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 "player-class.h"
55 #include "cmd-spell.h"
56 #include "realm-hex.h"
57 #include "objectkind.h"
58 #include "object-hook.h"
60 #include "monster-process.h"
61 #include "monster-status.h"
62 #include "monsterrace-hook.h"
63 #include "floor-save.h"
65 #include "player-skill.h"
67 #include "view-mainwindow.h"
68 #include "dungeon-file.h"
70 #include "player-effects.h"
74 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
75 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
78 * @brief 擬似鑑定を実際に行い判定を反映する
79 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
80 * @param heavy 重度の擬似鑑定を行うならばTRUE
83 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
86 object_type *o_ptr = &p_ptr->inventory_list[slot];
87 GAME_TEXT o_name[MAX_NLEN];
89 /* We know about it already, do not tell us again */
90 if (o_ptr->ident & (IDENT_SENSE))return;
92 /* It is fully known, no information needed */
93 if (object_is_known(o_ptr)) return;
95 /* Check for a feeling */
96 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
98 /* Skip non-feelings */
102 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
113 feel = FEEL_EXCELLENT;
119 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
121 feel = FEEL_UNCURSED;
126 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
132 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
139 feel = FEEL_WORTHLESS;
144 feel = FEEL_TERRIBLE;
150 /* Stop everything */
151 if (disturb_minor) disturb(FALSE, FALSE);
153 /* Get an object description */
154 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
156 /* Message (equipment) */
157 if (slot >= INVEN_RARM)
160 msg_format("%s%s(%c)は%sという感じがする...",
161 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
163 msg_format("You feel the %s (%c) you are %s %s %s...",
164 o_name, index_to_label(slot), describe_use(slot),
165 ((o_ptr->number == 1) ? "is" : "are"),
166 game_inscriptions[feel]);
171 /* Message (p_ptr->inventory_list) */
175 msg_format("ザックの中の%s(%c)は%sという感じがする...",
176 o_name, index_to_label(slot),game_inscriptions[feel]);
178 msg_format("You feel the %s (%c) in your pack %s %s...",
179 o_name, index_to_label(slot),
180 ((o_ptr->number == 1) ? "is" : "are"),
181 game_inscriptions[feel]);
186 o_ptr->ident |= (IDENT_SENSE);
188 /* Set the "inscription" */
189 o_ptr->feeling = feel;
191 /* Auto-inscription/destroy */
192 autopick_alter_item(slot, destroy_feeling);
193 p_ptr->update |= (PU_COMBINE | PU_REORDER);
195 p_ptr->window |= (PW_INVEN | PW_EQUIP);
201 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
204 * Sense the p_ptr->inventory_list\n
206 * Class 0 = Warrior --> fast and heavy\n
207 * Class 1 = Mage --> slow and light\n
208 * Class 2 = Priest --> fast but light\n
209 * Class 3 = Rogue --> okay and heavy\n
210 * Class 4 = Ranger --> slow but heavy (changed!)\n
211 * Class 5 = Paladin --> slow but heavy\n
213 static void sense_inventory1(void)
216 PLAYER_LEVEL plev = p_ptr->lev;
221 /*** Check for "sensing" ***/
223 /* No sensing when confused */
224 if (p_ptr->confused) return;
226 /* Analyze the class */
227 switch (p_ptr->pclass)
235 if (0 != randint0(9000L / (plev * plev + 40))) return;
246 if (0 != randint0(6000L / (plev * plev + 50))) return;
255 case CLASS_HIGH_MAGE:
257 case CLASS_MAGIC_EATER:
259 /* Very bad (light) sensing */
260 if (0 != randint0(240000L / (plev + 5))) return;
268 /* Good (light) sensing */
269 if (0 != randint0(10000L / (plev * plev + 40))) return;
278 if (0 != randint0(20000L / (plev * plev + 40))) return;
289 if (0 != randint0(95000L / (plev * plev + 40))) return;
301 if (0 != randint0(77777L / (plev * plev + 40))) return;
309 case CLASS_WARRIOR_MAGE:
313 if (0 != randint0(75000L / (plev * plev + 40))) return;
318 case CLASS_MINDCRAFTER:
320 case CLASS_BLUE_MAGE:
321 case CLASS_MIRROR_MASTER:
324 if (0 != randint0(55000L / (plev * plev + 40))) return;
329 case CLASS_CHAOS_WARRIOR:
332 if (0 != randint0(80000L / (plev * plev + 40))) return;
341 case CLASS_FORCETRAINER:
344 if (0 != randint0(20000L / (plev * plev + 40))) return;
352 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
360 case CLASS_BEASTMASTER:
363 if (0 != randint0(65000L / (plev * plev + 40))) return;
367 case CLASS_BERSERKER:
376 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
378 /*** Sense everything ***/
380 /* Check everything */
381 for (i = 0; i < INVEN_TOTAL; i++)
385 o_ptr = &p_ptr->inventory_list[i];
387 /* Skip empty slots */
388 if (!o_ptr->k_idx) continue;
390 /* Valid "tval" codes */
417 /* Skip non-sense machines */
420 /* Occasional failure on p_ptr->inventory_list items */
421 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
424 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
429 sense_inventory_aux(i, heavy);
434 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
437 static void sense_inventory2(void)
440 PLAYER_LEVEL plev = p_ptr->lev;
444 /*** Check for "sensing" ***/
446 /* No sensing when confused */
447 if (p_ptr->confused) return;
449 /* Analyze the class */
450 switch (p_ptr->pclass)
456 case CLASS_BERSERKER:
464 case CLASS_CHAOS_WARRIOR:
466 case CLASS_BEASTMASTER:
469 /* Very bad (light) sensing */
470 if (0 != randint0(240000L / (plev + 5))) return;
476 case CLASS_WARRIOR_MAGE:
481 if (0 != randint0(95000L / (plev * plev + 40))) return;
489 case CLASS_FORCETRAINER:
490 case CLASS_MINDCRAFTER:
493 if (0 != randint0(20000L / (plev * plev + 40))) return;
499 case CLASS_HIGH_MAGE:
501 case CLASS_MAGIC_EATER:
502 case CLASS_MIRROR_MASTER:
503 case CLASS_BLUE_MAGE:
506 if (0 != randint0(9000L / (plev * plev + 40))) return;
514 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
520 /*** Sense everything ***/
522 /* Check everything */
523 for (i = 0; i < INVEN_TOTAL; i++)
527 o_ptr = &p_ptr->inventory_list[i];
529 /* Skip empty slots */
530 if (!o_ptr->k_idx) continue;
532 /* Valid "tval" codes */
545 /* Skip non-sense machines */
548 /* Occasional failure on p_ptr->inventory_list items */
549 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
551 sense_inventory_aux(i, TRUE);
556 * @brief パターン終点到達時のテレポート処理を行う
559 static void pattern_teleport(void)
562 DEPTH max_level = 99;
565 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
570 /* Only downward in ironman mode */
571 if (ironman_downward)
572 min_level = current_floor_ptr->dun_level;
575 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
577 if (current_floor_ptr->dun_level > 100)
578 max_level = MAX_DEPTH - 1;
579 else if (current_floor_ptr->dun_level == 100)
584 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
585 min_level = d_info[p_ptr->dungeon_idx].mindepth;
589 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
592 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
594 /* Ask for a level */
595 if (!get_string(ppp, tmp_val, 10)) return;
597 /* Extract request */
598 command_arg = (COMMAND_ARG)atoi(tmp_val);
600 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
602 teleport_player(200, 0L);
609 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
610 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
613 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
615 if (autosave_l) do_cmd_save_game(TRUE);
618 current_floor_ptr->dun_level = command_arg;
622 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
624 p_ptr->inside_quest = 0;
628 * Clear all saved floors
629 * and create a first saved floor
631 prepare_change_floor_mode(CFM_FIRST_FLOOR);
632 p_ptr->leaving = TRUE;
636 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
637 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
639 static bool pattern_effect(void)
643 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
645 if ((prace_is_(RACE_AMBERITE)) &&
646 (p_ptr->cut > 0) && one_in_(10))
651 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
653 switch (pattern_type)
655 case PATTERN_TILE_END:
657 (void)restore_all_status();
658 (void)restore_level();
659 (void)cure_critical_wounds(1000);
661 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
662 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
665 * We could make the healing effect of the
666 * Pattern center one-time only to avoid various kinds
667 * of abuse, like luring the win monster into fighting you
668 * in the middle of the pattern...
672 case PATTERN_TILE_OLD:
676 case PATTERN_TILE_TELEPORT:
680 case PATTERN_TILE_WRECKED:
682 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
686 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
688 else if (!IS_INVULN())
689 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
698 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
699 * @param percent 回復比率
702 static void regenhp(int percent)
708 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
709 if (p_ptr->action == ACTION_HAYAGAKE) return;
711 /* Save the old hitpoints */
712 old_chp = p_ptr->chp;
715 * Extract the new hitpoints
717 * 'percent' is the Regen factor in unit (1/2^16)
720 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
722 /* Convert the unit (1/2^16) to (1/2^32) */
723 s64b_LSHIFT(new_chp, new_chp_frac, 16);
726 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
730 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
732 p_ptr->chp = p_ptr->mhp;
737 if (old_chp != p_ptr->chp)
739 p_ptr->redraw |= (PR_HP);
740 p_ptr->window |= (PW_PLAYER);
747 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
748 * @param upkeep_factor ペット維持によるMPコスト量
749 * @param regen_amount 回復量
752 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
754 MANA_POINT old_csp = p_ptr->csp;
755 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
758 * Excess mana will decay 32 times faster than normal
761 if (p_ptr->csp > p_ptr->msp)
763 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
765 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
767 /* Convert the unit (1/2^16) to (1/2^32) */
768 s64b_LSHIFT(decay, decay_frac, 16);
771 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
774 if (p_ptr->csp < p_ptr->msp)
776 p_ptr->csp = p_ptr->msp;
781 /* Regenerating mana (unless the player has excess mana) */
782 else if (regen_rate > 0)
784 /* (percent/100) is the Regen factor in unit (1/2^16) */
785 MANA_POINT new_mana = 0;
786 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
788 /* Convert the unit (1/2^16) to (1/2^32) */
789 s64b_LSHIFT(new_mana, new_mana_frac, 16);
792 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
794 /* Must set frac to zero even if equal */
795 if (p_ptr->csp >= p_ptr->msp)
797 p_ptr->csp = p_ptr->msp;
803 /* Reduce mana (even when the player has excess mana) */
806 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
807 s32b reduce_mana = 0;
808 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
810 /* Convert the unit (1/2^16) to (1/2^32) */
811 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
814 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
824 if (old_csp != p_ptr->csp)
826 p_ptr->redraw |= (PR_MANA);
827 p_ptr->window |= (PW_PLAYER);
828 p_ptr->window |= (PW_SPELL);
834 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
835 * @param regen_amount 回復量
838 static void regenmagic(int regen_amount)
843 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
845 for (i = 0; i < EATER_EXT*2; i++)
847 if (!p_ptr->magic_num2[i]) continue;
848 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
850 /* Increase remaining charge number like float value */
851 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
852 p_ptr->magic_num1[i] += new_mana;
854 /* Check maximum charge */
855 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
857 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
861 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
863 if (!p_ptr->magic_num1[i]) continue;
864 if (!p_ptr->magic_num2[i]) continue;
866 /* Decrease remaining period for charging */
867 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
868 / (dev * 16 * PY_REGEN_NORMAL);
869 p_ptr->magic_num1[i] -= new_mana;
871 /* Check minimum remaining period for charging */
872 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
879 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
881 * @note Should probably be done during monster turns.
883 static void regen_monsters(void)
888 /* Regenerate everyone */
889 for (i = 1; i < current_floor_ptr->m_max; i++)
891 /* Check the i'th monster */
892 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
893 monster_race *r_ptr = &r_info[m_ptr->r_idx];
895 if (!monster_is_valid(m_ptr)) continue;
897 /* Allow regeneration (if needed) */
898 if (m_ptr->hp < m_ptr->maxhp)
900 /* Hack -- Base regeneration */
901 frac = m_ptr->maxhp / 100;
903 /* Hack -- Minimal regeneration rate */
904 if (!frac) if (one_in_(2)) frac = 1;
906 /* Hack -- Some monsters regenerate quickly */
907 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
909 /* Hack -- Regenerate */
912 /* Do not over-regenerate */
913 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
915 /* Redraw (later) if needed */
916 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
917 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
924 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
926 * @note Should probably be done during monster turns.
928 static void regen_captured_monsters(void)
933 /* Regenerate everyone */
934 for (i = 0; i < INVEN_TOTAL; i++)
937 object_type *o_ptr = &p_ptr->inventory_list[i];
939 if (!o_ptr->k_idx) continue;
940 if (o_ptr->tval != TV_CAPTURE) continue;
941 if (!o_ptr->pval) continue;
945 r_ptr = &r_info[o_ptr->pval];
947 /* Allow regeneration (if needed) */
948 if (o_ptr->xtra4 < o_ptr->xtra5)
950 /* Hack -- Base regeneration */
951 frac = o_ptr->xtra5 / 100;
953 /* Hack -- Minimal regeneration rate */
954 if (!frac) if (one_in_(2)) frac = 1;
956 /* Hack -- Some monsters regenerate quickly */
957 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
959 /* Hack -- Regenerate */
960 o_ptr->xtra4 += (XTRA16)frac;
962 /* Do not over-regenerate */
963 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
970 p_ptr->update |= (PU_COMBINE);
971 p_ptr->window |= (PW_INVEN);
972 p_ptr->window |= (PW_EQUIP);
978 * @brief 寿命つき光源の警告メッセージ処理
979 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
982 static void notice_lite_change(object_type *o_ptr)
984 /* Hack -- notice interesting fuel steps */
985 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
987 p_ptr->window |= (PW_EQUIP);
990 /* Hack -- Special treatment when blind */
993 /* Hack -- save some light for later */
994 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
997 /* The light is now out */
998 else if (o_ptr->xtra4 == 0)
1000 disturb(FALSE, TRUE);
1001 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1003 /* Recalculate torch radius */
1004 p_ptr->update |= (PU_TORCH);
1006 /* Some ego light lose its effects without fuel */
1007 p_ptr->update |= (PU_BONUS);
1010 /* The light is getting dim */
1011 else if (o_ptr->name2 == EGO_LITE_LONG)
1013 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1014 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1016 if (disturb_minor) disturb(FALSE, TRUE);
1017 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1021 /* The light is getting dim */
1022 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1024 if (disturb_minor) disturb(FALSE, TRUE);
1025 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1031 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1032 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1035 static void recharged_notice(object_type *o_ptr)
1037 GAME_TEXT o_name[MAX_NLEN];
1041 /* No inscription */
1042 if (!o_ptr->inscription) return;
1045 s = my_strchr(quark_str(o_ptr->inscription), '!');
1047 /* Process notification request. */
1050 /* Find another '!' */
1053 /* Describe (briefly) */
1054 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1056 /* Notify the player */
1058 msg_format("%sは再充填された。", o_name);
1060 if (o_ptr->number > 1)
1061 msg_format("Your %s are recharged.", o_name);
1063 msg_format("Your %s is recharged.", o_name);
1066 disturb(FALSE, FALSE);
1072 /* Keep looking for '!'s */
1073 s = my_strchr(s + 1, '!');
1078 * @brief プレイヤーの歌に関する継続処理
1081 static void check_music(void)
1083 const magic_type *s_ptr;
1085 MANA_POINT need_mana;
1086 u32b need_mana_frac;
1088 /* Music singed by player */
1089 if (p_ptr->pclass != CLASS_BARD) return;
1090 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1092 if (p_ptr->anti_magic)
1094 stop_singing(p_ptr);
1098 spell = SINGING_SONG_ID(p_ptr);
1099 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1101 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1105 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1107 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1109 stop_singing(p_ptr);
1114 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1116 p_ptr->redraw |= PR_MANA;
1117 if (INTERUPTING_SONG_EFFECT(p_ptr))
1119 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1120 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1121 msg_print(_("歌を再開した。", "You restart singing."));
1122 p_ptr->action = ACTION_SING;
1123 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1124 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1125 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1128 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1129 p_ptr->spell_exp[spell] += 5;
1130 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1131 { 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; }
1132 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1133 { 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; }
1134 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1135 { 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; }
1137 /* Do any effects of continual song */
1138 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1142 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1143 * @param flag 探し出したい呪いフラグ配列
1144 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1147 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1150 int choices[INVEN_TOTAL-INVEN_RARM];
1153 /* Paranoia -- Player has no warning-item */
1154 if (!(p_ptr->cursed & flag)) return NULL;
1156 /* Search Inventry */
1157 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1159 object_type *o_ptr = &p_ptr->inventory_list[i];
1161 if (o_ptr->curse_flags & flag)
1163 choices[number] = i;
1166 else if ((flag == TRC_ADD_L_CURSE) ||
1167 (flag == TRC_ADD_H_CURSE) ||
1168 (flag == TRC_DRAIN_HP) ||
1169 (flag == TRC_DRAIN_MANA) ||
1170 (flag == TRC_CALL_ANIMAL) ||
1171 (flag == TRC_CALL_DEMON) ||
1172 (flag == TRC_CALL_DRAGON) ||
1173 (flag == TRC_CALL_UNDEAD) ||
1174 (flag == TRC_COWARDICE) ||
1175 (flag == TRC_LOW_MELEE) ||
1176 (flag == TRC_LOW_AC) ||
1177 (flag == TRC_LOW_MAGIC) ||
1178 (flag == TRC_FAST_DIGEST) ||
1179 (flag == TRC_SLOW_REGEN) )
1182 BIT_FLAGS flgs[TR_FLAG_SIZE];
1183 object_flags(o_ptr, flgs);
1186 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1187 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1188 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1189 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1190 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1191 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1192 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1193 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1194 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1195 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1196 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1197 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1198 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1199 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1202 if (have_flag(flgs, cf))
1204 choices[number] = i;
1210 /* Choice one of them */
1211 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1214 static void process_world_aux_digestion(void)
1216 if (!p_ptr->inside_battle)
1218 /* Digest quickly when gorged */
1219 if (p_ptr->food >= PY_FOOD_MAX)
1221 /* Digest a lot of food */
1222 (void)set_food(p_ptr->food - 100);
1225 /* Digest normally -- Every 50 game turns */
1226 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1228 /* Basic digestion rate based on speed */
1229 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1231 /* Regeneration takes more food */
1232 if (p_ptr->regenerate)
1234 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1236 if (p_ptr->cursed & TRC_FAST_DIGEST)
1239 /* Slow digestion takes less food */
1240 if (p_ptr->slow_digest)
1243 /* Minimal digestion */
1244 if (digestion < 1) digestion = 1;
1245 /* Maximal digestion */
1246 if (digestion > 100) digestion = 100;
1248 /* Digest some food */
1249 (void)set_food(p_ptr->food - digestion);
1254 if ((p_ptr->food < PY_FOOD_FAINT))
1256 /* Faint occasionally */
1257 if (!p_ptr->paralyzed && (randint0(100) < 10))
1259 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1260 disturb(TRUE, TRUE);
1262 /* Hack -- faint (bypass free action) */
1263 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1266 /* Starve to death (slowly) */
1267 if (p_ptr->food < PY_FOOD_STARVE)
1269 /* Calculate damage */
1270 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1272 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1279 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1280 * / Handle timed damage and regeneration every 10 game turns
1283 static void process_world_aux_hp_and_sp(void)
1285 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1286 bool cave_no_regen = FALSE;
1287 int upkeep_factor = 0;
1289 /* Default regeneration */
1290 int regen_amount = PY_REGEN_NORMAL;
1293 /*** Damage over Time ***/
1295 /* Take damage from poison */
1296 if (p_ptr->poisoned && !IS_INVULN())
1298 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1301 /* Take damage from cuts */
1302 if (p_ptr->cut && !IS_INVULN())
1306 /* Mortal wound or Deep Gash */
1307 if (p_ptr->cut > 1000)
1312 else if (p_ptr->cut > 200)
1318 else if (p_ptr->cut > 100)
1323 else if (p_ptr->cut > 50)
1328 else if (p_ptr->cut > 25)
1333 else if (p_ptr->cut > 10)
1344 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1347 /* (Vampires) Take damage from sunlight */
1348 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1350 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1352 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1354 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1355 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1356 cave_no_regen = TRUE;
1360 if (p_ptr->inventory_list[INVEN_LITE].tval && (p_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1361 !p_ptr->resist_lite)
1363 object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1364 GAME_TEXT o_name [MAX_NLEN];
1365 char ouch [MAX_NLEN+40];
1367 /* Get an object description */
1368 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1369 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1371 cave_no_regen = TRUE;
1373 /* Get an object description */
1374 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1375 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1377 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1381 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1385 if (have_flag(f_ptr->flags, FF_DEEP))
1387 damage = 6000 + randint0(4000);
1389 else if (!p_ptr->levitation)
1391 damage = 3000 + randint0(2000);
1396 if(prace_is_(RACE_ENT)) damage += damage / 3;
1397 if(p_ptr->resist_fire) damage = damage / 3;
1398 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1399 if(p_ptr->levitation) damage = damage / 5;
1401 damage = damage / 100 + (randint0(100) < (damage % 100));
1403 if (p_ptr->levitation)
1405 msg_print(_("熱で火傷した!", "The heat burns you!"));
1406 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1407 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1411 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1412 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1413 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1416 cave_no_regen = TRUE;
1420 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1424 if (have_flag(f_ptr->flags, FF_DEEP))
1426 damage = 6000 + randint0(4000);
1428 else if (!p_ptr->levitation)
1430 damage = 3000 + randint0(2000);
1435 if (p_ptr->resist_cold) damage = damage / 3;
1436 if (IS_OPPOSE_COLD()) damage = damage / 3;
1437 if (p_ptr->levitation) damage = damage / 5;
1439 damage = damage / 100 + (randint0(100) < (damage % 100));
1441 if (p_ptr->levitation)
1443 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1444 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1445 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1449 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1450 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1451 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1454 cave_no_regen = TRUE;
1458 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1462 if (have_flag(f_ptr->flags, FF_DEEP))
1464 damage = 6000 + randint0(4000);
1466 else if (!p_ptr->levitation)
1468 damage = 3000 + randint0(2000);
1473 if (p_ptr->resist_elec) damage = damage / 3;
1474 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1475 if (p_ptr->levitation) damage = damage / 5;
1477 damage = damage / 100 + (randint0(100) < (damage % 100));
1479 if (p_ptr->levitation)
1481 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1482 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1483 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1487 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1488 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1489 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1492 cave_no_regen = TRUE;
1496 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1500 if (have_flag(f_ptr->flags, FF_DEEP))
1502 damage = 6000 + randint0(4000);
1504 else if (!p_ptr->levitation)
1506 damage = 3000 + randint0(2000);
1511 if (p_ptr->resist_acid) damage = damage / 3;
1512 if (IS_OPPOSE_ACID()) damage = damage / 3;
1513 if (p_ptr->levitation) damage = damage / 5;
1515 damage = damage / 100 + (randint0(100) < (damage % 100));
1517 if (p_ptr->levitation)
1519 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1520 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1521 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1525 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1526 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1527 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1530 cave_no_regen = TRUE;
1534 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1538 if (have_flag(f_ptr->flags, FF_DEEP))
1540 damage = 6000 + randint0(4000);
1542 else if (!p_ptr->levitation)
1544 damage = 3000 + randint0(2000);
1549 if (p_ptr->resist_pois) damage = damage / 3;
1550 if (IS_OPPOSE_POIS()) damage = damage / 3;
1551 if (p_ptr->levitation) damage = damage / 5;
1553 damage = damage / 100 + (randint0(100) < (damage % 100));
1555 if (p_ptr->levitation)
1557 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1558 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1559 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1560 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1564 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1565 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1566 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1567 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1570 cave_no_regen = TRUE;
1574 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1575 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1577 if (p_ptr->total_weight > weight_limit())
1579 msg_print(_("溺れている!", "You are drowning!"));
1580 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1581 cave_no_regen = TRUE;
1588 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1590 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1591 if (prace_is_(RACE_ENT)) damage += damage / 3;
1592 if (p_ptr->resist_fire) damage = damage / 3;
1593 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1594 msg_print(_("熱い!", "It's hot!"));
1595 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1597 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1599 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1600 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1601 if (p_ptr->resist_elec) damage = damage / 3;
1602 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1603 msg_print(_("痛い!", "It hurts!"));
1604 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1606 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1608 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1609 if (p_ptr->resist_cold) damage = damage / 3;
1610 if (IS_OPPOSE_COLD()) damage = damage / 3;
1611 msg_print(_("冷たい!", "It's cold!"));
1612 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1616 /* Spectres -- take damage when moving through walls */
1618 * Added: ANYBODY takes damage if inside through walls
1619 * without wraith form -- NOTE: Spectres will never be
1620 * reduced below 0 hp by being inside a stone wall; others
1623 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1625 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1628 cave_no_regen = TRUE;
1630 if (p_ptr->pass_wall)
1632 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1633 dam_desc = _("密度", "density");
1637 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1638 dam_desc = _("硬い岩", "solid rock");
1641 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1646 /*** handle regeneration ***/
1649 if (p_ptr->food < PY_FOOD_WEAK)
1651 /* Lower regeneration */
1652 if (p_ptr->food < PY_FOOD_STARVE)
1656 else if (p_ptr->food < PY_FOOD_FAINT)
1658 regen_amount = PY_REGEN_FAINT;
1662 regen_amount = PY_REGEN_WEAK;
1666 /* Are we walking the pattern? */
1667 if (pattern_effect())
1669 cave_no_regen = TRUE;
1673 /* Regeneration ability */
1674 if (p_ptr->regenerate)
1676 regen_amount = regen_amount * 2;
1678 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1682 if (p_ptr->cursed & TRC_SLOW_REGEN)
1689 /* Searching or Resting */
1690 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1692 regen_amount = regen_amount * 2;
1695 upkeep_factor = calculate_upkeep();
1697 /* No regeneration while special action */
1698 if ((p_ptr->action == ACTION_LEARN) ||
1699 (p_ptr->action == ACTION_HAYAGAKE) ||
1700 (p_ptr->special_defense & KATA_KOUKIJIN))
1702 upkeep_factor += 100;
1705 /* Regenerate the mana */
1706 regenmana(upkeep_factor, regen_amount);
1709 /* Recharge magic eater's power */
1710 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1712 regenmagic(regen_amount);
1715 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1717 while (upkeep_factor > 100)
1719 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1721 do_cmd_pet_dismiss();
1723 upkeep_factor = calculate_upkeep();
1725 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1730 /* Poisoned or cut yields no healing */
1731 if (p_ptr->poisoned) regen_amount = 0;
1732 if (p_ptr->cut) regen_amount = 0;
1734 /* Special floor -- Pattern, in a wall -- yields no healing */
1735 if (cave_no_regen) regen_amount = 0;
1737 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1739 /* Regenerate Hit Points if needed */
1740 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1742 regenhp(regen_amount);
1747 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1748 * / Handle timeout every 10 game turns
1751 static void process_world_aux_timeout(void)
1753 const int dec_count = (easy_band ? 2 : 1);
1755 /*** Timeout Various Things ***/
1758 if (p_ptr->tim_mimic)
1760 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1763 /* Hack -- Hallucinating */
1766 (void)set_image(p_ptr->image - dec_count);
1772 (void)set_blind(p_ptr->blind - dec_count);
1775 /* Times see-invisible */
1776 if (p_ptr->tim_invis)
1778 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1789 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1792 /* Timed temporary elemental brands. -LM- */
1793 if (p_ptr->ele_attack)
1795 p_ptr->ele_attack--;
1797 /* Clear all temporary elemental brands. */
1798 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1801 /* Timed temporary elemental immune. -LM- */
1802 if (p_ptr->ele_immune)
1804 p_ptr->ele_immune--;
1806 /* Clear all temporary elemental brands. */
1807 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1810 /* Timed infra-vision */
1811 if (p_ptr->tim_infra)
1813 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1817 if (p_ptr->tim_stealth)
1819 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1822 /* Timed levitation */
1823 if (p_ptr->tim_levitation)
1825 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1828 /* Timed sh_touki */
1829 if (p_ptr->tim_sh_touki)
1831 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1835 if (p_ptr->tim_sh_fire)
1837 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1841 if (p_ptr->tim_sh_holy)
1843 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1847 if (p_ptr->tim_eyeeye)
1849 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1852 /* Timed resist-magic */
1853 if (p_ptr->resist_magic)
1855 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1858 /* Timed regeneration */
1859 if (p_ptr->tim_regen)
1861 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1864 /* Timed resist nether */
1865 if (p_ptr->tim_res_nether)
1867 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1870 /* Timed resist time */
1871 if (p_ptr->tim_res_time)
1873 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1877 if (p_ptr->tim_reflect)
1879 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1883 if (p_ptr->multishadow)
1885 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1888 /* Timed Robe of dust */
1889 if (p_ptr->dustrobe)
1891 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1894 /* Timed infra-vision */
1895 if (p_ptr->kabenuke)
1897 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1901 if (p_ptr->paralyzed)
1903 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1907 if (p_ptr->confused)
1909 (void)set_confused(p_ptr->confused - dec_count);
1915 (void)set_afraid(p_ptr->afraid - dec_count);
1921 (void)set_fast(p_ptr->fast - 1, TRUE);
1927 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1930 /* Protection from evil */
1931 if (p_ptr->protevil)
1933 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1936 /* Invulnerability */
1939 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1943 if (p_ptr->wraith_form)
1945 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1951 (void)set_hero(p_ptr->hero - 1, TRUE);
1957 (void)set_shero(p_ptr->shero - 1, TRUE);
1963 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1969 (void)set_shield(p_ptr->shield - 1, TRUE);
1973 if (p_ptr->tsubureru)
1975 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1979 if (p_ptr->magicdef)
1981 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1985 if (p_ptr->tsuyoshi)
1987 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1991 if (p_ptr->oppose_acid)
1993 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1996 /* Oppose Lightning */
1997 if (p_ptr->oppose_elec)
1999 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2003 if (p_ptr->oppose_fire)
2005 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2009 if (p_ptr->oppose_cold)
2011 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2015 if (p_ptr->oppose_pois)
2017 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2022 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2025 /*** Poison and Stun and Cut ***/
2028 if (p_ptr->poisoned)
2030 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2032 /* Apply some healing */
2033 (void)set_poisoned(p_ptr->poisoned - adjust);
2039 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2041 /* Apply some healing */
2042 (void)set_stun(p_ptr->stun - adjust);
2048 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2050 /* Hack -- Truly "mortal" wound */
2051 if (p_ptr->cut > 1000) adjust = 0;
2053 /* Apply some healing */
2054 (void)set_cut(p_ptr->cut - adjust);
2060 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2061 * / Handle burning fuel every 10 game turns
2064 static void process_world_aux_light(void)
2066 /* Check for light being wielded */
2067 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2069 /* Burn some fuel in the current lite */
2070 if (o_ptr->tval == TV_LITE)
2072 /* Hack -- Use some fuel (except on artifacts) */
2073 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2075 /* Decrease life-span */
2076 if (o_ptr->name2 == EGO_LITE_LONG)
2078 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2080 else o_ptr->xtra4--;
2082 /* Notice interesting fuel steps */
2083 notice_lite_change(o_ptr);
2090 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2091 * / Handle mutation effects once every 10 game turns
2094 static void process_world_aux_mutation(void)
2096 /* No mutation with effects */
2097 if (!p_ptr->muta2) return;
2099 /* No effect on monster arena */
2100 if (p_ptr->inside_battle) return;
2102 /* No effect on the global map */
2103 if (p_ptr->wild_mode) return;
2105 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2107 disturb(FALSE, TRUE);
2108 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2109 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2110 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2111 (void)set_afraid(0);
2114 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2116 if (!p_ptr->resist_fear)
2118 disturb(FALSE, TRUE);
2119 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2120 set_afraid(p_ptr->afraid + 13 + randint1(26));
2124 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2126 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2128 disturb(FALSE, TRUE);
2129 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2131 teleport_player(40, TELEPORT_PASSIVE);
2135 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2137 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2139 disturb(FALSE, TRUE);
2140 p_ptr->redraw |= PR_EXTRA;
2141 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2144 if (!p_ptr->resist_conf)
2146 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2149 if (!p_ptr->resist_chaos)
2154 if (one_in_(3)) lose_all_info();
2156 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2158 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2159 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2165 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2166 (void)set_image(p_ptr->image + randint0(150) + 150);
2172 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2174 if (!p_ptr->resist_chaos)
2176 disturb(FALSE, TRUE);
2177 p_ptr->redraw |= PR_EXTRA;
2178 (void)set_image(p_ptr->image + randint0(50) + 20);
2182 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2184 disturb(FALSE, TRUE);
2185 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2187 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2190 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2191 !p_ptr->anti_magic && one_in_(9000))
2194 disturb(FALSE, TRUE);
2195 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2196 "Magical energy flows through you! You must release it!"));
2200 (void)get_hack_dir(&dire);
2201 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2204 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2206 bool pet = one_in_(6);
2207 BIT_FLAGS mode = PM_ALLOW_GROUP;
2209 if (pet) mode |= PM_FORCE_PET;
2210 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2212 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2214 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2215 disturb(FALSE, TRUE);
2219 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2221 disturb(FALSE, TRUE);
2224 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2226 if (p_ptr->fast > 0)
2232 set_slow(randint1(30) + 10, FALSE);
2237 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2239 if (p_ptr->slow > 0)
2245 set_fast(randint1(30) + 10, FALSE);
2250 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2252 disturb(FALSE, TRUE);
2253 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2255 banish_monsters(100);
2256 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2260 /* Pick a random shop (except home) */
2263 n = randint0(MAX_STORES);
2265 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2267 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2273 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2277 msg_print(_("影につつまれた。", "A shadow passes over you."));
2280 /* Absorb light from the current possition */
2281 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2286 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2288 /* Absorb some fuel in the current lite */
2289 if (o_ptr->tval == TV_LITE)
2291 /* Use some fuel (except on artifacts) */
2292 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2294 /* Heal the player a bit */
2295 hp_player(o_ptr->xtra4 / 20);
2297 /* Decrease life-span of lite */
2299 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2301 /* Notice interesting fuel steps */
2302 notice_lite_change(o_ptr);
2307 * Unlite the area (radius 10) around player and
2308 * do 50 points damage to every affected monster
2310 unlite_area(50, 10);
2313 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2315 bool pet = one_in_(3);
2316 BIT_FLAGS mode = PM_ALLOW_GROUP;
2318 if (pet) mode |= PM_FORCE_PET;
2319 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2321 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2323 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2324 disturb(FALSE, TRUE);
2328 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2330 disturb(FALSE, TRUE);
2331 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2334 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2336 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2338 if (!lose_mutation(0))
2339 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2341 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2343 disturb(FALSE, TRUE);
2344 msg_print(_("非物質化した!", "You feel insubstantial!"));
2347 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2349 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2353 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2355 int which_stat = randint0(A_MAX);
2356 int sustained = FALSE;
2361 if (p_ptr->sustain_str) sustained = TRUE;
2364 if (p_ptr->sustain_int) sustained = TRUE;
2367 if (p_ptr->sustain_wis) sustained = TRUE;
2370 if (p_ptr->sustain_dex) sustained = TRUE;
2373 if (p_ptr->sustain_con) sustained = TRUE;
2376 if (p_ptr->sustain_chr) sustained = TRUE;
2379 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2385 disturb(FALSE, TRUE);
2386 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2388 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2391 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2393 bool pet = one_in_(5);
2394 BIT_FLAGS mode = PM_ALLOW_GROUP;
2396 if (pet) mode |= PM_FORCE_PET;
2397 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2399 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2401 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2402 disturb(FALSE, TRUE);
2405 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2407 if (p_ptr->tim_esp > 0)
2409 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2410 set_tim_esp(0, TRUE);
2414 msg_print(_("精神が広がった!", "Your mind expands!"));
2415 set_tim_esp(p_ptr->lev, FALSE);
2418 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2420 disturb(FALSE, TRUE);
2421 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2423 set_food(PY_FOOD_WEAK);
2424 if (music_singing_any()) stop_singing(p_ptr);
2425 if (hex_spelling_any()) stop_hex_spell_all();
2428 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2433 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2435 int danger_amount = 0;
2436 MONSTER_IDX monster;
2438 for (monster = 0; monster < current_floor_ptr->m_max; monster++)
2440 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2441 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2442 if (!monster_is_valid(m_ptr)) continue;
2444 if (r_ptr->level >= p_ptr->lev)
2446 danger_amount += r_ptr->level - p_ptr->lev + 1;
2450 if (danger_amount > 100)
2451 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2452 else if (danger_amount > 50)
2453 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2454 else if (danger_amount > 20)
2455 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2456 else if (danger_amount > 10)
2457 msg_print(_("心配な気がする!", "You feel paranoid!"));
2458 else if (danger_amount > 5)
2459 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2461 msg_print(_("寂しい気がする。", "You feel lonely."));
2464 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2466 disturb(FALSE, TRUE);
2467 msg_print(_("無敵な気がする!", "You feel invincible!"));
2469 (void)set_invuln(randint1(8) + 8, FALSE);
2472 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2474 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2478 HIT_POINT healing = p_ptr->csp;
2479 if (healing > wounds) healing = wounds;
2482 p_ptr->csp -= healing;
2483 p_ptr->redraw |= (PR_HP | PR_MANA);
2487 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2489 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2493 HIT_POINT healing = p_ptr->chp;
2494 if (healing > wounds) healing = wounds;
2496 p_ptr->csp += healing;
2497 p_ptr->redraw |= (PR_HP | PR_MANA);
2498 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2502 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2504 INVENTORY_IDX slot = 0;
2505 object_type *o_ptr = NULL;
2507 disturb(FALSE, TRUE);
2508 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2509 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2512 if (has_melee_weapon(INVEN_RARM))
2515 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
2517 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2519 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2523 else if (has_melee_weapon(INVEN_LARM))
2525 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
2528 if (slot && !object_is_cursed(o_ptr))
2530 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2531 inven_drop(slot, 1);
2538 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2539 * / Handle curse effects once every 10 game turns
2542 static void process_world_aux_curse(void)
2544 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2547 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2548 * can actually be useful!
2550 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2552 GAME_TEXT o_name[MAX_NLEN];
2554 int i, i_keep = 0, count = 0;
2556 /* Scan the equipment with random teleport ability */
2557 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2559 BIT_FLAGS flgs[TR_FLAG_SIZE];
2560 o_ptr = &p_ptr->inventory_list[i];
2561 if (!o_ptr->k_idx) continue;
2563 object_flags(o_ptr, flgs);
2565 if (have_flag(flgs, TR_TELEPORT))
2567 /* {.} will stop random teleportation. */
2568 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2571 if (one_in_(count)) i_keep = i;
2576 o_ptr = &p_ptr->inventory_list[i_keep];
2577 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2578 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2579 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2581 disturb(FALSE, TRUE);
2582 teleport_player(50, 0L);
2586 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2587 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2588 disturb(TRUE, TRUE);
2591 /* Make a chainsword noise */
2592 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2595 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2597 disturb(FALSE, FALSE);
2600 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2603 (void)activate_ty_curse(FALSE, &count);
2605 /* Handle experience draining */
2606 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2608 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2609 if (p_ptr->exp < 0) p_ptr->exp = 0;
2610 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2611 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2614 /* Add light curse (Later) */
2615 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2617 BIT_FLAGS new_curse;
2620 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2622 new_curse = get_curse(0, o_ptr);
2623 if (!(o_ptr->curse_flags & new_curse))
2625 GAME_TEXT o_name[MAX_NLEN];
2627 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2629 o_ptr->curse_flags |= new_curse;
2630 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2632 o_ptr->feeling = FEEL_NONE;
2634 p_ptr->update |= (PU_BONUS);
2637 /* Add heavy curse (Later) */
2638 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2640 BIT_FLAGS new_curse;
2643 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2645 new_curse = get_curse(1, o_ptr);
2646 if (!(o_ptr->curse_flags & new_curse))
2648 GAME_TEXT o_name[MAX_NLEN];
2650 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2652 o_ptr->curse_flags |= new_curse;
2653 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2654 o_ptr->feeling = FEEL_NONE;
2656 p_ptr->update |= (PU_BONUS);
2660 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2662 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'))
2664 GAME_TEXT o_name[MAX_NLEN];
2666 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2667 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2668 disturb(FALSE, TRUE);
2672 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2674 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'))
2676 GAME_TEXT o_name[MAX_NLEN];
2678 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2679 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2680 disturb(FALSE, TRUE);
2684 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2686 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2687 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2689 GAME_TEXT o_name[MAX_NLEN];
2691 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2692 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2693 disturb(FALSE, TRUE);
2697 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2699 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2700 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2702 GAME_TEXT o_name[MAX_NLEN];
2704 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2705 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2706 disturb(FALSE, TRUE);
2709 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2711 if (!p_ptr->resist_fear)
2713 disturb(FALSE, TRUE);
2714 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2715 set_afraid(p_ptr->afraid + 13 + randint1(26));
2718 /* Teleport player */
2719 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2721 disturb(FALSE, TRUE);
2723 /* Teleport player */
2724 teleport_player(40, TELEPORT_PASSIVE);
2726 /* Handle HP draining */
2727 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2729 GAME_TEXT o_name[MAX_NLEN];
2731 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2732 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2733 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2735 /* Handle mana draining */
2736 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2738 GAME_TEXT o_name[MAX_NLEN];
2740 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2741 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2742 p_ptr->csp -= MIN(p_ptr->lev, 50);
2746 p_ptr->csp_frac = 0;
2748 p_ptr->redraw |= PR_MANA;
2752 /* Rarely, take damage from the Jewel of Judgement */
2753 if (one_in_(999) && !p_ptr->anti_magic)
2755 object_type *o_ptr = &p_ptr->inventory_list[INVEN_LITE];
2757 if (o_ptr->name1 == ART_JUDGE)
2759 if (object_is_known(o_ptr))
2760 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2762 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2763 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2770 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2771 * / Handle recharging objects once every 10 game turns
2774 static void process_world_aux_recharge(void)
2779 /* Process equipment */
2780 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2782 /* Get the object */
2783 object_type *o_ptr = &p_ptr->inventory_list[i];
2784 if (!o_ptr->k_idx) continue;
2786 /* Recharge activatable objects */
2787 if (o_ptr->timeout > 0)
2792 /* Notice changes */
2793 if (!o_ptr->timeout)
2795 recharged_notice(o_ptr);
2801 /* Notice changes */
2804 p_ptr->window |= (PW_EQUIP);
2809 * Recharge rods. Rods now use timeout to control charging status,
2810 * and each charging rod in a stack decreases the stack's timeout by
2811 * one per current_world_ptr->game_turn. -LM-
2813 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2815 object_type *o_ptr = &p_ptr->inventory_list[i];
2816 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2817 if (!o_ptr->k_idx) continue;
2819 /* Examine all charging rods or stacks of charging rods. */
2820 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2822 /* Determine how many rods are charging. */
2823 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2824 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2826 /* Decrease timeout by that number. */
2827 o_ptr->timeout -= temp;
2829 /* Boundary control. */
2830 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2832 /* Notice changes, provide message if object is inscribed. */
2833 if (!(o_ptr->timeout))
2835 recharged_notice(o_ptr);
2839 /* One of the stack of rod is charged */
2840 else if (o_ptr->timeout % k_ptr->pval)
2847 /* Notice changes */
2850 p_ptr->window |= (PW_INVEN);
2854 /* Process objects on floor */
2855 for (i = 1; i < current_floor_ptr->o_max; i++)
2857 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2859 /* Skip dead objects */
2860 if (!o_ptr->k_idx) continue;
2862 /* Recharge rods on the ground. No messages. */
2863 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2866 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2868 /* Boundary control. */
2869 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2876 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2877 * / Handle involuntary movement once every 10 game turns
2880 static void process_world_aux_movement(void)
2882 /* Delayed Word-of-Recall */
2883 if (p_ptr->word_recall)
2886 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2887 * The player is yanked up/down as soon as
2888 * he loads the autosaved game.
2890 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2891 do_cmd_save_game(TRUE);
2893 /* Count down towards recall */
2894 p_ptr->word_recall--;
2896 p_ptr->redraw |= (PR_STATUS);
2898 /* Activate the recall */
2899 if (!p_ptr->word_recall)
2902 disturb(FALSE, TRUE);
2904 /* Determine the level */
2905 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2907 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2909 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2911 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2913 current_floor_ptr->dun_level = 0;
2914 p_ptr->dungeon_idx = 0;
2916 leave_quest_check();
2917 leave_tower_check();
2919 p_ptr->inside_quest = 0;
2921 p_ptr->leaving = TRUE;
2925 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2927 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2930 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2933 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2934 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2936 /* Nightmare mode makes recall more dangerous */
2937 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2939 if (current_floor_ptr->dun_level < 50)
2941 current_floor_ptr->dun_level *= 2;
2943 else if (current_floor_ptr->dun_level < 99)
2945 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2947 else if (current_floor_ptr->dun_level > 100)
2949 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2953 if (p_ptr->wild_mode)
2955 p_ptr->wilderness_y = p_ptr->y;
2956 p_ptr->wilderness_x = p_ptr->x;
2960 /* Save player position */
2961 p_ptr->oldpx = p_ptr->x;
2962 p_ptr->oldpy = p_ptr->y;
2964 p_ptr->wild_mode = FALSE;
2967 * Clear all saved floors
2968 * and create a first saved floor
2970 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2971 p_ptr->leaving = TRUE;
2973 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2977 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2979 quest_type* const q_ptr = &quest[i];
2982 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2983 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2984 (q_ptr->level < current_floor_ptr->dun_level))
2986 q_ptr->status = QUEST_STATUS_FAILED;
2987 q_ptr->complev = (byte)p_ptr->lev;
2989 q_ptr->comptime = current_world_ptr->play_time;
2990 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2996 sound(SOUND_TPLEVEL);
3001 /* Delayed Alter reality */
3002 if (p_ptr->alter_reality)
3004 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3005 do_cmd_save_game(TRUE);
3007 /* Count down towards alter */
3008 p_ptr->alter_reality--;
3010 p_ptr->redraw |= (PR_STATUS);
3012 /* Activate the alter reality */
3013 if (!p_ptr->alter_reality)
3016 disturb(FALSE, TRUE);
3018 /* Determine the level */
3019 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3021 msg_print(_("世界が変わった!", "The world changes!"));
3024 * Clear all saved floors
3025 * and create a first saved floor
3027 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3028 p_ptr->leaving = TRUE;
3032 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3035 sound(SOUND_TPLEVEL);
3041 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3042 * / Handle certain things once every 10 game turns
3045 static void process_world(void)
3049 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3050 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3051 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3053 extract_day_hour_min(&day, &hour, &min);
3055 /* Update dungeon feeling, and announce it if changed */
3056 update_dungeon_feeling();
3058 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3059 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3061 current_floor_ptr->dun_level = 0;
3062 p_ptr->dungeon_idx = 0;
3063 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3064 p_ptr->inside_arena = FALSE;
3065 p_ptr->wild_mode = FALSE;
3066 p_ptr->leaving = TRUE;
3069 /*** Check monster arena ***/
3070 if (p_ptr->inside_battle && !p_ptr->leaving)
3076 /* Count all hostile monsters */
3077 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3078 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3080 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3082 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3085 win_m_idx = g_ptr->m_idx;
3089 if (number_mon == 0)
3091 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3093 p_ptr->energy_need = 0;
3094 update_gambling_monsters();
3096 else if ((number_mon-1) == 0)
3098 GAME_TEXT m_name[MAX_NLEN];
3099 monster_type *wm_ptr;
3101 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3103 monster_desc(m_name, wm_ptr, 0);
3104 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3107 if (win_m_idx == (sel_monster+1))
3109 msg_print(_("おめでとうございます。", "Congratulations."));
3110 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3111 p_ptr->au += battle_odds;
3115 msg_print(_("残念でした。", "You lost gold."));
3118 p_ptr->energy_need = 0;
3119 update_gambling_monsters();
3121 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3123 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3124 p_ptr->au += kakekin;
3126 p_ptr->energy_need = 0;
3127 update_gambling_monsters();
3131 /* Every 10 game turns */
3132 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3134 /*** Attempt timed autosave ***/
3135 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3137 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3138 do_cmd_save_game(TRUE);
3141 if (mon_fight && !ignore_unview)
3143 msg_print(_("何かが聞こえた。", "You hear noise."));
3146 /*** Handle the wilderness/town (sunshine) ***/
3148 /* While in town/wilderness */
3149 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3151 /* Hack -- Daybreak/Nighfall in town */
3152 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3156 /* Check for dawn */
3157 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3159 if (dawn) day_break();
3165 /* While in the dungeon (vanilla_town or lite_town mode only) */
3166 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3168 /*** Shuffle the Storekeepers ***/
3170 /* Chance is only once a day (while in dungeon) */
3171 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3173 /* Sometimes, shuffle the shop-keepers */
3174 if (one_in_(STORE_SHUFFLE))
3179 /* Pick a random shop (except home and museum) */
3182 n = randint0(MAX_STORES);
3184 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3186 /* Check every feature */
3187 for (i = 1; i < max_f_idx; i++)
3189 feature_type *f_ptr = &f_info[i];
3191 /* Skip empty index */
3192 if (!f_ptr->name) continue;
3194 /* Skip non-store features */
3195 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3197 /* Verify store type */
3198 if (f_ptr->subtype == n)
3200 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3213 /*** Process the monsters ***/
3215 /* Check for creature generation. */
3216 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3217 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3219 /* Make a new monster */
3220 (void)alloc_monster(MAX_SIGHT + 5, 0);
3223 /* Hack -- Check for creature regeneration */
3224 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3225 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3227 if (!p_ptr->leaving)
3231 /* Hack -- Process the counters of monsters if needed */
3232 for (i = 0; i < MAX_MTIMED; i++)
3234 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3242 if (min != prev_min)
3244 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3245 determine_today_mon(FALSE);
3250 * Nightmare mode activates the TY_CURSE at midnight
3251 * Require exact minute -- Don't activate multiple times in a minute
3254 if (ironman_nightmare && (min != prev_min))
3257 /* Every 15 minutes after 11:00 pm */
3258 if ((hour == 23) && !(min % 15))
3260 disturb(FALSE, TRUE);
3265 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3269 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3273 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3277 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3282 /* TY_CURSE activates at midnight! */
3286 disturb(TRUE, TRUE);
3287 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3289 if (p_ptr->wild_mode)
3291 /* Go into large wilderness view */
3292 p_ptr->oldpy = randint1(MAX_HGT - 2);
3293 p_ptr->oldpx = randint1(MAX_WID - 2);
3296 /* Give first move to monsters */
3297 take_turn(p_ptr, 100);
3299 /* HACk -- set the encouter flag for the wilderness generation */
3300 generate_encounter = TRUE;
3303 invoking_midnight_curse = TRUE;
3309 /* Check the Food */
3310 process_world_aux_digestion();
3312 /* Process timed damage and regeneration */
3313 process_world_aux_hp_and_sp();
3315 /* Process timeout */
3316 process_world_aux_timeout();
3319 process_world_aux_light();
3321 /* Process mutation effects */
3322 process_world_aux_mutation();
3324 /* Process curse effects */
3325 process_world_aux_curse();
3327 /* Process recharging */
3328 process_world_aux_recharge();
3330 /* Feel the p_ptr->inventory_list */
3334 /* Involuntary Movement */
3335 process_world_aux_movement();
3339 * @brief ウィザードモードへの導入処理
3340 * / Verify use of "wizard" mode
3341 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3343 static bool enter_wizard_mode(void)
3345 /* Ask first time */
3346 if (!p_ptr->noscore)
3348 /* Wizard mode is not permitted */
3349 if (!allow_debug_opts || arg_wizard)
3351 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3355 /* Mention effects */
3356 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3357 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3360 /* Verify request */
3361 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3366 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3368 p_ptr->noscore |= 0x0002;
3379 * @brief デバッグコマンドへの導入処理
3380 * / Verify use of "debug" commands
3381 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3383 static bool enter_debug_mode(void)
3385 /* Ask first time */
3386 if (!p_ptr->noscore)
3388 /* Debug mode is not permitted */
3389 if (!allow_debug_opts)
3391 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3395 /* Mention effects */
3396 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3397 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3401 /* Verify request */
3402 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3407 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3409 p_ptr->noscore |= 0x0008;
3417 * Hack -- Declare the Debug Routines
3419 extern void do_cmd_debug(void);
3421 #endif /* ALLOW_WIZARD */
3427 * @brief ボーグコマンドへの導入処理
3428 * / Verify use of "borg" commands
3429 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3431 static bool enter_borg_mode(void)
3433 /* Ask first time */
3434 if (!(p_ptr->noscore & 0x0010))
3436 /* Mention effects */
3437 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3438 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3442 /* Verify request */
3443 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3448 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3450 p_ptr->noscore |= 0x0010;
3458 * Hack -- Declare the Ben Borg
3460 extern void do_cmd_borg(void);
3462 #endif /* ALLOW_BORG */
3466 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3467 * / Parse and execute the current command Give "Warning" on illegal commands.
3468 * @todo Make some "blocks"
3471 static void process_command(void)
3473 COMMAND_CODE old_now_message = now_message;
3475 /* Handle repeating the last command */
3481 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3482 reset_concent = TRUE;
3484 /* Parse the command */
3485 switch (command_cmd)
3501 /*** Wizard Commands ***/
3503 /* Toggle Wizard Mode */
3508 p_ptr->wizard = FALSE;
3509 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3511 else if (enter_wizard_mode())
3513 p_ptr->wizard = TRUE;
3514 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3516 p_ptr->update |= (PU_MONSTERS);
3518 /* Redraw "title" */
3519 p_ptr->redraw |= (PR_TITLE);
3527 /* Special "debug" commands */
3530 /* Enter debug mode */
3531 if (enter_debug_mode())
3538 #endif /* ALLOW_WIZARD */
3543 /* Special "borg" commands */
3546 /* Enter borg mode */
3547 if (enter_borg_mode())
3549 if (!p_ptr->wild_mode) do_cmd_borg();
3555 #endif /* ALLOW_BORG */
3559 /*** Inventory Commands ***/
3561 /* Wear/wield equipment */
3564 if (!p_ptr->wild_mode) do_cmd_wield();
3568 /* Take off equipment */
3571 if (!p_ptr->wild_mode) do_cmd_takeoff();
3578 if (!p_ptr->wild_mode) do_cmd_drop();
3582 /* Destroy an item */
3589 /* Equipment list */
3596 /* Inventory list */
3604 /*** Various commands ***/
3606 /* Identify an object */
3613 /* Hack -- toggle windows */
3616 toggle_inven_equip();
3621 /*** Standard "Movement" Commands ***/
3626 if (!p_ptr->wild_mode) do_cmd_alter();
3633 if (!p_ptr->wild_mode) do_cmd_tunnel();
3637 /* Move (usually pick up things) */
3644 /* Move (usually do not pick up) */
3652 /*** Running, Resting, Searching, Staying */
3654 /* Begin Running -- Arg is Max Distance */
3657 if (!p_ptr->wild_mode) do_cmd_run();
3661 /* Stay still (usually pick things up) */
3664 do_cmd_stay(always_pickup);
3668 /* Stay still (usually do not pick up) */
3671 do_cmd_stay(!always_pickup);
3675 /* Rest -- Arg is time */
3682 /* Search for traps/doors */
3689 /* Toggle search mode */
3692 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3693 else set_action(ACTION_SEARCH);
3698 /*** Stairs and Doors and Chests and Traps ***/
3701 case SPECIAL_KEY_STORE:
3707 /* Enter building -KMW- */
3708 case SPECIAL_KEY_BUILDING:
3714 /* Enter quest level -KMW- */
3715 case SPECIAL_KEY_QUEST:
3721 /* Go up staircase */
3724 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3726 if (vanilla_town) break;
3728 if (p_ptr->ambush_flag)
3730 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3734 if (p_ptr->food < PY_FOOD_WEAK)
3736 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3747 /* Go down staircase */
3750 if (p_ptr->wild_mode)
3757 /* Open a door or chest */
3771 /* Jam a door with spikes */
3785 /* Disarm a trap or chest */
3793 /*** Magic and Prayers ***/
3795 /* Gain new spells/prayers */
3798 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3799 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3800 else if (p_ptr->pclass == CLASS_SAMURAI)
3801 do_cmd_gain_hissatsu();
3802 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3803 import_magic_device();
3812 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3813 (p_ptr->pclass == CLASS_BERSERKER) ||
3814 (p_ptr->pclass == CLASS_NINJA) ||
3815 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3816 ) do_cmd_mind_browse();
3817 else if (p_ptr->pclass == CLASS_SMITH)
3819 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3820 do_cmd_magic_eater(TRUE, FALSE);
3821 else if (p_ptr->pclass == CLASS_SNIPER)
3822 do_cmd_snipe_browse();
3823 else do_cmd_browse();
3831 if (!p_ptr->wild_mode)
3833 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3835 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3837 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))
3839 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3842 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3844 concptr which_power = _("魔法", "magic");
3845 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3846 which_power = _("超能力", "psionic powers");
3847 else if (p_ptr->pclass == CLASS_IMITATOR)
3848 which_power = _("ものまね", "imitation");
3849 else if (p_ptr->pclass == CLASS_SAMURAI)
3850 which_power = _("必殺剣", "hissatsu");
3851 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3852 which_power = _("鏡魔法", "mirror magic");
3853 else if (p_ptr->pclass == CLASS_NINJA)
3854 which_power = _("忍術", "ninjutsu");
3855 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3856 which_power = _("祈り", "prayer");
3858 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3861 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3863 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3868 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3869 (p_ptr->pclass == CLASS_BERSERKER) ||
3870 (p_ptr->pclass == CLASS_NINJA) ||
3871 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3874 else if (p_ptr->pclass == CLASS_IMITATOR)
3876 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3877 do_cmd_magic_eater(FALSE, FALSE);
3878 else if (p_ptr->pclass == CLASS_SAMURAI)
3880 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3881 do_cmd_cast_learned();
3882 else if (p_ptr->pclass == CLASS_SMITH)
3884 else if (p_ptr->pclass == CLASS_SNIPER)
3893 /* Issue a pet command */
3900 /*** Use various objects ***/
3902 /* Inscribe an object */
3909 /* Uninscribe an object */
3912 do_cmd_uninscribe();
3916 /* Activate an artifact */
3930 /* Fuel your lantern/torch */
3940 do_cmd_fire(SP_NONE);
3947 do_cmd_throw(1, FALSE, -1);
3961 if (use_command && rogue_like_commands)
3972 /* Quaff a potion */
3975 do_cmd_quaff_potion();
3982 do_cmd_read_scroll();
3989 if (use_command && !rogue_like_commands)
3996 /* Use racial power */
3999 do_cmd_racial_power();
4004 /*** Looking at Things (nearby or on map) ***/
4006 /* Full dungeon map */
4013 /* Locate player on map */
4027 /* Target monster or location */
4036 /*** Help and Such ***/
4045 /* Identify symbol */
4048 do_cmd_query_symbol();
4052 /* Character description */
4055 do_cmd_change_name();
4060 /*** System Commands ***/
4062 /* Hack -- User interface */
4069 /* Single line from a pref file */
4078 do_cmd_reload_autopick();
4084 do_cmd_edit_autopick();
4088 /* Interact with macros */
4095 /* Interact with visuals */
4103 /* Interact with colors */
4111 /* Interact with options */
4115 (void)combine_and_reorder_home(STORE_HOME);
4120 /*** Misc Commands ***/
4136 /* Repeat level feeling */
4143 /* Show previous message */
4146 do_cmd_message_one();
4150 /* Show previous messages */
4153 do_cmd_messages(old_now_message);
4157 /* Show quest status -KMW- */
4160 do_cmd_checkquest();
4164 /* Redraw the screen */
4167 now_message = old_now_message;
4172 #ifndef VERIFY_SAVEFILE
4174 /* Hack -- Save and don't quit */
4177 do_cmd_save_game(FALSE);
4181 #endif /* VERIFY_SAVEFILE */
4191 case SPECIAL_KEY_QUIT:
4193 do_cmd_save_and_exit();
4197 /* Quit (commit suicide) */
4210 /* Check artifacts, uniques, objects */
4217 /* Load "screen dump" */
4220 do_cmd_load_screen();
4224 /* Save "screen dump" */
4227 do_cmd_save_screen();
4231 /* Record/stop "Movie" */
4234 prepare_movie_hooks();
4238 /* Make random artifact list */
4241 spoil_random_artifact("randifact.txt");
4248 if (!p_ptr->wild_mode) do_cmd_travel();
4249 if (p_ptr->special_defense & KATA_MUSOU)
4251 set_action(ACTION_NONE);
4257 /* Hack -- Unknown command */
4260 if (flush_failure) flush();
4264 sound(SOUND_ILLEGAL);
4265 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4270 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4276 if (!p_ptr->energy_use && !now_message)
4277 now_message = old_now_message;
4281 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4284 static void pack_overflow(void)
4286 if (p_ptr->inventory_list[INVEN_PACK].k_idx)
4288 GAME_TEXT o_name[MAX_NLEN];
4291 /* Is auto-destroy done? */
4292 update_creature(p_ptr);
4293 if (!p_ptr->inventory_list[INVEN_PACK].k_idx) return;
4295 /* Access the slot to be dropped */
4296 o_ptr = &p_ptr->inventory_list[INVEN_PACK];
4298 disturb(FALSE, TRUE);
4301 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4302 object_desc(o_name, o_ptr, 0);
4304 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4306 /* Drop it (carefully) near the player */
4307 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4309 /* Modify, Describe, Optimize */
4310 inven_item_increase(INVEN_PACK, -255);
4311 inven_item_describe(INVEN_PACK);
4312 inven_item_optimize(INVEN_PACK);
4319 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4322 static void process_upkeep_with_speed(void)
4324 /* Give the player some energy */
4325 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4327 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4330 /* No current_world_ptr->game_turn yet */
4331 if (p_ptr->enchant_energy_need > 0) return;
4333 while (p_ptr->enchant_energy_need <= 0)
4335 /* Handle the player song */
4336 if (!load) check_music();
4338 /* Hex - Handle the hex spells */
4339 if (!load) check_hex();
4340 if (!load) revenge_spell();
4342 /* There is some randomness of needed energy */
4343 p_ptr->enchant_energy_need += ENERGY_NEED();
4348 * @brief プレイヤーの行動処理 / Process the player
4351 * Notice the annoying code to handle "pack overflow", which\n
4352 * must come first just in case somebody manages to corrupt\n
4353 * the savefiles by clever use of menu commands or something.\n
4355 static void process_player(void)
4359 /*** Apply energy ***/
4361 if (p_ptr->hack_mutation)
4363 msg_print(_("何か変わった気がする!", "You feel different!"));
4365 (void)gain_mutation(p_ptr, 0);
4366 p_ptr->hack_mutation = FALSE;
4369 if (invoking_midnight_curse)
4372 activate_ty_curse(FALSE, &count);
4373 invoking_midnight_curse = FALSE;
4376 if (p_ptr->inside_battle)
4378 for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4380 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4382 if (!monster_is_valid(m_ptr)) continue;
4384 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4385 update_monster(m_idx, FALSE);
4390 /* Give the player some energy */
4391 else if (!(load && p_ptr->energy_need <= 0))
4393 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4396 /* No current_world_ptr->game_turn yet */
4397 if (p_ptr->energy_need > 0) return;
4398 if (!command_rep) prt_time();
4400 /*** Check for interupts ***/
4402 /* Complete resting */
4403 if (p_ptr->resting < 0)
4406 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4409 if ((p_ptr->chp == p_ptr->mhp) &&
4410 (p_ptr->csp >= p_ptr->msp))
4412 set_action(ACTION_NONE);
4416 /* Complete resting */
4417 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4420 if ((p_ptr->chp == p_ptr->mhp) &&
4421 (p_ptr->csp >= p_ptr->msp) &&
4422 !p_ptr->blind && !p_ptr->confused &&
4423 !p_ptr->poisoned && !p_ptr->afraid &&
4424 !p_ptr->stun && !p_ptr->cut &&
4425 !p_ptr->slow && !p_ptr->paralyzed &&
4426 !p_ptr->image && !p_ptr->word_recall &&
4427 !p_ptr->alter_reality)
4429 set_action(ACTION_NONE);
4434 if (p_ptr->action == ACTION_FISH)
4436 Term_xtra(TERM_XTRA_DELAY, 10);
4440 bool success = FALSE;
4441 get_mon_num_prep(monster_is_fishing_target,NULL);
4442 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);
4444 if (r_idx && one_in_(2))
4447 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4448 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4449 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4451 GAME_TEXT m_name[MAX_NLEN];
4452 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4453 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4459 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4461 disturb(FALSE, TRUE);
4465 /* Handle "abort" */
4468 /* Check for "player abort" (semi-efficiently for resting) */
4469 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4474 /* Check for a key */
4477 flush(); /* Flush input */
4479 disturb(FALSE, TRUE);
4481 /* Hack -- Show a Message */
4482 msg_print(_("中断しました。", "Canceled."));
4487 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4489 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4490 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4492 if (MON_CSLEEP(m_ptr))
4494 GAME_TEXT m_name[MAX_NLEN];
4497 (void)set_monster_csleep(p_ptr->riding, 0);
4498 monster_desc(m_name, m_ptr, 0);
4499 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4502 if (MON_STUNNED(m_ptr))
4504 /* Hack -- Recover from stun */
4505 if (set_monster_stunned(p_ptr->riding,
4506 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4508 GAME_TEXT m_name[MAX_NLEN];
4509 monster_desc(m_name, m_ptr, 0);
4510 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4514 if (MON_CONFUSED(m_ptr))
4516 /* Hack -- Recover from confusion */
4517 if (set_monster_confused(p_ptr->riding,
4518 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4520 GAME_TEXT m_name[MAX_NLEN];
4521 monster_desc(m_name, m_ptr, 0);
4522 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4526 if (MON_MONFEAR(m_ptr))
4528 /* Hack -- Recover from fear */
4529 if(set_monster_monfear(p_ptr->riding,
4530 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4532 GAME_TEXT m_name[MAX_NLEN];
4533 monster_desc(m_name, m_ptr, 0);
4534 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4544 if (p_ptr->lightspeed)
4546 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4548 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4550 if(P_PTR_KI < 40) P_PTR_KI = 0;
4551 else P_PTR_KI -= 40;
4552 p_ptr->update |= (PU_BONUS);
4554 if (p_ptr->action == ACTION_LEARN)
4557 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4559 /* Convert the unit (1/2^16) to (1/2^32) */
4560 s64b_LSHIFT(cost, cost_frac, 16);
4562 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4566 p_ptr->csp_frac = 0;
4567 set_action(ACTION_NONE);
4572 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4574 p_ptr->redraw |= PR_MANA;
4577 if (p_ptr->special_defense & KATA_MASK)
4579 if (p_ptr->special_defense & KATA_MUSOU)
4583 set_action(ACTION_NONE);
4588 p_ptr->redraw |= (PR_MANA);
4593 /*** Handle actual user input ***/
4595 /* Repeat until out of energy */
4596 while (p_ptr->energy_need <= 0)
4598 p_ptr->window |= PW_PLAYER;
4599 p_ptr->sutemi = FALSE;
4600 p_ptr->counter = FALSE;
4601 p_ptr->now_damaged = FALSE;
4605 /* Place the cursor on the player */
4606 move_cursor_relative(p_ptr->y, p_ptr->x);
4608 /* Refresh (optional) */
4609 if (fresh_before) Term_fresh();
4611 /* Hack -- Pack Overflow */
4614 /* Hack -- cancel "lurking browse mode" */
4615 if (!command_new) command_see = FALSE;
4617 /* Assume free current_world_ptr->game_turn */
4620 if (p_ptr->inside_battle)
4622 /* Place the cursor on the player */
4623 move_cursor_relative(p_ptr->y, p_ptr->x);
4625 command_cmd = SPECIAL_KEY_BUILDING;
4627 /* Process the command */
4631 /* Paralyzed or Knocked Out */
4632 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4634 take_turn(p_ptr, 100);
4638 else if (p_ptr->action == ACTION_REST)
4641 if (p_ptr->resting > 0)
4643 /* Reduce rest count */
4646 if (!p_ptr->resting) set_action(ACTION_NONE);
4647 p_ptr->redraw |= (PR_STATE);
4650 take_turn(p_ptr, 100);
4654 else if (p_ptr->action == ACTION_FISH)
4656 take_turn(p_ptr, 100);
4668 else if (travel.run)
4675 /* Repeated command */
4676 else if (command_rep)
4678 /* Count this execution */
4681 p_ptr->redraw |= (PR_STATE);
4684 /* Hack -- Assume messages were seen */
4687 /* Clear the top line */
4690 /* Process the command */
4694 /* Normal command */
4697 /* Place the cursor on the player */
4698 move_cursor_relative(p_ptr->y, p_ptr->x);
4701 /* Get a command (normal) */
4702 request_command(FALSE);
4705 /* Process the command */
4709 /* Hack -- Pack Overflow */
4715 if (p_ptr->energy_use)
4717 /* Use some energy */
4718 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4720 /* The Randomness is irrelevant */
4721 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4725 /* There is some randomness of needed energy */
4726 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4729 /* Hack -- constant hallucination */
4730 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4733 /* Shimmer monsters if needed */
4734 if (shimmer_monsters)
4736 /* Clear the flag */
4737 shimmer_monsters = FALSE;
4739 /* Shimmer multi-hued monsters */
4740 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4742 monster_type *m_ptr;
4743 monster_race *r_ptr;
4745 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4746 if (!monster_is_valid(m_ptr)) continue;
4748 /* Skip unseen monsters */
4749 if (!m_ptr->ml) continue;
4751 /* Access the monster race */
4752 r_ptr = &r_info[m_ptr->ap_r_idx];
4754 /* Skip non-multi-hued monsters */
4755 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4758 /* Reset the flag */
4759 shimmer_monsters = TRUE;
4761 /* Redraw regardless */
4762 lite_spot(m_ptr->fy, m_ptr->fx);
4767 /* Handle monster detection */
4768 if (repair_monsters)
4770 /* Reset the flag */
4771 repair_monsters = FALSE;
4773 /* Rotate detection flags */
4774 for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++)
4776 monster_type *m_ptr;
4777 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4778 if (!monster_is_valid(m_ptr)) continue;
4780 /* Nice monsters get mean */
4781 if (m_ptr->mflag & MFLAG_NICE)
4783 /* Nice monsters get mean */
4784 m_ptr->mflag &= ~(MFLAG_NICE);
4787 /* Handle memorized monsters */
4788 if (m_ptr->mflag2 & MFLAG2_MARK)
4790 /* Maintain detection */
4791 if (m_ptr->mflag2 & MFLAG2_SHOW)
4794 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4796 /* Still need repairs */
4797 repair_monsters = TRUE;
4800 /* Remove detection */
4804 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4806 /* Assume invisible */
4808 update_monster(m_idx, FALSE);
4810 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4811 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4813 /* Redraw regardless */
4814 lite_spot(m_ptr->fy, m_ptr->fx);
4819 if (p_ptr->pclass == CLASS_IMITATOR)
4822 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4825 for (j = 0; j < p_ptr->mane_num; j++)
4827 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4828 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4832 p_ptr->redraw |= (PR_IMITATION);
4834 if (p_ptr->action == ACTION_LEARN)
4837 p_ptr->redraw |= (PR_STATE);
4840 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4843 p_ptr->redraw |= (PR_MAP);
4844 p_ptr->update |= (PU_MONSTERS);
4845 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4847 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4849 p_ptr->timewalk = FALSE;
4850 p_ptr->energy_need = ENERGY_NEED();
4856 /* Hack -- notice death */
4857 if (!p_ptr->playing || p_ptr->is_dead)
4859 p_ptr->timewalk = FALSE;
4864 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
4866 /* Handle "leaving" */
4867 if (p_ptr->leaving) break;
4870 /* Update scent trail */
4875 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4879 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4880 * ゲームを終了するかのいずれかまでループする。
4883 * This function will not exit until the level is completed,\n
4884 * the user dies, or the game is terminated.\n
4887 static void dungeon(bool load_game)
4891 /* Set the base level */
4892 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4894 /* Reset various flags */
4895 is_loading_now = FALSE;
4898 p_ptr->leaving = FALSE;
4900 /* Reset the "command" vars */
4903 #if 0 /* Don't reset here --- It's used for Arena */
4912 /* Cancel the target */
4916 p_ptr->ambush_flag = FALSE;
4918 /* Cancel the health bar */
4921 /* Check visual effects */
4922 shimmer_monsters = TRUE;
4923 shimmer_objects = TRUE;
4924 repair_monsters = TRUE;
4925 repair_objects = TRUE;
4928 disturb(TRUE, TRUE);
4930 /* Get index of current quest (if any) */
4931 quest_num = quest_number(current_floor_ptr->dun_level);
4933 /* Inside a quest? */
4936 /* Mark the quest monster */
4937 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4940 /* Track maximum player level */
4941 if (p_ptr->max_plv < p_ptr->lev)
4943 p_ptr->max_plv = p_ptr->lev;
4947 /* Track maximum dungeon level (if not in quest -KMW-) */
4948 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4950 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4951 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4954 (void)calculate_upkeep();
4956 /* Validate the panel */
4957 panel_bounds_center();
4959 /* Verify the panel */
4965 /* Enter "xtra" mode */
4966 character_xtra = TRUE;
4968 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4969 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4970 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);
4974 /* Leave "xtra" mode */
4975 character_xtra = FALSE;
4977 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4978 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4982 if (quest_num && (is_fixed_quest_idx(quest_num) &&
4983 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
4984 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
4986 if (p_ptr->inside_battle)
4990 p_ptr->energy_need = 0;
4991 update_gambling_monsters();
4995 msg_print(_("試合開始!", "Ready..Fight!"));
5000 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5001 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5003 /* Hack -- notice death or departure */
5004 if (!p_ptr->playing || p_ptr->is_dead) return;
5006 /* Print quest message if appropriate */
5007 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5009 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5010 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5012 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5014 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5016 msg_format("この階には%sの主である%sが棲んでいる。",
5017 d_name+d_info[p_ptr->dungeon_idx].name,
5018 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5020 msg_format("%^s lives in this level as the keeper of %s.",
5021 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5022 d_name+d_info[p_ptr->dungeon_idx].name);
5026 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5028 /*** Process this dungeon level ***/
5030 /* Reset the monster generation level */
5031 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5033 /* Reset the object generation level */
5034 current_floor_ptr->object_level = current_floor_ptr->base_level;
5036 is_loading_now = TRUE;
5038 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5039 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5040 p_ptr->energy_need = 0;
5042 /* Not leaving dungeon */
5043 p_ptr->leaving_dungeon = FALSE;
5045 /* Initialize monster process */
5051 /* Hack -- Compact the monster list occasionally */
5052 if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5054 /* Hack -- Compress the monster list occasionally */
5055 if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0);
5058 /* Hack -- Compact the object list occasionally */
5059 if (current_floor_ptr->o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5061 /* Hack -- Compress the object list occasionally */
5062 if (current_floor_ptr->o_cnt + 32 < current_floor_ptr->o_max) compact_objects(0);
5064 /* Process the player */
5066 process_upkeep_with_speed();
5070 /* Hack -- Hilite the player */
5071 move_cursor_relative(p_ptr->y, p_ptr->x);
5073 /* Optional fresh */
5074 if (fresh_after) Term_fresh();
5076 /* Hack -- Notice death or departure */
5077 if (!p_ptr->playing || p_ptr->is_dead) break;
5079 /* Process all of the monsters */
5084 /* Hack -- Hilite the player */
5085 move_cursor_relative(p_ptr->y, p_ptr->x);
5087 /* Optional fresh */
5088 if (fresh_after) Term_fresh();
5090 /* Hack -- Notice death or departure */
5091 if (!p_ptr->playing || p_ptr->is_dead) break;
5093 /* Process the world */
5098 /* Hack -- Hilite the player */
5099 move_cursor_relative(p_ptr->y, p_ptr->x);
5101 /* Optional fresh */
5102 if (fresh_after) Term_fresh();
5104 /* Hack -- Notice death or departure */
5105 if (!p_ptr->playing || p_ptr->is_dead) break;
5107 /* Count game turns */
5108 current_world_ptr->game_turn++;
5110 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5112 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5113 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5116 prevent_turn_overflow();
5118 /* Handle "leaving" */
5119 if (p_ptr->leaving) break;
5121 if (wild_regen) wild_regen--;
5124 /* Inside a quest and non-unique questor? */
5125 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5127 /* Un-mark the quest monster */
5128 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5131 /* Not save-and-quit and not dead? */
5132 if (p_ptr->playing && !p_ptr->is_dead)
5135 * Maintain Unique monsters and artifact, save current
5136 * floor, then prepare next floor
5140 /* Forget the flag */
5141 reinit_wilderness = FALSE;
5144 /* Write about current level on the play record once per level */
5150 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5153 * Modified by Arcum Dagsson to support
5154 * separate macro files for different realms.
5156 static void load_all_pref_files(void)
5160 /* Access the "user" pref file */
5161 sprintf(buf, "user.prf");
5163 /* Process that file */
5164 process_pref_file(buf);
5166 /* Access the "user" system pref file */
5167 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5169 /* Process that file */
5170 process_pref_file(buf);
5172 /* Access the "race" pref file */
5173 sprintf(buf, "%s.prf", rp_ptr->title);
5175 /* Process that file */
5176 process_pref_file(buf);
5178 /* Access the "class" pref file */
5179 sprintf(buf, "%s.prf", cp_ptr->title);
5181 /* Process that file */
5182 process_pref_file(buf);
5184 /* Access the "character" pref file */
5185 sprintf(buf, "%s.prf", player_base);
5187 /* Process that file */
5188 process_pref_file(buf);
5190 /* Access the "realm 1" pref file */
5191 if (p_ptr->realm1 != REALM_NONE)
5193 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5195 /* Process that file */
5196 process_pref_file(buf);
5199 /* Access the "realm 2" pref file */
5200 if (p_ptr->realm2 != REALM_NONE)
5202 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5204 /* Process that file */
5205 process_pref_file(buf);
5209 /* Load an autopick preference file */
5210 autopick_load_pref(FALSE);
5214 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5217 * If the "new_game" parameter is true, then, after loading the
5218 * savefile, we will commit suicide, if necessary, to allow the
5219 * player to start a new game.
5221 void play_game(bool new_game)
5224 bool load_game = TRUE;
5225 bool init_random_seed = FALSE;
5235 else if (chuukei_server)
5237 prepare_chuukei_hooks();
5248 p_ptr->hack_mutation = FALSE;
5250 /* Hack -- Character is "icky" */
5251 character_icky = TRUE;
5253 /* Make sure main term is active */
5254 Term_activate(angband_term[0]);
5256 /* Initialise the resize hooks */
5257 angband_term[0]->resize_hook = resize_map;
5259 for (i = 1; i < 8; i++)
5261 /* Does the term exist? */
5262 if (angband_term[i])
5264 /* Add the redraw on resize hook */
5265 angband_term[i]->resize_hook = redraw_window;
5269 /* Hack -- current_world_ptr->game_turn off the cursor */
5270 (void)Term_set_cursor(0);
5273 /* Attempt to load */
5276 quit(_("セーブファイルが壊れています", "broken savefile"));
5279 /* Extract the options */
5280 extract_option_vars();
5282 /* Report waited score */
5283 if (p_ptr->wait_report_score)
5288 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5291 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5292 update_creature(p_ptr);
5294 p_ptr->is_dead = TRUE;
5296 start_time = (u32b)time(NULL);
5298 /* No suspending now */
5299 signals_ignore_tstp();
5301 /* Hack -- Character is now "icky" */
5302 character_icky = TRUE;
5304 /* Build the filename */
5305 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5307 /* Open the high score file, for reading/writing */
5308 highscore_fd = fd_open(buf, O_RDWR);
5310 /* 町名消失バグ対策(#38205) Init the wilderness */
5311 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5313 /* Handle score, show Top scores */
5314 success = send_world_score(TRUE);
5316 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5318 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5323 p_ptr->wait_report_score = FALSE;
5325 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5327 /* Shut the high score file */
5328 (void)fd_close(highscore_fd);
5330 /* Forget the high score fd */
5333 /* Allow suspending now */
5334 signals_handle_tstp();
5339 creating_savefile = new_game;
5341 /* Nothing loaded */
5342 if (!character_loaded)
5344 /* Make new player */
5347 /* The dungeon is not ready */
5348 character_dungeon = FALSE;
5350 /* Prepare to init the RNG */
5351 init_random_seed = TRUE;
5353 /* Initialize the saved floors data */
5354 init_saved_floors(FALSE);
5357 /* Old game is loaded. But new game is requested. */
5360 /* Initialize the saved floors data */
5361 init_saved_floors(TRUE);
5364 /* Process old character */
5367 /* Process the player name */
5368 process_player_name(FALSE);
5372 if (init_random_seed)
5377 /* Roll new character */
5380 /* The dungeon is not ready */
5381 character_dungeon = FALSE;
5384 current_floor_ptr->dun_level = 0;
5385 p_ptr->inside_quest = 0;
5386 p_ptr->inside_arena = FALSE;
5387 p_ptr->inside_battle = FALSE;
5391 /* Hack -- seed for flavors */
5392 current_world_ptr->seed_flavor = randint0(0x10000000);
5394 /* Hack -- seed for town layout */
5395 current_world_ptr->seed_town = randint0(0x10000000);
5397 /* Roll up a new character */
5405 determine_bounty_uniques();
5406 determine_today_mon(FALSE);
5408 /* Initialize object array */
5413 write_level = FALSE;
5415 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5417 " ---- Restart Game ----"));
5420 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5421 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5423 if (p_ptr->riding == -1)
5426 for (i = current_floor_ptr->m_max; i > 0; i--)
5428 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5437 creating_savefile = FALSE;
5439 p_ptr->teleport_town = FALSE;
5440 p_ptr->sutemi = FALSE;
5441 current_world_ptr->timewalk_m_idx = 0;
5442 p_ptr->now_damaged = FALSE;
5444 start_time = time(NULL) - 1;
5445 record_o_name[0] = '\0';
5447 /* Reset map panel */
5448 panel_row_min = current_floor_ptr->height;
5449 panel_col_min = current_floor_ptr->width;
5451 /* Sexy gal gets bonus to maximum weapon skill of whip */
5452 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5453 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5455 /* Fill the arrays of floors and walls in the good proportions */
5456 set_floor_and_wall(p_ptr->dungeon_idx);
5458 /* Flavor the objects */
5461 /* Flash a message */
5462 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5464 /* Flush the message */
5468 /* Hack -- Enter wizard mode */
5471 if (enter_wizard_mode())
5473 p_ptr->wizard = TRUE;
5475 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5477 /* Initialize the saved floors data */
5478 init_saved_floors(TRUE);
5481 p_ptr->inside_quest = 0;
5483 /* Avoid crash in update_view() */
5484 p_ptr->y = p_ptr->x = 10;
5487 else if (p_ptr->is_dead)
5489 quit("Already dead.");
5493 /* Initialize the town-buildings if necessary */
5494 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5496 /* Init the wilderness */
5498 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5501 init_flags = INIT_ONLY_BUILDINGS;
5503 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5505 select_floor_music();
5509 /* Generate a dungeon level if needed */
5510 if (!character_dungeon)
5517 /* HACK -- Restore from panic-save */
5518 if (p_ptr->panic_save)
5520 /* No player? -- Try to regenerate floor */
5521 if (!p_ptr->y || !p_ptr->x)
5523 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5527 /* Still no player? -- Try to locate random place */
5528 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5530 /* No longer in panic */
5531 p_ptr->panic_save = 0;
5535 /* Character is now "complete" */
5536 character_generated = TRUE;
5539 /* Hack -- Character is no longer "icky" */
5540 character_icky = FALSE;
5546 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5547 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5552 p_ptr->playing = TRUE;
5554 /* Reset the visual mappings */
5557 /* Load the "pref" files */
5558 load_all_pref_files();
5560 /* Give startup outfit (after loading pref files) */
5566 /* React to changes */
5567 Term_xtra(TERM_XTRA_REACT, 0);
5569 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5570 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5573 /* Set or clear "rogue_like_commands" if requested */
5574 if (arg_force_original) rogue_like_commands = FALSE;
5575 if (arg_force_roguelike) rogue_like_commands = TRUE;
5577 /* Hack -- Enforce "delayed death" */
5578 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5580 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5582 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5584 monster_type *m_ptr;
5585 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5586 monster_race *r_ptr = &r_info[pet_r_idx];
5587 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5588 (PM_FORCE_PET | PM_NO_KAGE));
5589 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5590 m_ptr->mspeed = r_ptr->speed;
5591 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5592 m_ptr->max_maxhp = m_ptr->maxhp;
5593 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5594 m_ptr->dealt_damage = 0;
5595 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5598 (void)combine_and_reorder_home(STORE_HOME);
5599 (void)combine_and_reorder_home(STORE_MUSEUM);
5601 select_floor_music();
5606 /* Process the level */
5609 /* Hack -- prevent "icky" message */
5610 character_xtra = TRUE;
5614 character_xtra = FALSE;
5616 /* Cancel the target */
5619 /* Cancel the health bar */
5626 /* Handle "quit and save" */
5627 if (!p_ptr->playing && !p_ptr->is_dead) break;
5629 /* Erase the old current_floor_ptr->grid_array */
5631 if (!p_ptr->is_dead) wipe_m_list();
5638 /* Accidental Death */
5639 if (p_ptr->playing && p_ptr->is_dead)
5641 if (p_ptr->inside_arena)
5643 p_ptr->inside_arena = FALSE;
5644 if (p_ptr->arena_number > MAX_ARENA_MONS)
5645 p_ptr->arena_number++;
5647 p_ptr->arena_number = -1 - p_ptr->arena_number;
5648 p_ptr->is_dead = FALSE;
5650 p_ptr->chp_frac = 0;
5651 p_ptr->exit_bldg = TRUE;
5654 /* Leave through the exit */
5655 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5657 /* prepare next floor */
5662 /* Mega-Hack -- Allow player to cheat death */
5663 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5670 /* Handle "death" */
5671 if (p_ptr->is_dead) break;
5673 /* Make a new level */
5685 * @brief ゲームターンからの実時間換算を行うための補正をかける
5686 * @param hoge ゲームターン
5687 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5688 * @return 修正をかけた後のゲームターン
5690 s32b turn_real(s32b hoge)
5692 switch (p_ptr->start_race)
5698 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5705 * @brief ターンのオーバーフローに対する対処
5706 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5707 * @return 修正をかけた後のゲームターン
5709 void prevent_turn_overflow(void)
5711 int rollback_days, i, j;
5712 s32b rollback_turns;
5714 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5716 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5717 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5719 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5720 else current_world_ptr->game_turn = 1;
5721 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5722 else current_floor_ptr->generated_turn = 1;
5723 if (old_battle > rollback_turns) old_battle -= rollback_turns;
5724 else old_battle = 1;
5725 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5726 else p_ptr->feeling_turn = 1;
5728 for (i = 1; i < max_towns; i++)
5730 for (j = 0; j < MAX_STORES; j++)
5732 store_type *st_ptr = &town_info[i].store[j];
5734 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5736 st_ptr->last_visit -= rollback_turns;
5737 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5740 if (st_ptr->store_open)
5742 st_ptr->store_open -= rollback_turns;
5743 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5751 * Close up the current game (player may or may not be dead)
5755 * This function is called only from "main.c" and "signals.c".
5758 void close_game(void)
5761 bool do_send = TRUE;
5763 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5766 /* Flush the messages */
5769 /* Flush the input */
5773 /* No suspending now */
5774 signals_ignore_tstp();
5777 /* Hack -- Character is now "icky" */
5778 character_icky = TRUE;
5781 /* Build the filename */
5782 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5784 /* Grab permissions */
5787 /* Open the high score file, for reading/writing */
5788 highscore_fd = fd_open(buf, O_RDWR);
5790 /* Drop permissions */
5796 /* Handle retirement */
5797 if (p_ptr->total_winner) kingly();
5800 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5802 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5804 else do_send = FALSE;
5811 /* Show more info */
5817 if ((!send_world_score(do_send)))
5819 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5820 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5822 p_ptr->wait_report_score = TRUE;
5823 p_ptr->is_dead = FALSE;
5824 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5827 if (!p_ptr->wait_report_score)
5830 else if (highscore_fd >= 0)
5832 display_scores_aux(0, 10, -1, NULL);
5835 /* Dump bones file */
5844 do_cmd_save_game(FALSE);
5846 /* Prompt for scores */
5847 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5848 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5850 /* Predict score (or ESCAPE) */
5851 if (inkey() != ESCAPE) predict_score();
5855 /* Shut the high score file */
5856 (void)fd_close(highscore_fd);
5858 /* Forget the high score fd */
5861 /* Kill all temporal files */
5862 clear_saved_floor_files();
5864 /* Allow suspending now */
5865 signals_handle_tstp();