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.
22 #include "cmd-activate.h"
25 #include "cmd-hissatsu.h"
27 #include "cmd-magiceat.h"
29 #include "cmd-quaff.h"
31 #include "cmd-smith.h"
32 #include "cmd-usestaff.h"
33 #include "cmd-zaprod.h"
34 #include "cmd-zapwand.h"
36 #include "cmd-basic.h"
42 #include "floor-events.h"
43 #include "floor-town.h"
45 #include "object-curse.h"
46 #include "object-flavor.h"
49 #include "spells-summon.h"
50 #include "spells-object.h"
51 #include "spells-status.h"
52 #include "spells-floor.h"
53 #include "monster-spell.h"
60 #include "player-move.h"
61 #include "player-status.h"
62 #include "player-class.h"
63 #include "player-race.h"
64 #include "cmd-spell.h"
65 #include "realm-hex.h"
66 #include "objectkind.h"
67 #include "object-hook.h"
69 #include "monster-process.h"
70 #include "monster-status.h"
71 #include "monsterrace-hook.h"
72 #include "floor-save.h"
74 #include "player-skill.h"
76 #include "view-mainwindow.h"
77 #include "dungeon-file.h"
79 #include "player-effects.h"
84 #include "targeting.h"
88 * Hack -- Link a copyright message into the executable
90 const concptr copyright[5] =
92 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
94 "This software may be copied and distributed for educational, research,",
95 "and not for profit purposes provided that this copyright and statement",
96 "are included in all such copies."
99 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
102 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
104 concptr ANGBAND_KEYBOARD = "0";
107 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
109 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
110 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
113 * Flags for initialization
118 * @brief 擬似鑑定を実際に行い判定を反映する
119 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
120 * @param heavy 重度の擬似鑑定を行うならばTRUE
123 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
126 object_type *o_ptr = &p_ptr->inventory_list[slot];
127 GAME_TEXT o_name[MAX_NLEN];
129 /* We know about it already, do not tell us again */
130 if (o_ptr->ident & (IDENT_SENSE))return;
132 /* It is fully known, no information needed */
133 if (object_is_known(o_ptr)) return;
135 /* Check for a feeling */
136 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
138 /* Skip non-feelings */
142 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
153 feel = FEEL_EXCELLENT;
159 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
161 feel = FEEL_UNCURSED;
166 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
172 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
179 feel = FEEL_WORTHLESS;
184 feel = FEEL_TERRIBLE;
190 /* Stop everything */
191 if (disturb_minor) disturb(FALSE, FALSE);
193 /* Get an object description */
194 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
196 /* Message (equipment) */
197 if (slot >= INVEN_RARM)
200 msg_format("%s%s(%c)は%sという感じがする...",
201 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
203 msg_format("You feel the %s (%c) you are %s %s %s...",
204 o_name, index_to_label(slot), describe_use(slot),
205 ((o_ptr->number == 1) ? "is" : "are"),
206 game_inscriptions[feel]);
211 /* Message (p_ptr->inventory_list) */
215 msg_format("ザックの中の%s(%c)は%sという感じがする...",
216 o_name, index_to_label(slot),game_inscriptions[feel]);
218 msg_format("You feel the %s (%c) in your pack %s %s...",
219 o_name, index_to_label(slot),
220 ((o_ptr->number == 1) ? "is" : "are"),
221 game_inscriptions[feel]);
226 o_ptr->ident |= (IDENT_SENSE);
228 /* Set the "inscription" */
229 o_ptr->feeling = feel;
231 /* Auto-inscription/destroy */
232 autopick_alter_item(slot, destroy_feeling);
233 p_ptr->update |= (PU_COMBINE | PU_REORDER);
235 p_ptr->window |= (PW_INVEN | PW_EQUIP);
241 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
244 * Sense the p_ptr->inventory_list\n
246 * Class 0 = Warrior --> fast and heavy\n
247 * Class 1 = Mage --> slow and light\n
248 * Class 2 = Priest --> fast but light\n
249 * Class 3 = Rogue --> okay and heavy\n
250 * Class 4 = Ranger --> slow but heavy (changed!)\n
251 * Class 5 = Paladin --> slow but heavy\n
253 static void sense_inventory1(void)
256 PLAYER_LEVEL plev = p_ptr->lev;
261 /*** Check for "sensing" ***/
263 /* No sensing when confused */
264 if (p_ptr->confused) return;
266 /* Analyze the class */
267 switch (p_ptr->pclass)
275 if (0 != randint0(9000L / (plev * plev + 40))) return;
286 if (0 != randint0(6000L / (plev * plev + 50))) return;
295 case CLASS_HIGH_MAGE:
297 case CLASS_MAGIC_EATER:
299 /* Very bad (light) sensing */
300 if (0 != randint0(240000L / (plev + 5))) return;
308 /* Good (light) sensing */
309 if (0 != randint0(10000L / (plev * plev + 40))) return;
318 if (0 != randint0(20000L / (plev * plev + 40))) return;
329 if (0 != randint0(95000L / (plev * plev + 40))) return;
341 if (0 != randint0(77777L / (plev * plev + 40))) return;
349 case CLASS_WARRIOR_MAGE:
353 if (0 != randint0(75000L / (plev * plev + 40))) return;
358 case CLASS_MINDCRAFTER:
360 case CLASS_BLUE_MAGE:
361 case CLASS_MIRROR_MASTER:
364 if (0 != randint0(55000L / (plev * plev + 40))) return;
369 case CLASS_CHAOS_WARRIOR:
372 if (0 != randint0(80000L / (plev * plev + 40))) return;
381 case CLASS_FORCETRAINER:
384 if (0 != randint0(20000L / (plev * plev + 40))) return;
392 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
400 case CLASS_BEASTMASTER:
403 if (0 != randint0(65000L / (plev * plev + 40))) return;
407 case CLASS_BERSERKER:
416 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
418 /*** Sense everything ***/
420 /* Check everything */
421 for (i = 0; i < INVEN_TOTAL; i++)
425 o_ptr = &p_ptr->inventory_list[i];
427 /* Skip empty slots */
428 if (!o_ptr->k_idx) continue;
430 /* Valid "tval" codes */
457 /* Skip non-sense machines */
460 /* Occasional failure on p_ptr->inventory_list items */
461 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
464 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
469 sense_inventory_aux(i, heavy);
474 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
477 static void sense_inventory2(void)
480 PLAYER_LEVEL plev = p_ptr->lev;
484 /*** Check for "sensing" ***/
486 /* No sensing when confused */
487 if (p_ptr->confused) return;
489 /* Analyze the class */
490 switch (p_ptr->pclass)
496 case CLASS_BERSERKER:
504 case CLASS_CHAOS_WARRIOR:
506 case CLASS_BEASTMASTER:
509 /* Very bad (light) sensing */
510 if (0 != randint0(240000L / (plev + 5))) return;
516 case CLASS_WARRIOR_MAGE:
521 if (0 != randint0(95000L / (plev * plev + 40))) return;
529 case CLASS_FORCETRAINER:
530 case CLASS_MINDCRAFTER:
533 if (0 != randint0(20000L / (plev * plev + 40))) return;
539 case CLASS_HIGH_MAGE:
541 case CLASS_MAGIC_EATER:
542 case CLASS_MIRROR_MASTER:
543 case CLASS_BLUE_MAGE:
546 if (0 != randint0(9000L / (plev * plev + 40))) return;
554 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
560 /*** Sense everything ***/
562 /* Check everything */
563 for (i = 0; i < INVEN_TOTAL; i++)
567 o_ptr = &p_ptr->inventory_list[i];
569 /* Skip empty slots */
570 if (!o_ptr->k_idx) continue;
572 /* Valid "tval" codes */
585 /* Skip non-sense machines */
588 /* Occasional failure on p_ptr->inventory_list items */
589 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
591 sense_inventory_aux(i, TRUE);
596 * @brief パターン終点到達時のテレポート処理を行う
599 static void pattern_teleport(void)
602 DEPTH max_level = 99;
605 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
610 /* Only downward in ironman mode */
611 if (ironman_downward)
612 min_level = current_floor_ptr->dun_level;
615 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
617 if (current_floor_ptr->dun_level > 100)
618 max_level = MAX_DEPTH - 1;
619 else if (current_floor_ptr->dun_level == 100)
624 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
625 min_level = d_info[p_ptr->dungeon_idx].mindepth;
629 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
632 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
634 /* Ask for a level */
635 if (!get_string(ppp, tmp_val, 10)) return;
637 /* Extract request */
638 command_arg = (COMMAND_ARG)atoi(tmp_val);
640 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
642 teleport_player(200, 0L);
649 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
650 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
653 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
655 if (autosave_l) do_cmd_save_game(TRUE);
658 current_floor_ptr->dun_level = command_arg;
662 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
664 p_ptr->inside_quest = 0;
668 * Clear all saved floors
669 * and create a first saved floor
671 prepare_change_floor_mode(CFM_FIRST_FLOOR);
672 p_ptr->leaving = TRUE;
676 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
677 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
679 static bool pattern_effect(void)
683 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
685 if ((prace_is_(RACE_AMBERITE)) &&
686 (p_ptr->cut > 0) && one_in_(10))
691 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
693 switch (pattern_type)
695 case PATTERN_TILE_END:
697 (void)restore_all_status();
698 (void)restore_level();
699 (void)cure_critical_wounds(1000);
701 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
702 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
705 * We could make the healing effect of the
706 * Pattern center one-time only to avoid various kinds
707 * of abuse, like luring the win monster into fighting you
708 * in the middle of the pattern...
712 case PATTERN_TILE_OLD:
716 case PATTERN_TILE_TELEPORT:
720 case PATTERN_TILE_WRECKED:
722 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
726 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
728 else if (!IS_INVULN())
729 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
738 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
739 * @param percent 回復比率
742 static void regenhp(int percent)
748 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
749 if (p_ptr->action == ACTION_HAYAGAKE) return;
751 /* Save the old hitpoints */
752 old_chp = p_ptr->chp;
755 * Extract the new hitpoints
757 * 'percent' is the Regen factor in unit (1/2^16)
760 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
762 /* Convert the unit (1/2^16) to (1/2^32) */
763 s64b_LSHIFT(new_chp, new_chp_frac, 16);
766 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
770 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
772 p_ptr->chp = p_ptr->mhp;
777 if (old_chp != p_ptr->chp)
779 p_ptr->redraw |= (PR_HP);
780 p_ptr->window |= (PW_PLAYER);
787 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
788 * @param upkeep_factor ペット維持によるMPコスト量
789 * @param regen_amount 回復量
792 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
794 MANA_POINT old_csp = p_ptr->csp;
795 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
798 * Excess mana will decay 32 times faster than normal
801 if (p_ptr->csp > p_ptr->msp)
803 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
805 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
807 /* Convert the unit (1/2^16) to (1/2^32) */
808 s64b_LSHIFT(decay, decay_frac, 16);
811 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
814 if (p_ptr->csp < p_ptr->msp)
816 p_ptr->csp = p_ptr->msp;
821 /* Regenerating mana (unless the player has excess mana) */
822 else if (regen_rate > 0)
824 /* (percent/100) is the Regen factor in unit (1/2^16) */
825 MANA_POINT new_mana = 0;
826 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
828 /* Convert the unit (1/2^16) to (1/2^32) */
829 s64b_LSHIFT(new_mana, new_mana_frac, 16);
832 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
834 /* Must set frac to zero even if equal */
835 if (p_ptr->csp >= p_ptr->msp)
837 p_ptr->csp = p_ptr->msp;
843 /* Reduce mana (even when the player has excess mana) */
846 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
847 s32b reduce_mana = 0;
848 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
850 /* Convert the unit (1/2^16) to (1/2^32) */
851 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
854 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
864 if (old_csp != p_ptr->csp)
866 p_ptr->redraw |= (PR_MANA);
867 p_ptr->window |= (PW_PLAYER);
868 p_ptr->window |= (PW_SPELL);
874 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
875 * @param regen_amount 回復量
878 static void regenmagic(int regen_amount)
883 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
885 for (i = 0; i < EATER_EXT*2; i++)
887 if (!p_ptr->magic_num2[i]) continue;
888 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
890 /* Increase remaining charge number like float value */
891 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
892 p_ptr->magic_num1[i] += new_mana;
894 /* Check maximum charge */
895 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
897 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
901 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
903 if (!p_ptr->magic_num1[i]) continue;
904 if (!p_ptr->magic_num2[i]) continue;
906 /* Decrease remaining period for charging */
907 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
908 / (dev * 16 * PY_REGEN_NORMAL);
909 p_ptr->magic_num1[i] -= new_mana;
911 /* Check minimum remaining period for charging */
912 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
919 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
921 * @note Should probably be done during monster turns.
923 static void regen_monsters(void)
928 /* Regenerate everyone */
929 for (i = 1; i < current_floor_ptr->m_max; i++)
931 /* Check the i'th monster */
932 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
933 monster_race *r_ptr = &r_info[m_ptr->r_idx];
935 if (!monster_is_valid(m_ptr)) continue;
937 /* Allow regeneration (if needed) */
938 if (m_ptr->hp < m_ptr->maxhp)
940 /* Hack -- Base regeneration */
941 frac = m_ptr->maxhp / 100;
943 /* Hack -- Minimal regeneration rate */
944 if (!frac) if (one_in_(2)) frac = 1;
946 /* Hack -- Some monsters regenerate quickly */
947 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
949 /* Hack -- Regenerate */
952 /* Do not over-regenerate */
953 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
955 /* Redraw (later) if needed */
956 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
957 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
964 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
966 * @note Should probably be done during monster turns.
968 static void regen_captured_monsters(void)
973 /* Regenerate everyone */
974 for (i = 0; i < INVEN_TOTAL; i++)
977 object_type *o_ptr = &p_ptr->inventory_list[i];
979 if (!o_ptr->k_idx) continue;
980 if (o_ptr->tval != TV_CAPTURE) continue;
981 if (!o_ptr->pval) continue;
985 r_ptr = &r_info[o_ptr->pval];
987 /* Allow regeneration (if needed) */
988 if (o_ptr->xtra4 < o_ptr->xtra5)
990 /* Hack -- Base regeneration */
991 frac = o_ptr->xtra5 / 100;
993 /* Hack -- Minimal regeneration rate */
994 if (!frac) if (one_in_(2)) frac = 1;
996 /* Hack -- Some monsters regenerate quickly */
997 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
999 /* Hack -- Regenerate */
1000 o_ptr->xtra4 += (XTRA16)frac;
1002 /* Do not over-regenerate */
1003 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1010 p_ptr->update |= (PU_COMBINE);
1011 p_ptr->window |= (PW_INVEN);
1012 p_ptr->window |= (PW_EQUIP);
1018 * @brief 寿命つき光源の警告メッセージ処理
1019 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1022 static void notice_lite_change(object_type *o_ptr)
1024 /* Hack -- notice interesting fuel steps */
1025 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1027 p_ptr->window |= (PW_EQUIP);
1030 /* Hack -- Special treatment when blind */
1033 /* Hack -- save some light for later */
1034 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1037 /* The light is now out */
1038 else if (o_ptr->xtra4 == 0)
1040 disturb(FALSE, TRUE);
1041 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1043 /* Recalculate torch radius */
1044 p_ptr->update |= (PU_TORCH);
1046 /* Some ego light lose its effects without fuel */
1047 p_ptr->update |= (PU_BONUS);
1050 /* The light is getting dim */
1051 else if (o_ptr->name2 == EGO_LITE_LONG)
1053 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1054 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1056 if (disturb_minor) disturb(FALSE, TRUE);
1057 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1061 /* The light is getting dim */
1062 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1064 if (disturb_minor) disturb(FALSE, TRUE);
1065 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1071 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1072 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1075 static void recharged_notice(object_type *o_ptr)
1077 GAME_TEXT o_name[MAX_NLEN];
1081 /* No inscription */
1082 if (!o_ptr->inscription) return;
1085 s = my_strchr(quark_str(o_ptr->inscription), '!');
1087 /* Process notification request. */
1090 /* Find another '!' */
1093 /* Describe (briefly) */
1094 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1096 /* Notify the player */
1098 msg_format("%sは再充填された。", o_name);
1100 if (o_ptr->number > 1)
1101 msg_format("Your %s are recharged.", o_name);
1103 msg_format("Your %s is recharged.", o_name);
1106 disturb(FALSE, FALSE);
1112 /* Keep looking for '!'s */
1113 s = my_strchr(s + 1, '!');
1118 * @brief プレイヤーの歌に関する継続処理
1121 static void check_music(void)
1123 const magic_type *s_ptr;
1125 MANA_POINT need_mana;
1126 u32b need_mana_frac;
1128 /* Music singed by player */
1129 if (p_ptr->pclass != CLASS_BARD) return;
1130 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1132 if (p_ptr->anti_magic)
1134 stop_singing(p_ptr);
1138 spell = SINGING_SONG_ID(p_ptr);
1139 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1141 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1145 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1147 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1149 stop_singing(p_ptr);
1154 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1156 p_ptr->redraw |= PR_MANA;
1157 if (INTERUPTING_SONG_EFFECT(p_ptr))
1159 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1160 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1161 msg_print(_("歌を再開した。", "You restart singing."));
1162 p_ptr->action = ACTION_SING;
1163 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1164 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1165 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1168 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1169 p_ptr->spell_exp[spell] += 5;
1170 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1171 { 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; }
1172 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1173 { 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; }
1174 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1175 { 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; }
1177 /* Do any effects of continual song */
1178 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1182 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1183 * @param flag 探し出したい呪いフラグ配列
1184 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1187 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1190 int choices[INVEN_TOTAL-INVEN_RARM];
1193 /* Paranoia -- Player has no warning-item */
1194 if (!(p_ptr->cursed & flag)) return NULL;
1196 /* Search Inventry */
1197 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1199 object_type *o_ptr = &p_ptr->inventory_list[i];
1201 if (o_ptr->curse_flags & flag)
1203 choices[number] = i;
1206 else if ((flag == TRC_ADD_L_CURSE) ||
1207 (flag == TRC_ADD_H_CURSE) ||
1208 (flag == TRC_DRAIN_HP) ||
1209 (flag == TRC_DRAIN_MANA) ||
1210 (flag == TRC_CALL_ANIMAL) ||
1211 (flag == TRC_CALL_DEMON) ||
1212 (flag == TRC_CALL_DRAGON) ||
1213 (flag == TRC_CALL_UNDEAD) ||
1214 (flag == TRC_COWARDICE) ||
1215 (flag == TRC_LOW_MELEE) ||
1216 (flag == TRC_LOW_AC) ||
1217 (flag == TRC_LOW_MAGIC) ||
1218 (flag == TRC_FAST_DIGEST) ||
1219 (flag == TRC_SLOW_REGEN) )
1222 BIT_FLAGS flgs[TR_FLAG_SIZE];
1223 object_flags(o_ptr, flgs);
1226 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1227 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1228 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1229 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1230 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1231 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1232 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1233 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1234 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1235 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1236 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1237 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1238 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1239 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1242 if (have_flag(flgs, cf))
1244 choices[number] = i;
1250 /* Choice one of them */
1251 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1254 static void process_world_aux_digestion(void)
1256 if (!p_ptr->inside_battle)
1258 /* Digest quickly when gorged */
1259 if (p_ptr->food >= PY_FOOD_MAX)
1261 /* Digest a lot of food */
1262 (void)set_food(p_ptr->food - 100);
1265 /* Digest normally -- Every 50 game turns */
1266 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1268 /* Basic digestion rate based on speed */
1269 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1271 /* Regeneration takes more food */
1272 if (p_ptr->regenerate)
1274 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1276 if (p_ptr->cursed & TRC_FAST_DIGEST)
1279 /* Slow digestion takes less food */
1280 if (p_ptr->slow_digest)
1283 /* Minimal digestion */
1284 if (digestion < 1) digestion = 1;
1285 /* Maximal digestion */
1286 if (digestion > 100) digestion = 100;
1288 /* Digest some food */
1289 (void)set_food(p_ptr->food - digestion);
1294 if ((p_ptr->food < PY_FOOD_FAINT))
1296 /* Faint occasionally */
1297 if (!p_ptr->paralyzed && (randint0(100) < 10))
1299 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1300 disturb(TRUE, TRUE);
1302 /* Hack -- faint (bypass free action) */
1303 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1306 /* Starve to death (slowly) */
1307 if (p_ptr->food < PY_FOOD_STARVE)
1309 /* Calculate damage */
1310 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1312 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1319 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1320 * / Handle timed damage and regeneration every 10 game turns
1323 static void process_world_aux_hp_and_sp(void)
1325 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1326 bool cave_no_regen = FALSE;
1327 int upkeep_factor = 0;
1329 /* Default regeneration */
1330 int regen_amount = PY_REGEN_NORMAL;
1333 /*** Damage over Time ***/
1335 /* Take damage from poison */
1336 if (p_ptr->poisoned && !IS_INVULN())
1338 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1341 /* Take damage from cuts */
1342 if (p_ptr->cut && !IS_INVULN())
1346 /* Mortal wound or Deep Gash */
1347 if (p_ptr->cut > 1000)
1352 else if (p_ptr->cut > 200)
1358 else if (p_ptr->cut > 100)
1363 else if (p_ptr->cut > 50)
1368 else if (p_ptr->cut > 25)
1373 else if (p_ptr->cut > 10)
1384 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1387 /* (Vampires) Take damage from sunlight */
1388 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1390 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1392 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1394 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1395 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1396 cave_no_regen = TRUE;
1400 if (p_ptr->inventory_list[INVEN_LITE].tval && (p_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1401 !p_ptr->resist_lite)
1403 object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1404 GAME_TEXT o_name [MAX_NLEN];
1405 char ouch [MAX_NLEN+40];
1407 /* Get an object description */
1408 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1409 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1411 cave_no_regen = TRUE;
1413 /* Get an object description */
1414 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1415 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1417 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1421 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1425 if (have_flag(f_ptr->flags, FF_DEEP))
1427 damage = 6000 + randint0(4000);
1429 else if (!p_ptr->levitation)
1431 damage = 3000 + randint0(2000);
1436 if(prace_is_(RACE_ENT)) damage += damage / 3;
1437 if(p_ptr->resist_fire) damage = damage / 3;
1438 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1439 if(p_ptr->levitation) damage = damage / 5;
1441 damage = damage / 100 + (randint0(100) < (damage % 100));
1443 if (p_ptr->levitation)
1445 msg_print(_("熱で火傷した!", "The heat burns you!"));
1446 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1447 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1451 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1452 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1453 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1456 cave_no_regen = TRUE;
1460 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1464 if (have_flag(f_ptr->flags, FF_DEEP))
1466 damage = 6000 + randint0(4000);
1468 else if (!p_ptr->levitation)
1470 damage = 3000 + randint0(2000);
1475 if (p_ptr->resist_cold) damage = damage / 3;
1476 if (IS_OPPOSE_COLD()) damage = damage / 3;
1477 if (p_ptr->levitation) damage = damage / 5;
1479 damage = damage / 100 + (randint0(100) < (damage % 100));
1481 if (p_ptr->levitation)
1483 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1484 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1485 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1489 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1490 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1491 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1494 cave_no_regen = TRUE;
1498 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1502 if (have_flag(f_ptr->flags, FF_DEEP))
1504 damage = 6000 + randint0(4000);
1506 else if (!p_ptr->levitation)
1508 damage = 3000 + randint0(2000);
1513 if (p_ptr->resist_elec) damage = damage / 3;
1514 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1515 if (p_ptr->levitation) damage = damage / 5;
1517 damage = damage / 100 + (randint0(100) < (damage % 100));
1519 if (p_ptr->levitation)
1521 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1522 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1523 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1527 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1528 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1529 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1532 cave_no_regen = TRUE;
1536 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1540 if (have_flag(f_ptr->flags, FF_DEEP))
1542 damage = 6000 + randint0(4000);
1544 else if (!p_ptr->levitation)
1546 damage = 3000 + randint0(2000);
1551 if (p_ptr->resist_acid) damage = damage / 3;
1552 if (IS_OPPOSE_ACID()) damage = damage / 3;
1553 if (p_ptr->levitation) damage = damage / 5;
1555 damage = damage / 100 + (randint0(100) < (damage % 100));
1557 if (p_ptr->levitation)
1559 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1560 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1561 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1565 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1566 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1567 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1570 cave_no_regen = TRUE;
1574 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1578 if (have_flag(f_ptr->flags, FF_DEEP))
1580 damage = 6000 + randint0(4000);
1582 else if (!p_ptr->levitation)
1584 damage = 3000 + randint0(2000);
1589 if (p_ptr->resist_pois) damage = damage / 3;
1590 if (IS_OPPOSE_POIS()) damage = damage / 3;
1591 if (p_ptr->levitation) damage = damage / 5;
1593 damage = damage / 100 + (randint0(100) < (damage % 100));
1595 if (p_ptr->levitation)
1597 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1598 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1599 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1600 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1604 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1605 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1606 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1607 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1610 cave_no_regen = TRUE;
1614 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1615 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1617 if (p_ptr->total_weight > weight_limit())
1619 msg_print(_("溺れている!", "You are drowning!"));
1620 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1621 cave_no_regen = TRUE;
1628 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1630 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1631 if (prace_is_(RACE_ENT)) damage += damage / 3;
1632 if (p_ptr->resist_fire) damage = damage / 3;
1633 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1634 msg_print(_("熱い!", "It's hot!"));
1635 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1637 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1639 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1640 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1641 if (p_ptr->resist_elec) damage = damage / 3;
1642 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1643 msg_print(_("痛い!", "It hurts!"));
1644 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1646 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1648 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1649 if (p_ptr->resist_cold) damage = damage / 3;
1650 if (IS_OPPOSE_COLD()) damage = damage / 3;
1651 msg_print(_("冷たい!", "It's cold!"));
1652 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1656 /* Spectres -- take damage when moving through walls */
1658 * Added: ANYBODY takes damage if inside through walls
1659 * without wraith form -- NOTE: Spectres will never be
1660 * reduced below 0 hp by being inside a stone wall; others
1663 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1665 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1668 cave_no_regen = TRUE;
1670 if (p_ptr->pass_wall)
1672 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1673 dam_desc = _("密度", "density");
1677 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1678 dam_desc = _("硬い岩", "solid rock");
1681 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1686 /*** handle regeneration ***/
1689 if (p_ptr->food < PY_FOOD_WEAK)
1691 /* Lower regeneration */
1692 if (p_ptr->food < PY_FOOD_STARVE)
1696 else if (p_ptr->food < PY_FOOD_FAINT)
1698 regen_amount = PY_REGEN_FAINT;
1702 regen_amount = PY_REGEN_WEAK;
1706 /* Are we walking the pattern? */
1707 if (pattern_effect())
1709 cave_no_regen = TRUE;
1713 /* Regeneration ability */
1714 if (p_ptr->regenerate)
1716 regen_amount = regen_amount * 2;
1718 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1722 if (p_ptr->cursed & TRC_SLOW_REGEN)
1729 /* Searching or Resting */
1730 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1732 regen_amount = regen_amount * 2;
1735 upkeep_factor = calculate_upkeep();
1737 /* No regeneration while special action */
1738 if ((p_ptr->action == ACTION_LEARN) ||
1739 (p_ptr->action == ACTION_HAYAGAKE) ||
1740 (p_ptr->special_defense & KATA_KOUKIJIN))
1742 upkeep_factor += 100;
1745 /* Regenerate the mana */
1746 regenmana(upkeep_factor, regen_amount);
1749 /* Recharge magic eater's power */
1750 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1752 regenmagic(regen_amount);
1755 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1757 while (upkeep_factor > 100)
1759 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1761 do_cmd_pet_dismiss();
1763 upkeep_factor = calculate_upkeep();
1765 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1770 /* Poisoned or cut yields no healing */
1771 if (p_ptr->poisoned) regen_amount = 0;
1772 if (p_ptr->cut) regen_amount = 0;
1774 /* Special floor -- Pattern, in a wall -- yields no healing */
1775 if (cave_no_regen) regen_amount = 0;
1777 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1779 /* Regenerate Hit Points if needed */
1780 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1782 regenhp(regen_amount);
1787 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1788 * / Handle timeout every 10 game turns
1791 static void process_world_aux_timeout(void)
1793 const int dec_count = (easy_band ? 2 : 1);
1795 /*** Timeout Various Things ***/
1798 if (p_ptr->tim_mimic)
1800 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1803 /* Hack -- Hallucinating */
1806 (void)set_image(p_ptr->image - dec_count);
1812 (void)set_blind(p_ptr->blind - dec_count);
1815 /* Times see-invisible */
1816 if (p_ptr->tim_invis)
1818 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1829 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1832 /* Timed temporary elemental brands. -LM- */
1833 if (p_ptr->ele_attack)
1835 p_ptr->ele_attack--;
1837 /* Clear all temporary elemental brands. */
1838 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1841 /* Timed temporary elemental immune. -LM- */
1842 if (p_ptr->ele_immune)
1844 p_ptr->ele_immune--;
1846 /* Clear all temporary elemental brands. */
1847 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1850 /* Timed infra-vision */
1851 if (p_ptr->tim_infra)
1853 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1857 if (p_ptr->tim_stealth)
1859 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1862 /* Timed levitation */
1863 if (p_ptr->tim_levitation)
1865 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1868 /* Timed sh_touki */
1869 if (p_ptr->tim_sh_touki)
1871 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1875 if (p_ptr->tim_sh_fire)
1877 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1881 if (p_ptr->tim_sh_holy)
1883 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1887 if (p_ptr->tim_eyeeye)
1889 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1892 /* Timed resist-magic */
1893 if (p_ptr->resist_magic)
1895 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1898 /* Timed regeneration */
1899 if (p_ptr->tim_regen)
1901 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1904 /* Timed resist nether */
1905 if (p_ptr->tim_res_nether)
1907 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1910 /* Timed resist time */
1911 if (p_ptr->tim_res_time)
1913 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1917 if (p_ptr->tim_reflect)
1919 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1923 if (p_ptr->multishadow)
1925 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1928 /* Timed Robe of dust */
1929 if (p_ptr->dustrobe)
1931 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1934 /* Timed infra-vision */
1935 if (p_ptr->kabenuke)
1937 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1941 if (p_ptr->paralyzed)
1943 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1947 if (p_ptr->confused)
1949 (void)set_confused(p_ptr->confused - dec_count);
1955 (void)set_afraid(p_ptr->afraid - dec_count);
1961 (void)set_fast(p_ptr->fast - 1, TRUE);
1967 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1970 /* Protection from evil */
1971 if (p_ptr->protevil)
1973 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1976 /* Invulnerability */
1979 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1983 if (p_ptr->wraith_form)
1985 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1991 (void)set_hero(p_ptr->hero - 1, TRUE);
1997 (void)set_shero(p_ptr->shero - 1, TRUE);
2003 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2009 (void)set_shield(p_ptr->shield - 1, TRUE);
2013 if (p_ptr->tsubureru)
2015 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2019 if (p_ptr->magicdef)
2021 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2025 if (p_ptr->tsuyoshi)
2027 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2031 if (p_ptr->oppose_acid)
2033 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2036 /* Oppose Lightning */
2037 if (p_ptr->oppose_elec)
2039 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2043 if (p_ptr->oppose_fire)
2045 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2049 if (p_ptr->oppose_cold)
2051 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2055 if (p_ptr->oppose_pois)
2057 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2062 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2065 /*** Poison and Stun and Cut ***/
2068 if (p_ptr->poisoned)
2070 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2072 /* Apply some healing */
2073 (void)set_poisoned(p_ptr->poisoned - adjust);
2079 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2081 /* Apply some healing */
2082 (void)set_stun(p_ptr->stun - adjust);
2088 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2090 /* Hack -- Truly "mortal" wound */
2091 if (p_ptr->cut > 1000) adjust = 0;
2093 /* Apply some healing */
2094 (void)set_cut(p_ptr->cut - adjust);
2100 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2101 * / Handle burning fuel every 10 game turns
2104 static void process_world_aux_light(void)
2106 /* Check for light being wielded */
2107 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2109 /* Burn some fuel in the current lite */
2110 if (o_ptr->tval == TV_LITE)
2112 /* Hack -- Use some fuel (except on artifacts) */
2113 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2115 /* Decrease life-span */
2116 if (o_ptr->name2 == EGO_LITE_LONG)
2118 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2120 else o_ptr->xtra4--;
2122 /* Notice interesting fuel steps */
2123 notice_lite_change(o_ptr);
2130 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2131 * / Handle mutation effects once every 10 game turns
2134 static void process_world_aux_mutation(void)
2136 /* No mutation with effects */
2137 if (!p_ptr->muta2) return;
2139 /* No effect on monster arena */
2140 if (p_ptr->inside_battle) return;
2142 /* No effect on the global map */
2143 if (p_ptr->wild_mode) return;
2145 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2147 disturb(FALSE, TRUE);
2148 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2149 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2150 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2151 (void)set_afraid(0);
2154 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2156 if (!p_ptr->resist_fear)
2158 disturb(FALSE, TRUE);
2159 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2160 set_afraid(p_ptr->afraid + 13 + randint1(26));
2164 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2166 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2168 disturb(FALSE, TRUE);
2169 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2171 teleport_player(40, TELEPORT_PASSIVE);
2175 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2177 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2179 disturb(FALSE, TRUE);
2180 p_ptr->redraw |= PR_EXTRA;
2181 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2184 if (!p_ptr->resist_conf)
2186 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2189 if (!p_ptr->resist_chaos)
2194 if (one_in_(3)) lose_all_info();
2196 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2198 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2199 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2205 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2206 (void)set_image(p_ptr->image + randint0(150) + 150);
2212 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2214 if (!p_ptr->resist_chaos)
2216 disturb(FALSE, TRUE);
2217 p_ptr->redraw |= PR_EXTRA;
2218 (void)set_image(p_ptr->image + randint0(50) + 20);
2222 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2224 disturb(FALSE, TRUE);
2225 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2227 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2230 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2231 !p_ptr->anti_magic && one_in_(9000))
2234 disturb(FALSE, TRUE);
2235 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2236 "Magical energy flows through you! You must release it!"));
2240 (void)get_hack_dir(&dire);
2241 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2244 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2246 bool pet = one_in_(6);
2247 BIT_FLAGS mode = PM_ALLOW_GROUP;
2249 if (pet) mode |= PM_FORCE_PET;
2250 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2252 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode))
2254 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2255 disturb(FALSE, TRUE);
2259 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2261 disturb(FALSE, TRUE);
2264 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2266 if (p_ptr->fast > 0)
2272 set_slow(randint1(30) + 10, FALSE);
2277 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2279 if (p_ptr->slow > 0)
2285 set_fast(randint1(30) + 10, FALSE);
2290 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2292 disturb(FALSE, TRUE);
2293 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2295 banish_monsters(100);
2296 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2300 /* Pick a random shop (except home) */
2303 n = randint0(MAX_STORES);
2305 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2307 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2313 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2317 msg_print(_("影につつまれた。", "A shadow passes over you."));
2320 /* Absorb light from the current possition */
2321 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2326 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2328 /* Absorb some fuel in the current lite */
2329 if (o_ptr->tval == TV_LITE)
2331 /* Use some fuel (except on artifacts) */
2332 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2334 /* Heal the player a bit */
2335 hp_player(o_ptr->xtra4 / 20);
2337 /* Decrease life-span of lite */
2339 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2341 /* Notice interesting fuel steps */
2342 notice_lite_change(o_ptr);
2347 * Unlite the area (radius 10) around player and
2348 * do 50 points damage to every affected monster
2350 unlite_area(50, 10);
2353 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2355 bool pet = one_in_(3);
2356 BIT_FLAGS mode = PM_ALLOW_GROUP;
2358 if (pet) mode |= PM_FORCE_PET;
2359 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2361 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2363 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2364 disturb(FALSE, TRUE);
2368 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2370 disturb(FALSE, TRUE);
2371 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2374 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2376 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2378 if (!lose_mutation(0))
2379 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2381 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2383 disturb(FALSE, TRUE);
2384 msg_print(_("非物質化した!", "You feel insubstantial!"));
2387 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2389 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2393 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2395 int which_stat = randint0(A_MAX);
2396 int sustained = FALSE;
2401 if (p_ptr->sustain_str) sustained = TRUE;
2404 if (p_ptr->sustain_int) sustained = TRUE;
2407 if (p_ptr->sustain_wis) sustained = TRUE;
2410 if (p_ptr->sustain_dex) sustained = TRUE;
2413 if (p_ptr->sustain_con) sustained = TRUE;
2416 if (p_ptr->sustain_chr) sustained = TRUE;
2419 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2425 disturb(FALSE, TRUE);
2426 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2428 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2431 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2433 bool pet = one_in_(5);
2434 BIT_FLAGS mode = PM_ALLOW_GROUP;
2436 if (pet) mode |= PM_FORCE_PET;
2437 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2439 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2441 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2442 disturb(FALSE, TRUE);
2445 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2447 if (p_ptr->tim_esp > 0)
2449 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2450 set_tim_esp(0, TRUE);
2454 msg_print(_("精神が広がった!", "Your mind expands!"));
2455 set_tim_esp(p_ptr->lev, FALSE);
2458 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2460 disturb(FALSE, TRUE);
2461 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2463 set_food(PY_FOOD_WEAK);
2464 if (music_singing_any()) stop_singing(p_ptr);
2465 if (hex_spelling_any()) stop_hex_spell_all();
2468 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2473 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2475 int danger_amount = 0;
2476 MONSTER_IDX monster;
2478 for (monster = 0; monster < current_floor_ptr->m_max; monster++)
2480 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2481 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2482 if (!monster_is_valid(m_ptr)) continue;
2484 if (r_ptr->level >= p_ptr->lev)
2486 danger_amount += r_ptr->level - p_ptr->lev + 1;
2490 if (danger_amount > 100)
2491 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2492 else if (danger_amount > 50)
2493 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2494 else if (danger_amount > 20)
2495 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2496 else if (danger_amount > 10)
2497 msg_print(_("心配な気がする!", "You feel paranoid!"));
2498 else if (danger_amount > 5)
2499 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2501 msg_print(_("寂しい気がする。", "You feel lonely."));
2504 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2506 disturb(FALSE, TRUE);
2507 msg_print(_("無敵な気がする!", "You feel invincible!"));
2509 (void)set_invuln(randint1(8) + 8, FALSE);
2512 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2514 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2518 HIT_POINT healing = p_ptr->csp;
2519 if (healing > wounds) healing = wounds;
2522 p_ptr->csp -= healing;
2523 p_ptr->redraw |= (PR_HP | PR_MANA);
2527 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2529 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2533 HIT_POINT healing = p_ptr->chp;
2534 if (healing > wounds) healing = wounds;
2536 p_ptr->csp += healing;
2537 p_ptr->redraw |= (PR_HP | PR_MANA);
2538 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2542 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2544 INVENTORY_IDX slot = 0;
2545 object_type *o_ptr = NULL;
2547 disturb(FALSE, TRUE);
2548 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2549 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2552 if (has_melee_weapon(INVEN_RARM))
2555 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
2557 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2559 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2563 else if (has_melee_weapon(INVEN_LARM))
2565 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2568 if (slot && !object_is_cursed(o_ptr))
2570 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2571 inven_drop(slot, 1);
2578 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2579 * / Handle curse effects once every 10 game turns
2582 static void process_world_aux_curse(void)
2584 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2587 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2588 * can actually be useful!
2590 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2592 GAME_TEXT o_name[MAX_NLEN];
2594 int i, i_keep = 0, count = 0;
2596 /* Scan the equipment with random teleport ability */
2597 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2599 BIT_FLAGS flgs[TR_FLAG_SIZE];
2600 o_ptr = &p_ptr->inventory_list[i];
2601 if (!o_ptr->k_idx) continue;
2603 object_flags(o_ptr, flgs);
2605 if (have_flag(flgs, TR_TELEPORT))
2607 /* {.} will stop random teleportation. */
2608 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2611 if (one_in_(count)) i_keep = i;
2616 o_ptr = &p_ptr->inventory_list[i_keep];
2617 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2618 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2619 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2621 disturb(FALSE, TRUE);
2622 teleport_player(50, 0L);
2626 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2627 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2628 disturb(TRUE, TRUE);
2631 /* Make a chainsword noise */
2632 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2635 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2637 disturb(FALSE, FALSE);
2640 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2643 (void)activate_ty_curse(FALSE, &count);
2645 /* Handle experience draining */
2646 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2648 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2649 if (p_ptr->exp < 0) p_ptr->exp = 0;
2650 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2651 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2654 /* Add light curse (Later) */
2655 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2657 BIT_FLAGS new_curse;
2660 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2662 new_curse = get_curse(0, o_ptr);
2663 if (!(o_ptr->curse_flags & new_curse))
2665 GAME_TEXT o_name[MAX_NLEN];
2667 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2669 o_ptr->curse_flags |= new_curse;
2670 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2672 o_ptr->feeling = FEEL_NONE;
2674 p_ptr->update |= (PU_BONUS);
2677 /* Add heavy curse (Later) */
2678 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2680 BIT_FLAGS new_curse;
2683 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2685 new_curse = get_curse(1, o_ptr);
2686 if (!(o_ptr->curse_flags & new_curse))
2688 GAME_TEXT o_name[MAX_NLEN];
2690 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2692 o_ptr->curse_flags |= new_curse;
2693 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2694 o_ptr->feeling = FEEL_NONE;
2696 p_ptr->update |= (PU_BONUS);
2700 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2702 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)))
2704 GAME_TEXT o_name[MAX_NLEN];
2706 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2707 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2708 disturb(FALSE, TRUE);
2712 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2714 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)))
2716 GAME_TEXT o_name[MAX_NLEN];
2718 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2719 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2720 disturb(FALSE, TRUE);
2724 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2726 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2727 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2729 GAME_TEXT o_name[MAX_NLEN];
2731 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2732 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2733 disturb(FALSE, TRUE);
2737 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2739 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2740 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2742 GAME_TEXT o_name[MAX_NLEN];
2744 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2745 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2746 disturb(FALSE, TRUE);
2749 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2751 if (!p_ptr->resist_fear)
2753 disturb(FALSE, TRUE);
2754 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2755 set_afraid(p_ptr->afraid + 13 + randint1(26));
2758 /* Teleport player */
2759 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2761 disturb(FALSE, TRUE);
2763 /* Teleport player */
2764 teleport_player(40, TELEPORT_PASSIVE);
2766 /* Handle HP draining */
2767 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2769 GAME_TEXT o_name[MAX_NLEN];
2771 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2772 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2773 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2775 /* Handle mana draining */
2776 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2778 GAME_TEXT o_name[MAX_NLEN];
2780 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2781 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2782 p_ptr->csp -= MIN(p_ptr->lev, 50);
2786 p_ptr->csp_frac = 0;
2788 p_ptr->redraw |= PR_MANA;
2792 /* Rarely, take damage from the Jewel of Judgement */
2793 if (one_in_(999) && !p_ptr->anti_magic)
2795 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2797 if (o_ptr->name1 == ART_JUDGE)
2799 if (object_is_known(o_ptr))
2800 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2802 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2803 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2810 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2811 * / Handle recharging objects once every 10 game turns
2814 static void process_world_aux_recharge(void)
2819 /* Process equipment */
2820 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2822 /* Get the object */
2823 object_type *o_ptr = &p_ptr->inventory_list[i];
2824 if (!o_ptr->k_idx) continue;
2826 /* Recharge activatable objects */
2827 if (o_ptr->timeout > 0)
2832 /* Notice changes */
2833 if (!o_ptr->timeout)
2835 recharged_notice(o_ptr);
2841 /* Notice changes */
2844 p_ptr->window |= (PW_EQUIP);
2849 * Recharge rods. Rods now use timeout to control charging status,
2850 * and each charging rod in a stack decreases the stack's timeout by
2851 * one per current_world_ptr->game_turn. -LM-
2853 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2855 object_type *o_ptr = &p_ptr->inventory_list[i];
2856 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2857 if (!o_ptr->k_idx) continue;
2859 /* Examine all charging rods or stacks of charging rods. */
2860 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2862 /* Determine how many rods are charging. */
2863 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2864 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2866 /* Decrease timeout by that number. */
2867 o_ptr->timeout -= temp;
2869 /* Boundary control. */
2870 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2872 /* Notice changes, provide message if object is inscribed. */
2873 if (!(o_ptr->timeout))
2875 recharged_notice(o_ptr);
2879 /* One of the stack of rod is charged */
2880 else if (o_ptr->timeout % k_ptr->pval)
2887 /* Notice changes */
2890 p_ptr->window |= (PW_INVEN);
2894 /* Process objects on floor */
2895 for (i = 1; i < current_floor_ptr->o_max; i++)
2897 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2899 /* Skip dead objects */
2900 if (!o_ptr->k_idx) continue;
2902 /* Recharge rods on the ground. No messages. */
2903 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2906 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2908 /* Boundary control. */
2909 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2916 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2917 * / Handle involuntary movement once every 10 game turns
2920 static void process_world_aux_movement(void)
2922 /* Delayed Word-of-Recall */
2923 if (p_ptr->word_recall)
2926 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2927 * The player is yanked up/down as soon as
2928 * he loads the autosaved game.
2930 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2931 do_cmd_save_game(TRUE);
2933 /* Count down towards recall */
2934 p_ptr->word_recall--;
2936 p_ptr->redraw |= (PR_STATUS);
2938 /* Activate the recall */
2939 if (!p_ptr->word_recall)
2942 disturb(FALSE, TRUE);
2944 /* Determine the level */
2945 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2947 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2949 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2951 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2953 current_floor_ptr->dun_level = 0;
2954 p_ptr->dungeon_idx = 0;
2956 leave_quest_check();
2957 leave_tower_check();
2959 p_ptr->inside_quest = 0;
2961 p_ptr->leaving = TRUE;
2965 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2967 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2970 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2973 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2974 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2976 /* Nightmare mode makes recall more dangerous */
2977 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2979 if (current_floor_ptr->dun_level < 50)
2981 current_floor_ptr->dun_level *= 2;
2983 else if (current_floor_ptr->dun_level < 99)
2985 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2987 else if (current_floor_ptr->dun_level > 100)
2989 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2993 if (p_ptr->wild_mode)
2995 p_ptr->wilderness_y = p_ptr->y;
2996 p_ptr->wilderness_x = p_ptr->x;
3000 /* Save player position */
3001 p_ptr->oldpx = p_ptr->x;
3002 p_ptr->oldpy = p_ptr->y;
3004 p_ptr->wild_mode = FALSE;
3007 * Clear all saved floors
3008 * and create a first saved floor
3010 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3011 p_ptr->leaving = TRUE;
3013 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
3017 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3019 quest_type* const q_ptr = &quest[i];
3022 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3023 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3024 (q_ptr->level < current_floor_ptr->dun_level))
3026 q_ptr->status = QUEST_STATUS_FAILED;
3027 q_ptr->complev = (byte)p_ptr->lev;
3029 q_ptr->comptime = current_world_ptr->play_time;
3030 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3036 sound(SOUND_TPLEVEL);
3041 /* Delayed Alter reality */
3042 if (p_ptr->alter_reality)
3044 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3045 do_cmd_save_game(TRUE);
3047 /* Count down towards alter */
3048 p_ptr->alter_reality--;
3050 p_ptr->redraw |= (PR_STATUS);
3052 /* Activate the alter reality */
3053 if (!p_ptr->alter_reality)
3056 disturb(FALSE, TRUE);
3058 /* Determine the level */
3059 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3061 msg_print(_("世界が変わった!", "The world changes!"));
3064 * Clear all saved floors
3065 * and create a first saved floor
3067 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3068 p_ptr->leaving = TRUE;
3072 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3075 sound(SOUND_TPLEVEL);
3081 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3082 * / Handle certain things once every 10 game turns
3085 static void process_world(void)
3089 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3090 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3091 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3093 extract_day_hour_min(&day, &hour, &min);
3095 /* Update dungeon feeling, and announce it if changed */
3096 update_dungeon_feeling();
3098 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3099 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3101 current_floor_ptr->dun_level = 0;
3102 p_ptr->dungeon_idx = 0;
3103 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3104 p_ptr->inside_arena = FALSE;
3105 p_ptr->wild_mode = FALSE;
3106 p_ptr->leaving = TRUE;
3109 /*** Check monster arena ***/
3110 if (p_ptr->inside_battle && !p_ptr->leaving)
3116 /* Count all hostile monsters */
3117 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3118 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3120 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3122 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3125 win_m_idx = g_ptr->m_idx;
3129 if (number_mon == 0)
3131 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3133 p_ptr->energy_need = 0;
3134 update_gambling_monsters();
3136 else if ((number_mon-1) == 0)
3138 GAME_TEXT m_name[MAX_NLEN];
3139 monster_type *wm_ptr;
3141 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3143 monster_desc(m_name, wm_ptr, 0);
3144 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3147 if (win_m_idx == (sel_monster+1))
3149 msg_print(_("おめでとうございます。", "Congratulations."));
3150 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3151 p_ptr->au += battle_odds;
3155 msg_print(_("残念でした。", "You lost gold."));
3158 p_ptr->energy_need = 0;
3159 update_gambling_monsters();
3161 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3163 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3164 p_ptr->au += kakekin;
3166 p_ptr->energy_need = 0;
3167 update_gambling_monsters();
3171 /* Every 10 game turns */
3172 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3174 /*** Attempt timed autosave ***/
3175 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3177 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3178 do_cmd_save_game(TRUE);
3181 if (current_floor_ptr->monster_noise && !ignore_unview)
3183 msg_print(_("何かが聞こえた。", "You hear noise."));
3186 /*** Handle the wilderness/town (sunshine) ***/
3188 /* While in town/wilderness */
3189 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3191 /* Hack -- Daybreak/Nighfall in town */
3192 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3196 /* Check for dawn */
3197 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3199 if (dawn) day_break();
3205 /* While in the dungeon (vanilla_town or lite_town mode only) */
3206 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3208 /*** Shuffle the Storekeepers ***/
3210 /* Chance is only once a day (while in dungeon) */
3211 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3213 /* Sometimes, shuffle the shop-keepers */
3214 if (one_in_(STORE_SHUFFLE))
3219 /* Pick a random shop (except home and museum) */
3222 n = randint0(MAX_STORES);
3224 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3226 /* Check every feature */
3227 for (i = 1; i < max_f_idx; i++)
3229 feature_type *f_ptr = &f_info[i];
3231 /* Skip empty index */
3232 if (!f_ptr->name) continue;
3234 /* Skip non-store features */
3235 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3237 /* Verify store type */
3238 if (f_ptr->subtype == n)
3240 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3253 /*** Process the monsters ***/
3255 /* Check for creature generation. */
3256 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3257 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3259 /* Make a new monster */
3260 (void)alloc_monster(MAX_SIGHT + 5, 0);
3263 /* Hack -- Check for creature regeneration */
3264 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3265 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3267 if (!p_ptr->leaving)
3271 /* Hack -- Process the counters of monsters if needed */
3272 for (i = 0; i < MAX_MTIMED; i++)
3274 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3282 if (min != prev_min)
3284 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3285 determine_today_mon(FALSE);
3290 * Nightmare mode activates the TY_CURSE at midnight
3291 * Require exact minute -- Don't activate multiple times in a minute
3294 if (ironman_nightmare && (min != prev_min))
3297 /* Every 15 minutes after 11:00 pm */
3298 if ((hour == 23) && !(min % 15))
3300 disturb(FALSE, TRUE);
3305 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3309 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3313 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3317 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3322 /* TY_CURSE activates at midnight! */
3326 disturb(TRUE, TRUE);
3327 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3329 if (p_ptr->wild_mode)
3331 /* Go into large wilderness view */
3332 p_ptr->oldpy = randint1(MAX_HGT - 2);
3333 p_ptr->oldpx = randint1(MAX_WID - 2);
3334 change_wild_mode(TRUE);
3336 /* Give first move to monsters */
3337 take_turn(p_ptr, 100);
3341 p_ptr->invoking_midnight_curse = TRUE;
3347 /* Check the Food */
3348 process_world_aux_digestion();
3350 /* Process timed damage and regeneration */
3351 process_world_aux_hp_and_sp();
3353 /* Process timeout */
3354 process_world_aux_timeout();
3357 process_world_aux_light();
3359 /* Process mutation effects */
3360 process_world_aux_mutation();
3362 /* Process curse effects */
3363 process_world_aux_curse();
3365 /* Process recharging */
3366 process_world_aux_recharge();
3368 /* Feel the p_ptr->inventory_list */
3372 /* Involuntary Movement */
3373 process_world_aux_movement();
3377 * @brief ウィザードモードへの導入処理
3378 * / Verify use of "wizard" mode
3379 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3381 static bool enter_wizard_mode(void)
3383 /* Ask first time */
3384 if (!p_ptr->noscore)
3386 /* Wizard mode is not permitted */
3387 if (!allow_debug_opts || arg_wizard)
3389 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3393 /* Mention effects */
3394 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3395 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3398 /* Verify request */
3399 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3404 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3406 p_ptr->noscore |= 0x0002;
3417 * @brief デバッグコマンドへの導入処理
3418 * / Verify use of "debug" commands
3419 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3421 static bool enter_debug_mode(void)
3423 /* Ask first time */
3424 if (!p_ptr->noscore)
3426 /* Debug mode is not permitted */
3427 if (!allow_debug_opts)
3429 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3433 /* Mention effects */
3434 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3435 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3439 /* Verify request */
3440 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3445 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3447 p_ptr->noscore |= 0x0008;
3455 * Hack -- Declare the Debug Routines
3457 extern void do_cmd_debug(void);
3459 #endif /* ALLOW_WIZARD */
3465 * @brief ボーグコマンドへの導入処理
3466 * / Verify use of "borg" commands
3467 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3469 static bool enter_borg_mode(void)
3471 /* Ask first time */
3472 if (!(p_ptr->noscore & 0x0010))
3474 /* Mention effects */
3475 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3476 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3480 /* Verify request */
3481 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3486 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3488 p_ptr->noscore |= 0x0010;
3496 * Hack -- Declare the Ben Borg
3498 extern void do_cmd_borg(void);
3500 #endif /* ALLOW_BORG */
3504 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3505 * / Parse and execute the current command Give "Warning" on illegal commands.
3506 * @todo Make some "blocks"
3509 static void process_command(void)
3511 COMMAND_CODE old_now_message = now_message;
3513 /* Handle repeating the last command */
3519 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3520 reset_concent = TRUE;
3522 /* Parse the command */
3523 switch (command_cmd)
3539 /*** Wizard Commands ***/
3541 /* Toggle Wizard Mode */
3546 p_ptr->wizard = FALSE;
3547 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3549 else if (enter_wizard_mode())
3551 p_ptr->wizard = TRUE;
3552 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3554 p_ptr->update |= (PU_MONSTERS);
3556 /* Redraw "title" */
3557 p_ptr->redraw |= (PR_TITLE);
3565 /* Special "debug" commands */
3568 /* Enter debug mode */
3569 if (enter_debug_mode())
3576 #endif /* ALLOW_WIZARD */
3581 /* Special "borg" commands */
3584 /* Enter borg mode */
3585 if (enter_borg_mode())
3587 if (!p_ptr->wild_mode) do_cmd_borg();
3593 #endif /* ALLOW_BORG */
3597 /*** Inventory Commands ***/
3599 /* Wear/wield equipment */
3602 if (!p_ptr->wild_mode) do_cmd_wield();
3606 /* Take off equipment */
3609 if (!p_ptr->wild_mode) do_cmd_takeoff();
3616 if (!p_ptr->wild_mode) do_cmd_drop();
3620 /* Destroy an item */
3627 /* Equipment list */
3634 /* Inventory list */
3642 /*** Various commands ***/
3644 /* Identify an object */
3651 /* Hack -- toggle windows */
3654 toggle_inven_equip();
3659 /*** Standard "Movement" Commands ***/
3664 if (!p_ptr->wild_mode) do_cmd_alter();
3671 if (!p_ptr->wild_mode) do_cmd_tunnel();
3675 /* Move (usually pick up things) */
3682 /* Move (usually do not pick up) */
3690 /*** Running, Resting, Searching, Staying */
3692 /* Begin Running -- Arg is Max Distance */
3695 if (!p_ptr->wild_mode) do_cmd_run();
3699 /* Stay still (usually pick things up) */
3702 do_cmd_stay(always_pickup);
3706 /* Stay still (usually do not pick up) */
3709 do_cmd_stay(!always_pickup);
3713 /* Rest -- Arg is time */
3720 /* Search for traps/doors */
3727 /* Toggle search mode */
3730 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3731 else set_action(ACTION_SEARCH);
3736 /*** Stairs and Doors and Chests and Traps ***/
3739 case SPECIAL_KEY_STORE:
3745 /* Enter building -KMW- */
3746 case SPECIAL_KEY_BUILDING:
3752 /* Enter quest level -KMW- */
3753 case SPECIAL_KEY_QUEST:
3759 /* Go up staircase */
3762 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3764 if (vanilla_town) break;
3766 if (p_ptr->ambush_flag)
3768 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3772 if (p_ptr->food < PY_FOOD_WEAK)
3774 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3778 change_wild_mode(FALSE);
3785 /* Go down staircase */
3788 if (p_ptr->wild_mode)
3789 change_wild_mode(FALSE);
3795 /* Open a door or chest */
3809 /* Jam a door with spikes */
3823 /* Disarm a trap or chest */
3831 /*** Magic and Prayers ***/
3833 /* Gain new spells/prayers */
3836 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3837 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3838 else if (p_ptr->pclass == CLASS_SAMURAI)
3839 do_cmd_gain_hissatsu();
3840 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3841 import_magic_device();
3850 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3851 (p_ptr->pclass == CLASS_BERSERKER) ||
3852 (p_ptr->pclass == CLASS_NINJA) ||
3853 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3854 ) do_cmd_mind_browse();
3855 else if (p_ptr->pclass == CLASS_SMITH)
3857 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3858 do_cmd_magic_eater(TRUE, FALSE);
3859 else if (p_ptr->pclass == CLASS_SNIPER)
3860 do_cmd_snipe_browse();
3861 else do_cmd_browse();
3869 if (!p_ptr->wild_mode)
3871 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3873 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3875 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))
3877 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3880 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3882 concptr which_power = _("魔法", "magic");
3883 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3884 which_power = _("超能力", "psionic powers");
3885 else if (p_ptr->pclass == CLASS_IMITATOR)
3886 which_power = _("ものまね", "imitation");
3887 else if (p_ptr->pclass == CLASS_SAMURAI)
3888 which_power = _("必殺剣", "hissatsu");
3889 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3890 which_power = _("鏡魔法", "mirror magic");
3891 else if (p_ptr->pclass == CLASS_NINJA)
3892 which_power = _("忍術", "ninjutsu");
3893 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3894 which_power = _("祈り", "prayer");
3896 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3899 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3901 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3906 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3907 (p_ptr->pclass == CLASS_BERSERKER) ||
3908 (p_ptr->pclass == CLASS_NINJA) ||
3909 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3912 else if (p_ptr->pclass == CLASS_IMITATOR)
3914 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3915 do_cmd_magic_eater(FALSE, FALSE);
3916 else if (p_ptr->pclass == CLASS_SAMURAI)
3918 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3919 do_cmd_cast_learned();
3920 else if (p_ptr->pclass == CLASS_SMITH)
3922 else if (p_ptr->pclass == CLASS_SNIPER)
3931 /* Issue a pet command */
3938 /*** Use various objects ***/
3940 /* Inscribe an object */
3947 /* Uninscribe an object */
3950 do_cmd_uninscribe();
3954 /* Activate an artifact */
3968 /* Fuel your lantern/torch */
3978 do_cmd_fire(SP_NONE);
3985 do_cmd_throw(1, FALSE, -1);
3999 if (use_command && rogue_like_commands)
4010 /* Quaff a potion */
4013 do_cmd_quaff_potion();
4020 do_cmd_read_scroll();
4027 if (use_command && !rogue_like_commands)
4034 /* Use racial power */
4037 do_cmd_racial_power();
4042 /*** Looking at Things (nearby or on map) ***/
4044 /* Full dungeon map */
4051 /* Locate player on map */
4065 /* Target monster or location */
4074 /*** Help and Such ***/
4083 /* Identify symbol */
4086 do_cmd_query_symbol();
4090 /* Character description */
4093 do_cmd_change_name();
4098 /*** System Commands ***/
4100 /* Hack -- User interface */
4107 /* Single line from a pref file */
4116 do_cmd_reload_autopick();
4122 do_cmd_edit_autopick();
4126 /* Interact with macros */
4133 /* Interact with visuals */
4141 /* Interact with colors */
4149 /* Interact with options */
4153 (void)combine_and_reorder_home(STORE_HOME);
4158 /*** Misc Commands ***/
4174 /* Repeat level feeling */
4181 /* Show previous message */
4184 do_cmd_message_one();
4188 /* Show previous messages */
4191 do_cmd_messages(old_now_message);
4195 /* Show quest status -KMW- */
4198 do_cmd_checkquest();
4202 /* Redraw the screen */
4205 now_message = old_now_message;
4210 #ifndef VERIFY_SAVEFILE
4212 /* Hack -- Save and don't quit */
4215 do_cmd_save_game(FALSE);
4219 #endif /* VERIFY_SAVEFILE */
4229 case SPECIAL_KEY_QUIT:
4231 do_cmd_save_and_exit();
4235 /* Quit (commit suicide) */
4248 /* Check artifacts, uniques, objects */
4255 /* Load "screen dump" */
4258 do_cmd_load_screen();
4262 /* Save "screen dump" */
4265 do_cmd_save_screen();
4269 /* Record/stop "Movie" */
4272 prepare_movie_hooks();
4276 /* Make random artifact list */
4279 spoil_random_artifact("randifact.txt");
4286 if (!p_ptr->wild_mode) do_cmd_travel();
4287 if (p_ptr->special_defense & KATA_MUSOU)
4289 set_action(ACTION_NONE);
4295 /* Hack -- Unknown command */
4298 if (flush_failure) flush();
4302 sound(SOUND_ILLEGAL);
4303 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4308 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4314 if (!p_ptr->energy_use && !now_message)
4315 now_message = old_now_message;
4319 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4322 static void pack_overflow(void)
4324 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
4326 GAME_TEXT o_name[MAX_NLEN];
4329 /* Is auto-destroy done? */
4330 update_creature(p_ptr);
4331 if (!p_ptr->inventory_list[INVEN_PACK].k_idx) return;
4333 /* Access the slot to be dropped */
4334 o_ptr = &p_ptr->inventory_list[INVEN_PACK];
4336 disturb(FALSE, TRUE);
4339 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4340 object_desc(o_name, o_ptr, 0);
4342 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4344 /* Drop it (carefully) near the player */
4345 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4347 /* Modify, Describe, Optimize */
4348 inven_item_increase(INVEN_PACK, -255);
4349 inven_item_describe(INVEN_PACK);
4350 inven_item_optimize(INVEN_PACK);
4357 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4360 static void process_upkeep_with_speed(void)
4362 /* Give the player some energy */
4363 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4365 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4368 /* No current_world_ptr->game_turn yet */
4369 if (p_ptr->enchant_energy_need > 0) return;
4371 while (p_ptr->enchant_energy_need <= 0)
4373 /* Handle the player song */
4374 if (!load) check_music();
4376 /* Hex - Handle the hex spells */
4377 if (!load) check_hex();
4378 if (!load) revenge_spell();
4380 /* There is some randomness of needed energy */
4381 p_ptr->enchant_energy_need += ENERGY_NEED();
4385 static void process_fishing(void)
4387 Term_xtra(TERM_XTRA_DELAY, 10);
4391 bool success = FALSE;
4392 get_mon_num_prep(monster_is_fishing_target, NULL);
4393 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);
4395 if (r_idx && one_in_(2))
4398 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4399 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4400 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4402 GAME_TEXT m_name[MAX_NLEN];
4403 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4404 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4410 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4412 disturb(FALSE, TRUE);
4417 * @brief プレイヤーの行動処理 / Process the player
4420 * Notice the annoying code to handle "pack overflow", which\n
4421 * must come first just in case somebody manages to corrupt\n
4422 * the savefiles by clever use of menu commands or something.\n
4424 static void process_player(void)
4428 /*** Apply energy ***/
4430 if (p_ptr->hack_mutation)
4432 msg_print(_("何か変わった気がする!", "You feel different!"));
4434 (void)gain_mutation(p_ptr, 0);
4435 p_ptr->hack_mutation = FALSE;
4438 if (p_ptr->invoking_midnight_curse)
4441 activate_ty_curse(FALSE, &count);
4442 p_ptr->invoking_midnight_curse = FALSE;
4445 if (p_ptr->inside_battle)
4447 for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4449 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4451 if (!monster_is_valid(m_ptr)) continue;
4453 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4454 update_monster(m_idx, FALSE);
4459 /* Give the player some energy */
4460 else if (!(load && p_ptr->energy_need <= 0))
4462 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4465 /* No current_world_ptr->game_turn yet */
4466 if (p_ptr->energy_need > 0) return;
4467 if (!command_rep) prt_time();
4469 /*** Check for interupts ***/
4471 /* Complete resting */
4472 if (p_ptr->resting < 0)
4475 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4478 if ((p_ptr->chp == p_ptr->mhp) &&
4479 (p_ptr->csp >= p_ptr->msp))
4481 set_action(ACTION_NONE);
4485 /* Complete resting */
4486 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4489 if ((p_ptr->chp == p_ptr->mhp) &&
4490 (p_ptr->csp >= p_ptr->msp) &&
4491 !p_ptr->blind && !p_ptr->confused &&
4492 !p_ptr->poisoned && !p_ptr->afraid &&
4493 !p_ptr->stun && !p_ptr->cut &&
4494 !p_ptr->slow && !p_ptr->paralyzed &&
4495 !p_ptr->image && !p_ptr->word_recall &&
4496 !p_ptr->alter_reality)
4498 set_action(ACTION_NONE);
4503 if (p_ptr->action == ACTION_FISH) process_fishing();
4505 /* Handle "abort" */
4508 /* Check for "player abort" (semi-efficiently for resting) */
4509 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4514 /* Check for a key */
4517 flush(); /* Flush input */
4519 disturb(FALSE, TRUE);
4521 /* Hack -- Show a Message */
4522 msg_print(_("中断しました。", "Canceled."));
4527 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4529 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4530 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4532 if (MON_CSLEEP(m_ptr))
4534 GAME_TEXT m_name[MAX_NLEN];
4537 (void)set_monster_csleep(p_ptr->riding, 0);
4538 monster_desc(m_name, m_ptr, 0);
4539 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4542 if (MON_STUNNED(m_ptr))
4544 /* Hack -- Recover from stun */
4545 if (set_monster_stunned(p_ptr->riding,
4546 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4548 GAME_TEXT m_name[MAX_NLEN];
4549 monster_desc(m_name, m_ptr, 0);
4550 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4554 if (MON_CONFUSED(m_ptr))
4556 /* Hack -- Recover from confusion */
4557 if (set_monster_confused(p_ptr->riding,
4558 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4560 GAME_TEXT m_name[MAX_NLEN];
4561 monster_desc(m_name, m_ptr, 0);
4562 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4566 if (MON_MONFEAR(m_ptr))
4568 /* Hack -- Recover from fear */
4569 if(set_monster_monfear(p_ptr->riding,
4570 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4572 GAME_TEXT m_name[MAX_NLEN];
4573 monster_desc(m_name, m_ptr, 0);
4574 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4584 if (p_ptr->lightspeed)
4586 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4588 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4590 if(P_PTR_KI < 40) P_PTR_KI = 0;
4591 else P_PTR_KI -= 40;
4592 p_ptr->update |= (PU_BONUS);
4594 if (p_ptr->action == ACTION_LEARN)
4597 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4599 /* Convert the unit (1/2^16) to (1/2^32) */
4600 s64b_LSHIFT(cost, cost_frac, 16);
4602 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4606 p_ptr->csp_frac = 0;
4607 set_action(ACTION_NONE);
4612 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4614 p_ptr->redraw |= PR_MANA;
4617 if (p_ptr->special_defense & KATA_MASK)
4619 if (p_ptr->special_defense & KATA_MUSOU)
4623 set_action(ACTION_NONE);
4628 p_ptr->redraw |= (PR_MANA);
4633 /*** Handle actual user input ***/
4635 /* Repeat until out of energy */
4636 while (p_ptr->energy_need <= 0)
4638 p_ptr->window |= PW_PLAYER;
4639 p_ptr->sutemi = FALSE;
4640 p_ptr->counter = FALSE;
4641 p_ptr->now_damaged = FALSE;
4645 /* Place the cursor on the player */
4646 move_cursor_relative(p_ptr->y, p_ptr->x);
4648 /* Refresh (optional) */
4649 if (fresh_before) Term_fresh();
4651 /* Hack -- Pack Overflow */
4654 /* Hack -- cancel "lurking browse mode" */
4655 if (!command_new) command_see = FALSE;
4657 /* Assume free current_world_ptr->game_turn */
4660 if (p_ptr->inside_battle)
4662 /* Place the cursor on the player */
4663 move_cursor_relative(p_ptr->y, p_ptr->x);
4665 command_cmd = SPECIAL_KEY_BUILDING;
4667 /* Process the command */
4671 /* Paralyzed or Knocked Out */
4672 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4674 take_turn(p_ptr, 100);
4678 else if (p_ptr->action == ACTION_REST)
4681 if (p_ptr->resting > 0)
4683 /* Reduce rest count */
4686 if (!p_ptr->resting) set_action(ACTION_NONE);
4687 p_ptr->redraw |= (PR_STATE);
4690 take_turn(p_ptr, 100);
4694 else if (p_ptr->action == ACTION_FISH)
4696 take_turn(p_ptr, 100);
4708 else if (travel.run)
4715 /* Repeated command */
4716 else if (command_rep)
4718 /* Count this execution */
4721 p_ptr->redraw |= (PR_STATE);
4724 /* Hack -- Assume messages were seen */
4727 /* Clear the top line */
4730 /* Process the command */
4734 /* Normal command */
4737 /* Place the cursor on the player */
4738 move_cursor_relative(p_ptr->y, p_ptr->x);
4741 /* Get a command (normal) */
4742 request_command(FALSE);
4745 /* Process the command */
4749 /* Hack -- Pack Overflow */
4755 if (p_ptr->energy_use)
4757 /* Use some energy */
4758 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4760 /* The Randomness is irrelevant */
4761 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4765 /* There is some randomness of needed energy */
4766 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4769 /* Hack -- constant hallucination */
4770 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4772 /* Shimmer multi-hued monsters */
4773 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4775 monster_type *m_ptr;
4776 monster_race *r_ptr;
4778 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4779 if (!monster_is_valid(m_ptr)) continue;
4781 /* Skip unseen monsters */
4782 if (!m_ptr->ml) continue;
4784 /* Access the monster race */
4785 r_ptr = &r_info[m_ptr->ap_r_idx];
4787 /* Skip non-multi-hued monsters */
4788 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4791 /* Redraw regardless */
4792 lite_spot(m_ptr->fy, m_ptr->fx);
4796 /* Handle monster detection */
4797 if (repair_monsters)
4799 /* Reset the flag */
4800 repair_monsters = FALSE;
4802 /* Rotate detection flags */
4803 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4805 monster_type *m_ptr;
4806 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4807 if (!monster_is_valid(m_ptr)) continue;
4809 /* Nice monsters get mean */
4810 if (m_ptr->mflag & MFLAG_NICE)
4812 /* Nice monsters get mean */
4813 m_ptr->mflag &= ~(MFLAG_NICE);
4816 /* Handle memorized monsters */
4817 if (m_ptr->mflag2 & MFLAG2_MARK)
4819 /* Maintain detection */
4820 if (m_ptr->mflag2 & MFLAG2_SHOW)
4823 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4825 /* Still need repairs */
4826 repair_monsters = TRUE;
4829 /* Remove detection */
4833 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4835 /* Assume invisible */
4837 update_monster(m_idx, FALSE);
4839 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4840 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4842 /* Redraw regardless */
4843 lite_spot(m_ptr->fy, m_ptr->fx);
4848 if (p_ptr->pclass == CLASS_IMITATOR)
4851 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4854 for (j = 0; j < p_ptr->mane_num; j++)
4856 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4857 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4861 p_ptr->redraw |= (PR_IMITATION);
4863 if (p_ptr->action == ACTION_LEARN)
4866 p_ptr->redraw |= (PR_STATE);
4869 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4872 p_ptr->redraw |= (PR_MAP);
4873 p_ptr->update |= (PU_MONSTERS);
4874 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4876 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4878 p_ptr->timewalk = FALSE;
4879 p_ptr->energy_need = ENERGY_NEED();
4885 /* Hack -- notice death */
4886 if (!p_ptr->playing || p_ptr->is_dead)
4888 p_ptr->timewalk = FALSE;
4893 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
4895 /* Handle "leaving" */
4896 if (p_ptr->leaving) break;
4899 /* Update scent trail */
4904 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4908 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4909 * ゲームを終了するかのいずれかまでループする。
4912 * This function will not exit until the level is completed,\n
4913 * the user dies, or the game is terminated.\n
4916 static void dungeon(bool load_game)
4920 /* Set the base level */
4921 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4923 /* Reset various flags */
4924 current_world_ptr->is_loading_now = FALSE;
4927 p_ptr->leaving = FALSE;
4929 /* Reset the "command" vars */
4932 #if 0 /* Don't reset here --- It's used for Arena */
4941 /* Cancel the target */
4945 p_ptr->ambush_flag = FALSE;
4947 /* Cancel the health bar */
4950 /* Check visual effects */
4951 repair_monsters = TRUE;
4952 repair_objects = TRUE;
4955 disturb(TRUE, TRUE);
4957 /* Get index of current quest (if any) */
4958 quest_num = quest_number(current_floor_ptr->dun_level);
4960 /* Inside a quest? */
4963 /* Mark the quest monster */
4964 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4967 /* Track maximum player level */
4968 if (p_ptr->max_plv < p_ptr->lev)
4970 p_ptr->max_plv = p_ptr->lev;
4974 /* Track maximum dungeon level (if not in quest -KMW-) */
4975 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4977 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4978 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4981 (void)calculate_upkeep();
4983 /* Validate the panel */
4984 panel_bounds_center();
4986 /* Verify the panel */
4992 /* Enter "xtra" mode */
4993 current_world_ptr->character_xtra = TRUE;
4995 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4996 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4997 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);
5001 /* Leave "xtra" mode */
5002 current_world_ptr->character_xtra = FALSE;
5004 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5005 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5009 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5010 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5011 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5013 if (p_ptr->inside_battle)
5017 p_ptr->energy_need = 0;
5018 update_gambling_monsters();
5022 msg_print(_("試合開始!", "Ready..Fight!"));
5027 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5028 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5030 /* Hack -- notice death or departure */
5031 if (!p_ptr->playing || p_ptr->is_dead) return;
5033 /* Print quest message if appropriate */
5034 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5036 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5037 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5039 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5041 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5043 msg_format("この階には%sの主である%sが棲んでいる。",
5044 d_name+d_info[p_ptr->dungeon_idx].name,
5045 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5047 msg_format("%^s lives in this level as the keeper of %s.",
5048 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5049 d_name+d_info[p_ptr->dungeon_idx].name);
5053 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5055 /*** Process this dungeon level ***/
5057 /* Reset the monster generation level */
5058 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5060 /* Reset the object generation level */
5061 current_floor_ptr->object_level = current_floor_ptr->base_level;
5063 current_world_ptr->is_loading_now = TRUE;
5065 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5066 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5067 p_ptr->energy_need = 0;
5069 /* Not leaving dungeon */
5070 p_ptr->leaving_dungeon = FALSE;
5072 /* Initialize monster process */
5078 /* Hack -- Compact the monster list occasionally */
5079 if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5081 /* Hack -- Compress the monster list occasionally */
5082 if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0);
5085 /* Hack -- Compact the object list occasionally */
5086 if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5088 /* Hack -- Compress the object list occasionally */
5089 if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0);
5091 /* Process the player */
5093 process_upkeep_with_speed();
5097 /* Hack -- Hilite the player */
5098 move_cursor_relative(p_ptr->y, p_ptr->x);
5100 /* Optional fresh */
5101 if (fresh_after) Term_fresh();
5103 /* Hack -- Notice death or departure */
5104 if (!p_ptr->playing || p_ptr->is_dead) break;
5106 /* Process all of the monsters */
5111 /* Hack -- Hilite the player */
5112 move_cursor_relative(p_ptr->y, p_ptr->x);
5114 /* Optional fresh */
5115 if (fresh_after) Term_fresh();
5117 /* Hack -- Notice death or departure */
5118 if (!p_ptr->playing || p_ptr->is_dead) break;
5120 /* Process the world */
5125 /* Hack -- Hilite the player */
5126 move_cursor_relative(p_ptr->y, p_ptr->x);
5128 /* Optional fresh */
5129 if (fresh_after) Term_fresh();
5131 /* Hack -- Notice death or departure */
5132 if (!p_ptr->playing || p_ptr->is_dead) break;
5134 /* Count game turns */
5135 current_world_ptr->game_turn++;
5137 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5139 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5140 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5143 prevent_turn_overflow();
5145 /* Handle "leaving" */
5146 if (p_ptr->leaving) break;
5148 if (wild_regen) wild_regen--;
5151 /* Inside a quest and non-unique questor? */
5152 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5154 /* Un-mark the quest monster */
5155 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5158 /* Not save-and-quit and not dead? */
5159 if (p_ptr->playing && !p_ptr->is_dead)
5162 * Maintain Unique monsters and artifact, save current
5163 * floor, then prepare next floor
5167 /* Forget the flag */
5168 reinit_wilderness = FALSE;
5171 /* Write about current level on the play record once per level */
5177 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5180 * Modified by Arcum Dagsson to support
5181 * separate macro files for different realms.
5183 static void load_all_pref_files(void)
5187 /* Access the "user" pref file */
5188 sprintf(buf, "user.prf");
5190 /* Process that file */
5191 process_pref_file(buf);
5193 /* Access the "user" system pref file */
5194 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5196 /* Process that file */
5197 process_pref_file(buf);
5199 /* Access the "race" pref file */
5200 sprintf(buf, "%s.prf", rp_ptr->title);
5202 /* Process that file */
5203 process_pref_file(buf);
5205 /* Access the "class" pref file */
5206 sprintf(buf, "%s.prf", cp_ptr->title);
5208 /* Process that file */
5209 process_pref_file(buf);
5211 /* Access the "character" pref file */
5212 sprintf(buf, "%s.prf", p_ptr->base_name);
5214 /* Process that file */
5215 process_pref_file(buf);
5217 /* Access the "realm 1" pref file */
5218 if (p_ptr->realm1 != REALM_NONE)
5220 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5222 /* Process that file */
5223 process_pref_file(buf);
5226 /* Access the "realm 2" pref file */
5227 if (p_ptr->realm2 != REALM_NONE)
5229 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5231 /* Process that file */
5232 process_pref_file(buf);
5236 /* Load an autopick preference file */
5237 autopick_load_pref(FALSE);
5241 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5244 * If the "new_game" parameter is true, then, after loading the
5245 * savefile, we will commit suicide, if necessary, to allow the
5246 * player to start a new game.
5248 void play_game(bool new_game)
5251 bool load_game = TRUE;
5252 bool init_random_seed = FALSE;
5262 else if (chuukei_server)
5264 prepare_chuukei_hooks();
5275 p_ptr->hack_mutation = FALSE;
5277 /* Hack -- Character is "icky" */
5278 current_world_ptr->character_icky = TRUE;
5280 /* Make sure main term is active */
5281 Term_activate(angband_term[0]);
5283 /* Initialise the resize hooks */
5284 angband_term[0]->resize_hook = resize_map;
5286 for (i = 1; i < 8; i++)
5288 /* Does the term exist? */
5289 if (angband_term[i])
5291 /* Add the redraw on resize hook */
5292 angband_term[i]->resize_hook = redraw_window;
5296 /* Hack -- current_world_ptr->game_turn off the cursor */
5297 (void)Term_set_cursor(0);
5300 /* Attempt to load */
5303 quit(_("セーブファイルが壊れています", "broken savefile"));
5306 /* Extract the options */
5307 extract_option_vars();
5309 /* Report waited score */
5310 if (p_ptr->wait_report_score)
5315 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5318 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5319 update_creature(p_ptr);
5321 p_ptr->is_dead = TRUE;
5323 start_time = (u32b)time(NULL);
5325 /* No suspending now */
5326 signals_ignore_tstp();
5328 /* Hack -- Character is now "icky" */
5329 current_world_ptr->character_icky = TRUE;
5331 /* Build the filename */
5332 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5334 /* Open the high score file, for reading/writing */
5335 highscore_fd = fd_open(buf, O_RDWR);
5337 /* 町名消失バグ対策(#38205) Init the wilderness */
5338 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5340 /* Handle score, show Top scores */
5341 success = send_world_score(TRUE);
5343 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5345 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5350 p_ptr->wait_report_score = FALSE;
5352 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5354 /* Shut the high score file */
5355 (void)fd_close(highscore_fd);
5357 /* Forget the high score fd */
5360 /* Allow suspending now */
5361 signals_handle_tstp();
5366 current_world_ptr->creating_savefile = new_game;
5368 /* Nothing loaded */
5369 if (!current_world_ptr->character_loaded)
5371 /* Make new player */
5374 /* The dungeon is not ready */
5375 current_world_ptr->character_dungeon = FALSE;
5377 /* Prepare to init the RNG */
5378 init_random_seed = TRUE;
5380 /* Initialize the saved floors data */
5381 init_saved_floors(FALSE);
5384 /* Old game is loaded. But new game is requested. */
5387 /* Initialize the saved floors data */
5388 init_saved_floors(TRUE);
5391 /* Process old character */
5394 /* Process the player name */
5395 process_player_name(FALSE);
5399 if (init_random_seed)
5404 /* Roll new character */
5407 /* The dungeon is not ready */
5408 current_world_ptr->character_dungeon = FALSE;
5411 current_floor_ptr->dun_level = 0;
5412 p_ptr->inside_quest = 0;
5413 p_ptr->inside_arena = FALSE;
5414 p_ptr->inside_battle = FALSE;
5418 /* Hack -- seed for flavors */
5419 current_world_ptr->seed_flavor = randint0(0x10000000);
5421 /* Hack -- seed for town layout */
5422 current_world_ptr->seed_town = randint0(0x10000000);
5424 /* Roll up a new character */
5432 determine_bounty_uniques();
5433 determine_today_mon(FALSE);
5435 /* Initialize object array */
5440 write_level = FALSE;
5442 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5444 " ---- Restart Game ----"));
5447 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5448 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5450 if (p_ptr->riding == -1)
5453 for (i = current_floor_ptr->m_max; i > 0; i--)
5455 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5464 current_world_ptr->creating_savefile = FALSE;
5466 p_ptr->teleport_town = FALSE;
5467 p_ptr->sutemi = FALSE;
5468 current_world_ptr->timewalk_m_idx = 0;
5469 p_ptr->now_damaged = FALSE;
5471 start_time = time(NULL) - 1;
5472 record_o_name[0] = '\0';
5474 /* Reset map panel */
5475 panel_row_min = current_floor_ptr->height;
5476 panel_col_min = current_floor_ptr->width;
5478 /* Sexy gal gets bonus to maximum weapon skill of whip */
5479 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5480 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5482 /* Fill the arrays of floors and walls in the good proportions */
5483 set_floor_and_wall(p_ptr->dungeon_idx);
5485 /* Flavor the objects */
5488 /* Flash a message */
5489 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5491 /* Flush the message */
5495 /* Hack -- Enter wizard mode */
5498 if (enter_wizard_mode())
5500 p_ptr->wizard = TRUE;
5502 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5504 /* Initialize the saved floors data */
5505 init_saved_floors(TRUE);
5508 p_ptr->inside_quest = 0;
5510 /* Avoid crash in update_view() */
5511 p_ptr->y = p_ptr->x = 10;
5514 else if (p_ptr->is_dead)
5516 quit("Already dead.");
5520 /* Initialize the town-buildings if necessary */
5521 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5523 /* Init the wilderness */
5525 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5528 init_flags = INIT_ONLY_BUILDINGS;
5530 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5532 select_floor_music();
5536 /* Generate a dungeon level if needed */
5537 if (!current_world_ptr->character_dungeon)
5544 /* HACK -- Restore from panic-save */
5545 if (p_ptr->panic_save)
5547 /* No player? -- Try to regenerate floor */
5548 if (!p_ptr->y || !p_ptr->x)
5550 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5554 /* Still no player? -- Try to locate random place */
5555 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5557 /* No longer in panic */
5558 p_ptr->panic_save = 0;
5562 /* Character is now "complete" */
5563 current_world_ptr->character_generated = TRUE;
5566 /* Hack -- Character is no longer "icky" */
5567 current_world_ptr->character_icky = FALSE;
5573 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5574 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5579 p_ptr->playing = TRUE;
5581 /* Reset the visual mappings */
5584 /* Load the "pref" files */
5585 load_all_pref_files();
5587 /* Give startup outfit (after loading pref files) */
5593 /* React to changes */
5594 Term_xtra(TERM_XTRA_REACT, 0);
5596 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5597 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5600 /* Set or clear "rogue_like_commands" if requested */
5601 if (arg_force_original) rogue_like_commands = FALSE;
5602 if (arg_force_roguelike) rogue_like_commands = TRUE;
5604 /* Hack -- Enforce "delayed death" */
5605 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5607 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5609 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5611 monster_type *m_ptr;
5612 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5613 monster_race *r_ptr = &r_info[pet_r_idx];
5614 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5615 (PM_FORCE_PET | PM_NO_KAGE));
5616 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5617 m_ptr->mspeed = r_ptr->speed;
5618 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5619 m_ptr->max_maxhp = m_ptr->maxhp;
5620 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5621 m_ptr->dealt_damage = 0;
5622 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5625 (void)combine_and_reorder_home(STORE_HOME);
5626 (void)combine_and_reorder_home(STORE_MUSEUM);
5628 select_floor_music();
5633 /* Process the level */
5636 /* Hack -- prevent "icky" message */
5637 current_world_ptr->character_xtra = TRUE;
5641 current_world_ptr->character_xtra = FALSE;
5643 /* Cancel the target */
5646 /* Cancel the health bar */
5653 /* Handle "quit and save" */
5654 if (!p_ptr->playing && !p_ptr->is_dead) break;
5656 /* Erase the old current_floor_ptr->grid_array */
5658 if (!p_ptr->is_dead) wipe_m_list();
5665 /* Accidental Death */
5666 if (p_ptr->playing && p_ptr->is_dead)
5668 if (p_ptr->inside_arena)
5670 p_ptr->inside_arena = FALSE;
5671 if (p_ptr->arena_number > MAX_ARENA_MONS)
5672 p_ptr->arena_number++;
5674 p_ptr->arena_number = -1 - p_ptr->arena_number;
5675 p_ptr->is_dead = FALSE;
5677 p_ptr->chp_frac = 0;
5678 p_ptr->exit_bldg = TRUE;
5681 /* Leave through the exit */
5682 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5684 /* prepare next floor */
5689 /* Mega-Hack -- Allow player to cheat death */
5690 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5697 /* Handle "death" */
5698 if (p_ptr->is_dead) break;
5700 /* Make a new level */
5712 * @brief ゲームターンからの実時間換算を行うための補正をかける
5713 * @param hoge ゲームターン
5714 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5715 * @return 修正をかけた後のゲームターン
5717 s32b turn_real(s32b hoge)
5719 switch (p_ptr->start_race)
5725 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5732 * @brief ターンのオーバーフローに対する対処
5733 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5734 * @return 修正をかけた後のゲームターン
5736 void prevent_turn_overflow(void)
5738 int rollback_days, i, j;
5739 s32b rollback_turns;
5741 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5743 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5744 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5746 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5747 else current_world_ptr->game_turn = 1;
5748 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5749 else current_floor_ptr->generated_turn = 1;
5750 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
5751 else current_world_ptr->arena_start_turn = 1;
5752 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5753 else p_ptr->feeling_turn = 1;
5755 for (i = 1; i < max_towns; i++)
5757 for (j = 0; j < MAX_STORES; j++)
5759 store_type *st_ptr = &town_info[i].store[j];
5761 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5763 st_ptr->last_visit -= rollback_turns;
5764 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5767 if (st_ptr->store_open)
5769 st_ptr->store_open -= rollback_turns;
5770 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5778 * Close up the current game (player may or may not be dead)
5782 * This function is called only from "main.c" and "signals.c".
5785 void close_game(void)
5788 bool do_send = TRUE;
5790 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5793 /* Flush the messages */
5796 /* Flush the input */
5800 /* No suspending now */
5801 signals_ignore_tstp();
5804 /* Hack -- Character is now "icky" */
5805 current_world_ptr->character_icky = TRUE;
5808 /* Build the filename */
5809 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5811 /* Grab permissions */
5814 /* Open the high score file, for reading/writing */
5815 highscore_fd = fd_open(buf, O_RDWR);
5817 /* Drop permissions */
5823 /* Handle retirement */
5824 if (p_ptr->total_winner) kingly();
5827 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5829 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5831 else do_send = FALSE;
5838 /* Show more info */
5844 if ((!send_world_score(do_send)))
5846 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5847 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5849 p_ptr->wait_report_score = TRUE;
5850 p_ptr->is_dead = FALSE;
5851 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5854 if (!p_ptr->wait_report_score)
5857 else if (highscore_fd >= 0)
5859 display_scores_aux(0, 10, -1, NULL);
5862 /* Dump bones file */
5871 do_cmd_save_game(FALSE);
5873 /* Prompt for scores */
5874 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5875 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5877 /* Predict score (or ESCAPE) */
5878 if (inkey() != ESCAPE) predict_score();
5882 /* Shut the high score file */
5883 (void)fd_close(highscore_fd);
5885 /* Forget the high score fd */
5888 /* Kill all temporal files */
5889 clear_saved_floor_files();
5891 /* Allow suspending now */
5892 signals_handle_tstp();