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.
23 #include "cmd-activate.h"
26 #include "cmd-hissatsu.h"
28 #include "cmd-magiceat.h"
30 #include "cmd-quaff.h"
32 #include "cmd-smith.h"
33 #include "cmd-usestaff.h"
34 #include "cmd-zaprod.h"
35 #include "cmd-zapwand.h"
37 #include "cmd-basic.h"
43 #include "floor-events.h"
44 #include "floor-town.h"
46 #include "object-ego.h"
47 #include "object-curse.h"
48 #include "object-flavor.h"
51 #include "spells-summon.h"
52 #include "spells-object.h"
53 #include "spells-status.h"
54 #include "spells-floor.h"
55 #include "monster-spell.h"
62 #include "player-move.h"
63 #include "player-status.h"
64 #include "player-class.h"
65 #include "player-race.h"
66 #include "player-personality.h"
67 #include "player-damage.h"
68 #include "player-effects.h"
69 #include "cmd-spell.h"
70 #include "realm-hex.h"
71 #include "objectkind.h"
72 #include "object-hook.h"
74 #include "monster-process.h"
75 #include "monster-status.h"
76 #include "monsterrace-hook.h"
77 #include "floor-save.h"
79 #include "player-skill.h"
81 #include "view-mainwindow.h"
82 #include "dungeon-file.h"
88 #include "realm-song.h"
89 #include "targeting.h"
93 * Hack -- Link a copyright message into the executable
95 const concptr copyright[5] =
97 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
99 "This software may be copied and distributed for educational, research,",
100 "and not for profit purposes provided that this copyright and statement",
101 "are included in all such copies."
104 bool can_save = FALSE; /* Game can be saved */
106 COMMAND_CODE now_message;
108 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
111 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
113 concptr ANGBAND_KEYBOARD = "0";
116 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
118 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
119 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
122 * Flags for initialization
127 * @brief 擬似鑑定を実際に行い判定を反映する
128 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
129 * @param heavy 重度の擬似鑑定を行うならばTRUE
132 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
135 object_type *o_ptr = &p_ptr->inventory_list[slot];
136 GAME_TEXT o_name[MAX_NLEN];
138 /* We know about it already, do not tell us again */
139 if (o_ptr->ident & (IDENT_SENSE))return;
141 /* It is fully known, no information needed */
142 if (object_is_known(o_ptr)) return;
144 /* Check for a feeling */
145 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
147 /* Skip non-feelings */
151 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
162 feel = FEEL_EXCELLENT;
168 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
170 feel = FEEL_UNCURSED;
175 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
181 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
188 feel = FEEL_WORTHLESS;
193 feel = FEEL_TERRIBLE;
199 /* Stop everything */
200 if (disturb_minor) disturb(FALSE, FALSE);
202 /* Get an object description */
203 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
205 /* Message (equipment) */
206 if (slot >= INVEN_RARM)
209 msg_format("%s%s(%c)は%sという感じがする...",
210 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
212 msg_format("You feel the %s (%c) you are %s %s %s...",
213 o_name, index_to_label(slot), describe_use(slot),
214 ((o_ptr->number == 1) ? "is" : "are"),
215 game_inscriptions[feel]);
220 /* Message (p_ptr->inventory_list) */
224 msg_format("ザックの中の%s(%c)は%sという感じがする...",
225 o_name, index_to_label(slot),game_inscriptions[feel]);
227 msg_format("You feel the %s (%c) in your pack %s %s...",
228 o_name, index_to_label(slot),
229 ((o_ptr->number == 1) ? "is" : "are"),
230 game_inscriptions[feel]);
235 o_ptr->ident |= (IDENT_SENSE);
237 /* Set the "inscription" */
238 o_ptr->feeling = feel;
240 /* Auto-inscription/destroy */
241 autopick_alter_item(slot, destroy_feeling);
242 p_ptr->update |= (PU_COMBINE | PU_REORDER);
244 p_ptr->window |= (PW_INVEN | PW_EQUIP);
250 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
253 * Sense the p_ptr->inventory_list\n
255 * Class 0 = Warrior --> fast and heavy\n
256 * Class 1 = Mage --> slow and light\n
257 * Class 2 = Priest --> fast but light\n
258 * Class 3 = Rogue --> okay and heavy\n
259 * Class 4 = Ranger --> slow but heavy (changed!)\n
260 * Class 5 = Paladin --> slow but heavy\n
262 static void sense_inventory1(void)
265 PLAYER_LEVEL plev = p_ptr->lev;
270 /*** Check for "sensing" ***/
272 /* No sensing when confused */
273 if (p_ptr->confused) return;
275 /* Analyze the class */
276 switch (p_ptr->pclass)
284 if (0 != randint0(9000L / (plev * plev + 40))) return;
295 if (0 != randint0(6000L / (plev * plev + 50))) return;
304 case CLASS_HIGH_MAGE:
306 case CLASS_MAGIC_EATER:
308 /* Very bad (light) sensing */
309 if (0 != randint0(240000L / (plev + 5))) return;
317 /* Good (light) sensing */
318 if (0 != randint0(10000L / (plev * plev + 40))) return;
327 if (0 != randint0(20000L / (plev * plev + 40))) return;
338 if (0 != randint0(95000L / (plev * plev + 40))) return;
350 if (0 != randint0(77777L / (plev * plev + 40))) return;
358 case CLASS_WARRIOR_MAGE:
362 if (0 != randint0(75000L / (plev * plev + 40))) return;
367 case CLASS_MINDCRAFTER:
369 case CLASS_BLUE_MAGE:
370 case CLASS_MIRROR_MASTER:
373 if (0 != randint0(55000L / (plev * plev + 40))) return;
378 case CLASS_CHAOS_WARRIOR:
381 if (0 != randint0(80000L / (plev * plev + 40))) return;
390 case CLASS_FORCETRAINER:
393 if (0 != randint0(20000L / (plev * plev + 40))) return;
401 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
409 case CLASS_BEASTMASTER:
412 if (0 != randint0(65000L / (plev * plev + 40))) return;
416 case CLASS_BERSERKER:
425 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
427 /*** Sense everything ***/
429 /* Check everything */
430 for (i = 0; i < INVEN_TOTAL; i++)
434 o_ptr = &p_ptr->inventory_list[i];
436 /* Skip empty slots */
437 if (!o_ptr->k_idx) continue;
439 /* Valid "tval" codes */
466 /* Skip non-sense machines */
469 /* Occasional failure on p_ptr->inventory_list items */
470 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
473 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
478 sense_inventory_aux(i, heavy);
483 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
486 static void sense_inventory2(void)
489 PLAYER_LEVEL plev = p_ptr->lev;
493 /*** Check for "sensing" ***/
495 /* No sensing when confused */
496 if (p_ptr->confused) return;
498 /* Analyze the class */
499 switch (p_ptr->pclass)
505 case CLASS_BERSERKER:
513 case CLASS_CHAOS_WARRIOR:
515 case CLASS_BEASTMASTER:
518 /* Very bad (light) sensing */
519 if (0 != randint0(240000L / (plev + 5))) return;
525 case CLASS_WARRIOR_MAGE:
530 if (0 != randint0(95000L / (plev * plev + 40))) return;
538 case CLASS_FORCETRAINER:
539 case CLASS_MINDCRAFTER:
542 if (0 != randint0(20000L / (plev * plev + 40))) return;
548 case CLASS_HIGH_MAGE:
550 case CLASS_MAGIC_EATER:
551 case CLASS_MIRROR_MASTER:
552 case CLASS_BLUE_MAGE:
555 if (0 != randint0(9000L / (plev * plev + 40))) return;
563 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
569 /*** Sense everything ***/
571 /* Check everything */
572 for (i = 0; i < INVEN_TOTAL; i++)
576 o_ptr = &p_ptr->inventory_list[i];
578 /* Skip empty slots */
579 if (!o_ptr->k_idx) continue;
581 /* Valid "tval" codes */
594 /* Skip non-sense machines */
597 /* Occasional failure on p_ptr->inventory_list items */
598 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
600 sense_inventory_aux(i, TRUE);
605 * @brief パターン終点到達時のテレポート処理を行う
608 static void pattern_teleport(void)
611 DEPTH max_level = 99;
614 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
619 /* Only downward in ironman mode */
620 if (ironman_downward)
621 min_level = current_floor_ptr->dun_level;
624 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
626 if (current_floor_ptr->dun_level > 100)
627 max_level = MAX_DEPTH - 1;
628 else if (current_floor_ptr->dun_level == 100)
633 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
634 min_level = d_info[p_ptr->dungeon_idx].mindepth;
638 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
641 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
643 /* Ask for a level */
644 if (!get_string(ppp, tmp_val, 10)) return;
646 /* Extract request */
647 command_arg = (COMMAND_ARG)atoi(tmp_val);
649 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
651 teleport_player(200, 0L);
658 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
659 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
662 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
664 if (autosave_l) do_cmd_save_game(TRUE);
667 current_floor_ptr->dun_level = command_arg;
671 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
673 p_ptr->inside_quest = 0;
677 * Clear all saved floors
678 * and create a first saved floor
680 prepare_change_floor_mode(CFM_FIRST_FLOOR);
681 p_ptr->leaving = TRUE;
685 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
686 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
688 static bool pattern_effect(void)
692 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
694 if ((PRACE_IS_(RACE_AMBERITE)) &&
695 (p_ptr->cut > 0) && one_in_(10))
700 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
702 switch (pattern_type)
704 case PATTERN_TILE_END:
706 (void)restore_all_status();
707 (void)restore_level();
708 (void)cure_critical_wounds(1000);
710 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
711 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
714 * We could make the healing effect of the
715 * Pattern center one-time only to avoid various kinds
716 * of abuse, like luring the win monster into fighting you
717 * in the middle of the pattern...
721 case PATTERN_TILE_OLD:
725 case PATTERN_TILE_TELEPORT:
729 case PATTERN_TILE_WRECKED:
731 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
735 if (PRACE_IS_(RACE_AMBERITE) && !one_in_(2))
737 else if (!IS_INVULN())
738 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
747 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
748 * @param percent 回復比率
751 static void regenhp(int percent)
757 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
758 if (p_ptr->action == ACTION_HAYAGAKE) return;
760 /* Save the old hitpoints */
761 old_chp = p_ptr->chp;
764 * Extract the new hitpoints
766 * 'percent' is the Regen factor in unit (1/2^16)
769 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
771 /* Convert the unit (1/2^16) to (1/2^32) */
772 s64b_LSHIFT(new_chp, new_chp_frac, 16);
775 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
779 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
781 p_ptr->chp = p_ptr->mhp;
786 if (old_chp != p_ptr->chp)
788 p_ptr->redraw |= (PR_HP);
789 p_ptr->window |= (PW_PLAYER);
796 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
797 * @param upkeep_factor ペット維持によるMPコスト量
798 * @param regen_amount 回復量
801 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
803 MANA_POINT old_csp = p_ptr->csp;
804 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
807 * Excess mana will decay 32 times faster than normal
810 if (p_ptr->csp > p_ptr->msp)
812 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
814 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
816 /* Convert the unit (1/2^16) to (1/2^32) */
817 s64b_LSHIFT(decay, decay_frac, 16);
820 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
823 if (p_ptr->csp < p_ptr->msp)
825 p_ptr->csp = p_ptr->msp;
830 /* Regenerating mana (unless the player has excess mana) */
831 else if (regen_rate > 0)
833 /* (percent/100) is the Regen factor in unit (1/2^16) */
834 MANA_POINT new_mana = 0;
835 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
837 /* Convert the unit (1/2^16) to (1/2^32) */
838 s64b_LSHIFT(new_mana, new_mana_frac, 16);
841 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
843 /* Must set frac to zero even if equal */
844 if (p_ptr->csp >= p_ptr->msp)
846 p_ptr->csp = p_ptr->msp;
852 /* Reduce mana (even when the player has excess mana) */
855 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
856 s32b reduce_mana = 0;
857 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
859 /* Convert the unit (1/2^16) to (1/2^32) */
860 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
863 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
873 if (old_csp != p_ptr->csp)
875 p_ptr->redraw |= (PR_MANA);
876 p_ptr->window |= (PW_PLAYER);
877 p_ptr->window |= (PW_SPELL);
883 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
884 * @param regen_amount 回復量
887 static void regenmagic(int regen_amount)
892 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
894 for (i = 0; i < EATER_EXT*2; i++)
896 if (!p_ptr->magic_num2[i]) continue;
897 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
899 /* Increase remaining charge number like float value */
900 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
901 p_ptr->magic_num1[i] += new_mana;
903 /* Check maximum charge */
904 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
906 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
910 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
912 if (!p_ptr->magic_num1[i]) continue;
913 if (!p_ptr->magic_num2[i]) continue;
915 /* Decrease remaining period for charging */
916 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
917 / (dev * 16 * PY_REGEN_NORMAL);
918 p_ptr->magic_num1[i] -= new_mana;
920 /* Check minimum remaining period for charging */
921 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
928 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
930 * @note Should probably be done during monster turns.
932 static void regen_monsters(void)
937 /* Regenerate everyone */
938 for (i = 1; i < current_floor_ptr->m_max; i++)
940 /* Check the i'th monster */
941 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
942 monster_race *r_ptr = &r_info[m_ptr->r_idx];
944 if (!monster_is_valid(m_ptr)) continue;
946 /* Allow regeneration (if needed) */
947 if (m_ptr->hp < m_ptr->maxhp)
949 /* Hack -- Base regeneration */
950 frac = m_ptr->maxhp / 100;
952 /* Hack -- Minimal regeneration rate */
953 if (!frac) if (one_in_(2)) frac = 1;
955 /* Hack -- Some monsters regenerate quickly */
956 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
958 /* Hack -- Regenerate */
961 /* Do not over-regenerate */
962 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
964 /* Redraw (later) if needed */
965 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
966 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
973 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
975 * @note Should probably be done during monster turns.
977 static void regen_captured_monsters(void)
982 /* Regenerate everyone */
983 for (i = 0; i < INVEN_TOTAL; i++)
986 object_type *o_ptr = &p_ptr->inventory_list[i];
988 if (!o_ptr->k_idx) continue;
989 if (o_ptr->tval != TV_CAPTURE) continue;
990 if (!o_ptr->pval) continue;
994 r_ptr = &r_info[o_ptr->pval];
996 /* Allow regeneration (if needed) */
997 if (o_ptr->xtra4 < o_ptr->xtra5)
999 /* Hack -- Base regeneration */
1000 frac = o_ptr->xtra5 / 100;
1002 /* Hack -- Minimal regeneration rate */
1003 if (!frac) if (one_in_(2)) frac = 1;
1005 /* Hack -- Some monsters regenerate quickly */
1006 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1008 /* Hack -- Regenerate */
1009 o_ptr->xtra4 += (XTRA16)frac;
1011 /* Do not over-regenerate */
1012 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1019 p_ptr->update |= (PU_COMBINE);
1020 p_ptr->window |= (PW_INVEN);
1021 p_ptr->window |= (PW_EQUIP);
1027 * @brief 寿命つき光源の警告メッセージ処理
1028 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1031 static void notice_lite_change(object_type *o_ptr)
1033 /* Hack -- notice interesting fuel steps */
1034 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1036 p_ptr->window |= (PW_EQUIP);
1039 /* Hack -- Special treatment when blind */
1042 /* Hack -- save some light for later */
1043 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1046 /* The light is now out */
1047 else if (o_ptr->xtra4 == 0)
1049 disturb(FALSE, TRUE);
1050 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1052 /* Recalculate torch radius */
1053 p_ptr->update |= (PU_TORCH);
1055 /* Some ego light lose its effects without fuel */
1056 p_ptr->update |= (PU_BONUS);
1059 /* The light is getting dim */
1060 else if (o_ptr->name2 == EGO_LITE_LONG)
1062 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1063 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1065 if (disturb_minor) disturb(FALSE, TRUE);
1066 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1070 /* The light is getting dim */
1071 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1073 if (disturb_minor) disturb(FALSE, TRUE);
1074 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1080 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1081 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1084 static void recharged_notice(object_type *o_ptr)
1086 GAME_TEXT o_name[MAX_NLEN];
1090 /* No inscription */
1091 if (!o_ptr->inscription) return;
1094 s = my_strchr(quark_str(o_ptr->inscription), '!');
1096 /* Process notification request. */
1099 /* Find another '!' */
1102 /* Describe (briefly) */
1103 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1105 /* Notify the player */
1107 msg_format("%sは再充填された。", o_name);
1109 if (o_ptr->number > 1)
1110 msg_format("Your %s are recharged.", o_name);
1112 msg_format("Your %s is recharged.", o_name);
1115 disturb(FALSE, FALSE);
1121 /* Keep looking for '!'s */
1122 s = my_strchr(s + 1, '!');
1127 * @brief プレイヤーの歌に関する継続処理
1130 static void check_music(void)
1132 const magic_type *s_ptr;
1134 MANA_POINT need_mana;
1135 u32b need_mana_frac;
1137 /* Music singed by player */
1138 if (p_ptr->pclass != CLASS_BARD) return;
1139 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1141 if (p_ptr->anti_magic)
1143 stop_singing(p_ptr);
1147 spell = SINGING_SONG_ID(p_ptr);
1148 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1150 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1154 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1156 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1158 stop_singing(p_ptr);
1163 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1165 p_ptr->redraw |= PR_MANA;
1166 if (INTERUPTING_SONG_EFFECT(p_ptr))
1168 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1169 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1170 msg_print(_("歌を再開した。", "You restart singing."));
1171 p_ptr->action = ACTION_SING;
1172 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1173 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1174 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1177 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1178 p_ptr->spell_exp[spell] += 5;
1179 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1180 { 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; }
1181 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1182 { 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; }
1183 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1184 { 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; }
1186 /* Do any effects of continual song */
1187 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1191 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1192 * @param flag 探し出したい呪いフラグ配列
1193 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1196 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1199 int choices[INVEN_TOTAL-INVEN_RARM];
1202 /* Paranoia -- Player has no warning-item */
1203 if (!(p_ptr->cursed & flag)) return NULL;
1205 /* Search Inventry */
1206 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1208 object_type *o_ptr = &p_ptr->inventory_list[i];
1210 if (o_ptr->curse_flags & flag)
1212 choices[number] = i;
1215 else if ((flag == TRC_ADD_L_CURSE) ||
1216 (flag == TRC_ADD_H_CURSE) ||
1217 (flag == TRC_DRAIN_HP) ||
1218 (flag == TRC_DRAIN_MANA) ||
1219 (flag == TRC_CALL_ANIMAL) ||
1220 (flag == TRC_CALL_DEMON) ||
1221 (flag == TRC_CALL_DRAGON) ||
1222 (flag == TRC_CALL_UNDEAD) ||
1223 (flag == TRC_COWARDICE) ||
1224 (flag == TRC_LOW_MELEE) ||
1225 (flag == TRC_LOW_AC) ||
1226 (flag == TRC_LOW_MAGIC) ||
1227 (flag == TRC_FAST_DIGEST) ||
1228 (flag == TRC_SLOW_REGEN) )
1231 BIT_FLAGS flgs[TR_FLAG_SIZE];
1232 object_flags(o_ptr, flgs);
1235 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1236 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1237 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1238 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1239 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1240 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1241 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1242 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1243 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1244 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1245 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1246 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1247 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1248 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1251 if (have_flag(flgs, cf))
1253 choices[number] = i;
1259 /* Choice one of them */
1260 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1263 static void process_world_aux_digestion(void)
1265 if (!p_ptr->inside_battle)
1267 /* Digest quickly when gorged */
1268 if (p_ptr->food >= PY_FOOD_MAX)
1270 /* Digest a lot of food */
1271 (void)set_food(p_ptr->food - 100);
1274 /* Digest normally -- Every 50 game turns */
1275 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1277 /* Basic digestion rate based on speed */
1278 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1280 /* Regeneration takes more food */
1281 if (p_ptr->regenerate)
1283 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1285 if (p_ptr->cursed & TRC_FAST_DIGEST)
1288 /* Slow digestion takes less food */
1289 if (p_ptr->slow_digest)
1292 /* Minimal digestion */
1293 if (digestion < 1) digestion = 1;
1294 /* Maximal digestion */
1295 if (digestion > 100) digestion = 100;
1297 /* Digest some food */
1298 (void)set_food(p_ptr->food - digestion);
1303 if ((p_ptr->food < PY_FOOD_FAINT))
1305 /* Faint occasionally */
1306 if (!p_ptr->paralyzed && (randint0(100) < 10))
1308 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1309 disturb(TRUE, TRUE);
1311 /* Hack -- faint (bypass free action) */
1312 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1315 /* Starve to death (slowly) */
1316 if (p_ptr->food < PY_FOOD_STARVE)
1318 /* Calculate damage */
1319 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1321 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1328 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1329 * / Handle timed damage and regeneration every 10 game turns
1332 static void process_world_aux_hp_and_sp(void)
1334 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1335 bool cave_no_regen = FALSE;
1336 int upkeep_factor = 0;
1338 /* Default regeneration */
1339 int regen_amount = PY_REGEN_NORMAL;
1342 /*** Damage over Time ***/
1344 /* Take damage from poison */
1345 if (p_ptr->poisoned && !IS_INVULN())
1347 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1350 /* Take damage from cuts */
1351 if (p_ptr->cut && !IS_INVULN())
1355 /* Mortal wound or Deep Gash */
1356 if (p_ptr->cut > 1000)
1361 else if (p_ptr->cut > 200)
1367 else if (p_ptr->cut > 100)
1372 else if (p_ptr->cut > 50)
1377 else if (p_ptr->cut > 25)
1382 else if (p_ptr->cut > 10)
1393 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1396 /* (Vampires) Take damage from sunlight */
1397 if (PRACE_IS_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1399 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1401 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1403 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1404 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1405 cave_no_regen = TRUE;
1409 if (p_ptr->inventory_list[INVEN_LITE].tval && (p_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1410 !p_ptr->resist_lite)
1412 object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1413 GAME_TEXT o_name [MAX_NLEN];
1414 char ouch [MAX_NLEN+40];
1416 /* Get an object description */
1417 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1418 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1420 cave_no_regen = TRUE;
1422 /* Get an object description */
1423 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1424 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1426 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1430 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1434 if (have_flag(f_ptr->flags, FF_DEEP))
1436 damage = 6000 + randint0(4000);
1438 else if (!p_ptr->levitation)
1440 damage = 3000 + randint0(2000);
1445 if(PRACE_IS_(RACE_ENT)) damage += damage / 3;
1446 if(p_ptr->resist_fire) damage = damage / 3;
1447 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1448 if(p_ptr->levitation) damage = damage / 5;
1450 damage = damage / 100 + (randint0(100) < (damage % 100));
1452 if (p_ptr->levitation)
1454 msg_print(_("熱で火傷した!", "The heat burns you!"));
1455 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1456 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1460 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1461 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1462 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1465 cave_no_regen = TRUE;
1469 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1473 if (have_flag(f_ptr->flags, FF_DEEP))
1475 damage = 6000 + randint0(4000);
1477 else if (!p_ptr->levitation)
1479 damage = 3000 + randint0(2000);
1484 if (p_ptr->resist_cold) damage = damage / 3;
1485 if (IS_OPPOSE_COLD()) damage = damage / 3;
1486 if (p_ptr->levitation) damage = damage / 5;
1488 damage = damage / 100 + (randint0(100) < (damage % 100));
1490 if (p_ptr->levitation)
1492 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1493 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1494 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1498 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1499 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1500 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1503 cave_no_regen = TRUE;
1507 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1511 if (have_flag(f_ptr->flags, FF_DEEP))
1513 damage = 6000 + randint0(4000);
1515 else if (!p_ptr->levitation)
1517 damage = 3000 + randint0(2000);
1522 if (p_ptr->resist_elec) damage = damage / 3;
1523 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1524 if (p_ptr->levitation) damage = damage / 5;
1526 damage = damage / 100 + (randint0(100) < (damage % 100));
1528 if (p_ptr->levitation)
1530 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1531 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1532 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1536 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1537 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1538 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1541 cave_no_regen = TRUE;
1545 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1549 if (have_flag(f_ptr->flags, FF_DEEP))
1551 damage = 6000 + randint0(4000);
1553 else if (!p_ptr->levitation)
1555 damage = 3000 + randint0(2000);
1560 if (p_ptr->resist_acid) damage = damage / 3;
1561 if (IS_OPPOSE_ACID()) damage = damage / 3;
1562 if (p_ptr->levitation) damage = damage / 5;
1564 damage = damage / 100 + (randint0(100) < (damage % 100));
1566 if (p_ptr->levitation)
1568 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1569 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1570 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1574 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1575 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1576 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1579 cave_no_regen = TRUE;
1583 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1587 if (have_flag(f_ptr->flags, FF_DEEP))
1589 damage = 6000 + randint0(4000);
1591 else if (!p_ptr->levitation)
1593 damage = 3000 + randint0(2000);
1598 if (p_ptr->resist_pois) damage = damage / 3;
1599 if (IS_OPPOSE_POIS()) damage = damage / 3;
1600 if (p_ptr->levitation) damage = damage / 5;
1602 damage = damage / 100 + (randint0(100) < (damage % 100));
1604 if (p_ptr->levitation)
1606 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1607 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1608 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1609 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1613 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1614 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1615 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1616 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1619 cave_no_regen = TRUE;
1623 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1624 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1626 if (p_ptr->total_weight > weight_limit())
1628 msg_print(_("溺れている!", "You are drowning!"));
1629 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1630 cave_no_regen = TRUE;
1637 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1639 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1640 if (PRACE_IS_(RACE_ENT)) damage += damage / 3;
1641 if (p_ptr->resist_fire) damage = damage / 3;
1642 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1643 msg_print(_("熱い!", "It's hot!"));
1644 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1646 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1648 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1649 if (PRACE_IS_(RACE_ANDROID)) damage += damage / 3;
1650 if (p_ptr->resist_elec) damage = damage / 3;
1651 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1652 msg_print(_("痛い!", "It hurts!"));
1653 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1655 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1657 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1658 if (p_ptr->resist_cold) damage = damage / 3;
1659 if (IS_OPPOSE_COLD()) damage = damage / 3;
1660 msg_print(_("冷たい!", "It's cold!"));
1661 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1665 /* Spectres -- take damage when moving through walls */
1667 * Added: ANYBODY takes damage if inside through walls
1668 * without wraith form -- NOTE: Spectres will never be
1669 * reduced below 0 hp by being inside a stone wall; others
1672 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1674 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1677 cave_no_regen = TRUE;
1679 if (p_ptr->pass_wall)
1681 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1682 dam_desc = _("密度", "density");
1686 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1687 dam_desc = _("硬い岩", "solid rock");
1690 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1695 /*** handle regeneration ***/
1698 if (p_ptr->food < PY_FOOD_WEAK)
1700 /* Lower regeneration */
1701 if (p_ptr->food < PY_FOOD_STARVE)
1705 else if (p_ptr->food < PY_FOOD_FAINT)
1707 regen_amount = PY_REGEN_FAINT;
1711 regen_amount = PY_REGEN_WEAK;
1715 /* Are we walking the pattern? */
1716 if (pattern_effect())
1718 cave_no_regen = TRUE;
1722 /* Regeneration ability */
1723 if (p_ptr->regenerate)
1725 regen_amount = regen_amount * 2;
1727 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1731 if (p_ptr->cursed & TRC_SLOW_REGEN)
1738 /* Searching or Resting */
1739 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1741 regen_amount = regen_amount * 2;
1744 upkeep_factor = calculate_upkeep();
1746 /* No regeneration while special action */
1747 if ((p_ptr->action == ACTION_LEARN) ||
1748 (p_ptr->action == ACTION_HAYAGAKE) ||
1749 (p_ptr->special_defense & KATA_KOUKIJIN))
1751 upkeep_factor += 100;
1754 /* Regenerate the mana */
1755 regenmana(upkeep_factor, regen_amount);
1758 /* Recharge magic eater's power */
1759 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1761 regenmagic(regen_amount);
1764 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1766 while (upkeep_factor > 100)
1768 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1770 do_cmd_pet_dismiss();
1772 upkeep_factor = calculate_upkeep();
1774 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1779 /* Poisoned or cut yields no healing */
1780 if (p_ptr->poisoned) regen_amount = 0;
1781 if (p_ptr->cut) regen_amount = 0;
1783 /* Special floor -- Pattern, in a wall -- yields no healing */
1784 if (cave_no_regen) regen_amount = 0;
1786 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1788 /* Regenerate Hit Points if needed */
1789 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1791 regenhp(regen_amount);
1796 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1797 * / Handle timeout every 10 game turns
1800 static void process_world_aux_timeout(void)
1802 const int dec_count = (easy_band ? 2 : 1);
1804 /*** Timeout Various Things ***/
1807 if (p_ptr->tim_mimic)
1809 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1812 /* Hack -- Hallucinating */
1815 (void)set_image(p_ptr->image - dec_count);
1821 (void)set_blind(p_ptr->blind - dec_count);
1824 /* Times see-invisible */
1825 if (p_ptr->tim_invis)
1827 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1830 if (p_ptr->suppress_multi_reward)
1832 p_ptr->suppress_multi_reward = FALSE;
1838 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1841 /* Timed temporary elemental brands. -LM- */
1842 if (p_ptr->ele_attack)
1844 p_ptr->ele_attack--;
1846 /* Clear all temporary elemental brands. */
1847 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1850 /* Timed temporary elemental immune. -LM- */
1851 if (p_ptr->ele_immune)
1853 p_ptr->ele_immune--;
1855 /* Clear all temporary elemental brands. */
1856 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1859 /* Timed infra-vision */
1860 if (p_ptr->tim_infra)
1862 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1866 if (p_ptr->tim_stealth)
1868 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1871 /* Timed levitation */
1872 if (p_ptr->tim_levitation)
1874 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1877 /* Timed sh_touki */
1878 if (p_ptr->tim_sh_touki)
1880 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1884 if (p_ptr->tim_sh_fire)
1886 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1890 if (p_ptr->tim_sh_holy)
1892 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1896 if (p_ptr->tim_eyeeye)
1898 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1901 /* Timed resist-magic */
1902 if (p_ptr->resist_magic)
1904 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1907 /* Timed regeneration */
1908 if (p_ptr->tim_regen)
1910 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1913 /* Timed resist nether */
1914 if (p_ptr->tim_res_nether)
1916 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1919 /* Timed resist time */
1920 if (p_ptr->tim_res_time)
1922 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1926 if (p_ptr->tim_reflect)
1928 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1932 if (p_ptr->multishadow)
1934 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1937 /* Timed Robe of dust */
1938 if (p_ptr->dustrobe)
1940 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1943 /* Timed infra-vision */
1944 if (p_ptr->kabenuke)
1946 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1950 if (p_ptr->paralyzed)
1952 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1956 if (p_ptr->confused)
1958 (void)set_confused(p_ptr->confused - dec_count);
1964 (void)set_afraid(p_ptr->afraid - dec_count);
1970 (void)set_fast(p_ptr->fast - 1, TRUE);
1976 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1979 /* Protection from evil */
1980 if (p_ptr->protevil)
1982 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1985 /* Invulnerability */
1988 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1992 if (p_ptr->wraith_form)
1994 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2000 (void)set_hero(p_ptr->hero - 1, TRUE);
2006 (void)set_shero(p_ptr->shero - 1, TRUE);
2012 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2018 (void)set_shield(p_ptr->shield - 1, TRUE);
2022 if (p_ptr->tsubureru)
2024 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2028 if (p_ptr->magicdef)
2030 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2034 if (p_ptr->tsuyoshi)
2036 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2040 if (p_ptr->oppose_acid)
2042 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2045 /* Oppose Lightning */
2046 if (p_ptr->oppose_elec)
2048 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2052 if (p_ptr->oppose_fire)
2054 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2058 if (p_ptr->oppose_cold)
2060 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2064 if (p_ptr->oppose_pois)
2066 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2071 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2074 /*** Poison and Stun and Cut ***/
2077 if (p_ptr->poisoned)
2079 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2081 /* Apply some healing */
2082 (void)set_poisoned(p_ptr->poisoned - adjust);
2088 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2090 /* Apply some healing */
2091 (void)set_stun(p_ptr->stun - adjust);
2097 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2099 /* Hack -- Truly "mortal" wound */
2100 if (p_ptr->cut > 1000) adjust = 0;
2102 /* Apply some healing */
2103 (void)set_cut(p_ptr->cut - adjust);
2109 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2110 * / Handle burning fuel every 10 game turns
2113 static void process_world_aux_light(void)
2115 /* Check for light being wielded */
2116 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2118 /* Burn some fuel in the current lite */
2119 if (o_ptr->tval == TV_LITE)
2121 /* Hack -- Use some fuel (except on artifacts) */
2122 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2124 /* Decrease life-span */
2125 if (o_ptr->name2 == EGO_LITE_LONG)
2127 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2129 else o_ptr->xtra4--;
2131 /* Notice interesting fuel steps */
2132 notice_lite_change(o_ptr);
2139 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2140 * / Handle mutation effects once every 10 game turns
2143 static void process_world_aux_mutation(void)
2145 /* No mutation with effects */
2146 if (!p_ptr->muta2) return;
2148 /* No effect on monster arena */
2149 if (p_ptr->inside_battle) return;
2151 /* No effect on the global map */
2152 if (p_ptr->wild_mode) return;
2154 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2156 disturb(FALSE, TRUE);
2157 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2158 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2159 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2160 (void)set_afraid(0);
2163 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2165 if (!p_ptr->resist_fear)
2167 disturb(FALSE, TRUE);
2168 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2169 set_afraid(p_ptr->afraid + 13 + randint1(26));
2173 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2175 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2177 disturb(FALSE, TRUE);
2178 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2180 teleport_player(40, TELEPORT_PASSIVE);
2184 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2186 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2188 disturb(FALSE, TRUE);
2189 p_ptr->redraw |= PR_EXTRA;
2190 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2193 if (!p_ptr->resist_conf)
2195 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2198 if (!p_ptr->resist_chaos)
2203 if (one_in_(3)) lose_all_info();
2205 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2207 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2208 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2214 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2215 (void)set_image(p_ptr->image + randint0(150) + 150);
2221 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2223 if (!p_ptr->resist_chaos)
2225 disturb(FALSE, TRUE);
2226 p_ptr->redraw |= PR_EXTRA;
2227 (void)set_image(p_ptr->image + randint0(50) + 20);
2231 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2233 disturb(FALSE, TRUE);
2234 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2236 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2239 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2240 !p_ptr->anti_magic && one_in_(9000))
2243 disturb(FALSE, TRUE);
2244 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2245 "Magical energy flows through you! You must release it!"));
2249 (void)get_hack_dir(&dire);
2250 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2253 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2255 bool pet = one_in_(6);
2256 BIT_FLAGS mode = PM_ALLOW_GROUP;
2258 if (pet) mode |= PM_FORCE_PET;
2259 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2261 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode))
2263 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2264 disturb(FALSE, TRUE);
2268 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2270 disturb(FALSE, TRUE);
2273 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2275 if (p_ptr->fast > 0)
2281 set_slow(randint1(30) + 10, FALSE);
2286 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2288 if (p_ptr->slow > 0)
2294 set_fast(randint1(30) + 10, FALSE);
2299 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2301 disturb(FALSE, TRUE);
2302 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2304 banish_monsters(100);
2305 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2309 /* Pick a random shop (except home) */
2312 n = randint0(MAX_STORES);
2314 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2316 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2322 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2326 msg_print(_("影につつまれた。", "A shadow passes over you."));
2329 /* Absorb light from the current possition */
2330 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2335 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2337 /* Absorb some fuel in the current lite */
2338 if (o_ptr->tval == TV_LITE)
2340 /* Use some fuel (except on artifacts) */
2341 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2343 /* Heal the player a bit */
2344 hp_player(o_ptr->xtra4 / 20);
2346 /* Decrease life-span of lite */
2348 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2350 /* Notice interesting fuel steps */
2351 notice_lite_change(o_ptr);
2356 * Unlite the area (radius 10) around player and
2357 * do 50 points damage to every affected monster
2359 unlite_area(50, 10);
2362 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2364 bool pet = one_in_(3);
2365 BIT_FLAGS mode = PM_ALLOW_GROUP;
2367 if (pet) mode |= PM_FORCE_PET;
2368 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2370 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2372 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2373 disturb(FALSE, TRUE);
2377 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2379 disturb(FALSE, TRUE);
2380 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2383 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2385 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2387 if (!lose_mutation(0))
2388 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2390 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2392 disturb(FALSE, TRUE);
2393 msg_print(_("非物質化した!", "You feel insubstantial!"));
2396 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2398 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2402 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2404 int which_stat = randint0(A_MAX);
2405 int sustained = FALSE;
2410 if (p_ptr->sustain_str) sustained = TRUE;
2413 if (p_ptr->sustain_int) sustained = TRUE;
2416 if (p_ptr->sustain_wis) sustained = TRUE;
2419 if (p_ptr->sustain_dex) sustained = TRUE;
2422 if (p_ptr->sustain_con) sustained = TRUE;
2425 if (p_ptr->sustain_chr) sustained = TRUE;
2428 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2434 disturb(FALSE, TRUE);
2435 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2437 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2440 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2442 bool pet = one_in_(5);
2443 BIT_FLAGS mode = PM_ALLOW_GROUP;
2445 if (pet) mode |= PM_FORCE_PET;
2446 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2448 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2450 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2451 disturb(FALSE, TRUE);
2454 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2456 if (p_ptr->tim_esp > 0)
2458 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2459 set_tim_esp(0, TRUE);
2463 msg_print(_("精神が広がった!", "Your mind expands!"));
2464 set_tim_esp(p_ptr->lev, FALSE);
2467 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2469 disturb(FALSE, TRUE);
2470 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2472 set_food(PY_FOOD_WEAK);
2473 if (music_singing_any()) stop_singing(p_ptr);
2474 if (hex_spelling_any()) stop_hex_spell_all();
2477 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2482 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2484 int danger_amount = 0;
2485 MONSTER_IDX monster;
2487 for (monster = 0; monster < current_floor_ptr->m_max; monster++)
2489 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2490 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2491 if (!monster_is_valid(m_ptr)) continue;
2493 if (r_ptr->level >= p_ptr->lev)
2495 danger_amount += r_ptr->level - p_ptr->lev + 1;
2499 if (danger_amount > 100)
2500 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2501 else if (danger_amount > 50)
2502 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2503 else if (danger_amount > 20)
2504 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2505 else if (danger_amount > 10)
2506 msg_print(_("心配な気がする!", "You feel paranoid!"));
2507 else if (danger_amount > 5)
2508 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2510 msg_print(_("寂しい気がする。", "You feel lonely."));
2513 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2515 disturb(FALSE, TRUE);
2516 msg_print(_("無敵な気がする!", "You feel invincible!"));
2518 (void)set_invuln(randint1(8) + 8, FALSE);
2521 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2523 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2527 HIT_POINT healing = p_ptr->csp;
2528 if (healing > wounds) healing = wounds;
2531 p_ptr->csp -= healing;
2532 p_ptr->redraw |= (PR_HP | PR_MANA);
2536 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2538 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2542 HIT_POINT healing = p_ptr->chp;
2543 if (healing > wounds) healing = wounds;
2545 p_ptr->csp += healing;
2546 p_ptr->redraw |= (PR_HP | PR_MANA);
2547 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2551 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2553 INVENTORY_IDX slot = 0;
2554 object_type *o_ptr = NULL;
2556 disturb(FALSE, TRUE);
2557 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2558 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2561 if (has_melee_weapon(INVEN_RARM))
2564 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
2566 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2568 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2572 else if (has_melee_weapon(INVEN_LARM))
2574 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2577 if (slot && !object_is_cursed(o_ptr))
2579 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2580 inven_drop(slot, 1);
2587 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2588 * / Handle curse effects once every 10 game turns
2591 static void process_world_aux_curse(void)
2593 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2596 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2597 * can actually be useful!
2599 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2601 GAME_TEXT o_name[MAX_NLEN];
2603 int i, i_keep = 0, count = 0;
2605 /* Scan the equipment with random teleport ability */
2606 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2608 BIT_FLAGS flgs[TR_FLAG_SIZE];
2609 o_ptr = &p_ptr->inventory_list[i];
2610 if (!o_ptr->k_idx) continue;
2612 object_flags(o_ptr, flgs);
2614 if (have_flag(flgs, TR_TELEPORT))
2616 /* {.} will stop random teleportation. */
2617 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2620 if (one_in_(count)) i_keep = i;
2625 o_ptr = &p_ptr->inventory_list[i_keep];
2626 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2627 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2628 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2630 disturb(FALSE, TRUE);
2631 teleport_player(50, 0L);
2635 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2636 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2637 disturb(TRUE, TRUE);
2640 /* Make a chainsword noise */
2641 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2644 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2646 disturb(FALSE, FALSE);
2649 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2652 (void)activate_ty_curse(FALSE, &count);
2654 /* Handle experience draining */
2655 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2657 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2658 if (p_ptr->exp < 0) p_ptr->exp = 0;
2659 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2660 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2663 /* Add light curse (Later) */
2664 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2666 BIT_FLAGS new_curse;
2669 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2671 new_curse = get_curse(0, o_ptr);
2672 if (!(o_ptr->curse_flags & new_curse))
2674 GAME_TEXT o_name[MAX_NLEN];
2676 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2678 o_ptr->curse_flags |= new_curse;
2679 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2681 o_ptr->feeling = FEEL_NONE;
2683 p_ptr->update |= (PU_BONUS);
2686 /* Add heavy curse (Later) */
2687 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2689 BIT_FLAGS new_curse;
2692 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2694 new_curse = get_curse(1, o_ptr);
2695 if (!(o_ptr->curse_flags & new_curse))
2697 GAME_TEXT o_name[MAX_NLEN];
2699 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2701 o_ptr->curse_flags |= new_curse;
2702 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2703 o_ptr->feeling = FEEL_NONE;
2705 p_ptr->update |= (PU_BONUS);
2709 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2711 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)))
2713 GAME_TEXT o_name[MAX_NLEN];
2715 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2716 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2717 disturb(FALSE, TRUE);
2721 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2723 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)))
2725 GAME_TEXT o_name[MAX_NLEN];
2727 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2728 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2729 disturb(FALSE, TRUE);
2733 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2735 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2736 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2738 GAME_TEXT o_name[MAX_NLEN];
2740 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2741 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2742 disturb(FALSE, TRUE);
2746 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2748 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2749 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2751 GAME_TEXT o_name[MAX_NLEN];
2753 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2754 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2755 disturb(FALSE, TRUE);
2758 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2760 if (!p_ptr->resist_fear)
2762 disturb(FALSE, TRUE);
2763 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2764 set_afraid(p_ptr->afraid + 13 + randint1(26));
2767 /* Teleport player */
2768 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2770 disturb(FALSE, TRUE);
2772 /* Teleport player */
2773 teleport_player(40, TELEPORT_PASSIVE);
2775 /* Handle HP draining */
2776 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2778 GAME_TEXT o_name[MAX_NLEN];
2780 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2781 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2782 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2784 /* Handle mana draining */
2785 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2787 GAME_TEXT o_name[MAX_NLEN];
2789 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2790 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2791 p_ptr->csp -= MIN(p_ptr->lev, 50);
2795 p_ptr->csp_frac = 0;
2797 p_ptr->redraw |= PR_MANA;
2801 /* Rarely, take damage from the Jewel of Judgement */
2802 if (one_in_(999) && !p_ptr->anti_magic)
2804 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2806 if (o_ptr->name1 == ART_JUDGE)
2808 if (object_is_known(o_ptr))
2809 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2811 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2812 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2819 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2820 * / Handle recharging objects once every 10 game turns
2823 static void process_world_aux_recharge(void)
2828 /* Process equipment */
2829 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2831 /* Get the object */
2832 object_type *o_ptr = &p_ptr->inventory_list[i];
2833 if (!o_ptr->k_idx) continue;
2835 /* Recharge activatable objects */
2836 if (o_ptr->timeout > 0)
2841 /* Notice changes */
2842 if (!o_ptr->timeout)
2844 recharged_notice(o_ptr);
2850 /* Notice changes */
2853 p_ptr->window |= (PW_EQUIP);
2858 * Recharge rods. Rods now use timeout to control charging status,
2859 * and each charging rod in a stack decreases the stack's timeout by
2860 * one per current_world_ptr->game_turn. -LM-
2862 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2864 object_type *o_ptr = &p_ptr->inventory_list[i];
2865 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2866 if (!o_ptr->k_idx) continue;
2868 /* Examine all charging rods or stacks of charging rods. */
2869 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2871 /* Determine how many rods are charging. */
2872 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2873 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2875 /* Decrease timeout by that number. */
2876 o_ptr->timeout -= temp;
2878 /* Boundary control. */
2879 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2881 /* Notice changes, provide message if object is inscribed. */
2882 if (!(o_ptr->timeout))
2884 recharged_notice(o_ptr);
2888 /* One of the stack of rod is charged */
2889 else if (o_ptr->timeout % k_ptr->pval)
2896 /* Notice changes */
2899 p_ptr->window |= (PW_INVEN);
2903 /* Process objects on floor */
2904 for (i = 1; i < current_floor_ptr->o_max; i++)
2906 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2908 /* Skip dead objects */
2909 if (!o_ptr->k_idx) continue;
2911 /* Recharge rods on the ground. No messages. */
2912 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2915 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2917 /* Boundary control. */
2918 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2925 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2926 * / Handle involuntary movement once every 10 game turns
2929 static void process_world_aux_movement(void)
2931 /* Delayed Word-of-Recall */
2932 if (p_ptr->word_recall)
2935 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2936 * The player is yanked up/down as soon as
2937 * he loads the autosaved game.
2939 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2940 do_cmd_save_game(TRUE);
2942 /* Count down towards recall */
2943 p_ptr->word_recall--;
2945 p_ptr->redraw |= (PR_STATUS);
2947 /* Activate the recall */
2948 if (!p_ptr->word_recall)
2951 disturb(FALSE, TRUE);
2953 /* Determine the level */
2954 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2956 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2958 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2960 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2962 current_floor_ptr->dun_level = 0;
2963 p_ptr->dungeon_idx = 0;
2965 leave_quest_check();
2966 leave_tower_check();
2968 p_ptr->inside_quest = 0;
2970 p_ptr->leaving = TRUE;
2974 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2976 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2979 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2982 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2983 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2985 /* Nightmare mode makes recall more dangerous */
2986 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2988 if (current_floor_ptr->dun_level < 50)
2990 current_floor_ptr->dun_level *= 2;
2992 else if (current_floor_ptr->dun_level < 99)
2994 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2996 else if (current_floor_ptr->dun_level > 100)
2998 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
3002 if (p_ptr->wild_mode)
3004 p_ptr->wilderness_y = p_ptr->y;
3005 p_ptr->wilderness_x = p_ptr->x;
3009 /* Save player position */
3010 p_ptr->oldpx = p_ptr->x;
3011 p_ptr->oldpy = p_ptr->y;
3013 p_ptr->wild_mode = FALSE;
3016 * Clear all saved floors
3017 * and create a first saved floor
3019 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3020 p_ptr->leaving = TRUE;
3022 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
3026 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3028 quest_type* const q_ptr = &quest[i];
3031 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3032 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3033 (q_ptr->level < current_floor_ptr->dun_level))
3035 q_ptr->status = QUEST_STATUS_FAILED;
3036 q_ptr->complev = (byte)p_ptr->lev;
3038 q_ptr->comptime = current_world_ptr->play_time;
3039 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3045 sound(SOUND_TPLEVEL);
3050 /* Delayed Alter reality */
3051 if (p_ptr->alter_reality)
3053 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3054 do_cmd_save_game(TRUE);
3056 /* Count down towards alter */
3057 p_ptr->alter_reality--;
3059 p_ptr->redraw |= (PR_STATUS);
3061 /* Activate the alter reality */
3062 if (!p_ptr->alter_reality)
3065 disturb(FALSE, TRUE);
3067 /* Determine the level */
3068 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3070 msg_print(_("世界が変わった!", "The world changes!"));
3073 * Clear all saved floors
3074 * and create a first saved floor
3076 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3077 p_ptr->leaving = TRUE;
3081 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3084 sound(SOUND_TPLEVEL);
3090 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3091 * / Handle certain things once every 10 game turns
3094 static void process_world(void)
3098 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3099 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3100 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3102 extract_day_hour_min(&day, &hour, &min);
3104 /* Update dungeon feeling, and announce it if changed */
3105 update_dungeon_feeling();
3107 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3108 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3110 current_floor_ptr->dun_level = 0;
3111 p_ptr->dungeon_idx = 0;
3112 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3113 p_ptr->inside_arena = FALSE;
3114 p_ptr->wild_mode = FALSE;
3115 p_ptr->leaving = TRUE;
3118 /*** Check monster arena ***/
3119 if (p_ptr->inside_battle && !p_ptr->leaving)
3125 /* Count all hostile monsters */
3126 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3127 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3129 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3131 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3134 win_m_idx = g_ptr->m_idx;
3138 if (number_mon == 0)
3140 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3142 p_ptr->energy_need = 0;
3143 update_gambling_monsters();
3145 else if ((number_mon-1) == 0)
3147 GAME_TEXT m_name[MAX_NLEN];
3148 monster_type *wm_ptr;
3150 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3152 monster_desc(m_name, wm_ptr, 0);
3153 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3156 if (win_m_idx == (sel_monster+1))
3158 msg_print(_("おめでとうございます。", "Congratulations."));
3159 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3160 p_ptr->au += battle_odds;
3164 msg_print(_("残念でした。", "You lost gold."));
3167 p_ptr->energy_need = 0;
3168 update_gambling_monsters();
3170 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3172 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3173 p_ptr->au += kakekin;
3175 p_ptr->energy_need = 0;
3176 update_gambling_monsters();
3180 /* Every 10 game turns */
3181 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3183 /*** Attempt timed autosave ***/
3184 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3186 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3187 do_cmd_save_game(TRUE);
3190 if (current_floor_ptr->monster_noise && !ignore_unview)
3192 msg_print(_("何かが聞こえた。", "You hear noise."));
3195 /*** Handle the wilderness/town (sunshine) ***/
3197 /* While in town/wilderness */
3198 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3200 /* Hack -- Daybreak/Nighfall in town */
3201 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3205 /* Check for dawn */
3206 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3208 if (dawn) day_break();
3214 /* While in the dungeon (vanilla_town or lite_town mode only) */
3215 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3217 /*** Shuffle the Storekeepers ***/
3219 /* Chance is only once a day (while in dungeon) */
3220 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3222 /* Sometimes, shuffle the shop-keepers */
3223 if (one_in_(STORE_SHUFFLE))
3228 /* Pick a random shop (except home and museum) */
3231 n = randint0(MAX_STORES);
3233 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3235 /* Check every feature */
3236 for (i = 1; i < max_f_idx; i++)
3238 feature_type *f_ptr = &f_info[i];
3240 /* Skip empty index */
3241 if (!f_ptr->name) continue;
3243 /* Skip non-store features */
3244 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3246 /* Verify store type */
3247 if (f_ptr->subtype == n)
3249 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3262 /*** Process the monsters ***/
3264 /* Check for creature generation. */
3265 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3266 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3268 /* Make a new monster */
3269 (void)alloc_monster(MAX_SIGHT + 5, 0);
3272 /* Hack -- Check for creature regeneration */
3273 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3274 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3276 if (!p_ptr->leaving)
3280 /* Hack -- Process the counters of monsters if needed */
3281 for (i = 0; i < MAX_MTIMED; i++)
3283 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3291 if (min != prev_min)
3293 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3294 determine_today_mon(FALSE);
3299 * Nightmare mode activates the TY_CURSE at midnight
3300 * Require exact minute -- Don't activate multiple times in a minute
3303 if (ironman_nightmare && (min != prev_min))
3306 /* Every 15 minutes after 11:00 pm */
3307 if ((hour == 23) && !(min % 15))
3309 disturb(FALSE, TRUE);
3314 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3318 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3322 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3326 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3331 /* TY_CURSE activates at midnight! */
3335 disturb(TRUE, TRUE);
3336 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3338 if (p_ptr->wild_mode)
3340 /* Go into large wilderness view */
3341 p_ptr->oldpy = randint1(MAX_HGT - 2);
3342 p_ptr->oldpx = randint1(MAX_WID - 2);
3343 change_wild_mode(TRUE);
3345 /* Give first move to monsters */
3346 take_turn(p_ptr, 100);
3350 p_ptr->invoking_midnight_curse = TRUE;
3356 /* Check the Food */
3357 process_world_aux_digestion();
3359 /* Process timed damage and regeneration */
3360 process_world_aux_hp_and_sp();
3362 /* Process timeout */
3363 process_world_aux_timeout();
3366 process_world_aux_light();
3368 /* Process mutation effects */
3369 process_world_aux_mutation();
3371 /* Process curse effects */
3372 process_world_aux_curse();
3374 /* Process recharging */
3375 process_world_aux_recharge();
3377 /* Feel the p_ptr->inventory_list */
3381 /* Involuntary Movement */
3382 process_world_aux_movement();
3386 * @brief ウィザードモードへの導入処理
3387 * / Verify use of "wizard" mode
3388 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3390 static bool enter_wizard_mode(void)
3392 /* Ask first time */
3393 if (!p_ptr->noscore)
3395 /* Wizard mode is not permitted */
3396 if (!allow_debug_opts || arg_wizard)
3398 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3402 /* Mention effects */
3403 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3404 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3407 /* Verify request */
3408 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3413 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3415 p_ptr->noscore |= 0x0002;
3426 * @brief デバッグコマンドへの導入処理
3427 * / Verify use of "debug" commands
3428 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3430 static bool enter_debug_mode(void)
3432 /* Ask first time */
3433 if (!p_ptr->noscore)
3435 /* Debug mode is not permitted */
3436 if (!allow_debug_opts)
3438 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3442 /* Mention effects */
3443 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3444 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3448 /* Verify request */
3449 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3454 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3456 p_ptr->noscore |= 0x0008;
3464 * Hack -- Declare the Debug Routines
3466 extern void do_cmd_debug(void);
3468 #endif /* ALLOW_WIZARD */
3474 * @brief ボーグコマンドへの導入処理
3475 * / Verify use of "borg" commands
3476 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3478 static bool enter_borg_mode(void)
3480 /* Ask first time */
3481 if (!(p_ptr->noscore & 0x0010))
3483 /* Mention effects */
3484 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3485 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3489 /* Verify request */
3490 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3495 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3497 p_ptr->noscore |= 0x0010;
3505 * Hack -- Declare the Ben Borg
3507 extern void do_cmd_borg(void);
3509 #endif /* ALLOW_BORG */
3513 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3514 * / Parse and execute the current command Give "Warning" on illegal commands.
3515 * @todo Make some "blocks"
3518 static void process_command(void)
3520 COMMAND_CODE old_now_message = now_message;
3522 /* Handle repeating the last command */
3528 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3529 p_ptr->reset_concent = TRUE;
3531 /* Parse the command */
3532 switch (command_cmd)
3548 /*** Wizard Commands ***/
3550 /* Toggle Wizard Mode */
3555 p_ptr->wizard = FALSE;
3556 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3558 else if (enter_wizard_mode())
3560 p_ptr->wizard = TRUE;
3561 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3563 p_ptr->update |= (PU_MONSTERS);
3565 /* Redraw "title" */
3566 p_ptr->redraw |= (PR_TITLE);
3574 /* Special "debug" commands */
3577 /* Enter debug mode */
3578 if (enter_debug_mode())
3585 #endif /* ALLOW_WIZARD */
3590 /* Special "borg" commands */
3593 /* Enter borg mode */
3594 if (enter_borg_mode())
3596 if (!p_ptr->wild_mode) do_cmd_borg();
3602 #endif /* ALLOW_BORG */
3606 /*** Inventory Commands ***/
3608 /* Wear/wield equipment */
3611 if (!p_ptr->wild_mode) do_cmd_wield();
3615 /* Take off equipment */
3618 if (!p_ptr->wild_mode) do_cmd_takeoff();
3625 if (!p_ptr->wild_mode) do_cmd_drop();
3629 /* Destroy an item */
3636 /* Equipment list */
3643 /* Inventory list */
3651 /*** Various commands ***/
3653 /* Identify an object */
3660 /* Hack -- toggle windows */
3663 toggle_inven_equip();
3668 /*** Standard "Movement" Commands ***/
3673 if (!p_ptr->wild_mode) do_cmd_alter();
3680 if (!p_ptr->wild_mode) do_cmd_tunnel();
3684 /* Move (usually pick up things) */
3691 /* Move (usually do not pick up) */
3699 /*** Running, Resting, Searching, Staying */
3701 /* Begin Running -- Arg is Max Distance */
3704 if (!p_ptr->wild_mode) do_cmd_run();
3708 /* Stay still (usually pick things up) */
3711 do_cmd_stay(always_pickup);
3715 /* Stay still (usually do not pick up) */
3718 do_cmd_stay(!always_pickup);
3722 /* Rest -- Arg is time */
3729 /* Search for traps/doors */
3736 /* Toggle search mode */
3739 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3740 else set_action(ACTION_SEARCH);
3745 /*** Stairs and Doors and Chests and Traps ***/
3748 case SPECIAL_KEY_STORE:
3754 /* Enter building -KMW- */
3755 case SPECIAL_KEY_BUILDING:
3761 /* Enter quest level -KMW- */
3762 case SPECIAL_KEY_QUEST:
3768 /* Go up staircase */
3771 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3773 if (vanilla_town) break;
3775 if (p_ptr->ambush_flag)
3777 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3781 if (p_ptr->food < PY_FOOD_WEAK)
3783 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3787 change_wild_mode(FALSE);
3794 /* Go down staircase */
3797 if (p_ptr->wild_mode)
3798 change_wild_mode(FALSE);
3804 /* Open a door or chest */
3818 /* Jam a door with spikes */
3832 /* Disarm a trap or chest */
3840 /*** Magic and Prayers ***/
3842 /* Gain new spells/prayers */
3845 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3846 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3847 else if (p_ptr->pclass == CLASS_SAMURAI)
3848 do_cmd_gain_hissatsu();
3849 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3850 import_magic_device();
3859 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3860 (p_ptr->pclass == CLASS_BERSERKER) ||
3861 (p_ptr->pclass == CLASS_NINJA) ||
3862 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3863 ) do_cmd_mind_browse();
3864 else if (p_ptr->pclass == CLASS_SMITH)
3866 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3867 do_cmd_magic_eater(TRUE, FALSE);
3868 else if (p_ptr->pclass == CLASS_SNIPER)
3869 do_cmd_snipe_browse();
3870 else do_cmd_browse();
3878 if (!p_ptr->wild_mode)
3880 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3882 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3884 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))
3886 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3889 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3891 concptr which_power = _("魔法", "magic");
3892 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3893 which_power = _("超能力", "psionic powers");
3894 else if (p_ptr->pclass == CLASS_IMITATOR)
3895 which_power = _("ものまね", "imitation");
3896 else if (p_ptr->pclass == CLASS_SAMURAI)
3897 which_power = _("必殺剣", "hissatsu");
3898 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3899 which_power = _("鏡魔法", "mirror magic");
3900 else if (p_ptr->pclass == CLASS_NINJA)
3901 which_power = _("忍術", "ninjutsu");
3902 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3903 which_power = _("祈り", "prayer");
3905 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3908 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3910 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3915 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3916 (p_ptr->pclass == CLASS_BERSERKER) ||
3917 (p_ptr->pclass == CLASS_NINJA) ||
3918 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3921 else if (p_ptr->pclass == CLASS_IMITATOR)
3923 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3924 do_cmd_magic_eater(FALSE, FALSE);
3925 else if (p_ptr->pclass == CLASS_SAMURAI)
3927 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3928 do_cmd_cast_learned();
3929 else if (p_ptr->pclass == CLASS_SMITH)
3931 else if (p_ptr->pclass == CLASS_SNIPER)
3940 /* Issue a pet command */
3947 /*** Use various objects ***/
3949 /* Inscribe an object */
3956 /* Uninscribe an object */
3959 do_cmd_uninscribe();
3963 /* Activate an artifact */
3977 /* Fuel your lantern/torch */
3987 do_cmd_fire(SP_NONE);
3994 do_cmd_throw(1, FALSE, -1);
4008 if (use_command && rogue_like_commands)
4019 /* Quaff a potion */
4022 do_cmd_quaff_potion();
4029 do_cmd_read_scroll();
4036 if (use_command && !rogue_like_commands)
4043 /* Use racial power */
4046 do_cmd_racial_power();
4051 /*** Looking at Things (nearby or on map) ***/
4053 /* Full dungeon map */
4060 /* Locate player on map */
4074 /* Target monster or location */
4083 /*** Help and Such ***/
4092 /* Identify symbol */
4095 do_cmd_query_symbol();
4099 /* Character description */
4102 do_cmd_change_name();
4107 /*** System Commands ***/
4109 /* Hack -- User interface */
4116 /* Single line from a pref file */
4125 do_cmd_reload_autopick();
4131 do_cmd_edit_autopick();
4135 /* Interact with macros */
4142 /* Interact with visuals */
4150 /* Interact with colors */
4158 /* Interact with options */
4162 (void)combine_and_reorder_home(STORE_HOME);
4167 /*** Misc Commands ***/
4183 /* Repeat level feeling */
4190 /* Show previous message */
4193 do_cmd_message_one();
4197 /* Show previous messages */
4200 do_cmd_messages(old_now_message);
4204 /* Show quest status -KMW- */
4207 do_cmd_checkquest();
4211 /* Redraw the screen */
4214 now_message = old_now_message;
4219 #ifndef VERIFY_SAVEFILE
4221 /* Hack -- Save and don't quit */
4224 do_cmd_save_game(FALSE);
4228 #endif /* VERIFY_SAVEFILE */
4238 case SPECIAL_KEY_QUIT:
4240 do_cmd_save_and_exit();
4244 /* Quit (commit suicide) */
4257 /* Check artifacts, uniques, objects */
4264 /* Load "screen dump" */
4267 do_cmd_load_screen();
4271 /* Save "screen dump" */
4274 do_cmd_save_screen();
4278 /* Record/stop "Movie" */
4281 prepare_movie_hooks();
4285 /* Make random artifact list */
4288 spoil_random_artifact("randifact.txt");
4295 if (!p_ptr->wild_mode) do_cmd_travel();
4296 if (p_ptr->special_defense & KATA_MUSOU)
4298 set_action(ACTION_NONE);
4304 /* Hack -- Unknown command */
4307 if (flush_failure) flush();
4311 sound(SOUND_ILLEGAL);
4312 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4317 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4323 if (!p_ptr->energy_use && !now_message)
4324 now_message = old_now_message;
4328 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4331 static void pack_overflow(void)
4333 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
4335 GAME_TEXT o_name[MAX_NLEN];
4338 /* Is auto-destroy done? */
4339 update_creature(p_ptr);
4340 if (!p_ptr->inventory_list[INVEN_PACK].k_idx) return;
4342 /* Access the slot to be dropped */
4343 o_ptr = &p_ptr->inventory_list[INVEN_PACK];
4345 disturb(FALSE, TRUE);
4348 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4349 object_desc(o_name, o_ptr, 0);
4351 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4353 /* Drop it (carefully) near the player */
4354 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4356 /* Modify, Describe, Optimize */
4357 inven_item_increase(INVEN_PACK, -255);
4358 inven_item_describe(INVEN_PACK);
4359 inven_item_optimize(INVEN_PACK);
4366 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4369 static void process_upkeep_with_speed(void)
4371 /* Give the player some energy */
4372 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4374 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4377 /* No current_world_ptr->game_turn yet */
4378 if (p_ptr->enchant_energy_need > 0) return;
4380 while (p_ptr->enchant_energy_need <= 0)
4382 /* Handle the player song */
4383 if (!load) check_music();
4385 /* Hex - Handle the hex spells */
4386 if (!load) check_hex();
4387 if (!load) revenge_spell();
4389 /* There is some randomness of needed energy */
4390 p_ptr->enchant_energy_need += ENERGY_NEED();
4394 static void process_fishing(void)
4396 Term_xtra(TERM_XTRA_DELAY, 10);
4400 bool success = FALSE;
4401 get_mon_num_prep(monster_is_fishing_target, NULL);
4402 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);
4404 if (r_idx && one_in_(2))
4407 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4408 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4409 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4411 GAME_TEXT m_name[MAX_NLEN];
4412 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4413 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4419 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4421 disturb(FALSE, TRUE);
4426 * @brief プレイヤーの行動処理 / Process the player
4429 * Notice the annoying code to handle "pack overflow", which\n
4430 * must come first just in case somebody manages to corrupt\n
4431 * the savefiles by clever use of menu commands or something.\n
4433 static void process_player(void)
4437 /*** Apply energy ***/
4439 if (p_ptr->hack_mutation)
4441 msg_print(_("何か変わった気がする!", "You feel different!"));
4443 (void)gain_mutation(p_ptr, 0);
4444 p_ptr->hack_mutation = FALSE;
4447 if (p_ptr->invoking_midnight_curse)
4450 activate_ty_curse(FALSE, &count);
4451 p_ptr->invoking_midnight_curse = FALSE;
4454 if (p_ptr->inside_battle)
4456 for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4458 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4460 if (!monster_is_valid(m_ptr)) continue;
4462 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4463 update_monster(m_idx, FALSE);
4468 /* Give the player some energy */
4469 else if (!(load && p_ptr->energy_need <= 0))
4471 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4474 /* No current_world_ptr->game_turn yet */
4475 if (p_ptr->energy_need > 0) return;
4476 if (!command_rep) prt_time();
4478 /*** Check for interupts ***/
4480 /* Complete resting */
4481 if (p_ptr->resting < 0)
4484 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4487 if ((p_ptr->chp == p_ptr->mhp) &&
4488 (p_ptr->csp >= p_ptr->msp))
4490 set_action(ACTION_NONE);
4494 /* Complete resting */
4495 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4498 if ((p_ptr->chp == p_ptr->mhp) &&
4499 (p_ptr->csp >= p_ptr->msp) &&
4500 !p_ptr->blind && !p_ptr->confused &&
4501 !p_ptr->poisoned && !p_ptr->afraid &&
4502 !p_ptr->stun && !p_ptr->cut &&
4503 !p_ptr->slow && !p_ptr->paralyzed &&
4504 !p_ptr->image && !p_ptr->word_recall &&
4505 !p_ptr->alter_reality)
4507 set_action(ACTION_NONE);
4512 if (p_ptr->action == ACTION_FISH) process_fishing();
4514 /* Handle "abort" */
4517 /* Check for "player abort" (semi-efficiently for resting) */
4518 if (p_ptr->running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4523 /* Check for a key */
4526 flush(); /* Flush input */
4528 disturb(FALSE, TRUE);
4530 /* Hack -- Show a Message */
4531 msg_print(_("中断しました。", "Canceled."));
4536 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4538 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4539 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4541 if (MON_CSLEEP(m_ptr))
4543 GAME_TEXT m_name[MAX_NLEN];
4546 (void)set_monster_csleep(p_ptr->riding, 0);
4547 monster_desc(m_name, m_ptr, 0);
4548 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4551 if (MON_STUNNED(m_ptr))
4553 /* Hack -- Recover from stun */
4554 if (set_monster_stunned(p_ptr->riding,
4555 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4557 GAME_TEXT m_name[MAX_NLEN];
4558 monster_desc(m_name, m_ptr, 0);
4559 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4563 if (MON_CONFUSED(m_ptr))
4565 /* Hack -- Recover from confusion */
4566 if (set_monster_confused(p_ptr->riding,
4567 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4569 GAME_TEXT m_name[MAX_NLEN];
4570 monster_desc(m_name, m_ptr, 0);
4571 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4575 if (MON_MONFEAR(m_ptr))
4577 /* Hack -- Recover from fear */
4578 if(set_monster_monfear(p_ptr->riding,
4579 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4581 GAME_TEXT m_name[MAX_NLEN];
4582 monster_desc(m_name, m_ptr, 0);
4583 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4593 if (p_ptr->lightspeed)
4595 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4597 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4599 if(P_PTR_KI < 40) P_PTR_KI = 0;
4600 else P_PTR_KI -= 40;
4601 p_ptr->update |= (PU_BONUS);
4603 if (p_ptr->action == ACTION_LEARN)
4606 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4608 /* Convert the unit (1/2^16) to (1/2^32) */
4609 s64b_LSHIFT(cost, cost_frac, 16);
4611 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4615 p_ptr->csp_frac = 0;
4616 set_action(ACTION_NONE);
4621 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4623 p_ptr->redraw |= PR_MANA;
4626 if (p_ptr->special_defense & KATA_MASK)
4628 if (p_ptr->special_defense & KATA_MUSOU)
4632 set_action(ACTION_NONE);
4637 p_ptr->redraw |= (PR_MANA);
4642 /*** Handle actual user input ***/
4644 /* Repeat until out of energy */
4645 while (p_ptr->energy_need <= 0)
4647 p_ptr->window |= PW_PLAYER;
4648 p_ptr->sutemi = FALSE;
4649 p_ptr->counter = FALSE;
4650 p_ptr->now_damaged = FALSE;
4654 /* Place the cursor on the player */
4655 move_cursor_relative(p_ptr->y, p_ptr->x);
4657 /* Refresh (optional) */
4658 if (fresh_before) Term_fresh();
4660 /* Hack -- Pack Overflow */
4663 /* Hack -- cancel "lurking browse mode" */
4664 if (!command_new) command_see = FALSE;
4666 /* Assume free current_world_ptr->game_turn */
4669 if (p_ptr->inside_battle)
4671 /* Place the cursor on the player */
4672 move_cursor_relative(p_ptr->y, p_ptr->x);
4674 command_cmd = SPECIAL_KEY_BUILDING;
4676 /* Process the command */
4680 /* Paralyzed or Knocked Out */
4681 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4683 take_turn(p_ptr, 100);
4687 else if (p_ptr->action == ACTION_REST)
4690 if (p_ptr->resting > 0)
4692 /* Reduce rest count */
4695 if (!p_ptr->resting) set_action(ACTION_NONE);
4696 p_ptr->redraw |= (PR_STATE);
4699 take_turn(p_ptr, 100);
4703 else if (p_ptr->action == ACTION_FISH)
4705 take_turn(p_ptr, 100);
4709 else if (p_ptr->running)
4717 else if (travel.run)
4724 /* Repeated command */
4725 else if (command_rep)
4727 /* Count this execution */
4730 p_ptr->redraw |= (PR_STATE);
4733 /* Hack -- Assume messages were seen */
4736 /* Clear the top line */
4739 /* Process the command */
4743 /* Normal command */
4746 /* Place the cursor on the player */
4747 move_cursor_relative(p_ptr->y, p_ptr->x);
4750 /* Get a command (normal) */
4751 request_command(FALSE);
4754 /* Process the command */
4758 /* Hack -- Pack Overflow */
4764 if (p_ptr->energy_use)
4766 /* Use some energy */
4767 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4769 /* The Randomness is irrelevant */
4770 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4774 /* There is some randomness of needed energy */
4775 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4778 /* Hack -- constant hallucination */
4779 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4781 /* Shimmer multi-hued monsters */
4782 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4784 monster_type *m_ptr;
4785 monster_race *r_ptr;
4787 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4788 if (!monster_is_valid(m_ptr)) continue;
4790 /* Skip unseen monsters */
4791 if (!m_ptr->ml) continue;
4793 /* Access the monster race */
4794 r_ptr = &r_info[m_ptr->ap_r_idx];
4796 /* Skip non-multi-hued monsters */
4797 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4800 /* Redraw regardless */
4801 lite_spot(m_ptr->fy, m_ptr->fx);
4805 /* Handle monster detection */
4806 if (repair_monsters)
4808 /* Reset the flag */
4809 repair_monsters = FALSE;
4811 /* Rotate detection flags */
4812 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4814 monster_type *m_ptr;
4815 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4816 if (!monster_is_valid(m_ptr)) continue;
4818 /* Nice monsters get mean */
4819 if (m_ptr->mflag & MFLAG_NICE)
4821 /* Nice monsters get mean */
4822 m_ptr->mflag &= ~(MFLAG_NICE);
4825 /* Handle memorized monsters */
4826 if (m_ptr->mflag2 & MFLAG2_MARK)
4828 /* Maintain detection */
4829 if (m_ptr->mflag2 & MFLAG2_SHOW)
4832 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4834 /* Still need repairs */
4835 repair_monsters = TRUE;
4838 /* Remove detection */
4842 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4844 /* Assume invisible */
4846 update_monster(m_idx, FALSE);
4848 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4849 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4851 /* Redraw regardless */
4852 lite_spot(m_ptr->fy, m_ptr->fx);
4857 if (p_ptr->pclass == CLASS_IMITATOR)
4860 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4863 for (j = 0; j < p_ptr->mane_num; j++)
4865 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4866 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4869 p_ptr->new_mane = FALSE;
4870 p_ptr->redraw |= (PR_IMITATION);
4872 if (p_ptr->action == ACTION_LEARN)
4874 p_ptr->new_mane = FALSE;
4875 p_ptr->redraw |= (PR_STATE);
4878 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4881 p_ptr->redraw |= (PR_MAP);
4882 p_ptr->update |= (PU_MONSTERS);
4883 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4885 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4887 p_ptr->timewalk = FALSE;
4888 p_ptr->energy_need = ENERGY_NEED();
4894 /* Hack -- notice death */
4895 if (!p_ptr->playing || p_ptr->is_dead)
4897 p_ptr->timewalk = FALSE;
4902 if (p_ptr->energy_use && p_ptr->reset_concent) reset_concentration(TRUE);
4904 /* Handle "leaving" */
4905 if (p_ptr->leaving) break;
4908 /* Update scent trail */
4913 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4917 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4918 * ゲームを終了するかのいずれかまでループする。
4921 * This function will not exit until the level is completed,\n
4922 * the user dies, or the game is terminated.\n
4925 static void dungeon(bool load_game)
4929 /* Set the base level */
4930 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4932 /* Reset various flags */
4933 current_world_ptr->is_loading_now = FALSE;
4936 p_ptr->leaving = FALSE;
4938 /* Reset the "command" vars */
4941 #if 0 /* Don't reset here --- It's used for Arena */
4950 /* Cancel the target */
4952 p_ptr->pet_t_m_idx = 0;
4953 p_ptr->riding_t_m_idx = 0;
4954 p_ptr->ambush_flag = FALSE;
4956 /* Cancel the health bar */
4959 /* Check visual effects */
4960 repair_monsters = TRUE;
4961 repair_objects = TRUE;
4964 disturb(TRUE, TRUE);
4966 /* Get index of current quest (if any) */
4967 quest_num = quest_number(current_floor_ptr->dun_level);
4969 /* Inside a quest? */
4972 /* Mark the quest monster */
4973 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4976 /* Track maximum player level */
4977 if (p_ptr->max_plv < p_ptr->lev)
4979 p_ptr->max_plv = p_ptr->lev;
4983 /* Track maximum dungeon level (if not in quest -KMW-) */
4984 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4986 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4987 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4990 (void)calculate_upkeep();
4992 /* Validate the panel */
4993 panel_bounds_center();
4995 /* Verify the panel */
5001 /* Enter "xtra" mode */
5002 current_world_ptr->character_xtra = TRUE;
5004 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5005 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5006 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);
5010 /* Leave "xtra" mode */
5011 current_world_ptr->character_xtra = FALSE;
5013 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5014 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5018 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5019 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5020 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5022 if (p_ptr->inside_battle)
5026 p_ptr->energy_need = 0;
5027 update_gambling_monsters();
5031 msg_print(_("試合開始!", "Ready..Fight!"));
5036 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5037 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5039 /* Hack -- notice death or departure */
5040 if (!p_ptr->playing || p_ptr->is_dead) return;
5042 /* Print quest message if appropriate */
5043 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5045 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5046 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5048 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5050 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5052 msg_format("この階には%sの主である%sが棲んでいる。",
5053 d_name+d_info[p_ptr->dungeon_idx].name,
5054 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5056 msg_format("%^s lives in this level as the keeper of %s.",
5057 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5058 d_name+d_info[p_ptr->dungeon_idx].name);
5062 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5064 /*** Process this dungeon level ***/
5066 /* Reset the monster generation level */
5067 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5069 /* Reset the object generation level */
5070 current_floor_ptr->object_level = current_floor_ptr->base_level;
5072 current_world_ptr->is_loading_now = TRUE;
5074 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5075 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5076 p_ptr->energy_need = 0;
5078 /* Not leaving dungeon */
5079 p_ptr->leaving_dungeon = FALSE;
5081 /* Initialize monster process */
5087 /* Hack -- Compact the monster list occasionally */
5088 if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5090 /* Hack -- Compress the monster list occasionally */
5091 if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0);
5094 /* Hack -- Compact the object list occasionally */
5095 if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5097 /* Hack -- Compress the object list occasionally */
5098 if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0);
5100 /* Process the player */
5102 process_upkeep_with_speed();
5106 /* Hack -- Hilite the player */
5107 move_cursor_relative(p_ptr->y, p_ptr->x);
5109 /* Optional fresh */
5110 if (fresh_after) Term_fresh();
5112 /* Hack -- Notice death or departure */
5113 if (!p_ptr->playing || p_ptr->is_dead) break;
5115 /* Process all of the monsters */
5120 /* Hack -- Hilite the player */
5121 move_cursor_relative(p_ptr->y, p_ptr->x);
5123 /* Optional fresh */
5124 if (fresh_after) Term_fresh();
5126 /* Hack -- Notice death or departure */
5127 if (!p_ptr->playing || p_ptr->is_dead) break;
5129 /* Process the world */
5134 /* Hack -- Hilite the player */
5135 move_cursor_relative(p_ptr->y, p_ptr->x);
5137 /* Optional fresh */
5138 if (fresh_after) Term_fresh();
5140 /* Hack -- Notice death or departure */
5141 if (!p_ptr->playing || p_ptr->is_dead) break;
5143 /* Count game turns */
5144 current_world_ptr->game_turn++;
5146 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5148 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5149 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5152 prevent_turn_overflow();
5154 /* Handle "leaving" */
5155 if (p_ptr->leaving) break;
5157 if (wild_regen) wild_regen--;
5160 /* Inside a quest and non-unique questor? */
5161 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5163 /* Un-mark the quest monster */
5164 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5167 /* Not save-and-quit and not dead? */
5168 if (p_ptr->playing && !p_ptr->is_dead)
5171 * Maintain Unique monsters and artifact, save current
5172 * floor, then prepare next floor
5176 /* Forget the flag */
5177 reinit_wilderness = FALSE;
5180 /* Write about current level on the play record once per level */
5186 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5189 * Modified by Arcum Dagsson to support
5190 * separate macro files for different realms.
5192 static void load_all_pref_files(void)
5196 /* Access the "user" pref file */
5197 sprintf(buf, "user.prf");
5199 /* Process that file */
5200 process_pref_file(buf);
5202 /* Access the "user" system pref file */
5203 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5205 /* Process that file */
5206 process_pref_file(buf);
5208 /* Access the "race" pref file */
5209 sprintf(buf, "%s.prf", rp_ptr->title);
5211 /* Process that file */
5212 process_pref_file(buf);
5214 /* Access the "class" pref file */
5215 sprintf(buf, "%s.prf", cp_ptr->title);
5217 /* Process that file */
5218 process_pref_file(buf);
5220 /* Access the "character" pref file */
5221 sprintf(buf, "%s.prf", p_ptr->base_name);
5223 /* Process that file */
5224 process_pref_file(buf);
5226 /* Access the "realm 1" pref file */
5227 if (p_ptr->realm1 != REALM_NONE)
5229 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5231 /* Process that file */
5232 process_pref_file(buf);
5235 /* Access the "realm 2" pref file */
5236 if (p_ptr->realm2 != REALM_NONE)
5238 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5240 /* Process that file */
5241 process_pref_file(buf);
5245 /* Load an autopick preference file */
5246 autopick_load_pref(FALSE);
5250 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5253 * If the "new_game" parameter is true, then, after loading the
5254 * savefile, we will commit suicide, if necessary, to allow the
5255 * player to start a new game.
5257 void play_game(bool new_game)
5260 bool load_game = TRUE;
5261 bool init_random_seed = FALSE;
5271 else if (chuukei_server)
5273 prepare_chuukei_hooks();
5284 p_ptr->hack_mutation = FALSE;
5286 /* Hack -- Character is "icky" */
5287 current_world_ptr->character_icky = TRUE;
5289 /* Make sure main term is active */
5290 Term_activate(angband_term[0]);
5292 /* Initialise the resize hooks */
5293 angband_term[0]->resize_hook = resize_map;
5295 for (i = 1; i < 8; i++)
5297 /* Does the term exist? */
5298 if (angband_term[i])
5300 /* Add the redraw on resize hook */
5301 angband_term[i]->resize_hook = redraw_window;
5305 /* Hack -- current_world_ptr->game_turn off the cursor */
5306 (void)Term_set_cursor(0);
5309 /* Attempt to load */
5312 quit(_("セーブファイルが壊れています", "broken savefile"));
5315 /* Extract the options */
5316 extract_option_vars();
5318 /* Report waited score */
5319 if (p_ptr->wait_report_score)
5324 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5327 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5328 update_creature(p_ptr);
5330 p_ptr->is_dead = TRUE;
5332 current_world_ptr->start_time = (u32b)time(NULL);
5334 /* No suspending now */
5335 signals_ignore_tstp();
5337 /* Hack -- Character is now "icky" */
5338 current_world_ptr->character_icky = TRUE;
5340 /* Build the filename */
5341 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5343 /* Open the high score file, for reading/writing */
5344 highscore_fd = fd_open(buf, O_RDWR);
5346 /* 町名消失バグ対策(#38205) Init the wilderness */
5347 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5349 /* Handle score, show Top scores */
5350 success = send_world_score(TRUE);
5352 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5354 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5359 p_ptr->wait_report_score = FALSE;
5361 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5363 /* Shut the high score file */
5364 (void)fd_close(highscore_fd);
5366 /* Forget the high score fd */
5369 /* Allow suspending now */
5370 signals_handle_tstp();
5375 current_world_ptr->creating_savefile = new_game;
5377 /* Nothing loaded */
5378 if (!current_world_ptr->character_loaded)
5380 /* Make new player */
5383 /* The dungeon is not ready */
5384 current_world_ptr->character_dungeon = FALSE;
5386 /* Prepare to init the RNG */
5387 init_random_seed = TRUE;
5389 /* Initialize the saved floors data */
5390 init_saved_floors(FALSE);
5393 /* Old game is loaded. But new game is requested. */
5396 /* Initialize the saved floors data */
5397 init_saved_floors(TRUE);
5400 /* Process old character */
5403 /* Process the player name */
5404 process_player_name(FALSE);
5408 if (init_random_seed)
5413 /* Roll new character */
5416 /* The dungeon is not ready */
5417 current_world_ptr->character_dungeon = FALSE;
5420 current_floor_ptr->dun_level = 0;
5421 p_ptr->inside_quest = 0;
5422 p_ptr->inside_arena = FALSE;
5423 p_ptr->inside_battle = FALSE;
5427 /* Hack -- seed for flavors */
5428 current_world_ptr->seed_flavor = randint0(0x10000000);
5430 /* Hack -- seed for town layout */
5431 current_world_ptr->seed_town = randint0(0x10000000);
5433 /* Roll up a new character */
5441 determine_bounty_uniques();
5442 determine_today_mon(FALSE);
5444 /* Initialize object array */
5449 write_level = FALSE;
5451 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5453 " ---- Restart Game ----"));
5456 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5457 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5459 if (p_ptr->riding == -1)
5462 for (i = current_floor_ptr->m_max; i > 0; i--)
5464 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5473 current_world_ptr->creating_savefile = FALSE;
5475 p_ptr->teleport_town = FALSE;
5476 p_ptr->sutemi = FALSE;
5477 current_world_ptr->timewalk_m_idx = 0;
5478 p_ptr->now_damaged = FALSE;
5480 current_world_ptr->start_time = time(NULL) - 1;
5481 record_o_name[0] = '\0';
5483 /* Reset map panel */
5484 panel_row_min = current_floor_ptr->height;
5485 panel_col_min = current_floor_ptr->width;
5487 /* Sexy gal gets bonus to maximum weapon skill of whip */
5488 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5489 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5491 /* Fill the arrays of floors and walls in the good proportions */
5492 set_floor_and_wall(p_ptr->dungeon_idx);
5494 /* Flavor the objects */
5497 /* Flash a message */
5498 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5500 /* Flush the message */
5504 /* Hack -- Enter wizard mode */
5507 if (enter_wizard_mode())
5509 p_ptr->wizard = TRUE;
5511 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5513 /* Initialize the saved floors data */
5514 init_saved_floors(TRUE);
5517 p_ptr->inside_quest = 0;
5519 /* Avoid crash in update_view() */
5520 p_ptr->y = p_ptr->x = 10;
5523 else if (p_ptr->is_dead)
5525 quit("Already dead.");
5529 /* Initialize the town-buildings if necessary */
5530 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5532 /* Init the wilderness */
5534 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5537 init_flags = INIT_ONLY_BUILDINGS;
5539 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5541 select_floor_music();
5545 /* Generate a dungeon level if needed */
5546 if (!current_world_ptr->character_dungeon)
5553 /* HACK -- Restore from panic-save */
5554 if (p_ptr->panic_save)
5556 /* No player? -- Try to regenerate floor */
5557 if (!p_ptr->y || !p_ptr->x)
5559 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5563 /* Still no player? -- Try to locate random place */
5564 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5566 /* No longer in panic */
5567 p_ptr->panic_save = 0;
5571 /* Character is now "complete" */
5572 current_world_ptr->character_generated = TRUE;
5575 /* Hack -- Character is no longer "icky" */
5576 current_world_ptr->character_icky = FALSE;
5582 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5583 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5588 p_ptr->playing = TRUE;
5590 /* Reset the visual mappings */
5593 /* Load the "pref" files */
5594 load_all_pref_files();
5596 /* Give startup outfit (after loading pref files) */
5602 /* React to changes */
5603 Term_xtra(TERM_XTRA_REACT, 0);
5605 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5606 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5609 /* Set or clear "rogue_like_commands" if requested */
5610 if (arg_force_original) rogue_like_commands = FALSE;
5611 if (arg_force_roguelike) rogue_like_commands = TRUE;
5613 /* Hack -- Enforce "delayed death" */
5614 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5616 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5618 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5620 monster_type *m_ptr;
5621 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5622 monster_race *r_ptr = &r_info[pet_r_idx];
5623 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5624 (PM_FORCE_PET | PM_NO_KAGE));
5625 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5626 m_ptr->mspeed = r_ptr->speed;
5627 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5628 m_ptr->max_maxhp = m_ptr->maxhp;
5629 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5630 m_ptr->dealt_damage = 0;
5631 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5634 (void)combine_and_reorder_home(STORE_HOME);
5635 (void)combine_and_reorder_home(STORE_MUSEUM);
5637 select_floor_music();
5642 /* Process the level */
5645 /* Hack -- prevent "icky" message */
5646 current_world_ptr->character_xtra = TRUE;
5650 current_world_ptr->character_xtra = FALSE;
5652 /* Cancel the target */
5655 /* Cancel the health bar */
5662 /* Handle "quit and save" */
5663 if (!p_ptr->playing && !p_ptr->is_dead) break;
5665 /* Erase the old current_floor_ptr->grid_array */
5667 if (!p_ptr->is_dead) wipe_m_list();
5674 /* Accidental Death */
5675 if (p_ptr->playing && p_ptr->is_dead)
5677 if (p_ptr->inside_arena)
5679 p_ptr->inside_arena = FALSE;
5680 if (p_ptr->arena_number > MAX_ARENA_MONS)
5681 p_ptr->arena_number++;
5683 p_ptr->arena_number = -1 - p_ptr->arena_number;
5684 p_ptr->is_dead = FALSE;
5686 p_ptr->chp_frac = 0;
5687 p_ptr->exit_bldg = TRUE;
5690 /* Leave through the exit */
5691 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5693 /* prepare next floor */
5698 /* Mega-Hack -- Allow player to cheat death */
5699 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5706 /* Handle "death" */
5707 if (p_ptr->is_dead) break;
5709 /* Make a new level */
5721 * @brief ゲームターンからの実時間換算を行うための補正をかける
5722 * @param hoge ゲームターン
5723 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5724 * @return 修正をかけた後のゲームターン
5726 s32b turn_real(s32b hoge)
5728 switch (p_ptr->start_race)
5734 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5741 * @brief ターンのオーバーフローに対する対処
5742 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5743 * @return 修正をかけた後のゲームターン
5745 void prevent_turn_overflow(void)
5747 int rollback_days, i, j;
5748 s32b rollback_turns;
5750 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5752 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5753 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5755 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5756 else current_world_ptr->game_turn = 1;
5757 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5758 else current_floor_ptr->generated_turn = 1;
5759 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
5760 else current_world_ptr->arena_start_turn = 1;
5761 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5762 else p_ptr->feeling_turn = 1;
5764 for (i = 1; i < max_towns; i++)
5766 for (j = 0; j < MAX_STORES; j++)
5768 store_type *st_ptr = &town_info[i].store[j];
5770 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5772 st_ptr->last_visit -= rollback_turns;
5773 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5776 if (st_ptr->store_open)
5778 st_ptr->store_open -= rollback_turns;
5779 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5787 * Close up the current game (player may or may not be dead)
5791 * This function is called only from "main.c" and "signals.c".
5794 void close_game(void)
5797 bool do_send = TRUE;
5799 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5802 /* Flush the messages */
5805 /* Flush the input */
5809 /* No suspending now */
5810 signals_ignore_tstp();
5813 /* Hack -- Character is now "icky" */
5814 current_world_ptr->character_icky = TRUE;
5817 /* Build the filename */
5818 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5820 /* Grab permissions */
5823 /* Open the high score file, for reading/writing */
5824 highscore_fd = fd_open(buf, O_RDWR);
5826 /* Drop permissions */
5832 /* Handle retirement */
5833 if (p_ptr->total_winner) kingly();
5836 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5838 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5840 else do_send = FALSE;
5847 /* Show more info */
5853 if ((!send_world_score(do_send)))
5855 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5856 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5858 p_ptr->wait_report_score = TRUE;
5859 p_ptr->is_dead = FALSE;
5860 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5863 if (!p_ptr->wait_report_score)
5866 else if (highscore_fd >= 0)
5868 display_scores_aux(0, 10, -1, NULL);
5871 /* Dump bones file */
5880 do_cmd_save_game(FALSE);
5882 /* Prompt for scores */
5883 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5884 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5886 /* Predict score (or ESCAPE) */
5887 if (inkey() != ESCAPE) predict_score();
5891 /* Shut the high score file */
5892 (void)fd_close(highscore_fd);
5894 /* Forget the high score fd */
5897 /* Kill all temporal files */
5898 clear_saved_floor_files();
5900 /* Allow suspending now */
5901 signals_handle_tstp();
5906 * @brief 全更新処理をチェックして処理していく
5907 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
5910 void handle_stuff(void)
5912 if (p_ptr->update) update_creature(p_ptr);
5913 if (p_ptr->redraw) redraw_stuff();
5914 if (p_ptr->window) window_stuff();
5917 void update_output(void)
5919 if (p_ptr->redraw) redraw_stuff();
5920 if (p_ptr->window) window_stuff();