3 @brief Angbandゲームエンジン / Angband game engine
6 Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 This software may be copied and distributed for educational, research, and\n
8 not for profit purposes provided that this copyright and statement are\n
9 included in all such copies.\n
10 2013 Deskull rearranged comment for Doxygen.
15 #include "cmd-activate.h"
17 #include "cmd-hissatsu.h"
19 #include "cmd-magiceat.h"
21 #include "cmd-quaff.h"
23 #include "cmd-smith.h"
24 #include "cmd-usestaff.h"
25 #include "cmd-zaprod.h"
26 #include "cmd-zapwand.h"
28 #include "cmd-basic.h"
31 #include "floor-events.h"
33 #include "object-curse.h"
34 #include "object-flavor.h"
37 #include "spells-summon.h"
38 #include "spells-object.h"
39 #include "spells-status.h"
40 #include "spells-floor.h"
41 #include "monster-spell.h"
48 #include "player-move.h"
49 #include "player-status.h"
50 #include "cmd-spell.h"
51 #include "realm-hex.h"
52 #include "object-hook.h"
54 #include "monster-process.h"
55 #include "monster-status.h"
56 #include "monsterrace-hook.h"
57 #include "floor-save.h"
59 #include "view-mainwindow.h"
60 #include "dungeon-file.h"
62 #include "player-effects.h"
65 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
66 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
69 * @brief 擬似鑑定を実際に行い判定を反映する
70 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
71 * @param heavy 重度の擬似鑑定を行うならばTRUE
74 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
77 object_type *o_ptr = &inventory[slot];
78 GAME_TEXT o_name[MAX_NLEN];
80 /* We know about it already, do not tell us again */
81 if (o_ptr->ident & (IDENT_SENSE))return;
83 /* It is fully known, no information needed */
84 if (object_is_known(o_ptr)) return;
86 /* Check for a feeling */
87 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
89 /* Skip non-feelings */
93 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
104 feel = FEEL_EXCELLENT;
110 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
112 feel = FEEL_UNCURSED;
117 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
123 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
130 feel = FEEL_WORTHLESS;
135 feel = FEEL_TERRIBLE;
141 /* Stop everything */
142 if (disturb_minor) disturb(FALSE, FALSE);
144 /* Get an object description */
145 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
147 /* Message (equipment) */
148 if (slot >= INVEN_RARM)
151 msg_format("%s%s(%c)は%sという感じがする...",
152 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
154 msg_format("You feel the %s (%c) you are %s %s %s...",
155 o_name, index_to_label(slot), describe_use(slot),
156 ((o_ptr->number == 1) ? "is" : "are"),
157 game_inscriptions[feel]);
162 /* Message (inventory) */
166 msg_format("ザックの中の%s(%c)は%sという感じがする...",
167 o_name, index_to_label(slot),game_inscriptions[feel]);
169 msg_format("You feel the %s (%c) in your pack %s %s...",
170 o_name, index_to_label(slot),
171 ((o_ptr->number == 1) ? "is" : "are"),
172 game_inscriptions[feel]);
177 o_ptr->ident |= (IDENT_SENSE);
179 /* Set the "inscription" */
180 o_ptr->feeling = feel;
182 /* Auto-inscription/destroy */
183 autopick_alter_item(slot, destroy_feeling);
184 p_ptr->update |= (PU_COMBINE | PU_REORDER);
186 p_ptr->window |= (PW_INVEN | PW_EQUIP);
192 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
195 * Sense the inventory\n
197 * Class 0 = Warrior --> fast and heavy\n
198 * Class 1 = Mage --> slow and light\n
199 * Class 2 = Priest --> fast but light\n
200 * Class 3 = Rogue --> okay and heavy\n
201 * Class 4 = Ranger --> slow but heavy (changed!)\n
202 * Class 5 = Paladin --> slow but heavy\n
204 static void sense_inventory1(void)
207 PLAYER_LEVEL plev = p_ptr->lev;
212 /*** Check for "sensing" ***/
214 /* No sensing when confused */
215 if (p_ptr->confused) return;
217 /* Analyze the class */
218 switch (p_ptr->pclass)
226 if (0 != randint0(9000L / (plev * plev + 40))) return;
237 if (0 != randint0(6000L / (plev * plev + 50))) return;
246 case CLASS_HIGH_MAGE:
248 case CLASS_MAGIC_EATER:
250 /* Very bad (light) sensing */
251 if (0 != randint0(240000L / (plev + 5))) return;
259 /* Good (light) sensing */
260 if (0 != randint0(10000L / (plev * plev + 40))) return;
269 if (0 != randint0(20000L / (plev * plev + 40))) return;
280 if (0 != randint0(95000L / (plev * plev + 40))) return;
292 if (0 != randint0(77777L / (plev * plev + 40))) return;
300 case CLASS_WARRIOR_MAGE:
304 if (0 != randint0(75000L / (plev * plev + 40))) return;
309 case CLASS_MINDCRAFTER:
311 case CLASS_BLUE_MAGE:
312 case CLASS_MIRROR_MASTER:
315 if (0 != randint0(55000L / (plev * plev + 40))) return;
320 case CLASS_CHAOS_WARRIOR:
323 if (0 != randint0(80000L / (plev * plev + 40))) return;
332 case CLASS_FORCETRAINER:
335 if (0 != randint0(20000L / (plev * plev + 40))) return;
343 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
351 case CLASS_BEASTMASTER:
354 if (0 != randint0(65000L / (plev * plev + 40))) return;
358 case CLASS_BERSERKER:
367 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
369 /*** Sense everything ***/
371 /* Check everything */
372 for (i = 0; i < INVEN_TOTAL; i++)
376 o_ptr = &inventory[i];
378 /* Skip empty slots */
379 if (!o_ptr->k_idx) continue;
381 /* Valid "tval" codes */
408 /* Skip non-sense machines */
411 /* Occasional failure on inventory items */
412 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
415 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
420 sense_inventory_aux(i, heavy);
425 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
428 static void sense_inventory2(void)
431 PLAYER_LEVEL plev = p_ptr->lev;
435 /*** Check for "sensing" ***/
437 /* No sensing when confused */
438 if (p_ptr->confused) return;
440 /* Analyze the class */
441 switch (p_ptr->pclass)
447 case CLASS_BERSERKER:
455 case CLASS_CHAOS_WARRIOR:
457 case CLASS_BEASTMASTER:
460 /* Very bad (light) sensing */
461 if (0 != randint0(240000L / (plev + 5))) return;
467 case CLASS_WARRIOR_MAGE:
472 if (0 != randint0(95000L / (plev * plev + 40))) return;
480 case CLASS_FORCETRAINER:
481 case CLASS_MINDCRAFTER:
484 if (0 != randint0(20000L / (plev * plev + 40))) return;
490 case CLASS_HIGH_MAGE:
492 case CLASS_MAGIC_EATER:
493 case CLASS_MIRROR_MASTER:
494 case CLASS_BLUE_MAGE:
497 if (0 != randint0(9000L / (plev * plev + 40))) return;
505 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
511 /*** Sense everything ***/
513 /* Check everything */
514 for (i = 0; i < INVEN_TOTAL; i++)
518 o_ptr = &inventory[i];
520 /* Skip empty slots */
521 if (!o_ptr->k_idx) continue;
523 /* Valid "tval" codes */
536 /* Skip non-sense machines */
539 /* Occasional failure on inventory items */
540 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
542 sense_inventory_aux(i, TRUE);
547 * @brief パターン終点到達時のテレポート処理を行う
550 static void pattern_teleport(void)
553 DEPTH max_level = 99;
556 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
561 /* Only downward in ironman mode */
562 if (ironman_downward)
563 min_level = current_floor_ptr->dun_level;
566 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
568 if (current_floor_ptr->dun_level > 100)
569 max_level = MAX_DEPTH - 1;
570 else if (current_floor_ptr->dun_level == 100)
575 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
576 min_level = d_info[p_ptr->dungeon_idx].mindepth;
580 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
583 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
585 /* Ask for a level */
586 if (!get_string(ppp, tmp_val, 10)) return;
588 /* Extract request */
589 command_arg = (COMMAND_ARG)atoi(tmp_val);
591 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
593 teleport_player(200, 0L);
600 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
601 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
604 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
606 if (autosave_l) do_cmd_save_game(TRUE);
609 current_floor_ptr->dun_level = command_arg;
613 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
615 p_ptr->inside_quest = 0;
619 * Clear all saved floors
620 * and create a first saved floor
622 prepare_change_floor_mode(CFM_FIRST_FLOOR);
623 p_ptr->leaving = TRUE;
627 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
628 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
630 static bool pattern_effect(void)
634 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
636 if ((prace_is_(RACE_AMBERITE)) &&
637 (p_ptr->cut > 0) && one_in_(10))
642 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
644 switch (pattern_type)
646 case PATTERN_TILE_END:
648 (void)restore_all_status();
649 (void)restore_level();
650 (void)cure_critical_wounds(1000);
652 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
653 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
656 * We could make the healing effect of the
657 * Pattern center one-time only to avoid various kinds
658 * of abuse, like luring the win monster into fighting you
659 * in the middle of the pattern...
663 case PATTERN_TILE_OLD:
667 case PATTERN_TILE_TELEPORT:
671 case PATTERN_TILE_WRECKED:
673 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
677 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
679 else if (!IS_INVULN())
680 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
689 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
690 * @param percent 回復比率
693 static void regenhp(int percent)
699 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
700 if (p_ptr->action == ACTION_HAYAGAKE) return;
702 /* Save the old hitpoints */
703 old_chp = p_ptr->chp;
706 * Extract the new hitpoints
708 * 'percent' is the Regen factor in unit (1/2^16)
711 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
713 /* Convert the unit (1/2^16) to (1/2^32) */
714 s64b_LSHIFT(new_chp, new_chp_frac, 16);
717 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
721 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
723 p_ptr->chp = p_ptr->mhp;
728 if (old_chp != p_ptr->chp)
730 p_ptr->redraw |= (PR_HP);
731 p_ptr->window |= (PW_PLAYER);
738 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
739 * @param upkeep_factor ペット維持によるMPコスト量
740 * @param regen_amount 回復量
743 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
745 MANA_POINT old_csp = p_ptr->csp;
746 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
749 * Excess mana will decay 32 times faster than normal
752 if (p_ptr->csp > p_ptr->msp)
754 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
756 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
758 /* Convert the unit (1/2^16) to (1/2^32) */
759 s64b_LSHIFT(decay, decay_frac, 16);
762 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
765 if (p_ptr->csp < p_ptr->msp)
767 p_ptr->csp = p_ptr->msp;
772 /* Regenerating mana (unless the player has excess mana) */
773 else if (regen_rate > 0)
775 /* (percent/100) is the Regen factor in unit (1/2^16) */
776 MANA_POINT new_mana = 0;
777 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
779 /* Convert the unit (1/2^16) to (1/2^32) */
780 s64b_LSHIFT(new_mana, new_mana_frac, 16);
783 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
785 /* Must set frac to zero even if equal */
786 if (p_ptr->csp >= p_ptr->msp)
788 p_ptr->csp = p_ptr->msp;
794 /* Reduce mana (even when the player has excess mana) */
797 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
798 s32b reduce_mana = 0;
799 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
801 /* Convert the unit (1/2^16) to (1/2^32) */
802 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
805 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
815 if (old_csp != p_ptr->csp)
817 p_ptr->redraw |= (PR_MANA);
818 p_ptr->window |= (PW_PLAYER);
819 p_ptr->window |= (PW_SPELL);
825 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
826 * @param regen_amount 回復量
829 static void regenmagic(int regen_amount)
834 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
836 for (i = 0; i < EATER_EXT*2; i++)
838 if (!p_ptr->magic_num2[i]) continue;
839 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
841 /* Increase remaining charge number like float value */
842 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
843 p_ptr->magic_num1[i] += new_mana;
845 /* Check maximum charge */
846 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
848 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
852 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
854 if (!p_ptr->magic_num1[i]) continue;
855 if (!p_ptr->magic_num2[i]) continue;
857 /* Decrease remaining period for charging */
858 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
859 / (dev * 16 * PY_REGEN_NORMAL);
860 p_ptr->magic_num1[i] -= new_mana;
862 /* Check minimum remaining period for charging */
863 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
870 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
872 * @note Should probably be done during monster turns.
874 static void regen_monsters(void)
879 /* Regenerate everyone */
880 for (i = 1; i < m_max; i++)
882 /* Check the i'th monster */
883 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
884 monster_race *r_ptr = &r_info[m_ptr->r_idx];
886 if (!monster_is_valid(m_ptr)) continue;
888 /* Allow regeneration (if needed) */
889 if (m_ptr->hp < m_ptr->maxhp)
891 /* Hack -- Base regeneration */
892 frac = m_ptr->maxhp / 100;
894 /* Hack -- Minimal regeneration rate */
895 if (!frac) if (one_in_(2)) frac = 1;
897 /* Hack -- Some monsters regenerate quickly */
898 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
900 /* Hack -- Regenerate */
903 /* Do not over-regenerate */
904 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
906 /* Redraw (later) if needed */
907 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
908 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
915 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
917 * @note Should probably be done during monster turns.
919 static void regen_captured_monsters(void)
924 /* Regenerate everyone */
925 for (i = 0; i < INVEN_TOTAL; i++)
928 object_type *o_ptr = &inventory[i];
930 if (!o_ptr->k_idx) continue;
931 if (o_ptr->tval != TV_CAPTURE) continue;
932 if (!o_ptr->pval) continue;
936 r_ptr = &r_info[o_ptr->pval];
938 /* Allow regeneration (if needed) */
939 if (o_ptr->xtra4 < o_ptr->xtra5)
941 /* Hack -- Base regeneration */
942 frac = o_ptr->xtra5 / 100;
944 /* Hack -- Minimal regeneration rate */
945 if (!frac) if (one_in_(2)) frac = 1;
947 /* Hack -- Some monsters regenerate quickly */
948 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
950 /* Hack -- Regenerate */
951 o_ptr->xtra4 += (XTRA16)frac;
953 /* Do not over-regenerate */
954 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
961 p_ptr->update |= (PU_COMBINE);
962 p_ptr->window |= (PW_INVEN);
963 p_ptr->window |= (PW_EQUIP);
969 * @brief 寿命つき光源の警告メッセージ処理
970 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
973 static void notice_lite_change(object_type *o_ptr)
975 /* Hack -- notice interesting fuel steps */
976 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
978 p_ptr->window |= (PW_EQUIP);
981 /* Hack -- Special treatment when blind */
984 /* Hack -- save some light for later */
985 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
988 /* The light is now out */
989 else if (o_ptr->xtra4 == 0)
991 disturb(FALSE, TRUE);
992 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
994 /* Recalculate torch radius */
995 p_ptr->update |= (PU_TORCH);
997 /* Some ego light lose its effects without fuel */
998 p_ptr->update |= (PU_BONUS);
1001 /* The light is getting dim */
1002 else if (o_ptr->name2 == EGO_LITE_LONG)
1004 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1005 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1007 if (disturb_minor) disturb(FALSE, TRUE);
1008 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1012 /* The light is getting dim */
1013 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1015 if (disturb_minor) disturb(FALSE, TRUE);
1016 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1022 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1023 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1026 static void recharged_notice(object_type *o_ptr)
1028 GAME_TEXT o_name[MAX_NLEN];
1032 /* No inscription */
1033 if (!o_ptr->inscription) return;
1036 s = my_strchr(quark_str(o_ptr->inscription), '!');
1038 /* Process notification request. */
1041 /* Find another '!' */
1044 /* Describe (briefly) */
1045 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1047 /* Notify the player */
1049 msg_format("%sは再充填された。", o_name);
1051 if (o_ptr->number > 1)
1052 msg_format("Your %s are recharged.", o_name);
1054 msg_format("Your %s is recharged.", o_name);
1057 disturb(FALSE, FALSE);
1063 /* Keep looking for '!'s */
1064 s = my_strchr(s + 1, '!');
1069 * @brief プレイヤーの歌に関する継続処理
1072 static void check_music(void)
1074 const magic_type *s_ptr;
1076 MANA_POINT need_mana;
1077 u32b need_mana_frac;
1079 /* Music singed by player */
1080 if (p_ptr->pclass != CLASS_BARD) return;
1081 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1083 if (p_ptr->anti_magic)
1085 stop_singing(p_ptr);
1089 spell = SINGING_SONG_ID(p_ptr);
1090 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1092 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1096 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1098 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1100 stop_singing(p_ptr);
1105 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1107 p_ptr->redraw |= PR_MANA;
1108 if (INTERUPTING_SONG_EFFECT(p_ptr))
1110 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1111 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1112 msg_print(_("歌を再開した。", "You restart singing."));
1113 p_ptr->action = ACTION_SING;
1114 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1115 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1116 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1119 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1120 p_ptr->spell_exp[spell] += 5;
1121 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1122 { if (one_in_(2) && (current_floor_ptr->dun_level > 4) && ((current_floor_ptr->dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1123 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1124 { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && ((current_floor_ptr->dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1125 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1126 { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1128 /* Do any effects of continual song */
1129 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1133 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1134 * @param flag 探し出したい呪いフラグ配列
1135 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1138 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1141 int choices[INVEN_TOTAL-INVEN_RARM];
1144 /* Paranoia -- Player has no warning-item */
1145 if (!(p_ptr->cursed & flag)) return NULL;
1147 /* Search Inventry */
1148 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1150 object_type *o_ptr = &inventory[i];
1152 if (o_ptr->curse_flags & flag)
1154 choices[number] = i;
1157 else if ((flag == TRC_ADD_L_CURSE) ||
1158 (flag == TRC_ADD_H_CURSE) ||
1159 (flag == TRC_DRAIN_HP) ||
1160 (flag == TRC_DRAIN_MANA) ||
1161 (flag == TRC_CALL_ANIMAL) ||
1162 (flag == TRC_CALL_DEMON) ||
1163 (flag == TRC_CALL_DRAGON) ||
1164 (flag == TRC_CALL_UNDEAD) ||
1165 (flag == TRC_COWARDICE) ||
1166 (flag == TRC_LOW_MELEE) ||
1167 (flag == TRC_LOW_AC) ||
1168 (flag == TRC_LOW_MAGIC) ||
1169 (flag == TRC_FAST_DIGEST) ||
1170 (flag == TRC_SLOW_REGEN) )
1173 BIT_FLAGS flgs[TR_FLAG_SIZE];
1174 object_flags(o_ptr, flgs);
1177 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1178 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1179 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1180 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1181 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1182 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1183 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1184 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1185 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1186 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1187 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1188 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1189 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1190 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1193 if (have_flag(flgs, cf))
1195 choices[number] = i;
1201 /* Choice one of them */
1202 return (&inventory[choices[randint0(number)]]);
1205 static void process_world_aux_digestion(void)
1207 if (!p_ptr->inside_battle)
1209 /* Digest quickly when gorged */
1210 if (p_ptr->food >= PY_FOOD_MAX)
1212 /* Digest a lot of food */
1213 (void)set_food(p_ptr->food - 100);
1216 /* Digest normally -- Every 50 game turns */
1217 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1219 /* Basic digestion rate based on speed */
1220 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1222 /* Regeneration takes more food */
1223 if (p_ptr->regenerate)
1225 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1227 if (p_ptr->cursed & TRC_FAST_DIGEST)
1230 /* Slow digestion takes less food */
1231 if (p_ptr->slow_digest)
1234 /* Minimal digestion */
1235 if (digestion < 1) digestion = 1;
1236 /* Maximal digestion */
1237 if (digestion > 100) digestion = 100;
1239 /* Digest some food */
1240 (void)set_food(p_ptr->food - digestion);
1245 if ((p_ptr->food < PY_FOOD_FAINT))
1247 /* Faint occasionally */
1248 if (!p_ptr->paralyzed && (randint0(100) < 10))
1250 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1251 disturb(TRUE, TRUE);
1253 /* Hack -- faint (bypass free action) */
1254 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1257 /* Starve to death (slowly) */
1258 if (p_ptr->food < PY_FOOD_STARVE)
1260 /* Calculate damage */
1261 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1263 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1270 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1271 * / Handle timed damage and regeneration every 10 game turns
1274 static void process_world_aux_hp_and_sp(void)
1276 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1277 bool cave_no_regen = FALSE;
1278 int upkeep_factor = 0;
1280 /* Default regeneration */
1281 int regen_amount = PY_REGEN_NORMAL;
1284 /*** Damage over Time ***/
1286 /* Take damage from poison */
1287 if (p_ptr->poisoned && !IS_INVULN())
1289 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1292 /* Take damage from cuts */
1293 if (p_ptr->cut && !IS_INVULN())
1297 /* Mortal wound or Deep Gash */
1298 if (p_ptr->cut > 1000)
1303 else if (p_ptr->cut > 200)
1309 else if (p_ptr->cut > 100)
1314 else if (p_ptr->cut > 50)
1319 else if (p_ptr->cut > 25)
1324 else if (p_ptr->cut > 10)
1335 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1338 /* (Vampires) Take damage from sunlight */
1339 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1341 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1343 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1345 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1346 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1347 cave_no_regen = TRUE;
1351 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1352 !p_ptr->resist_lite)
1354 object_type * o_ptr = &inventory[INVEN_LITE];
1355 GAME_TEXT o_name [MAX_NLEN];
1356 char ouch [MAX_NLEN+40];
1358 /* Get an object description */
1359 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1360 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1362 cave_no_regen = TRUE;
1364 /* Get an object description */
1365 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1366 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1368 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1372 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1376 if (have_flag(f_ptr->flags, FF_DEEP))
1378 damage = 6000 + randint0(4000);
1380 else if (!p_ptr->levitation)
1382 damage = 3000 + randint0(2000);
1387 if(prace_is_(RACE_ENT)) damage += damage / 3;
1388 if(p_ptr->resist_fire) damage = damage / 3;
1389 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1390 if(p_ptr->levitation) damage = damage / 5;
1392 damage = damage / 100 + (randint0(100) < (damage % 100));
1394 if (p_ptr->levitation)
1396 msg_print(_("熱で火傷した!", "The heat burns you!"));
1397 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1398 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1402 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1403 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1404 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1407 cave_no_regen = TRUE;
1411 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1415 if (have_flag(f_ptr->flags, FF_DEEP))
1417 damage = 6000 + randint0(4000);
1419 else if (!p_ptr->levitation)
1421 damage = 3000 + randint0(2000);
1426 if (p_ptr->resist_cold) damage = damage / 3;
1427 if (IS_OPPOSE_COLD()) damage = damage / 3;
1428 if (p_ptr->levitation) damage = damage / 5;
1430 damage = damage / 100 + (randint0(100) < (damage % 100));
1432 if (p_ptr->levitation)
1434 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1435 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1436 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1440 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1441 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1442 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1445 cave_no_regen = TRUE;
1449 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1453 if (have_flag(f_ptr->flags, FF_DEEP))
1455 damage = 6000 + randint0(4000);
1457 else if (!p_ptr->levitation)
1459 damage = 3000 + randint0(2000);
1464 if (p_ptr->resist_elec) damage = damage / 3;
1465 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1466 if (p_ptr->levitation) damage = damage / 5;
1468 damage = damage / 100 + (randint0(100) < (damage % 100));
1470 if (p_ptr->levitation)
1472 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1473 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1474 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1478 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1479 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1480 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1483 cave_no_regen = TRUE;
1487 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1491 if (have_flag(f_ptr->flags, FF_DEEP))
1493 damage = 6000 + randint0(4000);
1495 else if (!p_ptr->levitation)
1497 damage = 3000 + randint0(2000);
1502 if (p_ptr->resist_acid) damage = damage / 3;
1503 if (IS_OPPOSE_ACID()) damage = damage / 3;
1504 if (p_ptr->levitation) damage = damage / 5;
1506 damage = damage / 100 + (randint0(100) < (damage % 100));
1508 if (p_ptr->levitation)
1510 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1511 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1512 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1516 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1517 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1518 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1521 cave_no_regen = TRUE;
1525 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1529 if (have_flag(f_ptr->flags, FF_DEEP))
1531 damage = 6000 + randint0(4000);
1533 else if (!p_ptr->levitation)
1535 damage = 3000 + randint0(2000);
1540 if (p_ptr->resist_pois) damage = damage / 3;
1541 if (IS_OPPOSE_POIS()) damage = damage / 3;
1542 if (p_ptr->levitation) damage = damage / 5;
1544 damage = damage / 100 + (randint0(100) < (damage % 100));
1546 if (p_ptr->levitation)
1548 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1549 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1550 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1551 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1555 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1556 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1557 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1558 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1561 cave_no_regen = TRUE;
1565 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1566 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1568 if (p_ptr->total_weight > weight_limit())
1570 msg_print(_("溺れている!", "You are drowning!"));
1571 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1572 cave_no_regen = TRUE;
1579 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1581 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1582 if (prace_is_(RACE_ENT)) damage += damage / 3;
1583 if (p_ptr->resist_fire) damage = damage / 3;
1584 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1585 msg_print(_("熱い!", "It's hot!"));
1586 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1588 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1590 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1591 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1592 if (p_ptr->resist_elec) damage = damage / 3;
1593 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1594 msg_print(_("痛い!", "It hurts!"));
1595 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1597 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1599 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1600 if (p_ptr->resist_cold) damage = damage / 3;
1601 if (IS_OPPOSE_COLD()) damage = damage / 3;
1602 msg_print(_("冷たい!", "It's cold!"));
1603 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1607 /* Spectres -- take damage when moving through walls */
1609 * Added: ANYBODY takes damage if inside through walls
1610 * without wraith form -- NOTE: Spectres will never be
1611 * reduced below 0 hp by being inside a stone wall; others
1614 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1616 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1619 cave_no_regen = TRUE;
1621 if (p_ptr->pass_wall)
1623 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1624 dam_desc = _("密度", "density");
1628 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1629 dam_desc = _("硬い岩", "solid rock");
1632 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1637 /*** handle regeneration ***/
1640 if (p_ptr->food < PY_FOOD_WEAK)
1642 /* Lower regeneration */
1643 if (p_ptr->food < PY_FOOD_STARVE)
1647 else if (p_ptr->food < PY_FOOD_FAINT)
1649 regen_amount = PY_REGEN_FAINT;
1653 regen_amount = PY_REGEN_WEAK;
1657 /* Are we walking the pattern? */
1658 if (pattern_effect())
1660 cave_no_regen = TRUE;
1664 /* Regeneration ability */
1665 if (p_ptr->regenerate)
1667 regen_amount = regen_amount * 2;
1669 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1673 if (p_ptr->cursed & TRC_SLOW_REGEN)
1680 /* Searching or Resting */
1681 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1683 regen_amount = regen_amount * 2;
1686 upkeep_factor = calculate_upkeep();
1688 /* No regeneration while special action */
1689 if ((p_ptr->action == ACTION_LEARN) ||
1690 (p_ptr->action == ACTION_HAYAGAKE) ||
1691 (p_ptr->special_defense & KATA_KOUKIJIN))
1693 upkeep_factor += 100;
1696 /* Regenerate the mana */
1697 regenmana(upkeep_factor, regen_amount);
1700 /* Recharge magic eater's power */
1701 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1703 regenmagic(regen_amount);
1706 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1708 while (upkeep_factor > 100)
1710 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1712 do_cmd_pet_dismiss();
1714 upkeep_factor = calculate_upkeep();
1716 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1721 /* Poisoned or cut yields no healing */
1722 if (p_ptr->poisoned) regen_amount = 0;
1723 if (p_ptr->cut) regen_amount = 0;
1725 /* Special floor -- Pattern, in a wall -- yields no healing */
1726 if (cave_no_regen) regen_amount = 0;
1728 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1730 /* Regenerate Hit Points if needed */
1731 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1733 regenhp(regen_amount);
1738 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1739 * / Handle timeout every 10 game turns
1742 static void process_world_aux_timeout(void)
1744 const int dec_count = (easy_band ? 2 : 1);
1746 /*** Timeout Various Things ***/
1749 if (p_ptr->tim_mimic)
1751 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1754 /* Hack -- Hallucinating */
1757 (void)set_image(p_ptr->image - dec_count);
1763 (void)set_blind(p_ptr->blind - dec_count);
1766 /* Times see-invisible */
1767 if (p_ptr->tim_invis)
1769 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1780 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1783 /* Timed temporary elemental brands. -LM- */
1784 if (p_ptr->ele_attack)
1786 p_ptr->ele_attack--;
1788 /* Clear all temporary elemental brands. */
1789 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1792 /* Timed temporary elemental immune. -LM- */
1793 if (p_ptr->ele_immune)
1795 p_ptr->ele_immune--;
1797 /* Clear all temporary elemental brands. */
1798 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1801 /* Timed infra-vision */
1802 if (p_ptr->tim_infra)
1804 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1808 if (p_ptr->tim_stealth)
1810 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1813 /* Timed levitation */
1814 if (p_ptr->tim_levitation)
1816 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1819 /* Timed sh_touki */
1820 if (p_ptr->tim_sh_touki)
1822 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1826 if (p_ptr->tim_sh_fire)
1828 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1832 if (p_ptr->tim_sh_holy)
1834 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1838 if (p_ptr->tim_eyeeye)
1840 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1843 /* Timed resist-magic */
1844 if (p_ptr->resist_magic)
1846 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1849 /* Timed regeneration */
1850 if (p_ptr->tim_regen)
1852 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1855 /* Timed resist nether */
1856 if (p_ptr->tim_res_nether)
1858 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1861 /* Timed resist time */
1862 if (p_ptr->tim_res_time)
1864 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1868 if (p_ptr->tim_reflect)
1870 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1874 if (p_ptr->multishadow)
1876 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1879 /* Timed Robe of dust */
1880 if (p_ptr->dustrobe)
1882 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1885 /* Timed infra-vision */
1886 if (p_ptr->kabenuke)
1888 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1892 if (p_ptr->paralyzed)
1894 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1898 if (p_ptr->confused)
1900 (void)set_confused(p_ptr->confused - dec_count);
1906 (void)set_afraid(p_ptr->afraid - dec_count);
1912 (void)set_fast(p_ptr->fast - 1, TRUE);
1918 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1921 /* Protection from evil */
1922 if (p_ptr->protevil)
1924 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1927 /* Invulnerability */
1930 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1934 if (p_ptr->wraith_form)
1936 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1942 (void)set_hero(p_ptr->hero - 1, TRUE);
1948 (void)set_shero(p_ptr->shero - 1, TRUE);
1954 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1960 (void)set_shield(p_ptr->shield - 1, TRUE);
1964 if (p_ptr->tsubureru)
1966 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1970 if (p_ptr->magicdef)
1972 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1976 if (p_ptr->tsuyoshi)
1978 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1982 if (p_ptr->oppose_acid)
1984 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1987 /* Oppose Lightning */
1988 if (p_ptr->oppose_elec)
1990 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
1994 if (p_ptr->oppose_fire)
1996 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2000 if (p_ptr->oppose_cold)
2002 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2006 if (p_ptr->oppose_pois)
2008 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2013 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2016 /*** Poison and Stun and Cut ***/
2019 if (p_ptr->poisoned)
2021 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2023 /* Apply some healing */
2024 (void)set_poisoned(p_ptr->poisoned - adjust);
2030 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2032 /* Apply some healing */
2033 (void)set_stun(p_ptr->stun - adjust);
2039 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2041 /* Hack -- Truly "mortal" wound */
2042 if (p_ptr->cut > 1000) adjust = 0;
2044 /* Apply some healing */
2045 (void)set_cut(p_ptr->cut - adjust);
2051 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2052 * / Handle burning fuel every 10 game turns
2055 static void process_world_aux_light(void)
2057 /* Check for light being wielded */
2058 object_type *o_ptr = &inventory[INVEN_LITE];
2060 /* Burn some fuel in the current lite */
2061 if (o_ptr->tval == TV_LITE)
2063 /* Hack -- Use some fuel (except on artifacts) */
2064 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2066 /* Decrease life-span */
2067 if (o_ptr->name2 == EGO_LITE_LONG)
2069 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2071 else o_ptr->xtra4--;
2073 /* Notice interesting fuel steps */
2074 notice_lite_change(o_ptr);
2081 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2082 * / Handle mutation effects once every 10 game turns
2085 static void process_world_aux_mutation(void)
2087 /* No mutation with effects */
2088 if (!p_ptr->muta2) return;
2090 /* No effect on monster arena */
2091 if (p_ptr->inside_battle) return;
2093 /* No effect on the global map */
2094 if (p_ptr->wild_mode) return;
2096 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2098 disturb(FALSE, TRUE);
2099 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2100 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2101 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2102 (void)set_afraid(0);
2105 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2107 if (!p_ptr->resist_fear)
2109 disturb(FALSE, TRUE);
2110 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2111 set_afraid(p_ptr->afraid + 13 + randint1(26));
2115 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2117 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2119 disturb(FALSE, TRUE);
2120 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2122 teleport_player(40, TELEPORT_PASSIVE);
2126 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2128 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2130 disturb(FALSE, TRUE);
2131 p_ptr->redraw |= PR_EXTRA;
2132 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2135 if (!p_ptr->resist_conf)
2137 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2140 if (!p_ptr->resist_chaos)
2145 if (one_in_(3)) lose_all_info();
2147 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2149 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2150 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2156 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2157 (void)set_image(p_ptr->image + randint0(150) + 150);
2163 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2165 if (!p_ptr->resist_chaos)
2167 disturb(FALSE, TRUE);
2168 p_ptr->redraw |= PR_EXTRA;
2169 (void)set_image(p_ptr->image + randint0(50) + 20);
2173 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2175 disturb(FALSE, TRUE);
2176 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2178 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2181 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2182 !p_ptr->anti_magic && one_in_(9000))
2185 disturb(FALSE, TRUE);
2186 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2187 "Magical energy flows through you! You must release it!"));
2191 (void)get_hack_dir(&dire);
2192 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2195 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2197 bool pet = one_in_(6);
2198 BIT_FLAGS mode = PM_ALLOW_GROUP;
2200 if (pet) mode |= PM_FORCE_PET;
2201 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2203 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2205 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2206 disturb(FALSE, TRUE);
2210 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2212 disturb(FALSE, TRUE);
2215 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2217 if (p_ptr->fast > 0)
2223 set_slow(randint1(30) + 10, FALSE);
2228 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2230 if (p_ptr->slow > 0)
2236 set_fast(randint1(30) + 10, FALSE);
2241 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2243 disturb(FALSE, TRUE);
2244 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2246 banish_monsters(100);
2247 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2251 /* Pick a random shop (except home) */
2254 n = randint0(MAX_STORES);
2256 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2258 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2264 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2268 msg_print(_("影につつまれた。", "A shadow passes over you."));
2271 /* Absorb light from the current possition */
2272 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2277 o_ptr = &inventory[INVEN_LITE];
2279 /* Absorb some fuel in the current lite */
2280 if (o_ptr->tval == TV_LITE)
2282 /* Use some fuel (except on artifacts) */
2283 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2285 /* Heal the player a bit */
2286 hp_player(o_ptr->xtra4 / 20);
2288 /* Decrease life-span of lite */
2290 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2292 /* Notice interesting fuel steps */
2293 notice_lite_change(o_ptr);
2298 * Unlite the area (radius 10) around player and
2299 * do 50 points damage to every affected monster
2301 unlite_area(50, 10);
2304 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2306 bool pet = one_in_(3);
2307 BIT_FLAGS mode = PM_ALLOW_GROUP;
2309 if (pet) mode |= PM_FORCE_PET;
2310 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2312 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2314 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2315 disturb(FALSE, TRUE);
2319 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2321 disturb(FALSE, TRUE);
2322 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2325 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2327 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2329 if (!lose_mutation(0))
2330 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2332 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2334 disturb(FALSE, TRUE);
2335 msg_print(_("非物質化した!", "You feel insubstantial!"));
2338 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2340 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2344 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2346 int which_stat = randint0(A_MAX);
2347 int sustained = FALSE;
2352 if (p_ptr->sustain_str) sustained = TRUE;
2355 if (p_ptr->sustain_int) sustained = TRUE;
2358 if (p_ptr->sustain_wis) sustained = TRUE;
2361 if (p_ptr->sustain_dex) sustained = TRUE;
2364 if (p_ptr->sustain_con) sustained = TRUE;
2367 if (p_ptr->sustain_chr) sustained = TRUE;
2370 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2376 disturb(FALSE, TRUE);
2377 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2379 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2382 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2384 bool pet = one_in_(5);
2385 BIT_FLAGS mode = PM_ALLOW_GROUP;
2387 if (pet) mode |= PM_FORCE_PET;
2388 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2390 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2392 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2393 disturb(FALSE, TRUE);
2396 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2398 if (p_ptr->tim_esp > 0)
2400 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2401 set_tim_esp(0, TRUE);
2405 msg_print(_("精神が広がった!", "Your mind expands!"));
2406 set_tim_esp(p_ptr->lev, FALSE);
2409 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2411 disturb(FALSE, TRUE);
2412 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2414 set_food(PY_FOOD_WEAK);
2415 if (music_singing_any()) stop_singing(p_ptr);
2416 if (hex_spelling_any()) stop_hex_spell_all();
2419 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2424 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2426 int danger_amount = 0;
2427 MONSTER_IDX monster;
2429 for (monster = 0; monster < m_max; monster++)
2431 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2432 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2433 if (!monster_is_valid(m_ptr)) continue;
2435 if (r_ptr->level >= p_ptr->lev)
2437 danger_amount += r_ptr->level - p_ptr->lev + 1;
2441 if (danger_amount > 100)
2442 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2443 else if (danger_amount > 50)
2444 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2445 else if (danger_amount > 20)
2446 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2447 else if (danger_amount > 10)
2448 msg_print(_("心配な気がする!", "You feel paranoid!"));
2449 else if (danger_amount > 5)
2450 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2452 msg_print(_("寂しい気がする。", "You feel lonely."));
2455 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2457 disturb(FALSE, TRUE);
2458 msg_print(_("無敵な気がする!", "You feel invincible!"));
2460 (void)set_invuln(randint1(8) + 8, FALSE);
2463 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2465 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2469 HIT_POINT healing = p_ptr->csp;
2470 if (healing > wounds) healing = wounds;
2473 p_ptr->csp -= healing;
2474 p_ptr->redraw |= (PR_HP | PR_MANA);
2478 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2480 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2484 HIT_POINT healing = p_ptr->chp;
2485 if (healing > wounds) healing = wounds;
2487 p_ptr->csp += healing;
2488 p_ptr->redraw |= (PR_HP | PR_MANA);
2489 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2493 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2495 INVENTORY_IDX slot = 0;
2496 object_type *o_ptr = NULL;
2498 disturb(FALSE, TRUE);
2499 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2500 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2503 if (has_melee_weapon(INVEN_RARM))
2506 o_ptr = &inventory[INVEN_RARM];
2508 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2510 o_ptr = &inventory[INVEN_LARM];
2514 else if (has_melee_weapon(INVEN_LARM))
2516 o_ptr = &inventory[INVEN_LARM];
2519 if (slot && !object_is_cursed(o_ptr))
2521 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2522 inven_drop(slot, 1);
2529 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2530 * / Handle curse effects once every 10 game turns
2533 static void process_world_aux_curse(void)
2535 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2538 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2539 * can actually be useful!
2541 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2543 GAME_TEXT o_name[MAX_NLEN];
2545 int i, i_keep = 0, count = 0;
2547 /* Scan the equipment with random teleport ability */
2548 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2550 BIT_FLAGS flgs[TR_FLAG_SIZE];
2551 o_ptr = &inventory[i];
2553 /* Skip non-objects */
2554 if (!o_ptr->k_idx) continue;
2556 /* Extract the item flags */
2557 object_flags(o_ptr, flgs);
2559 if (have_flag(flgs, TR_TELEPORT))
2561 /* {.} will stop random teleportation. */
2562 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2565 if (one_in_(count)) i_keep = i;
2570 o_ptr = &inventory[i_keep];
2571 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2572 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2573 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2575 disturb(FALSE, TRUE);
2576 teleport_player(50, 0L);
2580 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2581 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2582 disturb(TRUE, TRUE);
2585 /* Make a chainsword noise */
2586 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2589 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2591 disturb(FALSE, FALSE);
2594 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2597 (void)activate_ty_curse(FALSE, &count);
2599 /* Handle experience draining */
2600 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2602 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2603 if (p_ptr->exp < 0) p_ptr->exp = 0;
2604 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2605 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2608 /* Add light curse (Later) */
2609 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2611 BIT_FLAGS new_curse;
2614 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2616 new_curse = get_curse(0, o_ptr);
2617 if (!(o_ptr->curse_flags & new_curse))
2619 GAME_TEXT o_name[MAX_NLEN];
2621 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2623 o_ptr->curse_flags |= new_curse;
2624 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2626 o_ptr->feeling = FEEL_NONE;
2628 p_ptr->update |= (PU_BONUS);
2631 /* Add heavy curse (Later) */
2632 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2634 BIT_FLAGS new_curse;
2637 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2639 new_curse = get_curse(1, o_ptr);
2640 if (!(o_ptr->curse_flags & new_curse))
2642 GAME_TEXT o_name[MAX_NLEN];
2644 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2646 o_ptr->curse_flags |= new_curse;
2647 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2648 o_ptr->feeling = FEEL_NONE;
2650 p_ptr->update |= (PU_BONUS);
2654 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2656 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2658 GAME_TEXT o_name[MAX_NLEN];
2660 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2661 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2662 disturb(FALSE, TRUE);
2666 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2668 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2670 GAME_TEXT o_name[MAX_NLEN];
2672 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2673 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2674 disturb(FALSE, TRUE);
2678 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2680 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2681 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2683 GAME_TEXT o_name[MAX_NLEN];
2685 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2686 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2687 disturb(FALSE, TRUE);
2691 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2693 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2694 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2696 GAME_TEXT o_name[MAX_NLEN];
2698 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2699 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2700 disturb(FALSE, TRUE);
2703 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2705 if (!p_ptr->resist_fear)
2707 disturb(FALSE, TRUE);
2708 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2709 set_afraid(p_ptr->afraid + 13 + randint1(26));
2712 /* Teleport player */
2713 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2715 disturb(FALSE, TRUE);
2717 /* Teleport player */
2718 teleport_player(40, TELEPORT_PASSIVE);
2720 /* Handle HP draining */
2721 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2723 GAME_TEXT o_name[MAX_NLEN];
2725 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2726 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2727 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2729 /* Handle mana draining */
2730 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2732 GAME_TEXT o_name[MAX_NLEN];
2734 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2735 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2736 p_ptr->csp -= MIN(p_ptr->lev, 50);
2740 p_ptr->csp_frac = 0;
2742 p_ptr->redraw |= PR_MANA;
2746 /* Rarely, take damage from the Jewel of Judgement */
2747 if (one_in_(999) && !p_ptr->anti_magic)
2749 object_type *o_ptr = &inventory[INVEN_LITE];
2751 if (o_ptr->name1 == ART_JUDGE)
2753 if (object_is_known(o_ptr))
2754 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2756 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2757 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2764 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2765 * / Handle recharging objects once every 10 game turns
2768 static void process_world_aux_recharge(void)
2773 /* Process equipment */
2774 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2776 /* Get the object */
2777 object_type *o_ptr = &inventory[i];
2779 /* Skip non-objects */
2780 if (!o_ptr->k_idx) continue;
2782 /* Recharge activatable objects */
2783 if (o_ptr->timeout > 0)
2788 /* Notice changes */
2789 if (!o_ptr->timeout)
2791 recharged_notice(o_ptr);
2797 /* Notice changes */
2800 p_ptr->window |= (PW_EQUIP);
2805 * Recharge rods. Rods now use timeout to control charging status,
2806 * and each charging rod in a stack decreases the stack's timeout by
2807 * one per current_world_ptr->game_turn. -LM-
2809 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2811 object_type *o_ptr = &inventory[i];
2812 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2814 /* Skip non-objects */
2815 if (!o_ptr->k_idx) continue;
2817 /* Examine all charging rods or stacks of charging rods. */
2818 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2820 /* Determine how many rods are charging. */
2821 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2822 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2824 /* Decrease timeout by that number. */
2825 o_ptr->timeout -= temp;
2827 /* Boundary control. */
2828 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2830 /* Notice changes, provide message if object is inscribed. */
2831 if (!(o_ptr->timeout))
2833 recharged_notice(o_ptr);
2837 /* One of the stack of rod is charged */
2838 else if (o_ptr->timeout % k_ptr->pval)
2845 /* Notice changes */
2848 p_ptr->window |= (PW_INVEN);
2852 /* Process objects on floor */
2853 for (i = 1; i < o_max; i++)
2855 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2857 /* Skip dead objects */
2858 if (!o_ptr->k_idx) continue;
2860 /* Recharge rods on the ground. No messages. */
2861 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2864 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2866 /* Boundary control. */
2867 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2874 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2875 * / Handle involuntary movement once every 10 game turns
2878 static void process_world_aux_movement(void)
2880 /* Delayed Word-of-Recall */
2881 if (p_ptr->word_recall)
2884 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2885 * The player is yanked up/down as soon as
2886 * he loads the autosaved game.
2888 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2889 do_cmd_save_game(TRUE);
2891 /* Count down towards recall */
2892 p_ptr->word_recall--;
2894 p_ptr->redraw |= (PR_STATUS);
2896 /* Activate the recall */
2897 if (!p_ptr->word_recall)
2900 disturb(FALSE, TRUE);
2902 /* Determine the level */
2903 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2905 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2907 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2909 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2911 current_floor_ptr->dun_level = 0;
2912 p_ptr->dungeon_idx = 0;
2914 leave_quest_check();
2915 leave_tower_check();
2917 p_ptr->inside_quest = 0;
2919 p_ptr->leaving = TRUE;
2923 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2925 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2928 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2931 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2932 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2934 /* Nightmare mode makes recall more dangerous */
2935 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2937 if (current_floor_ptr->dun_level < 50)
2939 current_floor_ptr->dun_level *= 2;
2941 else if (current_floor_ptr->dun_level < 99)
2943 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2945 else if (current_floor_ptr->dun_level > 100)
2947 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2951 if (p_ptr->wild_mode)
2953 p_ptr->wilderness_y = p_ptr->y;
2954 p_ptr->wilderness_x = p_ptr->x;
2958 /* Save player position */
2959 p_ptr->oldpx = p_ptr->x;
2960 p_ptr->oldpy = p_ptr->y;
2962 p_ptr->wild_mode = FALSE;
2965 * Clear all saved floors
2966 * and create a first saved floor
2968 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2969 p_ptr->leaving = TRUE;
2971 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2975 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2977 quest_type* const q_ptr = &quest[i];
2980 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2981 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2982 (q_ptr->level < current_floor_ptr->dun_level))
2984 q_ptr->status = QUEST_STATUS_FAILED;
2985 q_ptr->complev = (byte)p_ptr->lev;
2987 q_ptr->comptime = current_world_ptr->play_time;
2988 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2994 sound(SOUND_TPLEVEL);
2999 /* Delayed Alter reality */
3000 if (p_ptr->alter_reality)
3002 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3003 do_cmd_save_game(TRUE);
3005 /* Count down towards alter */
3006 p_ptr->alter_reality--;
3008 p_ptr->redraw |= (PR_STATUS);
3010 /* Activate the alter reality */
3011 if (!p_ptr->alter_reality)
3014 disturb(FALSE, TRUE);
3016 /* Determine the level */
3017 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3019 msg_print(_("世界が変わった!", "The world changes!"));
3022 * Clear all saved floors
3023 * and create a first saved floor
3025 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3026 p_ptr->leaving = TRUE;
3030 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3033 sound(SOUND_TPLEVEL);
3039 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3040 * / Handle certain things once every 10 game turns
3043 static void process_world(void)
3047 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3048 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3049 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3051 extract_day_hour_min(&day, &hour, &min);
3053 /* Update dungeon feeling, and announce it if changed */
3054 update_dungeon_feeling();
3056 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3057 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3059 current_floor_ptr->dun_level = 0;
3060 p_ptr->dungeon_idx = 0;
3061 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3062 p_ptr->inside_arena = FALSE;
3063 p_ptr->wild_mode = FALSE;
3064 p_ptr->leaving = TRUE;
3067 /*** Check monster arena ***/
3068 if (p_ptr->inside_battle && !p_ptr->leaving)
3074 /* Count all hostile monsters */
3075 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3076 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3078 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3080 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3083 win_m_idx = g_ptr->m_idx;
3087 if (number_mon == 0)
3089 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3091 p_ptr->energy_need = 0;
3092 update_gambling_monsters();
3094 else if ((number_mon-1) == 0)
3096 GAME_TEXT m_name[MAX_NLEN];
3097 monster_type *wm_ptr;
3099 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3101 monster_desc(m_name, wm_ptr, 0);
3102 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3105 if (win_m_idx == (sel_monster+1))
3107 msg_print(_("おめでとうございます。", "Congratulations."));
3108 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3109 p_ptr->au += battle_odds;
3113 msg_print(_("残念でした。", "You lost gold."));
3116 p_ptr->energy_need = 0;
3117 update_gambling_monsters();
3119 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3121 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3122 p_ptr->au += kakekin;
3124 p_ptr->energy_need = 0;
3125 update_gambling_monsters();
3129 /* Every 10 game turns */
3130 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3132 /*** Check the Time and Load ***/
3134 if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
3136 /* Check time and load */
3137 if ((0 != check_time()) || (0 != check_load()))
3140 if (closing_flag <= 2)
3142 disturb(FALSE, TRUE);
3144 /* Count warnings */
3147 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3148 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3155 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3158 p_ptr->playing = FALSE;
3159 p_ptr->leaving = TRUE;
3164 /*** Attempt timed autosave ***/
3165 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3167 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3168 do_cmd_save_game(TRUE);
3171 if (mon_fight && !ignore_unview)
3173 msg_print(_("何かが聞こえた。", "You hear noise."));
3176 /*** Handle the wilderness/town (sunshine) ***/
3178 /* While in town/wilderness */
3179 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3181 /* Hack -- Daybreak/Nighfall in town */
3182 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3186 /* Check for dawn */
3187 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3189 if (dawn) day_break();
3195 /* While in the dungeon (vanilla_town or lite_town mode only) */
3196 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3198 /*** Shuffle the Storekeepers ***/
3200 /* Chance is only once a day (while in dungeon) */
3201 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3203 /* Sometimes, shuffle the shop-keepers */
3204 if (one_in_(STORE_SHUFFLE))
3209 /* Pick a random shop (except home and museum) */
3212 n = randint0(MAX_STORES);
3214 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3216 /* Check every feature */
3217 for (i = 1; i < max_f_idx; i++)
3219 feature_type *f_ptr = &f_info[i];
3221 /* Skip empty index */
3222 if (!f_ptr->name) continue;
3224 /* Skip non-store features */
3225 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3227 /* Verify store type */
3228 if (f_ptr->subtype == n)
3230 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3243 /*** Process the monsters ***/
3245 /* Check for creature generation. */
3246 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3247 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3249 /* Make a new monster */
3250 (void)alloc_monster(MAX_SIGHT + 5, 0);
3253 /* Hack -- Check for creature regeneration */
3254 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3255 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3257 if (!p_ptr->leaving)
3261 /* Hack -- Process the counters of monsters if needed */
3262 for (i = 0; i < MAX_MTIMED; i++)
3264 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3272 if (min != prev_min)
3274 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3275 determine_today_mon(FALSE);
3280 * Nightmare mode activates the TY_CURSE at midnight
3281 * Require exact minute -- Don't activate multiple times in a minute
3284 if (ironman_nightmare && (min != prev_min))
3287 /* Every 15 minutes after 11:00 pm */
3288 if ((hour == 23) && !(min % 15))
3290 disturb(FALSE, TRUE);
3295 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3299 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3303 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3307 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3312 /* TY_CURSE activates at midnight! */
3316 disturb(TRUE, TRUE);
3317 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3319 if (p_ptr->wild_mode)
3321 /* Go into large wilderness view */
3322 p_ptr->oldpy = randint1(MAX_HGT - 2);
3323 p_ptr->oldpx = randint1(MAX_WID - 2);
3326 /* Give first move to monsters */
3327 take_turn(p_ptr, 100);
3329 /* HACk -- set the encouter flag for the wilderness generation */
3330 generate_encounter = TRUE;
3333 invoking_midnight_curse = TRUE;
3339 /* Check the Food */
3340 process_world_aux_digestion();
3342 /* Process timed damage and regeneration */
3343 process_world_aux_hp_and_sp();
3345 /* Process timeout */
3346 process_world_aux_timeout();
3349 process_world_aux_light();
3351 /* Process mutation effects */
3352 process_world_aux_mutation();
3354 /* Process curse effects */
3355 process_world_aux_curse();
3357 /* Process recharging */
3358 process_world_aux_recharge();
3360 /* Feel the inventory */
3364 /* Involuntary Movement */
3365 process_world_aux_movement();
3369 * @brief ウィザードモードへの導入処理
3370 * / Verify use of "wizard" mode
3371 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3373 static bool enter_wizard_mode(void)
3375 /* Ask first time */
3376 if (!p_ptr->noscore)
3378 /* Wizard mode is not permitted */
3379 if (!allow_debug_opts || arg_wizard)
3381 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3385 /* Mention effects */
3386 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3387 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3390 /* Verify request */
3391 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3396 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3398 p_ptr->noscore |= 0x0002;
3409 * @brief デバッグコマンドへの導入処理
3410 * / Verify use of "debug" commands
3411 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3413 static bool enter_debug_mode(void)
3415 /* Ask first time */
3416 if (!p_ptr->noscore)
3418 /* Debug mode is not permitted */
3419 if (!allow_debug_opts)
3421 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3425 /* Mention effects */
3426 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3427 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3431 /* Verify request */
3432 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3437 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3439 p_ptr->noscore |= 0x0008;
3447 * Hack -- Declare the Debug Routines
3449 extern void do_cmd_debug(void);
3451 #endif /* ALLOW_WIZARD */
3457 * @brief ボーグコマンドへの導入処理
3458 * / Verify use of "borg" commands
3459 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3461 static bool enter_borg_mode(void)
3463 /* Ask first time */
3464 if (!(p_ptr->noscore & 0x0010))
3466 /* Mention effects */
3467 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3468 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3472 /* Verify request */
3473 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3478 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3480 p_ptr->noscore |= 0x0010;
3488 * Hack -- Declare the Ben Borg
3490 extern void do_cmd_borg(void);
3492 #endif /* ALLOW_BORG */
3496 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3497 * / Parse and execute the current command Give "Warning" on illegal commands.
3498 * @todo Make some "blocks"
3501 static void process_command(void)
3503 COMMAND_CODE old_now_message = now_message;
3505 /* Handle repeating the last command */
3511 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3512 reset_concent = TRUE;
3514 /* Parse the command */
3515 switch (command_cmd)
3531 /*** Wizard Commands ***/
3533 /* Toggle Wizard Mode */
3538 p_ptr->wizard = FALSE;
3539 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3541 else if (enter_wizard_mode())
3543 p_ptr->wizard = TRUE;
3544 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3546 p_ptr->update |= (PU_MONSTERS);
3548 /* Redraw "title" */
3549 p_ptr->redraw |= (PR_TITLE);
3557 /* Special "debug" commands */
3560 /* Enter debug mode */
3561 if (enter_debug_mode())
3568 #endif /* ALLOW_WIZARD */
3573 /* Special "borg" commands */
3576 /* Enter borg mode */
3577 if (enter_borg_mode())
3579 if (!p_ptr->wild_mode) do_cmd_borg();
3585 #endif /* ALLOW_BORG */
3589 /*** Inventory Commands ***/
3591 /* Wear/wield equipment */
3594 if (!p_ptr->wild_mode) do_cmd_wield();
3598 /* Take off equipment */
3601 if (!p_ptr->wild_mode) do_cmd_takeoff();
3608 if (!p_ptr->wild_mode) do_cmd_drop();
3612 /* Destroy an item */
3619 /* Equipment list */
3626 /* Inventory list */
3634 /*** Various commands ***/
3636 /* Identify an object */
3643 /* Hack -- toggle windows */
3646 toggle_inven_equip();
3651 /*** Standard "Movement" Commands ***/
3656 if (!p_ptr->wild_mode) do_cmd_alter();
3663 if (!p_ptr->wild_mode) do_cmd_tunnel();
3667 /* Move (usually pick up things) */
3674 /* Move (usually do not pick up) */
3682 /*** Running, Resting, Searching, Staying */
3684 /* Begin Running -- Arg is Max Distance */
3687 if (!p_ptr->wild_mode) do_cmd_run();
3691 /* Stay still (usually pick things up) */
3694 do_cmd_stay(always_pickup);
3698 /* Stay still (usually do not pick up) */
3701 do_cmd_stay(!always_pickup);
3705 /* Rest -- Arg is time */
3712 /* Search for traps/doors */
3719 /* Toggle search mode */
3722 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3723 else set_action(ACTION_SEARCH);
3728 /*** Stairs and Doors and Chests and Traps ***/
3731 case SPECIAL_KEY_STORE:
3737 /* Enter building -KMW- */
3738 case SPECIAL_KEY_BUILDING:
3744 /* Enter quest level -KMW- */
3745 case SPECIAL_KEY_QUEST:
3751 /* Go up staircase */
3754 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3756 if (vanilla_town) break;
3758 if (p_ptr->ambush_flag)
3760 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3764 if (p_ptr->food < PY_FOOD_WEAK)
3766 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3777 /* Go down staircase */
3780 if (p_ptr->wild_mode)
3787 /* Open a door or chest */
3801 /* Jam a door with spikes */
3815 /* Disarm a trap or chest */
3823 /*** Magic and Prayers ***/
3825 /* Gain new spells/prayers */
3828 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3829 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3830 else if (p_ptr->pclass == CLASS_SAMURAI)
3831 do_cmd_gain_hissatsu();
3832 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3833 import_magic_device();
3842 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3843 (p_ptr->pclass == CLASS_BERSERKER) ||
3844 (p_ptr->pclass == CLASS_NINJA) ||
3845 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3846 ) do_cmd_mind_browse();
3847 else if (p_ptr->pclass == CLASS_SMITH)
3849 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3850 do_cmd_magic_eater(TRUE, FALSE);
3851 else if (p_ptr->pclass == CLASS_SNIPER)
3852 do_cmd_snipe_browse();
3853 else do_cmd_browse();
3861 if (!p_ptr->wild_mode)
3863 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3865 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3867 else if (current_floor_ptr->dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3869 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3872 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3874 concptr which_power = _("魔法", "magic");
3875 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3876 which_power = _("超能力", "psionic powers");
3877 else if (p_ptr->pclass == CLASS_IMITATOR)
3878 which_power = _("ものまね", "imitation");
3879 else if (p_ptr->pclass == CLASS_SAMURAI)
3880 which_power = _("必殺剣", "hissatsu");
3881 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3882 which_power = _("鏡魔法", "mirror magic");
3883 else if (p_ptr->pclass == CLASS_NINJA)
3884 which_power = _("忍術", "ninjutsu");
3885 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3886 which_power = _("祈り", "prayer");
3888 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3891 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3893 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3898 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3899 (p_ptr->pclass == CLASS_BERSERKER) ||
3900 (p_ptr->pclass == CLASS_NINJA) ||
3901 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3904 else if (p_ptr->pclass == CLASS_IMITATOR)
3906 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3907 do_cmd_magic_eater(FALSE, FALSE);
3908 else if (p_ptr->pclass == CLASS_SAMURAI)
3910 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3911 do_cmd_cast_learned();
3912 else if (p_ptr->pclass == CLASS_SMITH)
3914 else if (p_ptr->pclass == CLASS_SNIPER)
3923 /* Issue a pet command */
3930 /*** Use various objects ***/
3932 /* Inscribe an object */
3939 /* Uninscribe an object */
3942 do_cmd_uninscribe();
3946 /* Activate an artifact */
3960 /* Fuel your lantern/torch */
3970 do_cmd_fire(SP_NONE);
3977 do_cmd_throw(1, FALSE, -1);
3991 if (use_command && rogue_like_commands)
4002 /* Quaff a potion */
4005 do_cmd_quaff_potion();
4012 do_cmd_read_scroll();
4019 if (use_command && !rogue_like_commands)
4026 /* Use racial power */
4029 do_cmd_racial_power();
4034 /*** Looking at Things (nearby or on map) ***/
4036 /* Full dungeon map */
4043 /* Locate player on map */
4057 /* Target monster or location */
4066 /*** Help and Such ***/
4075 /* Identify symbol */
4078 do_cmd_query_symbol();
4082 /* Character description */
4085 do_cmd_change_name();
4090 /*** System Commands ***/
4092 /* Hack -- User interface */
4099 /* Single line from a pref file */
4108 do_cmd_reload_autopick();
4114 do_cmd_edit_autopick();
4118 /* Interact with macros */
4125 /* Interact with visuals */
4133 /* Interact with colors */
4141 /* Interact with options */
4145 (void)combine_and_reorder_home(STORE_HOME);
4150 /*** Misc Commands ***/
4166 /* Repeat level feeling */
4173 /* Show previous message */
4176 do_cmd_message_one();
4180 /* Show previous messages */
4183 do_cmd_messages(old_now_message);
4187 /* Show quest status -KMW- */
4190 do_cmd_checkquest();
4194 /* Redraw the screen */
4197 now_message = old_now_message;
4202 #ifndef VERIFY_SAVEFILE
4204 /* Hack -- Save and don't quit */
4207 do_cmd_save_game(FALSE);
4211 #endif /* VERIFY_SAVEFILE */
4221 case SPECIAL_KEY_QUIT:
4223 do_cmd_save_and_exit();
4227 /* Quit (commit suicide) */
4240 /* Check artifacts, uniques, objects */
4247 /* Load "screen dump" */
4250 do_cmd_load_screen();
4254 /* Save "screen dump" */
4257 do_cmd_save_screen();
4261 /* Record/stop "Movie" */
4264 prepare_movie_hooks();
4268 /* Make random artifact list */
4271 spoil_random_artifact("randifact.txt");
4278 if (!p_ptr->wild_mode) do_cmd_travel();
4279 if (p_ptr->special_defense & KATA_MUSOU)
4281 set_action(ACTION_NONE);
4287 /* Hack -- Unknown command */
4290 if (flush_failure) flush();
4294 sound(SOUND_ILLEGAL);
4295 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4300 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4306 if (!p_ptr->energy_use && !now_message)
4307 now_message = old_now_message;
4311 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4314 static void pack_overflow(void)
4316 if (inventory[INVEN_PACK].k_idx)
4318 GAME_TEXT o_name[MAX_NLEN];
4321 /* Is auto-destroy done? */
4322 update_creature(p_ptr);
4323 if (!inventory[INVEN_PACK].k_idx) return;
4325 /* Access the slot to be dropped */
4326 o_ptr = &inventory[INVEN_PACK];
4328 disturb(FALSE, TRUE);
4331 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4332 object_desc(o_name, o_ptr, 0);
4334 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4336 /* Drop it (carefully) near the player */
4337 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4339 /* Modify, Describe, Optimize */
4340 inven_item_increase(INVEN_PACK, -255);
4341 inven_item_describe(INVEN_PACK);
4342 inven_item_optimize(INVEN_PACK);
4349 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4352 static void process_upkeep_with_speed(void)
4354 /* Give the player some energy */
4355 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4357 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4360 /* No current_world_ptr->game_turn yet */
4361 if (p_ptr->enchant_energy_need > 0) return;
4363 while (p_ptr->enchant_energy_need <= 0)
4365 /* Handle the player song */
4366 if (!load) check_music();
4368 /* Hex - Handle the hex spells */
4369 if (!load) check_hex();
4370 if (!load) revenge_spell();
4372 /* There is some randomness of needed energy */
4373 p_ptr->enchant_energy_need += ENERGY_NEED();
4378 * @brief プレイヤーの行動処理 / Process the player
4381 * Notice the annoying code to handle "pack overflow", which\n
4382 * must come first just in case somebody manages to corrupt\n
4383 * the savefiles by clever use of menu commands or something.\n
4385 static void process_player(void)
4389 /*** Apply energy ***/
4393 msg_print(_("何か変わった気がする!", "You feel different!"));
4395 (void)gain_mutation(p_ptr, 0);
4396 hack_mutation = FALSE;
4399 if (invoking_midnight_curse)
4402 activate_ty_curse(FALSE, &count);
4403 invoking_midnight_curse = FALSE;
4406 if (p_ptr->inside_battle)
4408 for(m_idx = 1; m_idx < m_max; m_idx++)
4410 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4412 if (!monster_is_valid(m_ptr)) continue;
4414 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4415 update_monster(m_idx, FALSE);
4420 /* Give the player some energy */
4421 else if (!(load && p_ptr->energy_need <= 0))
4423 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4426 /* No current_world_ptr->game_turn yet */
4427 if (p_ptr->energy_need > 0) return;
4428 if (!command_rep) prt_time();
4430 /*** Check for interupts ***/
4432 /* Complete resting */
4433 if (p_ptr->resting < 0)
4436 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4439 if ((p_ptr->chp == p_ptr->mhp) &&
4440 (p_ptr->csp >= p_ptr->msp))
4442 set_action(ACTION_NONE);
4446 /* Complete resting */
4447 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4450 if ((p_ptr->chp == p_ptr->mhp) &&
4451 (p_ptr->csp >= p_ptr->msp) &&
4452 !p_ptr->blind && !p_ptr->confused &&
4453 !p_ptr->poisoned && !p_ptr->afraid &&
4454 !p_ptr->stun && !p_ptr->cut &&
4455 !p_ptr->slow && !p_ptr->paralyzed &&
4456 !p_ptr->image && !p_ptr->word_recall &&
4457 !p_ptr->alter_reality)
4459 set_action(ACTION_NONE);
4464 if (p_ptr->action == ACTION_FISH)
4466 Term_xtra(TERM_XTRA_DELAY, 10);
4470 bool success = FALSE;
4471 get_mon_num_prep(monster_is_fishing_target,NULL);
4472 r_idx = get_mon_num(current_floor_ptr->dun_level ? current_floor_ptr->dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
4474 if (r_idx && one_in_(2))
4477 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4478 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4479 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4481 GAME_TEXT m_name[MAX_NLEN];
4482 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4483 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4489 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4491 disturb(FALSE, TRUE);
4495 /* Handle "abort" */
4498 /* Check for "player abort" (semi-efficiently for resting) */
4499 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4504 /* Check for a key */
4507 flush(); /* Flush input */
4509 disturb(FALSE, TRUE);
4511 /* Hack -- Show a Message */
4512 msg_print(_("中断しました。", "Canceled."));
4517 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4519 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4520 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4522 if (MON_CSLEEP(m_ptr))
4524 GAME_TEXT m_name[MAX_NLEN];
4527 (void)set_monster_csleep(p_ptr->riding, 0);
4528 monster_desc(m_name, m_ptr, 0);
4529 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4532 if (MON_STUNNED(m_ptr))
4534 /* Hack -- Recover from stun */
4535 if (set_monster_stunned(p_ptr->riding,
4536 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4538 GAME_TEXT m_name[MAX_NLEN];
4539 monster_desc(m_name, m_ptr, 0);
4540 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4544 if (MON_CONFUSED(m_ptr))
4546 /* Hack -- Recover from confusion */
4547 if (set_monster_confused(p_ptr->riding,
4548 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4550 GAME_TEXT m_name[MAX_NLEN];
4551 monster_desc(m_name, m_ptr, 0);
4552 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4556 if (MON_MONFEAR(m_ptr))
4558 /* Hack -- Recover from fear */
4559 if(set_monster_monfear(p_ptr->riding,
4560 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4562 GAME_TEXT m_name[MAX_NLEN];
4563 monster_desc(m_name, m_ptr, 0);
4564 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4574 if (p_ptr->lightspeed)
4576 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4578 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4580 if(P_PTR_KI < 40) P_PTR_KI = 0;
4581 else P_PTR_KI -= 40;
4582 p_ptr->update |= (PU_BONUS);
4584 if (p_ptr->action == ACTION_LEARN)
4587 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4589 /* Convert the unit (1/2^16) to (1/2^32) */
4590 s64b_LSHIFT(cost, cost_frac, 16);
4592 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4596 p_ptr->csp_frac = 0;
4597 set_action(ACTION_NONE);
4602 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4604 p_ptr->redraw |= PR_MANA;
4607 if (p_ptr->special_defense & KATA_MASK)
4609 if (p_ptr->special_defense & KATA_MUSOU)
4613 set_action(ACTION_NONE);
4618 p_ptr->redraw |= (PR_MANA);
4623 /*** Handle actual user input ***/
4625 /* Repeat until out of energy */
4626 while (p_ptr->energy_need <= 0)
4628 p_ptr->window |= PW_PLAYER;
4629 p_ptr->sutemi = FALSE;
4630 p_ptr->counter = FALSE;
4631 p_ptr->now_damaged = FALSE;
4635 /* Place the cursor on the player */
4636 move_cursor_relative(p_ptr->y, p_ptr->x);
4638 /* Refresh (optional) */
4639 if (fresh_before) Term_fresh();
4641 /* Hack -- Pack Overflow */
4644 /* Hack -- cancel "lurking browse mode" */
4645 if (!command_new) command_see = FALSE;
4647 /* Assume free current_world_ptr->game_turn */
4650 if (p_ptr->inside_battle)
4652 /* Place the cursor on the player */
4653 move_cursor_relative(p_ptr->y, p_ptr->x);
4655 command_cmd = SPECIAL_KEY_BUILDING;
4657 /* Process the command */
4661 /* Paralyzed or Knocked Out */
4662 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4664 take_turn(p_ptr, 100);
4668 else if (p_ptr->action == ACTION_REST)
4671 if (p_ptr->resting > 0)
4673 /* Reduce rest count */
4676 if (!p_ptr->resting) set_action(ACTION_NONE);
4677 p_ptr->redraw |= (PR_STATE);
4680 take_turn(p_ptr, 100);
4684 else if (p_ptr->action == ACTION_FISH)
4686 take_turn(p_ptr, 100);
4698 else if (travel.run)
4705 /* Repeated command */
4706 else if (command_rep)
4708 /* Count this execution */
4711 p_ptr->redraw |= (PR_STATE);
4714 /* Hack -- Assume messages were seen */
4717 /* Clear the top line */
4720 /* Process the command */
4724 /* Normal command */
4727 /* Place the cursor on the player */
4728 move_cursor_relative(p_ptr->y, p_ptr->x);
4731 /* Get a command (normal) */
4732 request_command(FALSE);
4735 /* Process the command */
4739 /* Hack -- Pack Overflow */
4745 if (p_ptr->energy_use)
4747 /* Use some energy */
4748 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4750 /* The Randomness is irrelevant */
4751 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4755 /* There is some randomness of needed energy */
4756 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4759 /* Hack -- constant hallucination */
4760 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4763 /* Shimmer monsters if needed */
4764 if (shimmer_monsters)
4766 /* Clear the flag */
4767 shimmer_monsters = FALSE;
4769 /* Shimmer multi-hued monsters */
4770 for (m_idx = 1; m_idx < m_max; m_idx++)
4772 monster_type *m_ptr;
4773 monster_race *r_ptr;
4775 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4776 if (!monster_is_valid(m_ptr)) continue;
4778 /* Skip unseen monsters */
4779 if (!m_ptr->ml) continue;
4781 /* Access the monster race */
4782 r_ptr = &r_info[m_ptr->ap_r_idx];
4784 /* Skip non-multi-hued monsters */
4785 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4788 /* Reset the flag */
4789 shimmer_monsters = TRUE;
4791 /* Redraw regardless */
4792 lite_spot(m_ptr->fy, m_ptr->fx);
4797 /* Handle monster detection */
4798 if (repair_monsters)
4800 /* Reset the flag */
4801 repair_monsters = FALSE;
4803 /* Rotate detection flags */
4804 for (m_idx = 1; m_idx < m_max; m_idx++)
4806 monster_type *m_ptr;
4807 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4808 if (!monster_is_valid(m_ptr)) continue;
4810 /* Nice monsters get mean */
4811 if (m_ptr->mflag & MFLAG_NICE)
4813 /* Nice monsters get mean */
4814 m_ptr->mflag &= ~(MFLAG_NICE);
4817 /* Handle memorized monsters */
4818 if (m_ptr->mflag2 & MFLAG2_MARK)
4820 /* Maintain detection */
4821 if (m_ptr->mflag2 & MFLAG2_SHOW)
4824 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4826 /* Still need repairs */
4827 repair_monsters = TRUE;
4830 /* Remove detection */
4834 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4836 /* Assume invisible */
4838 update_monster(m_idx, FALSE);
4840 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4841 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4843 /* Redraw regardless */
4844 lite_spot(m_ptr->fy, m_ptr->fx);
4849 if (p_ptr->pclass == CLASS_IMITATOR)
4852 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4855 for (j = 0; j < p_ptr->mane_num; j++)
4857 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4858 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4862 p_ptr->redraw |= (PR_IMITATION);
4864 if (p_ptr->action == ACTION_LEARN)
4867 p_ptr->redraw |= (PR_STATE);
4870 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4873 p_ptr->redraw |= (PR_MAP);
4874 p_ptr->update |= (PU_MONSTERS);
4875 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4877 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4879 p_ptr->timewalk = FALSE;
4880 p_ptr->energy_need = ENERGY_NEED();
4886 /* Hack -- notice death */
4887 if (!p_ptr->playing || p_ptr->is_dead)
4889 p_ptr->timewalk = FALSE;
4894 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
4896 /* Handle "leaving" */
4897 if (p_ptr->leaving) break;
4900 /* Update scent trail */
4905 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4909 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4910 * ゲームを終了するかのいずれかまでループする。
4913 * This function will not exit until the level is completed,\n
4914 * the user dies, or the game is terminated.\n
4917 static void dungeon(bool load_game)
4921 /* Set the base level */
4922 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4924 /* Reset various flags */
4925 is_loading_now = FALSE;
4928 p_ptr->leaving = FALSE;
4930 /* Reset the "command" vars */
4933 #if 0 /* Don't reset here --- It's used for Arena */
4942 /* Cancel the target */
4946 p_ptr->ambush_flag = FALSE;
4948 /* Cancel the health bar */
4951 /* Check visual effects */
4952 shimmer_monsters = TRUE;
4953 shimmer_objects = TRUE;
4954 repair_monsters = TRUE;
4955 repair_objects = TRUE;
4958 disturb(TRUE, TRUE);
4960 /* Get index of current quest (if any) */
4961 quest_num = quest_number(current_floor_ptr->dun_level);
4963 /* Inside a quest? */
4966 /* Mark the quest monster */
4967 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4970 /* Track maximum player level */
4971 if (p_ptr->max_plv < p_ptr->lev)
4973 p_ptr->max_plv = p_ptr->lev;
4977 /* Track maximum dungeon level (if not in quest -KMW-) */
4978 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4980 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4981 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4984 (void)calculate_upkeep();
4986 /* Validate the panel */
4987 panel_bounds_center();
4989 /* Verify the panel */
4995 /* Enter "xtra" mode */
4996 character_xtra = TRUE;
4998 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4999 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5000 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
5004 /* Leave "xtra" mode */
5005 character_xtra = FALSE;
5007 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5008 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5012 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5013 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5014 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5016 if (p_ptr->inside_battle)
5020 p_ptr->energy_need = 0;
5021 update_gambling_monsters();
5025 msg_print(_("試合開始!", "Ready..Fight!"));
5030 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5031 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5033 /* Hack -- notice death or departure */
5034 if (!p_ptr->playing || p_ptr->is_dead) return;
5036 /* Print quest message if appropriate */
5037 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5039 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5040 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5042 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5044 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5046 msg_format("この階には%sの主である%sが棲んでいる。",
5047 d_name+d_info[p_ptr->dungeon_idx].name,
5048 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5050 msg_format("%^s lives in this level as the keeper of %s.",
5051 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5052 d_name+d_info[p_ptr->dungeon_idx].name);
5056 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5058 /*** Process this dungeon level ***/
5060 /* Reset the monster generation level */
5061 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5063 /* Reset the object generation level */
5064 current_floor_ptr->object_level = current_floor_ptr->base_level;
5066 is_loading_now = TRUE;
5068 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5069 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5070 p_ptr->energy_need = 0;
5072 /* Not leaving dungeon */
5073 p_ptr->leaving_dungeon = FALSE;
5075 /* Initialize monster process */
5081 /* Hack -- Compact the monster list occasionally */
5082 if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5084 /* Hack -- Compress the monster list occasionally */
5085 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5088 /* Hack -- Compact the object list occasionally */
5089 if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5091 /* Hack -- Compress the object list occasionally */
5092 if (o_cnt + 32 < o_max) compact_objects(0);
5094 /* Process the player */
5096 process_upkeep_with_speed();
5100 /* Hack -- Hilite the player */
5101 move_cursor_relative(p_ptr->y, p_ptr->x);
5103 /* Optional fresh */
5104 if (fresh_after) Term_fresh();
5106 /* Hack -- Notice death or departure */
5107 if (!p_ptr->playing || p_ptr->is_dead) break;
5109 /* Process all of the monsters */
5114 /* Hack -- Hilite the player */
5115 move_cursor_relative(p_ptr->y, p_ptr->x);
5117 /* Optional fresh */
5118 if (fresh_after) Term_fresh();
5120 /* Hack -- Notice death or departure */
5121 if (!p_ptr->playing || p_ptr->is_dead) break;
5123 /* Process the world */
5128 /* Hack -- Hilite the player */
5129 move_cursor_relative(p_ptr->y, p_ptr->x);
5131 /* Optional fresh */
5132 if (fresh_after) Term_fresh();
5134 /* Hack -- Notice death or departure */
5135 if (!p_ptr->playing || p_ptr->is_dead) break;
5137 /* Count game turns */
5138 current_world_ptr->game_turn++;
5140 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5142 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5143 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5146 prevent_turn_overflow();
5148 /* Handle "leaving" */
5149 if (p_ptr->leaving) break;
5151 if (wild_regen) wild_regen--;
5154 /* Inside a quest and non-unique questor? */
5155 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5157 /* Un-mark the quest monster */
5158 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5161 /* Not save-and-quit and not dead? */
5162 if (p_ptr->playing && !p_ptr->is_dead)
5165 * Maintain Unique monsters and artifact, save current
5166 * floor, then prepare next floor
5170 /* Forget the flag */
5171 reinit_wilderness = FALSE;
5174 /* Write about current level on the play record once per level */
5180 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5183 * Modified by Arcum Dagsson to support
5184 * separate macro files for different realms.
5186 static void load_all_pref_files(void)
5190 /* Access the "user" pref file */
5191 sprintf(buf, "user.prf");
5193 /* Process that file */
5194 process_pref_file(buf);
5196 /* Access the "user" system pref file */
5197 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5199 /* Process that file */
5200 process_pref_file(buf);
5202 /* Access the "race" pref file */
5203 sprintf(buf, "%s.prf", rp_ptr->title);
5205 /* Process that file */
5206 process_pref_file(buf);
5208 /* Access the "class" pref file */
5209 sprintf(buf, "%s.prf", cp_ptr->title);
5211 /* Process that file */
5212 process_pref_file(buf);
5214 /* Access the "character" pref file */
5215 sprintf(buf, "%s.prf", player_base);
5217 /* Process that file */
5218 process_pref_file(buf);
5220 /* Access the "realm 1" pref file */
5221 if (p_ptr->realm1 != REALM_NONE)
5223 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5225 /* Process that file */
5226 process_pref_file(buf);
5229 /* Access the "realm 2" pref file */
5230 if (p_ptr->realm2 != REALM_NONE)
5232 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5234 /* Process that file */
5235 process_pref_file(buf);
5239 /* Load an autopick preference file */
5240 autopick_load_pref(FALSE);
5245 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
5248 void extract_option_vars(void)
5252 for (i = 0; option_info[i].o_desc; i++)
5254 int os = option_info[i].o_set;
5255 int ob = option_info[i].o_bit;
5257 /* Set the "default" options */
5258 if (option_info[i].o_var)
5261 if (option_flag[os] & (1L << ob))
5264 (*option_info[i].o_var) = TRUE;
5271 (*option_info[i].o_var) = FALSE;
5279 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
5282 void determine_bounty_uniques(void)
5286 monster_race *r_ptr;
5288 get_mon_num_prep(NULL, NULL);
5289 for (i = 0; i < MAX_KUBI; i++)
5293 current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
5294 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
5296 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5298 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
5300 if (r_ptr->rarity > 100) continue;
5302 if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
5304 for (j = 0; j < i; j++)
5305 if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
5312 for (i = 0; i < MAX_KUBI - 1; i++)
5314 for (j = i; j < MAX_KUBI; j++)
5316 if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
5318 tmp = current_world_ptr->bounty_r_idx[i];
5319 current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
5320 current_world_ptr->bounty_r_idx[j] = tmp;
5328 * @brief 今日の賞金首を確定する / Determine today's bounty monster
5330 * @note conv_old is used if loaded 0.0.3 or older save file
5332 void determine_today_mon(bool conv_old)
5335 bool old_inside_battle = p_ptr->inside_battle;
5336 monster_race *r_ptr;
5340 for (i = 0; i < max_d_idx; i++)
5342 if (max_dlv[i] < d_info[i].mindepth) continue;
5343 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
5346 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
5348 p_ptr->inside_battle = TRUE;
5349 get_mon_num_prep(NULL, NULL);
5353 today_mon = get_mon_num(max_dl);
5354 r_ptr = &r_info[today_mon];
5356 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5357 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
5358 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
5359 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
5360 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
5361 if (r_ptr->rarity > 10) continue;
5365 p_ptr->today_mon = 0;
5366 p_ptr->inside_battle = old_inside_battle;
5370 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5373 * If the "new_game" parameter is true, then, after loading the
5374 * savefile, we will commit suicide, if necessary, to allow the
5375 * player to start a new game.
5377 void play_game(bool new_game)
5380 bool load_game = TRUE;
5381 bool init_random_seed = FALSE;
5391 else if (chuukei_server)
5393 prepare_chuukei_hooks();
5404 hack_mutation = FALSE;
5406 /* Hack -- Character is "icky" */
5407 character_icky = TRUE;
5409 /* Make sure main term is active */
5410 Term_activate(angband_term[0]);
5412 /* Initialise the resize hooks */
5413 angband_term[0]->resize_hook = resize_map;
5415 for (i = 1; i < 8; i++)
5417 /* Does the term exist? */
5418 if (angband_term[i])
5420 /* Add the redraw on resize hook */
5421 angband_term[i]->resize_hook = redraw_window;
5425 /* Hack -- current_world_ptr->game_turn off the cursor */
5426 (void)Term_set_cursor(0);
5429 /* Attempt to load */
5432 quit(_("セーブファイルが壊れています", "broken savefile"));
5435 /* Extract the options */
5436 extract_option_vars();
5438 /* Report waited score */
5439 if (p_ptr->wait_report_score)
5444 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5447 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5448 update_creature(p_ptr);
5450 p_ptr->is_dead = TRUE;
5452 start_time = (u32b)time(NULL);
5454 /* No suspending now */
5455 signals_ignore_tstp();
5457 /* Hack -- Character is now "icky" */
5458 character_icky = TRUE;
5460 /* Build the filename */
5461 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5463 /* Open the high score file, for reading/writing */
5464 highscore_fd = fd_open(buf, O_RDWR);
5466 /* 町名消失バグ対策(#38205) Init the wilderness */
5467 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5469 /* Handle score, show Top scores */
5470 success = send_world_score(TRUE);
5472 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5474 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5479 p_ptr->wait_report_score = FALSE;
5481 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5483 /* Shut the high score file */
5484 (void)fd_close(highscore_fd);
5486 /* Forget the high score fd */
5489 /* Allow suspending now */
5490 signals_handle_tstp();
5495 creating_savefile = new_game;
5497 /* Nothing loaded */
5498 if (!character_loaded)
5500 /* Make new player */
5503 /* The dungeon is not ready */
5504 character_dungeon = FALSE;
5506 /* Prepare to init the RNG */
5507 init_random_seed = TRUE;
5509 /* Initialize the saved floors data */
5510 init_saved_floors(FALSE);
5513 /* Old game is loaded. But new game is requested. */
5516 /* Initialize the saved floors data */
5517 init_saved_floors(TRUE);
5520 /* Process old character */
5523 /* Process the player name */
5524 process_player_name(FALSE);
5528 if (init_random_seed)
5533 /* Roll new character */
5536 /* The dungeon is not ready */
5537 character_dungeon = FALSE;
5540 current_floor_ptr->dun_level = 0;
5541 p_ptr->inside_quest = 0;
5542 p_ptr->inside_arena = FALSE;
5543 p_ptr->inside_battle = FALSE;
5547 /* Hack -- seed for flavors */
5548 seed_flavor = randint0(0x10000000);
5550 /* Hack -- seed for town layout */
5551 seed_town = randint0(0x10000000);
5553 /* Roll up a new character */
5561 determine_bounty_uniques();
5562 determine_today_mon(FALSE);
5564 /* Initialize object array */
5569 write_level = FALSE;
5571 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5573 " ---- Restart Game ----"));
5576 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5577 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5579 if (p_ptr->riding == -1)
5582 for (i = m_max; i > 0; i--)
5584 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5593 creating_savefile = FALSE;
5595 p_ptr->teleport_town = FALSE;
5596 p_ptr->sutemi = FALSE;
5597 current_world_ptr->timewalk_m_idx = 0;
5598 p_ptr->now_damaged = FALSE;
5600 start_time = time(NULL) - 1;
5601 record_o_name[0] = '\0';
5603 /* Reset map panel */
5604 panel_row_min = current_floor_ptr->height;
5605 panel_col_min = current_floor_ptr->width;
5607 /* Sexy gal gets bonus to maximum weapon skill of whip */
5608 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5609 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5611 /* Fill the arrays of floors and walls in the good proportions */
5612 set_floor_and_wall(p_ptr->dungeon_idx);
5614 /* Flavor the objects */
5617 /* Flash a message */
5618 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5620 /* Flush the message */
5624 /* Hack -- Enter wizard mode */
5627 if (enter_wizard_mode())
5629 p_ptr->wizard = TRUE;
5631 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5633 /* Initialize the saved floors data */
5634 init_saved_floors(TRUE);
5637 p_ptr->inside_quest = 0;
5639 /* Avoid crash in update_view() */
5640 p_ptr->y = p_ptr->x = 10;
5643 else if (p_ptr->is_dead)
5645 quit("Already dead.");
5649 /* Initialize the town-buildings if necessary */
5650 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5652 /* Init the wilderness */
5654 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5657 init_flags = INIT_ONLY_BUILDINGS;
5659 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5661 select_floor_music();
5665 /* Generate a dungeon level if needed */
5666 if (!character_dungeon)
5673 /* HACK -- Restore from panic-save */
5674 if (p_ptr->panic_save)
5676 /* No player? -- Try to regenerate floor */
5677 if (!p_ptr->y || !p_ptr->x)
5679 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5683 /* Still no player? -- Try to locate random place */
5684 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5686 /* No longer in panic */
5687 p_ptr->panic_save = 0;
5691 /* Character is now "complete" */
5692 character_generated = TRUE;
5695 /* Hack -- Character is no longer "icky" */
5696 character_icky = FALSE;
5702 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5703 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5708 p_ptr->playing = TRUE;
5710 /* Reset the visual mappings */
5713 /* Load the "pref" files */
5714 load_all_pref_files();
5716 /* Give startup outfit (after loading pref files) */
5722 /* React to changes */
5723 Term_xtra(TERM_XTRA_REACT, 0);
5725 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5726 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5729 /* Set or clear "rogue_like_commands" if requested */
5730 if (arg_force_original) rogue_like_commands = FALSE;
5731 if (arg_force_roguelike) rogue_like_commands = TRUE;
5733 /* Hack -- Enforce "delayed death" */
5734 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5736 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5738 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5740 monster_type *m_ptr;
5741 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5742 monster_race *r_ptr = &r_info[pet_r_idx];
5743 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5744 (PM_FORCE_PET | PM_NO_KAGE));
5745 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5746 m_ptr->mspeed = r_ptr->speed;
5747 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5748 m_ptr->max_maxhp = m_ptr->maxhp;
5749 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5750 m_ptr->dealt_damage = 0;
5751 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5754 (void)combine_and_reorder_home(STORE_HOME);
5755 (void)combine_and_reorder_home(STORE_MUSEUM);
5757 select_floor_music();
5762 /* Process the level */
5765 /* Hack -- prevent "icky" message */
5766 character_xtra = TRUE;
5770 character_xtra = FALSE;
5772 /* Cancel the target */
5775 /* Cancel the health bar */
5782 /* Handle "quit and save" */
5783 if (!p_ptr->playing && !p_ptr->is_dead) break;
5785 /* Erase the old current_floor_ptr->grid_array */
5787 if (!p_ptr->is_dead) wipe_m_list();
5794 /* Accidental Death */
5795 if (p_ptr->playing && p_ptr->is_dead)
5797 if (p_ptr->inside_arena)
5799 p_ptr->inside_arena = FALSE;
5800 if (p_ptr->arena_number > MAX_ARENA_MONS)
5801 p_ptr->arena_number++;
5803 p_ptr->arena_number = -1 - p_ptr->arena_number;
5804 p_ptr->is_dead = FALSE;
5806 p_ptr->chp_frac = 0;
5807 p_ptr->exit_bldg = TRUE;
5810 /* Leave through the exit */
5811 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5813 /* prepare next floor */
5818 /* Mega-Hack -- Allow player to cheat death */
5819 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5826 /* Handle "death" */
5827 if (p_ptr->is_dead) break;
5829 /* Make a new level */
5841 * @brief ゲームターンからの実時間換算を行うための補正をかける
5842 * @param hoge ゲームターン
5843 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5844 * @return 修正をかけた後のゲームターン
5846 s32b turn_real(s32b hoge)
5848 switch (p_ptr->start_race)
5854 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5861 * @brief ターンのオーバーフローに対する対処
5862 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5863 * @return 修正をかけた後のゲームターン
5865 void prevent_turn_overflow(void)
5867 int rollback_days, i, j;
5868 s32b rollback_turns;
5870 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5872 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5873 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5875 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5876 else current_world_ptr->game_turn = 1;
5877 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5878 else current_floor_ptr->generated_turn = 1;
5879 if (old_battle > rollback_turns) old_battle -= rollback_turns;
5880 else old_battle = 1;
5881 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5882 else p_ptr->feeling_turn = 1;
5884 for (i = 1; i < max_towns; i++)
5886 for (j = 0; j < MAX_STORES; j++)
5888 store_type *st_ptr = &town_info[i].store[j];
5890 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5892 st_ptr->last_visit -= rollback_turns;
5893 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5896 if (st_ptr->store_open)
5898 st_ptr->store_open -= rollback_turns;
5899 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5907 * Close up the current game (player may or may not be dead)
5911 * This function is called only from "main.c" and "signals.c".
5914 void close_game(void)
5917 bool do_send = TRUE;
5919 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5922 /* Flush the messages */
5925 /* Flush the input */
5929 /* No suspending now */
5930 signals_ignore_tstp();
5933 /* Hack -- Character is now "icky" */
5934 character_icky = TRUE;
5937 /* Build the filename */
5938 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5940 /* Grab permissions */
5943 /* Open the high score file, for reading/writing */
5944 highscore_fd = fd_open(buf, O_RDWR);
5946 /* Drop permissions */
5952 /* Handle retirement */
5953 if (p_ptr->total_winner) kingly();
5956 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5958 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5960 else do_send = FALSE;
5967 /* Show more info */
5973 if ((!send_world_score(do_send)))
5975 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5976 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5978 p_ptr->wait_report_score = TRUE;
5979 p_ptr->is_dead = FALSE;
5980 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5983 if (!p_ptr->wait_report_score)
5986 else if (highscore_fd >= 0)
5988 display_scores_aux(0, 10, -1, NULL);
5991 /* Dump bones file */
6000 do_cmd_save_game(FALSE);
6002 /* Prompt for scores */
6003 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
6004 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
6006 /* Predict score (or ESCAPE) */
6007 if (inkey() != ESCAPE) predict_score();
6011 /* Shut the high score file */
6012 (void)fd_close(highscore_fd);
6014 /* Forget the high score fd */
6017 /* Kill all temporal files */
6018 clear_saved_floor_files();
6020 /* Allow suspending now */
6021 signals_handle_tstp();