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.
14 #include "cmd-activate.h"
16 #include "cmd-hissatsu.h"
18 #include "cmd-magiceat.h"
20 #include "cmd-quaff.h"
22 #include "cmd-smith.h"
23 #include "cmd-usestaff.h"
24 #include "cmd-zaprod.h"
25 #include "cmd-zapwand.h"
28 #include "floor-events.h"
30 #include "object-curse.h"
31 #include "object-flavor.h"
34 #include "spells-summon.h"
35 #include "spells-object.h"
36 #include "spells-status.h"
37 #include "spells-floor.h"
38 #include "monsterrace-hook.h"
44 #include "player-move.h"
45 #include "player-status.h"
46 #include "cmd-spell.h"
47 #include "realm-hex.h"
48 #include "object-hook.h"
50 #include "monster-status.h"
51 #include "floor-save.h"
54 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
55 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
58 * @brief 擬似鑑定を実際に行い判定を反映する
59 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
60 * @param heavy 重度の擬似鑑定を行うならばTRUE
63 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
66 object_type *o_ptr = &inventory[slot];
67 GAME_TEXT o_name[MAX_NLEN];
69 /* We know about it already, do not tell us again */
70 if (o_ptr->ident & (IDENT_SENSE))return;
72 /* It is fully known, no information needed */
73 if (object_is_known(o_ptr)) return;
75 /* Check for a feeling */
76 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
78 /* Skip non-feelings */
82 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
93 feel = FEEL_EXCELLENT;
99 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
101 feel = FEEL_UNCURSED;
106 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
112 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
119 feel = FEEL_WORTHLESS;
124 feel = FEEL_TERRIBLE;
130 /* Stop everything */
131 if (disturb_minor) disturb(FALSE, FALSE);
133 /* Get an object description */
134 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
136 /* Message (equipment) */
137 if (slot >= INVEN_RARM)
140 msg_format("%s%s(%c)は%sという感じがする...",
141 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
143 msg_format("You feel the %s (%c) you are %s %s %s...",
144 o_name, index_to_label(slot), describe_use(slot),
145 ((o_ptr->number == 1) ? "is" : "are"),
146 game_inscriptions[feel]);
151 /* Message (inventory) */
155 msg_format("ザックの中の%s(%c)は%sという感じがする...",
156 o_name, index_to_label(slot),game_inscriptions[feel]);
158 msg_format("You feel the %s (%c) in your pack %s %s...",
159 o_name, index_to_label(slot),
160 ((o_ptr->number == 1) ? "is" : "are"),
161 game_inscriptions[feel]);
166 o_ptr->ident |= (IDENT_SENSE);
168 /* Set the "inscription" */
169 o_ptr->feeling = feel;
171 /* Auto-inscription/destroy */
172 autopick_alter_item(slot, destroy_feeling);
173 p_ptr->update |= (PU_COMBINE | PU_REORDER);
175 p_ptr->window |= (PW_INVEN | PW_EQUIP);
181 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
184 * Sense the inventory\n
186 * Class 0 = Warrior --> fast and heavy\n
187 * Class 1 = Mage --> slow and light\n
188 * Class 2 = Priest --> fast but light\n
189 * Class 3 = Rogue --> okay and heavy\n
190 * Class 4 = Ranger --> slow but heavy (changed!)\n
191 * Class 5 = Paladin --> slow but heavy\n
193 static void sense_inventory1(void)
196 PLAYER_LEVEL plev = p_ptr->lev;
201 /*** Check for "sensing" ***/
203 /* No sensing when confused */
204 if (p_ptr->confused) return;
206 /* Analyze the class */
207 switch (p_ptr->pclass)
215 if (0 != randint0(9000L / (plev * plev + 40))) return;
226 if (0 != randint0(6000L / (plev * plev + 50))) return;
235 case CLASS_HIGH_MAGE:
237 case CLASS_MAGIC_EATER:
239 /* Very bad (light) sensing */
240 if (0 != randint0(240000L / (plev + 5))) return;
248 /* Good (light) sensing */
249 if (0 != randint0(10000L / (plev * plev + 40))) return;
258 if (0 != randint0(20000L / (plev * plev + 40))) return;
269 if (0 != randint0(95000L / (plev * plev + 40))) return;
281 if (0 != randint0(77777L / (plev * plev + 40))) return;
289 case CLASS_WARRIOR_MAGE:
293 if (0 != randint0(75000L / (plev * plev + 40))) return;
298 case CLASS_MINDCRAFTER:
300 case CLASS_BLUE_MAGE:
301 case CLASS_MIRROR_MASTER:
304 if (0 != randint0(55000L / (plev * plev + 40))) return;
309 case CLASS_CHAOS_WARRIOR:
312 if (0 != randint0(80000L / (plev * plev + 40))) return;
321 case CLASS_FORCETRAINER:
324 if (0 != randint0(20000L / (plev * plev + 40))) return;
332 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
340 case CLASS_BEASTMASTER:
343 if (0 != randint0(65000L / (plev * plev + 40))) return;
347 case CLASS_BERSERKER:
356 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
358 /*** Sense everything ***/
360 /* Check everything */
361 for (i = 0; i < INVEN_TOTAL; i++)
365 o_ptr = &inventory[i];
367 /* Skip empty slots */
368 if (!o_ptr->k_idx) continue;
370 /* Valid "tval" codes */
397 /* Skip non-sense machines */
400 /* Occasional failure on inventory items */
401 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
404 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
409 sense_inventory_aux(i, heavy);
414 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
417 static void sense_inventory2(void)
420 PLAYER_LEVEL plev = p_ptr->lev;
424 /*** Check for "sensing" ***/
426 /* No sensing when confused */
427 if (p_ptr->confused) return;
429 /* Analyze the class */
430 switch (p_ptr->pclass)
436 case CLASS_BERSERKER:
444 case CLASS_CHAOS_WARRIOR:
446 case CLASS_BEASTMASTER:
449 /* Very bad (light) sensing */
450 if (0 != randint0(240000L / (plev + 5))) return;
456 case CLASS_WARRIOR_MAGE:
461 if (0 != randint0(95000L / (plev * plev + 40))) return;
469 case CLASS_FORCETRAINER:
470 case CLASS_MINDCRAFTER:
473 if (0 != randint0(20000L / (plev * plev + 40))) return;
479 case CLASS_HIGH_MAGE:
481 case CLASS_MAGIC_EATER:
482 case CLASS_MIRROR_MASTER:
483 case CLASS_BLUE_MAGE:
486 if (0 != randint0(9000L / (plev * plev + 40))) return;
494 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
500 /*** Sense everything ***/
502 /* Check everything */
503 for (i = 0; i < INVEN_TOTAL; i++)
507 o_ptr = &inventory[i];
509 /* Skip empty slots */
510 if (!o_ptr->k_idx) continue;
512 /* Valid "tval" codes */
525 /* Skip non-sense machines */
528 /* Occasional failure on inventory items */
529 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
531 sense_inventory_aux(i, TRUE);
536 * @brief パターン終点到達時のテレポート処理を行う
539 static void pattern_teleport(void)
542 DEPTH max_level = 99;
545 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
550 /* Only downward in ironman mode */
551 if (ironman_downward)
552 min_level = current_floor_ptr->dun_level;
555 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
557 if (current_floor_ptr->dun_level > 100)
558 max_level = MAX_DEPTH - 1;
559 else if (current_floor_ptr->dun_level == 100)
564 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
565 min_level = d_info[p_ptr->dungeon_idx].mindepth;
569 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
572 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
574 /* Ask for a level */
575 if (!get_string(ppp, tmp_val, 10)) return;
577 /* Extract request */
578 command_arg = (COMMAND_ARG)atoi(tmp_val);
580 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
582 teleport_player(200, 0L);
589 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
590 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
593 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
595 if (autosave_l) do_cmd_save_game(TRUE);
598 current_floor_ptr->dun_level = command_arg;
602 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
604 p_ptr->inside_quest = 0;
608 * Clear all saved floors
609 * and create a first saved floor
611 prepare_change_floor_mode(CFM_FIRST_FLOOR);
612 p_ptr->leaving = TRUE;
616 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
617 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
619 static bool pattern_effect(void)
623 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
625 if ((prace_is_(RACE_AMBERITE)) &&
626 (p_ptr->cut > 0) && one_in_(10))
631 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
633 switch (pattern_type)
635 case PATTERN_TILE_END:
637 (void)restore_all_status();
638 (void)restore_level();
639 (void)cure_critical_wounds(1000);
641 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
642 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
645 * We could make the healing effect of the
646 * Pattern center one-time only to avoid various kinds
647 * of abuse, like luring the win monster into fighting you
648 * in the middle of the pattern...
652 case PATTERN_TILE_OLD:
656 case PATTERN_TILE_TELEPORT:
660 case PATTERN_TILE_WRECKED:
662 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
666 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
668 else if (!IS_INVULN())
669 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
678 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
679 * @param percent 回復比率
682 static void regenhp(int percent)
688 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
689 if (p_ptr->action == ACTION_HAYAGAKE) return;
691 /* Save the old hitpoints */
692 old_chp = p_ptr->chp;
695 * Extract the new hitpoints
697 * 'percent' is the Regen factor in unit (1/2^16)
700 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
702 /* Convert the unit (1/2^16) to (1/2^32) */
703 s64b_LSHIFT(new_chp, new_chp_frac, 16);
706 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
710 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
712 p_ptr->chp = p_ptr->mhp;
717 if (old_chp != p_ptr->chp)
719 p_ptr->redraw |= (PR_HP);
720 p_ptr->window |= (PW_PLAYER);
727 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
728 * @param upkeep_factor ペット維持によるMPコスト量
729 * @param regen_amount 回復量
732 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
734 MANA_POINT old_csp = p_ptr->csp;
735 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
738 * Excess mana will decay 32 times faster than normal
741 if (p_ptr->csp > p_ptr->msp)
743 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
745 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
747 /* Convert the unit (1/2^16) to (1/2^32) */
748 s64b_LSHIFT(decay, decay_frac, 16);
751 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
754 if (p_ptr->csp < p_ptr->msp)
756 p_ptr->csp = p_ptr->msp;
761 /* Regenerating mana (unless the player has excess mana) */
762 else if (regen_rate > 0)
764 /* (percent/100) is the Regen factor in unit (1/2^16) */
765 MANA_POINT new_mana = 0;
766 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
768 /* Convert the unit (1/2^16) to (1/2^32) */
769 s64b_LSHIFT(new_mana, new_mana_frac, 16);
772 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
774 /* Must set frac to zero even if equal */
775 if (p_ptr->csp >= p_ptr->msp)
777 p_ptr->csp = p_ptr->msp;
783 /* Reduce mana (even when the player has excess mana) */
786 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
787 s32b reduce_mana = 0;
788 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
790 /* Convert the unit (1/2^16) to (1/2^32) */
791 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
794 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
804 if (old_csp != p_ptr->csp)
806 p_ptr->redraw |= (PR_MANA);
807 p_ptr->window |= (PW_PLAYER);
808 p_ptr->window |= (PW_SPELL);
814 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
815 * @param regen_amount 回復量
818 static void regenmagic(int regen_amount)
823 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
825 for (i = 0; i < EATER_EXT*2; i++)
827 if (!p_ptr->magic_num2[i]) continue;
828 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
830 /* Increase remaining charge number like float value */
831 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
832 p_ptr->magic_num1[i] += new_mana;
834 /* Check maximum charge */
835 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
837 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
841 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
843 if (!p_ptr->magic_num1[i]) continue;
844 if (!p_ptr->magic_num2[i]) continue;
846 /* Decrease remaining period for charging */
847 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
848 / (dev * 16 * PY_REGEN_NORMAL);
849 p_ptr->magic_num1[i] -= new_mana;
851 /* Check minimum remaining period for charging */
852 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
859 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
861 * @note Should probably be done during monster turns.
863 static void regen_monsters(void)
868 /* Regenerate everyone */
869 for (i = 1; i < m_max; i++)
871 /* Check the i'th monster */
872 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
873 monster_race *r_ptr = &r_info[m_ptr->r_idx];
875 if (!monster_is_valid(m_ptr)) continue;
877 /* Allow regeneration (if needed) */
878 if (m_ptr->hp < m_ptr->maxhp)
880 /* Hack -- Base regeneration */
881 frac = m_ptr->maxhp / 100;
883 /* Hack -- Minimal regeneration rate */
884 if (!frac) if (one_in_(2)) frac = 1;
886 /* Hack -- Some monsters regenerate quickly */
887 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
889 /* Hack -- Regenerate */
892 /* Do not over-regenerate */
893 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
895 /* Redraw (later) if needed */
896 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
897 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
904 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
906 * @note Should probably be done during monster turns.
908 static void regen_captured_monsters(void)
913 /* Regenerate everyone */
914 for (i = 0; i < INVEN_TOTAL; i++)
917 object_type *o_ptr = &inventory[i];
919 if (!o_ptr->k_idx) continue;
920 if (o_ptr->tval != TV_CAPTURE) continue;
921 if (!o_ptr->pval) continue;
925 r_ptr = &r_info[o_ptr->pval];
927 /* Allow regeneration (if needed) */
928 if (o_ptr->xtra4 < o_ptr->xtra5)
930 /* Hack -- Base regeneration */
931 frac = o_ptr->xtra5 / 100;
933 /* Hack -- Minimal regeneration rate */
934 if (!frac) if (one_in_(2)) frac = 1;
936 /* Hack -- Some monsters regenerate quickly */
937 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
939 /* Hack -- Regenerate */
940 o_ptr->xtra4 += (XTRA16)frac;
942 /* Do not over-regenerate */
943 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
950 p_ptr->update |= (PU_COMBINE);
951 p_ptr->window |= (PW_INVEN);
952 p_ptr->window |= (PW_EQUIP);
958 * @brief 寿命つき光源の警告メッセージ処理
959 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
962 static void notice_lite_change(object_type *o_ptr)
964 /* Hack -- notice interesting fuel steps */
965 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
967 p_ptr->window |= (PW_EQUIP);
970 /* Hack -- Special treatment when blind */
973 /* Hack -- save some light for later */
974 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
977 /* The light is now out */
978 else if (o_ptr->xtra4 == 0)
980 disturb(FALSE, TRUE);
981 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
983 /* Recalculate torch radius */
984 p_ptr->update |= (PU_TORCH);
986 /* Some ego light lose its effects without fuel */
987 p_ptr->update |= (PU_BONUS);
990 /* The light is getting dim */
991 else if (o_ptr->name2 == EGO_LITE_LONG)
993 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
994 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
996 if (disturb_minor) disturb(FALSE, TRUE);
997 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1001 /* The light is getting dim */
1002 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1004 if (disturb_minor) disturb(FALSE, TRUE);
1005 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1011 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1012 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1015 static void recharged_notice(object_type *o_ptr)
1017 GAME_TEXT o_name[MAX_NLEN];
1021 /* No inscription */
1022 if (!o_ptr->inscription) return;
1025 s = my_strchr(quark_str(o_ptr->inscription), '!');
1027 /* Process notification request. */
1030 /* Find another '!' */
1033 /* Describe (briefly) */
1034 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1036 /* Notify the player */
1038 msg_format("%sは再充填された。", o_name);
1040 if (o_ptr->number > 1)
1041 msg_format("Your %s are recharged.", o_name);
1043 msg_format("Your %s is recharged.", o_name);
1046 disturb(FALSE, FALSE);
1052 /* Keep looking for '!'s */
1053 s = my_strchr(s + 1, '!');
1058 * @brief プレイヤーの歌に関する継続処理
1061 static void check_music(void)
1063 const magic_type *s_ptr;
1065 MANA_POINT need_mana;
1066 u32b need_mana_frac;
1068 /* Music singed by player */
1069 if (p_ptr->pclass != CLASS_BARD) return;
1070 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1072 if (p_ptr->anti_magic)
1074 stop_singing(p_ptr);
1078 spell = SINGING_SONG_ID(p_ptr);
1079 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1081 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1085 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1087 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1089 stop_singing(p_ptr);
1094 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1096 p_ptr->redraw |= PR_MANA;
1097 if (INTERUPTING_SONG_EFFECT(p_ptr))
1099 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1100 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1101 msg_print(_("歌を再開した。", "You restart singing."));
1102 p_ptr->action = ACTION_SING;
1103 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1104 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1105 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1108 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1109 p_ptr->spell_exp[spell] += 5;
1110 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1111 { 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; }
1112 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1113 { 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; }
1114 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1115 { 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; }
1117 /* Do any effects of continual song */
1118 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1122 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1123 * @param flag 探し出したい呪いフラグ配列
1124 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1127 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1130 int choices[INVEN_TOTAL-INVEN_RARM];
1133 /* Paranoia -- Player has no warning-item */
1134 if (!(p_ptr->cursed & flag)) return NULL;
1136 /* Search Inventry */
1137 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1139 object_type *o_ptr = &inventory[i];
1141 if (o_ptr->curse_flags & flag)
1143 choices[number] = i;
1146 else if ((flag == TRC_ADD_L_CURSE) ||
1147 (flag == TRC_ADD_H_CURSE) ||
1148 (flag == TRC_DRAIN_HP) ||
1149 (flag == TRC_DRAIN_MANA) ||
1150 (flag == TRC_CALL_ANIMAL) ||
1151 (flag == TRC_CALL_DEMON) ||
1152 (flag == TRC_CALL_DRAGON) ||
1153 (flag == TRC_CALL_UNDEAD) ||
1154 (flag == TRC_COWARDICE) ||
1155 (flag == TRC_LOW_MELEE) ||
1156 (flag == TRC_LOW_AC) ||
1157 (flag == TRC_LOW_MAGIC) ||
1158 (flag == TRC_FAST_DIGEST) ||
1159 (flag == TRC_SLOW_REGEN) )
1162 BIT_FLAGS flgs[TR_FLAG_SIZE];
1163 object_flags(o_ptr, flgs);
1166 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1167 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1168 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1169 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1170 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1171 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1172 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1173 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1174 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1175 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1176 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1177 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1178 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1179 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1182 if (have_flag(flgs, cf))
1184 choices[number] = i;
1190 /* Choice one of them */
1191 return (&inventory[choices[randint0(number)]]);
1194 static void process_world_aux_digestion(void)
1196 if (!p_ptr->inside_battle)
1198 /* Digest quickly when gorged */
1199 if (p_ptr->food >= PY_FOOD_MAX)
1201 /* Digest a lot of food */
1202 (void)set_food(p_ptr->food - 100);
1205 /* Digest normally -- Every 50 game turns */
1206 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1208 /* Basic digestion rate based on speed */
1209 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1211 /* Regeneration takes more food */
1212 if (p_ptr->regenerate)
1214 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1216 if (p_ptr->cursed & TRC_FAST_DIGEST)
1219 /* Slow digestion takes less food */
1220 if (p_ptr->slow_digest)
1223 /* Minimal digestion */
1224 if (digestion < 1) digestion = 1;
1225 /* Maximal digestion */
1226 if (digestion > 100) digestion = 100;
1228 /* Digest some food */
1229 (void)set_food(p_ptr->food - digestion);
1234 if ((p_ptr->food < PY_FOOD_FAINT))
1236 /* Faint occasionally */
1237 if (!p_ptr->paralyzed && (randint0(100) < 10))
1239 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1240 disturb(TRUE, TRUE);
1242 /* Hack -- faint (bypass free action) */
1243 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1246 /* Starve to death (slowly) */
1247 if (p_ptr->food < PY_FOOD_STARVE)
1249 /* Calculate damage */
1250 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1252 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1259 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1260 * / Handle timed damage and regeneration every 10 game turns
1263 static void process_world_aux_hp_and_sp(void)
1265 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1266 bool cave_no_regen = FALSE;
1267 int upkeep_factor = 0;
1269 /* Default regeneration */
1270 int regen_amount = PY_REGEN_NORMAL;
1273 /*** Damage over Time ***/
1275 /* Take damage from poison */
1276 if (p_ptr->poisoned && !IS_INVULN())
1278 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1281 /* Take damage from cuts */
1282 if (p_ptr->cut && !IS_INVULN())
1286 /* Mortal wound or Deep Gash */
1287 if (p_ptr->cut > 1000)
1292 else if (p_ptr->cut > 200)
1298 else if (p_ptr->cut > 100)
1303 else if (p_ptr->cut > 50)
1308 else if (p_ptr->cut > 25)
1313 else if (p_ptr->cut > 10)
1324 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1327 /* (Vampires) Take damage from sunlight */
1328 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1330 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1332 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1334 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1335 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1336 cave_no_regen = TRUE;
1340 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1341 !p_ptr->resist_lite)
1343 object_type * o_ptr = &inventory[INVEN_LITE];
1344 GAME_TEXT o_name [MAX_NLEN];
1345 char ouch [MAX_NLEN+40];
1347 /* Get an object description */
1348 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1349 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1351 cave_no_regen = TRUE;
1353 /* Get an object description */
1354 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1355 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1357 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1361 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1365 if (have_flag(f_ptr->flags, FF_DEEP))
1367 damage = 6000 + randint0(4000);
1369 else if (!p_ptr->levitation)
1371 damage = 3000 + randint0(2000);
1376 if(prace_is_(RACE_ENT)) damage += damage / 3;
1377 if(p_ptr->resist_fire) damage = damage / 3;
1378 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1379 if(p_ptr->levitation) damage = damage / 5;
1381 damage = damage / 100 + (randint0(100) < (damage % 100));
1383 if (p_ptr->levitation)
1385 msg_print(_("熱で火傷した!", "The heat burns you!"));
1386 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1387 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1391 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1392 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1393 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1396 cave_no_regen = TRUE;
1400 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1404 if (have_flag(f_ptr->flags, FF_DEEP))
1406 damage = 6000 + randint0(4000);
1408 else if (!p_ptr->levitation)
1410 damage = 3000 + randint0(2000);
1415 if (p_ptr->resist_cold) damage = damage / 3;
1416 if (IS_OPPOSE_COLD()) damage = damage / 3;
1417 if (p_ptr->levitation) damage = damage / 5;
1419 damage = damage / 100 + (randint0(100) < (damage % 100));
1421 if (p_ptr->levitation)
1423 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1424 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1425 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1429 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1430 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1431 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1434 cave_no_regen = TRUE;
1438 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1442 if (have_flag(f_ptr->flags, FF_DEEP))
1444 damage = 6000 + randint0(4000);
1446 else if (!p_ptr->levitation)
1448 damage = 3000 + randint0(2000);
1453 if (p_ptr->resist_elec) damage = damage / 3;
1454 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1455 if (p_ptr->levitation) damage = damage / 5;
1457 damage = damage / 100 + (randint0(100) < (damage % 100));
1459 if (p_ptr->levitation)
1461 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1462 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1463 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1467 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1468 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1469 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1472 cave_no_regen = TRUE;
1476 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1480 if (have_flag(f_ptr->flags, FF_DEEP))
1482 damage = 6000 + randint0(4000);
1484 else if (!p_ptr->levitation)
1486 damage = 3000 + randint0(2000);
1491 if (p_ptr->resist_acid) damage = damage / 3;
1492 if (IS_OPPOSE_ACID()) damage = damage / 3;
1493 if (p_ptr->levitation) damage = damage / 5;
1495 damage = damage / 100 + (randint0(100) < (damage % 100));
1497 if (p_ptr->levitation)
1499 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1500 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1501 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1505 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1506 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1507 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1510 cave_no_regen = TRUE;
1514 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1518 if (have_flag(f_ptr->flags, FF_DEEP))
1520 damage = 6000 + randint0(4000);
1522 else if (!p_ptr->levitation)
1524 damage = 3000 + randint0(2000);
1529 if (p_ptr->resist_pois) damage = damage / 3;
1530 if (IS_OPPOSE_POIS()) damage = damage / 3;
1531 if (p_ptr->levitation) damage = damage / 5;
1533 damage = damage / 100 + (randint0(100) < (damage % 100));
1535 if (p_ptr->levitation)
1537 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1538 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1539 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1540 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1544 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1545 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1546 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1547 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1550 cave_no_regen = TRUE;
1554 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1555 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1557 if (p_ptr->total_weight > weight_limit())
1559 msg_print(_("溺れている!", "You are drowning!"));
1560 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1561 cave_no_regen = TRUE;
1568 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1570 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1571 if (prace_is_(RACE_ENT)) damage += damage / 3;
1572 if (p_ptr->resist_fire) damage = damage / 3;
1573 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1574 msg_print(_("熱い!", "It's hot!"));
1575 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1577 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1579 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1580 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1581 if (p_ptr->resist_elec) damage = damage / 3;
1582 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1583 msg_print(_("痛い!", "It hurts!"));
1584 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1586 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1588 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1589 if (p_ptr->resist_cold) damage = damage / 3;
1590 if (IS_OPPOSE_COLD()) damage = damage / 3;
1591 msg_print(_("冷たい!", "It's cold!"));
1592 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1596 /* Spectres -- take damage when moving through walls */
1598 * Added: ANYBODY takes damage if inside through walls
1599 * without wraith form -- NOTE: Spectres will never be
1600 * reduced below 0 hp by being inside a stone wall; others
1603 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1605 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1608 cave_no_regen = TRUE;
1610 if (p_ptr->pass_wall)
1612 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1613 dam_desc = _("密度", "density");
1617 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1618 dam_desc = _("硬い岩", "solid rock");
1621 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1626 /*** handle regeneration ***/
1629 if (p_ptr->food < PY_FOOD_WEAK)
1631 /* Lower regeneration */
1632 if (p_ptr->food < PY_FOOD_STARVE)
1636 else if (p_ptr->food < PY_FOOD_FAINT)
1638 regen_amount = PY_REGEN_FAINT;
1642 regen_amount = PY_REGEN_WEAK;
1646 /* Are we walking the pattern? */
1647 if (pattern_effect())
1649 cave_no_regen = TRUE;
1653 /* Regeneration ability */
1654 if (p_ptr->regenerate)
1656 regen_amount = regen_amount * 2;
1658 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1662 if (p_ptr->cursed & TRC_SLOW_REGEN)
1669 /* Searching or Resting */
1670 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1672 regen_amount = regen_amount * 2;
1675 upkeep_factor = calculate_upkeep();
1677 /* No regeneration while special action */
1678 if ((p_ptr->action == ACTION_LEARN) ||
1679 (p_ptr->action == ACTION_HAYAGAKE) ||
1680 (p_ptr->special_defense & KATA_KOUKIJIN))
1682 upkeep_factor += 100;
1685 /* Regenerate the mana */
1686 regenmana(upkeep_factor, regen_amount);
1689 /* Recharge magic eater's power */
1690 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1692 regenmagic(regen_amount);
1695 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1697 while (upkeep_factor > 100)
1699 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1701 do_cmd_pet_dismiss();
1703 upkeep_factor = calculate_upkeep();
1705 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1710 /* Poisoned or cut yields no healing */
1711 if (p_ptr->poisoned) regen_amount = 0;
1712 if (p_ptr->cut) regen_amount = 0;
1714 /* Special floor -- Pattern, in a wall -- yields no healing */
1715 if (cave_no_regen) regen_amount = 0;
1717 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1719 /* Regenerate Hit Points if needed */
1720 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1722 regenhp(regen_amount);
1727 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1728 * / Handle timeout every 10 game turns
1731 static void process_world_aux_timeout(void)
1733 const int dec_count = (easy_band ? 2 : 1);
1735 /*** Timeout Various Things ***/
1738 if (p_ptr->tim_mimic)
1740 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1743 /* Hack -- Hallucinating */
1746 (void)set_image(p_ptr->image - dec_count);
1752 (void)set_blind(p_ptr->blind - dec_count);
1755 /* Times see-invisible */
1756 if (p_ptr->tim_invis)
1758 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1769 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1772 /* Timed temporary elemental brands. -LM- */
1773 if (p_ptr->ele_attack)
1775 p_ptr->ele_attack--;
1777 /* Clear all temporary elemental brands. */
1778 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1781 /* Timed temporary elemental immune. -LM- */
1782 if (p_ptr->ele_immune)
1784 p_ptr->ele_immune--;
1786 /* Clear all temporary elemental brands. */
1787 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1790 /* Timed infra-vision */
1791 if (p_ptr->tim_infra)
1793 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1797 if (p_ptr->tim_stealth)
1799 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1802 /* Timed levitation */
1803 if (p_ptr->tim_levitation)
1805 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1808 /* Timed sh_touki */
1809 if (p_ptr->tim_sh_touki)
1811 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1815 if (p_ptr->tim_sh_fire)
1817 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1821 if (p_ptr->tim_sh_holy)
1823 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1827 if (p_ptr->tim_eyeeye)
1829 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1832 /* Timed resist-magic */
1833 if (p_ptr->resist_magic)
1835 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1838 /* Timed regeneration */
1839 if (p_ptr->tim_regen)
1841 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1844 /* Timed resist nether */
1845 if (p_ptr->tim_res_nether)
1847 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1850 /* Timed resist time */
1851 if (p_ptr->tim_res_time)
1853 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1857 if (p_ptr->tim_reflect)
1859 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1863 if (p_ptr->multishadow)
1865 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1868 /* Timed Robe of dust */
1869 if (p_ptr->dustrobe)
1871 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1874 /* Timed infra-vision */
1875 if (p_ptr->kabenuke)
1877 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1881 if (p_ptr->paralyzed)
1883 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1887 if (p_ptr->confused)
1889 (void)set_confused(p_ptr->confused - dec_count);
1895 (void)set_afraid(p_ptr->afraid - dec_count);
1901 (void)set_fast(p_ptr->fast - 1, TRUE);
1907 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1910 /* Protection from evil */
1911 if (p_ptr->protevil)
1913 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1916 /* Invulnerability */
1919 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1923 if (p_ptr->wraith_form)
1925 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1931 (void)set_hero(p_ptr->hero - 1, TRUE);
1937 (void)set_shero(p_ptr->shero - 1, TRUE);
1943 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1949 (void)set_shield(p_ptr->shield - 1, TRUE);
1953 if (p_ptr->tsubureru)
1955 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1959 if (p_ptr->magicdef)
1961 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1965 if (p_ptr->tsuyoshi)
1967 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1971 if (p_ptr->oppose_acid)
1973 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1976 /* Oppose Lightning */
1977 if (p_ptr->oppose_elec)
1979 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
1983 if (p_ptr->oppose_fire)
1985 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
1989 if (p_ptr->oppose_cold)
1991 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
1995 if (p_ptr->oppose_pois)
1997 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2002 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2005 /*** Poison and Stun and Cut ***/
2008 if (p_ptr->poisoned)
2010 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2012 /* Apply some healing */
2013 (void)set_poisoned(p_ptr->poisoned - adjust);
2019 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2021 /* Apply some healing */
2022 (void)set_stun(p_ptr->stun - adjust);
2028 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2030 /* Hack -- Truly "mortal" wound */
2031 if (p_ptr->cut > 1000) adjust = 0;
2033 /* Apply some healing */
2034 (void)set_cut(p_ptr->cut - adjust);
2040 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2041 * / Handle burning fuel every 10 game turns
2044 static void process_world_aux_light(void)
2046 /* Check for light being wielded */
2047 object_type *o_ptr = &inventory[INVEN_LITE];
2049 /* Burn some fuel in the current lite */
2050 if (o_ptr->tval == TV_LITE)
2052 /* Hack -- Use some fuel (except on artifacts) */
2053 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2055 /* Decrease life-span */
2056 if (o_ptr->name2 == EGO_LITE_LONG)
2058 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2060 else o_ptr->xtra4--;
2062 /* Notice interesting fuel steps */
2063 notice_lite_change(o_ptr);
2070 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2071 * / Handle mutation effects once every 10 game turns
2074 static void process_world_aux_mutation(void)
2076 /* No mutation with effects */
2077 if (!p_ptr->muta2) return;
2079 /* No effect on monster arena */
2080 if (p_ptr->inside_battle) return;
2082 /* No effect on the global map */
2083 if (p_ptr->wild_mode) return;
2085 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2087 disturb(FALSE, TRUE);
2088 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2089 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2090 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2091 (void)set_afraid(0);
2094 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2096 if (!p_ptr->resist_fear)
2098 disturb(FALSE, TRUE);
2099 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2100 set_afraid(p_ptr->afraid + 13 + randint1(26));
2104 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2106 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2108 disturb(FALSE, TRUE);
2109 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2111 teleport_player(40, TELEPORT_PASSIVE);
2115 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2117 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2119 disturb(FALSE, TRUE);
2120 p_ptr->redraw |= PR_EXTRA;
2121 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2124 if (!p_ptr->resist_conf)
2126 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2129 if (!p_ptr->resist_chaos)
2134 if (one_in_(3)) lose_all_info();
2136 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2138 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2139 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2145 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2146 (void)set_image(p_ptr->image + randint0(150) + 150);
2152 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2154 if (!p_ptr->resist_chaos)
2156 disturb(FALSE, TRUE);
2157 p_ptr->redraw |= PR_EXTRA;
2158 (void)set_image(p_ptr->image + randint0(50) + 20);
2162 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2164 disturb(FALSE, TRUE);
2165 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2167 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2170 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2171 !p_ptr->anti_magic && one_in_(9000))
2174 disturb(FALSE, TRUE);
2175 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2176 "Magical energy flows through you! You must release it!"));
2180 (void)get_hack_dir(&dire);
2181 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2184 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2186 bool pet = one_in_(6);
2187 BIT_FLAGS mode = PM_ALLOW_GROUP;
2189 if (pet) mode |= PM_FORCE_PET;
2190 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2192 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2194 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2195 disturb(FALSE, TRUE);
2199 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2201 disturb(FALSE, TRUE);
2204 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2206 if (p_ptr->fast > 0)
2212 set_slow(randint1(30) + 10, FALSE);
2217 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2219 if (p_ptr->slow > 0)
2225 set_fast(randint1(30) + 10, FALSE);
2230 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2232 disturb(FALSE, TRUE);
2233 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2235 banish_monsters(100);
2236 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2240 /* Pick a random shop (except home) */
2243 n = randint0(MAX_STORES);
2245 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2247 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2253 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2257 msg_print(_("影につつまれた。", "A shadow passes over you."));
2260 /* Absorb light from the current possition */
2261 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2266 o_ptr = &inventory[INVEN_LITE];
2268 /* Absorb some fuel in the current lite */
2269 if (o_ptr->tval == TV_LITE)
2271 /* Use some fuel (except on artifacts) */
2272 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2274 /* Heal the player a bit */
2275 hp_player(o_ptr->xtra4 / 20);
2277 /* Decrease life-span of lite */
2279 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2281 /* Notice interesting fuel steps */
2282 notice_lite_change(o_ptr);
2287 * Unlite the area (radius 10) around player and
2288 * do 50 points damage to every affected monster
2290 unlite_area(50, 10);
2293 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2295 bool pet = one_in_(3);
2296 BIT_FLAGS mode = PM_ALLOW_GROUP;
2298 if (pet) mode |= PM_FORCE_PET;
2299 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2301 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2303 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2304 disturb(FALSE, TRUE);
2308 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2310 disturb(FALSE, TRUE);
2311 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2314 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2316 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2318 if (!lose_mutation(0))
2319 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2321 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2323 disturb(FALSE, TRUE);
2324 msg_print(_("非物質化した!", "You feel insubstantial!"));
2327 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2329 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2333 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2335 int which_stat = randint0(A_MAX);
2336 int sustained = FALSE;
2341 if (p_ptr->sustain_str) sustained = TRUE;
2344 if (p_ptr->sustain_int) sustained = TRUE;
2347 if (p_ptr->sustain_wis) sustained = TRUE;
2350 if (p_ptr->sustain_dex) sustained = TRUE;
2353 if (p_ptr->sustain_con) sustained = TRUE;
2356 if (p_ptr->sustain_chr) sustained = TRUE;
2359 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2365 disturb(FALSE, TRUE);
2366 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2368 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2371 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2373 bool pet = one_in_(5);
2374 BIT_FLAGS mode = PM_ALLOW_GROUP;
2376 if (pet) mode |= PM_FORCE_PET;
2377 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2379 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2381 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2382 disturb(FALSE, TRUE);
2385 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2387 if (p_ptr->tim_esp > 0)
2389 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2390 set_tim_esp(0, TRUE);
2394 msg_print(_("精神が広がった!", "Your mind expands!"));
2395 set_tim_esp(p_ptr->lev, FALSE);
2398 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2400 disturb(FALSE, TRUE);
2401 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2403 set_food(PY_FOOD_WEAK);
2404 if (music_singing_any()) stop_singing(p_ptr);
2405 if (hex_spelling_any()) stop_hex_spell_all();
2408 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2413 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2415 int danger_amount = 0;
2416 MONSTER_IDX monster;
2418 for (monster = 0; monster < m_max; monster++)
2420 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2421 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2422 if (!monster_is_valid(m_ptr)) continue;
2424 if (r_ptr->level >= p_ptr->lev)
2426 danger_amount += r_ptr->level - p_ptr->lev + 1;
2430 if (danger_amount > 100)
2431 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2432 else if (danger_amount > 50)
2433 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2434 else if (danger_amount > 20)
2435 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2436 else if (danger_amount > 10)
2437 msg_print(_("心配な気がする!", "You feel paranoid!"));
2438 else if (danger_amount > 5)
2439 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2441 msg_print(_("寂しい気がする。", "You feel lonely."));
2444 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2446 disturb(FALSE, TRUE);
2447 msg_print(_("無敵な気がする!", "You feel invincible!"));
2449 (void)set_invuln(randint1(8) + 8, FALSE);
2452 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2454 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2458 HIT_POINT healing = p_ptr->csp;
2459 if (healing > wounds) healing = wounds;
2462 p_ptr->csp -= healing;
2463 p_ptr->redraw |= (PR_HP | PR_MANA);
2467 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2469 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2473 HIT_POINT healing = p_ptr->chp;
2474 if (healing > wounds) healing = wounds;
2476 p_ptr->csp += healing;
2477 p_ptr->redraw |= (PR_HP | PR_MANA);
2478 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2482 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2484 INVENTORY_IDX slot = 0;
2485 object_type *o_ptr = NULL;
2487 disturb(FALSE, TRUE);
2488 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2489 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2492 if (has_melee_weapon(INVEN_RARM))
2495 o_ptr = &inventory[INVEN_RARM];
2497 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2499 o_ptr = &inventory[INVEN_LARM];
2503 else if (has_melee_weapon(INVEN_LARM))
2505 o_ptr = &inventory[INVEN_LARM];
2508 if (slot && !object_is_cursed(o_ptr))
2510 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2511 inven_drop(slot, 1);
2518 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2519 * / Handle curse effects once every 10 game turns
2522 static void process_world_aux_curse(void)
2524 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2527 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2528 * can actually be useful!
2530 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2532 GAME_TEXT o_name[MAX_NLEN];
2534 int i, i_keep = 0, count = 0;
2536 /* Scan the equipment with random teleport ability */
2537 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2539 BIT_FLAGS flgs[TR_FLAG_SIZE];
2540 o_ptr = &inventory[i];
2542 /* Skip non-objects */
2543 if (!o_ptr->k_idx) continue;
2545 /* Extract the item flags */
2546 object_flags(o_ptr, flgs);
2548 if (have_flag(flgs, TR_TELEPORT))
2550 /* {.} will stop random teleportation. */
2551 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2554 if (one_in_(count)) i_keep = i;
2559 o_ptr = &inventory[i_keep];
2560 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2561 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2562 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2564 disturb(FALSE, TRUE);
2565 teleport_player(50, 0L);
2569 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2570 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2571 disturb(TRUE, TRUE);
2574 /* Make a chainsword noise */
2575 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2578 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2580 disturb(FALSE, FALSE);
2583 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2586 (void)activate_ty_curse(FALSE, &count);
2588 /* Handle experience draining */
2589 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2591 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2592 if (p_ptr->exp < 0) p_ptr->exp = 0;
2593 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2594 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2597 /* Add light curse (Later) */
2598 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2600 BIT_FLAGS new_curse;
2603 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2605 new_curse = get_curse(0, o_ptr);
2606 if (!(o_ptr->curse_flags & new_curse))
2608 GAME_TEXT o_name[MAX_NLEN];
2610 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2612 o_ptr->curse_flags |= new_curse;
2613 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2615 o_ptr->feeling = FEEL_NONE;
2617 p_ptr->update |= (PU_BONUS);
2620 /* Add heavy curse (Later) */
2621 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2623 BIT_FLAGS new_curse;
2626 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2628 new_curse = get_curse(1, o_ptr);
2629 if (!(o_ptr->curse_flags & new_curse))
2631 GAME_TEXT o_name[MAX_NLEN];
2633 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2635 o_ptr->curse_flags |= new_curse;
2636 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2637 o_ptr->feeling = FEEL_NONE;
2639 p_ptr->update |= (PU_BONUS);
2643 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2645 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'))
2647 GAME_TEXT o_name[MAX_NLEN];
2649 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2650 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2651 disturb(FALSE, TRUE);
2655 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2657 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'))
2659 GAME_TEXT o_name[MAX_NLEN];
2661 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2662 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2663 disturb(FALSE, TRUE);
2667 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2669 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2670 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2672 GAME_TEXT o_name[MAX_NLEN];
2674 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2675 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2676 disturb(FALSE, TRUE);
2680 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2682 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2683 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2685 GAME_TEXT o_name[MAX_NLEN];
2687 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2688 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2689 disturb(FALSE, TRUE);
2692 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2694 if (!p_ptr->resist_fear)
2696 disturb(FALSE, TRUE);
2697 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2698 set_afraid(p_ptr->afraid + 13 + randint1(26));
2701 /* Teleport player */
2702 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2704 disturb(FALSE, TRUE);
2706 /* Teleport player */
2707 teleport_player(40, TELEPORT_PASSIVE);
2709 /* Handle HP draining */
2710 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2712 GAME_TEXT o_name[MAX_NLEN];
2714 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2715 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2716 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2718 /* Handle mana draining */
2719 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2721 GAME_TEXT o_name[MAX_NLEN];
2723 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2724 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2725 p_ptr->csp -= MIN(p_ptr->lev, 50);
2729 p_ptr->csp_frac = 0;
2731 p_ptr->redraw |= PR_MANA;
2735 /* Rarely, take damage from the Jewel of Judgement */
2736 if (one_in_(999) && !p_ptr->anti_magic)
2738 object_type *o_ptr = &inventory[INVEN_LITE];
2740 if (o_ptr->name1 == ART_JUDGE)
2742 if (object_is_known(o_ptr))
2743 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2745 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2746 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2753 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2754 * / Handle recharging objects once every 10 game turns
2757 static void process_world_aux_recharge(void)
2762 /* Process equipment */
2763 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2765 /* Get the object */
2766 object_type *o_ptr = &inventory[i];
2768 /* Skip non-objects */
2769 if (!o_ptr->k_idx) continue;
2771 /* Recharge activatable objects */
2772 if (o_ptr->timeout > 0)
2777 /* Notice changes */
2778 if (!o_ptr->timeout)
2780 recharged_notice(o_ptr);
2786 /* Notice changes */
2789 p_ptr->window |= (PW_EQUIP);
2794 * Recharge rods. Rods now use timeout to control charging status,
2795 * and each charging rod in a stack decreases the stack's timeout by
2796 * one per current_world_ptr->game_turn. -LM-
2798 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2800 object_type *o_ptr = &inventory[i];
2801 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2803 /* Skip non-objects */
2804 if (!o_ptr->k_idx) continue;
2806 /* Examine all charging rods or stacks of charging rods. */
2807 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2809 /* Determine how many rods are charging. */
2810 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2811 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2813 /* Decrease timeout by that number. */
2814 o_ptr->timeout -= temp;
2816 /* Boundary control. */
2817 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2819 /* Notice changes, provide message if object is inscribed. */
2820 if (!(o_ptr->timeout))
2822 recharged_notice(o_ptr);
2826 /* One of the stack of rod is charged */
2827 else if (o_ptr->timeout % k_ptr->pval)
2834 /* Notice changes */
2837 p_ptr->window |= (PW_INVEN);
2841 /* Process objects on floor */
2842 for (i = 1; i < o_max; i++)
2844 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2846 /* Skip dead objects */
2847 if (!o_ptr->k_idx) continue;
2849 /* Recharge rods on the ground. No messages. */
2850 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2853 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2855 /* Boundary control. */
2856 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2863 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2864 * / Handle involuntary movement once every 10 game turns
2867 static void process_world_aux_movement(void)
2869 /* Delayed Word-of-Recall */
2870 if (p_ptr->word_recall)
2873 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2874 * The player is yanked up/down as soon as
2875 * he loads the autosaved game.
2877 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2878 do_cmd_save_game(TRUE);
2880 /* Count down towards recall */
2881 p_ptr->word_recall--;
2883 p_ptr->redraw |= (PR_STATUS);
2885 /* Activate the recall */
2886 if (!p_ptr->word_recall)
2889 disturb(FALSE, TRUE);
2891 /* Determine the level */
2892 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2894 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2896 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2898 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2900 current_floor_ptr->dun_level = 0;
2901 p_ptr->dungeon_idx = 0;
2903 leave_quest_check();
2904 leave_tower_check();
2906 p_ptr->inside_quest = 0;
2908 p_ptr->leaving = TRUE;
2912 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2914 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2917 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2920 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2921 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2923 /* Nightmare mode makes recall more dangerous */
2924 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2926 if (current_floor_ptr->dun_level < 50)
2928 current_floor_ptr->dun_level *= 2;
2930 else if (current_floor_ptr->dun_level < 99)
2932 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2934 else if (current_floor_ptr->dun_level > 100)
2936 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2940 if (p_ptr->wild_mode)
2942 p_ptr->wilderness_y = p_ptr->y;
2943 p_ptr->wilderness_x = p_ptr->x;
2947 /* Save player position */
2948 p_ptr->oldpx = p_ptr->x;
2949 p_ptr->oldpy = p_ptr->y;
2951 p_ptr->wild_mode = FALSE;
2954 * Clear all saved floors
2955 * and create a first saved floor
2957 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2958 p_ptr->leaving = TRUE;
2960 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2964 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2966 quest_type* const q_ptr = &quest[i];
2969 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2970 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2971 (q_ptr->level < current_floor_ptr->dun_level))
2973 q_ptr->status = QUEST_STATUS_FAILED;
2974 q_ptr->complev = (byte)p_ptr->lev;
2976 q_ptr->comptime = current_world_ptr->play_time;
2977 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2983 sound(SOUND_TPLEVEL);
2988 /* Delayed Alter reality */
2989 if (p_ptr->alter_reality)
2991 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
2992 do_cmd_save_game(TRUE);
2994 /* Count down towards alter */
2995 p_ptr->alter_reality--;
2997 p_ptr->redraw |= (PR_STATUS);
2999 /* Activate the alter reality */
3000 if (!p_ptr->alter_reality)
3003 disturb(FALSE, TRUE);
3005 /* Determine the level */
3006 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3008 msg_print(_("世界が変わった!", "The world changes!"));
3011 * Clear all saved floors
3012 * and create a first saved floor
3014 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3015 p_ptr->leaving = TRUE;
3019 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3022 sound(SOUND_TPLEVEL);
3028 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3029 * / Handle certain things once every 10 game turns
3032 static void process_world(void)
3036 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3037 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3038 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3040 extract_day_hour_min(&day, &hour, &min);
3042 /* Update dungeon feeling, and announce it if changed */
3043 update_dungeon_feeling();
3045 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3046 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3048 current_floor_ptr->dun_level = 0;
3049 p_ptr->dungeon_idx = 0;
3050 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3051 p_ptr->inside_arena = FALSE;
3052 p_ptr->wild_mode = FALSE;
3053 p_ptr->leaving = TRUE;
3056 /*** Check monster arena ***/
3057 if (p_ptr->inside_battle && !p_ptr->leaving)
3063 /* Count all hostile monsters */
3064 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3065 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3067 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3069 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3072 win_m_idx = g_ptr->m_idx;
3076 if (number_mon == 0)
3078 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3080 p_ptr->energy_need = 0;
3081 update_gambling_monsters();
3083 else if ((number_mon-1) == 0)
3085 GAME_TEXT m_name[MAX_NLEN];
3086 monster_type *wm_ptr;
3088 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3090 monster_desc(m_name, wm_ptr, 0);
3091 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3094 if (win_m_idx == (sel_monster+1))
3096 msg_print(_("おめでとうございます。", "Congratulations."));
3097 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3098 p_ptr->au += battle_odds;
3102 msg_print(_("残念でした。", "You lost gold."));
3105 p_ptr->energy_need = 0;
3106 update_gambling_monsters();
3108 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3110 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3111 p_ptr->au += kakekin;
3113 p_ptr->energy_need = 0;
3114 update_gambling_monsters();
3118 /* Every 10 game turns */
3119 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3121 /*** Check the Time and Load ***/
3123 if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
3125 /* Check time and load */
3126 if ((0 != check_time()) || (0 != check_load()))
3129 if (closing_flag <= 2)
3131 disturb(FALSE, TRUE);
3133 /* Count warnings */
3136 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3137 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3144 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3147 p_ptr->playing = FALSE;
3148 p_ptr->leaving = TRUE;
3153 /*** Attempt timed autosave ***/
3154 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3156 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3157 do_cmd_save_game(TRUE);
3160 if (mon_fight && !ignore_unview)
3162 msg_print(_("何かが聞こえた。", "You hear noise."));
3165 /*** Handle the wilderness/town (sunshine) ***/
3167 /* While in town/wilderness */
3168 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3170 /* Hack -- Daybreak/Nighfall in town */
3171 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3175 /* Check for dawn */
3176 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3178 if (dawn) day_break();
3184 /* While in the dungeon (vanilla_town or lite_town mode only) */
3185 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3187 /*** Shuffle the Storekeepers ***/
3189 /* Chance is only once a day (while in dungeon) */
3190 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3192 /* Sometimes, shuffle the shop-keepers */
3193 if (one_in_(STORE_SHUFFLE))
3198 /* Pick a random shop (except home and museum) */
3201 n = randint0(MAX_STORES);
3203 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3205 /* Check every feature */
3206 for (i = 1; i < max_f_idx; i++)
3208 feature_type *f_ptr = &f_info[i];
3210 /* Skip empty index */
3211 if (!f_ptr->name) continue;
3213 /* Skip non-store features */
3214 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3216 /* Verify store type */
3217 if (f_ptr->subtype == n)
3219 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3232 /*** Process the monsters ***/
3234 /* Check for creature generation. */
3235 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3236 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3238 /* Make a new monster */
3239 (void)alloc_monster(MAX_SIGHT + 5, 0);
3242 /* Hack -- Check for creature regeneration */
3243 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3244 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3246 if (!p_ptr->leaving)
3250 /* Hack -- Process the counters of monsters if needed */
3251 for (i = 0; i < MAX_MTIMED; i++)
3253 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3261 if (min != prev_min)
3263 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3264 determine_today_mon(FALSE);
3269 * Nightmare mode activates the TY_CURSE at midnight
3270 * Require exact minute -- Don't activate multiple times in a minute
3273 if (ironman_nightmare && (min != prev_min))
3276 /* Every 15 minutes after 11:00 pm */
3277 if ((hour == 23) && !(min % 15))
3279 disturb(FALSE, TRUE);
3284 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3288 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3292 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3296 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3301 /* TY_CURSE activates at midnight! */
3305 disturb(TRUE, TRUE);
3306 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3308 if (p_ptr->wild_mode)
3310 /* Go into large wilderness view */
3311 p_ptr->oldpy = randint1(MAX_HGT - 2);
3312 p_ptr->oldpx = randint1(MAX_WID - 2);
3315 /* Give first move to monsters */
3316 take_turn(p_ptr, 100);
3318 /* HACk -- set the encouter flag for the wilderness generation */
3319 generate_encounter = TRUE;
3322 invoking_midnight_curse = TRUE;
3328 /* Check the Food */
3329 process_world_aux_digestion();
3331 /* Process timed damage and regeneration */
3332 process_world_aux_hp_and_sp();
3334 /* Process timeout */
3335 process_world_aux_timeout();
3338 process_world_aux_light();
3340 /* Process mutation effects */
3341 process_world_aux_mutation();
3343 /* Process curse effects */
3344 process_world_aux_curse();
3346 /* Process recharging */
3347 process_world_aux_recharge();
3349 /* Feel the inventory */
3353 /* Involuntary Movement */
3354 process_world_aux_movement();
3358 * @brief ウィザードモードへの導入処理
3359 * / Verify use of "wizard" mode
3360 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3362 static bool enter_wizard_mode(void)
3364 /* Ask first time */
3365 if (!p_ptr->noscore)
3367 /* Wizard mode is not permitted */
3368 if (!allow_debug_opts || arg_wizard)
3370 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3374 /* Mention effects */
3375 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3376 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3379 /* Verify request */
3380 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3385 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3387 p_ptr->noscore |= 0x0002;
3398 * @brief デバッグコマンドへの導入処理
3399 * / Verify use of "debug" commands
3400 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3402 static bool enter_debug_mode(void)
3404 /* Ask first time */
3405 if (!p_ptr->noscore)
3407 /* Debug mode is not permitted */
3408 if (!allow_debug_opts)
3410 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3414 /* Mention effects */
3415 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3416 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3420 /* Verify request */
3421 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3426 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3428 p_ptr->noscore |= 0x0008;
3436 * Hack -- Declare the Debug Routines
3438 extern void do_cmd_debug(void);
3440 #endif /* ALLOW_WIZARD */
3446 * @brief ボーグコマンドへの導入処理
3447 * / Verify use of "borg" commands
3448 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3450 static bool enter_borg_mode(void)
3452 /* Ask first time */
3453 if (!(p_ptr->noscore & 0x0010))
3455 /* Mention effects */
3456 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3457 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3461 /* Verify request */
3462 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3467 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3469 p_ptr->noscore |= 0x0010;
3477 * Hack -- Declare the Ben Borg
3479 extern void do_cmd_borg(void);
3481 #endif /* ALLOW_BORG */
3485 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3486 * / Parse and execute the current command Give "Warning" on illegal commands.
3487 * @todo Make some "blocks"
3490 static void process_command(void)
3492 COMMAND_CODE old_now_message = now_message;
3494 /* Handle repeating the last command */
3500 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3501 reset_concent = TRUE;
3503 /* Parse the command */
3504 switch (command_cmd)
3520 /*** Wizard Commands ***/
3522 /* Toggle Wizard Mode */
3527 p_ptr->wizard = FALSE;
3528 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3530 else if (enter_wizard_mode())
3532 p_ptr->wizard = TRUE;
3533 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3535 p_ptr->update |= (PU_MONSTERS);
3537 /* Redraw "title" */
3538 p_ptr->redraw |= (PR_TITLE);
3546 /* Special "debug" commands */
3549 /* Enter debug mode */
3550 if (enter_debug_mode())
3557 #endif /* ALLOW_WIZARD */
3562 /* Special "borg" commands */
3565 /* Enter borg mode */
3566 if (enter_borg_mode())
3568 if (!p_ptr->wild_mode) do_cmd_borg();
3574 #endif /* ALLOW_BORG */
3578 /*** Inventory Commands ***/
3580 /* Wear/wield equipment */
3583 if (!p_ptr->wild_mode) do_cmd_wield();
3587 /* Take off equipment */
3590 if (!p_ptr->wild_mode) do_cmd_takeoff();
3597 if (!p_ptr->wild_mode) do_cmd_drop();
3601 /* Destroy an item */
3608 /* Equipment list */
3615 /* Inventory list */
3623 /*** Various commands ***/
3625 /* Identify an object */
3632 /* Hack -- toggle windows */
3635 toggle_inven_equip();
3640 /*** Standard "Movement" Commands ***/
3645 if (!p_ptr->wild_mode) do_cmd_alter();
3652 if (!p_ptr->wild_mode) do_cmd_tunnel();
3656 /* Move (usually pick up things) */
3663 /* Move (usually do not pick up) */
3671 /*** Running, Resting, Searching, Staying */
3673 /* Begin Running -- Arg is Max Distance */
3676 if (!p_ptr->wild_mode) do_cmd_run();
3680 /* Stay still (usually pick things up) */
3683 do_cmd_stay(always_pickup);
3687 /* Stay still (usually do not pick up) */
3690 do_cmd_stay(!always_pickup);
3694 /* Rest -- Arg is time */
3701 /* Search for traps/doors */
3708 /* Toggle search mode */
3711 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3712 else set_action(ACTION_SEARCH);
3717 /*** Stairs and Doors and Chests and Traps ***/
3720 case SPECIAL_KEY_STORE:
3726 /* Enter building -KMW- */
3727 case SPECIAL_KEY_BUILDING:
3733 /* Enter quest level -KMW- */
3734 case SPECIAL_KEY_QUEST:
3740 /* Go up staircase */
3743 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3745 if (vanilla_town) break;
3747 if (p_ptr->ambush_flag)
3749 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3753 if (p_ptr->food < PY_FOOD_WEAK)
3755 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3766 /* Go down staircase */
3769 if (p_ptr->wild_mode)
3776 /* Open a door or chest */
3790 /* Jam a door with spikes */
3804 /* Disarm a trap or chest */
3812 /*** Magic and Prayers ***/
3814 /* Gain new spells/prayers */
3817 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3818 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3819 else if (p_ptr->pclass == CLASS_SAMURAI)
3820 do_cmd_gain_hissatsu();
3821 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3822 import_magic_device();
3831 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3832 (p_ptr->pclass == CLASS_BERSERKER) ||
3833 (p_ptr->pclass == CLASS_NINJA) ||
3834 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3835 ) do_cmd_mind_browse();
3836 else if (p_ptr->pclass == CLASS_SMITH)
3838 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3839 do_cmd_magic_eater(TRUE, FALSE);
3840 else if (p_ptr->pclass == CLASS_SNIPER)
3841 do_cmd_snipe_browse();
3842 else do_cmd_browse();
3850 if (!p_ptr->wild_mode)
3852 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3854 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3856 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))
3858 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3861 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3863 concptr which_power = _("魔法", "magic");
3864 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3865 which_power = _("超能力", "psionic powers");
3866 else if (p_ptr->pclass == CLASS_IMITATOR)
3867 which_power = _("ものまね", "imitation");
3868 else if (p_ptr->pclass == CLASS_SAMURAI)
3869 which_power = _("必殺剣", "hissatsu");
3870 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3871 which_power = _("鏡魔法", "mirror magic");
3872 else if (p_ptr->pclass == CLASS_NINJA)
3873 which_power = _("忍術", "ninjutsu");
3874 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3875 which_power = _("祈り", "prayer");
3877 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3880 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3882 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3887 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3888 (p_ptr->pclass == CLASS_BERSERKER) ||
3889 (p_ptr->pclass == CLASS_NINJA) ||
3890 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3893 else if (p_ptr->pclass == CLASS_IMITATOR)
3895 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3896 do_cmd_magic_eater(FALSE, FALSE);
3897 else if (p_ptr->pclass == CLASS_SAMURAI)
3899 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3900 do_cmd_cast_learned();
3901 else if (p_ptr->pclass == CLASS_SMITH)
3903 else if (p_ptr->pclass == CLASS_SNIPER)
3912 /* Issue a pet command */
3919 /*** Use various objects ***/
3921 /* Inscribe an object */
3928 /* Uninscribe an object */
3931 do_cmd_uninscribe();
3935 /* Activate an artifact */
3949 /* Fuel your lantern/torch */
3959 do_cmd_fire(SP_NONE);
3966 do_cmd_throw(1, FALSE, -1);
3980 if (use_command && rogue_like_commands)
3991 /* Quaff a potion */
3994 do_cmd_quaff_potion();
4001 do_cmd_read_scroll();
4008 if (use_command && !rogue_like_commands)
4015 /* Use racial power */
4018 do_cmd_racial_power();
4023 /*** Looking at Things (nearby or on map) ***/
4025 /* Full dungeon map */
4032 /* Locate player on map */
4046 /* Target monster or location */
4055 /*** Help and Such ***/
4064 /* Identify symbol */
4067 do_cmd_query_symbol();
4071 /* Character description */
4074 do_cmd_change_name();
4079 /*** System Commands ***/
4081 /* Hack -- User interface */
4088 /* Single line from a pref file */
4097 do_cmd_reload_autopick();
4103 do_cmd_edit_autopick();
4107 /* Interact with macros */
4114 /* Interact with visuals */
4122 /* Interact with colors */
4130 /* Interact with options */
4134 (void)combine_and_reorder_home(STORE_HOME);
4139 /*** Misc Commands ***/
4155 /* Repeat level feeling */
4162 /* Show previous message */
4165 do_cmd_message_one();
4169 /* Show previous messages */
4172 do_cmd_messages(old_now_message);
4176 /* Show quest status -KMW- */
4179 do_cmd_checkquest();
4183 /* Redraw the screen */
4186 now_message = old_now_message;
4191 #ifndef VERIFY_SAVEFILE
4193 /* Hack -- Save and don't quit */
4196 do_cmd_save_game(FALSE);
4200 #endif /* VERIFY_SAVEFILE */
4210 case SPECIAL_KEY_QUIT:
4212 do_cmd_save_and_exit();
4216 /* Quit (commit suicide) */
4229 /* Check artifacts, uniques, objects */
4236 /* Load "screen dump" */
4239 do_cmd_load_screen();
4243 /* Save "screen dump" */
4246 do_cmd_save_screen();
4250 /* Record/stop "Movie" */
4253 prepare_movie_hooks();
4257 /* Make random artifact list */
4260 spoil_random_artifact("randifact.txt");
4267 if (!p_ptr->wild_mode) do_cmd_travel();
4268 if (p_ptr->special_defense & KATA_MUSOU)
4270 set_action(ACTION_NONE);
4276 /* Hack -- Unknown command */
4279 if (flush_failure) flush();
4283 sound(SOUND_ILLEGAL);
4284 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4289 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4295 if (!p_ptr->energy_use && !now_message)
4296 now_message = old_now_message;
4300 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4303 static void pack_overflow(void)
4305 if (inventory[INVEN_PACK].k_idx)
4307 GAME_TEXT o_name[MAX_NLEN];
4310 /* Is auto-destroy done? */
4311 update_creature(p_ptr);
4312 if (!inventory[INVEN_PACK].k_idx) return;
4314 /* Access the slot to be dropped */
4315 o_ptr = &inventory[INVEN_PACK];
4317 disturb(FALSE, TRUE);
4320 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4321 object_desc(o_name, o_ptr, 0);
4323 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4325 /* Drop it (carefully) near the player */
4326 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4328 /* Modify, Describe, Optimize */
4329 inven_item_increase(INVEN_PACK, -255);
4330 inven_item_describe(INVEN_PACK);
4331 inven_item_optimize(INVEN_PACK);
4338 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4341 static void process_upkeep_with_speed(void)
4343 /* Give the player some energy */
4344 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4346 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4349 /* No current_world_ptr->game_turn yet */
4350 if (p_ptr->enchant_energy_need > 0) return;
4352 while (p_ptr->enchant_energy_need <= 0)
4354 /* Handle the player song */
4355 if (!load) check_music();
4357 /* Hex - Handle the hex spells */
4358 if (!load) check_hex();
4359 if (!load) revenge_spell();
4361 /* There is some randomness of needed energy */
4362 p_ptr->enchant_energy_need += ENERGY_NEED();
4367 * @brief プレイヤーの行動処理 / Process the player
4370 * Notice the annoying code to handle "pack overflow", which\n
4371 * must come first just in case somebody manages to corrupt\n
4372 * the savefiles by clever use of menu commands or something.\n
4374 static void process_player(void)
4378 /*** Apply energy ***/
4382 msg_print(_("何か変わった気がする!", "You feel different!"));
4384 (void)gain_mutation(p_ptr, 0);
4385 hack_mutation = FALSE;
4388 if (invoking_midnight_curse)
4391 activate_ty_curse(FALSE, &count);
4392 invoking_midnight_curse = FALSE;
4395 if (p_ptr->inside_battle)
4397 for(m_idx = 1; m_idx < m_max; m_idx++)
4399 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4401 if (!monster_is_valid(m_ptr)) continue;
4403 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4404 update_monster(m_idx, FALSE);
4409 /* Give the player some energy */
4410 else if (!(load && p_ptr->energy_need <= 0))
4412 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4415 /* No current_world_ptr->game_turn yet */
4416 if (p_ptr->energy_need > 0) return;
4417 if (!command_rep) prt_time();
4419 /*** Check for interupts ***/
4421 /* Complete resting */
4422 if (p_ptr->resting < 0)
4425 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4428 if ((p_ptr->chp == p_ptr->mhp) &&
4429 (p_ptr->csp >= p_ptr->msp))
4431 set_action(ACTION_NONE);
4435 /* Complete resting */
4436 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4439 if ((p_ptr->chp == p_ptr->mhp) &&
4440 (p_ptr->csp >= p_ptr->msp) &&
4441 !p_ptr->blind && !p_ptr->confused &&
4442 !p_ptr->poisoned && !p_ptr->afraid &&
4443 !p_ptr->stun && !p_ptr->cut &&
4444 !p_ptr->slow && !p_ptr->paralyzed &&
4445 !p_ptr->image && !p_ptr->word_recall &&
4446 !p_ptr->alter_reality)
4448 set_action(ACTION_NONE);
4453 if (p_ptr->action == ACTION_FISH)
4455 Term_xtra(TERM_XTRA_DELAY, 10);
4459 bool success = FALSE;
4460 get_mon_num_prep(monster_is_fishing_target,NULL);
4461 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);
4463 if (r_idx && one_in_(2))
4466 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4467 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4468 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4470 GAME_TEXT m_name[MAX_NLEN];
4471 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4472 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4478 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4480 disturb(FALSE, TRUE);
4484 /* Handle "abort" */
4487 /* Check for "player abort" (semi-efficiently for resting) */
4488 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4493 /* Check for a key */
4496 flush(); /* Flush input */
4498 disturb(FALSE, TRUE);
4500 /* Hack -- Show a Message */
4501 msg_print(_("中断しました。", "Canceled."));
4506 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4508 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4509 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4511 if (MON_CSLEEP(m_ptr))
4513 GAME_TEXT m_name[MAX_NLEN];
4516 (void)set_monster_csleep(p_ptr->riding, 0);
4517 monster_desc(m_name, m_ptr, 0);
4518 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4521 if (MON_STUNNED(m_ptr))
4523 /* Hack -- Recover from stun */
4524 if (set_monster_stunned(p_ptr->riding,
4525 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4527 GAME_TEXT m_name[MAX_NLEN];
4528 monster_desc(m_name, m_ptr, 0);
4529 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4533 if (MON_CONFUSED(m_ptr))
4535 /* Hack -- Recover from confusion */
4536 if (set_monster_confused(p_ptr->riding,
4537 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4539 GAME_TEXT m_name[MAX_NLEN];
4540 monster_desc(m_name, m_ptr, 0);
4541 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4545 if (MON_MONFEAR(m_ptr))
4547 /* Hack -- Recover from fear */
4548 if(set_monster_monfear(p_ptr->riding,
4549 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4551 GAME_TEXT m_name[MAX_NLEN];
4552 monster_desc(m_name, m_ptr, 0);
4553 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4563 if (p_ptr->lightspeed)
4565 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4567 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4569 if(P_PTR_KI < 40) P_PTR_KI = 0;
4570 else P_PTR_KI -= 40;
4571 p_ptr->update |= (PU_BONUS);
4573 if (p_ptr->action == ACTION_LEARN)
4576 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4578 /* Convert the unit (1/2^16) to (1/2^32) */
4579 s64b_LSHIFT(cost, cost_frac, 16);
4581 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4585 p_ptr->csp_frac = 0;
4586 set_action(ACTION_NONE);
4591 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4593 p_ptr->redraw |= PR_MANA;
4596 if (p_ptr->special_defense & KATA_MASK)
4598 if (p_ptr->special_defense & KATA_MUSOU)
4602 set_action(ACTION_NONE);
4607 p_ptr->redraw |= (PR_MANA);
4612 /*** Handle actual user input ***/
4614 /* Repeat until out of energy */
4615 while (p_ptr->energy_need <= 0)
4617 p_ptr->window |= PW_PLAYER;
4618 p_ptr->sutemi = FALSE;
4619 p_ptr->counter = FALSE;
4620 p_ptr->now_damaged = FALSE;
4624 /* Place the cursor on the player */
4625 move_cursor_relative(p_ptr->y, p_ptr->x);
4627 /* Refresh (optional) */
4628 if (fresh_before) Term_fresh();
4630 /* Hack -- Pack Overflow */
4633 /* Hack -- cancel "lurking browse mode" */
4634 if (!command_new) command_see = FALSE;
4636 /* Assume free current_world_ptr->game_turn */
4639 if (p_ptr->inside_battle)
4641 /* Place the cursor on the player */
4642 move_cursor_relative(p_ptr->y, p_ptr->x);
4644 command_cmd = SPECIAL_KEY_BUILDING;
4646 /* Process the command */
4650 /* Paralyzed or Knocked Out */
4651 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4653 take_turn(p_ptr, 100);
4657 else if (p_ptr->action == ACTION_REST)
4660 if (p_ptr->resting > 0)
4662 /* Reduce rest count */
4665 if (!p_ptr->resting) set_action(ACTION_NONE);
4666 p_ptr->redraw |= (PR_STATE);
4669 take_turn(p_ptr, 100);
4673 else if (p_ptr->action == ACTION_FISH)
4675 take_turn(p_ptr, 100);
4687 else if (travel.run)
4694 /* Repeated command */
4695 else if (command_rep)
4697 /* Count this execution */
4700 p_ptr->redraw |= (PR_STATE);
4703 /* Hack -- Assume messages were seen */
4706 /* Clear the top line */
4709 /* Process the command */
4713 /* Normal command */
4716 /* Place the cursor on the player */
4717 move_cursor_relative(p_ptr->y, p_ptr->x);
4720 /* Get a command (normal) */
4721 request_command(FALSE);
4724 /* Process the command */
4728 /* Hack -- Pack Overflow */
4734 if (p_ptr->energy_use)
4736 /* Use some energy */
4737 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4739 /* The Randomness is irrelevant */
4740 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4744 /* There is some randomness of needed energy */
4745 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4748 /* Hack -- constant hallucination */
4749 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4752 /* Shimmer monsters if needed */
4753 if (shimmer_monsters)
4755 /* Clear the flag */
4756 shimmer_monsters = FALSE;
4758 /* Shimmer multi-hued monsters */
4759 for (m_idx = 1; m_idx < m_max; m_idx++)
4761 monster_type *m_ptr;
4762 monster_race *r_ptr;
4764 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4765 if (!monster_is_valid(m_ptr)) continue;
4767 /* Skip unseen monsters */
4768 if (!m_ptr->ml) continue;
4770 /* Access the monster race */
4771 r_ptr = &r_info[m_ptr->ap_r_idx];
4773 /* Skip non-multi-hued monsters */
4774 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4777 /* Reset the flag */
4778 shimmer_monsters = TRUE;
4780 /* Redraw regardless */
4781 lite_spot(m_ptr->fy, m_ptr->fx);
4786 /* Handle monster detection */
4787 if (repair_monsters)
4789 /* Reset the flag */
4790 repair_monsters = FALSE;
4792 /* Rotate detection flags */
4793 for (m_idx = 1; m_idx < m_max; m_idx++)
4795 monster_type *m_ptr;
4796 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4797 if (!monster_is_valid(m_ptr)) continue;
4799 /* Nice monsters get mean */
4800 if (m_ptr->mflag & MFLAG_NICE)
4802 /* Nice monsters get mean */
4803 m_ptr->mflag &= ~(MFLAG_NICE);
4806 /* Handle memorized monsters */
4807 if (m_ptr->mflag2 & MFLAG2_MARK)
4809 /* Maintain detection */
4810 if (m_ptr->mflag2 & MFLAG2_SHOW)
4813 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4815 /* Still need repairs */
4816 repair_monsters = TRUE;
4819 /* Remove detection */
4823 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4825 /* Assume invisible */
4827 update_monster(m_idx, FALSE);
4829 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4830 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4832 /* Redraw regardless */
4833 lite_spot(m_ptr->fy, m_ptr->fx);
4838 if (p_ptr->pclass == CLASS_IMITATOR)
4841 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4844 for (j = 0; j < p_ptr->mane_num; j++)
4846 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4847 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4851 p_ptr->redraw |= (PR_IMITATION);
4853 if (p_ptr->action == ACTION_LEARN)
4856 p_ptr->redraw |= (PR_STATE);
4859 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4862 p_ptr->redraw |= (PR_MAP);
4863 p_ptr->update |= (PU_MONSTERS);
4864 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4866 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4868 p_ptr->timewalk = FALSE;
4869 p_ptr->energy_need = ENERGY_NEED();
4875 /* Hack -- notice death */
4876 if (!p_ptr->playing || p_ptr->is_dead)
4878 p_ptr->timewalk = FALSE;
4883 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
4885 /* Handle "leaving" */
4886 if (p_ptr->leaving) break;
4889 /* Update scent trail */
4894 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4898 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4899 * ゲームを終了するかのいずれかまでループする。
4902 * This function will not exit until the level is completed,\n
4903 * the user dies, or the game is terminated.\n
4906 static void dungeon(bool load_game)
4910 /* Set the base level */
4911 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4913 /* Reset various flags */
4914 is_loading_now = FALSE;
4917 p_ptr->leaving = FALSE;
4919 /* Reset the "command" vars */
4922 #if 0 /* Don't reset here --- It's used for Arena */
4931 /* Cancel the target */
4935 p_ptr->ambush_flag = FALSE;
4937 /* Cancel the health bar */
4940 /* Check visual effects */
4941 shimmer_monsters = TRUE;
4942 shimmer_objects = TRUE;
4943 repair_monsters = TRUE;
4944 repair_objects = TRUE;
4947 disturb(TRUE, TRUE);
4949 /* Get index of current quest (if any) */
4950 quest_num = quest_number(current_floor_ptr->dun_level);
4952 /* Inside a quest? */
4955 /* Mark the quest monster */
4956 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4959 /* Track maximum player level */
4960 if (p_ptr->max_plv < p_ptr->lev)
4962 p_ptr->max_plv = p_ptr->lev;
4966 /* Track maximum dungeon level (if not in quest -KMW-) */
4967 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4969 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4970 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4973 (void)calculate_upkeep();
4975 /* Validate the panel */
4976 panel_bounds_center();
4978 /* Verify the panel */
4984 /* Enter "xtra" mode */
4985 character_xtra = TRUE;
4987 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4988 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4989 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);
4993 /* Leave "xtra" mode */
4994 character_xtra = FALSE;
4996 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4997 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5001 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5002 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5003 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5005 if (p_ptr->inside_battle)
5009 p_ptr->energy_need = 0;
5010 update_gambling_monsters();
5014 msg_print(_("試合開始!", "Ready..Fight!"));
5019 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5020 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5022 /* Hack -- notice death or departure */
5023 if (!p_ptr->playing || p_ptr->is_dead) return;
5025 /* Print quest message if appropriate */
5026 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5028 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5029 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5031 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5033 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5035 msg_format("この階には%sの主である%sが棲んでいる。",
5036 d_name+d_info[p_ptr->dungeon_idx].name,
5037 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5039 msg_format("%^s lives in this level as the keeper of %s.",
5040 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5041 d_name+d_info[p_ptr->dungeon_idx].name);
5045 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5047 /*** Process this dungeon level ***/
5049 /* Reset the monster generation level */
5050 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5052 /* Reset the object generation level */
5053 current_floor_ptr->object_level = current_floor_ptr->base_level;
5055 is_loading_now = TRUE;
5057 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5058 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5059 p_ptr->energy_need = 0;
5061 /* Not leaving dungeon */
5062 p_ptr->leaving_dungeon = FALSE;
5064 /* Initialize monster process */
5070 /* Hack -- Compact the monster list occasionally */
5071 if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5073 /* Hack -- Compress the monster list occasionally */
5074 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5077 /* Hack -- Compact the object list occasionally */
5078 if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5080 /* Hack -- Compress the object list occasionally */
5081 if (o_cnt + 32 < o_max) compact_objects(0);
5083 /* Process the player */
5085 process_upkeep_with_speed();
5089 /* Hack -- Hilite the player */
5090 move_cursor_relative(p_ptr->y, p_ptr->x);
5092 /* Optional fresh */
5093 if (fresh_after) Term_fresh();
5095 /* Hack -- Notice death or departure */
5096 if (!p_ptr->playing || p_ptr->is_dead) break;
5098 /* Process all of the monsters */
5103 /* Hack -- Hilite the player */
5104 move_cursor_relative(p_ptr->y, p_ptr->x);
5106 /* Optional fresh */
5107 if (fresh_after) Term_fresh();
5109 /* Hack -- Notice death or departure */
5110 if (!p_ptr->playing || p_ptr->is_dead) break;
5112 /* Process the world */
5117 /* Hack -- Hilite the player */
5118 move_cursor_relative(p_ptr->y, p_ptr->x);
5120 /* Optional fresh */
5121 if (fresh_after) Term_fresh();
5123 /* Hack -- Notice death or departure */
5124 if (!p_ptr->playing || p_ptr->is_dead) break;
5126 /* Count game turns */
5127 current_world_ptr->game_turn++;
5129 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5131 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5132 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5135 prevent_turn_overflow();
5137 /* Handle "leaving" */
5138 if (p_ptr->leaving) break;
5140 if (wild_regen) wild_regen--;
5143 /* Inside a quest and non-unique questor? */
5144 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5146 /* Un-mark the quest monster */
5147 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5150 /* Not save-and-quit and not dead? */
5151 if (p_ptr->playing && !p_ptr->is_dead)
5154 * Maintain Unique monsters and artifact, save current
5155 * floor, then prepare next floor
5159 /* Forget the flag */
5160 reinit_wilderness = FALSE;
5163 /* Write about current level on the play record once per level */
5169 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5172 * Modified by Arcum Dagsson to support
5173 * separate macro files for different realms.
5175 static void load_all_pref_files(void)
5179 /* Access the "user" pref file */
5180 sprintf(buf, "user.prf");
5182 /* Process that file */
5183 process_pref_file(buf);
5185 /* Access the "user" system pref file */
5186 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5188 /* Process that file */
5189 process_pref_file(buf);
5191 /* Access the "race" pref file */
5192 sprintf(buf, "%s.prf", rp_ptr->title);
5194 /* Process that file */
5195 process_pref_file(buf);
5197 /* Access the "class" pref file */
5198 sprintf(buf, "%s.prf", cp_ptr->title);
5200 /* Process that file */
5201 process_pref_file(buf);
5203 /* Access the "character" pref file */
5204 sprintf(buf, "%s.prf", player_base);
5206 /* Process that file */
5207 process_pref_file(buf);
5209 /* Access the "realm 1" pref file */
5210 if (p_ptr->realm1 != REALM_NONE)
5212 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5214 /* Process that file */
5215 process_pref_file(buf);
5218 /* Access the "realm 2" pref file */
5219 if (p_ptr->realm2 != REALM_NONE)
5221 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5223 /* Process that file */
5224 process_pref_file(buf);
5228 /* Load an autopick preference file */
5229 autopick_load_pref(FALSE);
5234 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
5237 void extract_option_vars(void)
5241 for (i = 0; option_info[i].o_desc; i++)
5243 int os = option_info[i].o_set;
5244 int ob = option_info[i].o_bit;
5246 /* Set the "default" options */
5247 if (option_info[i].o_var)
5250 if (option_flag[os] & (1L << ob))
5253 (*option_info[i].o_var) = TRUE;
5260 (*option_info[i].o_var) = FALSE;
5268 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
5271 void determine_bounty_uniques(void)
5275 monster_race *r_ptr;
5277 get_mon_num_prep(NULL, NULL);
5278 for (i = 0; i < MAX_KUBI; i++)
5282 current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
5283 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
5285 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5287 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
5289 if (r_ptr->rarity > 100) continue;
5291 if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
5293 for (j = 0; j < i; j++)
5294 if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
5301 for (i = 0; i < MAX_KUBI - 1; i++)
5303 for (j = i; j < MAX_KUBI; j++)
5305 if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
5307 tmp = current_world_ptr->bounty_r_idx[i];
5308 current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
5309 current_world_ptr->bounty_r_idx[j] = tmp;
5317 * @brief 今日の賞金首を確定する / Determine today's bounty monster
5319 * @note conv_old is used if loaded 0.0.3 or older save file
5321 void determine_today_mon(bool conv_old)
5324 bool old_inside_battle = p_ptr->inside_battle;
5325 monster_race *r_ptr;
5329 for (i = 0; i < max_d_idx; i++)
5331 if (max_dlv[i] < d_info[i].mindepth) continue;
5332 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
5335 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
5337 p_ptr->inside_battle = TRUE;
5338 get_mon_num_prep(NULL, NULL);
5342 today_mon = get_mon_num(max_dl);
5343 r_ptr = &r_info[today_mon];
5345 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5346 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
5347 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
5348 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
5349 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
5350 if (r_ptr->rarity > 10) continue;
5354 p_ptr->today_mon = 0;
5355 p_ptr->inside_battle = old_inside_battle;
5359 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5362 * If the "new_game" parameter is true, then, after loading the
5363 * savefile, we will commit suicide, if necessary, to allow the
5364 * player to start a new game.
5366 void play_game(bool new_game)
5369 bool load_game = TRUE;
5370 bool init_random_seed = FALSE;
5380 else if (chuukei_server)
5382 prepare_chuukei_hooks();
5393 hack_mutation = FALSE;
5395 /* Hack -- Character is "icky" */
5396 character_icky = TRUE;
5398 /* Make sure main term is active */
5399 Term_activate(angband_term[0]);
5401 /* Initialise the resize hooks */
5402 angband_term[0]->resize_hook = resize_map;
5404 for (i = 1; i < 8; i++)
5406 /* Does the term exist? */
5407 if (angband_term[i])
5409 /* Add the redraw on resize hook */
5410 angband_term[i]->resize_hook = redraw_window;
5414 /* Hack -- current_world_ptr->game_turn off the cursor */
5415 (void)Term_set_cursor(0);
5418 /* Attempt to load */
5421 quit(_("セーブファイルが壊れています", "broken savefile"));
5424 /* Extract the options */
5425 extract_option_vars();
5427 /* Report waited score */
5428 if (p_ptr->wait_report_score)
5433 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5436 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5437 update_creature(p_ptr);
5439 p_ptr->is_dead = TRUE;
5441 start_time = (u32b)time(NULL);
5443 /* No suspending now */
5444 signals_ignore_tstp();
5446 /* Hack -- Character is now "icky" */
5447 character_icky = TRUE;
5449 /* Build the filename */
5450 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5452 /* Open the high score file, for reading/writing */
5453 highscore_fd = fd_open(buf, O_RDWR);
5455 /* 町名消失バグ対策(#38205) Init the wilderness */
5456 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5458 /* Handle score, show Top scores */
5459 success = send_world_score(TRUE);
5461 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5463 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5468 p_ptr->wait_report_score = FALSE;
5470 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5472 /* Shut the high score file */
5473 (void)fd_close(highscore_fd);
5475 /* Forget the high score fd */
5478 /* Allow suspending now */
5479 signals_handle_tstp();
5484 creating_savefile = new_game;
5486 /* Nothing loaded */
5487 if (!character_loaded)
5489 /* Make new player */
5492 /* The dungeon is not ready */
5493 character_dungeon = FALSE;
5495 /* Prepare to init the RNG */
5496 init_random_seed = TRUE;
5498 /* Initialize the saved floors data */
5499 init_saved_floors(FALSE);
5502 /* Old game is loaded. But new game is requested. */
5505 /* Initialize the saved floors data */
5506 init_saved_floors(TRUE);
5509 /* Process old character */
5512 /* Process the player name */
5513 process_player_name(FALSE);
5517 if (init_random_seed)
5522 /* Roll new character */
5525 /* The dungeon is not ready */
5526 character_dungeon = FALSE;
5529 current_floor_ptr->dun_level = 0;
5530 p_ptr->inside_quest = 0;
5531 p_ptr->inside_arena = FALSE;
5532 p_ptr->inside_battle = FALSE;
5536 /* Hack -- seed for flavors */
5537 seed_flavor = randint0(0x10000000);
5539 /* Hack -- seed for town layout */
5540 seed_town = randint0(0x10000000);
5542 /* Roll up a new character */
5550 determine_bounty_uniques();
5551 determine_today_mon(FALSE);
5553 /* Initialize object array */
5558 write_level = FALSE;
5560 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5562 " ---- Restart Game ----"));
5565 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5566 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5568 if (p_ptr->riding == -1)
5571 for (i = m_max; i > 0; i--)
5573 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5582 creating_savefile = FALSE;
5584 p_ptr->teleport_town = FALSE;
5585 p_ptr->sutemi = FALSE;
5586 current_world_ptr->timewalk_m_idx = 0;
5587 p_ptr->now_damaged = FALSE;
5589 start_time = time(NULL) - 1;
5590 record_o_name[0] = '\0';
5592 /* Reset map panel */
5593 panel_row_min = current_floor_ptr->height;
5594 panel_col_min = current_floor_ptr->width;
5596 /* Sexy gal gets bonus to maximum weapon skill of whip */
5597 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5598 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5600 /* Fill the arrays of floors and walls in the good proportions */
5601 set_floor_and_wall(p_ptr->dungeon_idx);
5603 /* Flavor the objects */
5606 /* Flash a message */
5607 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5609 /* Flush the message */
5613 /* Hack -- Enter wizard mode */
5616 if (enter_wizard_mode())
5618 p_ptr->wizard = TRUE;
5620 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5622 /* Initialize the saved floors data */
5623 init_saved_floors(TRUE);
5626 p_ptr->inside_quest = 0;
5628 /* Avoid crash in update_view() */
5629 p_ptr->y = p_ptr->x = 10;
5632 else if (p_ptr->is_dead)
5634 quit("Already dead.");
5638 /* Initialize the town-buildings if necessary */
5639 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5641 /* Init the wilderness */
5643 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5646 init_flags = INIT_ONLY_BUILDINGS;
5648 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5650 select_floor_music();
5654 /* Generate a dungeon level if needed */
5655 if (!character_dungeon)
5662 /* HACK -- Restore from panic-save */
5663 if (p_ptr->panic_save)
5665 /* No player? -- Try to regenerate floor */
5666 if (!p_ptr->y || !p_ptr->x)
5668 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5672 /* Still no player? -- Try to locate random place */
5673 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5675 /* No longer in panic */
5676 p_ptr->panic_save = 0;
5680 /* Character is now "complete" */
5681 character_generated = TRUE;
5684 /* Hack -- Character is no longer "icky" */
5685 character_icky = FALSE;
5691 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5692 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5697 p_ptr->playing = TRUE;
5699 /* Reset the visual mappings */
5702 /* Load the "pref" files */
5703 load_all_pref_files();
5705 /* Give startup outfit (after loading pref files) */
5711 /* React to changes */
5712 Term_xtra(TERM_XTRA_REACT, 0);
5714 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5715 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5718 /* Set or clear "rogue_like_commands" if requested */
5719 if (arg_force_original) rogue_like_commands = FALSE;
5720 if (arg_force_roguelike) rogue_like_commands = TRUE;
5722 /* Hack -- Enforce "delayed death" */
5723 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5725 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5727 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5729 monster_type *m_ptr;
5730 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5731 monster_race *r_ptr = &r_info[pet_r_idx];
5732 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5733 (PM_FORCE_PET | PM_NO_KAGE));
5734 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5735 m_ptr->mspeed = r_ptr->speed;
5736 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5737 m_ptr->max_maxhp = m_ptr->maxhp;
5738 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5739 m_ptr->dealt_damage = 0;
5740 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5743 (void)combine_and_reorder_home(STORE_HOME);
5744 (void)combine_and_reorder_home(STORE_MUSEUM);
5746 select_floor_music();
5751 /* Process the level */
5754 /* Hack -- prevent "icky" message */
5755 character_xtra = TRUE;
5759 character_xtra = FALSE;
5761 /* Cancel the target */
5764 /* Cancel the health bar */
5771 /* Handle "quit and save" */
5772 if (!p_ptr->playing && !p_ptr->is_dead) break;
5774 /* Erase the old current_floor_ptr->grid_array */
5776 if (!p_ptr->is_dead) wipe_m_list();
5783 /* Accidental Death */
5784 if (p_ptr->playing && p_ptr->is_dead)
5786 if (p_ptr->inside_arena)
5788 p_ptr->inside_arena = FALSE;
5789 if (p_ptr->arena_number > MAX_ARENA_MONS)
5790 p_ptr->arena_number++;
5792 p_ptr->arena_number = -1 - p_ptr->arena_number;
5793 p_ptr->is_dead = FALSE;
5795 p_ptr->chp_frac = 0;
5796 p_ptr->exit_bldg = TRUE;
5799 /* Leave through the exit */
5800 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5802 /* prepare next floor */
5807 /* Mega-Hack -- Allow player to cheat death */
5808 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5815 /* Handle "death" */
5816 if (p_ptr->is_dead) break;
5818 /* Make a new level */
5830 * @brief ゲームターンからの実時間換算を行うための補正をかける
5831 * @param hoge ゲームターン
5832 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5833 * @return 修正をかけた後のゲームターン
5835 s32b turn_real(s32b hoge)
5837 switch (p_ptr->start_race)
5843 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5850 * @brief ターンのオーバーフローに対する対処
5851 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5852 * @return 修正をかけた後のゲームターン
5854 void prevent_turn_overflow(void)
5856 int rollback_days, i, j;
5857 s32b rollback_turns;
5859 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5861 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5862 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5864 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5865 else current_world_ptr->game_turn = 1;
5866 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5867 else current_floor_ptr->generated_turn = 1;
5868 if (old_battle > rollback_turns) old_battle -= rollback_turns;
5869 else old_battle = 1;
5870 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5871 else p_ptr->feeling_turn = 1;
5873 for (i = 1; i < max_towns; i++)
5875 for (j = 0; j < MAX_STORES; j++)
5877 store_type *st_ptr = &town_info[i].store[j];
5879 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5881 st_ptr->last_visit -= rollback_turns;
5882 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5885 if (st_ptr->store_open)
5887 st_ptr->store_open -= rollback_turns;
5888 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5896 * Close up the current game (player may or may not be dead)
5900 * This function is called only from "main.c" and "signals.c".
5903 void close_game(void)
5906 bool do_send = TRUE;
5908 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5911 /* Flush the messages */
5914 /* Flush the input */
5918 /* No suspending now */
5919 signals_ignore_tstp();
5922 /* Hack -- Character is now "icky" */
5923 character_icky = TRUE;
5926 /* Build the filename */
5927 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5929 /* Grab permissions */
5932 /* Open the high score file, for reading/writing */
5933 highscore_fd = fd_open(buf, O_RDWR);
5935 /* Drop permissions */
5941 /* Handle retirement */
5942 if (p_ptr->total_winner) kingly();
5945 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5947 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5949 else do_send = FALSE;
5956 /* Show more info */
5962 if ((!send_world_score(do_send)))
5964 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5965 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5967 p_ptr->wait_report_score = TRUE;
5968 p_ptr->is_dead = FALSE;
5969 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5972 if (!p_ptr->wait_report_score)
5975 else if (highscore_fd >= 0)
5977 display_scores_aux(0, 10, -1, NULL);
5980 /* Dump bones file */
5989 do_cmd_save_game(FALSE);
5991 /* Prompt for scores */
5992 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5993 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5995 /* Predict score (or ESCAPE) */
5996 if (inkey() != ESCAPE) predict_score();
6000 /* Shut the high score file */
6001 (void)fd_close(highscore_fd);
6003 /* Forget the high score fd */
6006 /* Kill all temporal files */
6007 clear_saved_floor_files();
6009 /* Allow suspending now */
6010 signals_handle_tstp();