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-ego.h"
46 #include "object-curse.h"
47 #include "object-flavor.h"
50 #include "spells-summon.h"
51 #include "spells-object.h"
52 #include "spells-status.h"
53 #include "spells-floor.h"
54 #include "monster-spell.h"
61 #include "player-move.h"
62 #include "player-status.h"
63 #include "player-class.h"
64 #include "player-race.h"
65 #include "player-personality.h"
66 #include "cmd-spell.h"
67 #include "realm-hex.h"
68 #include "objectkind.h"
69 #include "object-hook.h"
71 #include "monster-process.h"
72 #include "monster-status.h"
73 #include "monsterrace-hook.h"
74 #include "floor-save.h"
76 #include "player-skill.h"
78 #include "view-mainwindow.h"
79 #include "dungeon-file.h"
81 #include "player-effects.h"
86 #include "realm-song.h"
87 #include "targeting.h"
91 * Hack -- Link a copyright message into the executable
93 const concptr copyright[5] =
95 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
97 "This software may be copied and distributed for educational, research,",
98 "and not for profit purposes provided that this copyright and statement",
99 "are included in all such copies."
102 bool can_save = FALSE; /* Game can be saved */
104 COMMAND_CODE now_message;
106 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
109 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
111 concptr ANGBAND_KEYBOARD = "0";
114 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
116 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
117 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
120 * Flags for initialization
125 * @brief 擬似鑑定を実際に行い判定を反映する
126 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
127 * @param heavy 重度の擬似鑑定を行うならばTRUE
130 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
133 object_type *o_ptr = &p_ptr->inventory_list[slot];
134 GAME_TEXT o_name[MAX_NLEN];
136 /* We know about it already, do not tell us again */
137 if (o_ptr->ident & (IDENT_SENSE))return;
139 /* It is fully known, no information needed */
140 if (object_is_known(o_ptr)) return;
142 /* Check for a feeling */
143 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
145 /* Skip non-feelings */
149 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
160 feel = FEEL_EXCELLENT;
166 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
168 feel = FEEL_UNCURSED;
173 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
179 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
186 feel = FEEL_WORTHLESS;
191 feel = FEEL_TERRIBLE;
197 /* Stop everything */
198 if (disturb_minor) disturb(FALSE, FALSE);
200 /* Get an object description */
201 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
203 /* Message (equipment) */
204 if (slot >= INVEN_RARM)
207 msg_format("%s%s(%c)は%sという感じがする...",
208 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
210 msg_format("You feel the %s (%c) you are %s %s %s...",
211 o_name, index_to_label(slot), describe_use(slot),
212 ((o_ptr->number == 1) ? "is" : "are"),
213 game_inscriptions[feel]);
218 /* Message (p_ptr->inventory_list) */
222 msg_format("ザックの中の%s(%c)は%sという感じがする...",
223 o_name, index_to_label(slot),game_inscriptions[feel]);
225 msg_format("You feel the %s (%c) in your pack %s %s...",
226 o_name, index_to_label(slot),
227 ((o_ptr->number == 1) ? "is" : "are"),
228 game_inscriptions[feel]);
233 o_ptr->ident |= (IDENT_SENSE);
235 /* Set the "inscription" */
236 o_ptr->feeling = feel;
238 /* Auto-inscription/destroy */
239 autopick_alter_item(slot, destroy_feeling);
240 p_ptr->update |= (PU_COMBINE | PU_REORDER);
242 p_ptr->window |= (PW_INVEN | PW_EQUIP);
248 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
251 * Sense the p_ptr->inventory_list\n
253 * Class 0 = Warrior --> fast and heavy\n
254 * Class 1 = Mage --> slow and light\n
255 * Class 2 = Priest --> fast but light\n
256 * Class 3 = Rogue --> okay and heavy\n
257 * Class 4 = Ranger --> slow but heavy (changed!)\n
258 * Class 5 = Paladin --> slow but heavy\n
260 static void sense_inventory1(void)
263 PLAYER_LEVEL plev = p_ptr->lev;
268 /*** Check for "sensing" ***/
270 /* No sensing when confused */
271 if (p_ptr->confused) return;
273 /* Analyze the class */
274 switch (p_ptr->pclass)
282 if (0 != randint0(9000L / (plev * plev + 40))) return;
293 if (0 != randint0(6000L / (plev * plev + 50))) return;
302 case CLASS_HIGH_MAGE:
304 case CLASS_MAGIC_EATER:
306 /* Very bad (light) sensing */
307 if (0 != randint0(240000L / (plev + 5))) return;
315 /* Good (light) sensing */
316 if (0 != randint0(10000L / (plev * plev + 40))) return;
325 if (0 != randint0(20000L / (plev * plev + 40))) return;
336 if (0 != randint0(95000L / (plev * plev + 40))) return;
348 if (0 != randint0(77777L / (plev * plev + 40))) return;
356 case CLASS_WARRIOR_MAGE:
360 if (0 != randint0(75000L / (plev * plev + 40))) return;
365 case CLASS_MINDCRAFTER:
367 case CLASS_BLUE_MAGE:
368 case CLASS_MIRROR_MASTER:
371 if (0 != randint0(55000L / (plev * plev + 40))) return;
376 case CLASS_CHAOS_WARRIOR:
379 if (0 != randint0(80000L / (plev * plev + 40))) return;
388 case CLASS_FORCETRAINER:
391 if (0 != randint0(20000L / (plev * plev + 40))) return;
399 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
407 case CLASS_BEASTMASTER:
410 if (0 != randint0(65000L / (plev * plev + 40))) return;
414 case CLASS_BERSERKER:
423 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
425 /*** Sense everything ***/
427 /* Check everything */
428 for (i = 0; i < INVEN_TOTAL; i++)
432 o_ptr = &p_ptr->inventory_list[i];
434 /* Skip empty slots */
435 if (!o_ptr->k_idx) continue;
437 /* Valid "tval" codes */
464 /* Skip non-sense machines */
467 /* Occasional failure on p_ptr->inventory_list items */
468 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
471 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
476 sense_inventory_aux(i, heavy);
481 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
484 static void sense_inventory2(void)
487 PLAYER_LEVEL plev = p_ptr->lev;
491 /*** Check for "sensing" ***/
493 /* No sensing when confused */
494 if (p_ptr->confused) return;
496 /* Analyze the class */
497 switch (p_ptr->pclass)
503 case CLASS_BERSERKER:
511 case CLASS_CHAOS_WARRIOR:
513 case CLASS_BEASTMASTER:
516 /* Very bad (light) sensing */
517 if (0 != randint0(240000L / (plev + 5))) return;
523 case CLASS_WARRIOR_MAGE:
528 if (0 != randint0(95000L / (plev * plev + 40))) return;
536 case CLASS_FORCETRAINER:
537 case CLASS_MINDCRAFTER:
540 if (0 != randint0(20000L / (plev * plev + 40))) return;
546 case CLASS_HIGH_MAGE:
548 case CLASS_MAGIC_EATER:
549 case CLASS_MIRROR_MASTER:
550 case CLASS_BLUE_MAGE:
553 if (0 != randint0(9000L / (plev * plev + 40))) return;
561 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
567 /*** Sense everything ***/
569 /* Check everything */
570 for (i = 0; i < INVEN_TOTAL; i++)
574 o_ptr = &p_ptr->inventory_list[i];
576 /* Skip empty slots */
577 if (!o_ptr->k_idx) continue;
579 /* Valid "tval" codes */
592 /* Skip non-sense machines */
595 /* Occasional failure on p_ptr->inventory_list items */
596 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
598 sense_inventory_aux(i, TRUE);
603 * @brief パターン終点到達時のテレポート処理を行う
606 static void pattern_teleport(void)
609 DEPTH max_level = 99;
612 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
617 /* Only downward in ironman mode */
618 if (ironman_downward)
619 min_level = current_floor_ptr->dun_level;
622 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
624 if (current_floor_ptr->dun_level > 100)
625 max_level = MAX_DEPTH - 1;
626 else if (current_floor_ptr->dun_level == 100)
631 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
632 min_level = d_info[p_ptr->dungeon_idx].mindepth;
636 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
639 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
641 /* Ask for a level */
642 if (!get_string(ppp, tmp_val, 10)) return;
644 /* Extract request */
645 command_arg = (COMMAND_ARG)atoi(tmp_val);
647 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
649 teleport_player(200, 0L);
656 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
657 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
660 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
662 if (autosave_l) do_cmd_save_game(TRUE);
665 current_floor_ptr->dun_level = command_arg;
669 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
671 p_ptr->inside_quest = 0;
675 * Clear all saved floors
676 * and create a first saved floor
678 prepare_change_floor_mode(CFM_FIRST_FLOOR);
679 p_ptr->leaving = TRUE;
683 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
684 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
686 static bool pattern_effect(void)
690 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
692 if ((PRACE_IS_(RACE_AMBERITE)) &&
693 (p_ptr->cut > 0) && one_in_(10))
698 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
700 switch (pattern_type)
702 case PATTERN_TILE_END:
704 (void)restore_all_status();
705 (void)restore_level();
706 (void)cure_critical_wounds(1000);
708 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
709 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
712 * We could make the healing effect of the
713 * Pattern center one-time only to avoid various kinds
714 * of abuse, like luring the win monster into fighting you
715 * in the middle of the pattern...
719 case PATTERN_TILE_OLD:
723 case PATTERN_TILE_TELEPORT:
727 case PATTERN_TILE_WRECKED:
729 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
733 if (PRACE_IS_(RACE_AMBERITE) && !one_in_(2))
735 else if (!IS_INVULN())
736 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
745 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
746 * @param percent 回復比率
749 static void regenhp(int percent)
755 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
756 if (p_ptr->action == ACTION_HAYAGAKE) return;
758 /* Save the old hitpoints */
759 old_chp = p_ptr->chp;
762 * Extract the new hitpoints
764 * 'percent' is the Regen factor in unit (1/2^16)
767 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
769 /* Convert the unit (1/2^16) to (1/2^32) */
770 s64b_LSHIFT(new_chp, new_chp_frac, 16);
773 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
777 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
779 p_ptr->chp = p_ptr->mhp;
784 if (old_chp != p_ptr->chp)
786 p_ptr->redraw |= (PR_HP);
787 p_ptr->window |= (PW_PLAYER);
794 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
795 * @param upkeep_factor ペット維持によるMPコスト量
796 * @param regen_amount 回復量
799 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
801 MANA_POINT old_csp = p_ptr->csp;
802 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
805 * Excess mana will decay 32 times faster than normal
808 if (p_ptr->csp > p_ptr->msp)
810 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
812 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
814 /* Convert the unit (1/2^16) to (1/2^32) */
815 s64b_LSHIFT(decay, decay_frac, 16);
818 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
821 if (p_ptr->csp < p_ptr->msp)
823 p_ptr->csp = p_ptr->msp;
828 /* Regenerating mana (unless the player has excess mana) */
829 else if (regen_rate > 0)
831 /* (percent/100) is the Regen factor in unit (1/2^16) */
832 MANA_POINT new_mana = 0;
833 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
835 /* Convert the unit (1/2^16) to (1/2^32) */
836 s64b_LSHIFT(new_mana, new_mana_frac, 16);
839 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
841 /* Must set frac to zero even if equal */
842 if (p_ptr->csp >= p_ptr->msp)
844 p_ptr->csp = p_ptr->msp;
850 /* Reduce mana (even when the player has excess mana) */
853 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
854 s32b reduce_mana = 0;
855 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
857 /* Convert the unit (1/2^16) to (1/2^32) */
858 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
861 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
871 if (old_csp != p_ptr->csp)
873 p_ptr->redraw |= (PR_MANA);
874 p_ptr->window |= (PW_PLAYER);
875 p_ptr->window |= (PW_SPELL);
881 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
882 * @param regen_amount 回復量
885 static void regenmagic(int regen_amount)
890 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
892 for (i = 0; i < EATER_EXT*2; i++)
894 if (!p_ptr->magic_num2[i]) continue;
895 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
897 /* Increase remaining charge number like float value */
898 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
899 p_ptr->magic_num1[i] += new_mana;
901 /* Check maximum charge */
902 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
904 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
908 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
910 if (!p_ptr->magic_num1[i]) continue;
911 if (!p_ptr->magic_num2[i]) continue;
913 /* Decrease remaining period for charging */
914 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
915 / (dev * 16 * PY_REGEN_NORMAL);
916 p_ptr->magic_num1[i] -= new_mana;
918 /* Check minimum remaining period for charging */
919 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
926 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
928 * @note Should probably be done during monster turns.
930 static void regen_monsters(void)
935 /* Regenerate everyone */
936 for (i = 1; i < current_floor_ptr->m_max; i++)
938 /* Check the i'th monster */
939 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
940 monster_race *r_ptr = &r_info[m_ptr->r_idx];
942 if (!monster_is_valid(m_ptr)) continue;
944 /* Allow regeneration (if needed) */
945 if (m_ptr->hp < m_ptr->maxhp)
947 /* Hack -- Base regeneration */
948 frac = m_ptr->maxhp / 100;
950 /* Hack -- Minimal regeneration rate */
951 if (!frac) if (one_in_(2)) frac = 1;
953 /* Hack -- Some monsters regenerate quickly */
954 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
956 /* Hack -- Regenerate */
959 /* Do not over-regenerate */
960 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
962 /* Redraw (later) if needed */
963 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
964 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
971 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
973 * @note Should probably be done during monster turns.
975 static void regen_captured_monsters(void)
980 /* Regenerate everyone */
981 for (i = 0; i < INVEN_TOTAL; i++)
984 object_type *o_ptr = &p_ptr->inventory_list[i];
986 if (!o_ptr->k_idx) continue;
987 if (o_ptr->tval != TV_CAPTURE) continue;
988 if (!o_ptr->pval) continue;
992 r_ptr = &r_info[o_ptr->pval];
994 /* Allow regeneration (if needed) */
995 if (o_ptr->xtra4 < o_ptr->xtra5)
997 /* Hack -- Base regeneration */
998 frac = o_ptr->xtra5 / 100;
1000 /* Hack -- Minimal regeneration rate */
1001 if (!frac) if (one_in_(2)) frac = 1;
1003 /* Hack -- Some monsters regenerate quickly */
1004 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1006 /* Hack -- Regenerate */
1007 o_ptr->xtra4 += (XTRA16)frac;
1009 /* Do not over-regenerate */
1010 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1017 p_ptr->update |= (PU_COMBINE);
1018 p_ptr->window |= (PW_INVEN);
1019 p_ptr->window |= (PW_EQUIP);
1025 * @brief 寿命つき光源の警告メッセージ処理
1026 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1029 static void notice_lite_change(object_type *o_ptr)
1031 /* Hack -- notice interesting fuel steps */
1032 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1034 p_ptr->window |= (PW_EQUIP);
1037 /* Hack -- Special treatment when blind */
1040 /* Hack -- save some light for later */
1041 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1044 /* The light is now out */
1045 else if (o_ptr->xtra4 == 0)
1047 disturb(FALSE, TRUE);
1048 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1050 /* Recalculate torch radius */
1051 p_ptr->update |= (PU_TORCH);
1053 /* Some ego light lose its effects without fuel */
1054 p_ptr->update |= (PU_BONUS);
1057 /* The light is getting dim */
1058 else if (o_ptr->name2 == EGO_LITE_LONG)
1060 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1061 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1063 if (disturb_minor) disturb(FALSE, TRUE);
1064 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1068 /* The light is getting dim */
1069 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1071 if (disturb_minor) disturb(FALSE, TRUE);
1072 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1078 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1079 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1082 static void recharged_notice(object_type *o_ptr)
1084 GAME_TEXT o_name[MAX_NLEN];
1088 /* No inscription */
1089 if (!o_ptr->inscription) return;
1092 s = my_strchr(quark_str(o_ptr->inscription), '!');
1094 /* Process notification request. */
1097 /* Find another '!' */
1100 /* Describe (briefly) */
1101 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1103 /* Notify the player */
1105 msg_format("%sは再充填された。", o_name);
1107 if (o_ptr->number > 1)
1108 msg_format("Your %s are recharged.", o_name);
1110 msg_format("Your %s is recharged.", o_name);
1113 disturb(FALSE, FALSE);
1119 /* Keep looking for '!'s */
1120 s = my_strchr(s + 1, '!');
1125 * @brief プレイヤーの歌に関する継続処理
1128 static void check_music(void)
1130 const magic_type *s_ptr;
1132 MANA_POINT need_mana;
1133 u32b need_mana_frac;
1135 /* Music singed by player */
1136 if (p_ptr->pclass != CLASS_BARD) return;
1137 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1139 if (p_ptr->anti_magic)
1141 stop_singing(p_ptr);
1145 spell = SINGING_SONG_ID(p_ptr);
1146 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1148 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1152 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1154 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1156 stop_singing(p_ptr);
1161 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1163 p_ptr->redraw |= PR_MANA;
1164 if (INTERUPTING_SONG_EFFECT(p_ptr))
1166 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1167 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1168 msg_print(_("歌を再開した。", "You restart singing."));
1169 p_ptr->action = ACTION_SING;
1170 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1171 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1172 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1175 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1176 p_ptr->spell_exp[spell] += 5;
1177 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1178 { 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; }
1179 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1180 { 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; }
1181 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1182 { 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; }
1184 /* Do any effects of continual song */
1185 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1189 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1190 * @param flag 探し出したい呪いフラグ配列
1191 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1194 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1197 int choices[INVEN_TOTAL-INVEN_RARM];
1200 /* Paranoia -- Player has no warning-item */
1201 if (!(p_ptr->cursed & flag)) return NULL;
1203 /* Search Inventry */
1204 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1206 object_type *o_ptr = &p_ptr->inventory_list[i];
1208 if (o_ptr->curse_flags & flag)
1210 choices[number] = i;
1213 else if ((flag == TRC_ADD_L_CURSE) ||
1214 (flag == TRC_ADD_H_CURSE) ||
1215 (flag == TRC_DRAIN_HP) ||
1216 (flag == TRC_DRAIN_MANA) ||
1217 (flag == TRC_CALL_ANIMAL) ||
1218 (flag == TRC_CALL_DEMON) ||
1219 (flag == TRC_CALL_DRAGON) ||
1220 (flag == TRC_CALL_UNDEAD) ||
1221 (flag == TRC_COWARDICE) ||
1222 (flag == TRC_LOW_MELEE) ||
1223 (flag == TRC_LOW_AC) ||
1224 (flag == TRC_LOW_MAGIC) ||
1225 (flag == TRC_FAST_DIGEST) ||
1226 (flag == TRC_SLOW_REGEN) )
1229 BIT_FLAGS flgs[TR_FLAG_SIZE];
1230 object_flags(o_ptr, flgs);
1233 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1234 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1235 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1236 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1237 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1238 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1239 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1240 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1241 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1242 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1243 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1244 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1245 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1246 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1249 if (have_flag(flgs, cf))
1251 choices[number] = i;
1257 /* Choice one of them */
1258 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1261 static void process_world_aux_digestion(void)
1263 if (!p_ptr->inside_battle)
1265 /* Digest quickly when gorged */
1266 if (p_ptr->food >= PY_FOOD_MAX)
1268 /* Digest a lot of food */
1269 (void)set_food(p_ptr->food - 100);
1272 /* Digest normally -- Every 50 game turns */
1273 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1275 /* Basic digestion rate based on speed */
1276 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1278 /* Regeneration takes more food */
1279 if (p_ptr->regenerate)
1281 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1283 if (p_ptr->cursed & TRC_FAST_DIGEST)
1286 /* Slow digestion takes less food */
1287 if (p_ptr->slow_digest)
1290 /* Minimal digestion */
1291 if (digestion < 1) digestion = 1;
1292 /* Maximal digestion */
1293 if (digestion > 100) digestion = 100;
1295 /* Digest some food */
1296 (void)set_food(p_ptr->food - digestion);
1301 if ((p_ptr->food < PY_FOOD_FAINT))
1303 /* Faint occasionally */
1304 if (!p_ptr->paralyzed && (randint0(100) < 10))
1306 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1307 disturb(TRUE, TRUE);
1309 /* Hack -- faint (bypass free action) */
1310 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1313 /* Starve to death (slowly) */
1314 if (p_ptr->food < PY_FOOD_STARVE)
1316 /* Calculate damage */
1317 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1319 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1326 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1327 * / Handle timed damage and regeneration every 10 game turns
1330 static void process_world_aux_hp_and_sp(void)
1332 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1333 bool cave_no_regen = FALSE;
1334 int upkeep_factor = 0;
1336 /* Default regeneration */
1337 int regen_amount = PY_REGEN_NORMAL;
1340 /*** Damage over Time ***/
1342 /* Take damage from poison */
1343 if (p_ptr->poisoned && !IS_INVULN())
1345 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1348 /* Take damage from cuts */
1349 if (p_ptr->cut && !IS_INVULN())
1353 /* Mortal wound or Deep Gash */
1354 if (p_ptr->cut > 1000)
1359 else if (p_ptr->cut > 200)
1365 else if (p_ptr->cut > 100)
1370 else if (p_ptr->cut > 50)
1375 else if (p_ptr->cut > 25)
1380 else if (p_ptr->cut > 10)
1391 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1394 /* (Vampires) Take damage from sunlight */
1395 if (PRACE_IS_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1397 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1399 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1401 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1402 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1403 cave_no_regen = TRUE;
1407 if (p_ptr->inventory_list[INVEN_LITE].tval && (p_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1408 !p_ptr->resist_lite)
1410 object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1411 GAME_TEXT o_name [MAX_NLEN];
1412 char ouch [MAX_NLEN+40];
1414 /* Get an object description */
1415 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1416 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1418 cave_no_regen = TRUE;
1420 /* Get an object description */
1421 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1422 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1424 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1428 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1432 if (have_flag(f_ptr->flags, FF_DEEP))
1434 damage = 6000 + randint0(4000);
1436 else if (!p_ptr->levitation)
1438 damage = 3000 + randint0(2000);
1443 if(PRACE_IS_(RACE_ENT)) damage += damage / 3;
1444 if(p_ptr->resist_fire) damage = damage / 3;
1445 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1446 if(p_ptr->levitation) damage = damage / 5;
1448 damage = damage / 100 + (randint0(100) < (damage % 100));
1450 if (p_ptr->levitation)
1452 msg_print(_("熱で火傷した!", "The heat burns you!"));
1453 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1454 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1458 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1459 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1460 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1463 cave_no_regen = TRUE;
1467 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1471 if (have_flag(f_ptr->flags, FF_DEEP))
1473 damage = 6000 + randint0(4000);
1475 else if (!p_ptr->levitation)
1477 damage = 3000 + randint0(2000);
1482 if (p_ptr->resist_cold) damage = damage / 3;
1483 if (IS_OPPOSE_COLD()) damage = damage / 3;
1484 if (p_ptr->levitation) damage = damage / 5;
1486 damage = damage / 100 + (randint0(100) < (damage % 100));
1488 if (p_ptr->levitation)
1490 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1491 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1492 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1496 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1497 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1498 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1501 cave_no_regen = TRUE;
1505 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1509 if (have_flag(f_ptr->flags, FF_DEEP))
1511 damage = 6000 + randint0(4000);
1513 else if (!p_ptr->levitation)
1515 damage = 3000 + randint0(2000);
1520 if (p_ptr->resist_elec) damage = damage / 3;
1521 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1522 if (p_ptr->levitation) damage = damage / 5;
1524 damage = damage / 100 + (randint0(100) < (damage % 100));
1526 if (p_ptr->levitation)
1528 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1529 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1530 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1534 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1535 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1536 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1539 cave_no_regen = TRUE;
1543 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1547 if (have_flag(f_ptr->flags, FF_DEEP))
1549 damage = 6000 + randint0(4000);
1551 else if (!p_ptr->levitation)
1553 damage = 3000 + randint0(2000);
1558 if (p_ptr->resist_acid) damage = damage / 3;
1559 if (IS_OPPOSE_ACID()) damage = damage / 3;
1560 if (p_ptr->levitation) damage = damage / 5;
1562 damage = damage / 100 + (randint0(100) < (damage % 100));
1564 if (p_ptr->levitation)
1566 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1567 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1568 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1572 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1573 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1574 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1577 cave_no_regen = TRUE;
1581 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1585 if (have_flag(f_ptr->flags, FF_DEEP))
1587 damage = 6000 + randint0(4000);
1589 else if (!p_ptr->levitation)
1591 damage = 3000 + randint0(2000);
1596 if (p_ptr->resist_pois) damage = damage / 3;
1597 if (IS_OPPOSE_POIS()) damage = damage / 3;
1598 if (p_ptr->levitation) damage = damage / 5;
1600 damage = damage / 100 + (randint0(100) < (damage % 100));
1602 if (p_ptr->levitation)
1604 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1605 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1606 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1607 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1611 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1612 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1613 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1614 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1617 cave_no_regen = TRUE;
1621 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1622 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1624 if (p_ptr->total_weight > weight_limit())
1626 msg_print(_("溺れている!", "You are drowning!"));
1627 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1628 cave_no_regen = TRUE;
1635 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1637 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1638 if (PRACE_IS_(RACE_ENT)) damage += damage / 3;
1639 if (p_ptr->resist_fire) damage = damage / 3;
1640 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1641 msg_print(_("熱い!", "It's hot!"));
1642 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1644 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1646 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1647 if (PRACE_IS_(RACE_ANDROID)) damage += damage / 3;
1648 if (p_ptr->resist_elec) damage = damage / 3;
1649 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1650 msg_print(_("痛い!", "It hurts!"));
1651 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1653 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1655 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1656 if (p_ptr->resist_cold) damage = damage / 3;
1657 if (IS_OPPOSE_COLD()) damage = damage / 3;
1658 msg_print(_("冷たい!", "It's cold!"));
1659 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1663 /* Spectres -- take damage when moving through walls */
1665 * Added: ANYBODY takes damage if inside through walls
1666 * without wraith form -- NOTE: Spectres will never be
1667 * reduced below 0 hp by being inside a stone wall; others
1670 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1672 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1675 cave_no_regen = TRUE;
1677 if (p_ptr->pass_wall)
1679 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1680 dam_desc = _("密度", "density");
1684 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1685 dam_desc = _("硬い岩", "solid rock");
1688 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1693 /*** handle regeneration ***/
1696 if (p_ptr->food < PY_FOOD_WEAK)
1698 /* Lower regeneration */
1699 if (p_ptr->food < PY_FOOD_STARVE)
1703 else if (p_ptr->food < PY_FOOD_FAINT)
1705 regen_amount = PY_REGEN_FAINT;
1709 regen_amount = PY_REGEN_WEAK;
1713 /* Are we walking the pattern? */
1714 if (pattern_effect())
1716 cave_no_regen = TRUE;
1720 /* Regeneration ability */
1721 if (p_ptr->regenerate)
1723 regen_amount = regen_amount * 2;
1725 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1729 if (p_ptr->cursed & TRC_SLOW_REGEN)
1736 /* Searching or Resting */
1737 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1739 regen_amount = regen_amount * 2;
1742 upkeep_factor = calculate_upkeep();
1744 /* No regeneration while special action */
1745 if ((p_ptr->action == ACTION_LEARN) ||
1746 (p_ptr->action == ACTION_HAYAGAKE) ||
1747 (p_ptr->special_defense & KATA_KOUKIJIN))
1749 upkeep_factor += 100;
1752 /* Regenerate the mana */
1753 regenmana(upkeep_factor, regen_amount);
1756 /* Recharge magic eater's power */
1757 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1759 regenmagic(regen_amount);
1762 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1764 while (upkeep_factor > 100)
1766 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1768 do_cmd_pet_dismiss();
1770 upkeep_factor = calculate_upkeep();
1772 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1777 /* Poisoned or cut yields no healing */
1778 if (p_ptr->poisoned) regen_amount = 0;
1779 if (p_ptr->cut) regen_amount = 0;
1781 /* Special floor -- Pattern, in a wall -- yields no healing */
1782 if (cave_no_regen) regen_amount = 0;
1784 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1786 /* Regenerate Hit Points if needed */
1787 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1789 regenhp(regen_amount);
1794 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1795 * / Handle timeout every 10 game turns
1798 static void process_world_aux_timeout(void)
1800 const int dec_count = (easy_band ? 2 : 1);
1802 /*** Timeout Various Things ***/
1805 if (p_ptr->tim_mimic)
1807 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1810 /* Hack -- Hallucinating */
1813 (void)set_image(p_ptr->image - dec_count);
1819 (void)set_blind(p_ptr->blind - dec_count);
1822 /* Times see-invisible */
1823 if (p_ptr->tim_invis)
1825 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1828 if (p_ptr->suppress_multi_reward)
1830 p_ptr->suppress_multi_reward = FALSE;
1836 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1839 /* Timed temporary elemental brands. -LM- */
1840 if (p_ptr->ele_attack)
1842 p_ptr->ele_attack--;
1844 /* Clear all temporary elemental brands. */
1845 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1848 /* Timed temporary elemental immune. -LM- */
1849 if (p_ptr->ele_immune)
1851 p_ptr->ele_immune--;
1853 /* Clear all temporary elemental brands. */
1854 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1857 /* Timed infra-vision */
1858 if (p_ptr->tim_infra)
1860 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1864 if (p_ptr->tim_stealth)
1866 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1869 /* Timed levitation */
1870 if (p_ptr->tim_levitation)
1872 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1875 /* Timed sh_touki */
1876 if (p_ptr->tim_sh_touki)
1878 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1882 if (p_ptr->tim_sh_fire)
1884 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1888 if (p_ptr->tim_sh_holy)
1890 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1894 if (p_ptr->tim_eyeeye)
1896 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1899 /* Timed resist-magic */
1900 if (p_ptr->resist_magic)
1902 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1905 /* Timed regeneration */
1906 if (p_ptr->tim_regen)
1908 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1911 /* Timed resist nether */
1912 if (p_ptr->tim_res_nether)
1914 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1917 /* Timed resist time */
1918 if (p_ptr->tim_res_time)
1920 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1924 if (p_ptr->tim_reflect)
1926 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1930 if (p_ptr->multishadow)
1932 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1935 /* Timed Robe of dust */
1936 if (p_ptr->dustrobe)
1938 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1941 /* Timed infra-vision */
1942 if (p_ptr->kabenuke)
1944 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1948 if (p_ptr->paralyzed)
1950 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1954 if (p_ptr->confused)
1956 (void)set_confused(p_ptr->confused - dec_count);
1962 (void)set_afraid(p_ptr->afraid - dec_count);
1968 (void)set_fast(p_ptr->fast - 1, TRUE);
1974 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1977 /* Protection from evil */
1978 if (p_ptr->protevil)
1980 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1983 /* Invulnerability */
1986 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1990 if (p_ptr->wraith_form)
1992 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1998 (void)set_hero(p_ptr->hero - 1, TRUE);
2004 (void)set_shero(p_ptr->shero - 1, TRUE);
2010 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2016 (void)set_shield(p_ptr->shield - 1, TRUE);
2020 if (p_ptr->tsubureru)
2022 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2026 if (p_ptr->magicdef)
2028 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2032 if (p_ptr->tsuyoshi)
2034 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2038 if (p_ptr->oppose_acid)
2040 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2043 /* Oppose Lightning */
2044 if (p_ptr->oppose_elec)
2046 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2050 if (p_ptr->oppose_fire)
2052 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2056 if (p_ptr->oppose_cold)
2058 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2062 if (p_ptr->oppose_pois)
2064 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2069 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2072 /*** Poison and Stun and Cut ***/
2075 if (p_ptr->poisoned)
2077 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2079 /* Apply some healing */
2080 (void)set_poisoned(p_ptr->poisoned - adjust);
2086 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2088 /* Apply some healing */
2089 (void)set_stun(p_ptr->stun - adjust);
2095 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2097 /* Hack -- Truly "mortal" wound */
2098 if (p_ptr->cut > 1000) adjust = 0;
2100 /* Apply some healing */
2101 (void)set_cut(p_ptr->cut - adjust);
2107 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2108 * / Handle burning fuel every 10 game turns
2111 static void process_world_aux_light(void)
2113 /* Check for light being wielded */
2114 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2116 /* Burn some fuel in the current lite */
2117 if (o_ptr->tval == TV_LITE)
2119 /* Hack -- Use some fuel (except on artifacts) */
2120 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2122 /* Decrease life-span */
2123 if (o_ptr->name2 == EGO_LITE_LONG)
2125 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2127 else o_ptr->xtra4--;
2129 /* Notice interesting fuel steps */
2130 notice_lite_change(o_ptr);
2137 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2138 * / Handle mutation effects once every 10 game turns
2141 static void process_world_aux_mutation(void)
2143 /* No mutation with effects */
2144 if (!p_ptr->muta2) return;
2146 /* No effect on monster arena */
2147 if (p_ptr->inside_battle) return;
2149 /* No effect on the global map */
2150 if (p_ptr->wild_mode) return;
2152 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2154 disturb(FALSE, TRUE);
2155 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2156 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2157 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2158 (void)set_afraid(0);
2161 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2163 if (!p_ptr->resist_fear)
2165 disturb(FALSE, TRUE);
2166 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2167 set_afraid(p_ptr->afraid + 13 + randint1(26));
2171 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2173 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2175 disturb(FALSE, TRUE);
2176 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2178 teleport_player(40, TELEPORT_PASSIVE);
2182 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2184 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2186 disturb(FALSE, TRUE);
2187 p_ptr->redraw |= PR_EXTRA;
2188 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2191 if (!p_ptr->resist_conf)
2193 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2196 if (!p_ptr->resist_chaos)
2201 if (one_in_(3)) lose_all_info();
2203 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2205 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2206 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2212 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2213 (void)set_image(p_ptr->image + randint0(150) + 150);
2219 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2221 if (!p_ptr->resist_chaos)
2223 disturb(FALSE, TRUE);
2224 p_ptr->redraw |= PR_EXTRA;
2225 (void)set_image(p_ptr->image + randint0(50) + 20);
2229 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2231 disturb(FALSE, TRUE);
2232 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2234 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2237 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2238 !p_ptr->anti_magic && one_in_(9000))
2241 disturb(FALSE, TRUE);
2242 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2243 "Magical energy flows through you! You must release it!"));
2247 (void)get_hack_dir(&dire);
2248 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2251 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2253 bool pet = one_in_(6);
2254 BIT_FLAGS mode = PM_ALLOW_GROUP;
2256 if (pet) mode |= PM_FORCE_PET;
2257 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2259 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode))
2261 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2262 disturb(FALSE, TRUE);
2266 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2268 disturb(FALSE, TRUE);
2271 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2273 if (p_ptr->fast > 0)
2279 set_slow(randint1(30) + 10, FALSE);
2284 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2286 if (p_ptr->slow > 0)
2292 set_fast(randint1(30) + 10, FALSE);
2297 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2299 disturb(FALSE, TRUE);
2300 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2302 banish_monsters(100);
2303 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2307 /* Pick a random shop (except home) */
2310 n = randint0(MAX_STORES);
2312 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2314 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2320 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2324 msg_print(_("影につつまれた。", "A shadow passes over you."));
2327 /* Absorb light from the current possition */
2328 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2333 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2335 /* Absorb some fuel in the current lite */
2336 if (o_ptr->tval == TV_LITE)
2338 /* Use some fuel (except on artifacts) */
2339 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2341 /* Heal the player a bit */
2342 hp_player(o_ptr->xtra4 / 20);
2344 /* Decrease life-span of lite */
2346 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2348 /* Notice interesting fuel steps */
2349 notice_lite_change(o_ptr);
2354 * Unlite the area (radius 10) around player and
2355 * do 50 points damage to every affected monster
2357 unlite_area(50, 10);
2360 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2362 bool pet = one_in_(3);
2363 BIT_FLAGS mode = PM_ALLOW_GROUP;
2365 if (pet) mode |= PM_FORCE_PET;
2366 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2368 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2370 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2371 disturb(FALSE, TRUE);
2375 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2377 disturb(FALSE, TRUE);
2378 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2381 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2383 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2385 if (!lose_mutation(0))
2386 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2388 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2390 disturb(FALSE, TRUE);
2391 msg_print(_("非物質化した!", "You feel insubstantial!"));
2394 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2396 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2400 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2402 int which_stat = randint0(A_MAX);
2403 int sustained = FALSE;
2408 if (p_ptr->sustain_str) sustained = TRUE;
2411 if (p_ptr->sustain_int) sustained = TRUE;
2414 if (p_ptr->sustain_wis) sustained = TRUE;
2417 if (p_ptr->sustain_dex) sustained = TRUE;
2420 if (p_ptr->sustain_con) sustained = TRUE;
2423 if (p_ptr->sustain_chr) sustained = TRUE;
2426 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2432 disturb(FALSE, TRUE);
2433 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2435 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2438 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2440 bool pet = one_in_(5);
2441 BIT_FLAGS mode = PM_ALLOW_GROUP;
2443 if (pet) mode |= PM_FORCE_PET;
2444 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2446 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2448 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2449 disturb(FALSE, TRUE);
2452 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2454 if (p_ptr->tim_esp > 0)
2456 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2457 set_tim_esp(0, TRUE);
2461 msg_print(_("精神が広がった!", "Your mind expands!"));
2462 set_tim_esp(p_ptr->lev, FALSE);
2465 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2467 disturb(FALSE, TRUE);
2468 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2470 set_food(PY_FOOD_WEAK);
2471 if (music_singing_any()) stop_singing(p_ptr);
2472 if (hex_spelling_any()) stop_hex_spell_all();
2475 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2480 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2482 int danger_amount = 0;
2483 MONSTER_IDX monster;
2485 for (monster = 0; monster < current_floor_ptr->m_max; monster++)
2487 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2488 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2489 if (!monster_is_valid(m_ptr)) continue;
2491 if (r_ptr->level >= p_ptr->lev)
2493 danger_amount += r_ptr->level - p_ptr->lev + 1;
2497 if (danger_amount > 100)
2498 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2499 else if (danger_amount > 50)
2500 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2501 else if (danger_amount > 20)
2502 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2503 else if (danger_amount > 10)
2504 msg_print(_("心配な気がする!", "You feel paranoid!"));
2505 else if (danger_amount > 5)
2506 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2508 msg_print(_("寂しい気がする。", "You feel lonely."));
2511 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2513 disturb(FALSE, TRUE);
2514 msg_print(_("無敵な気がする!", "You feel invincible!"));
2516 (void)set_invuln(randint1(8) + 8, FALSE);
2519 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2521 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2525 HIT_POINT healing = p_ptr->csp;
2526 if (healing > wounds) healing = wounds;
2529 p_ptr->csp -= healing;
2530 p_ptr->redraw |= (PR_HP | PR_MANA);
2534 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2536 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2540 HIT_POINT healing = p_ptr->chp;
2541 if (healing > wounds) healing = wounds;
2543 p_ptr->csp += healing;
2544 p_ptr->redraw |= (PR_HP | PR_MANA);
2545 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2549 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2551 INVENTORY_IDX slot = 0;
2552 object_type *o_ptr = NULL;
2554 disturb(FALSE, TRUE);
2555 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2556 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2559 if (has_melee_weapon(INVEN_RARM))
2562 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
2564 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2566 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2570 else if (has_melee_weapon(INVEN_LARM))
2572 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2575 if (slot && !object_is_cursed(o_ptr))
2577 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2578 inven_drop(slot, 1);
2585 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2586 * / Handle curse effects once every 10 game turns
2589 static void process_world_aux_curse(void)
2591 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2594 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2595 * can actually be useful!
2597 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2599 GAME_TEXT o_name[MAX_NLEN];
2601 int i, i_keep = 0, count = 0;
2603 /* Scan the equipment with random teleport ability */
2604 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2606 BIT_FLAGS flgs[TR_FLAG_SIZE];
2607 o_ptr = &p_ptr->inventory_list[i];
2608 if (!o_ptr->k_idx) continue;
2610 object_flags(o_ptr, flgs);
2612 if (have_flag(flgs, TR_TELEPORT))
2614 /* {.} will stop random teleportation. */
2615 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2618 if (one_in_(count)) i_keep = i;
2623 o_ptr = &p_ptr->inventory_list[i_keep];
2624 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2625 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2626 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2628 disturb(FALSE, TRUE);
2629 teleport_player(50, 0L);
2633 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2634 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2635 disturb(TRUE, TRUE);
2638 /* Make a chainsword noise */
2639 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2642 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2644 disturb(FALSE, FALSE);
2647 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2650 (void)activate_ty_curse(FALSE, &count);
2652 /* Handle experience draining */
2653 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2655 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2656 if (p_ptr->exp < 0) p_ptr->exp = 0;
2657 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2658 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2661 /* Add light curse (Later) */
2662 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2664 BIT_FLAGS new_curse;
2667 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2669 new_curse = get_curse(0, o_ptr);
2670 if (!(o_ptr->curse_flags & new_curse))
2672 GAME_TEXT o_name[MAX_NLEN];
2674 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2676 o_ptr->curse_flags |= new_curse;
2677 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2679 o_ptr->feeling = FEEL_NONE;
2681 p_ptr->update |= (PU_BONUS);
2684 /* Add heavy curse (Later) */
2685 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2687 BIT_FLAGS new_curse;
2690 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2692 new_curse = get_curse(1, o_ptr);
2693 if (!(o_ptr->curse_flags & new_curse))
2695 GAME_TEXT o_name[MAX_NLEN];
2697 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2699 o_ptr->curse_flags |= new_curse;
2700 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2701 o_ptr->feeling = FEEL_NONE;
2703 p_ptr->update |= (PU_BONUS);
2707 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2709 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)))
2711 GAME_TEXT o_name[MAX_NLEN];
2713 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2714 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2715 disturb(FALSE, TRUE);
2719 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2721 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)))
2723 GAME_TEXT o_name[MAX_NLEN];
2725 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2726 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2727 disturb(FALSE, TRUE);
2731 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2733 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2734 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2736 GAME_TEXT o_name[MAX_NLEN];
2738 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2739 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2740 disturb(FALSE, TRUE);
2744 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2746 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2747 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2749 GAME_TEXT o_name[MAX_NLEN];
2751 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2752 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2753 disturb(FALSE, TRUE);
2756 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2758 if (!p_ptr->resist_fear)
2760 disturb(FALSE, TRUE);
2761 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2762 set_afraid(p_ptr->afraid + 13 + randint1(26));
2765 /* Teleport player */
2766 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2768 disturb(FALSE, TRUE);
2770 /* Teleport player */
2771 teleport_player(40, TELEPORT_PASSIVE);
2773 /* Handle HP draining */
2774 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2776 GAME_TEXT o_name[MAX_NLEN];
2778 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2779 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2780 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2782 /* Handle mana draining */
2783 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2785 GAME_TEXT o_name[MAX_NLEN];
2787 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2788 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2789 p_ptr->csp -= MIN(p_ptr->lev, 50);
2793 p_ptr->csp_frac = 0;
2795 p_ptr->redraw |= PR_MANA;
2799 /* Rarely, take damage from the Jewel of Judgement */
2800 if (one_in_(999) && !p_ptr->anti_magic)
2802 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2804 if (o_ptr->name1 == ART_JUDGE)
2806 if (object_is_known(o_ptr))
2807 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2809 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2810 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2817 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2818 * / Handle recharging objects once every 10 game turns
2821 static void process_world_aux_recharge(void)
2826 /* Process equipment */
2827 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2829 /* Get the object */
2830 object_type *o_ptr = &p_ptr->inventory_list[i];
2831 if (!o_ptr->k_idx) continue;
2833 /* Recharge activatable objects */
2834 if (o_ptr->timeout > 0)
2839 /* Notice changes */
2840 if (!o_ptr->timeout)
2842 recharged_notice(o_ptr);
2848 /* Notice changes */
2851 p_ptr->window |= (PW_EQUIP);
2856 * Recharge rods. Rods now use timeout to control charging status,
2857 * and each charging rod in a stack decreases the stack's timeout by
2858 * one per current_world_ptr->game_turn. -LM-
2860 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2862 object_type *o_ptr = &p_ptr->inventory_list[i];
2863 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2864 if (!o_ptr->k_idx) continue;
2866 /* Examine all charging rods or stacks of charging rods. */
2867 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2869 /* Determine how many rods are charging. */
2870 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2871 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2873 /* Decrease timeout by that number. */
2874 o_ptr->timeout -= temp;
2876 /* Boundary control. */
2877 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2879 /* Notice changes, provide message if object is inscribed. */
2880 if (!(o_ptr->timeout))
2882 recharged_notice(o_ptr);
2886 /* One of the stack of rod is charged */
2887 else if (o_ptr->timeout % k_ptr->pval)
2894 /* Notice changes */
2897 p_ptr->window |= (PW_INVEN);
2901 /* Process objects on floor */
2902 for (i = 1; i < current_floor_ptr->o_max; i++)
2904 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2906 /* Skip dead objects */
2907 if (!o_ptr->k_idx) continue;
2909 /* Recharge rods on the ground. No messages. */
2910 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2913 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2915 /* Boundary control. */
2916 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2923 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2924 * / Handle involuntary movement once every 10 game turns
2927 static void process_world_aux_movement(void)
2929 /* Delayed Word-of-Recall */
2930 if (p_ptr->word_recall)
2933 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2934 * The player is yanked up/down as soon as
2935 * he loads the autosaved game.
2937 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2938 do_cmd_save_game(TRUE);
2940 /* Count down towards recall */
2941 p_ptr->word_recall--;
2943 p_ptr->redraw |= (PR_STATUS);
2945 /* Activate the recall */
2946 if (!p_ptr->word_recall)
2949 disturb(FALSE, TRUE);
2951 /* Determine the level */
2952 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2954 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2956 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2958 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2960 current_floor_ptr->dun_level = 0;
2961 p_ptr->dungeon_idx = 0;
2963 leave_quest_check();
2964 leave_tower_check();
2966 p_ptr->inside_quest = 0;
2968 p_ptr->leaving = TRUE;
2972 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2974 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2977 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2980 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2981 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2983 /* Nightmare mode makes recall more dangerous */
2984 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2986 if (current_floor_ptr->dun_level < 50)
2988 current_floor_ptr->dun_level *= 2;
2990 else if (current_floor_ptr->dun_level < 99)
2992 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2994 else if (current_floor_ptr->dun_level > 100)
2996 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
3000 if (p_ptr->wild_mode)
3002 p_ptr->wilderness_y = p_ptr->y;
3003 p_ptr->wilderness_x = p_ptr->x;
3007 /* Save player position */
3008 p_ptr->oldpx = p_ptr->x;
3009 p_ptr->oldpy = p_ptr->y;
3011 p_ptr->wild_mode = FALSE;
3014 * Clear all saved floors
3015 * and create a first saved floor
3017 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3018 p_ptr->leaving = TRUE;
3020 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
3024 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3026 quest_type* const q_ptr = &quest[i];
3029 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3030 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3031 (q_ptr->level < current_floor_ptr->dun_level))
3033 q_ptr->status = QUEST_STATUS_FAILED;
3034 q_ptr->complev = (byte)p_ptr->lev;
3036 q_ptr->comptime = current_world_ptr->play_time;
3037 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3043 sound(SOUND_TPLEVEL);
3048 /* Delayed Alter reality */
3049 if (p_ptr->alter_reality)
3051 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3052 do_cmd_save_game(TRUE);
3054 /* Count down towards alter */
3055 p_ptr->alter_reality--;
3057 p_ptr->redraw |= (PR_STATUS);
3059 /* Activate the alter reality */
3060 if (!p_ptr->alter_reality)
3063 disturb(FALSE, TRUE);
3065 /* Determine the level */
3066 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3068 msg_print(_("世界が変わった!", "The world changes!"));
3071 * Clear all saved floors
3072 * and create a first saved floor
3074 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3075 p_ptr->leaving = TRUE;
3079 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3082 sound(SOUND_TPLEVEL);
3088 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3089 * / Handle certain things once every 10 game turns
3092 static void process_world(void)
3096 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3097 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3098 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3100 extract_day_hour_min(&day, &hour, &min);
3102 /* Update dungeon feeling, and announce it if changed */
3103 update_dungeon_feeling();
3105 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3106 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3108 current_floor_ptr->dun_level = 0;
3109 p_ptr->dungeon_idx = 0;
3110 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3111 p_ptr->inside_arena = FALSE;
3112 p_ptr->wild_mode = FALSE;
3113 p_ptr->leaving = TRUE;
3116 /*** Check monster arena ***/
3117 if (p_ptr->inside_battle && !p_ptr->leaving)
3123 /* Count all hostile monsters */
3124 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3125 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3127 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3129 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3132 win_m_idx = g_ptr->m_idx;
3136 if (number_mon == 0)
3138 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3140 p_ptr->energy_need = 0;
3141 update_gambling_monsters();
3143 else if ((number_mon-1) == 0)
3145 GAME_TEXT m_name[MAX_NLEN];
3146 monster_type *wm_ptr;
3148 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3150 monster_desc(m_name, wm_ptr, 0);
3151 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3154 if (win_m_idx == (sel_monster+1))
3156 msg_print(_("おめでとうございます。", "Congratulations."));
3157 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3158 p_ptr->au += battle_odds;
3162 msg_print(_("残念でした。", "You lost gold."));
3165 p_ptr->energy_need = 0;
3166 update_gambling_monsters();
3168 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3170 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3171 p_ptr->au += kakekin;
3173 p_ptr->energy_need = 0;
3174 update_gambling_monsters();
3178 /* Every 10 game turns */
3179 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3181 /*** Attempt timed autosave ***/
3182 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3184 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3185 do_cmd_save_game(TRUE);
3188 if (current_floor_ptr->monster_noise && !ignore_unview)
3190 msg_print(_("何かが聞こえた。", "You hear noise."));
3193 /*** Handle the wilderness/town (sunshine) ***/
3195 /* While in town/wilderness */
3196 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3198 /* Hack -- Daybreak/Nighfall in town */
3199 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3203 /* Check for dawn */
3204 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3206 if (dawn) day_break();
3212 /* While in the dungeon (vanilla_town or lite_town mode only) */
3213 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3215 /*** Shuffle the Storekeepers ***/
3217 /* Chance is only once a day (while in dungeon) */
3218 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3220 /* Sometimes, shuffle the shop-keepers */
3221 if (one_in_(STORE_SHUFFLE))
3226 /* Pick a random shop (except home and museum) */
3229 n = randint0(MAX_STORES);
3231 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3233 /* Check every feature */
3234 for (i = 1; i < max_f_idx; i++)
3236 feature_type *f_ptr = &f_info[i];
3238 /* Skip empty index */
3239 if (!f_ptr->name) continue;
3241 /* Skip non-store features */
3242 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3244 /* Verify store type */
3245 if (f_ptr->subtype == n)
3247 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3260 /*** Process the monsters ***/
3262 /* Check for creature generation. */
3263 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3264 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3266 /* Make a new monster */
3267 (void)alloc_monster(MAX_SIGHT + 5, 0);
3270 /* Hack -- Check for creature regeneration */
3271 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3272 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3274 if (!p_ptr->leaving)
3278 /* Hack -- Process the counters of monsters if needed */
3279 for (i = 0; i < MAX_MTIMED; i++)
3281 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3289 if (min != prev_min)
3291 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3292 determine_today_mon(FALSE);
3297 * Nightmare mode activates the TY_CURSE at midnight
3298 * Require exact minute -- Don't activate multiple times in a minute
3301 if (ironman_nightmare && (min != prev_min))
3304 /* Every 15 minutes after 11:00 pm */
3305 if ((hour == 23) && !(min % 15))
3307 disturb(FALSE, TRUE);
3312 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3316 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3320 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3324 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3329 /* TY_CURSE activates at midnight! */
3333 disturb(TRUE, TRUE);
3334 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3336 if (p_ptr->wild_mode)
3338 /* Go into large wilderness view */
3339 p_ptr->oldpy = randint1(MAX_HGT - 2);
3340 p_ptr->oldpx = randint1(MAX_WID - 2);
3341 change_wild_mode(TRUE);
3343 /* Give first move to monsters */
3344 take_turn(p_ptr, 100);
3348 p_ptr->invoking_midnight_curse = TRUE;
3354 /* Check the Food */
3355 process_world_aux_digestion();
3357 /* Process timed damage and regeneration */
3358 process_world_aux_hp_and_sp();
3360 /* Process timeout */
3361 process_world_aux_timeout();
3364 process_world_aux_light();
3366 /* Process mutation effects */
3367 process_world_aux_mutation();
3369 /* Process curse effects */
3370 process_world_aux_curse();
3372 /* Process recharging */
3373 process_world_aux_recharge();
3375 /* Feel the p_ptr->inventory_list */
3379 /* Involuntary Movement */
3380 process_world_aux_movement();
3384 * @brief ウィザードモードへの導入処理
3385 * / Verify use of "wizard" mode
3386 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3388 static bool enter_wizard_mode(void)
3390 /* Ask first time */
3391 if (!p_ptr->noscore)
3393 /* Wizard mode is not permitted */
3394 if (!allow_debug_opts || arg_wizard)
3396 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3400 /* Mention effects */
3401 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3402 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3405 /* Verify request */
3406 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3411 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3413 p_ptr->noscore |= 0x0002;
3424 * @brief デバッグコマンドへの導入処理
3425 * / Verify use of "debug" commands
3426 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3428 static bool enter_debug_mode(void)
3430 /* Ask first time */
3431 if (!p_ptr->noscore)
3433 /* Debug mode is not permitted */
3434 if (!allow_debug_opts)
3436 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3440 /* Mention effects */
3441 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3442 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3446 /* Verify request */
3447 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3452 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3454 p_ptr->noscore |= 0x0008;
3462 * Hack -- Declare the Debug Routines
3464 extern void do_cmd_debug(void);
3466 #endif /* ALLOW_WIZARD */
3472 * @brief ボーグコマンドへの導入処理
3473 * / Verify use of "borg" commands
3474 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3476 static bool enter_borg_mode(void)
3478 /* Ask first time */
3479 if (!(p_ptr->noscore & 0x0010))
3481 /* Mention effects */
3482 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3483 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3487 /* Verify request */
3488 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3493 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3495 p_ptr->noscore |= 0x0010;
3503 * Hack -- Declare the Ben Borg
3505 extern void do_cmd_borg(void);
3507 #endif /* ALLOW_BORG */
3511 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3512 * / Parse and execute the current command Give "Warning" on illegal commands.
3513 * @todo Make some "blocks"
3516 static void process_command(void)
3518 COMMAND_CODE old_now_message = now_message;
3520 /* Handle repeating the last command */
3526 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3527 p_ptr->reset_concent = TRUE;
3529 /* Parse the command */
3530 switch (command_cmd)
3546 /*** Wizard Commands ***/
3548 /* Toggle Wizard Mode */
3553 p_ptr->wizard = FALSE;
3554 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3556 else if (enter_wizard_mode())
3558 p_ptr->wizard = TRUE;
3559 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3561 p_ptr->update |= (PU_MONSTERS);
3563 /* Redraw "title" */
3564 p_ptr->redraw |= (PR_TITLE);
3572 /* Special "debug" commands */
3575 /* Enter debug mode */
3576 if (enter_debug_mode())
3583 #endif /* ALLOW_WIZARD */
3588 /* Special "borg" commands */
3591 /* Enter borg mode */
3592 if (enter_borg_mode())
3594 if (!p_ptr->wild_mode) do_cmd_borg();
3600 #endif /* ALLOW_BORG */
3604 /*** Inventory Commands ***/
3606 /* Wear/wield equipment */
3609 if (!p_ptr->wild_mode) do_cmd_wield();
3613 /* Take off equipment */
3616 if (!p_ptr->wild_mode) do_cmd_takeoff();
3623 if (!p_ptr->wild_mode) do_cmd_drop();
3627 /* Destroy an item */
3634 /* Equipment list */
3641 /* Inventory list */
3649 /*** Various commands ***/
3651 /* Identify an object */
3658 /* Hack -- toggle windows */
3661 toggle_inven_equip();
3666 /*** Standard "Movement" Commands ***/
3671 if (!p_ptr->wild_mode) do_cmd_alter();
3678 if (!p_ptr->wild_mode) do_cmd_tunnel();
3682 /* Move (usually pick up things) */
3689 /* Move (usually do not pick up) */
3697 /*** Running, Resting, Searching, Staying */
3699 /* Begin Running -- Arg is Max Distance */
3702 if (!p_ptr->wild_mode) do_cmd_run();
3706 /* Stay still (usually pick things up) */
3709 do_cmd_stay(always_pickup);
3713 /* Stay still (usually do not pick up) */
3716 do_cmd_stay(!always_pickup);
3720 /* Rest -- Arg is time */
3727 /* Search for traps/doors */
3734 /* Toggle search mode */
3737 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3738 else set_action(ACTION_SEARCH);
3743 /*** Stairs and Doors and Chests and Traps ***/
3746 case SPECIAL_KEY_STORE:
3752 /* Enter building -KMW- */
3753 case SPECIAL_KEY_BUILDING:
3759 /* Enter quest level -KMW- */
3760 case SPECIAL_KEY_QUEST:
3766 /* Go up staircase */
3769 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3771 if (vanilla_town) break;
3773 if (p_ptr->ambush_flag)
3775 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3779 if (p_ptr->food < PY_FOOD_WEAK)
3781 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3785 change_wild_mode(FALSE);
3792 /* Go down staircase */
3795 if (p_ptr->wild_mode)
3796 change_wild_mode(FALSE);
3802 /* Open a door or chest */
3816 /* Jam a door with spikes */
3830 /* Disarm a trap or chest */
3838 /*** Magic and Prayers ***/
3840 /* Gain new spells/prayers */
3843 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3844 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3845 else if (p_ptr->pclass == CLASS_SAMURAI)
3846 do_cmd_gain_hissatsu();
3847 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3848 import_magic_device();
3857 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3858 (p_ptr->pclass == CLASS_BERSERKER) ||
3859 (p_ptr->pclass == CLASS_NINJA) ||
3860 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3861 ) do_cmd_mind_browse();
3862 else if (p_ptr->pclass == CLASS_SMITH)
3864 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3865 do_cmd_magic_eater(TRUE, FALSE);
3866 else if (p_ptr->pclass == CLASS_SNIPER)
3867 do_cmd_snipe_browse();
3868 else do_cmd_browse();
3876 if (!p_ptr->wild_mode)
3878 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3880 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3882 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))
3884 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3887 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3889 concptr which_power = _("魔法", "magic");
3890 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3891 which_power = _("超能力", "psionic powers");
3892 else if (p_ptr->pclass == CLASS_IMITATOR)
3893 which_power = _("ものまね", "imitation");
3894 else if (p_ptr->pclass == CLASS_SAMURAI)
3895 which_power = _("必殺剣", "hissatsu");
3896 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3897 which_power = _("鏡魔法", "mirror magic");
3898 else if (p_ptr->pclass == CLASS_NINJA)
3899 which_power = _("忍術", "ninjutsu");
3900 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3901 which_power = _("祈り", "prayer");
3903 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3906 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3908 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3913 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3914 (p_ptr->pclass == CLASS_BERSERKER) ||
3915 (p_ptr->pclass == CLASS_NINJA) ||
3916 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3919 else if (p_ptr->pclass == CLASS_IMITATOR)
3921 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3922 do_cmd_magic_eater(FALSE, FALSE);
3923 else if (p_ptr->pclass == CLASS_SAMURAI)
3925 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3926 do_cmd_cast_learned();
3927 else if (p_ptr->pclass == CLASS_SMITH)
3929 else if (p_ptr->pclass == CLASS_SNIPER)
3938 /* Issue a pet command */
3945 /*** Use various objects ***/
3947 /* Inscribe an object */
3954 /* Uninscribe an object */
3957 do_cmd_uninscribe();
3961 /* Activate an artifact */
3975 /* Fuel your lantern/torch */
3985 do_cmd_fire(SP_NONE);
3992 do_cmd_throw(1, FALSE, -1);
4006 if (use_command && rogue_like_commands)
4017 /* Quaff a potion */
4020 do_cmd_quaff_potion();
4027 do_cmd_read_scroll();
4034 if (use_command && !rogue_like_commands)
4041 /* Use racial power */
4044 do_cmd_racial_power();
4049 /*** Looking at Things (nearby or on map) ***/
4051 /* Full dungeon map */
4058 /* Locate player on map */
4072 /* Target monster or location */
4081 /*** Help and Such ***/
4090 /* Identify symbol */
4093 do_cmd_query_symbol();
4097 /* Character description */
4100 do_cmd_change_name();
4105 /*** System Commands ***/
4107 /* Hack -- User interface */
4114 /* Single line from a pref file */
4123 do_cmd_reload_autopick();
4129 do_cmd_edit_autopick();
4133 /* Interact with macros */
4140 /* Interact with visuals */
4148 /* Interact with colors */
4156 /* Interact with options */
4160 (void)combine_and_reorder_home(STORE_HOME);
4165 /*** Misc Commands ***/
4181 /* Repeat level feeling */
4188 /* Show previous message */
4191 do_cmd_message_one();
4195 /* Show previous messages */
4198 do_cmd_messages(old_now_message);
4202 /* Show quest status -KMW- */
4205 do_cmd_checkquest();
4209 /* Redraw the screen */
4212 now_message = old_now_message;
4217 #ifndef VERIFY_SAVEFILE
4219 /* Hack -- Save and don't quit */
4222 do_cmd_save_game(FALSE);
4226 #endif /* VERIFY_SAVEFILE */
4236 case SPECIAL_KEY_QUIT:
4238 do_cmd_save_and_exit();
4242 /* Quit (commit suicide) */
4255 /* Check artifacts, uniques, objects */
4262 /* Load "screen dump" */
4265 do_cmd_load_screen();
4269 /* Save "screen dump" */
4272 do_cmd_save_screen();
4276 /* Record/stop "Movie" */
4279 prepare_movie_hooks();
4283 /* Make random artifact list */
4286 spoil_random_artifact("randifact.txt");
4293 if (!p_ptr->wild_mode) do_cmd_travel();
4294 if (p_ptr->special_defense & KATA_MUSOU)
4296 set_action(ACTION_NONE);
4302 /* Hack -- Unknown command */
4305 if (flush_failure) flush();
4309 sound(SOUND_ILLEGAL);
4310 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4315 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4321 if (!p_ptr->energy_use && !now_message)
4322 now_message = old_now_message;
4326 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4329 static void pack_overflow(void)
4331 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
4333 GAME_TEXT o_name[MAX_NLEN];
4336 /* Is auto-destroy done? */
4337 update_creature(p_ptr);
4338 if (!p_ptr->inventory_list[INVEN_PACK].k_idx) return;
4340 /* Access the slot to be dropped */
4341 o_ptr = &p_ptr->inventory_list[INVEN_PACK];
4343 disturb(FALSE, TRUE);
4346 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4347 object_desc(o_name, o_ptr, 0);
4349 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4351 /* Drop it (carefully) near the player */
4352 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4354 /* Modify, Describe, Optimize */
4355 inven_item_increase(INVEN_PACK, -255);
4356 inven_item_describe(INVEN_PACK);
4357 inven_item_optimize(INVEN_PACK);
4364 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4367 static void process_upkeep_with_speed(void)
4369 /* Give the player some energy */
4370 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4372 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4375 /* No current_world_ptr->game_turn yet */
4376 if (p_ptr->enchant_energy_need > 0) return;
4378 while (p_ptr->enchant_energy_need <= 0)
4380 /* Handle the player song */
4381 if (!load) check_music();
4383 /* Hex - Handle the hex spells */
4384 if (!load) check_hex();
4385 if (!load) revenge_spell();
4387 /* There is some randomness of needed energy */
4388 p_ptr->enchant_energy_need += ENERGY_NEED();
4392 static void process_fishing(void)
4394 Term_xtra(TERM_XTRA_DELAY, 10);
4398 bool success = FALSE;
4399 get_mon_num_prep(monster_is_fishing_target, NULL);
4400 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);
4402 if (r_idx && one_in_(2))
4405 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4406 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4407 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4409 GAME_TEXT m_name[MAX_NLEN];
4410 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4411 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4417 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4419 disturb(FALSE, TRUE);
4424 * @brief プレイヤーの行動処理 / Process the player
4427 * Notice the annoying code to handle "pack overflow", which\n
4428 * must come first just in case somebody manages to corrupt\n
4429 * the savefiles by clever use of menu commands or something.\n
4431 static void process_player(void)
4435 /*** Apply energy ***/
4437 if (p_ptr->hack_mutation)
4439 msg_print(_("何か変わった気がする!", "You feel different!"));
4441 (void)gain_mutation(p_ptr, 0);
4442 p_ptr->hack_mutation = FALSE;
4445 if (p_ptr->invoking_midnight_curse)
4448 activate_ty_curse(FALSE, &count);
4449 p_ptr->invoking_midnight_curse = FALSE;
4452 if (p_ptr->inside_battle)
4454 for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4456 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4458 if (!monster_is_valid(m_ptr)) continue;
4460 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4461 update_monster(m_idx, FALSE);
4466 /* Give the player some energy */
4467 else if (!(load && p_ptr->energy_need <= 0))
4469 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4472 /* No current_world_ptr->game_turn yet */
4473 if (p_ptr->energy_need > 0) return;
4474 if (!command_rep) prt_time();
4476 /*** Check for interupts ***/
4478 /* Complete resting */
4479 if (p_ptr->resting < 0)
4482 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4485 if ((p_ptr->chp == p_ptr->mhp) &&
4486 (p_ptr->csp >= p_ptr->msp))
4488 set_action(ACTION_NONE);
4492 /* Complete resting */
4493 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4496 if ((p_ptr->chp == p_ptr->mhp) &&
4497 (p_ptr->csp >= p_ptr->msp) &&
4498 !p_ptr->blind && !p_ptr->confused &&
4499 !p_ptr->poisoned && !p_ptr->afraid &&
4500 !p_ptr->stun && !p_ptr->cut &&
4501 !p_ptr->slow && !p_ptr->paralyzed &&
4502 !p_ptr->image && !p_ptr->word_recall &&
4503 !p_ptr->alter_reality)
4505 set_action(ACTION_NONE);
4510 if (p_ptr->action == ACTION_FISH) process_fishing();
4512 /* Handle "abort" */
4515 /* Check for "player abort" (semi-efficiently for resting) */
4516 if (p_ptr->running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4521 /* Check for a key */
4524 flush(); /* Flush input */
4526 disturb(FALSE, TRUE);
4528 /* Hack -- Show a Message */
4529 msg_print(_("中断しました。", "Canceled."));
4534 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4536 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4537 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4539 if (MON_CSLEEP(m_ptr))
4541 GAME_TEXT m_name[MAX_NLEN];
4544 (void)set_monster_csleep(p_ptr->riding, 0);
4545 monster_desc(m_name, m_ptr, 0);
4546 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4549 if (MON_STUNNED(m_ptr))
4551 /* Hack -- Recover from stun */
4552 if (set_monster_stunned(p_ptr->riding,
4553 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4555 GAME_TEXT m_name[MAX_NLEN];
4556 monster_desc(m_name, m_ptr, 0);
4557 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4561 if (MON_CONFUSED(m_ptr))
4563 /* Hack -- Recover from confusion */
4564 if (set_monster_confused(p_ptr->riding,
4565 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4567 GAME_TEXT m_name[MAX_NLEN];
4568 monster_desc(m_name, m_ptr, 0);
4569 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4573 if (MON_MONFEAR(m_ptr))
4575 /* Hack -- Recover from fear */
4576 if(set_monster_monfear(p_ptr->riding,
4577 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4579 GAME_TEXT m_name[MAX_NLEN];
4580 monster_desc(m_name, m_ptr, 0);
4581 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4591 if (p_ptr->lightspeed)
4593 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4595 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4597 if(P_PTR_KI < 40) P_PTR_KI = 0;
4598 else P_PTR_KI -= 40;
4599 p_ptr->update |= (PU_BONUS);
4601 if (p_ptr->action == ACTION_LEARN)
4604 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4606 /* Convert the unit (1/2^16) to (1/2^32) */
4607 s64b_LSHIFT(cost, cost_frac, 16);
4609 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4613 p_ptr->csp_frac = 0;
4614 set_action(ACTION_NONE);
4619 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4621 p_ptr->redraw |= PR_MANA;
4624 if (p_ptr->special_defense & KATA_MASK)
4626 if (p_ptr->special_defense & KATA_MUSOU)
4630 set_action(ACTION_NONE);
4635 p_ptr->redraw |= (PR_MANA);
4640 /*** Handle actual user input ***/
4642 /* Repeat until out of energy */
4643 while (p_ptr->energy_need <= 0)
4645 p_ptr->window |= PW_PLAYER;
4646 p_ptr->sutemi = FALSE;
4647 p_ptr->counter = FALSE;
4648 p_ptr->now_damaged = FALSE;
4652 /* Place the cursor on the player */
4653 move_cursor_relative(p_ptr->y, p_ptr->x);
4655 /* Refresh (optional) */
4656 if (fresh_before) Term_fresh();
4658 /* Hack -- Pack Overflow */
4661 /* Hack -- cancel "lurking browse mode" */
4662 if (!command_new) command_see = FALSE;
4664 /* Assume free current_world_ptr->game_turn */
4667 if (p_ptr->inside_battle)
4669 /* Place the cursor on the player */
4670 move_cursor_relative(p_ptr->y, p_ptr->x);
4672 command_cmd = SPECIAL_KEY_BUILDING;
4674 /* Process the command */
4678 /* Paralyzed or Knocked Out */
4679 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4681 take_turn(p_ptr, 100);
4685 else if (p_ptr->action == ACTION_REST)
4688 if (p_ptr->resting > 0)
4690 /* Reduce rest count */
4693 if (!p_ptr->resting) set_action(ACTION_NONE);
4694 p_ptr->redraw |= (PR_STATE);
4697 take_turn(p_ptr, 100);
4701 else if (p_ptr->action == ACTION_FISH)
4703 take_turn(p_ptr, 100);
4707 else if (p_ptr->running)
4715 else if (travel.run)
4722 /* Repeated command */
4723 else if (command_rep)
4725 /* Count this execution */
4728 p_ptr->redraw |= (PR_STATE);
4731 /* Hack -- Assume messages were seen */
4734 /* Clear the top line */
4737 /* Process the command */
4741 /* Normal command */
4744 /* Place the cursor on the player */
4745 move_cursor_relative(p_ptr->y, p_ptr->x);
4748 /* Get a command (normal) */
4749 request_command(FALSE);
4752 /* Process the command */
4756 /* Hack -- Pack Overflow */
4762 if (p_ptr->energy_use)
4764 /* Use some energy */
4765 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4767 /* The Randomness is irrelevant */
4768 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4772 /* There is some randomness of needed energy */
4773 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4776 /* Hack -- constant hallucination */
4777 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4779 /* Shimmer multi-hued monsters */
4780 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4782 monster_type *m_ptr;
4783 monster_race *r_ptr;
4785 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4786 if (!monster_is_valid(m_ptr)) continue;
4788 /* Skip unseen monsters */
4789 if (!m_ptr->ml) continue;
4791 /* Access the monster race */
4792 r_ptr = &r_info[m_ptr->ap_r_idx];
4794 /* Skip non-multi-hued monsters */
4795 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4798 /* Redraw regardless */
4799 lite_spot(m_ptr->fy, m_ptr->fx);
4803 /* Handle monster detection */
4804 if (repair_monsters)
4806 /* Reset the flag */
4807 repair_monsters = FALSE;
4809 /* Rotate detection flags */
4810 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4812 monster_type *m_ptr;
4813 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4814 if (!monster_is_valid(m_ptr)) continue;
4816 /* Nice monsters get mean */
4817 if (m_ptr->mflag & MFLAG_NICE)
4819 /* Nice monsters get mean */
4820 m_ptr->mflag &= ~(MFLAG_NICE);
4823 /* Handle memorized monsters */
4824 if (m_ptr->mflag2 & MFLAG2_MARK)
4826 /* Maintain detection */
4827 if (m_ptr->mflag2 & MFLAG2_SHOW)
4830 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4832 /* Still need repairs */
4833 repair_monsters = TRUE;
4836 /* Remove detection */
4840 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4842 /* Assume invisible */
4844 update_monster(m_idx, FALSE);
4846 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4847 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4849 /* Redraw regardless */
4850 lite_spot(m_ptr->fy, m_ptr->fx);
4855 if (p_ptr->pclass == CLASS_IMITATOR)
4858 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4861 for (j = 0; j < p_ptr->mane_num; j++)
4863 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4864 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4868 p_ptr->redraw |= (PR_IMITATION);
4870 if (p_ptr->action == ACTION_LEARN)
4873 p_ptr->redraw |= (PR_STATE);
4876 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4879 p_ptr->redraw |= (PR_MAP);
4880 p_ptr->update |= (PU_MONSTERS);
4881 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4883 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4885 p_ptr->timewalk = FALSE;
4886 p_ptr->energy_need = ENERGY_NEED();
4892 /* Hack -- notice death */
4893 if (!p_ptr->playing || p_ptr->is_dead)
4895 p_ptr->timewalk = FALSE;
4900 if (p_ptr->energy_use && p_ptr->reset_concent) reset_concentration(TRUE);
4902 /* Handle "leaving" */
4903 if (p_ptr->leaving) break;
4906 /* Update scent trail */
4911 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4915 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4916 * ゲームを終了するかのいずれかまでループする。
4919 * This function will not exit until the level is completed,\n
4920 * the user dies, or the game is terminated.\n
4923 static void dungeon(bool load_game)
4927 /* Set the base level */
4928 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4930 /* Reset various flags */
4931 current_world_ptr->is_loading_now = FALSE;
4934 p_ptr->leaving = FALSE;
4936 /* Reset the "command" vars */
4939 #if 0 /* Don't reset here --- It's used for Arena */
4948 /* Cancel the target */
4952 p_ptr->ambush_flag = FALSE;
4954 /* Cancel the health bar */
4957 /* Check visual effects */
4958 repair_monsters = TRUE;
4959 repair_objects = TRUE;
4962 disturb(TRUE, TRUE);
4964 /* Get index of current quest (if any) */
4965 quest_num = quest_number(current_floor_ptr->dun_level);
4967 /* Inside a quest? */
4970 /* Mark the quest monster */
4971 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4974 /* Track maximum player level */
4975 if (p_ptr->max_plv < p_ptr->lev)
4977 p_ptr->max_plv = p_ptr->lev;
4981 /* Track maximum dungeon level (if not in quest -KMW-) */
4982 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4984 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4985 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4988 (void)calculate_upkeep();
4990 /* Validate the panel */
4991 panel_bounds_center();
4993 /* Verify the panel */
4999 /* Enter "xtra" mode */
5000 current_world_ptr->character_xtra = TRUE;
5002 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5003 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5004 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);
5008 /* Leave "xtra" mode */
5009 current_world_ptr->character_xtra = FALSE;
5011 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5012 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5016 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5017 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5018 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5020 if (p_ptr->inside_battle)
5024 p_ptr->energy_need = 0;
5025 update_gambling_monsters();
5029 msg_print(_("試合開始!", "Ready..Fight!"));
5034 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5035 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5037 /* Hack -- notice death or departure */
5038 if (!p_ptr->playing || p_ptr->is_dead) return;
5040 /* Print quest message if appropriate */
5041 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5043 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5044 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5046 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5048 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5050 msg_format("この階には%sの主である%sが棲んでいる。",
5051 d_name+d_info[p_ptr->dungeon_idx].name,
5052 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5054 msg_format("%^s lives in this level as the keeper of %s.",
5055 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5056 d_name+d_info[p_ptr->dungeon_idx].name);
5060 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5062 /*** Process this dungeon level ***/
5064 /* Reset the monster generation level */
5065 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5067 /* Reset the object generation level */
5068 current_floor_ptr->object_level = current_floor_ptr->base_level;
5070 current_world_ptr->is_loading_now = TRUE;
5072 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5073 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5074 p_ptr->energy_need = 0;
5076 /* Not leaving dungeon */
5077 p_ptr->leaving_dungeon = FALSE;
5079 /* Initialize monster process */
5085 /* Hack -- Compact the monster list occasionally */
5086 if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5088 /* Hack -- Compress the monster list occasionally */
5089 if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0);
5092 /* Hack -- Compact the object list occasionally */
5093 if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5095 /* Hack -- Compress the object list occasionally */
5096 if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0);
5098 /* Process the player */
5100 process_upkeep_with_speed();
5104 /* Hack -- Hilite the player */
5105 move_cursor_relative(p_ptr->y, p_ptr->x);
5107 /* Optional fresh */
5108 if (fresh_after) Term_fresh();
5110 /* Hack -- Notice death or departure */
5111 if (!p_ptr->playing || p_ptr->is_dead) break;
5113 /* Process all of the monsters */
5118 /* Hack -- Hilite the player */
5119 move_cursor_relative(p_ptr->y, p_ptr->x);
5121 /* Optional fresh */
5122 if (fresh_after) Term_fresh();
5124 /* Hack -- Notice death or departure */
5125 if (!p_ptr->playing || p_ptr->is_dead) break;
5127 /* Process the world */
5132 /* Hack -- Hilite the player */
5133 move_cursor_relative(p_ptr->y, p_ptr->x);
5135 /* Optional fresh */
5136 if (fresh_after) Term_fresh();
5138 /* Hack -- Notice death or departure */
5139 if (!p_ptr->playing || p_ptr->is_dead) break;
5141 /* Count game turns */
5142 current_world_ptr->game_turn++;
5144 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5146 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5147 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5150 prevent_turn_overflow();
5152 /* Handle "leaving" */
5153 if (p_ptr->leaving) break;
5155 if (wild_regen) wild_regen--;
5158 /* Inside a quest and non-unique questor? */
5159 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5161 /* Un-mark the quest monster */
5162 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5165 /* Not save-and-quit and not dead? */
5166 if (p_ptr->playing && !p_ptr->is_dead)
5169 * Maintain Unique monsters and artifact, save current
5170 * floor, then prepare next floor
5174 /* Forget the flag */
5175 reinit_wilderness = FALSE;
5178 /* Write about current level on the play record once per level */
5184 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5187 * Modified by Arcum Dagsson to support
5188 * separate macro files for different realms.
5190 static void load_all_pref_files(void)
5194 /* Access the "user" pref file */
5195 sprintf(buf, "user.prf");
5197 /* Process that file */
5198 process_pref_file(buf);
5200 /* Access the "user" system pref file */
5201 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5203 /* Process that file */
5204 process_pref_file(buf);
5206 /* Access the "race" pref file */
5207 sprintf(buf, "%s.prf", rp_ptr->title);
5209 /* Process that file */
5210 process_pref_file(buf);
5212 /* Access the "class" pref file */
5213 sprintf(buf, "%s.prf", cp_ptr->title);
5215 /* Process that file */
5216 process_pref_file(buf);
5218 /* Access the "character" pref file */
5219 sprintf(buf, "%s.prf", p_ptr->base_name);
5221 /* Process that file */
5222 process_pref_file(buf);
5224 /* Access the "realm 1" pref file */
5225 if (p_ptr->realm1 != REALM_NONE)
5227 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5229 /* Process that file */
5230 process_pref_file(buf);
5233 /* Access the "realm 2" pref file */
5234 if (p_ptr->realm2 != REALM_NONE)
5236 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5238 /* Process that file */
5239 process_pref_file(buf);
5243 /* Load an autopick preference file */
5244 autopick_load_pref(FALSE);
5248 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5251 * If the "new_game" parameter is true, then, after loading the
5252 * savefile, we will commit suicide, if necessary, to allow the
5253 * player to start a new game.
5255 void play_game(bool new_game)
5258 bool load_game = TRUE;
5259 bool init_random_seed = FALSE;
5269 else if (chuukei_server)
5271 prepare_chuukei_hooks();
5282 p_ptr->hack_mutation = FALSE;
5284 /* Hack -- Character is "icky" */
5285 current_world_ptr->character_icky = TRUE;
5287 /* Make sure main term is active */
5288 Term_activate(angband_term[0]);
5290 /* Initialise the resize hooks */
5291 angband_term[0]->resize_hook = resize_map;
5293 for (i = 1; i < 8; i++)
5295 /* Does the term exist? */
5296 if (angband_term[i])
5298 /* Add the redraw on resize hook */
5299 angband_term[i]->resize_hook = redraw_window;
5303 /* Hack -- current_world_ptr->game_turn off the cursor */
5304 (void)Term_set_cursor(0);
5307 /* Attempt to load */
5310 quit(_("セーブファイルが壊れています", "broken savefile"));
5313 /* Extract the options */
5314 extract_option_vars();
5316 /* Report waited score */
5317 if (p_ptr->wait_report_score)
5322 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5325 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5326 update_creature(p_ptr);
5328 p_ptr->is_dead = TRUE;
5330 current_world_ptr->start_time = (u32b)time(NULL);
5332 /* No suspending now */
5333 signals_ignore_tstp();
5335 /* Hack -- Character is now "icky" */
5336 current_world_ptr->character_icky = TRUE;
5338 /* Build the filename */
5339 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5341 /* Open the high score file, for reading/writing */
5342 highscore_fd = fd_open(buf, O_RDWR);
5344 /* 町名消失バグ対策(#38205) Init the wilderness */
5345 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5347 /* Handle score, show Top scores */
5348 success = send_world_score(TRUE);
5350 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5352 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5357 p_ptr->wait_report_score = FALSE;
5359 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5361 /* Shut the high score file */
5362 (void)fd_close(highscore_fd);
5364 /* Forget the high score fd */
5367 /* Allow suspending now */
5368 signals_handle_tstp();
5373 current_world_ptr->creating_savefile = new_game;
5375 /* Nothing loaded */
5376 if (!current_world_ptr->character_loaded)
5378 /* Make new player */
5381 /* The dungeon is not ready */
5382 current_world_ptr->character_dungeon = FALSE;
5384 /* Prepare to init the RNG */
5385 init_random_seed = TRUE;
5387 /* Initialize the saved floors data */
5388 init_saved_floors(FALSE);
5391 /* Old game is loaded. But new game is requested. */
5394 /* Initialize the saved floors data */
5395 init_saved_floors(TRUE);
5398 /* Process old character */
5401 /* Process the player name */
5402 process_player_name(FALSE);
5406 if (init_random_seed)
5411 /* Roll new character */
5414 /* The dungeon is not ready */
5415 current_world_ptr->character_dungeon = FALSE;
5418 current_floor_ptr->dun_level = 0;
5419 p_ptr->inside_quest = 0;
5420 p_ptr->inside_arena = FALSE;
5421 p_ptr->inside_battle = FALSE;
5425 /* Hack -- seed for flavors */
5426 current_world_ptr->seed_flavor = randint0(0x10000000);
5428 /* Hack -- seed for town layout */
5429 current_world_ptr->seed_town = randint0(0x10000000);
5431 /* Roll up a new character */
5439 determine_bounty_uniques();
5440 determine_today_mon(FALSE);
5442 /* Initialize object array */
5447 write_level = FALSE;
5449 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5451 " ---- Restart Game ----"));
5454 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5455 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5457 if (p_ptr->riding == -1)
5460 for (i = current_floor_ptr->m_max; i > 0; i--)
5462 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5471 current_world_ptr->creating_savefile = FALSE;
5473 p_ptr->teleport_town = FALSE;
5474 p_ptr->sutemi = FALSE;
5475 current_world_ptr->timewalk_m_idx = 0;
5476 p_ptr->now_damaged = FALSE;
5478 current_world_ptr->start_time = time(NULL) - 1;
5479 record_o_name[0] = '\0';
5481 /* Reset map panel */
5482 panel_row_min = current_floor_ptr->height;
5483 panel_col_min = current_floor_ptr->width;
5485 /* Sexy gal gets bonus to maximum weapon skill of whip */
5486 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5487 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5489 /* Fill the arrays of floors and walls in the good proportions */
5490 set_floor_and_wall(p_ptr->dungeon_idx);
5492 /* Flavor the objects */
5495 /* Flash a message */
5496 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5498 /* Flush the message */
5502 /* Hack -- Enter wizard mode */
5505 if (enter_wizard_mode())
5507 p_ptr->wizard = TRUE;
5509 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5511 /* Initialize the saved floors data */
5512 init_saved_floors(TRUE);
5515 p_ptr->inside_quest = 0;
5517 /* Avoid crash in update_view() */
5518 p_ptr->y = p_ptr->x = 10;
5521 else if (p_ptr->is_dead)
5523 quit("Already dead.");
5527 /* Initialize the town-buildings if necessary */
5528 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5530 /* Init the wilderness */
5532 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5535 init_flags = INIT_ONLY_BUILDINGS;
5537 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5539 select_floor_music();
5543 /* Generate a dungeon level if needed */
5544 if (!current_world_ptr->character_dungeon)
5551 /* HACK -- Restore from panic-save */
5552 if (p_ptr->panic_save)
5554 /* No player? -- Try to regenerate floor */
5555 if (!p_ptr->y || !p_ptr->x)
5557 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5561 /* Still no player? -- Try to locate random place */
5562 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5564 /* No longer in panic */
5565 p_ptr->panic_save = 0;
5569 /* Character is now "complete" */
5570 current_world_ptr->character_generated = TRUE;
5573 /* Hack -- Character is no longer "icky" */
5574 current_world_ptr->character_icky = FALSE;
5580 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5581 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5586 p_ptr->playing = TRUE;
5588 /* Reset the visual mappings */
5591 /* Load the "pref" files */
5592 load_all_pref_files();
5594 /* Give startup outfit (after loading pref files) */
5600 /* React to changes */
5601 Term_xtra(TERM_XTRA_REACT, 0);
5603 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5604 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5607 /* Set or clear "rogue_like_commands" if requested */
5608 if (arg_force_original) rogue_like_commands = FALSE;
5609 if (arg_force_roguelike) rogue_like_commands = TRUE;
5611 /* Hack -- Enforce "delayed death" */
5612 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5614 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5616 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5618 monster_type *m_ptr;
5619 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5620 monster_race *r_ptr = &r_info[pet_r_idx];
5621 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5622 (PM_FORCE_PET | PM_NO_KAGE));
5623 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5624 m_ptr->mspeed = r_ptr->speed;
5625 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5626 m_ptr->max_maxhp = m_ptr->maxhp;
5627 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5628 m_ptr->dealt_damage = 0;
5629 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5632 (void)combine_and_reorder_home(STORE_HOME);
5633 (void)combine_and_reorder_home(STORE_MUSEUM);
5635 select_floor_music();
5640 /* Process the level */
5643 /* Hack -- prevent "icky" message */
5644 current_world_ptr->character_xtra = TRUE;
5648 current_world_ptr->character_xtra = FALSE;
5650 /* Cancel the target */
5653 /* Cancel the health bar */
5660 /* Handle "quit and save" */
5661 if (!p_ptr->playing && !p_ptr->is_dead) break;
5663 /* Erase the old current_floor_ptr->grid_array */
5665 if (!p_ptr->is_dead) wipe_m_list();
5672 /* Accidental Death */
5673 if (p_ptr->playing && p_ptr->is_dead)
5675 if (p_ptr->inside_arena)
5677 p_ptr->inside_arena = FALSE;
5678 if (p_ptr->arena_number > MAX_ARENA_MONS)
5679 p_ptr->arena_number++;
5681 p_ptr->arena_number = -1 - p_ptr->arena_number;
5682 p_ptr->is_dead = FALSE;
5684 p_ptr->chp_frac = 0;
5685 p_ptr->exit_bldg = TRUE;
5688 /* Leave through the exit */
5689 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5691 /* prepare next floor */
5696 /* Mega-Hack -- Allow player to cheat death */
5697 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5704 /* Handle "death" */
5705 if (p_ptr->is_dead) break;
5707 /* Make a new level */
5719 * @brief ゲームターンからの実時間換算を行うための補正をかける
5720 * @param hoge ゲームターン
5721 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5722 * @return 修正をかけた後のゲームターン
5724 s32b turn_real(s32b hoge)
5726 switch (p_ptr->start_race)
5732 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5739 * @brief ターンのオーバーフローに対する対処
5740 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5741 * @return 修正をかけた後のゲームターン
5743 void prevent_turn_overflow(void)
5745 int rollback_days, i, j;
5746 s32b rollback_turns;
5748 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5750 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5751 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5753 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5754 else current_world_ptr->game_turn = 1;
5755 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5756 else current_floor_ptr->generated_turn = 1;
5757 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
5758 else current_world_ptr->arena_start_turn = 1;
5759 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5760 else p_ptr->feeling_turn = 1;
5762 for (i = 1; i < max_towns; i++)
5764 for (j = 0; j < MAX_STORES; j++)
5766 store_type *st_ptr = &town_info[i].store[j];
5768 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5770 st_ptr->last_visit -= rollback_turns;
5771 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5774 if (st_ptr->store_open)
5776 st_ptr->store_open -= rollback_turns;
5777 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5785 * Close up the current game (player may or may not be dead)
5789 * This function is called only from "main.c" and "signals.c".
5792 void close_game(void)
5795 bool do_send = TRUE;
5797 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5800 /* Flush the messages */
5803 /* Flush the input */
5807 /* No suspending now */
5808 signals_ignore_tstp();
5811 /* Hack -- Character is now "icky" */
5812 current_world_ptr->character_icky = TRUE;
5815 /* Build the filename */
5816 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5818 /* Grab permissions */
5821 /* Open the high score file, for reading/writing */
5822 highscore_fd = fd_open(buf, O_RDWR);
5824 /* Drop permissions */
5830 /* Handle retirement */
5831 if (p_ptr->total_winner) kingly();
5834 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5836 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5838 else do_send = FALSE;
5845 /* Show more info */
5851 if ((!send_world_score(do_send)))
5853 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5854 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5856 p_ptr->wait_report_score = TRUE;
5857 p_ptr->is_dead = FALSE;
5858 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5861 if (!p_ptr->wait_report_score)
5864 else if (highscore_fd >= 0)
5866 display_scores_aux(0, 10, -1, NULL);
5869 /* Dump bones file */
5878 do_cmd_save_game(FALSE);
5880 /* Prompt for scores */
5881 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5882 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5884 /* Predict score (or ESCAPE) */
5885 if (inkey() != ESCAPE) predict_score();
5889 /* Shut the high score file */
5890 (void)fd_close(highscore_fd);
5892 /* Forget the high score fd */
5895 /* Kill all temporal files */
5896 clear_saved_floor_files();
5898 /* Allow suspending now */
5899 signals_handle_tstp();
5904 * @brief 全更新処理をチェックして処理していく
5905 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
5908 void handle_stuff(void)
5910 if (p_ptr->update) update_creature(p_ptr);
5911 if (p_ptr->redraw) redraw_stuff();
5912 if (p_ptr->window) window_stuff();
5915 void update_output(void)
5917 if (p_ptr->redraw) redraw_stuff();
5918 if (p_ptr->window) window_stuff();