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.
18 #include "cmd-activate.h"
20 #include "cmd-hissatsu.h"
22 #include "cmd-magiceat.h"
24 #include "cmd-quaff.h"
26 #include "cmd-smith.h"
27 #include "cmd-usestaff.h"
28 #include "cmd-zaprod.h"
29 #include "cmd-zapwand.h"
31 #include "cmd-basic.h"
35 #include "floor-events.h"
37 #include "object-curse.h"
38 #include "object-flavor.h"
41 #include "spells-summon.h"
42 #include "spells-object.h"
43 #include "spells-status.h"
44 #include "spells-floor.h"
45 #include "monster-spell.h"
52 #include "player-move.h"
53 #include "player-status.h"
54 #include "cmd-spell.h"
55 #include "realm-hex.h"
56 #include "object-hook.h"
58 #include "monster-process.h"
59 #include "monster-status.h"
60 #include "monsterrace-hook.h"
61 #include "floor-save.h"
63 #include "player-skill.h"
65 #include "view-mainwindow.h"
66 #include "dungeon-file.h"
68 #include "player-effects.h"
71 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
72 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
75 * @brief 擬似鑑定を実際に行い判定を反映する
76 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
77 * @param heavy 重度の擬似鑑定を行うならばTRUE
80 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
83 object_type *o_ptr = &p_ptr->inventory_list[slot];
84 GAME_TEXT o_name[MAX_NLEN];
86 /* We know about it already, do not tell us again */
87 if (o_ptr->ident & (IDENT_SENSE))return;
89 /* It is fully known, no information needed */
90 if (object_is_known(o_ptr)) return;
92 /* Check for a feeling */
93 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
95 /* Skip non-feelings */
99 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
110 feel = FEEL_EXCELLENT;
116 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
118 feel = FEEL_UNCURSED;
123 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
129 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
136 feel = FEEL_WORTHLESS;
141 feel = FEEL_TERRIBLE;
147 /* Stop everything */
148 if (disturb_minor) disturb(FALSE, FALSE);
150 /* Get an object description */
151 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
153 /* Message (equipment) */
154 if (slot >= INVEN_RARM)
157 msg_format("%s%s(%c)は%sという感じがする...",
158 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
160 msg_format("You feel the %s (%c) you are %s %s %s...",
161 o_name, index_to_label(slot), describe_use(slot),
162 ((o_ptr->number == 1) ? "is" : "are"),
163 game_inscriptions[feel]);
168 /* Message (p_ptr->inventory_list) */
172 msg_format("ザックの中の%s(%c)は%sという感じがする...",
173 o_name, index_to_label(slot),game_inscriptions[feel]);
175 msg_format("You feel the %s (%c) in your pack %s %s...",
176 o_name, index_to_label(slot),
177 ((o_ptr->number == 1) ? "is" : "are"),
178 game_inscriptions[feel]);
183 o_ptr->ident |= (IDENT_SENSE);
185 /* Set the "inscription" */
186 o_ptr->feeling = feel;
188 /* Auto-inscription/destroy */
189 autopick_alter_item(slot, destroy_feeling);
190 p_ptr->update |= (PU_COMBINE | PU_REORDER);
192 p_ptr->window |= (PW_INVEN | PW_EQUIP);
198 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
201 * Sense the p_ptr->inventory_list\n
203 * Class 0 = Warrior --> fast and heavy\n
204 * Class 1 = Mage --> slow and light\n
205 * Class 2 = Priest --> fast but light\n
206 * Class 3 = Rogue --> okay and heavy\n
207 * Class 4 = Ranger --> slow but heavy (changed!)\n
208 * Class 5 = Paladin --> slow but heavy\n
210 static void sense_inventory1(void)
213 PLAYER_LEVEL plev = p_ptr->lev;
218 /*** Check for "sensing" ***/
220 /* No sensing when confused */
221 if (p_ptr->confused) return;
223 /* Analyze the class */
224 switch (p_ptr->pclass)
232 if (0 != randint0(9000L / (plev * plev + 40))) return;
243 if (0 != randint0(6000L / (plev * plev + 50))) return;
252 case CLASS_HIGH_MAGE:
254 case CLASS_MAGIC_EATER:
256 /* Very bad (light) sensing */
257 if (0 != randint0(240000L / (plev + 5))) return;
265 /* Good (light) sensing */
266 if (0 != randint0(10000L / (plev * plev + 40))) return;
275 if (0 != randint0(20000L / (plev * plev + 40))) return;
286 if (0 != randint0(95000L / (plev * plev + 40))) return;
298 if (0 != randint0(77777L / (plev * plev + 40))) return;
306 case CLASS_WARRIOR_MAGE:
310 if (0 != randint0(75000L / (plev * plev + 40))) return;
315 case CLASS_MINDCRAFTER:
317 case CLASS_BLUE_MAGE:
318 case CLASS_MIRROR_MASTER:
321 if (0 != randint0(55000L / (plev * plev + 40))) return;
326 case CLASS_CHAOS_WARRIOR:
329 if (0 != randint0(80000L / (plev * plev + 40))) return;
338 case CLASS_FORCETRAINER:
341 if (0 != randint0(20000L / (plev * plev + 40))) return;
349 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
357 case CLASS_BEASTMASTER:
360 if (0 != randint0(65000L / (plev * plev + 40))) return;
364 case CLASS_BERSERKER:
373 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
375 /*** Sense everything ***/
377 /* Check everything */
378 for (i = 0; i < INVEN_TOTAL; i++)
382 o_ptr = &p_ptr->inventory_list[i];
384 /* Skip empty slots */
385 if (!o_ptr->k_idx) continue;
387 /* Valid "tval" codes */
414 /* Skip non-sense machines */
417 /* Occasional failure on p_ptr->inventory_list items */
418 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
421 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
426 sense_inventory_aux(i, heavy);
431 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
434 static void sense_inventory2(void)
437 PLAYER_LEVEL plev = p_ptr->lev;
441 /*** Check for "sensing" ***/
443 /* No sensing when confused */
444 if (p_ptr->confused) return;
446 /* Analyze the class */
447 switch (p_ptr->pclass)
453 case CLASS_BERSERKER:
461 case CLASS_CHAOS_WARRIOR:
463 case CLASS_BEASTMASTER:
466 /* Very bad (light) sensing */
467 if (0 != randint0(240000L / (plev + 5))) return;
473 case CLASS_WARRIOR_MAGE:
478 if (0 != randint0(95000L / (plev * plev + 40))) return;
486 case CLASS_FORCETRAINER:
487 case CLASS_MINDCRAFTER:
490 if (0 != randint0(20000L / (plev * plev + 40))) return;
496 case CLASS_HIGH_MAGE:
498 case CLASS_MAGIC_EATER:
499 case CLASS_MIRROR_MASTER:
500 case CLASS_BLUE_MAGE:
503 if (0 != randint0(9000L / (plev * plev + 40))) return;
511 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
517 /*** Sense everything ***/
519 /* Check everything */
520 for (i = 0; i < INVEN_TOTAL; i++)
524 o_ptr = &p_ptr->inventory_list[i];
526 /* Skip empty slots */
527 if (!o_ptr->k_idx) continue;
529 /* Valid "tval" codes */
542 /* Skip non-sense machines */
545 /* Occasional failure on p_ptr->inventory_list items */
546 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
548 sense_inventory_aux(i, TRUE);
553 * @brief パターン終点到達時のテレポート処理を行う
556 static void pattern_teleport(void)
559 DEPTH max_level = 99;
562 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
567 /* Only downward in ironman mode */
568 if (ironman_downward)
569 min_level = current_floor_ptr->dun_level;
572 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
574 if (current_floor_ptr->dun_level > 100)
575 max_level = MAX_DEPTH - 1;
576 else if (current_floor_ptr->dun_level == 100)
581 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
582 min_level = d_info[p_ptr->dungeon_idx].mindepth;
586 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
589 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
591 /* Ask for a level */
592 if (!get_string(ppp, tmp_val, 10)) return;
594 /* Extract request */
595 command_arg = (COMMAND_ARG)atoi(tmp_val);
597 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
599 teleport_player(200, 0L);
606 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
607 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
610 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
612 if (autosave_l) do_cmd_save_game(TRUE);
615 current_floor_ptr->dun_level = command_arg;
619 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
621 p_ptr->inside_quest = 0;
625 * Clear all saved floors
626 * and create a first saved floor
628 prepare_change_floor_mode(CFM_FIRST_FLOOR);
629 p_ptr->leaving = TRUE;
633 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
634 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
636 static bool pattern_effect(void)
640 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
642 if ((prace_is_(RACE_AMBERITE)) &&
643 (p_ptr->cut > 0) && one_in_(10))
648 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
650 switch (pattern_type)
652 case PATTERN_TILE_END:
654 (void)restore_all_status();
655 (void)restore_level();
656 (void)cure_critical_wounds(1000);
658 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
659 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
662 * We could make the healing effect of the
663 * Pattern center one-time only to avoid various kinds
664 * of abuse, like luring the win monster into fighting you
665 * in the middle of the pattern...
669 case PATTERN_TILE_OLD:
673 case PATTERN_TILE_TELEPORT:
677 case PATTERN_TILE_WRECKED:
679 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
683 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
685 else if (!IS_INVULN())
686 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
695 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
696 * @param percent 回復比率
699 static void regenhp(int percent)
705 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
706 if (p_ptr->action == ACTION_HAYAGAKE) return;
708 /* Save the old hitpoints */
709 old_chp = p_ptr->chp;
712 * Extract the new hitpoints
714 * 'percent' is the Regen factor in unit (1/2^16)
717 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
719 /* Convert the unit (1/2^16) to (1/2^32) */
720 s64b_LSHIFT(new_chp, new_chp_frac, 16);
723 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
727 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
729 p_ptr->chp = p_ptr->mhp;
734 if (old_chp != p_ptr->chp)
736 p_ptr->redraw |= (PR_HP);
737 p_ptr->window |= (PW_PLAYER);
744 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
745 * @param upkeep_factor ペット維持によるMPコスト量
746 * @param regen_amount 回復量
749 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
751 MANA_POINT old_csp = p_ptr->csp;
752 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
755 * Excess mana will decay 32 times faster than normal
758 if (p_ptr->csp > p_ptr->msp)
760 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
762 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
764 /* Convert the unit (1/2^16) to (1/2^32) */
765 s64b_LSHIFT(decay, decay_frac, 16);
768 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
771 if (p_ptr->csp < p_ptr->msp)
773 p_ptr->csp = p_ptr->msp;
778 /* Regenerating mana (unless the player has excess mana) */
779 else if (regen_rate > 0)
781 /* (percent/100) is the Regen factor in unit (1/2^16) */
782 MANA_POINT new_mana = 0;
783 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
785 /* Convert the unit (1/2^16) to (1/2^32) */
786 s64b_LSHIFT(new_mana, new_mana_frac, 16);
789 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
791 /* Must set frac to zero even if equal */
792 if (p_ptr->csp >= p_ptr->msp)
794 p_ptr->csp = p_ptr->msp;
800 /* Reduce mana (even when the player has excess mana) */
803 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
804 s32b reduce_mana = 0;
805 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
807 /* Convert the unit (1/2^16) to (1/2^32) */
808 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
811 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
821 if (old_csp != p_ptr->csp)
823 p_ptr->redraw |= (PR_MANA);
824 p_ptr->window |= (PW_PLAYER);
825 p_ptr->window |= (PW_SPELL);
831 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
832 * @param regen_amount 回復量
835 static void regenmagic(int regen_amount)
840 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
842 for (i = 0; i < EATER_EXT*2; i++)
844 if (!p_ptr->magic_num2[i]) continue;
845 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
847 /* Increase remaining charge number like float value */
848 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
849 p_ptr->magic_num1[i] += new_mana;
851 /* Check maximum charge */
852 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
854 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
858 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
860 if (!p_ptr->magic_num1[i]) continue;
861 if (!p_ptr->magic_num2[i]) continue;
863 /* Decrease remaining period for charging */
864 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
865 / (dev * 16 * PY_REGEN_NORMAL);
866 p_ptr->magic_num1[i] -= new_mana;
868 /* Check minimum remaining period for charging */
869 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
876 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
878 * @note Should probably be done during monster turns.
880 static void regen_monsters(void)
885 /* Regenerate everyone */
886 for (i = 1; i < m_max; i++)
888 /* Check the i'th monster */
889 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
890 monster_race *r_ptr = &r_info[m_ptr->r_idx];
892 if (!monster_is_valid(m_ptr)) continue;
894 /* Allow regeneration (if needed) */
895 if (m_ptr->hp < m_ptr->maxhp)
897 /* Hack -- Base regeneration */
898 frac = m_ptr->maxhp / 100;
900 /* Hack -- Minimal regeneration rate */
901 if (!frac) if (one_in_(2)) frac = 1;
903 /* Hack -- Some monsters regenerate quickly */
904 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
906 /* Hack -- Regenerate */
909 /* Do not over-regenerate */
910 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
912 /* Redraw (later) if needed */
913 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
914 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
921 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
923 * @note Should probably be done during monster turns.
925 static void regen_captured_monsters(void)
930 /* Regenerate everyone */
931 for (i = 0; i < INVEN_TOTAL; i++)
934 object_type *o_ptr = &p_ptr->inventory_list[i];
936 if (!o_ptr->k_idx) continue;
937 if (o_ptr->tval != TV_CAPTURE) continue;
938 if (!o_ptr->pval) continue;
942 r_ptr = &r_info[o_ptr->pval];
944 /* Allow regeneration (if needed) */
945 if (o_ptr->xtra4 < o_ptr->xtra5)
947 /* Hack -- Base regeneration */
948 frac = o_ptr->xtra5 / 100;
950 /* Hack -- Minimal regeneration rate */
951 if (!frac) if (one_in_(2)) frac = 1;
953 /* Hack -- Some monsters regenerate quickly */
954 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
956 /* Hack -- Regenerate */
957 o_ptr->xtra4 += (XTRA16)frac;
959 /* Do not over-regenerate */
960 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
967 p_ptr->update |= (PU_COMBINE);
968 p_ptr->window |= (PW_INVEN);
969 p_ptr->window |= (PW_EQUIP);
975 * @brief 寿命つき光源の警告メッセージ処理
976 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
979 static void notice_lite_change(object_type *o_ptr)
981 /* Hack -- notice interesting fuel steps */
982 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
984 p_ptr->window |= (PW_EQUIP);
987 /* Hack -- Special treatment when blind */
990 /* Hack -- save some light for later */
991 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
994 /* The light is now out */
995 else if (o_ptr->xtra4 == 0)
997 disturb(FALSE, TRUE);
998 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1000 /* Recalculate torch radius */
1001 p_ptr->update |= (PU_TORCH);
1003 /* Some ego light lose its effects without fuel */
1004 p_ptr->update |= (PU_BONUS);
1007 /* The light is getting dim */
1008 else if (o_ptr->name2 == EGO_LITE_LONG)
1010 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1011 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1013 if (disturb_minor) disturb(FALSE, TRUE);
1014 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1018 /* The light is getting dim */
1019 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1021 if (disturb_minor) disturb(FALSE, TRUE);
1022 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1028 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1029 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1032 static void recharged_notice(object_type *o_ptr)
1034 GAME_TEXT o_name[MAX_NLEN];
1038 /* No inscription */
1039 if (!o_ptr->inscription) return;
1042 s = my_strchr(quark_str(o_ptr->inscription), '!');
1044 /* Process notification request. */
1047 /* Find another '!' */
1050 /* Describe (briefly) */
1051 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1053 /* Notify the player */
1055 msg_format("%sは再充填された。", o_name);
1057 if (o_ptr->number > 1)
1058 msg_format("Your %s are recharged.", o_name);
1060 msg_format("Your %s is recharged.", o_name);
1063 disturb(FALSE, FALSE);
1069 /* Keep looking for '!'s */
1070 s = my_strchr(s + 1, '!');
1075 * @brief プレイヤーの歌に関する継続処理
1078 static void check_music(void)
1080 const magic_type *s_ptr;
1082 MANA_POINT need_mana;
1083 u32b need_mana_frac;
1085 /* Music singed by player */
1086 if (p_ptr->pclass != CLASS_BARD) return;
1087 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1089 if (p_ptr->anti_magic)
1091 stop_singing(p_ptr);
1095 spell = SINGING_SONG_ID(p_ptr);
1096 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1098 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1102 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1104 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1106 stop_singing(p_ptr);
1111 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1113 p_ptr->redraw |= PR_MANA;
1114 if (INTERUPTING_SONG_EFFECT(p_ptr))
1116 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1117 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1118 msg_print(_("歌を再開した。", "You restart singing."));
1119 p_ptr->action = ACTION_SING;
1120 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1121 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1122 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1125 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1126 p_ptr->spell_exp[spell] += 5;
1127 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1128 { 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; }
1129 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1130 { 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; }
1131 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1132 { 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; }
1134 /* Do any effects of continual song */
1135 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1139 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1140 * @param flag 探し出したい呪いフラグ配列
1141 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1144 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1147 int choices[INVEN_TOTAL-INVEN_RARM];
1150 /* Paranoia -- Player has no warning-item */
1151 if (!(p_ptr->cursed & flag)) return NULL;
1153 /* Search Inventry */
1154 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1156 object_type *o_ptr = &p_ptr->inventory_list[i];
1158 if (o_ptr->curse_flags & flag)
1160 choices[number] = i;
1163 else if ((flag == TRC_ADD_L_CURSE) ||
1164 (flag == TRC_ADD_H_CURSE) ||
1165 (flag == TRC_DRAIN_HP) ||
1166 (flag == TRC_DRAIN_MANA) ||
1167 (flag == TRC_CALL_ANIMAL) ||
1168 (flag == TRC_CALL_DEMON) ||
1169 (flag == TRC_CALL_DRAGON) ||
1170 (flag == TRC_CALL_UNDEAD) ||
1171 (flag == TRC_COWARDICE) ||
1172 (flag == TRC_LOW_MELEE) ||
1173 (flag == TRC_LOW_AC) ||
1174 (flag == TRC_LOW_MAGIC) ||
1175 (flag == TRC_FAST_DIGEST) ||
1176 (flag == TRC_SLOW_REGEN) )
1179 BIT_FLAGS flgs[TR_FLAG_SIZE];
1180 object_flags(o_ptr, flgs);
1183 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1184 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1185 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1186 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1187 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1188 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1189 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1190 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1191 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1192 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1193 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1194 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1195 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1196 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1199 if (have_flag(flgs, cf))
1201 choices[number] = i;
1207 /* Choice one of them */
1208 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1211 static void process_world_aux_digestion(void)
1213 if (!p_ptr->inside_battle)
1215 /* Digest quickly when gorged */
1216 if (p_ptr->food >= PY_FOOD_MAX)
1218 /* Digest a lot of food */
1219 (void)set_food(p_ptr->food - 100);
1222 /* Digest normally -- Every 50 game turns */
1223 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1225 /* Basic digestion rate based on speed */
1226 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1228 /* Regeneration takes more food */
1229 if (p_ptr->regenerate)
1231 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1233 if (p_ptr->cursed & TRC_FAST_DIGEST)
1236 /* Slow digestion takes less food */
1237 if (p_ptr->slow_digest)
1240 /* Minimal digestion */
1241 if (digestion < 1) digestion = 1;
1242 /* Maximal digestion */
1243 if (digestion > 100) digestion = 100;
1245 /* Digest some food */
1246 (void)set_food(p_ptr->food - digestion);
1251 if ((p_ptr->food < PY_FOOD_FAINT))
1253 /* Faint occasionally */
1254 if (!p_ptr->paralyzed && (randint0(100) < 10))
1256 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1257 disturb(TRUE, TRUE);
1259 /* Hack -- faint (bypass free action) */
1260 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1263 /* Starve to death (slowly) */
1264 if (p_ptr->food < PY_FOOD_STARVE)
1266 /* Calculate damage */
1267 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1269 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1276 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1277 * / Handle timed damage and regeneration every 10 game turns
1280 static void process_world_aux_hp_and_sp(void)
1282 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1283 bool cave_no_regen = FALSE;
1284 int upkeep_factor = 0;
1286 /* Default regeneration */
1287 int regen_amount = PY_REGEN_NORMAL;
1290 /*** Damage over Time ***/
1292 /* Take damage from poison */
1293 if (p_ptr->poisoned && !IS_INVULN())
1295 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1298 /* Take damage from cuts */
1299 if (p_ptr->cut && !IS_INVULN())
1303 /* Mortal wound or Deep Gash */
1304 if (p_ptr->cut > 1000)
1309 else if (p_ptr->cut > 200)
1315 else if (p_ptr->cut > 100)
1320 else if (p_ptr->cut > 50)
1325 else if (p_ptr->cut > 25)
1330 else if (p_ptr->cut > 10)
1341 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1344 /* (Vampires) Take damage from sunlight */
1345 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1347 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1349 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1351 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1352 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1353 cave_no_regen = TRUE;
1357 if (p_ptr->inventory_list[INVEN_LITE].tval && (p_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1358 !p_ptr->resist_lite)
1360 object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1361 GAME_TEXT o_name [MAX_NLEN];
1362 char ouch [MAX_NLEN+40];
1364 /* Get an object description */
1365 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1366 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1368 cave_no_regen = TRUE;
1370 /* Get an object description */
1371 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1372 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1374 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1378 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1382 if (have_flag(f_ptr->flags, FF_DEEP))
1384 damage = 6000 + randint0(4000);
1386 else if (!p_ptr->levitation)
1388 damage = 3000 + randint0(2000);
1393 if(prace_is_(RACE_ENT)) damage += damage / 3;
1394 if(p_ptr->resist_fire) damage = damage / 3;
1395 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1396 if(p_ptr->levitation) damage = damage / 5;
1398 damage = damage / 100 + (randint0(100) < (damage % 100));
1400 if (p_ptr->levitation)
1402 msg_print(_("熱で火傷した!", "The heat burns you!"));
1403 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1404 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1408 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1409 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1410 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1413 cave_no_regen = TRUE;
1417 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1421 if (have_flag(f_ptr->flags, FF_DEEP))
1423 damage = 6000 + randint0(4000);
1425 else if (!p_ptr->levitation)
1427 damage = 3000 + randint0(2000);
1432 if (p_ptr->resist_cold) damage = damage / 3;
1433 if (IS_OPPOSE_COLD()) damage = damage / 3;
1434 if (p_ptr->levitation) damage = damage / 5;
1436 damage = damage / 100 + (randint0(100) < (damage % 100));
1438 if (p_ptr->levitation)
1440 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1441 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1442 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1446 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1447 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1448 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1451 cave_no_regen = TRUE;
1455 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1459 if (have_flag(f_ptr->flags, FF_DEEP))
1461 damage = 6000 + randint0(4000);
1463 else if (!p_ptr->levitation)
1465 damage = 3000 + randint0(2000);
1470 if (p_ptr->resist_elec) damage = damage / 3;
1471 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1472 if (p_ptr->levitation) damage = damage / 5;
1474 damage = damage / 100 + (randint0(100) < (damage % 100));
1476 if (p_ptr->levitation)
1478 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1479 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1480 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1484 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1485 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1486 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1489 cave_no_regen = TRUE;
1493 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1497 if (have_flag(f_ptr->flags, FF_DEEP))
1499 damage = 6000 + randint0(4000);
1501 else if (!p_ptr->levitation)
1503 damage = 3000 + randint0(2000);
1508 if (p_ptr->resist_acid) damage = damage / 3;
1509 if (IS_OPPOSE_ACID()) damage = damage / 3;
1510 if (p_ptr->levitation) damage = damage / 5;
1512 damage = damage / 100 + (randint0(100) < (damage % 100));
1514 if (p_ptr->levitation)
1516 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1517 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1518 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1522 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1523 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1524 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1527 cave_no_regen = TRUE;
1531 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1535 if (have_flag(f_ptr->flags, FF_DEEP))
1537 damage = 6000 + randint0(4000);
1539 else if (!p_ptr->levitation)
1541 damage = 3000 + randint0(2000);
1546 if (p_ptr->resist_pois) damage = damage / 3;
1547 if (IS_OPPOSE_POIS()) damage = damage / 3;
1548 if (p_ptr->levitation) damage = damage / 5;
1550 damage = damage / 100 + (randint0(100) < (damage % 100));
1552 if (p_ptr->levitation)
1554 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1555 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1556 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1557 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1561 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1562 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1563 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1564 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1567 cave_no_regen = TRUE;
1571 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1572 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1574 if (p_ptr->total_weight > weight_limit())
1576 msg_print(_("溺れている!", "You are drowning!"));
1577 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1578 cave_no_regen = TRUE;
1585 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1587 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1588 if (prace_is_(RACE_ENT)) damage += damage / 3;
1589 if (p_ptr->resist_fire) damage = damage / 3;
1590 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1591 msg_print(_("熱い!", "It's hot!"));
1592 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1594 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1596 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1597 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1598 if (p_ptr->resist_elec) damage = damage / 3;
1599 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1600 msg_print(_("痛い!", "It hurts!"));
1601 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1603 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1605 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1606 if (p_ptr->resist_cold) damage = damage / 3;
1607 if (IS_OPPOSE_COLD()) damage = damage / 3;
1608 msg_print(_("冷たい!", "It's cold!"));
1609 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1613 /* Spectres -- take damage when moving through walls */
1615 * Added: ANYBODY takes damage if inside through walls
1616 * without wraith form -- NOTE: Spectres will never be
1617 * reduced below 0 hp by being inside a stone wall; others
1620 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1622 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1625 cave_no_regen = TRUE;
1627 if (p_ptr->pass_wall)
1629 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1630 dam_desc = _("密度", "density");
1634 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1635 dam_desc = _("硬い岩", "solid rock");
1638 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1643 /*** handle regeneration ***/
1646 if (p_ptr->food < PY_FOOD_WEAK)
1648 /* Lower regeneration */
1649 if (p_ptr->food < PY_FOOD_STARVE)
1653 else if (p_ptr->food < PY_FOOD_FAINT)
1655 regen_amount = PY_REGEN_FAINT;
1659 regen_amount = PY_REGEN_WEAK;
1663 /* Are we walking the pattern? */
1664 if (pattern_effect())
1666 cave_no_regen = TRUE;
1670 /* Regeneration ability */
1671 if (p_ptr->regenerate)
1673 regen_amount = regen_amount * 2;
1675 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1679 if (p_ptr->cursed & TRC_SLOW_REGEN)
1686 /* Searching or Resting */
1687 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1689 regen_amount = regen_amount * 2;
1692 upkeep_factor = calculate_upkeep();
1694 /* No regeneration while special action */
1695 if ((p_ptr->action == ACTION_LEARN) ||
1696 (p_ptr->action == ACTION_HAYAGAKE) ||
1697 (p_ptr->special_defense & KATA_KOUKIJIN))
1699 upkeep_factor += 100;
1702 /* Regenerate the mana */
1703 regenmana(upkeep_factor, regen_amount);
1706 /* Recharge magic eater's power */
1707 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1709 regenmagic(regen_amount);
1712 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1714 while (upkeep_factor > 100)
1716 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1718 do_cmd_pet_dismiss();
1720 upkeep_factor = calculate_upkeep();
1722 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1727 /* Poisoned or cut yields no healing */
1728 if (p_ptr->poisoned) regen_amount = 0;
1729 if (p_ptr->cut) regen_amount = 0;
1731 /* Special floor -- Pattern, in a wall -- yields no healing */
1732 if (cave_no_regen) regen_amount = 0;
1734 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1736 /* Regenerate Hit Points if needed */
1737 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1739 regenhp(regen_amount);
1744 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1745 * / Handle timeout every 10 game turns
1748 static void process_world_aux_timeout(void)
1750 const int dec_count = (easy_band ? 2 : 1);
1752 /*** Timeout Various Things ***/
1755 if (p_ptr->tim_mimic)
1757 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1760 /* Hack -- Hallucinating */
1763 (void)set_image(p_ptr->image - dec_count);
1769 (void)set_blind(p_ptr->blind - dec_count);
1772 /* Times see-invisible */
1773 if (p_ptr->tim_invis)
1775 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1786 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1789 /* Timed temporary elemental brands. -LM- */
1790 if (p_ptr->ele_attack)
1792 p_ptr->ele_attack--;
1794 /* Clear all temporary elemental brands. */
1795 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1798 /* Timed temporary elemental immune. -LM- */
1799 if (p_ptr->ele_immune)
1801 p_ptr->ele_immune--;
1803 /* Clear all temporary elemental brands. */
1804 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1807 /* Timed infra-vision */
1808 if (p_ptr->tim_infra)
1810 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1814 if (p_ptr->tim_stealth)
1816 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1819 /* Timed levitation */
1820 if (p_ptr->tim_levitation)
1822 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1825 /* Timed sh_touki */
1826 if (p_ptr->tim_sh_touki)
1828 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1832 if (p_ptr->tim_sh_fire)
1834 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1838 if (p_ptr->tim_sh_holy)
1840 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1844 if (p_ptr->tim_eyeeye)
1846 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1849 /* Timed resist-magic */
1850 if (p_ptr->resist_magic)
1852 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1855 /* Timed regeneration */
1856 if (p_ptr->tim_regen)
1858 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1861 /* Timed resist nether */
1862 if (p_ptr->tim_res_nether)
1864 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1867 /* Timed resist time */
1868 if (p_ptr->tim_res_time)
1870 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1874 if (p_ptr->tim_reflect)
1876 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1880 if (p_ptr->multishadow)
1882 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1885 /* Timed Robe of dust */
1886 if (p_ptr->dustrobe)
1888 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1891 /* Timed infra-vision */
1892 if (p_ptr->kabenuke)
1894 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1898 if (p_ptr->paralyzed)
1900 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1904 if (p_ptr->confused)
1906 (void)set_confused(p_ptr->confused - dec_count);
1912 (void)set_afraid(p_ptr->afraid - dec_count);
1918 (void)set_fast(p_ptr->fast - 1, TRUE);
1924 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1927 /* Protection from evil */
1928 if (p_ptr->protevil)
1930 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1933 /* Invulnerability */
1936 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1940 if (p_ptr->wraith_form)
1942 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1948 (void)set_hero(p_ptr->hero - 1, TRUE);
1954 (void)set_shero(p_ptr->shero - 1, TRUE);
1960 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1966 (void)set_shield(p_ptr->shield - 1, TRUE);
1970 if (p_ptr->tsubureru)
1972 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1976 if (p_ptr->magicdef)
1978 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1982 if (p_ptr->tsuyoshi)
1984 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1988 if (p_ptr->oppose_acid)
1990 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1993 /* Oppose Lightning */
1994 if (p_ptr->oppose_elec)
1996 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2000 if (p_ptr->oppose_fire)
2002 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2006 if (p_ptr->oppose_cold)
2008 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2012 if (p_ptr->oppose_pois)
2014 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2019 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2022 /*** Poison and Stun and Cut ***/
2025 if (p_ptr->poisoned)
2027 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2029 /* Apply some healing */
2030 (void)set_poisoned(p_ptr->poisoned - adjust);
2036 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2038 /* Apply some healing */
2039 (void)set_stun(p_ptr->stun - adjust);
2045 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2047 /* Hack -- Truly "mortal" wound */
2048 if (p_ptr->cut > 1000) adjust = 0;
2050 /* Apply some healing */
2051 (void)set_cut(p_ptr->cut - adjust);
2057 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2058 * / Handle burning fuel every 10 game turns
2061 static void process_world_aux_light(void)
2063 /* Check for light being wielded */
2064 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2066 /* Burn some fuel in the current lite */
2067 if (o_ptr->tval == TV_LITE)
2069 /* Hack -- Use some fuel (except on artifacts) */
2070 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2072 /* Decrease life-span */
2073 if (o_ptr->name2 == EGO_LITE_LONG)
2075 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2077 else o_ptr->xtra4--;
2079 /* Notice interesting fuel steps */
2080 notice_lite_change(o_ptr);
2087 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2088 * / Handle mutation effects once every 10 game turns
2091 static void process_world_aux_mutation(void)
2093 /* No mutation with effects */
2094 if (!p_ptr->muta2) return;
2096 /* No effect on monster arena */
2097 if (p_ptr->inside_battle) return;
2099 /* No effect on the global map */
2100 if (p_ptr->wild_mode) return;
2102 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2104 disturb(FALSE, TRUE);
2105 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2106 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2107 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2108 (void)set_afraid(0);
2111 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2113 if (!p_ptr->resist_fear)
2115 disturb(FALSE, TRUE);
2116 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2117 set_afraid(p_ptr->afraid + 13 + randint1(26));
2121 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2123 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2125 disturb(FALSE, TRUE);
2126 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2128 teleport_player(40, TELEPORT_PASSIVE);
2132 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2134 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2136 disturb(FALSE, TRUE);
2137 p_ptr->redraw |= PR_EXTRA;
2138 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2141 if (!p_ptr->resist_conf)
2143 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2146 if (!p_ptr->resist_chaos)
2151 if (one_in_(3)) lose_all_info();
2153 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2155 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2156 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2162 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2163 (void)set_image(p_ptr->image + randint0(150) + 150);
2169 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2171 if (!p_ptr->resist_chaos)
2173 disturb(FALSE, TRUE);
2174 p_ptr->redraw |= PR_EXTRA;
2175 (void)set_image(p_ptr->image + randint0(50) + 20);
2179 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2181 disturb(FALSE, TRUE);
2182 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2184 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2187 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2188 !p_ptr->anti_magic && one_in_(9000))
2191 disturb(FALSE, TRUE);
2192 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2193 "Magical energy flows through you! You must release it!"));
2197 (void)get_hack_dir(&dire);
2198 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2201 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2203 bool pet = one_in_(6);
2204 BIT_FLAGS mode = PM_ALLOW_GROUP;
2206 if (pet) mode |= PM_FORCE_PET;
2207 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2209 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2211 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2212 disturb(FALSE, TRUE);
2216 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2218 disturb(FALSE, TRUE);
2221 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2223 if (p_ptr->fast > 0)
2229 set_slow(randint1(30) + 10, FALSE);
2234 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2236 if (p_ptr->slow > 0)
2242 set_fast(randint1(30) + 10, FALSE);
2247 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2249 disturb(FALSE, TRUE);
2250 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2252 banish_monsters(100);
2253 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2257 /* Pick a random shop (except home) */
2260 n = randint0(MAX_STORES);
2262 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2264 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2270 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2274 msg_print(_("影につつまれた。", "A shadow passes over you."));
2277 /* Absorb light from the current possition */
2278 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2283 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2285 /* Absorb some fuel in the current lite */
2286 if (o_ptr->tval == TV_LITE)
2288 /* Use some fuel (except on artifacts) */
2289 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2291 /* Heal the player a bit */
2292 hp_player(o_ptr->xtra4 / 20);
2294 /* Decrease life-span of lite */
2296 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2298 /* Notice interesting fuel steps */
2299 notice_lite_change(o_ptr);
2304 * Unlite the area (radius 10) around player and
2305 * do 50 points damage to every affected monster
2307 unlite_area(50, 10);
2310 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2312 bool pet = one_in_(3);
2313 BIT_FLAGS mode = PM_ALLOW_GROUP;
2315 if (pet) mode |= PM_FORCE_PET;
2316 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2318 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2320 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2321 disturb(FALSE, TRUE);
2325 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2327 disturb(FALSE, TRUE);
2328 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2331 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2333 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2335 if (!lose_mutation(0))
2336 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2338 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2340 disturb(FALSE, TRUE);
2341 msg_print(_("非物質化した!", "You feel insubstantial!"));
2344 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2346 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2350 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2352 int which_stat = randint0(A_MAX);
2353 int sustained = FALSE;
2358 if (p_ptr->sustain_str) sustained = TRUE;
2361 if (p_ptr->sustain_int) sustained = TRUE;
2364 if (p_ptr->sustain_wis) sustained = TRUE;
2367 if (p_ptr->sustain_dex) sustained = TRUE;
2370 if (p_ptr->sustain_con) sustained = TRUE;
2373 if (p_ptr->sustain_chr) sustained = TRUE;
2376 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2382 disturb(FALSE, TRUE);
2383 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2385 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2388 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2390 bool pet = one_in_(5);
2391 BIT_FLAGS mode = PM_ALLOW_GROUP;
2393 if (pet) mode |= PM_FORCE_PET;
2394 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2396 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2398 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2399 disturb(FALSE, TRUE);
2402 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2404 if (p_ptr->tim_esp > 0)
2406 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2407 set_tim_esp(0, TRUE);
2411 msg_print(_("精神が広がった!", "Your mind expands!"));
2412 set_tim_esp(p_ptr->lev, FALSE);
2415 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2417 disturb(FALSE, TRUE);
2418 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2420 set_food(PY_FOOD_WEAK);
2421 if (music_singing_any()) stop_singing(p_ptr);
2422 if (hex_spelling_any()) stop_hex_spell_all();
2425 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2430 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2432 int danger_amount = 0;
2433 MONSTER_IDX monster;
2435 for (monster = 0; monster < m_max; monster++)
2437 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2438 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2439 if (!monster_is_valid(m_ptr)) continue;
2441 if (r_ptr->level >= p_ptr->lev)
2443 danger_amount += r_ptr->level - p_ptr->lev + 1;
2447 if (danger_amount > 100)
2448 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2449 else if (danger_amount > 50)
2450 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2451 else if (danger_amount > 20)
2452 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2453 else if (danger_amount > 10)
2454 msg_print(_("心配な気がする!", "You feel paranoid!"));
2455 else if (danger_amount > 5)
2456 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2458 msg_print(_("寂しい気がする。", "You feel lonely."));
2461 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2463 disturb(FALSE, TRUE);
2464 msg_print(_("無敵な気がする!", "You feel invincible!"));
2466 (void)set_invuln(randint1(8) + 8, FALSE);
2469 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2471 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2475 HIT_POINT healing = p_ptr->csp;
2476 if (healing > wounds) healing = wounds;
2479 p_ptr->csp -= healing;
2480 p_ptr->redraw |= (PR_HP | PR_MANA);
2484 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2486 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2490 HIT_POINT healing = p_ptr->chp;
2491 if (healing > wounds) healing = wounds;
2493 p_ptr->csp += healing;
2494 p_ptr->redraw |= (PR_HP | PR_MANA);
2495 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2499 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2501 INVENTORY_IDX slot = 0;
2502 object_type *o_ptr = NULL;
2504 disturb(FALSE, TRUE);
2505 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2506 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2509 if (has_melee_weapon(INVEN_RARM))
2512 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
2514 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2516 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2520 else if (has_melee_weapon(INVEN_LARM))
2522 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2525 if (slot && !object_is_cursed(o_ptr))
2527 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2528 inven_drop(slot, 1);
2535 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2536 * / Handle curse effects once every 10 game turns
2539 static void process_world_aux_curse(void)
2541 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2544 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2545 * can actually be useful!
2547 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2549 GAME_TEXT o_name[MAX_NLEN];
2551 int i, i_keep = 0, count = 0;
2553 /* Scan the equipment with random teleport ability */
2554 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2556 BIT_FLAGS flgs[TR_FLAG_SIZE];
2557 o_ptr = &p_ptr->inventory_list[i];
2558 if (!o_ptr->k_idx) continue;
2560 object_flags(o_ptr, flgs);
2562 if (have_flag(flgs, TR_TELEPORT))
2564 /* {.} will stop random teleportation. */
2565 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2568 if (one_in_(count)) i_keep = i;
2573 o_ptr = &p_ptr->inventory_list[i_keep];
2574 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2575 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2576 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2578 disturb(FALSE, TRUE);
2579 teleport_player(50, 0L);
2583 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2584 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2585 disturb(TRUE, TRUE);
2588 /* Make a chainsword noise */
2589 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2592 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2594 disturb(FALSE, FALSE);
2597 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2600 (void)activate_ty_curse(FALSE, &count);
2602 /* Handle experience draining */
2603 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2605 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2606 if (p_ptr->exp < 0) p_ptr->exp = 0;
2607 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2608 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2611 /* Add light curse (Later) */
2612 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2614 BIT_FLAGS new_curse;
2617 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2619 new_curse = get_curse(0, o_ptr);
2620 if (!(o_ptr->curse_flags & new_curse))
2622 GAME_TEXT o_name[MAX_NLEN];
2624 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2626 o_ptr->curse_flags |= new_curse;
2627 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2629 o_ptr->feeling = FEEL_NONE;
2631 p_ptr->update |= (PU_BONUS);
2634 /* Add heavy curse (Later) */
2635 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2637 BIT_FLAGS new_curse;
2640 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2642 new_curse = get_curse(1, o_ptr);
2643 if (!(o_ptr->curse_flags & new_curse))
2645 GAME_TEXT o_name[MAX_NLEN];
2647 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2649 o_ptr->curse_flags |= new_curse;
2650 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2651 o_ptr->feeling = FEEL_NONE;
2653 p_ptr->update |= (PU_BONUS);
2657 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2659 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2661 GAME_TEXT o_name[MAX_NLEN];
2663 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2664 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2665 disturb(FALSE, TRUE);
2669 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2671 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2673 GAME_TEXT o_name[MAX_NLEN];
2675 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2676 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2677 disturb(FALSE, TRUE);
2681 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2683 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2684 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2686 GAME_TEXT o_name[MAX_NLEN];
2688 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2689 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2690 disturb(FALSE, TRUE);
2694 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2696 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2697 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2699 GAME_TEXT o_name[MAX_NLEN];
2701 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2702 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2703 disturb(FALSE, TRUE);
2706 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2708 if (!p_ptr->resist_fear)
2710 disturb(FALSE, TRUE);
2711 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2712 set_afraid(p_ptr->afraid + 13 + randint1(26));
2715 /* Teleport player */
2716 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2718 disturb(FALSE, TRUE);
2720 /* Teleport player */
2721 teleport_player(40, TELEPORT_PASSIVE);
2723 /* Handle HP draining */
2724 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2726 GAME_TEXT o_name[MAX_NLEN];
2728 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2729 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2730 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2732 /* Handle mana draining */
2733 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2735 GAME_TEXT o_name[MAX_NLEN];
2737 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2738 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2739 p_ptr->csp -= MIN(p_ptr->lev, 50);
2743 p_ptr->csp_frac = 0;
2745 p_ptr->redraw |= PR_MANA;
2749 /* Rarely, take damage from the Jewel of Judgement */
2750 if (one_in_(999) && !p_ptr->anti_magic)
2752 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2754 if (o_ptr->name1 == ART_JUDGE)
2756 if (object_is_known(o_ptr))
2757 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2759 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2760 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2767 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2768 * / Handle recharging objects once every 10 game turns
2771 static void process_world_aux_recharge(void)
2776 /* Process equipment */
2777 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2779 /* Get the object */
2780 object_type *o_ptr = &p_ptr->inventory_list[i];
2781 if (!o_ptr->k_idx) continue;
2783 /* Recharge activatable objects */
2784 if (o_ptr->timeout > 0)
2789 /* Notice changes */
2790 if (!o_ptr->timeout)
2792 recharged_notice(o_ptr);
2798 /* Notice changes */
2801 p_ptr->window |= (PW_EQUIP);
2806 * Recharge rods. Rods now use timeout to control charging status,
2807 * and each charging rod in a stack decreases the stack's timeout by
2808 * one per current_world_ptr->game_turn. -LM-
2810 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2812 object_type *o_ptr = &p_ptr->inventory_list[i];
2813 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2814 if (!o_ptr->k_idx) continue;
2816 /* Examine all charging rods or stacks of charging rods. */
2817 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2819 /* Determine how many rods are charging. */
2820 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2821 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2823 /* Decrease timeout by that number. */
2824 o_ptr->timeout -= temp;
2826 /* Boundary control. */
2827 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2829 /* Notice changes, provide message if object is inscribed. */
2830 if (!(o_ptr->timeout))
2832 recharged_notice(o_ptr);
2836 /* One of the stack of rod is charged */
2837 else if (o_ptr->timeout % k_ptr->pval)
2844 /* Notice changes */
2847 p_ptr->window |= (PW_INVEN);
2851 /* Process objects on floor */
2852 for (i = 1; i < o_max; i++)
2854 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2856 /* Skip dead objects */
2857 if (!o_ptr->k_idx) continue;
2859 /* Recharge rods on the ground. No messages. */
2860 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2863 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2865 /* Boundary control. */
2866 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2873 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2874 * / Handle involuntary movement once every 10 game turns
2877 static void process_world_aux_movement(void)
2879 /* Delayed Word-of-Recall */
2880 if (p_ptr->word_recall)
2883 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2884 * The player is yanked up/down as soon as
2885 * he loads the autosaved game.
2887 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2888 do_cmd_save_game(TRUE);
2890 /* Count down towards recall */
2891 p_ptr->word_recall--;
2893 p_ptr->redraw |= (PR_STATUS);
2895 /* Activate the recall */
2896 if (!p_ptr->word_recall)
2899 disturb(FALSE, TRUE);
2901 /* Determine the level */
2902 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2904 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2906 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2908 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2910 current_floor_ptr->dun_level = 0;
2911 p_ptr->dungeon_idx = 0;
2913 leave_quest_check();
2914 leave_tower_check();
2916 p_ptr->inside_quest = 0;
2918 p_ptr->leaving = TRUE;
2922 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2924 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2927 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2930 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2931 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2933 /* Nightmare mode makes recall more dangerous */
2934 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2936 if (current_floor_ptr->dun_level < 50)
2938 current_floor_ptr->dun_level *= 2;
2940 else if (current_floor_ptr->dun_level < 99)
2942 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2944 else if (current_floor_ptr->dun_level > 100)
2946 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2950 if (p_ptr->wild_mode)
2952 p_ptr->wilderness_y = p_ptr->y;
2953 p_ptr->wilderness_x = p_ptr->x;
2957 /* Save player position */
2958 p_ptr->oldpx = p_ptr->x;
2959 p_ptr->oldpy = p_ptr->y;
2961 p_ptr->wild_mode = FALSE;
2964 * Clear all saved floors
2965 * and create a first saved floor
2967 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2968 p_ptr->leaving = TRUE;
2970 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2974 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2976 quest_type* const q_ptr = &quest[i];
2979 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2980 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2981 (q_ptr->level < current_floor_ptr->dun_level))
2983 q_ptr->status = QUEST_STATUS_FAILED;
2984 q_ptr->complev = (byte)p_ptr->lev;
2986 q_ptr->comptime = current_world_ptr->play_time;
2987 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2993 sound(SOUND_TPLEVEL);
2998 /* Delayed Alter reality */
2999 if (p_ptr->alter_reality)
3001 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3002 do_cmd_save_game(TRUE);
3004 /* Count down towards alter */
3005 p_ptr->alter_reality--;
3007 p_ptr->redraw |= (PR_STATUS);
3009 /* Activate the alter reality */
3010 if (!p_ptr->alter_reality)
3013 disturb(FALSE, TRUE);
3015 /* Determine the level */
3016 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3018 msg_print(_("世界が変わった!", "The world changes!"));
3021 * Clear all saved floors
3022 * and create a first saved floor
3024 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3025 p_ptr->leaving = TRUE;
3029 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3032 sound(SOUND_TPLEVEL);
3038 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3039 * / Handle certain things once every 10 game turns
3042 static void process_world(void)
3046 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3047 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3048 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3050 extract_day_hour_min(&day, &hour, &min);
3052 /* Update dungeon feeling, and announce it if changed */
3053 update_dungeon_feeling();
3055 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3056 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3058 current_floor_ptr->dun_level = 0;
3059 p_ptr->dungeon_idx = 0;
3060 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3061 p_ptr->inside_arena = FALSE;
3062 p_ptr->wild_mode = FALSE;
3063 p_ptr->leaving = TRUE;
3066 /*** Check monster arena ***/
3067 if (p_ptr->inside_battle && !p_ptr->leaving)
3073 /* Count all hostile monsters */
3074 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3075 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3077 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3079 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3082 win_m_idx = g_ptr->m_idx;
3086 if (number_mon == 0)
3088 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3090 p_ptr->energy_need = 0;
3091 update_gambling_monsters();
3093 else if ((number_mon-1) == 0)
3095 GAME_TEXT m_name[MAX_NLEN];
3096 monster_type *wm_ptr;
3098 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3100 monster_desc(m_name, wm_ptr, 0);
3101 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3104 if (win_m_idx == (sel_monster+1))
3106 msg_print(_("おめでとうございます。", "Congratulations."));
3107 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3108 p_ptr->au += battle_odds;
3112 msg_print(_("残念でした。", "You lost gold."));
3115 p_ptr->energy_need = 0;
3116 update_gambling_monsters();
3118 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3120 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3121 p_ptr->au += kakekin;
3123 p_ptr->energy_need = 0;
3124 update_gambling_monsters();
3128 /* Every 10 game turns */
3129 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3131 /*** Check the Time and Load ***/
3133 if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
3135 /* Check time and load */
3136 if ((0 != check_time()) || (0 != check_load()))
3139 if (closing_flag <= 2)
3141 disturb(FALSE, TRUE);
3143 /* Count warnings */
3146 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3147 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3154 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3157 p_ptr->playing = FALSE;
3158 p_ptr->leaving = TRUE;
3163 /*** Attempt timed autosave ***/
3164 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3166 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3167 do_cmd_save_game(TRUE);
3170 if (mon_fight && !ignore_unview)
3172 msg_print(_("何かが聞こえた。", "You hear noise."));
3175 /*** Handle the wilderness/town (sunshine) ***/
3177 /* While in town/wilderness */
3178 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3180 /* Hack -- Daybreak/Nighfall in town */
3181 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3185 /* Check for dawn */
3186 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3188 if (dawn) day_break();
3194 /* While in the dungeon (vanilla_town or lite_town mode only) */
3195 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3197 /*** Shuffle the Storekeepers ***/
3199 /* Chance is only once a day (while in dungeon) */
3200 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3202 /* Sometimes, shuffle the shop-keepers */
3203 if (one_in_(STORE_SHUFFLE))
3208 /* Pick a random shop (except home and museum) */
3211 n = randint0(MAX_STORES);
3213 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3215 /* Check every feature */
3216 for (i = 1; i < max_f_idx; i++)
3218 feature_type *f_ptr = &f_info[i];
3220 /* Skip empty index */
3221 if (!f_ptr->name) continue;
3223 /* Skip non-store features */
3224 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3226 /* Verify store type */
3227 if (f_ptr->subtype == n)
3229 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3242 /*** Process the monsters ***/
3244 /* Check for creature generation. */
3245 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3246 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3248 /* Make a new monster */
3249 (void)alloc_monster(MAX_SIGHT + 5, 0);
3252 /* Hack -- Check for creature regeneration */
3253 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3254 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3256 if (!p_ptr->leaving)
3260 /* Hack -- Process the counters of monsters if needed */
3261 for (i = 0; i < MAX_MTIMED; i++)
3263 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3271 if (min != prev_min)
3273 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3274 determine_today_mon(FALSE);
3279 * Nightmare mode activates the TY_CURSE at midnight
3280 * Require exact minute -- Don't activate multiple times in a minute
3283 if (ironman_nightmare && (min != prev_min))
3286 /* Every 15 minutes after 11:00 pm */
3287 if ((hour == 23) && !(min % 15))
3289 disturb(FALSE, TRUE);
3294 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3298 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3302 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3306 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3311 /* TY_CURSE activates at midnight! */
3315 disturb(TRUE, TRUE);
3316 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3318 if (p_ptr->wild_mode)
3320 /* Go into large wilderness view */
3321 p_ptr->oldpy = randint1(MAX_HGT - 2);
3322 p_ptr->oldpx = randint1(MAX_WID - 2);
3325 /* Give first move to monsters */
3326 take_turn(p_ptr, 100);
3328 /* HACk -- set the encouter flag for the wilderness generation */
3329 generate_encounter = TRUE;
3332 invoking_midnight_curse = TRUE;
3338 /* Check the Food */
3339 process_world_aux_digestion();
3341 /* Process timed damage and regeneration */
3342 process_world_aux_hp_and_sp();
3344 /* Process timeout */
3345 process_world_aux_timeout();
3348 process_world_aux_light();
3350 /* Process mutation effects */
3351 process_world_aux_mutation();
3353 /* Process curse effects */
3354 process_world_aux_curse();
3356 /* Process recharging */
3357 process_world_aux_recharge();
3359 /* Feel the p_ptr->inventory_list */
3363 /* Involuntary Movement */
3364 process_world_aux_movement();
3368 * @brief ウィザードモードへの導入処理
3369 * / Verify use of "wizard" mode
3370 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3372 static bool enter_wizard_mode(void)
3374 /* Ask first time */
3375 if (!p_ptr->noscore)
3377 /* Wizard mode is not permitted */
3378 if (!allow_debug_opts || arg_wizard)
3380 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3384 /* Mention effects */
3385 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3386 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3389 /* Verify request */
3390 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3395 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3397 p_ptr->noscore |= 0x0002;
3408 * @brief デバッグコマンドへの導入処理
3409 * / Verify use of "debug" commands
3410 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3412 static bool enter_debug_mode(void)
3414 /* Ask first time */
3415 if (!p_ptr->noscore)
3417 /* Debug mode is not permitted */
3418 if (!allow_debug_opts)
3420 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3424 /* Mention effects */
3425 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3426 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3430 /* Verify request */
3431 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3436 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3438 p_ptr->noscore |= 0x0008;
3446 * Hack -- Declare the Debug Routines
3448 extern void do_cmd_debug(void);
3450 #endif /* ALLOW_WIZARD */
3456 * @brief ボーグコマンドへの導入処理
3457 * / Verify use of "borg" commands
3458 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3460 static bool enter_borg_mode(void)
3462 /* Ask first time */
3463 if (!(p_ptr->noscore & 0x0010))
3465 /* Mention effects */
3466 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3467 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3471 /* Verify request */
3472 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3477 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3479 p_ptr->noscore |= 0x0010;
3487 * Hack -- Declare the Ben Borg
3489 extern void do_cmd_borg(void);
3491 #endif /* ALLOW_BORG */
3495 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3496 * / Parse and execute the current command Give "Warning" on illegal commands.
3497 * @todo Make some "blocks"
3500 static void process_command(void)
3502 COMMAND_CODE old_now_message = now_message;
3504 /* Handle repeating the last command */
3510 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3511 reset_concent = TRUE;
3513 /* Parse the command */
3514 switch (command_cmd)
3530 /*** Wizard Commands ***/
3532 /* Toggle Wizard Mode */
3537 p_ptr->wizard = FALSE;
3538 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3540 else if (enter_wizard_mode())
3542 p_ptr->wizard = TRUE;
3543 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3545 p_ptr->update |= (PU_MONSTERS);
3547 /* Redraw "title" */
3548 p_ptr->redraw |= (PR_TITLE);
3556 /* Special "debug" commands */
3559 /* Enter debug mode */
3560 if (enter_debug_mode())
3567 #endif /* ALLOW_WIZARD */
3572 /* Special "borg" commands */
3575 /* Enter borg mode */
3576 if (enter_borg_mode())
3578 if (!p_ptr->wild_mode) do_cmd_borg();
3584 #endif /* ALLOW_BORG */
3588 /*** Inventory Commands ***/
3590 /* Wear/wield equipment */
3593 if (!p_ptr->wild_mode) do_cmd_wield();
3597 /* Take off equipment */
3600 if (!p_ptr->wild_mode) do_cmd_takeoff();
3607 if (!p_ptr->wild_mode) do_cmd_drop();
3611 /* Destroy an item */
3618 /* Equipment list */
3625 /* Inventory list */
3633 /*** Various commands ***/
3635 /* Identify an object */
3642 /* Hack -- toggle windows */
3645 toggle_inven_equip();
3650 /*** Standard "Movement" Commands ***/
3655 if (!p_ptr->wild_mode) do_cmd_alter();
3662 if (!p_ptr->wild_mode) do_cmd_tunnel();
3666 /* Move (usually pick up things) */
3673 /* Move (usually do not pick up) */
3681 /*** Running, Resting, Searching, Staying */
3683 /* Begin Running -- Arg is Max Distance */
3686 if (!p_ptr->wild_mode) do_cmd_run();
3690 /* Stay still (usually pick things up) */
3693 do_cmd_stay(always_pickup);
3697 /* Stay still (usually do not pick up) */
3700 do_cmd_stay(!always_pickup);
3704 /* Rest -- Arg is time */
3711 /* Search for traps/doors */
3718 /* Toggle search mode */
3721 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3722 else set_action(ACTION_SEARCH);
3727 /*** Stairs and Doors and Chests and Traps ***/
3730 case SPECIAL_KEY_STORE:
3736 /* Enter building -KMW- */
3737 case SPECIAL_KEY_BUILDING:
3743 /* Enter quest level -KMW- */
3744 case SPECIAL_KEY_QUEST:
3750 /* Go up staircase */
3753 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3755 if (vanilla_town) break;
3757 if (p_ptr->ambush_flag)
3759 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3763 if (p_ptr->food < PY_FOOD_WEAK)
3765 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3776 /* Go down staircase */
3779 if (p_ptr->wild_mode)
3786 /* Open a door or chest */
3800 /* Jam a door with spikes */
3814 /* Disarm a trap or chest */
3822 /*** Magic and Prayers ***/
3824 /* Gain new spells/prayers */
3827 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3828 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3829 else if (p_ptr->pclass == CLASS_SAMURAI)
3830 do_cmd_gain_hissatsu();
3831 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3832 import_magic_device();
3841 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3842 (p_ptr->pclass == CLASS_BERSERKER) ||
3843 (p_ptr->pclass == CLASS_NINJA) ||
3844 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3845 ) do_cmd_mind_browse();
3846 else if (p_ptr->pclass == CLASS_SMITH)
3848 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3849 do_cmd_magic_eater(TRUE, FALSE);
3850 else if (p_ptr->pclass == CLASS_SNIPER)
3851 do_cmd_snipe_browse();
3852 else do_cmd_browse();
3860 if (!p_ptr->wild_mode)
3862 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3864 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3866 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))
3868 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3871 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3873 concptr which_power = _("魔法", "magic");
3874 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3875 which_power = _("超能力", "psionic powers");
3876 else if (p_ptr->pclass == CLASS_IMITATOR)
3877 which_power = _("ものまね", "imitation");
3878 else if (p_ptr->pclass == CLASS_SAMURAI)
3879 which_power = _("必殺剣", "hissatsu");
3880 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3881 which_power = _("鏡魔法", "mirror magic");
3882 else if (p_ptr->pclass == CLASS_NINJA)
3883 which_power = _("忍術", "ninjutsu");
3884 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3885 which_power = _("祈り", "prayer");
3887 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3890 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3892 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3897 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3898 (p_ptr->pclass == CLASS_BERSERKER) ||
3899 (p_ptr->pclass == CLASS_NINJA) ||
3900 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3903 else if (p_ptr->pclass == CLASS_IMITATOR)
3905 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3906 do_cmd_magic_eater(FALSE, FALSE);
3907 else if (p_ptr->pclass == CLASS_SAMURAI)
3909 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3910 do_cmd_cast_learned();
3911 else if (p_ptr->pclass == CLASS_SMITH)
3913 else if (p_ptr->pclass == CLASS_SNIPER)
3922 /* Issue a pet command */
3929 /*** Use various objects ***/
3931 /* Inscribe an object */
3938 /* Uninscribe an object */
3941 do_cmd_uninscribe();
3945 /* Activate an artifact */
3959 /* Fuel your lantern/torch */
3969 do_cmd_fire(SP_NONE);
3976 do_cmd_throw(1, FALSE, -1);
3990 if (use_command && rogue_like_commands)
4001 /* Quaff a potion */
4004 do_cmd_quaff_potion();
4011 do_cmd_read_scroll();
4018 if (use_command && !rogue_like_commands)
4025 /* Use racial power */
4028 do_cmd_racial_power();
4033 /*** Looking at Things (nearby or on map) ***/
4035 /* Full dungeon map */
4042 /* Locate player on map */
4056 /* Target monster or location */
4065 /*** Help and Such ***/
4074 /* Identify symbol */
4077 do_cmd_query_symbol();
4081 /* Character description */
4084 do_cmd_change_name();
4089 /*** System Commands ***/
4091 /* Hack -- User interface */
4098 /* Single line from a pref file */
4107 do_cmd_reload_autopick();
4113 do_cmd_edit_autopick();
4117 /* Interact with macros */
4124 /* Interact with visuals */
4132 /* Interact with colors */
4140 /* Interact with options */
4144 (void)combine_and_reorder_home(STORE_HOME);
4149 /*** Misc Commands ***/
4165 /* Repeat level feeling */
4172 /* Show previous message */
4175 do_cmd_message_one();
4179 /* Show previous messages */
4182 do_cmd_messages(old_now_message);
4186 /* Show quest status -KMW- */
4189 do_cmd_checkquest();
4193 /* Redraw the screen */
4196 now_message = old_now_message;
4201 #ifndef VERIFY_SAVEFILE
4203 /* Hack -- Save and don't quit */
4206 do_cmd_save_game(FALSE);
4210 #endif /* VERIFY_SAVEFILE */
4220 case SPECIAL_KEY_QUIT:
4222 do_cmd_save_and_exit();
4226 /* Quit (commit suicide) */
4239 /* Check artifacts, uniques, objects */
4246 /* Load "screen dump" */
4249 do_cmd_load_screen();
4253 /* Save "screen dump" */
4256 do_cmd_save_screen();
4260 /* Record/stop "Movie" */
4263 prepare_movie_hooks();
4267 /* Make random artifact list */
4270 spoil_random_artifact("randifact.txt");
4277 if (!p_ptr->wild_mode) do_cmd_travel();
4278 if (p_ptr->special_defense & KATA_MUSOU)
4280 set_action(ACTION_NONE);
4286 /* Hack -- Unknown command */
4289 if (flush_failure) flush();
4293 sound(SOUND_ILLEGAL);
4294 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4299 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4305 if (!p_ptr->energy_use && !now_message)
4306 now_message = old_now_message;
4310 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4313 static void pack_overflow(void)
4315 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
4317 GAME_TEXT o_name[MAX_NLEN];
4320 /* Is auto-destroy done? */
4321 update_creature(p_ptr);
4322 if (!p_ptr->inventory_list[INVEN_PACK].k_idx) return;
4324 /* Access the slot to be dropped */
4325 o_ptr = &p_ptr->inventory_list[INVEN_PACK];
4327 disturb(FALSE, TRUE);
4330 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4331 object_desc(o_name, o_ptr, 0);
4333 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4335 /* Drop it (carefully) near the player */
4336 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4338 /* Modify, Describe, Optimize */
4339 inven_item_increase(INVEN_PACK, -255);
4340 inven_item_describe(INVEN_PACK);
4341 inven_item_optimize(INVEN_PACK);
4348 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4351 static void process_upkeep_with_speed(void)
4353 /* Give the player some energy */
4354 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4356 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4359 /* No current_world_ptr->game_turn yet */
4360 if (p_ptr->enchant_energy_need > 0) return;
4362 while (p_ptr->enchant_energy_need <= 0)
4364 /* Handle the player song */
4365 if (!load) check_music();
4367 /* Hex - Handle the hex spells */
4368 if (!load) check_hex();
4369 if (!load) revenge_spell();
4371 /* There is some randomness of needed energy */
4372 p_ptr->enchant_energy_need += ENERGY_NEED();
4377 * @brief プレイヤーの行動処理 / Process the player
4380 * Notice the annoying code to handle "pack overflow", which\n
4381 * must come first just in case somebody manages to corrupt\n
4382 * the savefiles by clever use of menu commands or something.\n
4384 static void process_player(void)
4388 /*** Apply energy ***/
4392 msg_print(_("何か変わった気がする!", "You feel different!"));
4394 (void)gain_mutation(p_ptr, 0);
4395 hack_mutation = FALSE;
4398 if (invoking_midnight_curse)
4401 activate_ty_curse(FALSE, &count);
4402 invoking_midnight_curse = FALSE;
4405 if (p_ptr->inside_battle)
4407 for(m_idx = 1; m_idx < m_max; m_idx++)
4409 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4411 if (!monster_is_valid(m_ptr)) continue;
4413 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4414 update_monster(m_idx, FALSE);
4419 /* Give the player some energy */
4420 else if (!(load && p_ptr->energy_need <= 0))
4422 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4425 /* No current_world_ptr->game_turn yet */
4426 if (p_ptr->energy_need > 0) return;
4427 if (!command_rep) prt_time();
4429 /*** Check for interupts ***/
4431 /* Complete resting */
4432 if (p_ptr->resting < 0)
4435 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4438 if ((p_ptr->chp == p_ptr->mhp) &&
4439 (p_ptr->csp >= p_ptr->msp))
4441 set_action(ACTION_NONE);
4445 /* Complete resting */
4446 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4449 if ((p_ptr->chp == p_ptr->mhp) &&
4450 (p_ptr->csp >= p_ptr->msp) &&
4451 !p_ptr->blind && !p_ptr->confused &&
4452 !p_ptr->poisoned && !p_ptr->afraid &&
4453 !p_ptr->stun && !p_ptr->cut &&
4454 !p_ptr->slow && !p_ptr->paralyzed &&
4455 !p_ptr->image && !p_ptr->word_recall &&
4456 !p_ptr->alter_reality)
4458 set_action(ACTION_NONE);
4463 if (p_ptr->action == ACTION_FISH)
4465 Term_xtra(TERM_XTRA_DELAY, 10);
4469 bool success = FALSE;
4470 get_mon_num_prep(monster_is_fishing_target,NULL);
4471 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);
4473 if (r_idx && one_in_(2))
4476 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4477 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4478 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4480 GAME_TEXT m_name[MAX_NLEN];
4481 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4482 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4488 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4490 disturb(FALSE, TRUE);
4494 /* Handle "abort" */
4497 /* Check for "player abort" (semi-efficiently for resting) */
4498 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4503 /* Check for a key */
4506 flush(); /* Flush input */
4508 disturb(FALSE, TRUE);
4510 /* Hack -- Show a Message */
4511 msg_print(_("中断しました。", "Canceled."));
4516 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4518 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4519 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4521 if (MON_CSLEEP(m_ptr))
4523 GAME_TEXT m_name[MAX_NLEN];
4526 (void)set_monster_csleep(p_ptr->riding, 0);
4527 monster_desc(m_name, m_ptr, 0);
4528 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4531 if (MON_STUNNED(m_ptr))
4533 /* Hack -- Recover from stun */
4534 if (set_monster_stunned(p_ptr->riding,
4535 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4537 GAME_TEXT m_name[MAX_NLEN];
4538 monster_desc(m_name, m_ptr, 0);
4539 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4543 if (MON_CONFUSED(m_ptr))
4545 /* Hack -- Recover from confusion */
4546 if (set_monster_confused(p_ptr->riding,
4547 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4549 GAME_TEXT m_name[MAX_NLEN];
4550 monster_desc(m_name, m_ptr, 0);
4551 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4555 if (MON_MONFEAR(m_ptr))
4557 /* Hack -- Recover from fear */
4558 if(set_monster_monfear(p_ptr->riding,
4559 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4561 GAME_TEXT m_name[MAX_NLEN];
4562 monster_desc(m_name, m_ptr, 0);
4563 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4573 if (p_ptr->lightspeed)
4575 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4577 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4579 if(P_PTR_KI < 40) P_PTR_KI = 0;
4580 else P_PTR_KI -= 40;
4581 p_ptr->update |= (PU_BONUS);
4583 if (p_ptr->action == ACTION_LEARN)
4586 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4588 /* Convert the unit (1/2^16) to (1/2^32) */
4589 s64b_LSHIFT(cost, cost_frac, 16);
4591 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4595 p_ptr->csp_frac = 0;
4596 set_action(ACTION_NONE);
4601 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4603 p_ptr->redraw |= PR_MANA;
4606 if (p_ptr->special_defense & KATA_MASK)
4608 if (p_ptr->special_defense & KATA_MUSOU)
4612 set_action(ACTION_NONE);
4617 p_ptr->redraw |= (PR_MANA);
4622 /*** Handle actual user input ***/
4624 /* Repeat until out of energy */
4625 while (p_ptr->energy_need <= 0)
4627 p_ptr->window |= PW_PLAYER;
4628 p_ptr->sutemi = FALSE;
4629 p_ptr->counter = FALSE;
4630 p_ptr->now_damaged = FALSE;
4634 /* Place the cursor on the player */
4635 move_cursor_relative(p_ptr->y, p_ptr->x);
4637 /* Refresh (optional) */
4638 if (fresh_before) Term_fresh();
4640 /* Hack -- Pack Overflow */
4643 /* Hack -- cancel "lurking browse mode" */
4644 if (!command_new) command_see = FALSE;
4646 /* Assume free current_world_ptr->game_turn */
4649 if (p_ptr->inside_battle)
4651 /* Place the cursor on the player */
4652 move_cursor_relative(p_ptr->y, p_ptr->x);
4654 command_cmd = SPECIAL_KEY_BUILDING;
4656 /* Process the command */
4660 /* Paralyzed or Knocked Out */
4661 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4663 take_turn(p_ptr, 100);
4667 else if (p_ptr->action == ACTION_REST)
4670 if (p_ptr->resting > 0)
4672 /* Reduce rest count */
4675 if (!p_ptr->resting) set_action(ACTION_NONE);
4676 p_ptr->redraw |= (PR_STATE);
4679 take_turn(p_ptr, 100);
4683 else if (p_ptr->action == ACTION_FISH)
4685 take_turn(p_ptr, 100);
4697 else if (travel.run)
4704 /* Repeated command */
4705 else if (command_rep)
4707 /* Count this execution */
4710 p_ptr->redraw |= (PR_STATE);
4713 /* Hack -- Assume messages were seen */
4716 /* Clear the top line */
4719 /* Process the command */
4723 /* Normal command */
4726 /* Place the cursor on the player */
4727 move_cursor_relative(p_ptr->y, p_ptr->x);
4730 /* Get a command (normal) */
4731 request_command(FALSE);
4734 /* Process the command */
4738 /* Hack -- Pack Overflow */
4744 if (p_ptr->energy_use)
4746 /* Use some energy */
4747 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4749 /* The Randomness is irrelevant */
4750 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4754 /* There is some randomness of needed energy */
4755 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4758 /* Hack -- constant hallucination */
4759 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4762 /* Shimmer monsters if needed */
4763 if (shimmer_monsters)
4765 /* Clear the flag */
4766 shimmer_monsters = FALSE;
4768 /* Shimmer multi-hued monsters */
4769 for (m_idx = 1; m_idx < m_max; m_idx++)
4771 monster_type *m_ptr;
4772 monster_race *r_ptr;
4774 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4775 if (!monster_is_valid(m_ptr)) continue;
4777 /* Skip unseen monsters */
4778 if (!m_ptr->ml) continue;
4780 /* Access the monster race */
4781 r_ptr = &r_info[m_ptr->ap_r_idx];
4783 /* Skip non-multi-hued monsters */
4784 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4787 /* Reset the flag */
4788 shimmer_monsters = TRUE;
4790 /* Redraw regardless */
4791 lite_spot(m_ptr->fy, m_ptr->fx);
4796 /* Handle monster detection */
4797 if (repair_monsters)
4799 /* Reset the flag */
4800 repair_monsters = FALSE;
4802 /* Rotate detection flags */
4803 for (m_idx = 1; m_idx < m_max; m_idx++)
4805 monster_type *m_ptr;
4806 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4807 if (!monster_is_valid(m_ptr)) continue;
4809 /* Nice monsters get mean */
4810 if (m_ptr->mflag & MFLAG_NICE)
4812 /* Nice monsters get mean */
4813 m_ptr->mflag &= ~(MFLAG_NICE);
4816 /* Handle memorized monsters */
4817 if (m_ptr->mflag2 & MFLAG2_MARK)
4819 /* Maintain detection */
4820 if (m_ptr->mflag2 & MFLAG2_SHOW)
4823 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4825 /* Still need repairs */
4826 repair_monsters = TRUE;
4829 /* Remove detection */
4833 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4835 /* Assume invisible */
4837 update_monster(m_idx, FALSE);
4839 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4840 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4842 /* Redraw regardless */
4843 lite_spot(m_ptr->fy, m_ptr->fx);
4848 if (p_ptr->pclass == CLASS_IMITATOR)
4851 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4854 for (j = 0; j < p_ptr->mane_num; j++)
4856 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4857 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4861 p_ptr->redraw |= (PR_IMITATION);
4863 if (p_ptr->action == ACTION_LEARN)
4866 p_ptr->redraw |= (PR_STATE);
4869 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4872 p_ptr->redraw |= (PR_MAP);
4873 p_ptr->update |= (PU_MONSTERS);
4874 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4876 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4878 p_ptr->timewalk = FALSE;
4879 p_ptr->energy_need = ENERGY_NEED();
4885 /* Hack -- notice death */
4886 if (!p_ptr->playing || p_ptr->is_dead)
4888 p_ptr->timewalk = FALSE;
4893 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
4895 /* Handle "leaving" */
4896 if (p_ptr->leaving) break;
4899 /* Update scent trail */
4904 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4908 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4909 * ゲームを終了するかのいずれかまでループする。
4912 * This function will not exit until the level is completed,\n
4913 * the user dies, or the game is terminated.\n
4916 static void dungeon(bool load_game)
4920 /* Set the base level */
4921 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4923 /* Reset various flags */
4924 is_loading_now = FALSE;
4927 p_ptr->leaving = FALSE;
4929 /* Reset the "command" vars */
4932 #if 0 /* Don't reset here --- It's used for Arena */
4941 /* Cancel the target */
4945 p_ptr->ambush_flag = FALSE;
4947 /* Cancel the health bar */
4950 /* Check visual effects */
4951 shimmer_monsters = TRUE;
4952 shimmer_objects = TRUE;
4953 repair_monsters = TRUE;
4954 repair_objects = TRUE;
4957 disturb(TRUE, TRUE);
4959 /* Get index of current quest (if any) */
4960 quest_num = quest_number(current_floor_ptr->dun_level);
4962 /* Inside a quest? */
4965 /* Mark the quest monster */
4966 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4969 /* Track maximum player level */
4970 if (p_ptr->max_plv < p_ptr->lev)
4972 p_ptr->max_plv = p_ptr->lev;
4976 /* Track maximum dungeon level (if not in quest -KMW-) */
4977 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4979 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4980 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4983 (void)calculate_upkeep();
4985 /* Validate the panel */
4986 panel_bounds_center();
4988 /* Verify the panel */
4994 /* Enter "xtra" mode */
4995 character_xtra = TRUE;
4997 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4998 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4999 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);
5003 /* Leave "xtra" mode */
5004 character_xtra = FALSE;
5006 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5007 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5011 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5012 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5013 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5015 if (p_ptr->inside_battle)
5019 p_ptr->energy_need = 0;
5020 update_gambling_monsters();
5024 msg_print(_("試合開始!", "Ready..Fight!"));
5029 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5030 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5032 /* Hack -- notice death or departure */
5033 if (!p_ptr->playing || p_ptr->is_dead) return;
5035 /* Print quest message if appropriate */
5036 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5038 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5039 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5041 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5043 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5045 msg_format("この階には%sの主である%sが棲んでいる。",
5046 d_name+d_info[p_ptr->dungeon_idx].name,
5047 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5049 msg_format("%^s lives in this level as the keeper of %s.",
5050 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5051 d_name+d_info[p_ptr->dungeon_idx].name);
5055 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5057 /*** Process this dungeon level ***/
5059 /* Reset the monster generation level */
5060 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5062 /* Reset the object generation level */
5063 current_floor_ptr->object_level = current_floor_ptr->base_level;
5065 is_loading_now = TRUE;
5067 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5068 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5069 p_ptr->energy_need = 0;
5071 /* Not leaving dungeon */
5072 p_ptr->leaving_dungeon = FALSE;
5074 /* Initialize monster process */
5080 /* Hack -- Compact the monster list occasionally */
5081 if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5083 /* Hack -- Compress the monster list occasionally */
5084 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5087 /* Hack -- Compact the object list occasionally */
5088 if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5090 /* Hack -- Compress the object list occasionally */
5091 if (o_cnt + 32 < o_max) compact_objects(0);
5093 /* Process the player */
5095 process_upkeep_with_speed();
5099 /* Hack -- Hilite the player */
5100 move_cursor_relative(p_ptr->y, p_ptr->x);
5102 /* Optional fresh */
5103 if (fresh_after) Term_fresh();
5105 /* Hack -- Notice death or departure */
5106 if (!p_ptr->playing || p_ptr->is_dead) break;
5108 /* Process all of the monsters */
5113 /* Hack -- Hilite the player */
5114 move_cursor_relative(p_ptr->y, p_ptr->x);
5116 /* Optional fresh */
5117 if (fresh_after) Term_fresh();
5119 /* Hack -- Notice death or departure */
5120 if (!p_ptr->playing || p_ptr->is_dead) break;
5122 /* Process the world */
5127 /* Hack -- Hilite the player */
5128 move_cursor_relative(p_ptr->y, p_ptr->x);
5130 /* Optional fresh */
5131 if (fresh_after) Term_fresh();
5133 /* Hack -- Notice death or departure */
5134 if (!p_ptr->playing || p_ptr->is_dead) break;
5136 /* Count game turns */
5137 current_world_ptr->game_turn++;
5139 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5141 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5142 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5145 prevent_turn_overflow();
5147 /* Handle "leaving" */
5148 if (p_ptr->leaving) break;
5150 if (wild_regen) wild_regen--;
5153 /* Inside a quest and non-unique questor? */
5154 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5156 /* Un-mark the quest monster */
5157 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5160 /* Not save-and-quit and not dead? */
5161 if (p_ptr->playing && !p_ptr->is_dead)
5164 * Maintain Unique monsters and artifact, save current
5165 * floor, then prepare next floor
5169 /* Forget the flag */
5170 reinit_wilderness = FALSE;
5173 /* Write about current level on the play record once per level */
5179 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5182 * Modified by Arcum Dagsson to support
5183 * separate macro files for different realms.
5185 static void load_all_pref_files(void)
5189 /* Access the "user" pref file */
5190 sprintf(buf, "user.prf");
5192 /* Process that file */
5193 process_pref_file(buf);
5195 /* Access the "user" system pref file */
5196 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5198 /* Process that file */
5199 process_pref_file(buf);
5201 /* Access the "race" pref file */
5202 sprintf(buf, "%s.prf", rp_ptr->title);
5204 /* Process that file */
5205 process_pref_file(buf);
5207 /* Access the "class" pref file */
5208 sprintf(buf, "%s.prf", cp_ptr->title);
5210 /* Process that file */
5211 process_pref_file(buf);
5213 /* Access the "character" pref file */
5214 sprintf(buf, "%s.prf", player_base);
5216 /* Process that file */
5217 process_pref_file(buf);
5219 /* Access the "realm 1" pref file */
5220 if (p_ptr->realm1 != REALM_NONE)
5222 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5224 /* Process that file */
5225 process_pref_file(buf);
5228 /* Access the "realm 2" pref file */
5229 if (p_ptr->realm2 != REALM_NONE)
5231 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5233 /* Process that file */
5234 process_pref_file(buf);
5238 /* Load an autopick preference file */
5239 autopick_load_pref(FALSE);
5243 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5246 * If the "new_game" parameter is true, then, after loading the
5247 * savefile, we will commit suicide, if necessary, to allow the
5248 * player to start a new game.
5250 void play_game(bool new_game)
5253 bool load_game = TRUE;
5254 bool init_random_seed = FALSE;
5264 else if (chuukei_server)
5266 prepare_chuukei_hooks();
5277 hack_mutation = FALSE;
5279 /* Hack -- Character is "icky" */
5280 character_icky = TRUE;
5282 /* Make sure main term is active */
5283 Term_activate(angband_term[0]);
5285 /* Initialise the resize hooks */
5286 angband_term[0]->resize_hook = resize_map;
5288 for (i = 1; i < 8; i++)
5290 /* Does the term exist? */
5291 if (angband_term[i])
5293 /* Add the redraw on resize hook */
5294 angband_term[i]->resize_hook = redraw_window;
5298 /* Hack -- current_world_ptr->game_turn off the cursor */
5299 (void)Term_set_cursor(0);
5302 /* Attempt to load */
5305 quit(_("セーブファイルが壊れています", "broken savefile"));
5308 /* Extract the options */
5309 extract_option_vars();
5311 /* Report waited score */
5312 if (p_ptr->wait_report_score)
5317 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5320 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5321 update_creature(p_ptr);
5323 p_ptr->is_dead = TRUE;
5325 start_time = (u32b)time(NULL);
5327 /* No suspending now */
5328 signals_ignore_tstp();
5330 /* Hack -- Character is now "icky" */
5331 character_icky = TRUE;
5333 /* Build the filename */
5334 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5336 /* Open the high score file, for reading/writing */
5337 highscore_fd = fd_open(buf, O_RDWR);
5339 /* 町名消失バグ対策(#38205) Init the wilderness */
5340 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5342 /* Handle score, show Top scores */
5343 success = send_world_score(TRUE);
5345 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5347 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5352 p_ptr->wait_report_score = FALSE;
5354 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5356 /* Shut the high score file */
5357 (void)fd_close(highscore_fd);
5359 /* Forget the high score fd */
5362 /* Allow suspending now */
5363 signals_handle_tstp();
5368 creating_savefile = new_game;
5370 /* Nothing loaded */
5371 if (!character_loaded)
5373 /* Make new player */
5376 /* The dungeon is not ready */
5377 character_dungeon = FALSE;
5379 /* Prepare to init the RNG */
5380 init_random_seed = TRUE;
5382 /* Initialize the saved floors data */
5383 init_saved_floors(FALSE);
5386 /* Old game is loaded. But new game is requested. */
5389 /* Initialize the saved floors data */
5390 init_saved_floors(TRUE);
5393 /* Process old character */
5396 /* Process the player name */
5397 process_player_name(FALSE);
5401 if (init_random_seed)
5406 /* Roll new character */
5409 /* The dungeon is not ready */
5410 character_dungeon = FALSE;
5413 current_floor_ptr->dun_level = 0;
5414 p_ptr->inside_quest = 0;
5415 p_ptr->inside_arena = FALSE;
5416 p_ptr->inside_battle = FALSE;
5420 /* Hack -- seed for flavors */
5421 seed_flavor = randint0(0x10000000);
5423 /* Hack -- seed for town layout */
5424 seed_town = randint0(0x10000000);
5426 /* Roll up a new character */
5434 determine_bounty_uniques();
5435 determine_today_mon(FALSE);
5437 /* Initialize object array */
5442 write_level = FALSE;
5444 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5446 " ---- Restart Game ----"));
5449 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5450 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5452 if (p_ptr->riding == -1)
5455 for (i = m_max; i > 0; i--)
5457 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5466 creating_savefile = FALSE;
5468 p_ptr->teleport_town = FALSE;
5469 p_ptr->sutemi = FALSE;
5470 current_world_ptr->timewalk_m_idx = 0;
5471 p_ptr->now_damaged = FALSE;
5473 start_time = time(NULL) - 1;
5474 record_o_name[0] = '\0';
5476 /* Reset map panel */
5477 panel_row_min = current_floor_ptr->height;
5478 panel_col_min = current_floor_ptr->width;
5480 /* Sexy gal gets bonus to maximum weapon skill of whip */
5481 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5482 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5484 /* Fill the arrays of floors and walls in the good proportions */
5485 set_floor_and_wall(p_ptr->dungeon_idx);
5487 /* Flavor the objects */
5490 /* Flash a message */
5491 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5493 /* Flush the message */
5497 /* Hack -- Enter wizard mode */
5500 if (enter_wizard_mode())
5502 p_ptr->wizard = TRUE;
5504 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5506 /* Initialize the saved floors data */
5507 init_saved_floors(TRUE);
5510 p_ptr->inside_quest = 0;
5512 /* Avoid crash in update_view() */
5513 p_ptr->y = p_ptr->x = 10;
5516 else if (p_ptr->is_dead)
5518 quit("Already dead.");
5522 /* Initialize the town-buildings if necessary */
5523 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5525 /* Init the wilderness */
5527 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5530 init_flags = INIT_ONLY_BUILDINGS;
5532 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5534 select_floor_music();
5538 /* Generate a dungeon level if needed */
5539 if (!character_dungeon)
5546 /* HACK -- Restore from panic-save */
5547 if (p_ptr->panic_save)
5549 /* No player? -- Try to regenerate floor */
5550 if (!p_ptr->y || !p_ptr->x)
5552 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5556 /* Still no player? -- Try to locate random place */
5557 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5559 /* No longer in panic */
5560 p_ptr->panic_save = 0;
5564 /* Character is now "complete" */
5565 character_generated = TRUE;
5568 /* Hack -- Character is no longer "icky" */
5569 character_icky = FALSE;
5575 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5576 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5581 p_ptr->playing = TRUE;
5583 /* Reset the visual mappings */
5586 /* Load the "pref" files */
5587 load_all_pref_files();
5589 /* Give startup outfit (after loading pref files) */
5595 /* React to changes */
5596 Term_xtra(TERM_XTRA_REACT, 0);
5598 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5599 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5602 /* Set or clear "rogue_like_commands" if requested */
5603 if (arg_force_original) rogue_like_commands = FALSE;
5604 if (arg_force_roguelike) rogue_like_commands = TRUE;
5606 /* Hack -- Enforce "delayed death" */
5607 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5609 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5611 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5613 monster_type *m_ptr;
5614 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5615 monster_race *r_ptr = &r_info[pet_r_idx];
5616 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5617 (PM_FORCE_PET | PM_NO_KAGE));
5618 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5619 m_ptr->mspeed = r_ptr->speed;
5620 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5621 m_ptr->max_maxhp = m_ptr->maxhp;
5622 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5623 m_ptr->dealt_damage = 0;
5624 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5627 (void)combine_and_reorder_home(STORE_HOME);
5628 (void)combine_and_reorder_home(STORE_MUSEUM);
5630 select_floor_music();
5635 /* Process the level */
5638 /* Hack -- prevent "icky" message */
5639 character_xtra = TRUE;
5643 character_xtra = FALSE;
5645 /* Cancel the target */
5648 /* Cancel the health bar */
5655 /* Handle "quit and save" */
5656 if (!p_ptr->playing && !p_ptr->is_dead) break;
5658 /* Erase the old current_floor_ptr->grid_array */
5660 if (!p_ptr->is_dead) wipe_m_list();
5667 /* Accidental Death */
5668 if (p_ptr->playing && p_ptr->is_dead)
5670 if (p_ptr->inside_arena)
5672 p_ptr->inside_arena = FALSE;
5673 if (p_ptr->arena_number > MAX_ARENA_MONS)
5674 p_ptr->arena_number++;
5676 p_ptr->arena_number = -1 - p_ptr->arena_number;
5677 p_ptr->is_dead = FALSE;
5679 p_ptr->chp_frac = 0;
5680 p_ptr->exit_bldg = TRUE;
5683 /* Leave through the exit */
5684 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5686 /* prepare next floor */
5691 /* Mega-Hack -- Allow player to cheat death */
5692 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5699 /* Handle "death" */
5700 if (p_ptr->is_dead) break;
5702 /* Make a new level */
5714 * @brief ゲームターンからの実時間換算を行うための補正をかける
5715 * @param hoge ゲームターン
5716 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5717 * @return 修正をかけた後のゲームターン
5719 s32b turn_real(s32b hoge)
5721 switch (p_ptr->start_race)
5727 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5734 * @brief ターンのオーバーフローに対する対処
5735 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5736 * @return 修正をかけた後のゲームターン
5738 void prevent_turn_overflow(void)
5740 int rollback_days, i, j;
5741 s32b rollback_turns;
5743 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5745 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5746 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5748 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5749 else current_world_ptr->game_turn = 1;
5750 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5751 else current_floor_ptr->generated_turn = 1;
5752 if (old_battle > rollback_turns) old_battle -= rollback_turns;
5753 else old_battle = 1;
5754 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5755 else p_ptr->feeling_turn = 1;
5757 for (i = 1; i < max_towns; i++)
5759 for (j = 0; j < MAX_STORES; j++)
5761 store_type *st_ptr = &town_info[i].store[j];
5763 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5765 st_ptr->last_visit -= rollback_turns;
5766 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5769 if (st_ptr->store_open)
5771 st_ptr->store_open -= rollback_turns;
5772 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5780 * Close up the current game (player may or may not be dead)
5784 * This function is called only from "main.c" and "signals.c".
5787 void close_game(void)
5790 bool do_send = TRUE;
5792 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5795 /* Flush the messages */
5798 /* Flush the input */
5802 /* No suspending now */
5803 signals_ignore_tstp();
5806 /* Hack -- Character is now "icky" */
5807 character_icky = TRUE;
5810 /* Build the filename */
5811 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5813 /* Grab permissions */
5816 /* Open the high score file, for reading/writing */
5817 highscore_fd = fd_open(buf, O_RDWR);
5819 /* Drop permissions */
5825 /* Handle retirement */
5826 if (p_ptr->total_winner) kingly();
5829 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5831 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5833 else do_send = FALSE;
5840 /* Show more info */
5846 if ((!send_world_score(do_send)))
5848 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5849 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5851 p_ptr->wait_report_score = TRUE;
5852 p_ptr->is_dead = FALSE;
5853 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5856 if (!p_ptr->wait_report_score)
5859 else if (highscore_fd >= 0)
5861 display_scores_aux(0, 10, -1, NULL);
5864 /* Dump bones file */
5873 do_cmd_save_game(FALSE);
5875 /* Prompt for scores */
5876 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5877 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5879 /* Predict score (or ESCAPE) */
5880 if (inkey() != ESCAPE) predict_score();
5884 /* Shut the high score file */
5885 (void)fd_close(highscore_fd);
5887 /* Forget the high score fd */
5890 /* Kill all temporal files */
5891 clear_saved_floor_files();
5893 /* Allow suspending now */
5894 signals_handle_tstp();