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 bool repair_monsters; /* Hack -- optimize detect monsters */
109 bool repair_objects; /* Hack -- optimize detect objects */
111 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
114 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
116 concptr ANGBAND_KEYBOARD = "0";
119 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
121 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
122 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
125 * Flags for initialization
130 * @brief 擬似鑑定を実際に行い判定を反映する
131 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
132 * @param heavy 重度の擬似鑑定を行うならばTRUE
135 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
138 object_type *o_ptr = &p_ptr->inventory_list[slot];
139 GAME_TEXT o_name[MAX_NLEN];
141 /* We know about it already, do not tell us again */
142 if (o_ptr->ident & (IDENT_SENSE))return;
144 /* It is fully known, no information needed */
145 if (object_is_known(o_ptr)) return;
147 /* Check for a feeling */
148 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
150 /* Skip non-feelings */
154 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
165 feel = FEEL_EXCELLENT;
171 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
173 feel = FEEL_UNCURSED;
178 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
184 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
191 feel = FEEL_WORTHLESS;
196 feel = FEEL_TERRIBLE;
202 /* Stop everything */
203 if (disturb_minor) disturb(FALSE, FALSE);
205 /* Get an object description */
206 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
208 /* Message (equipment) */
209 if (slot >= INVEN_RARM)
212 msg_format("%s%s(%c)は%sという感じがする...",
213 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
215 msg_format("You feel the %s (%c) you are %s %s %s...",
216 o_name, index_to_label(slot), describe_use(slot),
217 ((o_ptr->number == 1) ? "is" : "are"),
218 game_inscriptions[feel]);
223 /* Message (p_ptr->inventory_list) */
227 msg_format("ザックの中の%s(%c)は%sという感じがする...",
228 o_name, index_to_label(slot),game_inscriptions[feel]);
230 msg_format("You feel the %s (%c) in your pack %s %s...",
231 o_name, index_to_label(slot),
232 ((o_ptr->number == 1) ? "is" : "are"),
233 game_inscriptions[feel]);
238 o_ptr->ident |= (IDENT_SENSE);
240 /* Set the "inscription" */
241 o_ptr->feeling = feel;
243 /* Auto-inscription/destroy */
244 autopick_alter_item(slot, destroy_feeling);
245 p_ptr->update |= (PU_COMBINE | PU_REORDER);
247 p_ptr->window |= (PW_INVEN | PW_EQUIP);
253 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
256 * Sense the p_ptr->inventory_list\n
258 * Class 0 = Warrior --> fast and heavy\n
259 * Class 1 = Mage --> slow and light\n
260 * Class 2 = Priest --> fast but light\n
261 * Class 3 = Rogue --> okay and heavy\n
262 * Class 4 = Ranger --> slow but heavy (changed!)\n
263 * Class 5 = Paladin --> slow but heavy\n
265 static void sense_inventory1(void)
268 PLAYER_LEVEL plev = p_ptr->lev;
273 /*** Check for "sensing" ***/
275 /* No sensing when confused */
276 if (p_ptr->confused) return;
278 /* Analyze the class */
279 switch (p_ptr->pclass)
287 if (0 != randint0(9000L / (plev * plev + 40))) return;
298 if (0 != randint0(6000L / (plev * plev + 50))) return;
307 case CLASS_HIGH_MAGE:
309 case CLASS_MAGIC_EATER:
311 /* Very bad (light) sensing */
312 if (0 != randint0(240000L / (plev + 5))) return;
320 /* Good (light) sensing */
321 if (0 != randint0(10000L / (plev * plev + 40))) return;
330 if (0 != randint0(20000L / (plev * plev + 40))) return;
341 if (0 != randint0(95000L / (plev * plev + 40))) return;
353 if (0 != randint0(77777L / (plev * plev + 40))) return;
361 case CLASS_WARRIOR_MAGE:
365 if (0 != randint0(75000L / (plev * plev + 40))) return;
370 case CLASS_MINDCRAFTER:
372 case CLASS_BLUE_MAGE:
373 case CLASS_MIRROR_MASTER:
376 if (0 != randint0(55000L / (plev * plev + 40))) return;
381 case CLASS_CHAOS_WARRIOR:
384 if (0 != randint0(80000L / (plev * plev + 40))) return;
393 case CLASS_FORCETRAINER:
396 if (0 != randint0(20000L / (plev * plev + 40))) return;
404 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
412 case CLASS_BEASTMASTER:
415 if (0 != randint0(65000L / (plev * plev + 40))) return;
419 case CLASS_BERSERKER:
428 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
430 /*** Sense everything ***/
432 /* Check everything */
433 for (i = 0; i < INVEN_TOTAL; i++)
437 o_ptr = &p_ptr->inventory_list[i];
439 /* Skip empty slots */
440 if (!o_ptr->k_idx) continue;
442 /* Valid "tval" codes */
469 /* Skip non-sense machines */
472 /* Occasional failure on p_ptr->inventory_list items */
473 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
476 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
481 sense_inventory_aux(i, heavy);
486 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
489 static void sense_inventory2(void)
492 PLAYER_LEVEL plev = p_ptr->lev;
496 /*** Check for "sensing" ***/
498 /* No sensing when confused */
499 if (p_ptr->confused) return;
501 /* Analyze the class */
502 switch (p_ptr->pclass)
508 case CLASS_BERSERKER:
516 case CLASS_CHAOS_WARRIOR:
518 case CLASS_BEASTMASTER:
521 /* Very bad (light) sensing */
522 if (0 != randint0(240000L / (plev + 5))) return;
528 case CLASS_WARRIOR_MAGE:
533 if (0 != randint0(95000L / (plev * plev + 40))) return;
541 case CLASS_FORCETRAINER:
542 case CLASS_MINDCRAFTER:
545 if (0 != randint0(20000L / (plev * plev + 40))) return;
551 case CLASS_HIGH_MAGE:
553 case CLASS_MAGIC_EATER:
554 case CLASS_MIRROR_MASTER:
555 case CLASS_BLUE_MAGE:
558 if (0 != randint0(9000L / (plev * plev + 40))) return;
566 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
572 /*** Sense everything ***/
574 /* Check everything */
575 for (i = 0; i < INVEN_TOTAL; i++)
579 o_ptr = &p_ptr->inventory_list[i];
581 /* Skip empty slots */
582 if (!o_ptr->k_idx) continue;
584 /* Valid "tval" codes */
597 /* Skip non-sense machines */
600 /* Occasional failure on p_ptr->inventory_list items */
601 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
603 sense_inventory_aux(i, TRUE);
608 * @brief パターン終点到達時のテレポート処理を行う
611 static void pattern_teleport(void)
614 DEPTH max_level = 99;
617 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
622 /* Only downward in ironman mode */
623 if (ironman_downward)
624 min_level = current_floor_ptr->dun_level;
627 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
629 if (current_floor_ptr->dun_level > 100)
630 max_level = MAX_DEPTH - 1;
631 else if (current_floor_ptr->dun_level == 100)
636 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
637 min_level = d_info[p_ptr->dungeon_idx].mindepth;
641 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
644 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
646 /* Ask for a level */
647 if (!get_string(ppp, tmp_val, 10)) return;
649 /* Extract request */
650 command_arg = (COMMAND_ARG)atoi(tmp_val);
652 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
654 teleport_player(200, 0L);
661 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
662 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
665 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
667 if (autosave_l) do_cmd_save_game(TRUE);
670 current_floor_ptr->dun_level = command_arg;
674 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
676 p_ptr->inside_quest = 0;
680 * Clear all saved floors
681 * and create a first saved floor
683 prepare_change_floor_mode(CFM_FIRST_FLOOR);
684 p_ptr->leaving = TRUE;
688 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
689 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
691 static bool pattern_effect(void)
695 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
697 if ((PRACE_IS_(p_ptr, RACE_AMBERITE)) &&
698 (p_ptr->cut > 0) && one_in_(10))
703 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
705 switch (pattern_type)
707 case PATTERN_TILE_END:
709 (void)restore_all_status();
710 (void)restore_level();
711 (void)cure_critical_wounds(1000);
713 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
714 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
717 * We could make the healing effect of the
718 * Pattern center one-time only to avoid various kinds
719 * of abuse, like luring the win monster into fighting you
720 * in the middle of the pattern...
724 case PATTERN_TILE_OLD:
728 case PATTERN_TILE_TELEPORT:
732 case PATTERN_TILE_WRECKED:
734 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
738 if (PRACE_IS_(p_ptr, RACE_AMBERITE) && !one_in_(2))
740 else if (!IS_INVULN())
741 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
750 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
751 * @param percent 回復比率
754 static void regenhp(int percent)
760 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
761 if (p_ptr->action == ACTION_HAYAGAKE) return;
763 /* Save the old hitpoints */
764 old_chp = p_ptr->chp;
767 * Extract the new hitpoints
769 * 'percent' is the Regen factor in unit (1/2^16)
772 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
774 /* Convert the unit (1/2^16) to (1/2^32) */
775 s64b_LSHIFT(new_chp, new_chp_frac, 16);
778 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
782 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
784 p_ptr->chp = p_ptr->mhp;
789 if (old_chp != p_ptr->chp)
791 p_ptr->redraw |= (PR_HP);
792 p_ptr->window |= (PW_PLAYER);
799 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
800 * @param upkeep_factor ペット維持によるMPコスト量
801 * @param regen_amount 回復量
804 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
806 MANA_POINT old_csp = p_ptr->csp;
807 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
810 * Excess mana will decay 32 times faster than normal
813 if (p_ptr->csp > p_ptr->msp)
815 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
817 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
819 /* Convert the unit (1/2^16) to (1/2^32) */
820 s64b_LSHIFT(decay, decay_frac, 16);
823 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
826 if (p_ptr->csp < p_ptr->msp)
828 p_ptr->csp = p_ptr->msp;
833 /* Regenerating mana (unless the player has excess mana) */
834 else if (regen_rate > 0)
836 /* (percent/100) is the Regen factor in unit (1/2^16) */
837 MANA_POINT new_mana = 0;
838 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
840 /* Convert the unit (1/2^16) to (1/2^32) */
841 s64b_LSHIFT(new_mana, new_mana_frac, 16);
844 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
846 /* Must set frac to zero even if equal */
847 if (p_ptr->csp >= p_ptr->msp)
849 p_ptr->csp = p_ptr->msp;
855 /* Reduce mana (even when the player has excess mana) */
858 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
859 s32b reduce_mana = 0;
860 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
862 /* Convert the unit (1/2^16) to (1/2^32) */
863 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
866 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
876 if (old_csp != p_ptr->csp)
878 p_ptr->redraw |= (PR_MANA);
879 p_ptr->window |= (PW_PLAYER);
880 p_ptr->window |= (PW_SPELL);
886 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
887 * @param regen_amount 回復量
890 static void regenmagic(int regen_amount)
895 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
897 for (i = 0; i < EATER_EXT*2; i++)
899 if (!p_ptr->magic_num2[i]) continue;
900 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
902 /* Increase remaining charge number like float value */
903 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
904 p_ptr->magic_num1[i] += new_mana;
906 /* Check maximum charge */
907 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
909 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
913 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
915 if (!p_ptr->magic_num1[i]) continue;
916 if (!p_ptr->magic_num2[i]) continue;
918 /* Decrease remaining period for charging */
919 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
920 / (dev * 16 * PY_REGEN_NORMAL);
921 p_ptr->magic_num1[i] -= new_mana;
923 /* Check minimum remaining period for charging */
924 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
931 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
933 * @note Should probably be done during monster turns.
935 static void regen_monsters(void)
940 /* Regenerate everyone */
941 for (i = 1; i < current_floor_ptr->m_max; i++)
943 /* Check the i'th monster */
944 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
945 monster_race *r_ptr = &r_info[m_ptr->r_idx];
947 if (!monster_is_valid(m_ptr)) continue;
949 /* Allow regeneration (if needed) */
950 if (m_ptr->hp < m_ptr->maxhp)
952 /* Hack -- Base regeneration */
953 frac = m_ptr->maxhp / 100;
955 /* Hack -- Minimal regeneration rate */
956 if (!frac) if (one_in_(2)) frac = 1;
958 /* Hack -- Some monsters regenerate quickly */
959 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
961 /* Hack -- Regenerate */
964 /* Do not over-regenerate */
965 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
967 /* Redraw (later) if needed */
968 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
969 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
976 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
978 * @note Should probably be done during monster turns.
980 static void regen_captured_monsters(void)
985 /* Regenerate everyone */
986 for (i = 0; i < INVEN_TOTAL; i++)
989 object_type *o_ptr = &p_ptr->inventory_list[i];
991 if (!o_ptr->k_idx) continue;
992 if (o_ptr->tval != TV_CAPTURE) continue;
993 if (!o_ptr->pval) continue;
997 r_ptr = &r_info[o_ptr->pval];
999 /* Allow regeneration (if needed) */
1000 if (o_ptr->xtra4 < o_ptr->xtra5)
1002 /* Hack -- Base regeneration */
1003 frac = o_ptr->xtra5 / 100;
1005 /* Hack -- Minimal regeneration rate */
1006 if (!frac) if (one_in_(2)) frac = 1;
1008 /* Hack -- Some monsters regenerate quickly */
1009 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1011 /* Hack -- Regenerate */
1012 o_ptr->xtra4 += (XTRA16)frac;
1014 /* Do not over-regenerate */
1015 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1022 p_ptr->update |= (PU_COMBINE);
1023 p_ptr->window |= (PW_INVEN);
1024 p_ptr->window |= (PW_EQUIP);
1030 * @brief 寿命つき光源の警告メッセージ処理
1031 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1034 static void notice_lite_change(object_type *o_ptr)
1036 /* Hack -- notice interesting fuel steps */
1037 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1039 p_ptr->window |= (PW_EQUIP);
1042 /* Hack -- Special treatment when blind */
1045 /* Hack -- save some light for later */
1046 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1049 /* The light is now out */
1050 else if (o_ptr->xtra4 == 0)
1052 disturb(FALSE, TRUE);
1053 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1055 /* Recalculate torch radius */
1056 p_ptr->update |= (PU_TORCH);
1058 /* Some ego light lose its effects without fuel */
1059 p_ptr->update |= (PU_BONUS);
1062 /* The light is getting dim */
1063 else if (o_ptr->name2 == EGO_LITE_LONG)
1065 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1066 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1068 if (disturb_minor) disturb(FALSE, TRUE);
1069 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1073 /* The light is getting dim */
1074 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1076 if (disturb_minor) disturb(FALSE, TRUE);
1077 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1083 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1084 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1087 static void recharged_notice(object_type *o_ptr)
1089 GAME_TEXT o_name[MAX_NLEN];
1093 /* No inscription */
1094 if (!o_ptr->inscription) return;
1097 s = my_strchr(quark_str(o_ptr->inscription), '!');
1099 /* Process notification request. */
1102 /* Find another '!' */
1105 /* Describe (briefly) */
1106 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1108 /* Notify the player */
1110 msg_format("%sは再充填された。", o_name);
1112 if (o_ptr->number > 1)
1113 msg_format("Your %s are recharged.", o_name);
1115 msg_format("Your %s is recharged.", o_name);
1118 disturb(FALSE, FALSE);
1124 /* Keep looking for '!'s */
1125 s = my_strchr(s + 1, '!');
1130 * @brief プレイヤーの歌に関する継続処理
1133 static void check_music(void)
1135 const magic_type *s_ptr;
1137 MANA_POINT need_mana;
1138 u32b need_mana_frac;
1140 /* Music singed by player */
1141 if (p_ptr->pclass != CLASS_BARD) return;
1142 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1144 if (p_ptr->anti_magic)
1146 stop_singing(p_ptr);
1150 spell = SINGING_SONG_ID(p_ptr);
1151 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1153 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1157 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1159 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1161 stop_singing(p_ptr);
1166 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1168 p_ptr->redraw |= PR_MANA;
1169 if (INTERUPTING_SONG_EFFECT(p_ptr))
1171 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1172 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1173 msg_print(_("歌を再開した。", "You restart singing."));
1174 p_ptr->action = ACTION_SING;
1175 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1176 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1177 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1180 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1181 p_ptr->spell_exp[spell] += 5;
1182 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1183 { 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; }
1184 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1185 { 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; }
1186 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1187 { 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; }
1189 /* Do any effects of continual song */
1190 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1194 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1195 * @param flag 探し出したい呪いフラグ配列
1196 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1199 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1202 int choices[INVEN_TOTAL-INVEN_RARM];
1205 /* Paranoia -- Player has no warning-item */
1206 if (!(p_ptr->cursed & flag)) return NULL;
1208 /* Search Inventry */
1209 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1211 object_type *o_ptr = &p_ptr->inventory_list[i];
1213 if (o_ptr->curse_flags & flag)
1215 choices[number] = i;
1218 else if ((flag == TRC_ADD_L_CURSE) ||
1219 (flag == TRC_ADD_H_CURSE) ||
1220 (flag == TRC_DRAIN_HP) ||
1221 (flag == TRC_DRAIN_MANA) ||
1222 (flag == TRC_CALL_ANIMAL) ||
1223 (flag == TRC_CALL_DEMON) ||
1224 (flag == TRC_CALL_DRAGON) ||
1225 (flag == TRC_CALL_UNDEAD) ||
1226 (flag == TRC_COWARDICE) ||
1227 (flag == TRC_LOW_MELEE) ||
1228 (flag == TRC_LOW_AC) ||
1229 (flag == TRC_LOW_MAGIC) ||
1230 (flag == TRC_FAST_DIGEST) ||
1231 (flag == TRC_SLOW_REGEN) )
1234 BIT_FLAGS flgs[TR_FLAG_SIZE];
1235 object_flags(o_ptr, flgs);
1238 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1239 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1240 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1241 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1242 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1243 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1244 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1245 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1246 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1247 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1248 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1249 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1250 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1251 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1254 if (have_flag(flgs, cf))
1256 choices[number] = i;
1262 /* Choice one of them */
1263 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1266 static void process_world_aux_digestion(void)
1268 if (!p_ptr->inside_battle)
1270 /* Digest quickly when gorged */
1271 if (p_ptr->food >= PY_FOOD_MAX)
1273 /* Digest a lot of food */
1274 (void)set_food(p_ptr->food - 100);
1277 /* Digest normally -- Every 50 game turns */
1278 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1280 /* Basic digestion rate based on speed */
1281 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1283 /* Regeneration takes more food */
1284 if (p_ptr->regenerate)
1286 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1288 if (p_ptr->cursed & TRC_FAST_DIGEST)
1291 /* Slow digestion takes less food */
1292 if (p_ptr->slow_digest)
1295 /* Minimal digestion */
1296 if (digestion < 1) digestion = 1;
1297 /* Maximal digestion */
1298 if (digestion > 100) digestion = 100;
1300 /* Digest some food */
1301 (void)set_food(p_ptr->food - digestion);
1306 if ((p_ptr->food < PY_FOOD_FAINT))
1308 /* Faint occasionally */
1309 if (!p_ptr->paralyzed && (randint0(100) < 10))
1311 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1312 disturb(TRUE, TRUE);
1314 /* Hack -- faint (bypass free action) */
1315 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1318 /* Starve to death (slowly) */
1319 if (p_ptr->food < PY_FOOD_STARVE)
1321 /* Calculate damage */
1322 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1324 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1331 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1332 * / Handle timed damage and regeneration every 10 game turns
1335 static void process_world_aux_hp_and_sp(void)
1337 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1338 bool cave_no_regen = FALSE;
1339 int upkeep_factor = 0;
1341 /* Default regeneration */
1342 int regen_amount = PY_REGEN_NORMAL;
1345 /*** Damage over Time ***/
1347 /* Take damage from poison */
1348 if (p_ptr->poisoned && !IS_INVULN())
1350 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1353 /* Take damage from cuts */
1354 if (p_ptr->cut && !IS_INVULN())
1358 /* Mortal wound or Deep Gash */
1359 if (p_ptr->cut > 1000)
1364 else if (p_ptr->cut > 200)
1370 else if (p_ptr->cut > 100)
1375 else if (p_ptr->cut > 50)
1380 else if (p_ptr->cut > 25)
1385 else if (p_ptr->cut > 10)
1396 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1399 /* (Vampires) Take damage from sunlight */
1400 if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1402 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1404 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1406 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1407 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1408 cave_no_regen = TRUE;
1412 if (p_ptr->inventory_list[INVEN_LITE].tval && (p_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1413 !p_ptr->resist_lite)
1415 object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1416 GAME_TEXT o_name [MAX_NLEN];
1417 char ouch [MAX_NLEN+40];
1419 /* Get an object description */
1420 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1421 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1423 cave_no_regen = TRUE;
1425 /* Get an object description */
1426 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1427 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1429 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1433 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1437 if (have_flag(f_ptr->flags, FF_DEEP))
1439 damage = 6000 + randint0(4000);
1441 else if (!p_ptr->levitation)
1443 damage = 3000 + randint0(2000);
1448 if(PRACE_IS_(p_ptr, RACE_ENT)) damage += damage / 3;
1449 if(p_ptr->resist_fire) damage = damage / 3;
1450 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1451 if(p_ptr->levitation) damage = damage / 5;
1453 damage = damage / 100 + (randint0(100) < (damage % 100));
1455 if (p_ptr->levitation)
1457 msg_print(_("熱で火傷した!", "The heat burns you!"));
1458 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1459 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1463 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1464 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1465 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1468 cave_no_regen = TRUE;
1472 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1476 if (have_flag(f_ptr->flags, FF_DEEP))
1478 damage = 6000 + randint0(4000);
1480 else if (!p_ptr->levitation)
1482 damage = 3000 + randint0(2000);
1487 if (p_ptr->resist_cold) damage = damage / 3;
1488 if (IS_OPPOSE_COLD()) damage = damage / 3;
1489 if (p_ptr->levitation) damage = damage / 5;
1491 damage = damage / 100 + (randint0(100) < (damage % 100));
1493 if (p_ptr->levitation)
1495 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1496 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1497 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1501 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1502 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1503 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1506 cave_no_regen = TRUE;
1510 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1514 if (have_flag(f_ptr->flags, FF_DEEP))
1516 damage = 6000 + randint0(4000);
1518 else if (!p_ptr->levitation)
1520 damage = 3000 + randint0(2000);
1525 if (p_ptr->resist_elec) damage = damage / 3;
1526 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1527 if (p_ptr->levitation) damage = damage / 5;
1529 damage = damage / 100 + (randint0(100) < (damage % 100));
1531 if (p_ptr->levitation)
1533 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1534 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1535 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1539 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1540 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1541 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1544 cave_no_regen = TRUE;
1548 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1552 if (have_flag(f_ptr->flags, FF_DEEP))
1554 damage = 6000 + randint0(4000);
1556 else if (!p_ptr->levitation)
1558 damage = 3000 + randint0(2000);
1563 if (p_ptr->resist_acid) damage = damage / 3;
1564 if (IS_OPPOSE_ACID()) damage = damage / 3;
1565 if (p_ptr->levitation) damage = damage / 5;
1567 damage = damage / 100 + (randint0(100) < (damage % 100));
1569 if (p_ptr->levitation)
1571 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1572 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1573 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1577 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1578 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1579 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1582 cave_no_regen = TRUE;
1586 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1590 if (have_flag(f_ptr->flags, FF_DEEP))
1592 damage = 6000 + randint0(4000);
1594 else if (!p_ptr->levitation)
1596 damage = 3000 + randint0(2000);
1601 if (p_ptr->resist_pois) damage = damage / 3;
1602 if (IS_OPPOSE_POIS()) damage = damage / 3;
1603 if (p_ptr->levitation) damage = damage / 5;
1605 damage = damage / 100 + (randint0(100) < (damage % 100));
1607 if (p_ptr->levitation)
1609 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1610 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1611 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1612 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1616 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1617 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1618 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1619 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1622 cave_no_regen = TRUE;
1626 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1627 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1629 if (p_ptr->total_weight > weight_limit())
1631 msg_print(_("溺れている!", "You are drowning!"));
1632 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1633 cave_no_regen = TRUE;
1640 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1642 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1643 if (PRACE_IS_(p_ptr, RACE_ENT)) damage += damage / 3;
1644 if (p_ptr->resist_fire) damage = damage / 3;
1645 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1646 msg_print(_("熱い!", "It's hot!"));
1647 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1649 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1651 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1652 if (PRACE_IS_(p_ptr, RACE_ANDROID)) damage += damage / 3;
1653 if (p_ptr->resist_elec) damage = damage / 3;
1654 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1655 msg_print(_("痛い!", "It hurts!"));
1656 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1658 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1660 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1661 if (p_ptr->resist_cold) damage = damage / 3;
1662 if (IS_OPPOSE_COLD()) damage = damage / 3;
1663 msg_print(_("冷たい!", "It's cold!"));
1664 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1668 /* Spectres -- take damage when moving through walls */
1670 * Added: ANYBODY takes damage if inside through walls
1671 * without wraith form -- NOTE: Spectres will never be
1672 * reduced below 0 hp by being inside a stone wall; others
1675 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1677 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1680 cave_no_regen = TRUE;
1682 if (p_ptr->pass_wall)
1684 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1685 dam_desc = _("密度", "density");
1689 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1690 dam_desc = _("硬い岩", "solid rock");
1693 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1698 /*** handle regeneration ***/
1701 if (p_ptr->food < PY_FOOD_WEAK)
1703 /* Lower regeneration */
1704 if (p_ptr->food < PY_FOOD_STARVE)
1708 else if (p_ptr->food < PY_FOOD_FAINT)
1710 regen_amount = PY_REGEN_FAINT;
1714 regen_amount = PY_REGEN_WEAK;
1718 /* Are we walking the pattern? */
1719 if (pattern_effect())
1721 cave_no_regen = TRUE;
1725 /* Regeneration ability */
1726 if (p_ptr->regenerate)
1728 regen_amount = regen_amount * 2;
1730 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1734 if (p_ptr->cursed & TRC_SLOW_REGEN)
1741 /* Searching or Resting */
1742 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1744 regen_amount = regen_amount * 2;
1747 upkeep_factor = calculate_upkeep();
1749 /* No regeneration while special action */
1750 if ((p_ptr->action == ACTION_LEARN) ||
1751 (p_ptr->action == ACTION_HAYAGAKE) ||
1752 (p_ptr->special_defense & KATA_KOUKIJIN))
1754 upkeep_factor += 100;
1757 /* Regenerate the mana */
1758 regenmana(upkeep_factor, regen_amount);
1761 /* Recharge magic eater's power */
1762 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1764 regenmagic(regen_amount);
1767 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1769 while (upkeep_factor > 100)
1771 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1773 do_cmd_pet_dismiss();
1775 upkeep_factor = calculate_upkeep();
1777 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1782 /* Poisoned or cut yields no healing */
1783 if (p_ptr->poisoned) regen_amount = 0;
1784 if (p_ptr->cut) regen_amount = 0;
1786 /* Special floor -- Pattern, in a wall -- yields no healing */
1787 if (cave_no_regen) regen_amount = 0;
1789 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1791 /* Regenerate Hit Points if needed */
1792 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1794 regenhp(regen_amount);
1799 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1800 * / Handle timeout every 10 game turns
1803 static void process_world_aux_timeout(void)
1805 const int dec_count = (easy_band ? 2 : 1);
1807 /*** Timeout Various Things ***/
1810 if (p_ptr->tim_mimic)
1812 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1815 /* Hack -- Hallucinating */
1818 (void)set_image(p_ptr->image - dec_count);
1824 (void)set_blind(p_ptr->blind - dec_count);
1827 /* Times see-invisible */
1828 if (p_ptr->tim_invis)
1830 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1833 if (p_ptr->suppress_multi_reward)
1835 p_ptr->suppress_multi_reward = FALSE;
1841 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1844 /* Timed temporary elemental brands. -LM- */
1845 if (p_ptr->ele_attack)
1847 p_ptr->ele_attack--;
1849 /* Clear all temporary elemental brands. */
1850 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1853 /* Timed temporary elemental immune. -LM- */
1854 if (p_ptr->ele_immune)
1856 p_ptr->ele_immune--;
1858 /* Clear all temporary elemental brands. */
1859 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1862 /* Timed infra-vision */
1863 if (p_ptr->tim_infra)
1865 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1869 if (p_ptr->tim_stealth)
1871 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1874 /* Timed levitation */
1875 if (p_ptr->tim_levitation)
1877 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1880 /* Timed sh_touki */
1881 if (p_ptr->tim_sh_touki)
1883 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1887 if (p_ptr->tim_sh_fire)
1889 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1893 if (p_ptr->tim_sh_holy)
1895 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1899 if (p_ptr->tim_eyeeye)
1901 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1904 /* Timed resist-magic */
1905 if (p_ptr->resist_magic)
1907 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1910 /* Timed regeneration */
1911 if (p_ptr->tim_regen)
1913 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1916 /* Timed resist nether */
1917 if (p_ptr->tim_res_nether)
1919 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1922 /* Timed resist time */
1923 if (p_ptr->tim_res_time)
1925 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1929 if (p_ptr->tim_reflect)
1931 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1935 if (p_ptr->multishadow)
1937 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1940 /* Timed Robe of dust */
1941 if (p_ptr->dustrobe)
1943 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1946 /* Timed infra-vision */
1947 if (p_ptr->kabenuke)
1949 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1953 if (p_ptr->paralyzed)
1955 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1959 if (p_ptr->confused)
1961 (void)set_confused(p_ptr->confused - dec_count);
1967 (void)set_afraid(p_ptr->afraid - dec_count);
1973 (void)set_fast(p_ptr->fast - 1, TRUE);
1979 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1982 /* Protection from evil */
1983 if (p_ptr->protevil)
1985 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1988 /* Invulnerability */
1991 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1995 if (p_ptr->wraith_form)
1997 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2003 (void)set_hero(p_ptr->hero - 1, TRUE);
2009 (void)set_shero(p_ptr->shero - 1, TRUE);
2015 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2021 (void)set_shield(p_ptr->shield - 1, TRUE);
2025 if (p_ptr->tsubureru)
2027 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2031 if (p_ptr->magicdef)
2033 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2037 if (p_ptr->tsuyoshi)
2039 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2043 if (p_ptr->oppose_acid)
2045 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2048 /* Oppose Lightning */
2049 if (p_ptr->oppose_elec)
2051 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2055 if (p_ptr->oppose_fire)
2057 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2061 if (p_ptr->oppose_cold)
2063 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2067 if (p_ptr->oppose_pois)
2069 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2074 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2077 /*** Poison and Stun and Cut ***/
2080 if (p_ptr->poisoned)
2082 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2084 /* Apply some healing */
2085 (void)set_poisoned(p_ptr->poisoned - adjust);
2091 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2093 /* Apply some healing */
2094 (void)set_stun(p_ptr->stun - adjust);
2100 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2102 /* Hack -- Truly "mortal" wound */
2103 if (p_ptr->cut > 1000) adjust = 0;
2105 /* Apply some healing */
2106 (void)set_cut(p_ptr->cut - adjust);
2112 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2113 * / Handle burning fuel every 10 game turns
2116 static void process_world_aux_light(void)
2118 /* Check for light being wielded */
2119 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2121 /* Burn some fuel in the current lite */
2122 if (o_ptr->tval == TV_LITE)
2124 /* Hack -- Use some fuel (except on artifacts) */
2125 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2127 /* Decrease life-span */
2128 if (o_ptr->name2 == EGO_LITE_LONG)
2130 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2132 else o_ptr->xtra4--;
2134 /* Notice interesting fuel steps */
2135 notice_lite_change(o_ptr);
2142 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2143 * / Handle mutation effects once every 10 game turns
2146 static void process_world_aux_mutation(void)
2148 /* No mutation with effects */
2149 if (!p_ptr->muta2) return;
2151 /* No effect on monster arena */
2152 if (p_ptr->inside_battle) return;
2154 /* No effect on the global map */
2155 if (p_ptr->wild_mode) return;
2157 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2159 disturb(FALSE, TRUE);
2160 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2161 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2162 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2163 (void)set_afraid(0);
2166 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2168 if (!p_ptr->resist_fear)
2170 disturb(FALSE, TRUE);
2171 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2172 set_afraid(p_ptr->afraid + 13 + randint1(26));
2176 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2178 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2180 disturb(FALSE, TRUE);
2181 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2183 teleport_player(40, TELEPORT_PASSIVE);
2187 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2189 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2191 disturb(FALSE, TRUE);
2192 p_ptr->redraw |= PR_EXTRA;
2193 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2196 if (!p_ptr->resist_conf)
2198 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2201 if (!p_ptr->resist_chaos)
2206 if (one_in_(3)) lose_all_info();
2208 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2210 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2211 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2217 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2218 (void)set_image(p_ptr->image + randint0(150) + 150);
2224 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2226 if (!p_ptr->resist_chaos)
2228 disturb(FALSE, TRUE);
2229 p_ptr->redraw |= PR_EXTRA;
2230 (void)set_image(p_ptr->image + randint0(50) + 20);
2234 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2236 disturb(FALSE, TRUE);
2237 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2239 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2242 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2243 !p_ptr->anti_magic && one_in_(9000))
2246 disturb(FALSE, TRUE);
2247 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2248 "Magical energy flows through you! You must release it!"));
2252 (void)get_hack_dir(&dire);
2253 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2256 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2258 bool pet = one_in_(6);
2259 BIT_FLAGS mode = PM_ALLOW_GROUP;
2261 if (pet) mode |= PM_FORCE_PET;
2262 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2264 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode))
2266 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2267 disturb(FALSE, TRUE);
2271 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2273 disturb(FALSE, TRUE);
2276 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2278 if (p_ptr->fast > 0)
2284 set_slow(randint1(30) + 10, FALSE);
2289 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2291 if (p_ptr->slow > 0)
2297 set_fast(randint1(30) + 10, FALSE);
2302 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2304 disturb(FALSE, TRUE);
2305 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2307 banish_monsters(100);
2308 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2312 /* Pick a random shop (except home) */
2315 n = randint0(MAX_STORES);
2317 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2319 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2325 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2329 msg_print(_("影につつまれた。", "A shadow passes over you."));
2332 /* Absorb light from the current possition */
2333 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2338 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2340 /* Absorb some fuel in the current lite */
2341 if (o_ptr->tval == TV_LITE)
2343 /* Use some fuel (except on artifacts) */
2344 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2346 /* Heal the player a bit */
2347 hp_player(o_ptr->xtra4 / 20);
2349 /* Decrease life-span of lite */
2351 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2353 /* Notice interesting fuel steps */
2354 notice_lite_change(o_ptr);
2359 * Unlite the area (radius 10) around player and
2360 * do 50 points damage to every affected monster
2362 unlite_area(50, 10);
2365 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2367 bool pet = one_in_(3);
2368 BIT_FLAGS mode = PM_ALLOW_GROUP;
2370 if (pet) mode |= PM_FORCE_PET;
2371 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2373 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2375 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2376 disturb(FALSE, TRUE);
2380 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2382 disturb(FALSE, TRUE);
2383 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2386 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2388 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2390 if (!lose_mutation(0))
2391 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2393 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2395 disturb(FALSE, TRUE);
2396 msg_print(_("非物質化した!", "You feel insubstantial!"));
2399 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2401 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2405 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2407 int which_stat = randint0(A_MAX);
2408 int sustained = FALSE;
2413 if (p_ptr->sustain_str) sustained = TRUE;
2416 if (p_ptr->sustain_int) sustained = TRUE;
2419 if (p_ptr->sustain_wis) sustained = TRUE;
2422 if (p_ptr->sustain_dex) sustained = TRUE;
2425 if (p_ptr->sustain_con) sustained = TRUE;
2428 if (p_ptr->sustain_chr) sustained = TRUE;
2431 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2437 disturb(FALSE, TRUE);
2438 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2440 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2443 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2445 bool pet = one_in_(5);
2446 BIT_FLAGS mode = PM_ALLOW_GROUP;
2448 if (pet) mode |= PM_FORCE_PET;
2449 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2451 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2453 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2454 disturb(FALSE, TRUE);
2457 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2459 if (p_ptr->tim_esp > 0)
2461 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2462 set_tim_esp(0, TRUE);
2466 msg_print(_("精神が広がった!", "Your mind expands!"));
2467 set_tim_esp(p_ptr->lev, FALSE);
2470 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2472 disturb(FALSE, TRUE);
2473 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2475 set_food(PY_FOOD_WEAK);
2476 if (music_singing_any()) stop_singing(p_ptr);
2477 if (hex_spelling_any()) stop_hex_spell_all();
2480 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2485 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2487 int danger_amount = 0;
2488 MONSTER_IDX monster;
2490 for (monster = 0; monster < current_floor_ptr->m_max; monster++)
2492 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2493 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2494 if (!monster_is_valid(m_ptr)) continue;
2496 if (r_ptr->level >= p_ptr->lev)
2498 danger_amount += r_ptr->level - p_ptr->lev + 1;
2502 if (danger_amount > 100)
2503 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2504 else if (danger_amount > 50)
2505 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2506 else if (danger_amount > 20)
2507 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2508 else if (danger_amount > 10)
2509 msg_print(_("心配な気がする!", "You feel paranoid!"));
2510 else if (danger_amount > 5)
2511 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2513 msg_print(_("寂しい気がする。", "You feel lonely."));
2516 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2518 disturb(FALSE, TRUE);
2519 msg_print(_("無敵な気がする!", "You feel invincible!"));
2521 (void)set_invuln(randint1(8) + 8, FALSE);
2524 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2526 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2530 HIT_POINT healing = p_ptr->csp;
2531 if (healing > wounds) healing = wounds;
2534 p_ptr->csp -= healing;
2535 p_ptr->redraw |= (PR_HP | PR_MANA);
2539 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2541 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2545 HIT_POINT healing = p_ptr->chp;
2546 if (healing > wounds) healing = wounds;
2548 p_ptr->csp += healing;
2549 p_ptr->redraw |= (PR_HP | PR_MANA);
2550 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2554 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2556 INVENTORY_IDX slot = 0;
2557 object_type *o_ptr = NULL;
2559 disturb(FALSE, TRUE);
2560 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2561 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2564 if (has_melee_weapon(INVEN_RARM))
2567 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
2569 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2571 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2575 else if (has_melee_weapon(INVEN_LARM))
2577 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2580 if (slot && !object_is_cursed(o_ptr))
2582 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2583 inven_drop(slot, 1);
2590 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2591 * / Handle curse effects once every 10 game turns
2594 static void process_world_aux_curse(void)
2596 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2599 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2600 * can actually be useful!
2602 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2604 GAME_TEXT o_name[MAX_NLEN];
2606 int i, i_keep = 0, count = 0;
2608 /* Scan the equipment with random teleport ability */
2609 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2611 BIT_FLAGS flgs[TR_FLAG_SIZE];
2612 o_ptr = &p_ptr->inventory_list[i];
2613 if (!o_ptr->k_idx) continue;
2615 object_flags(o_ptr, flgs);
2617 if (have_flag(flgs, TR_TELEPORT))
2619 /* {.} will stop random teleportation. */
2620 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2623 if (one_in_(count)) i_keep = i;
2628 o_ptr = &p_ptr->inventory_list[i_keep];
2629 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2630 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2631 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2633 disturb(FALSE, TRUE);
2634 teleport_player(50, 0L);
2638 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2639 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2640 disturb(TRUE, TRUE);
2643 /* Make a chainsword noise */
2644 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2647 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2649 disturb(FALSE, FALSE);
2652 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2655 (void)activate_ty_curse(FALSE, &count);
2657 /* Handle experience draining */
2658 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2660 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2661 if (p_ptr->exp < 0) p_ptr->exp = 0;
2662 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2663 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2666 /* Add light curse (Later) */
2667 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2669 BIT_FLAGS new_curse;
2672 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2674 new_curse = get_curse(0, o_ptr);
2675 if (!(o_ptr->curse_flags & new_curse))
2677 GAME_TEXT o_name[MAX_NLEN];
2679 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2681 o_ptr->curse_flags |= new_curse;
2682 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2684 o_ptr->feeling = FEEL_NONE;
2686 p_ptr->update |= (PU_BONUS);
2689 /* Add heavy curse (Later) */
2690 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2692 BIT_FLAGS new_curse;
2695 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2697 new_curse = get_curse(1, o_ptr);
2698 if (!(o_ptr->curse_flags & new_curse))
2700 GAME_TEXT o_name[MAX_NLEN];
2702 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2704 o_ptr->curse_flags |= new_curse;
2705 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2706 o_ptr->feeling = FEEL_NONE;
2708 p_ptr->update |= (PU_BONUS);
2712 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2714 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)))
2716 GAME_TEXT o_name[MAX_NLEN];
2718 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2719 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2720 disturb(FALSE, TRUE);
2724 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2726 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)))
2728 GAME_TEXT o_name[MAX_NLEN];
2730 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2731 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2732 disturb(FALSE, TRUE);
2736 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2738 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2739 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2741 GAME_TEXT o_name[MAX_NLEN];
2743 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2744 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2745 disturb(FALSE, TRUE);
2749 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2751 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2752 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2754 GAME_TEXT o_name[MAX_NLEN];
2756 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2757 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2758 disturb(FALSE, TRUE);
2761 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2763 if (!p_ptr->resist_fear)
2765 disturb(FALSE, TRUE);
2766 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2767 set_afraid(p_ptr->afraid + 13 + randint1(26));
2770 /* Teleport player */
2771 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2773 disturb(FALSE, TRUE);
2775 /* Teleport player */
2776 teleport_player(40, TELEPORT_PASSIVE);
2778 /* Handle HP draining */
2779 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2781 GAME_TEXT o_name[MAX_NLEN];
2783 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2784 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2785 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2787 /* Handle mana draining */
2788 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2790 GAME_TEXT o_name[MAX_NLEN];
2792 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2793 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2794 p_ptr->csp -= MIN(p_ptr->lev, 50);
2798 p_ptr->csp_frac = 0;
2800 p_ptr->redraw |= PR_MANA;
2804 /* Rarely, take damage from the Jewel of Judgement */
2805 if (one_in_(999) && !p_ptr->anti_magic)
2807 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2809 if (o_ptr->name1 == ART_JUDGE)
2811 if (object_is_known(o_ptr))
2812 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2814 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2815 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2822 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2823 * / Handle recharging objects once every 10 game turns
2826 static void process_world_aux_recharge(void)
2831 /* Process equipment */
2832 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2834 /* Get the object */
2835 object_type *o_ptr = &p_ptr->inventory_list[i];
2836 if (!o_ptr->k_idx) continue;
2838 /* Recharge activatable objects */
2839 if (o_ptr->timeout > 0)
2844 /* Notice changes */
2845 if (!o_ptr->timeout)
2847 recharged_notice(o_ptr);
2853 /* Notice changes */
2856 p_ptr->window |= (PW_EQUIP);
2861 * Recharge rods. Rods now use timeout to control charging status,
2862 * and each charging rod in a stack decreases the stack's timeout by
2863 * one per current_world_ptr->game_turn. -LM-
2865 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2867 object_type *o_ptr = &p_ptr->inventory_list[i];
2868 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2869 if (!o_ptr->k_idx) continue;
2871 /* Examine all charging rods or stacks of charging rods. */
2872 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2874 /* Determine how many rods are charging. */
2875 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2876 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2878 /* Decrease timeout by that number. */
2879 o_ptr->timeout -= temp;
2881 /* Boundary control. */
2882 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2884 /* Notice changes, provide message if object is inscribed. */
2885 if (!(o_ptr->timeout))
2887 recharged_notice(o_ptr);
2891 /* One of the stack of rod is charged */
2892 else if (o_ptr->timeout % k_ptr->pval)
2899 /* Notice changes */
2902 p_ptr->window |= (PW_INVEN);
2906 /* Process objects on floor */
2907 for (i = 1; i < current_floor_ptr->o_max; i++)
2909 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2911 if (!OBJECT_IS_VALID(o_ptr)) continue;
2913 /* Recharge rods on the ground. No messages. */
2914 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2917 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2919 /* Boundary control. */
2920 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2927 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2928 * / Handle involuntary movement once every 10 game turns
2931 static void process_world_aux_movement(void)
2933 /* Delayed Word-of-Recall */
2934 if (p_ptr->word_recall)
2937 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2938 * The player is yanked up/down as soon as
2939 * he loads the autosaved game.
2941 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2942 do_cmd_save_game(TRUE);
2944 /* Count down towards recall */
2945 p_ptr->word_recall--;
2947 p_ptr->redraw |= (PR_STATUS);
2949 /* Activate the recall */
2950 if (!p_ptr->word_recall)
2953 disturb(FALSE, TRUE);
2955 /* Determine the level */
2956 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2958 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2960 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2962 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2964 current_floor_ptr->dun_level = 0;
2965 p_ptr->dungeon_idx = 0;
2967 leave_quest_check();
2968 leave_tower_check();
2970 p_ptr->inside_quest = 0;
2972 p_ptr->leaving = TRUE;
2976 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2978 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2981 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2984 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2985 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2987 /* Nightmare mode makes recall more dangerous */
2988 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2990 if (current_floor_ptr->dun_level < 50)
2992 current_floor_ptr->dun_level *= 2;
2994 else if (current_floor_ptr->dun_level < 99)
2996 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2998 else if (current_floor_ptr->dun_level > 100)
3000 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
3004 if (p_ptr->wild_mode)
3006 p_ptr->wilderness_y = p_ptr->y;
3007 p_ptr->wilderness_x = p_ptr->x;
3011 /* Save player position */
3012 p_ptr->oldpx = p_ptr->x;
3013 p_ptr->oldpy = p_ptr->y;
3015 p_ptr->wild_mode = FALSE;
3018 * Clear all saved floors
3019 * and create a first saved floor
3021 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3022 p_ptr->leaving = TRUE;
3024 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
3028 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3030 quest_type* const q_ptr = &quest[i];
3033 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3034 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3035 (q_ptr->level < current_floor_ptr->dun_level))
3037 q_ptr->status = QUEST_STATUS_FAILED;
3038 q_ptr->complev = (byte)p_ptr->lev;
3040 q_ptr->comptime = current_world_ptr->play_time;
3041 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3047 sound(SOUND_TPLEVEL);
3052 /* Delayed Alter reality */
3053 if (p_ptr->alter_reality)
3055 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3056 do_cmd_save_game(TRUE);
3058 /* Count down towards alter */
3059 p_ptr->alter_reality--;
3061 p_ptr->redraw |= (PR_STATUS);
3063 /* Activate the alter reality */
3064 if (!p_ptr->alter_reality)
3067 disturb(FALSE, TRUE);
3069 /* Determine the level */
3070 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3072 msg_print(_("世界が変わった!", "The world changes!"));
3075 * Clear all saved floors
3076 * and create a first saved floor
3078 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3079 p_ptr->leaving = TRUE;
3083 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3086 sound(SOUND_TPLEVEL);
3092 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3093 * / Handle certain things once every 10 game turns
3096 static void process_world(void)
3100 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3101 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3102 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3104 extract_day_hour_min(&day, &hour, &min);
3106 /* Update dungeon feeling, and announce it if changed */
3107 update_dungeon_feeling();
3109 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3110 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3112 current_floor_ptr->dun_level = 0;
3113 p_ptr->dungeon_idx = 0;
3114 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3115 p_ptr->inside_arena = FALSE;
3116 p_ptr->wild_mode = FALSE;
3117 p_ptr->leaving = TRUE;
3120 /*** Check monster arena ***/
3121 if (p_ptr->inside_battle && !p_ptr->leaving)
3127 /* Count all hostile monsters */
3128 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3129 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3131 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3133 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3136 win_m_idx = g_ptr->m_idx;
3140 if (number_mon == 0)
3142 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3144 p_ptr->energy_need = 0;
3145 update_gambling_monsters();
3147 else if ((number_mon-1) == 0)
3149 GAME_TEXT m_name[MAX_NLEN];
3150 monster_type *wm_ptr;
3152 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3154 monster_desc(m_name, wm_ptr, 0);
3155 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3158 if (win_m_idx == (sel_monster+1))
3160 msg_print(_("おめでとうございます。", "Congratulations."));
3161 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3162 p_ptr->au += battle_odds;
3166 msg_print(_("残念でした。", "You lost gold."));
3169 p_ptr->energy_need = 0;
3170 update_gambling_monsters();
3172 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3174 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3175 p_ptr->au += kakekin;
3177 p_ptr->energy_need = 0;
3178 update_gambling_monsters();
3182 /* Every 10 game turns */
3183 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3185 /*** Attempt timed autosave ***/
3186 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3188 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3189 do_cmd_save_game(TRUE);
3192 if (current_floor_ptr->monster_noise && !ignore_unview)
3194 msg_print(_("何かが聞こえた。", "You hear noise."));
3197 /*** Handle the wilderness/town (sunshine) ***/
3199 /* While in town/wilderness */
3200 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3202 /* Hack -- Daybreak/Nighfall in town */
3203 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3207 /* Check for dawn */
3208 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3210 if (dawn) day_break();
3216 /* While in the dungeon (vanilla_town or lite_town mode only) */
3217 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3219 /*** Shuffle the Storekeepers ***/
3221 /* Chance is only once a day (while in dungeon) */
3222 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3224 /* Sometimes, shuffle the shop-keepers */
3225 if (one_in_(STORE_SHUFFLE))
3230 /* Pick a random shop (except home and museum) */
3233 n = randint0(MAX_STORES);
3235 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3237 /* Check every feature */
3238 for (i = 1; i < max_f_idx; i++)
3240 feature_type *f_ptr = &f_info[i];
3242 /* Skip empty index */
3243 if (!f_ptr->name) continue;
3245 /* Skip non-store features */
3246 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3248 /* Verify store type */
3249 if (f_ptr->subtype == n)
3251 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3264 /*** Process the monsters ***/
3266 /* Check for creature generation. */
3267 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3268 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3270 /* Make a new monster */
3271 (void)alloc_monster(MAX_SIGHT + 5, 0);
3274 /* Hack -- Check for creature regeneration */
3275 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3276 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3278 if (!p_ptr->leaving)
3282 /* Hack -- Process the counters of monsters if needed */
3283 for (i = 0; i < MAX_MTIMED; i++)
3285 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3293 if (min != prev_min)
3295 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3296 determine_today_mon(FALSE);
3301 * Nightmare mode activates the TY_CURSE at midnight
3302 * Require exact minute -- Don't activate multiple times in a minute
3305 if (ironman_nightmare && (min != prev_min))
3308 /* Every 15 minutes after 11:00 pm */
3309 if ((hour == 23) && !(min % 15))
3311 disturb(FALSE, TRUE);
3316 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3320 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3324 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3328 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3333 /* TY_CURSE activates at midnight! */
3337 disturb(TRUE, TRUE);
3338 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3340 if (p_ptr->wild_mode)
3342 /* Go into large wilderness view */
3343 p_ptr->oldpy = randint1(MAX_HGT - 2);
3344 p_ptr->oldpx = randint1(MAX_WID - 2);
3345 change_wild_mode(TRUE);
3347 /* Give first move to monsters */
3348 take_turn(p_ptr, 100);
3352 p_ptr->invoking_midnight_curse = TRUE;
3358 /* Check the Food */
3359 process_world_aux_digestion();
3361 /* Process timed damage and regeneration */
3362 process_world_aux_hp_and_sp();
3364 /* Process timeout */
3365 process_world_aux_timeout();
3368 process_world_aux_light();
3370 /* Process mutation effects */
3371 process_world_aux_mutation();
3373 /* Process curse effects */
3374 process_world_aux_curse();
3376 /* Process recharging */
3377 process_world_aux_recharge();
3379 /* Feel the p_ptr->inventory_list */
3383 /* Involuntary Movement */
3384 process_world_aux_movement();
3388 * @brief ウィザードモードへの導入処理
3389 * / Verify use of "wizard" mode
3390 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3392 static bool enter_wizard_mode(void)
3394 /* Ask first time */
3395 if (!p_ptr->noscore)
3397 /* Wizard mode is not permitted */
3398 if (!allow_debug_opts || arg_wizard)
3400 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3404 /* Mention effects */
3405 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3406 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3409 /* Verify request */
3410 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3415 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3417 p_ptr->noscore |= 0x0002;
3428 * @brief デバッグコマンドへの導入処理
3429 * / Verify use of "debug" commands
3430 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3432 static bool enter_debug_mode(void)
3434 /* Ask first time */
3435 if (!p_ptr->noscore)
3437 /* Debug mode is not permitted */
3438 if (!allow_debug_opts)
3440 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3444 /* Mention effects */
3445 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3446 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3450 /* Verify request */
3451 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3456 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3458 p_ptr->noscore |= 0x0008;
3466 * Hack -- Declare the Debug Routines
3468 extern void do_cmd_debug(void);
3470 #endif /* ALLOW_WIZARD */
3476 * @brief ボーグコマンドへの導入処理
3477 * / Verify use of "borg" commands
3478 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3480 static bool enter_borg_mode(void)
3482 /* Ask first time */
3483 if (!(p_ptr->noscore & 0x0010))
3485 /* Mention effects */
3486 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3487 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3491 /* Verify request */
3492 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3497 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3499 p_ptr->noscore |= 0x0010;
3507 * Hack -- Declare the Ben Borg
3509 extern void do_cmd_borg(void);
3511 #endif /* ALLOW_BORG */
3515 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3516 * / Parse and execute the current command Give "Warning" on illegal commands.
3517 * @todo Make some "blocks"
3520 static void process_command(void)
3522 COMMAND_CODE old_now_message = now_message;
3524 /* Handle repeating the last command */
3530 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3531 p_ptr->reset_concent = TRUE;
3533 /* Parse the command */
3534 switch (command_cmd)
3550 /*** Wizard Commands ***/
3552 /* Toggle Wizard Mode */
3557 p_ptr->wizard = FALSE;
3558 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3560 else if (enter_wizard_mode())
3562 p_ptr->wizard = TRUE;
3563 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3565 p_ptr->update |= (PU_MONSTERS);
3567 /* Redraw "title" */
3568 p_ptr->redraw |= (PR_TITLE);
3576 /* Special "debug" commands */
3579 /* Enter debug mode */
3580 if (enter_debug_mode())
3587 #endif /* ALLOW_WIZARD */
3592 /* Special "borg" commands */
3595 /* Enter borg mode */
3596 if (enter_borg_mode())
3598 if (!p_ptr->wild_mode) do_cmd_borg();
3604 #endif /* ALLOW_BORG */
3608 /*** Inventory Commands ***/
3610 /* Wear/wield equipment */
3613 if (!p_ptr->wild_mode) do_cmd_wield();
3617 /* Take off equipment */
3620 if (!p_ptr->wild_mode) do_cmd_takeoff();
3627 if (!p_ptr->wild_mode) do_cmd_drop();
3631 /* Destroy an item */
3638 /* Equipment list */
3645 /* Inventory list */
3653 /*** Various commands ***/
3655 /* Identify an object */
3662 /* Hack -- toggle windows */
3665 toggle_inven_equip();
3670 /*** Standard "Movement" Commands ***/
3675 if (!p_ptr->wild_mode) do_cmd_alter();
3682 if (!p_ptr->wild_mode) do_cmd_tunnel();
3686 /* Move (usually pick up things) */
3693 /* Move (usually do not pick up) */
3701 /*** Running, Resting, Searching, Staying */
3703 /* Begin Running -- Arg is Max Distance */
3706 if (!p_ptr->wild_mode) do_cmd_run();
3710 /* Stay still (usually pick things up) */
3713 do_cmd_stay(always_pickup);
3717 /* Stay still (usually do not pick up) */
3720 do_cmd_stay(!always_pickup);
3724 /* Rest -- Arg is time */
3731 /* Search for traps/doors */
3738 /* Toggle search mode */
3741 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3742 else set_action(ACTION_SEARCH);
3747 /*** Stairs and Doors and Chests and Traps ***/
3750 case SPECIAL_KEY_STORE:
3756 /* Enter building -KMW- */
3757 case SPECIAL_KEY_BUILDING:
3763 /* Enter quest level -KMW- */
3764 case SPECIAL_KEY_QUEST:
3770 /* Go up staircase */
3773 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3775 if (vanilla_town) break;
3777 if (p_ptr->ambush_flag)
3779 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3783 if (p_ptr->food < PY_FOOD_WEAK)
3785 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3789 change_wild_mode(FALSE);
3796 /* Go down staircase */
3799 if (p_ptr->wild_mode)
3800 change_wild_mode(FALSE);
3806 /* Open a door or chest */
3820 /* Jam a door with spikes */
3834 /* Disarm a trap or chest */
3842 /*** Magic and Prayers ***/
3844 /* Gain new spells/prayers */
3847 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3848 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3849 else if (p_ptr->pclass == CLASS_SAMURAI)
3850 do_cmd_gain_hissatsu();
3851 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3852 import_magic_device();
3861 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3862 (p_ptr->pclass == CLASS_BERSERKER) ||
3863 (p_ptr->pclass == CLASS_NINJA) ||
3864 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3865 ) do_cmd_mind_browse();
3866 else if (p_ptr->pclass == CLASS_SMITH)
3868 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3869 do_cmd_magic_eater(TRUE, FALSE);
3870 else if (p_ptr->pclass == CLASS_SNIPER)
3871 do_cmd_snipe_browse();
3872 else do_cmd_browse();
3880 if (!p_ptr->wild_mode)
3882 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3884 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3886 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))
3888 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3891 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3893 concptr which_power = _("魔法", "magic");
3894 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3895 which_power = _("超能力", "psionic powers");
3896 else if (p_ptr->pclass == CLASS_IMITATOR)
3897 which_power = _("ものまね", "imitation");
3898 else if (p_ptr->pclass == CLASS_SAMURAI)
3899 which_power = _("必殺剣", "hissatsu");
3900 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3901 which_power = _("鏡魔法", "mirror magic");
3902 else if (p_ptr->pclass == CLASS_NINJA)
3903 which_power = _("忍術", "ninjutsu");
3904 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3905 which_power = _("祈り", "prayer");
3907 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3910 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3912 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3917 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3918 (p_ptr->pclass == CLASS_BERSERKER) ||
3919 (p_ptr->pclass == CLASS_NINJA) ||
3920 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3923 else if (p_ptr->pclass == CLASS_IMITATOR)
3925 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3926 do_cmd_magic_eater(FALSE, FALSE);
3927 else if (p_ptr->pclass == CLASS_SAMURAI)
3929 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3930 do_cmd_cast_learned();
3931 else if (p_ptr->pclass == CLASS_SMITH)
3933 else if (p_ptr->pclass == CLASS_SNIPER)
3942 /* Issue a pet command */
3949 /*** Use various objects ***/
3951 /* Inscribe an object */
3958 /* Uninscribe an object */
3961 do_cmd_uninscribe();
3965 /* Activate an artifact */
3979 /* Fuel your lantern/torch */
3989 do_cmd_fire(SP_NONE);
3996 do_cmd_throw(1, FALSE, -1);
4010 if (use_command && rogue_like_commands)
4021 /* Quaff a potion */
4024 do_cmd_quaff_potion();
4031 do_cmd_read_scroll();
4038 if (use_command && !rogue_like_commands)
4045 /* Use racial power */
4048 do_cmd_racial_power();
4053 /*** Looking at Things (nearby or on map) ***/
4055 /* Full dungeon map */
4062 /* Locate player on map */
4076 /* Target monster or location */
4085 /*** Help and Such ***/
4094 /* Identify symbol */
4097 do_cmd_query_symbol();
4101 /* Character description */
4104 do_cmd_player_status();
4109 /*** System Commands ***/
4111 /* Hack -- User interface */
4118 /* Single line from a pref file */
4127 do_cmd_reload_autopick();
4133 do_cmd_edit_autopick();
4137 /* Interact with macros */
4144 /* Interact with visuals */
4152 /* Interact with colors */
4160 /* Interact with options */
4164 (void)combine_and_reorder_home(STORE_HOME);
4169 /*** Misc Commands ***/
4185 /* Repeat level feeling */
4192 /* Show previous message */
4195 do_cmd_message_one();
4199 /* Show previous messages */
4202 do_cmd_messages(old_now_message);
4206 /* Show quest status -KMW- */
4209 do_cmd_checkquest();
4213 /* Redraw the screen */
4216 now_message = old_now_message;
4221 #ifndef VERIFY_SAVEFILE
4223 /* Hack -- Save and don't quit */
4226 do_cmd_save_game(FALSE);
4230 #endif /* VERIFY_SAVEFILE */
4240 case SPECIAL_KEY_QUIT:
4242 do_cmd_save_and_exit();
4246 /* Quit (commit suicide) */
4259 /* Check artifacts, uniques, objects */
4266 /* Load "screen dump" */
4269 do_cmd_load_screen();
4273 /* Save "screen dump" */
4276 do_cmd_save_screen();
4280 /* Record/stop "Movie" */
4283 prepare_movie_hooks();
4287 /* Make random artifact list */
4290 spoil_random_artifact("randifact.txt");
4297 if (!p_ptr->wild_mode) do_cmd_travel();
4298 if (p_ptr->special_defense & KATA_MUSOU)
4300 set_action(ACTION_NONE);
4306 /* Hack -- Unknown command */
4309 if (flush_failure) flush();
4313 sound(SOUND_ILLEGAL);
4314 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4319 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4325 if (!p_ptr->energy_use && !now_message)
4326 now_message = old_now_message;
4330 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4333 static void pack_overflow(void)
4335 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
4337 GAME_TEXT o_name[MAX_NLEN];
4340 /* Is auto-destroy done? */
4341 update_creature(p_ptr);
4342 if (!p_ptr->inventory_list[INVEN_PACK].k_idx) return;
4344 /* Access the slot to be dropped */
4345 o_ptr = &p_ptr->inventory_list[INVEN_PACK];
4347 disturb(FALSE, TRUE);
4350 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4351 object_desc(o_name, o_ptr, 0);
4353 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4355 /* Drop it (carefully) near the player */
4356 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4358 /* Modify, Describe, Optimize */
4359 inven_item_increase(INVEN_PACK, -255);
4360 inven_item_describe(INVEN_PACK);
4361 inven_item_optimize(INVEN_PACK);
4368 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4371 static void process_upkeep_with_speed(void)
4373 /* Give the player some energy */
4374 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4376 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4379 /* No current_world_ptr->game_turn yet */
4380 if (p_ptr->enchant_energy_need > 0) return;
4382 while (p_ptr->enchant_energy_need <= 0)
4384 /* Handle the player song */
4385 if (!load) check_music();
4387 /* Hex - Handle the hex spells */
4388 if (!load) check_hex();
4389 if (!load) revenge_spell();
4391 /* There is some randomness of needed energy */
4392 p_ptr->enchant_energy_need += ENERGY_NEED();
4396 static void process_fishing(void)
4398 Term_xtra(TERM_XTRA_DELAY, 10);
4402 bool success = FALSE;
4403 get_mon_num_prep(monster_is_fishing_target, NULL);
4404 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);
4406 if (r_idx && one_in_(2))
4409 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4410 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4411 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4413 GAME_TEXT m_name[MAX_NLEN];
4414 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4415 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4421 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4423 disturb(FALSE, TRUE);
4428 * @brief プレイヤーの行動処理 / Process the player
4431 * Notice the annoying code to handle "pack overflow", which\n
4432 * must come first just in case somebody manages to corrupt\n
4433 * the savefiles by clever use of menu commands or something.\n
4435 static void process_player(void)
4439 /*** Apply energy ***/
4441 if (p_ptr->hack_mutation)
4443 msg_print(_("何か変わった気がする!", "You feel different!"));
4445 (void)gain_mutation(p_ptr, 0);
4446 p_ptr->hack_mutation = FALSE;
4449 if (p_ptr->invoking_midnight_curse)
4452 activate_ty_curse(FALSE, &count);
4453 p_ptr->invoking_midnight_curse = FALSE;
4456 if (p_ptr->inside_battle)
4458 for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4460 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4462 if (!monster_is_valid(m_ptr)) continue;
4464 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4465 update_monster(m_idx, FALSE);
4470 /* Give the player some energy */
4471 else if (!(load && p_ptr->energy_need <= 0))
4473 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4476 /* No current_world_ptr->game_turn yet */
4477 if (p_ptr->energy_need > 0) return;
4478 if (!command_rep) prt_time();
4480 /*** Check for interupts ***/
4482 /* Complete resting */
4483 if (p_ptr->resting < 0)
4486 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4489 if ((p_ptr->chp == p_ptr->mhp) &&
4490 (p_ptr->csp >= p_ptr->msp))
4492 set_action(ACTION_NONE);
4496 /* Complete resting */
4497 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4500 if ((p_ptr->chp == p_ptr->mhp) &&
4501 (p_ptr->csp >= p_ptr->msp) &&
4502 !p_ptr->blind && !p_ptr->confused &&
4503 !p_ptr->poisoned && !p_ptr->afraid &&
4504 !p_ptr->stun && !p_ptr->cut &&
4505 !p_ptr->slow && !p_ptr->paralyzed &&
4506 !p_ptr->image && !p_ptr->word_recall &&
4507 !p_ptr->alter_reality)
4509 set_action(ACTION_NONE);
4514 if (p_ptr->action == ACTION_FISH) process_fishing();
4516 /* Handle "abort" */
4519 /* Check for "player abort" (semi-efficiently for resting) */
4520 if (p_ptr->running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4525 /* Check for a key */
4528 flush(); /* Flush input */
4530 disturb(FALSE, TRUE);
4532 /* Hack -- Show a Message */
4533 msg_print(_("中断しました。", "Canceled."));
4538 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4540 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4541 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4543 if (MON_CSLEEP(m_ptr))
4545 GAME_TEXT m_name[MAX_NLEN];
4548 (void)set_monster_csleep(p_ptr->riding, 0);
4549 monster_desc(m_name, m_ptr, 0);
4550 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4553 if (MON_STUNNED(m_ptr))
4555 /* Hack -- Recover from stun */
4556 if (set_monster_stunned(p_ptr->riding,
4557 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4559 GAME_TEXT m_name[MAX_NLEN];
4560 monster_desc(m_name, m_ptr, 0);
4561 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4565 if (MON_CONFUSED(m_ptr))
4567 /* Hack -- Recover from confusion */
4568 if (set_monster_confused(p_ptr->riding,
4569 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4571 GAME_TEXT m_name[MAX_NLEN];
4572 monster_desc(m_name, m_ptr, 0);
4573 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4577 if (MON_MONFEAR(m_ptr))
4579 /* Hack -- Recover from fear */
4580 if(set_monster_monfear(p_ptr->riding,
4581 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4583 GAME_TEXT m_name[MAX_NLEN];
4584 monster_desc(m_name, m_ptr, 0);
4585 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4595 if (p_ptr->lightspeed)
4597 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4599 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4601 if(P_PTR_KI < 40) P_PTR_KI = 0;
4602 else P_PTR_KI -= 40;
4603 p_ptr->update |= (PU_BONUS);
4605 if (p_ptr->action == ACTION_LEARN)
4608 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4610 /* Convert the unit (1/2^16) to (1/2^32) */
4611 s64b_LSHIFT(cost, cost_frac, 16);
4613 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4617 p_ptr->csp_frac = 0;
4618 set_action(ACTION_NONE);
4623 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4625 p_ptr->redraw |= PR_MANA;
4628 if (p_ptr->special_defense & KATA_MASK)
4630 if (p_ptr->special_defense & KATA_MUSOU)
4634 set_action(ACTION_NONE);
4639 p_ptr->redraw |= (PR_MANA);
4644 /*** Handle actual user input ***/
4646 /* Repeat until out of energy */
4647 while (p_ptr->energy_need <= 0)
4649 p_ptr->window |= PW_PLAYER;
4650 p_ptr->sutemi = FALSE;
4651 p_ptr->counter = FALSE;
4652 p_ptr->now_damaged = FALSE;
4656 /* Place the cursor on the player */
4657 move_cursor_relative(p_ptr->y, p_ptr->x);
4659 /* Refresh (optional) */
4660 if (fresh_before) Term_fresh();
4662 /* Hack -- Pack Overflow */
4665 /* Hack -- cancel "lurking browse mode" */
4666 if (!command_new) command_see = FALSE;
4668 /* Assume free current_world_ptr->game_turn */
4671 if (p_ptr->inside_battle)
4673 /* Place the cursor on the player */
4674 move_cursor_relative(p_ptr->y, p_ptr->x);
4676 command_cmd = SPECIAL_KEY_BUILDING;
4678 /* Process the command */
4682 /* Paralyzed or Knocked Out */
4683 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4685 take_turn(p_ptr, 100);
4689 else if (p_ptr->action == ACTION_REST)
4692 if (p_ptr->resting > 0)
4694 /* Reduce rest count */
4697 if (!p_ptr->resting) set_action(ACTION_NONE);
4698 p_ptr->redraw |= (PR_STATE);
4701 take_turn(p_ptr, 100);
4705 else if (p_ptr->action == ACTION_FISH)
4707 take_turn(p_ptr, 100);
4711 else if (p_ptr->running)
4719 else if (travel.run)
4726 /* Repeated command */
4727 else if (command_rep)
4729 /* Count this execution */
4732 p_ptr->redraw |= (PR_STATE);
4735 /* Hack -- Assume messages were seen */
4738 /* Clear the top line */
4741 /* Process the command */
4745 /* Normal command */
4748 /* Place the cursor on the player */
4749 move_cursor_relative(p_ptr->y, p_ptr->x);
4752 /* Get a command (normal) */
4753 request_command(FALSE);
4756 /* Process the command */
4760 /* Hack -- Pack Overflow */
4766 if (p_ptr->energy_use)
4768 /* Use some energy */
4769 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4771 /* The Randomness is irrelevant */
4772 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4776 /* There is some randomness of needed energy */
4777 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4780 /* Hack -- constant hallucination */
4781 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4783 /* Shimmer multi-hued monsters */
4784 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4786 monster_type *m_ptr;
4787 monster_race *r_ptr;
4789 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4790 if (!monster_is_valid(m_ptr)) continue;
4792 /* Skip unseen monsters */
4793 if (!m_ptr->ml) continue;
4795 /* Access the monster race */
4796 r_ptr = &r_info[m_ptr->ap_r_idx];
4798 /* Skip non-multi-hued monsters */
4799 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4802 /* Redraw regardless */
4803 lite_spot(m_ptr->fy, m_ptr->fx);
4807 /* Handle monster detection */
4808 if (repair_monsters)
4810 /* Reset the flag */
4811 repair_monsters = FALSE;
4813 /* Rotate detection flags */
4814 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4816 monster_type *m_ptr;
4817 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4818 if (!monster_is_valid(m_ptr)) continue;
4820 /* Nice monsters get mean */
4821 if (m_ptr->mflag & MFLAG_NICE)
4823 /* Nice monsters get mean */
4824 m_ptr->mflag &= ~(MFLAG_NICE);
4827 /* Handle memorized monsters */
4828 if (m_ptr->mflag2 & MFLAG2_MARK)
4830 /* Maintain detection */
4831 if (m_ptr->mflag2 & MFLAG2_SHOW)
4834 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4836 /* Still need repairs */
4837 repair_monsters = TRUE;
4840 /* Remove detection */
4844 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4846 /* Assume invisible */
4848 update_monster(m_idx, FALSE);
4850 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4851 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4853 /* Redraw regardless */
4854 lite_spot(m_ptr->fy, m_ptr->fx);
4859 if (p_ptr->pclass == CLASS_IMITATOR)
4862 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4865 for (j = 0; j < p_ptr->mane_num; j++)
4867 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4868 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4871 p_ptr->new_mane = FALSE;
4872 p_ptr->redraw |= (PR_IMITATION);
4874 if (p_ptr->action == ACTION_LEARN)
4876 p_ptr->new_mane = FALSE;
4877 p_ptr->redraw |= (PR_STATE);
4880 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4883 p_ptr->redraw |= (PR_MAP);
4884 p_ptr->update |= (PU_MONSTERS);
4885 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4887 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4889 p_ptr->timewalk = FALSE;
4890 p_ptr->energy_need = ENERGY_NEED();
4896 /* Hack -- notice death */
4897 if (!p_ptr->playing || p_ptr->is_dead)
4899 p_ptr->timewalk = FALSE;
4904 if (p_ptr->energy_use && p_ptr->reset_concent) reset_concentration(TRUE);
4906 /* Handle "leaving" */
4907 if (p_ptr->leaving) break;
4910 /* Update scent trail */
4915 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4919 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4920 * ゲームを終了するかのいずれかまでループする。
4923 * This function will not exit until the level is completed,\n
4924 * the user dies, or the game is terminated.\n
4927 static void dungeon(bool load_game)
4931 /* Set the base level */
4932 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4934 /* Reset various flags */
4935 current_world_ptr->is_loading_now = FALSE;
4938 p_ptr->leaving = FALSE;
4940 /* Reset the "command" vars */
4943 #if 0 /* Don't reset here --- It's used for Arena */
4952 /* Cancel the target */
4954 p_ptr->pet_t_m_idx = 0;
4955 p_ptr->riding_t_m_idx = 0;
4956 p_ptr->ambush_flag = FALSE;
4958 /* Cancel the health bar */
4961 /* Check visual effects */
4962 repair_monsters = TRUE;
4963 repair_objects = TRUE;
4966 disturb(TRUE, TRUE);
4968 /* Get index of current quest (if any) */
4969 quest_num = quest_number(current_floor_ptr->dun_level);
4971 /* Inside a quest? */
4974 /* Mark the quest monster */
4975 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4978 /* Track maximum player level */
4979 if (p_ptr->max_plv < p_ptr->lev)
4981 p_ptr->max_plv = p_ptr->lev;
4985 /* Track maximum dungeon level (if not in quest -KMW-) */
4986 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4988 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4989 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4992 (void)calculate_upkeep();
4994 /* Validate the panel */
4995 panel_bounds_center();
4997 /* Verify the panel */
5003 /* Enter "xtra" mode */
5004 current_world_ptr->character_xtra = TRUE;
5006 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5007 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5008 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);
5012 /* Leave "xtra" mode */
5013 current_world_ptr->character_xtra = FALSE;
5015 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5016 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5020 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5021 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5022 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5024 if (p_ptr->inside_battle)
5028 p_ptr->energy_need = 0;
5029 update_gambling_monsters();
5033 msg_print(_("試合開始!", "Ready..Fight!"));
5038 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5039 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5041 /* Hack -- notice death or departure */
5042 if (!p_ptr->playing || p_ptr->is_dead) return;
5044 /* Print quest message if appropriate */
5045 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5047 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5048 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5050 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5052 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5054 msg_format("この階には%sの主である%sが棲んでいる。",
5055 d_name+d_info[p_ptr->dungeon_idx].name,
5056 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5058 msg_format("%^s lives in this level as the keeper of %s.",
5059 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5060 d_name+d_info[p_ptr->dungeon_idx].name);
5064 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5066 /*** Process this dungeon level ***/
5068 /* Reset the monster generation level */
5069 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5071 /* Reset the object generation level */
5072 current_floor_ptr->object_level = current_floor_ptr->base_level;
5074 current_world_ptr->is_loading_now = TRUE;
5076 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5077 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5078 p_ptr->energy_need = 0;
5080 /* Not leaving dungeon */
5081 p_ptr->leaving_dungeon = FALSE;
5083 /* Initialize monster process */
5089 /* Hack -- Compact the monster list occasionally */
5090 if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5092 /* Hack -- Compress the monster list occasionally */
5093 if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0);
5096 /* Hack -- Compact the object list occasionally */
5097 if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5099 /* Hack -- Compress the object list occasionally */
5100 if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0);
5102 /* Process the player */
5104 process_upkeep_with_speed();
5108 /* Hack -- Hilite the player */
5109 move_cursor_relative(p_ptr->y, p_ptr->x);
5111 /* Optional fresh */
5112 if (fresh_after) Term_fresh();
5114 /* Hack -- Notice death or departure */
5115 if (!p_ptr->playing || p_ptr->is_dead) break;
5117 /* Process all of the monsters */
5122 /* Hack -- Hilite the player */
5123 move_cursor_relative(p_ptr->y, p_ptr->x);
5125 /* Optional fresh */
5126 if (fresh_after) Term_fresh();
5128 /* Hack -- Notice death or departure */
5129 if (!p_ptr->playing || p_ptr->is_dead) break;
5131 /* Process the world */
5136 /* Hack -- Hilite the player */
5137 move_cursor_relative(p_ptr->y, p_ptr->x);
5139 /* Optional fresh */
5140 if (fresh_after) Term_fresh();
5142 /* Hack -- Notice death or departure */
5143 if (!p_ptr->playing || p_ptr->is_dead) break;
5145 /* Count game turns */
5146 current_world_ptr->game_turn++;
5148 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5150 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5151 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5154 prevent_turn_overflow();
5156 /* Handle "leaving" */
5157 if (p_ptr->leaving) break;
5159 if (wild_regen) wild_regen--;
5162 /* Inside a quest and non-unique questor? */
5163 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5165 /* Un-mark the quest monster */
5166 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5169 /* Not save-and-quit and not dead? */
5170 if (p_ptr->playing && !p_ptr->is_dead)
5173 * Maintain Unique monsters and artifact, save current
5174 * floor, then prepare next floor
5176 leave_floor(p_ptr->change_floor_mode);
5178 /* Forget the flag */
5179 reinit_wilderness = FALSE;
5182 /* Write about current level on the play record once per level */
5188 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5191 * Modified by Arcum Dagsson to support
5192 * separate macro files for different realms.
5194 static void load_all_pref_files(void)
5198 /* Access the "user" pref file */
5199 sprintf(buf, "user.prf");
5201 /* Process that file */
5202 process_pref_file(buf);
5204 /* Access the "user" system pref file */
5205 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5207 /* Process that file */
5208 process_pref_file(buf);
5210 /* Access the "race" pref file */
5211 sprintf(buf, "%s.prf", rp_ptr->title);
5213 /* Process that file */
5214 process_pref_file(buf);
5216 /* Access the "class" pref file */
5217 sprintf(buf, "%s.prf", cp_ptr->title);
5219 /* Process that file */
5220 process_pref_file(buf);
5222 /* Access the "character" pref file */
5223 sprintf(buf, "%s.prf", p_ptr->base_name);
5225 /* Process that file */
5226 process_pref_file(buf);
5228 /* Access the "realm 1" pref file */
5229 if (p_ptr->realm1 != REALM_NONE)
5231 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5233 /* Process that file */
5234 process_pref_file(buf);
5237 /* Access the "realm 2" pref file */
5238 if (p_ptr->realm2 != REALM_NONE)
5240 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5242 /* Process that file */
5243 process_pref_file(buf);
5247 /* Load an autopick preference file */
5248 autopick_load_pref(FALSE);
5252 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5255 * If the "new_game" parameter is true, then, after loading the
5256 * savefile, we will commit suicide, if necessary, to allow the
5257 * player to start a new game.
5259 void play_game(bool new_game)
5262 bool load_game = TRUE;
5263 bool init_random_seed = FALSE;
5273 else if (chuukei_server)
5275 prepare_chuukei_hooks();
5286 p_ptr->hack_mutation = FALSE;
5288 /* Hack -- Character is "icky" */
5289 current_world_ptr->character_icky = TRUE;
5291 /* Make sure main term is active */
5292 Term_activate(angband_term[0]);
5294 /* Initialise the resize hooks */
5295 angband_term[0]->resize_hook = resize_map;
5297 for (i = 1; i < 8; i++)
5299 /* Does the term exist? */
5300 if (angband_term[i])
5302 /* Add the redraw on resize hook */
5303 angband_term[i]->resize_hook = redraw_window;
5307 /* Hack -- current_world_ptr->game_turn off the cursor */
5308 (void)Term_set_cursor(0);
5311 /* Attempt to load */
5314 quit(_("セーブファイルが壊れています", "broken savefile"));
5317 /* Extract the options */
5318 extract_option_vars();
5320 /* Report waited score */
5321 if (p_ptr->wait_report_score)
5326 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5329 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5330 update_creature(p_ptr);
5332 p_ptr->is_dead = TRUE;
5334 current_world_ptr->start_time = (u32b)time(NULL);
5336 /* No suspending now */
5337 signals_ignore_tstp();
5339 /* Hack -- Character is now "icky" */
5340 current_world_ptr->character_icky = TRUE;
5342 /* Build the filename */
5343 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5345 /* Open the high score file, for reading/writing */
5346 highscore_fd = fd_open(buf, O_RDWR);
5348 /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
5349 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5351 /* Handle score, show Top scores */
5352 success = send_world_score(TRUE);
5354 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5356 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5361 p_ptr->wait_report_score = FALSE;
5363 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5365 /* Shut the high score file */
5366 (void)fd_close(highscore_fd);
5368 /* Forget the high score fd */
5371 /* Allow suspending now */
5372 signals_handle_tstp();
5377 current_world_ptr->creating_savefile = new_game;
5379 /* Nothing loaded */
5380 if (!current_world_ptr->character_loaded)
5382 /* Make new player */
5385 /* The dungeon is not ready */
5386 current_world_ptr->character_dungeon = FALSE;
5388 /* Prepare to init the RNG */
5389 init_random_seed = TRUE;
5391 /* Initialize the saved floors data */
5392 init_saved_floors(FALSE);
5395 /* Old game is loaded. But new game is requested. */
5398 /* Initialize the saved floors data */
5399 init_saved_floors(TRUE);
5402 /* Process old character */
5405 /* Process the player name */
5406 process_player_name(FALSE);
5410 if (init_random_seed)
5415 /* Roll new character */
5418 /* The dungeon is not ready */
5419 current_world_ptr->character_dungeon = FALSE;
5422 current_floor_ptr->dun_level = 0;
5423 p_ptr->inside_quest = 0;
5424 p_ptr->inside_arena = FALSE;
5425 p_ptr->inside_battle = FALSE;
5429 /* Hack -- seed for flavors */
5430 current_world_ptr->seed_flavor = randint0(0x10000000);
5432 /* Hack -- seed for town layout */
5433 current_world_ptr->seed_town = randint0(0x10000000);
5435 /* Roll up a new character */
5443 determine_bounty_uniques();
5444 determine_today_mon(FALSE);
5446 /* Initialize object array */
5451 write_level = FALSE;
5453 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5455 " ---- Restart Game ----"));
5458 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5459 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5461 if (p_ptr->riding == -1)
5464 for (i = current_floor_ptr->m_max; i > 0; i--)
5466 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5475 current_world_ptr->creating_savefile = FALSE;
5477 p_ptr->teleport_town = FALSE;
5478 p_ptr->sutemi = FALSE;
5479 current_world_ptr->timewalk_m_idx = 0;
5480 p_ptr->now_damaged = FALSE;
5482 current_world_ptr->start_time = time(NULL) - 1;
5483 record_o_name[0] = '\0';
5485 /* Reset map panel */
5486 panel_row_min = current_floor_ptr->height;
5487 panel_col_min = current_floor_ptr->width;
5489 /* Sexy gal gets bonus to maximum weapon skill of whip */
5490 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5491 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5493 /* Fill the arrays of floors and walls in the good proportions */
5494 set_floor_and_wall(p_ptr->dungeon_idx);
5496 /* Flavor the objects */
5499 /* Flash a message */
5500 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5502 /* Flush the message */
5506 /* Hack -- Enter wizard mode */
5509 if (enter_wizard_mode())
5511 p_ptr->wizard = TRUE;
5513 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5515 /* Initialize the saved floors data */
5516 init_saved_floors(TRUE);
5519 p_ptr->inside_quest = 0;
5521 /* Avoid crash in update_view() */
5522 p_ptr->y = p_ptr->x = 10;
5525 else if (p_ptr->is_dead)
5527 quit("Already dead.");
5531 /* Initialize the town-buildings if necessary */
5532 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5534 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5535 init_flags = INIT_ONLY_BUILDINGS;
5536 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5537 select_floor_music();
5540 /* Generate a dungeon level if needed */
5541 if (!current_world_ptr->character_dungeon)
5543 change_floor(p_ptr->change_floor_mode);
5547 /* HACK -- Restore from panic-save */
5548 if (p_ptr->panic_save)
5550 /* No player? -- Try to regenerate floor */
5551 if (!p_ptr->y || !p_ptr->x)
5553 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5554 change_floor(p_ptr->change_floor_mode);
5557 /* Still no player? -- Try to locate random place */
5558 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5560 /* No longer in panic */
5561 p_ptr->panic_save = 0;
5565 /* Character is now "complete" */
5566 current_world_ptr->character_generated = TRUE;
5569 /* Hack -- Character is no longer "icky" */
5570 current_world_ptr->character_icky = FALSE;
5576 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5577 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5582 p_ptr->playing = TRUE;
5584 /* Reset the visual mappings */
5587 /* Load the "pref" files */
5588 load_all_pref_files();
5590 /* Give startup outfit (after loading pref files) */
5596 /* React to changes */
5597 Term_xtra(TERM_XTRA_REACT, 0);
5599 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5600 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5603 /* Set or clear "rogue_like_commands" if requested */
5604 if (arg_force_original) rogue_like_commands = FALSE;
5605 if (arg_force_roguelike) rogue_like_commands = TRUE;
5607 /* Hack -- Enforce "delayed death" */
5608 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5610 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5612 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5614 monster_type *m_ptr;
5615 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5616 monster_race *r_ptr = &r_info[pet_r_idx];
5617 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5618 (PM_FORCE_PET | PM_NO_KAGE));
5619 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5620 m_ptr->mspeed = r_ptr->speed;
5621 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5622 m_ptr->max_maxhp = m_ptr->maxhp;
5623 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5624 m_ptr->dealt_damage = 0;
5625 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5628 (void)combine_and_reorder_home(STORE_HOME);
5629 (void)combine_and_reorder_home(STORE_MUSEUM);
5631 select_floor_music();
5636 /* Process the level */
5639 /* Hack -- prevent "icky" message */
5640 current_world_ptr->character_xtra = TRUE;
5644 current_world_ptr->character_xtra = FALSE;
5646 /* Cancel the target */
5649 /* Cancel the health bar */
5656 /* Handle "quit and save" */
5657 if (!p_ptr->playing && !p_ptr->is_dead) break;
5659 /* Erase the old current_floor_ptr->grid_array */
5661 if (!p_ptr->is_dead) wipe_m_list();
5668 /* Accidental Death */
5669 if (p_ptr->playing && p_ptr->is_dead)
5671 if (p_ptr->inside_arena)
5673 p_ptr->inside_arena = FALSE;
5674 if (p_ptr->arena_number > MAX_ARENA_MONS)
5675 p_ptr->arena_number++;
5677 p_ptr->arena_number = -1 - p_ptr->arena_number;
5678 p_ptr->is_dead = FALSE;
5680 p_ptr->chp_frac = 0;
5681 p_ptr->exit_bldg = TRUE;
5684 /* Leave through the exit */
5685 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5687 /* prepare next floor */
5688 leave_floor(p_ptr->change_floor_mode);
5692 /* Mega-Hack -- Allow player to cheat death */
5693 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5700 /* Handle "death" */
5701 if (p_ptr->is_dead) break;
5703 /* Make a new level */
5704 change_floor(p_ptr->change_floor_mode);
5715 * @brief ゲームターンからの実時間換算を行うための補正をかける
5716 * @param hoge ゲームターン
5717 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5718 * @return 修正をかけた後のゲームターン
5720 s32b turn_real(s32b hoge)
5722 switch (p_ptr->start_race)
5728 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5735 * @brief ターンのオーバーフローに対する対処
5736 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5737 * @return 修正をかけた後のゲームターン
5739 void prevent_turn_overflow(void)
5741 int rollback_days, i, j;
5742 s32b rollback_turns;
5744 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5746 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5747 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5749 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5750 else current_world_ptr->game_turn = 1;
5751 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5752 else current_floor_ptr->generated_turn = 1;
5753 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
5754 else current_world_ptr->arena_start_turn = 1;
5755 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5756 else p_ptr->feeling_turn = 1;
5758 for (i = 1; i < max_towns; i++)
5760 for (j = 0; j < MAX_STORES; j++)
5762 store_type *st_ptr = &town_info[i].store[j];
5764 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5766 st_ptr->last_visit -= rollback_turns;
5767 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5770 if (st_ptr->store_open)
5772 st_ptr->store_open -= rollback_turns;
5773 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5781 * Close up the current game (player may or may not be dead)
5785 * This function is called only from "main.c" and "signals.c".
5788 void close_game(void)
5791 bool do_send = TRUE;
5793 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5796 /* Flush the messages */
5799 /* Flush the input */
5803 /* No suspending now */
5804 signals_ignore_tstp();
5807 /* Hack -- Character is now "icky" */
5808 current_world_ptr->character_icky = TRUE;
5811 /* Build the filename */
5812 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5814 /* Grab permissions */
5817 /* Open the high score file, for reading/writing */
5818 highscore_fd = fd_open(buf, O_RDWR);
5820 /* Drop permissions */
5826 /* Handle retirement */
5827 if (p_ptr->total_winner) kingly();
5830 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5832 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5834 else do_send = FALSE;
5841 /* Show more info */
5847 if ((!send_world_score(do_send)))
5849 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5850 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5852 p_ptr->wait_report_score = TRUE;
5853 p_ptr->is_dead = FALSE;
5854 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5857 if (!p_ptr->wait_report_score)
5860 else if (highscore_fd >= 0)
5862 display_scores_aux(0, 10, -1, NULL);
5865 /* Dump bones file */
5874 do_cmd_save_game(FALSE);
5876 /* Prompt for scores */
5877 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5878 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5880 /* Predict score (or ESCAPE) */
5881 if (inkey() != ESCAPE) predict_score();
5885 /* Shut the high score file */
5886 (void)fd_close(highscore_fd);
5888 /* Forget the high score fd */
5891 /* Kill all temporal files */
5892 clear_saved_floor_files();
5894 /* Allow suspending now */
5895 signals_handle_tstp();
5900 * @brief 全更新処理をチェックして処理していく
5901 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
5904 void handle_stuff(void)
5906 if (p_ptr->update) update_creature(p_ptr);
5907 if (p_ptr->redraw) redraw_stuff();
5908 if (p_ptr->window) window_stuff();
5911 void update_output(void)
5913 if (p_ptr->redraw) redraw_stuff();
5914 if (p_ptr->window) window_stuff();