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.
15 #include "cmd-activate.h"
17 #include "cmd-hissatsu.h"
19 #include "cmd-magiceat.h"
21 #include "cmd-quaff.h"
23 #include "cmd-smith.h"
24 #include "cmd-usestaff.h"
25 #include "cmd-zaprod.h"
26 #include "cmd-zapwand.h"
28 #include "cmd-basic.h"
31 #include "floor-events.h"
33 #include "object-curse.h"
34 #include "object-flavor.h"
37 #include "spells-summon.h"
38 #include "spells-object.h"
39 #include "spells-status.h"
40 #include "spells-floor.h"
47 #include "player-move.h"
48 #include "player-status.h"
49 #include "cmd-spell.h"
50 #include "realm-hex.h"
51 #include "object-hook.h"
53 #include "monster-process.h"
54 #include "monster-status.h"
55 #include "monsterrace-hook.h"
56 #include "floor-save.h"
58 #include "view-mainwindow.h"
59 #include "dungeon-file.h"
61 #include "player-effects.h"
63 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
64 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
67 * @brief 擬似鑑定を実際に行い判定を反映する
68 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
69 * @param heavy 重度の擬似鑑定を行うならばTRUE
72 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
75 object_type *o_ptr = &inventory[slot];
76 GAME_TEXT o_name[MAX_NLEN];
78 /* We know about it already, do not tell us again */
79 if (o_ptr->ident & (IDENT_SENSE))return;
81 /* It is fully known, no information needed */
82 if (object_is_known(o_ptr)) return;
84 /* Check for a feeling */
85 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
87 /* Skip non-feelings */
91 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
102 feel = FEEL_EXCELLENT;
108 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
110 feel = FEEL_UNCURSED;
115 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
121 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
128 feel = FEEL_WORTHLESS;
133 feel = FEEL_TERRIBLE;
139 /* Stop everything */
140 if (disturb_minor) disturb(FALSE, FALSE);
142 /* Get an object description */
143 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
145 /* Message (equipment) */
146 if (slot >= INVEN_RARM)
149 msg_format("%s%s(%c)は%sという感じがする...",
150 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
152 msg_format("You feel the %s (%c) you are %s %s %s...",
153 o_name, index_to_label(slot), describe_use(slot),
154 ((o_ptr->number == 1) ? "is" : "are"),
155 game_inscriptions[feel]);
160 /* Message (inventory) */
164 msg_format("ザックの中の%s(%c)は%sという感じがする...",
165 o_name, index_to_label(slot),game_inscriptions[feel]);
167 msg_format("You feel the %s (%c) in your pack %s %s...",
168 o_name, index_to_label(slot),
169 ((o_ptr->number == 1) ? "is" : "are"),
170 game_inscriptions[feel]);
175 o_ptr->ident |= (IDENT_SENSE);
177 /* Set the "inscription" */
178 o_ptr->feeling = feel;
180 /* Auto-inscription/destroy */
181 autopick_alter_item(slot, destroy_feeling);
182 p_ptr->update |= (PU_COMBINE | PU_REORDER);
184 p_ptr->window |= (PW_INVEN | PW_EQUIP);
190 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
193 * Sense the inventory\n
195 * Class 0 = Warrior --> fast and heavy\n
196 * Class 1 = Mage --> slow and light\n
197 * Class 2 = Priest --> fast but light\n
198 * Class 3 = Rogue --> okay and heavy\n
199 * Class 4 = Ranger --> slow but heavy (changed!)\n
200 * Class 5 = Paladin --> slow but heavy\n
202 static void sense_inventory1(void)
205 PLAYER_LEVEL plev = p_ptr->lev;
210 /*** Check for "sensing" ***/
212 /* No sensing when confused */
213 if (p_ptr->confused) return;
215 /* Analyze the class */
216 switch (p_ptr->pclass)
224 if (0 != randint0(9000L / (plev * plev + 40))) return;
235 if (0 != randint0(6000L / (plev * plev + 50))) return;
244 case CLASS_HIGH_MAGE:
246 case CLASS_MAGIC_EATER:
248 /* Very bad (light) sensing */
249 if (0 != randint0(240000L / (plev + 5))) return;
257 /* Good (light) sensing */
258 if (0 != randint0(10000L / (plev * plev + 40))) return;
267 if (0 != randint0(20000L / (plev * plev + 40))) return;
278 if (0 != randint0(95000L / (plev * plev + 40))) return;
290 if (0 != randint0(77777L / (plev * plev + 40))) return;
298 case CLASS_WARRIOR_MAGE:
302 if (0 != randint0(75000L / (plev * plev + 40))) return;
307 case CLASS_MINDCRAFTER:
309 case CLASS_BLUE_MAGE:
310 case CLASS_MIRROR_MASTER:
313 if (0 != randint0(55000L / (plev * plev + 40))) return;
318 case CLASS_CHAOS_WARRIOR:
321 if (0 != randint0(80000L / (plev * plev + 40))) return;
330 case CLASS_FORCETRAINER:
333 if (0 != randint0(20000L / (plev * plev + 40))) return;
341 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
349 case CLASS_BEASTMASTER:
352 if (0 != randint0(65000L / (plev * plev + 40))) return;
356 case CLASS_BERSERKER:
365 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
367 /*** Sense everything ***/
369 /* Check everything */
370 for (i = 0; i < INVEN_TOTAL; i++)
374 o_ptr = &inventory[i];
376 /* Skip empty slots */
377 if (!o_ptr->k_idx) continue;
379 /* Valid "tval" codes */
406 /* Skip non-sense machines */
409 /* Occasional failure on inventory items */
410 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
413 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
418 sense_inventory_aux(i, heavy);
423 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
426 static void sense_inventory2(void)
429 PLAYER_LEVEL plev = p_ptr->lev;
433 /*** Check for "sensing" ***/
435 /* No sensing when confused */
436 if (p_ptr->confused) return;
438 /* Analyze the class */
439 switch (p_ptr->pclass)
445 case CLASS_BERSERKER:
453 case CLASS_CHAOS_WARRIOR:
455 case CLASS_BEASTMASTER:
458 /* Very bad (light) sensing */
459 if (0 != randint0(240000L / (plev + 5))) return;
465 case CLASS_WARRIOR_MAGE:
470 if (0 != randint0(95000L / (plev * plev + 40))) return;
478 case CLASS_FORCETRAINER:
479 case CLASS_MINDCRAFTER:
482 if (0 != randint0(20000L / (plev * plev + 40))) return;
488 case CLASS_HIGH_MAGE:
490 case CLASS_MAGIC_EATER:
491 case CLASS_MIRROR_MASTER:
492 case CLASS_BLUE_MAGE:
495 if (0 != randint0(9000L / (plev * plev + 40))) return;
503 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
509 /*** Sense everything ***/
511 /* Check everything */
512 for (i = 0; i < INVEN_TOTAL; i++)
516 o_ptr = &inventory[i];
518 /* Skip empty slots */
519 if (!o_ptr->k_idx) continue;
521 /* Valid "tval" codes */
534 /* Skip non-sense machines */
537 /* Occasional failure on inventory items */
538 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
540 sense_inventory_aux(i, TRUE);
545 * @brief パターン終点到達時のテレポート処理を行う
548 static void pattern_teleport(void)
551 DEPTH max_level = 99;
554 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
559 /* Only downward in ironman mode */
560 if (ironman_downward)
561 min_level = current_floor_ptr->dun_level;
564 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
566 if (current_floor_ptr->dun_level > 100)
567 max_level = MAX_DEPTH - 1;
568 else if (current_floor_ptr->dun_level == 100)
573 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
574 min_level = d_info[p_ptr->dungeon_idx].mindepth;
578 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
581 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
583 /* Ask for a level */
584 if (!get_string(ppp, tmp_val, 10)) return;
586 /* Extract request */
587 command_arg = (COMMAND_ARG)atoi(tmp_val);
589 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
591 teleport_player(200, 0L);
598 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
599 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
602 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
604 if (autosave_l) do_cmd_save_game(TRUE);
607 current_floor_ptr->dun_level = command_arg;
611 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
613 p_ptr->inside_quest = 0;
617 * Clear all saved floors
618 * and create a first saved floor
620 prepare_change_floor_mode(CFM_FIRST_FLOOR);
621 p_ptr->leaving = TRUE;
625 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
626 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
628 static bool pattern_effect(void)
632 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
634 if ((prace_is_(RACE_AMBERITE)) &&
635 (p_ptr->cut > 0) && one_in_(10))
640 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
642 switch (pattern_type)
644 case PATTERN_TILE_END:
646 (void)restore_all_status();
647 (void)restore_level();
648 (void)cure_critical_wounds(1000);
650 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
651 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
654 * We could make the healing effect of the
655 * Pattern center one-time only to avoid various kinds
656 * of abuse, like luring the win monster into fighting you
657 * in the middle of the pattern...
661 case PATTERN_TILE_OLD:
665 case PATTERN_TILE_TELEPORT:
669 case PATTERN_TILE_WRECKED:
671 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
675 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
677 else if (!IS_INVULN())
678 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
687 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
688 * @param percent 回復比率
691 static void regenhp(int percent)
697 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
698 if (p_ptr->action == ACTION_HAYAGAKE) return;
700 /* Save the old hitpoints */
701 old_chp = p_ptr->chp;
704 * Extract the new hitpoints
706 * 'percent' is the Regen factor in unit (1/2^16)
709 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
711 /* Convert the unit (1/2^16) to (1/2^32) */
712 s64b_LSHIFT(new_chp, new_chp_frac, 16);
715 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
719 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
721 p_ptr->chp = p_ptr->mhp;
726 if (old_chp != p_ptr->chp)
728 p_ptr->redraw |= (PR_HP);
729 p_ptr->window |= (PW_PLAYER);
736 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
737 * @param upkeep_factor ペット維持によるMPコスト量
738 * @param regen_amount 回復量
741 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
743 MANA_POINT old_csp = p_ptr->csp;
744 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
747 * Excess mana will decay 32 times faster than normal
750 if (p_ptr->csp > p_ptr->msp)
752 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
754 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
756 /* Convert the unit (1/2^16) to (1/2^32) */
757 s64b_LSHIFT(decay, decay_frac, 16);
760 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
763 if (p_ptr->csp < p_ptr->msp)
765 p_ptr->csp = p_ptr->msp;
770 /* Regenerating mana (unless the player has excess mana) */
771 else if (regen_rate > 0)
773 /* (percent/100) is the Regen factor in unit (1/2^16) */
774 MANA_POINT new_mana = 0;
775 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
777 /* Convert the unit (1/2^16) to (1/2^32) */
778 s64b_LSHIFT(new_mana, new_mana_frac, 16);
781 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
783 /* Must set frac to zero even if equal */
784 if (p_ptr->csp >= p_ptr->msp)
786 p_ptr->csp = p_ptr->msp;
792 /* Reduce mana (even when the player has excess mana) */
795 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
796 s32b reduce_mana = 0;
797 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
799 /* Convert the unit (1/2^16) to (1/2^32) */
800 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
803 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
813 if (old_csp != p_ptr->csp)
815 p_ptr->redraw |= (PR_MANA);
816 p_ptr->window |= (PW_PLAYER);
817 p_ptr->window |= (PW_SPELL);
823 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
824 * @param regen_amount 回復量
827 static void regenmagic(int regen_amount)
832 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
834 for (i = 0; i < EATER_EXT*2; i++)
836 if (!p_ptr->magic_num2[i]) continue;
837 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
839 /* Increase remaining charge number like float value */
840 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
841 p_ptr->magic_num1[i] += new_mana;
843 /* Check maximum charge */
844 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
846 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
850 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
852 if (!p_ptr->magic_num1[i]) continue;
853 if (!p_ptr->magic_num2[i]) continue;
855 /* Decrease remaining period for charging */
856 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
857 / (dev * 16 * PY_REGEN_NORMAL);
858 p_ptr->magic_num1[i] -= new_mana;
860 /* Check minimum remaining period for charging */
861 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
868 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
870 * @note Should probably be done during monster turns.
872 static void regen_monsters(void)
877 /* Regenerate everyone */
878 for (i = 1; i < m_max; i++)
880 /* Check the i'th monster */
881 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
882 monster_race *r_ptr = &r_info[m_ptr->r_idx];
884 if (!monster_is_valid(m_ptr)) continue;
886 /* Allow regeneration (if needed) */
887 if (m_ptr->hp < m_ptr->maxhp)
889 /* Hack -- Base regeneration */
890 frac = m_ptr->maxhp / 100;
892 /* Hack -- Minimal regeneration rate */
893 if (!frac) if (one_in_(2)) frac = 1;
895 /* Hack -- Some monsters regenerate quickly */
896 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
898 /* Hack -- Regenerate */
901 /* Do not over-regenerate */
902 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
904 /* Redraw (later) if needed */
905 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
906 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
913 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
915 * @note Should probably be done during monster turns.
917 static void regen_captured_monsters(void)
922 /* Regenerate everyone */
923 for (i = 0; i < INVEN_TOTAL; i++)
926 object_type *o_ptr = &inventory[i];
928 if (!o_ptr->k_idx) continue;
929 if (o_ptr->tval != TV_CAPTURE) continue;
930 if (!o_ptr->pval) continue;
934 r_ptr = &r_info[o_ptr->pval];
936 /* Allow regeneration (if needed) */
937 if (o_ptr->xtra4 < o_ptr->xtra5)
939 /* Hack -- Base regeneration */
940 frac = o_ptr->xtra5 / 100;
942 /* Hack -- Minimal regeneration rate */
943 if (!frac) if (one_in_(2)) frac = 1;
945 /* Hack -- Some monsters regenerate quickly */
946 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
948 /* Hack -- Regenerate */
949 o_ptr->xtra4 += (XTRA16)frac;
951 /* Do not over-regenerate */
952 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
959 p_ptr->update |= (PU_COMBINE);
960 p_ptr->window |= (PW_INVEN);
961 p_ptr->window |= (PW_EQUIP);
967 * @brief 寿命つき光源の警告メッセージ処理
968 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
971 static void notice_lite_change(object_type *o_ptr)
973 /* Hack -- notice interesting fuel steps */
974 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
976 p_ptr->window |= (PW_EQUIP);
979 /* Hack -- Special treatment when blind */
982 /* Hack -- save some light for later */
983 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
986 /* The light is now out */
987 else if (o_ptr->xtra4 == 0)
989 disturb(FALSE, TRUE);
990 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
992 /* Recalculate torch radius */
993 p_ptr->update |= (PU_TORCH);
995 /* Some ego light lose its effects without fuel */
996 p_ptr->update |= (PU_BONUS);
999 /* The light is getting dim */
1000 else if (o_ptr->name2 == EGO_LITE_LONG)
1002 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1003 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1005 if (disturb_minor) disturb(FALSE, TRUE);
1006 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1010 /* The light is getting dim */
1011 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1013 if (disturb_minor) disturb(FALSE, TRUE);
1014 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1020 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1021 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1024 static void recharged_notice(object_type *o_ptr)
1026 GAME_TEXT o_name[MAX_NLEN];
1030 /* No inscription */
1031 if (!o_ptr->inscription) return;
1034 s = my_strchr(quark_str(o_ptr->inscription), '!');
1036 /* Process notification request. */
1039 /* Find another '!' */
1042 /* Describe (briefly) */
1043 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1045 /* Notify the player */
1047 msg_format("%sは再充填された。", o_name);
1049 if (o_ptr->number > 1)
1050 msg_format("Your %s are recharged.", o_name);
1052 msg_format("Your %s is recharged.", o_name);
1055 disturb(FALSE, FALSE);
1061 /* Keep looking for '!'s */
1062 s = my_strchr(s + 1, '!');
1067 * @brief プレイヤーの歌に関する継続処理
1070 static void check_music(void)
1072 const magic_type *s_ptr;
1074 MANA_POINT need_mana;
1075 u32b need_mana_frac;
1077 /* Music singed by player */
1078 if (p_ptr->pclass != CLASS_BARD) return;
1079 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1081 if (p_ptr->anti_magic)
1083 stop_singing(p_ptr);
1087 spell = SINGING_SONG_ID(p_ptr);
1088 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1090 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1094 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1096 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1098 stop_singing(p_ptr);
1103 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1105 p_ptr->redraw |= PR_MANA;
1106 if (INTERUPTING_SONG_EFFECT(p_ptr))
1108 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1109 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1110 msg_print(_("歌を再開した。", "You restart singing."));
1111 p_ptr->action = ACTION_SING;
1112 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1113 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1114 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1117 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1118 p_ptr->spell_exp[spell] += 5;
1119 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1120 { 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; }
1121 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1122 { 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; }
1123 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1124 { 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; }
1126 /* Do any effects of continual song */
1127 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1131 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1132 * @param flag 探し出したい呪いフラグ配列
1133 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1136 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1139 int choices[INVEN_TOTAL-INVEN_RARM];
1142 /* Paranoia -- Player has no warning-item */
1143 if (!(p_ptr->cursed & flag)) return NULL;
1145 /* Search Inventry */
1146 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1148 object_type *o_ptr = &inventory[i];
1150 if (o_ptr->curse_flags & flag)
1152 choices[number] = i;
1155 else if ((flag == TRC_ADD_L_CURSE) ||
1156 (flag == TRC_ADD_H_CURSE) ||
1157 (flag == TRC_DRAIN_HP) ||
1158 (flag == TRC_DRAIN_MANA) ||
1159 (flag == TRC_CALL_ANIMAL) ||
1160 (flag == TRC_CALL_DEMON) ||
1161 (flag == TRC_CALL_DRAGON) ||
1162 (flag == TRC_CALL_UNDEAD) ||
1163 (flag == TRC_COWARDICE) ||
1164 (flag == TRC_LOW_MELEE) ||
1165 (flag == TRC_LOW_AC) ||
1166 (flag == TRC_LOW_MAGIC) ||
1167 (flag == TRC_FAST_DIGEST) ||
1168 (flag == TRC_SLOW_REGEN) )
1171 BIT_FLAGS flgs[TR_FLAG_SIZE];
1172 object_flags(o_ptr, flgs);
1175 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1176 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1177 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1178 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1179 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1180 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1181 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1182 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1183 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1184 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1185 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1186 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1187 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1188 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1191 if (have_flag(flgs, cf))
1193 choices[number] = i;
1199 /* Choice one of them */
1200 return (&inventory[choices[randint0(number)]]);
1203 static void process_world_aux_digestion(void)
1205 if (!p_ptr->inside_battle)
1207 /* Digest quickly when gorged */
1208 if (p_ptr->food >= PY_FOOD_MAX)
1210 /* Digest a lot of food */
1211 (void)set_food(p_ptr->food - 100);
1214 /* Digest normally -- Every 50 game turns */
1215 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1217 /* Basic digestion rate based on speed */
1218 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1220 /* Regeneration takes more food */
1221 if (p_ptr->regenerate)
1223 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1225 if (p_ptr->cursed & TRC_FAST_DIGEST)
1228 /* Slow digestion takes less food */
1229 if (p_ptr->slow_digest)
1232 /* Minimal digestion */
1233 if (digestion < 1) digestion = 1;
1234 /* Maximal digestion */
1235 if (digestion > 100) digestion = 100;
1237 /* Digest some food */
1238 (void)set_food(p_ptr->food - digestion);
1243 if ((p_ptr->food < PY_FOOD_FAINT))
1245 /* Faint occasionally */
1246 if (!p_ptr->paralyzed && (randint0(100) < 10))
1248 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1249 disturb(TRUE, TRUE);
1251 /* Hack -- faint (bypass free action) */
1252 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1255 /* Starve to death (slowly) */
1256 if (p_ptr->food < PY_FOOD_STARVE)
1258 /* Calculate damage */
1259 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1261 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1268 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1269 * / Handle timed damage and regeneration every 10 game turns
1272 static void process_world_aux_hp_and_sp(void)
1274 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1275 bool cave_no_regen = FALSE;
1276 int upkeep_factor = 0;
1278 /* Default regeneration */
1279 int regen_amount = PY_REGEN_NORMAL;
1282 /*** Damage over Time ***/
1284 /* Take damage from poison */
1285 if (p_ptr->poisoned && !IS_INVULN())
1287 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1290 /* Take damage from cuts */
1291 if (p_ptr->cut && !IS_INVULN())
1295 /* Mortal wound or Deep Gash */
1296 if (p_ptr->cut > 1000)
1301 else if (p_ptr->cut > 200)
1307 else if (p_ptr->cut > 100)
1312 else if (p_ptr->cut > 50)
1317 else if (p_ptr->cut > 25)
1322 else if (p_ptr->cut > 10)
1333 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1336 /* (Vampires) Take damage from sunlight */
1337 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1339 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1341 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1343 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1344 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1345 cave_no_regen = TRUE;
1349 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1350 !p_ptr->resist_lite)
1352 object_type * o_ptr = &inventory[INVEN_LITE];
1353 GAME_TEXT o_name [MAX_NLEN];
1354 char ouch [MAX_NLEN+40];
1356 /* Get an object description */
1357 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1358 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1360 cave_no_regen = TRUE;
1362 /* Get an object description */
1363 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1364 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1366 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1370 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1374 if (have_flag(f_ptr->flags, FF_DEEP))
1376 damage = 6000 + randint0(4000);
1378 else if (!p_ptr->levitation)
1380 damage = 3000 + randint0(2000);
1385 if(prace_is_(RACE_ENT)) damage += damage / 3;
1386 if(p_ptr->resist_fire) damage = damage / 3;
1387 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1388 if(p_ptr->levitation) damage = damage / 5;
1390 damage = damage / 100 + (randint0(100) < (damage % 100));
1392 if (p_ptr->levitation)
1394 msg_print(_("熱で火傷した!", "The heat burns you!"));
1395 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1396 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1400 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1401 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1402 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1405 cave_no_regen = TRUE;
1409 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1413 if (have_flag(f_ptr->flags, FF_DEEP))
1415 damage = 6000 + randint0(4000);
1417 else if (!p_ptr->levitation)
1419 damage = 3000 + randint0(2000);
1424 if (p_ptr->resist_cold) damage = damage / 3;
1425 if (IS_OPPOSE_COLD()) damage = damage / 3;
1426 if (p_ptr->levitation) damage = damage / 5;
1428 damage = damage / 100 + (randint0(100) < (damage % 100));
1430 if (p_ptr->levitation)
1432 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1433 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1434 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1438 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1439 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1440 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1443 cave_no_regen = TRUE;
1447 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1451 if (have_flag(f_ptr->flags, FF_DEEP))
1453 damage = 6000 + randint0(4000);
1455 else if (!p_ptr->levitation)
1457 damage = 3000 + randint0(2000);
1462 if (p_ptr->resist_elec) damage = damage / 3;
1463 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1464 if (p_ptr->levitation) damage = damage / 5;
1466 damage = damage / 100 + (randint0(100) < (damage % 100));
1468 if (p_ptr->levitation)
1470 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1471 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1472 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1476 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1477 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1478 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1481 cave_no_regen = TRUE;
1485 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1489 if (have_flag(f_ptr->flags, FF_DEEP))
1491 damage = 6000 + randint0(4000);
1493 else if (!p_ptr->levitation)
1495 damage = 3000 + randint0(2000);
1500 if (p_ptr->resist_acid) damage = damage / 3;
1501 if (IS_OPPOSE_ACID()) damage = damage / 3;
1502 if (p_ptr->levitation) damage = damage / 5;
1504 damage = damage / 100 + (randint0(100) < (damage % 100));
1506 if (p_ptr->levitation)
1508 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1509 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1510 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1514 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1515 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1516 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1519 cave_no_regen = TRUE;
1523 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1527 if (have_flag(f_ptr->flags, FF_DEEP))
1529 damage = 6000 + randint0(4000);
1531 else if (!p_ptr->levitation)
1533 damage = 3000 + randint0(2000);
1538 if (p_ptr->resist_pois) damage = damage / 3;
1539 if (IS_OPPOSE_POIS()) damage = damage / 3;
1540 if (p_ptr->levitation) damage = damage / 5;
1542 damage = damage / 100 + (randint0(100) < (damage % 100));
1544 if (p_ptr->levitation)
1546 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1547 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1548 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1549 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1553 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1554 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1555 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1556 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1559 cave_no_regen = TRUE;
1563 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1564 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1566 if (p_ptr->total_weight > weight_limit())
1568 msg_print(_("溺れている!", "You are drowning!"));
1569 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1570 cave_no_regen = TRUE;
1577 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1579 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1580 if (prace_is_(RACE_ENT)) damage += damage / 3;
1581 if (p_ptr->resist_fire) damage = damage / 3;
1582 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1583 msg_print(_("熱い!", "It's hot!"));
1584 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1586 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1588 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1589 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1590 if (p_ptr->resist_elec) damage = damage / 3;
1591 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1592 msg_print(_("痛い!", "It hurts!"));
1593 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1595 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1597 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1598 if (p_ptr->resist_cold) damage = damage / 3;
1599 if (IS_OPPOSE_COLD()) damage = damage / 3;
1600 msg_print(_("冷たい!", "It's cold!"));
1601 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1605 /* Spectres -- take damage when moving through walls */
1607 * Added: ANYBODY takes damage if inside through walls
1608 * without wraith form -- NOTE: Spectres will never be
1609 * reduced below 0 hp by being inside a stone wall; others
1612 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1614 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1617 cave_no_regen = TRUE;
1619 if (p_ptr->pass_wall)
1621 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1622 dam_desc = _("密度", "density");
1626 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1627 dam_desc = _("硬い岩", "solid rock");
1630 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1635 /*** handle regeneration ***/
1638 if (p_ptr->food < PY_FOOD_WEAK)
1640 /* Lower regeneration */
1641 if (p_ptr->food < PY_FOOD_STARVE)
1645 else if (p_ptr->food < PY_FOOD_FAINT)
1647 regen_amount = PY_REGEN_FAINT;
1651 regen_amount = PY_REGEN_WEAK;
1655 /* Are we walking the pattern? */
1656 if (pattern_effect())
1658 cave_no_regen = TRUE;
1662 /* Regeneration ability */
1663 if (p_ptr->regenerate)
1665 regen_amount = regen_amount * 2;
1667 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1671 if (p_ptr->cursed & TRC_SLOW_REGEN)
1678 /* Searching or Resting */
1679 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1681 regen_amount = regen_amount * 2;
1684 upkeep_factor = calculate_upkeep();
1686 /* No regeneration while special action */
1687 if ((p_ptr->action == ACTION_LEARN) ||
1688 (p_ptr->action == ACTION_HAYAGAKE) ||
1689 (p_ptr->special_defense & KATA_KOUKIJIN))
1691 upkeep_factor += 100;
1694 /* Regenerate the mana */
1695 regenmana(upkeep_factor, regen_amount);
1698 /* Recharge magic eater's power */
1699 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1701 regenmagic(regen_amount);
1704 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1706 while (upkeep_factor > 100)
1708 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1710 do_cmd_pet_dismiss();
1712 upkeep_factor = calculate_upkeep();
1714 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1719 /* Poisoned or cut yields no healing */
1720 if (p_ptr->poisoned) regen_amount = 0;
1721 if (p_ptr->cut) regen_amount = 0;
1723 /* Special floor -- Pattern, in a wall -- yields no healing */
1724 if (cave_no_regen) regen_amount = 0;
1726 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1728 /* Regenerate Hit Points if needed */
1729 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1731 regenhp(regen_amount);
1736 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1737 * / Handle timeout every 10 game turns
1740 static void process_world_aux_timeout(void)
1742 const int dec_count = (easy_band ? 2 : 1);
1744 /*** Timeout Various Things ***/
1747 if (p_ptr->tim_mimic)
1749 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1752 /* Hack -- Hallucinating */
1755 (void)set_image(p_ptr->image - dec_count);
1761 (void)set_blind(p_ptr->blind - dec_count);
1764 /* Times see-invisible */
1765 if (p_ptr->tim_invis)
1767 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1778 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1781 /* Timed temporary elemental brands. -LM- */
1782 if (p_ptr->ele_attack)
1784 p_ptr->ele_attack--;
1786 /* Clear all temporary elemental brands. */
1787 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1790 /* Timed temporary elemental immune. -LM- */
1791 if (p_ptr->ele_immune)
1793 p_ptr->ele_immune--;
1795 /* Clear all temporary elemental brands. */
1796 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1799 /* Timed infra-vision */
1800 if (p_ptr->tim_infra)
1802 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1806 if (p_ptr->tim_stealth)
1808 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1811 /* Timed levitation */
1812 if (p_ptr->tim_levitation)
1814 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1817 /* Timed sh_touki */
1818 if (p_ptr->tim_sh_touki)
1820 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1824 if (p_ptr->tim_sh_fire)
1826 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1830 if (p_ptr->tim_sh_holy)
1832 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1836 if (p_ptr->tim_eyeeye)
1838 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1841 /* Timed resist-magic */
1842 if (p_ptr->resist_magic)
1844 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1847 /* Timed regeneration */
1848 if (p_ptr->tim_regen)
1850 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1853 /* Timed resist nether */
1854 if (p_ptr->tim_res_nether)
1856 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1859 /* Timed resist time */
1860 if (p_ptr->tim_res_time)
1862 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1866 if (p_ptr->tim_reflect)
1868 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1872 if (p_ptr->multishadow)
1874 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1877 /* Timed Robe of dust */
1878 if (p_ptr->dustrobe)
1880 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1883 /* Timed infra-vision */
1884 if (p_ptr->kabenuke)
1886 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1890 if (p_ptr->paralyzed)
1892 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1896 if (p_ptr->confused)
1898 (void)set_confused(p_ptr->confused - dec_count);
1904 (void)set_afraid(p_ptr->afraid - dec_count);
1910 (void)set_fast(p_ptr->fast - 1, TRUE);
1916 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1919 /* Protection from evil */
1920 if (p_ptr->protevil)
1922 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1925 /* Invulnerability */
1928 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1932 if (p_ptr->wraith_form)
1934 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1940 (void)set_hero(p_ptr->hero - 1, TRUE);
1946 (void)set_shero(p_ptr->shero - 1, TRUE);
1952 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1958 (void)set_shield(p_ptr->shield - 1, TRUE);
1962 if (p_ptr->tsubureru)
1964 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1968 if (p_ptr->magicdef)
1970 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1974 if (p_ptr->tsuyoshi)
1976 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1980 if (p_ptr->oppose_acid)
1982 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1985 /* Oppose Lightning */
1986 if (p_ptr->oppose_elec)
1988 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
1992 if (p_ptr->oppose_fire)
1994 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
1998 if (p_ptr->oppose_cold)
2000 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2004 if (p_ptr->oppose_pois)
2006 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2011 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2014 /*** Poison and Stun and Cut ***/
2017 if (p_ptr->poisoned)
2019 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2021 /* Apply some healing */
2022 (void)set_poisoned(p_ptr->poisoned - adjust);
2028 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2030 /* Apply some healing */
2031 (void)set_stun(p_ptr->stun - adjust);
2037 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2039 /* Hack -- Truly "mortal" wound */
2040 if (p_ptr->cut > 1000) adjust = 0;
2042 /* Apply some healing */
2043 (void)set_cut(p_ptr->cut - adjust);
2049 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2050 * / Handle burning fuel every 10 game turns
2053 static void process_world_aux_light(void)
2055 /* Check for light being wielded */
2056 object_type *o_ptr = &inventory[INVEN_LITE];
2058 /* Burn some fuel in the current lite */
2059 if (o_ptr->tval == TV_LITE)
2061 /* Hack -- Use some fuel (except on artifacts) */
2062 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2064 /* Decrease life-span */
2065 if (o_ptr->name2 == EGO_LITE_LONG)
2067 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2069 else o_ptr->xtra4--;
2071 /* Notice interesting fuel steps */
2072 notice_lite_change(o_ptr);
2079 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2080 * / Handle mutation effects once every 10 game turns
2083 static void process_world_aux_mutation(void)
2085 /* No mutation with effects */
2086 if (!p_ptr->muta2) return;
2088 /* No effect on monster arena */
2089 if (p_ptr->inside_battle) return;
2091 /* No effect on the global map */
2092 if (p_ptr->wild_mode) return;
2094 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2096 disturb(FALSE, TRUE);
2097 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2098 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2099 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2100 (void)set_afraid(0);
2103 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2105 if (!p_ptr->resist_fear)
2107 disturb(FALSE, TRUE);
2108 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2109 set_afraid(p_ptr->afraid + 13 + randint1(26));
2113 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2115 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2117 disturb(FALSE, TRUE);
2118 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2120 teleport_player(40, TELEPORT_PASSIVE);
2124 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2126 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2128 disturb(FALSE, TRUE);
2129 p_ptr->redraw |= PR_EXTRA;
2130 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2133 if (!p_ptr->resist_conf)
2135 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2138 if (!p_ptr->resist_chaos)
2143 if (one_in_(3)) lose_all_info();
2145 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2147 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2148 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2154 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2155 (void)set_image(p_ptr->image + randint0(150) + 150);
2161 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2163 if (!p_ptr->resist_chaos)
2165 disturb(FALSE, TRUE);
2166 p_ptr->redraw |= PR_EXTRA;
2167 (void)set_image(p_ptr->image + randint0(50) + 20);
2171 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2173 disturb(FALSE, TRUE);
2174 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2176 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2179 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2180 !p_ptr->anti_magic && one_in_(9000))
2183 disturb(FALSE, TRUE);
2184 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2185 "Magical energy flows through you! You must release it!"));
2189 (void)get_hack_dir(&dire);
2190 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2193 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2195 bool pet = one_in_(6);
2196 BIT_FLAGS mode = PM_ALLOW_GROUP;
2198 if (pet) mode |= PM_FORCE_PET;
2199 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2201 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2203 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2204 disturb(FALSE, TRUE);
2208 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2210 disturb(FALSE, TRUE);
2213 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2215 if (p_ptr->fast > 0)
2221 set_slow(randint1(30) + 10, FALSE);
2226 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2228 if (p_ptr->slow > 0)
2234 set_fast(randint1(30) + 10, FALSE);
2239 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2241 disturb(FALSE, TRUE);
2242 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2244 banish_monsters(100);
2245 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2249 /* Pick a random shop (except home) */
2252 n = randint0(MAX_STORES);
2254 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2256 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2262 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2266 msg_print(_("影につつまれた。", "A shadow passes over you."));
2269 /* Absorb light from the current possition */
2270 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2275 o_ptr = &inventory[INVEN_LITE];
2277 /* Absorb some fuel in the current lite */
2278 if (o_ptr->tval == TV_LITE)
2280 /* Use some fuel (except on artifacts) */
2281 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2283 /* Heal the player a bit */
2284 hp_player(o_ptr->xtra4 / 20);
2286 /* Decrease life-span of lite */
2288 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2290 /* Notice interesting fuel steps */
2291 notice_lite_change(o_ptr);
2296 * Unlite the area (radius 10) around player and
2297 * do 50 points damage to every affected monster
2299 unlite_area(50, 10);
2302 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2304 bool pet = one_in_(3);
2305 BIT_FLAGS mode = PM_ALLOW_GROUP;
2307 if (pet) mode |= PM_FORCE_PET;
2308 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2310 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2312 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2313 disturb(FALSE, TRUE);
2317 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2319 disturb(FALSE, TRUE);
2320 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2323 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2325 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2327 if (!lose_mutation(0))
2328 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2330 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2332 disturb(FALSE, TRUE);
2333 msg_print(_("非物質化した!", "You feel insubstantial!"));
2336 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2338 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2342 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2344 int which_stat = randint0(A_MAX);
2345 int sustained = FALSE;
2350 if (p_ptr->sustain_str) sustained = TRUE;
2353 if (p_ptr->sustain_int) sustained = TRUE;
2356 if (p_ptr->sustain_wis) sustained = TRUE;
2359 if (p_ptr->sustain_dex) sustained = TRUE;
2362 if (p_ptr->sustain_con) sustained = TRUE;
2365 if (p_ptr->sustain_chr) sustained = TRUE;
2368 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2374 disturb(FALSE, TRUE);
2375 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2377 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2380 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2382 bool pet = one_in_(5);
2383 BIT_FLAGS mode = PM_ALLOW_GROUP;
2385 if (pet) mode |= PM_FORCE_PET;
2386 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2388 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2390 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2391 disturb(FALSE, TRUE);
2394 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2396 if (p_ptr->tim_esp > 0)
2398 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2399 set_tim_esp(0, TRUE);
2403 msg_print(_("精神が広がった!", "Your mind expands!"));
2404 set_tim_esp(p_ptr->lev, FALSE);
2407 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2409 disturb(FALSE, TRUE);
2410 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2412 set_food(PY_FOOD_WEAK);
2413 if (music_singing_any()) stop_singing(p_ptr);
2414 if (hex_spelling_any()) stop_hex_spell_all();
2417 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2422 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2424 int danger_amount = 0;
2425 MONSTER_IDX monster;
2427 for (monster = 0; monster < m_max; monster++)
2429 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2430 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2431 if (!monster_is_valid(m_ptr)) continue;
2433 if (r_ptr->level >= p_ptr->lev)
2435 danger_amount += r_ptr->level - p_ptr->lev + 1;
2439 if (danger_amount > 100)
2440 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2441 else if (danger_amount > 50)
2442 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2443 else if (danger_amount > 20)
2444 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2445 else if (danger_amount > 10)
2446 msg_print(_("心配な気がする!", "You feel paranoid!"));
2447 else if (danger_amount > 5)
2448 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2450 msg_print(_("寂しい気がする。", "You feel lonely."));
2453 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2455 disturb(FALSE, TRUE);
2456 msg_print(_("無敵な気がする!", "You feel invincible!"));
2458 (void)set_invuln(randint1(8) + 8, FALSE);
2461 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2463 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2467 HIT_POINT healing = p_ptr->csp;
2468 if (healing > wounds) healing = wounds;
2471 p_ptr->csp -= healing;
2472 p_ptr->redraw |= (PR_HP | PR_MANA);
2476 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2478 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2482 HIT_POINT healing = p_ptr->chp;
2483 if (healing > wounds) healing = wounds;
2485 p_ptr->csp += healing;
2486 p_ptr->redraw |= (PR_HP | PR_MANA);
2487 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2491 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2493 INVENTORY_IDX slot = 0;
2494 object_type *o_ptr = NULL;
2496 disturb(FALSE, TRUE);
2497 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2498 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2501 if (has_melee_weapon(INVEN_RARM))
2504 o_ptr = &inventory[INVEN_RARM];
2506 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2508 o_ptr = &inventory[INVEN_LARM];
2512 else if (has_melee_weapon(INVEN_LARM))
2514 o_ptr = &inventory[INVEN_LARM];
2517 if (slot && !object_is_cursed(o_ptr))
2519 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2520 inven_drop(slot, 1);
2527 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2528 * / Handle curse effects once every 10 game turns
2531 static void process_world_aux_curse(void)
2533 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2536 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2537 * can actually be useful!
2539 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2541 GAME_TEXT o_name[MAX_NLEN];
2543 int i, i_keep = 0, count = 0;
2545 /* Scan the equipment with random teleport ability */
2546 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2548 BIT_FLAGS flgs[TR_FLAG_SIZE];
2549 o_ptr = &inventory[i];
2551 /* Skip non-objects */
2552 if (!o_ptr->k_idx) continue;
2554 /* Extract the item flags */
2555 object_flags(o_ptr, flgs);
2557 if (have_flag(flgs, TR_TELEPORT))
2559 /* {.} will stop random teleportation. */
2560 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2563 if (one_in_(count)) i_keep = i;
2568 o_ptr = &inventory[i_keep];
2569 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2570 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2571 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2573 disturb(FALSE, TRUE);
2574 teleport_player(50, 0L);
2578 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2579 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2580 disturb(TRUE, TRUE);
2583 /* Make a chainsword noise */
2584 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2587 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2589 disturb(FALSE, FALSE);
2592 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2595 (void)activate_ty_curse(FALSE, &count);
2597 /* Handle experience draining */
2598 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2600 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2601 if (p_ptr->exp < 0) p_ptr->exp = 0;
2602 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2603 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2606 /* Add light curse (Later) */
2607 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2609 BIT_FLAGS new_curse;
2612 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2614 new_curse = get_curse(0, o_ptr);
2615 if (!(o_ptr->curse_flags & new_curse))
2617 GAME_TEXT o_name[MAX_NLEN];
2619 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2621 o_ptr->curse_flags |= new_curse;
2622 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2624 o_ptr->feeling = FEEL_NONE;
2626 p_ptr->update |= (PU_BONUS);
2629 /* Add heavy curse (Later) */
2630 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2632 BIT_FLAGS new_curse;
2635 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2637 new_curse = get_curse(1, o_ptr);
2638 if (!(o_ptr->curse_flags & new_curse))
2640 GAME_TEXT o_name[MAX_NLEN];
2642 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2644 o_ptr->curse_flags |= new_curse;
2645 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2646 o_ptr->feeling = FEEL_NONE;
2648 p_ptr->update |= (PU_BONUS);
2652 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2654 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'))
2656 GAME_TEXT o_name[MAX_NLEN];
2658 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2659 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2660 disturb(FALSE, TRUE);
2664 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2666 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'))
2668 GAME_TEXT o_name[MAX_NLEN];
2670 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2671 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2672 disturb(FALSE, TRUE);
2676 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2678 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2679 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2681 GAME_TEXT o_name[MAX_NLEN];
2683 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2684 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2685 disturb(FALSE, TRUE);
2689 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2691 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2692 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2694 GAME_TEXT o_name[MAX_NLEN];
2696 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2697 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2698 disturb(FALSE, TRUE);
2701 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2703 if (!p_ptr->resist_fear)
2705 disturb(FALSE, TRUE);
2706 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2707 set_afraid(p_ptr->afraid + 13 + randint1(26));
2710 /* Teleport player */
2711 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2713 disturb(FALSE, TRUE);
2715 /* Teleport player */
2716 teleport_player(40, TELEPORT_PASSIVE);
2718 /* Handle HP draining */
2719 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2721 GAME_TEXT o_name[MAX_NLEN];
2723 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2724 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2725 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2727 /* Handle mana draining */
2728 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2730 GAME_TEXT o_name[MAX_NLEN];
2732 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2733 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2734 p_ptr->csp -= MIN(p_ptr->lev, 50);
2738 p_ptr->csp_frac = 0;
2740 p_ptr->redraw |= PR_MANA;
2744 /* Rarely, take damage from the Jewel of Judgement */
2745 if (one_in_(999) && !p_ptr->anti_magic)
2747 object_type *o_ptr = &inventory[INVEN_LITE];
2749 if (o_ptr->name1 == ART_JUDGE)
2751 if (object_is_known(o_ptr))
2752 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2754 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2755 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2762 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2763 * / Handle recharging objects once every 10 game turns
2766 static void process_world_aux_recharge(void)
2771 /* Process equipment */
2772 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2774 /* Get the object */
2775 object_type *o_ptr = &inventory[i];
2777 /* Skip non-objects */
2778 if (!o_ptr->k_idx) continue;
2780 /* Recharge activatable objects */
2781 if (o_ptr->timeout > 0)
2786 /* Notice changes */
2787 if (!o_ptr->timeout)
2789 recharged_notice(o_ptr);
2795 /* Notice changes */
2798 p_ptr->window |= (PW_EQUIP);
2803 * Recharge rods. Rods now use timeout to control charging status,
2804 * and each charging rod in a stack decreases the stack's timeout by
2805 * one per current_world_ptr->game_turn. -LM-
2807 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2809 object_type *o_ptr = &inventory[i];
2810 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2812 /* Skip non-objects */
2813 if (!o_ptr->k_idx) continue;
2815 /* Examine all charging rods or stacks of charging rods. */
2816 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2818 /* Determine how many rods are charging. */
2819 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2820 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2822 /* Decrease timeout by that number. */
2823 o_ptr->timeout -= temp;
2825 /* Boundary control. */
2826 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2828 /* Notice changes, provide message if object is inscribed. */
2829 if (!(o_ptr->timeout))
2831 recharged_notice(o_ptr);
2835 /* One of the stack of rod is charged */
2836 else if (o_ptr->timeout % k_ptr->pval)
2843 /* Notice changes */
2846 p_ptr->window |= (PW_INVEN);
2850 /* Process objects on floor */
2851 for (i = 1; i < o_max; i++)
2853 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2855 /* Skip dead objects */
2856 if (!o_ptr->k_idx) continue;
2858 /* Recharge rods on the ground. No messages. */
2859 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2862 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2864 /* Boundary control. */
2865 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2872 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2873 * / Handle involuntary movement once every 10 game turns
2876 static void process_world_aux_movement(void)
2878 /* Delayed Word-of-Recall */
2879 if (p_ptr->word_recall)
2882 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2883 * The player is yanked up/down as soon as
2884 * he loads the autosaved game.
2886 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2887 do_cmd_save_game(TRUE);
2889 /* Count down towards recall */
2890 p_ptr->word_recall--;
2892 p_ptr->redraw |= (PR_STATUS);
2894 /* Activate the recall */
2895 if (!p_ptr->word_recall)
2898 disturb(FALSE, TRUE);
2900 /* Determine the level */
2901 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2903 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2905 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2907 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2909 current_floor_ptr->dun_level = 0;
2910 p_ptr->dungeon_idx = 0;
2912 leave_quest_check();
2913 leave_tower_check();
2915 p_ptr->inside_quest = 0;
2917 p_ptr->leaving = TRUE;
2921 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2923 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2926 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2929 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2930 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2932 /* Nightmare mode makes recall more dangerous */
2933 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2935 if (current_floor_ptr->dun_level < 50)
2937 current_floor_ptr->dun_level *= 2;
2939 else if (current_floor_ptr->dun_level < 99)
2941 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2943 else if (current_floor_ptr->dun_level > 100)
2945 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2949 if (p_ptr->wild_mode)
2951 p_ptr->wilderness_y = p_ptr->y;
2952 p_ptr->wilderness_x = p_ptr->x;
2956 /* Save player position */
2957 p_ptr->oldpx = p_ptr->x;
2958 p_ptr->oldpy = p_ptr->y;
2960 p_ptr->wild_mode = FALSE;
2963 * Clear all saved floors
2964 * and create a first saved floor
2966 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2967 p_ptr->leaving = TRUE;
2969 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2973 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2975 quest_type* const q_ptr = &quest[i];
2978 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2979 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2980 (q_ptr->level < current_floor_ptr->dun_level))
2982 q_ptr->status = QUEST_STATUS_FAILED;
2983 q_ptr->complev = (byte)p_ptr->lev;
2985 q_ptr->comptime = current_world_ptr->play_time;
2986 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2992 sound(SOUND_TPLEVEL);
2997 /* Delayed Alter reality */
2998 if (p_ptr->alter_reality)
3000 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3001 do_cmd_save_game(TRUE);
3003 /* Count down towards alter */
3004 p_ptr->alter_reality--;
3006 p_ptr->redraw |= (PR_STATUS);
3008 /* Activate the alter reality */
3009 if (!p_ptr->alter_reality)
3012 disturb(FALSE, TRUE);
3014 /* Determine the level */
3015 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3017 msg_print(_("世界が変わった!", "The world changes!"));
3020 * Clear all saved floors
3021 * and create a first saved floor
3023 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3024 p_ptr->leaving = TRUE;
3028 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3031 sound(SOUND_TPLEVEL);
3037 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3038 * / Handle certain things once every 10 game turns
3041 static void process_world(void)
3045 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3046 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3047 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3049 extract_day_hour_min(&day, &hour, &min);
3051 /* Update dungeon feeling, and announce it if changed */
3052 update_dungeon_feeling();
3054 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3055 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3057 current_floor_ptr->dun_level = 0;
3058 p_ptr->dungeon_idx = 0;
3059 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3060 p_ptr->inside_arena = FALSE;
3061 p_ptr->wild_mode = FALSE;
3062 p_ptr->leaving = TRUE;
3065 /*** Check monster arena ***/
3066 if (p_ptr->inside_battle && !p_ptr->leaving)
3072 /* Count all hostile monsters */
3073 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3074 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3076 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3078 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3081 win_m_idx = g_ptr->m_idx;
3085 if (number_mon == 0)
3087 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3089 p_ptr->energy_need = 0;
3090 update_gambling_monsters();
3092 else if ((number_mon-1) == 0)
3094 GAME_TEXT m_name[MAX_NLEN];
3095 monster_type *wm_ptr;
3097 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3099 monster_desc(m_name, wm_ptr, 0);
3100 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3103 if (win_m_idx == (sel_monster+1))
3105 msg_print(_("おめでとうございます。", "Congratulations."));
3106 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3107 p_ptr->au += battle_odds;
3111 msg_print(_("残念でした。", "You lost gold."));
3114 p_ptr->energy_need = 0;
3115 update_gambling_monsters();
3117 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3119 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3120 p_ptr->au += kakekin;
3122 p_ptr->energy_need = 0;
3123 update_gambling_monsters();
3127 /* Every 10 game turns */
3128 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3130 /*** Check the Time and Load ***/
3132 if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
3134 /* Check time and load */
3135 if ((0 != check_time()) || (0 != check_load()))
3138 if (closing_flag <= 2)
3140 disturb(FALSE, TRUE);
3142 /* Count warnings */
3145 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3146 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3153 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3156 p_ptr->playing = FALSE;
3157 p_ptr->leaving = TRUE;
3162 /*** Attempt timed autosave ***/
3163 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3165 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3166 do_cmd_save_game(TRUE);
3169 if (mon_fight && !ignore_unview)
3171 msg_print(_("何かが聞こえた。", "You hear noise."));
3174 /*** Handle the wilderness/town (sunshine) ***/
3176 /* While in town/wilderness */
3177 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3179 /* Hack -- Daybreak/Nighfall in town */
3180 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3184 /* Check for dawn */
3185 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3187 if (dawn) day_break();
3193 /* While in the dungeon (vanilla_town or lite_town mode only) */
3194 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3196 /*** Shuffle the Storekeepers ***/
3198 /* Chance is only once a day (while in dungeon) */
3199 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3201 /* Sometimes, shuffle the shop-keepers */
3202 if (one_in_(STORE_SHUFFLE))
3207 /* Pick a random shop (except home and museum) */
3210 n = randint0(MAX_STORES);
3212 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3214 /* Check every feature */
3215 for (i = 1; i < max_f_idx; i++)
3217 feature_type *f_ptr = &f_info[i];
3219 /* Skip empty index */
3220 if (!f_ptr->name) continue;
3222 /* Skip non-store features */
3223 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3225 /* Verify store type */
3226 if (f_ptr->subtype == n)
3228 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3241 /*** Process the monsters ***/
3243 /* Check for creature generation. */
3244 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3245 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3247 /* Make a new monster */
3248 (void)alloc_monster(MAX_SIGHT + 5, 0);
3251 /* Hack -- Check for creature regeneration */
3252 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3253 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3255 if (!p_ptr->leaving)
3259 /* Hack -- Process the counters of monsters if needed */
3260 for (i = 0; i < MAX_MTIMED; i++)
3262 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3270 if (min != prev_min)
3272 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3273 determine_today_mon(FALSE);
3278 * Nightmare mode activates the TY_CURSE at midnight
3279 * Require exact minute -- Don't activate multiple times in a minute
3282 if (ironman_nightmare && (min != prev_min))
3285 /* Every 15 minutes after 11:00 pm */
3286 if ((hour == 23) && !(min % 15))
3288 disturb(FALSE, TRUE);
3293 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3297 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3301 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3305 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3310 /* TY_CURSE activates at midnight! */
3314 disturb(TRUE, TRUE);
3315 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3317 if (p_ptr->wild_mode)
3319 /* Go into large wilderness view */
3320 p_ptr->oldpy = randint1(MAX_HGT - 2);
3321 p_ptr->oldpx = randint1(MAX_WID - 2);
3324 /* Give first move to monsters */
3325 take_turn(p_ptr, 100);
3327 /* HACk -- set the encouter flag for the wilderness generation */
3328 generate_encounter = TRUE;
3331 invoking_midnight_curse = TRUE;
3337 /* Check the Food */
3338 process_world_aux_digestion();
3340 /* Process timed damage and regeneration */
3341 process_world_aux_hp_and_sp();
3343 /* Process timeout */
3344 process_world_aux_timeout();
3347 process_world_aux_light();
3349 /* Process mutation effects */
3350 process_world_aux_mutation();
3352 /* Process curse effects */
3353 process_world_aux_curse();
3355 /* Process recharging */
3356 process_world_aux_recharge();
3358 /* Feel the inventory */
3362 /* Involuntary Movement */
3363 process_world_aux_movement();
3367 * @brief ウィザードモードへの導入処理
3368 * / Verify use of "wizard" mode
3369 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3371 static bool enter_wizard_mode(void)
3373 /* Ask first time */
3374 if (!p_ptr->noscore)
3376 /* Wizard mode is not permitted */
3377 if (!allow_debug_opts || arg_wizard)
3379 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3383 /* Mention effects */
3384 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3385 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3388 /* Verify request */
3389 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3394 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3396 p_ptr->noscore |= 0x0002;
3407 * @brief デバッグコマンドへの導入処理
3408 * / Verify use of "debug" commands
3409 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3411 static bool enter_debug_mode(void)
3413 /* Ask first time */
3414 if (!p_ptr->noscore)
3416 /* Debug mode is not permitted */
3417 if (!allow_debug_opts)
3419 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3423 /* Mention effects */
3424 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3425 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3429 /* Verify request */
3430 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3435 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3437 p_ptr->noscore |= 0x0008;
3445 * Hack -- Declare the Debug Routines
3447 extern void do_cmd_debug(void);
3449 #endif /* ALLOW_WIZARD */
3455 * @brief ボーグコマンドへの導入処理
3456 * / Verify use of "borg" commands
3457 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3459 static bool enter_borg_mode(void)
3461 /* Ask first time */
3462 if (!(p_ptr->noscore & 0x0010))
3464 /* Mention effects */
3465 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3466 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3470 /* Verify request */
3471 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3476 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3478 p_ptr->noscore |= 0x0010;
3486 * Hack -- Declare the Ben Borg
3488 extern void do_cmd_borg(void);
3490 #endif /* ALLOW_BORG */
3494 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3495 * / Parse and execute the current command Give "Warning" on illegal commands.
3496 * @todo Make some "blocks"
3499 static void process_command(void)
3501 COMMAND_CODE old_now_message = now_message;
3503 /* Handle repeating the last command */
3509 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3510 reset_concent = TRUE;
3512 /* Parse the command */
3513 switch (command_cmd)
3529 /*** Wizard Commands ***/
3531 /* Toggle Wizard Mode */
3536 p_ptr->wizard = FALSE;
3537 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3539 else if (enter_wizard_mode())
3541 p_ptr->wizard = TRUE;
3542 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3544 p_ptr->update |= (PU_MONSTERS);
3546 /* Redraw "title" */
3547 p_ptr->redraw |= (PR_TITLE);
3555 /* Special "debug" commands */
3558 /* Enter debug mode */
3559 if (enter_debug_mode())
3566 #endif /* ALLOW_WIZARD */
3571 /* Special "borg" commands */
3574 /* Enter borg mode */
3575 if (enter_borg_mode())
3577 if (!p_ptr->wild_mode) do_cmd_borg();
3583 #endif /* ALLOW_BORG */
3587 /*** Inventory Commands ***/
3589 /* Wear/wield equipment */
3592 if (!p_ptr->wild_mode) do_cmd_wield();
3596 /* Take off equipment */
3599 if (!p_ptr->wild_mode) do_cmd_takeoff();
3606 if (!p_ptr->wild_mode) do_cmd_drop();
3610 /* Destroy an item */
3617 /* Equipment list */
3624 /* Inventory list */
3632 /*** Various commands ***/
3634 /* Identify an object */
3641 /* Hack -- toggle windows */
3644 toggle_inven_equip();
3649 /*** Standard "Movement" Commands ***/
3654 if (!p_ptr->wild_mode) do_cmd_alter();
3661 if (!p_ptr->wild_mode) do_cmd_tunnel();
3665 /* Move (usually pick up things) */
3672 /* Move (usually do not pick up) */
3680 /*** Running, Resting, Searching, Staying */
3682 /* Begin Running -- Arg is Max Distance */
3685 if (!p_ptr->wild_mode) do_cmd_run();
3689 /* Stay still (usually pick things up) */
3692 do_cmd_stay(always_pickup);
3696 /* Stay still (usually do not pick up) */
3699 do_cmd_stay(!always_pickup);
3703 /* Rest -- Arg is time */
3710 /* Search for traps/doors */
3717 /* Toggle search mode */
3720 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3721 else set_action(ACTION_SEARCH);
3726 /*** Stairs and Doors and Chests and Traps ***/
3729 case SPECIAL_KEY_STORE:
3735 /* Enter building -KMW- */
3736 case SPECIAL_KEY_BUILDING:
3742 /* Enter quest level -KMW- */
3743 case SPECIAL_KEY_QUEST:
3749 /* Go up staircase */
3752 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3754 if (vanilla_town) break;
3756 if (p_ptr->ambush_flag)
3758 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3762 if (p_ptr->food < PY_FOOD_WEAK)
3764 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3775 /* Go down staircase */
3778 if (p_ptr->wild_mode)
3785 /* Open a door or chest */
3799 /* Jam a door with spikes */
3813 /* Disarm a trap or chest */
3821 /*** Magic and Prayers ***/
3823 /* Gain new spells/prayers */
3826 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
3827 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3828 else if (p_ptr->pclass == CLASS_SAMURAI)
3829 do_cmd_gain_hissatsu();
3830 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3831 import_magic_device();
3840 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
3841 (p_ptr->pclass == CLASS_BERSERKER) ||
3842 (p_ptr->pclass == CLASS_NINJA) ||
3843 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3844 ) do_cmd_mind_browse();
3845 else if (p_ptr->pclass == CLASS_SMITH)
3847 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3848 do_cmd_magic_eater(TRUE, FALSE);
3849 else if (p_ptr->pclass == CLASS_SNIPER)
3850 do_cmd_snipe_browse();
3851 else do_cmd_browse();
3859 if (!p_ptr->wild_mode)
3861 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
3863 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3865 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))
3867 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3870 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
3872 concptr which_power = _("魔法", "magic");
3873 if (p_ptr->pclass == CLASS_MINDCRAFTER)
3874 which_power = _("超能力", "psionic powers");
3875 else if (p_ptr->pclass == CLASS_IMITATOR)
3876 which_power = _("ものまね", "imitation");
3877 else if (p_ptr->pclass == CLASS_SAMURAI)
3878 which_power = _("必殺剣", "hissatsu");
3879 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
3880 which_power = _("鏡魔法", "mirror magic");
3881 else if (p_ptr->pclass == CLASS_NINJA)
3882 which_power = _("忍術", "ninjutsu");
3883 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3884 which_power = _("祈り", "prayer");
3886 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3889 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
3891 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3896 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
3897 (p_ptr->pclass == CLASS_BERSERKER) ||
3898 (p_ptr->pclass == CLASS_NINJA) ||
3899 (p_ptr->pclass == CLASS_MIRROR_MASTER)
3902 else if (p_ptr->pclass == CLASS_IMITATOR)
3904 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
3905 do_cmd_magic_eater(FALSE, FALSE);
3906 else if (p_ptr->pclass == CLASS_SAMURAI)
3908 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
3909 do_cmd_cast_learned();
3910 else if (p_ptr->pclass == CLASS_SMITH)
3912 else if (p_ptr->pclass == CLASS_SNIPER)
3921 /* Issue a pet command */
3928 /*** Use various objects ***/
3930 /* Inscribe an object */
3937 /* Uninscribe an object */
3940 do_cmd_uninscribe();
3944 /* Activate an artifact */
3958 /* Fuel your lantern/torch */
3968 do_cmd_fire(SP_NONE);
3975 do_cmd_throw(1, FALSE, -1);
3989 if (use_command && rogue_like_commands)
4000 /* Quaff a potion */
4003 do_cmd_quaff_potion();
4010 do_cmd_read_scroll();
4017 if (use_command && !rogue_like_commands)
4024 /* Use racial power */
4027 do_cmd_racial_power();
4032 /*** Looking at Things (nearby or on map) ***/
4034 /* Full dungeon map */
4041 /* Locate player on map */
4055 /* Target monster or location */
4064 /*** Help and Such ***/
4073 /* Identify symbol */
4076 do_cmd_query_symbol();
4080 /* Character description */
4083 do_cmd_change_name();
4088 /*** System Commands ***/
4090 /* Hack -- User interface */
4097 /* Single line from a pref file */
4106 do_cmd_reload_autopick();
4112 do_cmd_edit_autopick();
4116 /* Interact with macros */
4123 /* Interact with visuals */
4131 /* Interact with colors */
4139 /* Interact with options */
4143 (void)combine_and_reorder_home(STORE_HOME);
4148 /*** Misc Commands ***/
4164 /* Repeat level feeling */
4171 /* Show previous message */
4174 do_cmd_message_one();
4178 /* Show previous messages */
4181 do_cmd_messages(old_now_message);
4185 /* Show quest status -KMW- */
4188 do_cmd_checkquest();
4192 /* Redraw the screen */
4195 now_message = old_now_message;
4200 #ifndef VERIFY_SAVEFILE
4202 /* Hack -- Save and don't quit */
4205 do_cmd_save_game(FALSE);
4209 #endif /* VERIFY_SAVEFILE */
4219 case SPECIAL_KEY_QUIT:
4221 do_cmd_save_and_exit();
4225 /* Quit (commit suicide) */
4238 /* Check artifacts, uniques, objects */
4245 /* Load "screen dump" */
4248 do_cmd_load_screen();
4252 /* Save "screen dump" */
4255 do_cmd_save_screen();
4259 /* Record/stop "Movie" */
4262 prepare_movie_hooks();
4266 /* Make random artifact list */
4269 spoil_random_artifact("randifact.txt");
4276 if (!p_ptr->wild_mode) do_cmd_travel();
4277 if (p_ptr->special_defense & KATA_MUSOU)
4279 set_action(ACTION_NONE);
4285 /* Hack -- Unknown command */
4288 if (flush_failure) flush();
4292 sound(SOUND_ILLEGAL);
4293 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4298 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4304 if (!p_ptr->energy_use && !now_message)
4305 now_message = old_now_message;
4309 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4312 static void pack_overflow(void)
4314 if (inventory[INVEN_PACK].k_idx)
4316 GAME_TEXT o_name[MAX_NLEN];
4319 /* Is auto-destroy done? */
4320 update_creature(p_ptr);
4321 if (!inventory[INVEN_PACK].k_idx) return;
4323 /* Access the slot to be dropped */
4324 o_ptr = &inventory[INVEN_PACK];
4326 disturb(FALSE, TRUE);
4329 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4330 object_desc(o_name, o_ptr, 0);
4332 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4334 /* Drop it (carefully) near the player */
4335 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4337 /* Modify, Describe, Optimize */
4338 inven_item_increase(INVEN_PACK, -255);
4339 inven_item_describe(INVEN_PACK);
4340 inven_item_optimize(INVEN_PACK);
4347 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4350 static void process_upkeep_with_speed(void)
4352 /* Give the player some energy */
4353 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4355 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4358 /* No current_world_ptr->game_turn yet */
4359 if (p_ptr->enchant_energy_need > 0) return;
4361 while (p_ptr->enchant_energy_need <= 0)
4363 /* Handle the player song */
4364 if (!load) check_music();
4366 /* Hex - Handle the hex spells */
4367 if (!load) check_hex();
4368 if (!load) revenge_spell();
4370 /* There is some randomness of needed energy */
4371 p_ptr->enchant_energy_need += ENERGY_NEED();
4376 * @brief プレイヤーの行動処理 / Process the player
4379 * Notice the annoying code to handle "pack overflow", which\n
4380 * must come first just in case somebody manages to corrupt\n
4381 * the savefiles by clever use of menu commands or something.\n
4383 static void process_player(void)
4387 /*** Apply energy ***/
4391 msg_print(_("何か変わった気がする!", "You feel different!"));
4393 (void)gain_mutation(p_ptr, 0);
4394 hack_mutation = FALSE;
4397 if (invoking_midnight_curse)
4400 activate_ty_curse(FALSE, &count);
4401 invoking_midnight_curse = FALSE;
4404 if (p_ptr->inside_battle)
4406 for(m_idx = 1; m_idx < m_max; m_idx++)
4408 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4410 if (!monster_is_valid(m_ptr)) continue;
4412 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4413 update_monster(m_idx, FALSE);
4418 /* Give the player some energy */
4419 else if (!(load && p_ptr->energy_need <= 0))
4421 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4424 /* No current_world_ptr->game_turn yet */
4425 if (p_ptr->energy_need > 0) return;
4426 if (!command_rep) prt_time();
4428 /*** Check for interupts ***/
4430 /* Complete resting */
4431 if (p_ptr->resting < 0)
4434 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4437 if ((p_ptr->chp == p_ptr->mhp) &&
4438 (p_ptr->csp >= p_ptr->msp))
4440 set_action(ACTION_NONE);
4444 /* Complete resting */
4445 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4448 if ((p_ptr->chp == p_ptr->mhp) &&
4449 (p_ptr->csp >= p_ptr->msp) &&
4450 !p_ptr->blind && !p_ptr->confused &&
4451 !p_ptr->poisoned && !p_ptr->afraid &&
4452 !p_ptr->stun && !p_ptr->cut &&
4453 !p_ptr->slow && !p_ptr->paralyzed &&
4454 !p_ptr->image && !p_ptr->word_recall &&
4455 !p_ptr->alter_reality)
4457 set_action(ACTION_NONE);
4462 if (p_ptr->action == ACTION_FISH)
4464 Term_xtra(TERM_XTRA_DELAY, 10);
4468 bool success = FALSE;
4469 get_mon_num_prep(monster_is_fishing_target,NULL);
4470 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);
4472 if (r_idx && one_in_(2))
4475 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4476 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4477 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4479 GAME_TEXT m_name[MAX_NLEN];
4480 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4481 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4487 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4489 disturb(FALSE, TRUE);
4493 /* Handle "abort" */
4496 /* Check for "player abort" (semi-efficiently for resting) */
4497 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4502 /* Check for a key */
4505 flush(); /* Flush input */
4507 disturb(FALSE, TRUE);
4509 /* Hack -- Show a Message */
4510 msg_print(_("中断しました。", "Canceled."));
4515 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4517 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4518 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4520 if (MON_CSLEEP(m_ptr))
4522 GAME_TEXT m_name[MAX_NLEN];
4525 (void)set_monster_csleep(p_ptr->riding, 0);
4526 monster_desc(m_name, m_ptr, 0);
4527 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4530 if (MON_STUNNED(m_ptr))
4532 /* Hack -- Recover from stun */
4533 if (set_monster_stunned(p_ptr->riding,
4534 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4536 GAME_TEXT m_name[MAX_NLEN];
4537 monster_desc(m_name, m_ptr, 0);
4538 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4542 if (MON_CONFUSED(m_ptr))
4544 /* Hack -- Recover from confusion */
4545 if (set_monster_confused(p_ptr->riding,
4546 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4548 GAME_TEXT m_name[MAX_NLEN];
4549 monster_desc(m_name, m_ptr, 0);
4550 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4554 if (MON_MONFEAR(m_ptr))
4556 /* Hack -- Recover from fear */
4557 if(set_monster_monfear(p_ptr->riding,
4558 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4560 GAME_TEXT m_name[MAX_NLEN];
4561 monster_desc(m_name, m_ptr, 0);
4562 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4572 if (p_ptr->lightspeed)
4574 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4576 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4578 if(P_PTR_KI < 40) P_PTR_KI = 0;
4579 else P_PTR_KI -= 40;
4580 p_ptr->update |= (PU_BONUS);
4582 if (p_ptr->action == ACTION_LEARN)
4585 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4587 /* Convert the unit (1/2^16) to (1/2^32) */
4588 s64b_LSHIFT(cost, cost_frac, 16);
4590 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4594 p_ptr->csp_frac = 0;
4595 set_action(ACTION_NONE);
4600 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4602 p_ptr->redraw |= PR_MANA;
4605 if (p_ptr->special_defense & KATA_MASK)
4607 if (p_ptr->special_defense & KATA_MUSOU)
4611 set_action(ACTION_NONE);
4616 p_ptr->redraw |= (PR_MANA);
4621 /*** Handle actual user input ***/
4623 /* Repeat until out of energy */
4624 while (p_ptr->energy_need <= 0)
4626 p_ptr->window |= PW_PLAYER;
4627 p_ptr->sutemi = FALSE;
4628 p_ptr->counter = FALSE;
4629 p_ptr->now_damaged = FALSE;
4633 /* Place the cursor on the player */
4634 move_cursor_relative(p_ptr->y, p_ptr->x);
4636 /* Refresh (optional) */
4637 if (fresh_before) Term_fresh();
4639 /* Hack -- Pack Overflow */
4642 /* Hack -- cancel "lurking browse mode" */
4643 if (!command_new) command_see = FALSE;
4645 /* Assume free current_world_ptr->game_turn */
4648 if (p_ptr->inside_battle)
4650 /* Place the cursor on the player */
4651 move_cursor_relative(p_ptr->y, p_ptr->x);
4653 command_cmd = SPECIAL_KEY_BUILDING;
4655 /* Process the command */
4659 /* Paralyzed or Knocked Out */
4660 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4662 take_turn(p_ptr, 100);
4666 else if (p_ptr->action == ACTION_REST)
4669 if (p_ptr->resting > 0)
4671 /* Reduce rest count */
4674 if (!p_ptr->resting) set_action(ACTION_NONE);
4675 p_ptr->redraw |= (PR_STATE);
4678 take_turn(p_ptr, 100);
4682 else if (p_ptr->action == ACTION_FISH)
4684 take_turn(p_ptr, 100);
4696 else if (travel.run)
4703 /* Repeated command */
4704 else if (command_rep)
4706 /* Count this execution */
4709 p_ptr->redraw |= (PR_STATE);
4712 /* Hack -- Assume messages were seen */
4715 /* Clear the top line */
4718 /* Process the command */
4722 /* Normal command */
4725 /* Place the cursor on the player */
4726 move_cursor_relative(p_ptr->y, p_ptr->x);
4729 /* Get a command (normal) */
4730 request_command(FALSE);
4733 /* Process the command */
4737 /* Hack -- Pack Overflow */
4743 if (p_ptr->energy_use)
4745 /* Use some energy */
4746 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4748 /* The Randomness is irrelevant */
4749 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4753 /* There is some randomness of needed energy */
4754 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4757 /* Hack -- constant hallucination */
4758 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4761 /* Shimmer monsters if needed */
4762 if (shimmer_monsters)
4764 /* Clear the flag */
4765 shimmer_monsters = FALSE;
4767 /* Shimmer multi-hued monsters */
4768 for (m_idx = 1; m_idx < m_max; m_idx++)
4770 monster_type *m_ptr;
4771 monster_race *r_ptr;
4773 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4774 if (!monster_is_valid(m_ptr)) continue;
4776 /* Skip unseen monsters */
4777 if (!m_ptr->ml) continue;
4779 /* Access the monster race */
4780 r_ptr = &r_info[m_ptr->ap_r_idx];
4782 /* Skip non-multi-hued monsters */
4783 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4786 /* Reset the flag */
4787 shimmer_monsters = TRUE;
4789 /* Redraw regardless */
4790 lite_spot(m_ptr->fy, m_ptr->fx);
4795 /* Handle monster detection */
4796 if (repair_monsters)
4798 /* Reset the flag */
4799 repair_monsters = FALSE;
4801 /* Rotate detection flags */
4802 for (m_idx = 1; m_idx < m_max; m_idx++)
4804 monster_type *m_ptr;
4805 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4806 if (!monster_is_valid(m_ptr)) continue;
4808 /* Nice monsters get mean */
4809 if (m_ptr->mflag & MFLAG_NICE)
4811 /* Nice monsters get mean */
4812 m_ptr->mflag &= ~(MFLAG_NICE);
4815 /* Handle memorized monsters */
4816 if (m_ptr->mflag2 & MFLAG2_MARK)
4818 /* Maintain detection */
4819 if (m_ptr->mflag2 & MFLAG2_SHOW)
4822 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4824 /* Still need repairs */
4825 repair_monsters = TRUE;
4828 /* Remove detection */
4832 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4834 /* Assume invisible */
4836 update_monster(m_idx, FALSE);
4838 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
4839 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
4841 /* Redraw regardless */
4842 lite_spot(m_ptr->fy, m_ptr->fx);
4847 if (p_ptr->pclass == CLASS_IMITATOR)
4850 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
4853 for (j = 0; j < p_ptr->mane_num; j++)
4855 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
4856 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
4860 p_ptr->redraw |= (PR_IMITATION);
4862 if (p_ptr->action == ACTION_LEARN)
4865 p_ptr->redraw |= (PR_STATE);
4868 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
4871 p_ptr->redraw |= (PR_MAP);
4872 p_ptr->update |= (PU_MONSTERS);
4873 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4875 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4877 p_ptr->timewalk = FALSE;
4878 p_ptr->energy_need = ENERGY_NEED();
4884 /* Hack -- notice death */
4885 if (!p_ptr->playing || p_ptr->is_dead)
4887 p_ptr->timewalk = FALSE;
4892 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
4894 /* Handle "leaving" */
4895 if (p_ptr->leaving) break;
4898 /* Update scent trail */
4903 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4907 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4908 * ゲームを終了するかのいずれかまでループする。
4911 * This function will not exit until the level is completed,\n
4912 * the user dies, or the game is terminated.\n
4915 static void dungeon(bool load_game)
4919 /* Set the base level */
4920 current_floor_ptr->base_level = current_floor_ptr->dun_level;
4922 /* Reset various flags */
4923 is_loading_now = FALSE;
4926 p_ptr->leaving = FALSE;
4928 /* Reset the "command" vars */
4931 #if 0 /* Don't reset here --- It's used for Arena */
4940 /* Cancel the target */
4944 p_ptr->ambush_flag = FALSE;
4946 /* Cancel the health bar */
4949 /* Check visual effects */
4950 shimmer_monsters = TRUE;
4951 shimmer_objects = TRUE;
4952 repair_monsters = TRUE;
4953 repair_objects = TRUE;
4956 disturb(TRUE, TRUE);
4958 /* Get index of current quest (if any) */
4959 quest_num = quest_number(current_floor_ptr->dun_level);
4961 /* Inside a quest? */
4964 /* Mark the quest monster */
4965 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4968 /* Track maximum player level */
4969 if (p_ptr->max_plv < p_ptr->lev)
4971 p_ptr->max_plv = p_ptr->lev;
4975 /* Track maximum dungeon level (if not in quest -KMW-) */
4976 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
4978 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
4979 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
4982 (void)calculate_upkeep();
4984 /* Validate the panel */
4985 panel_bounds_center();
4987 /* Verify the panel */
4993 /* Enter "xtra" mode */
4994 character_xtra = TRUE;
4996 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4997 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4998 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);
5002 /* Leave "xtra" mode */
5003 character_xtra = FALSE;
5005 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5006 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5010 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5011 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5012 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5014 if (p_ptr->inside_battle)
5018 p_ptr->energy_need = 0;
5019 update_gambling_monsters();
5023 msg_print(_("試合開始!", "Ready..Fight!"));
5028 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5029 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5031 /* Hack -- notice death or departure */
5032 if (!p_ptr->playing || p_ptr->is_dead) return;
5034 /* Print quest message if appropriate */
5035 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5037 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5038 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5040 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5042 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5044 msg_format("この階には%sの主である%sが棲んでいる。",
5045 d_name+d_info[p_ptr->dungeon_idx].name,
5046 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5048 msg_format("%^s lives in this level as the keeper of %s.",
5049 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5050 d_name+d_info[p_ptr->dungeon_idx].name);
5054 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5056 /*** Process this dungeon level ***/
5058 /* Reset the monster generation level */
5059 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5061 /* Reset the object generation level */
5062 current_floor_ptr->object_level = current_floor_ptr->base_level;
5064 is_loading_now = TRUE;
5066 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5067 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5068 p_ptr->energy_need = 0;
5070 /* Not leaving dungeon */
5071 p_ptr->leaving_dungeon = FALSE;
5073 /* Initialize monster process */
5079 /* Hack -- Compact the monster list occasionally */
5080 if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5082 /* Hack -- Compress the monster list occasionally */
5083 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5086 /* Hack -- Compact the object list occasionally */
5087 if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5089 /* Hack -- Compress the object list occasionally */
5090 if (o_cnt + 32 < o_max) compact_objects(0);
5092 /* Process the player */
5094 process_upkeep_with_speed();
5098 /* Hack -- Hilite the player */
5099 move_cursor_relative(p_ptr->y, p_ptr->x);
5101 /* Optional fresh */
5102 if (fresh_after) Term_fresh();
5104 /* Hack -- Notice death or departure */
5105 if (!p_ptr->playing || p_ptr->is_dead) break;
5107 /* Process all of the monsters */
5112 /* Hack -- Hilite the player */
5113 move_cursor_relative(p_ptr->y, p_ptr->x);
5115 /* Optional fresh */
5116 if (fresh_after) Term_fresh();
5118 /* Hack -- Notice death or departure */
5119 if (!p_ptr->playing || p_ptr->is_dead) break;
5121 /* Process the world */
5126 /* Hack -- Hilite the player */
5127 move_cursor_relative(p_ptr->y, p_ptr->x);
5129 /* Optional fresh */
5130 if (fresh_after) Term_fresh();
5132 /* Hack -- Notice death or departure */
5133 if (!p_ptr->playing || p_ptr->is_dead) break;
5135 /* Count game turns */
5136 current_world_ptr->game_turn++;
5138 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5140 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5141 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5144 prevent_turn_overflow();
5146 /* Handle "leaving" */
5147 if (p_ptr->leaving) break;
5149 if (wild_regen) wild_regen--;
5152 /* Inside a quest and non-unique questor? */
5153 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5155 /* Un-mark the quest monster */
5156 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5159 /* Not save-and-quit and not dead? */
5160 if (p_ptr->playing && !p_ptr->is_dead)
5163 * Maintain Unique monsters and artifact, save current
5164 * floor, then prepare next floor
5168 /* Forget the flag */
5169 reinit_wilderness = FALSE;
5172 /* Write about current level on the play record once per level */
5178 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5181 * Modified by Arcum Dagsson to support
5182 * separate macro files for different realms.
5184 static void load_all_pref_files(void)
5188 /* Access the "user" pref file */
5189 sprintf(buf, "user.prf");
5191 /* Process that file */
5192 process_pref_file(buf);
5194 /* Access the "user" system pref file */
5195 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5197 /* Process that file */
5198 process_pref_file(buf);
5200 /* Access the "race" pref file */
5201 sprintf(buf, "%s.prf", rp_ptr->title);
5203 /* Process that file */
5204 process_pref_file(buf);
5206 /* Access the "class" pref file */
5207 sprintf(buf, "%s.prf", cp_ptr->title);
5209 /* Process that file */
5210 process_pref_file(buf);
5212 /* Access the "character" pref file */
5213 sprintf(buf, "%s.prf", player_base);
5215 /* Process that file */
5216 process_pref_file(buf);
5218 /* Access the "realm 1" pref file */
5219 if (p_ptr->realm1 != REALM_NONE)
5221 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5223 /* Process that file */
5224 process_pref_file(buf);
5227 /* Access the "realm 2" pref file */
5228 if (p_ptr->realm2 != REALM_NONE)
5230 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5232 /* Process that file */
5233 process_pref_file(buf);
5237 /* Load an autopick preference file */
5238 autopick_load_pref(FALSE);
5243 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
5246 void extract_option_vars(void)
5250 for (i = 0; option_info[i].o_desc; i++)
5252 int os = option_info[i].o_set;
5253 int ob = option_info[i].o_bit;
5255 /* Set the "default" options */
5256 if (option_info[i].o_var)
5259 if (option_flag[os] & (1L << ob))
5262 (*option_info[i].o_var) = TRUE;
5269 (*option_info[i].o_var) = FALSE;
5277 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
5280 void determine_bounty_uniques(void)
5284 monster_race *r_ptr;
5286 get_mon_num_prep(NULL, NULL);
5287 for (i = 0; i < MAX_KUBI; i++)
5291 current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
5292 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
5294 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5296 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
5298 if (r_ptr->rarity > 100) continue;
5300 if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
5302 for (j = 0; j < i; j++)
5303 if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
5310 for (i = 0; i < MAX_KUBI - 1; i++)
5312 for (j = i; j < MAX_KUBI; j++)
5314 if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
5316 tmp = current_world_ptr->bounty_r_idx[i];
5317 current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
5318 current_world_ptr->bounty_r_idx[j] = tmp;
5326 * @brief 今日の賞金首を確定する / Determine today's bounty monster
5328 * @note conv_old is used if loaded 0.0.3 or older save file
5330 void determine_today_mon(bool conv_old)
5333 bool old_inside_battle = p_ptr->inside_battle;
5334 monster_race *r_ptr;
5338 for (i = 0; i < max_d_idx; i++)
5340 if (max_dlv[i] < d_info[i].mindepth) continue;
5341 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
5344 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
5346 p_ptr->inside_battle = TRUE;
5347 get_mon_num_prep(NULL, NULL);
5351 today_mon = get_mon_num(max_dl);
5352 r_ptr = &r_info[today_mon];
5354 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5355 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
5356 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
5357 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
5358 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
5359 if (r_ptr->rarity > 10) continue;
5363 p_ptr->today_mon = 0;
5364 p_ptr->inside_battle = old_inside_battle;
5368 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5371 * If the "new_game" parameter is true, then, after loading the
5372 * savefile, we will commit suicide, if necessary, to allow the
5373 * player to start a new game.
5375 void play_game(bool new_game)
5378 bool load_game = TRUE;
5379 bool init_random_seed = FALSE;
5389 else if (chuukei_server)
5391 prepare_chuukei_hooks();
5402 hack_mutation = FALSE;
5404 /* Hack -- Character is "icky" */
5405 character_icky = TRUE;
5407 /* Make sure main term is active */
5408 Term_activate(angband_term[0]);
5410 /* Initialise the resize hooks */
5411 angband_term[0]->resize_hook = resize_map;
5413 for (i = 1; i < 8; i++)
5415 /* Does the term exist? */
5416 if (angband_term[i])
5418 /* Add the redraw on resize hook */
5419 angband_term[i]->resize_hook = redraw_window;
5423 /* Hack -- current_world_ptr->game_turn off the cursor */
5424 (void)Term_set_cursor(0);
5427 /* Attempt to load */
5430 quit(_("セーブファイルが壊れています", "broken savefile"));
5433 /* Extract the options */
5434 extract_option_vars();
5436 /* Report waited score */
5437 if (p_ptr->wait_report_score)
5442 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5445 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5446 update_creature(p_ptr);
5448 p_ptr->is_dead = TRUE;
5450 start_time = (u32b)time(NULL);
5452 /* No suspending now */
5453 signals_ignore_tstp();
5455 /* Hack -- Character is now "icky" */
5456 character_icky = TRUE;
5458 /* Build the filename */
5459 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5461 /* Open the high score file, for reading/writing */
5462 highscore_fd = fd_open(buf, O_RDWR);
5464 /* 町名消失バグ対策(#38205) Init the wilderness */
5465 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5467 /* Handle score, show Top scores */
5468 success = send_world_score(TRUE);
5470 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5472 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5477 p_ptr->wait_report_score = FALSE;
5479 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5481 /* Shut the high score file */
5482 (void)fd_close(highscore_fd);
5484 /* Forget the high score fd */
5487 /* Allow suspending now */
5488 signals_handle_tstp();
5493 creating_savefile = new_game;
5495 /* Nothing loaded */
5496 if (!character_loaded)
5498 /* Make new player */
5501 /* The dungeon is not ready */
5502 character_dungeon = FALSE;
5504 /* Prepare to init the RNG */
5505 init_random_seed = TRUE;
5507 /* Initialize the saved floors data */
5508 init_saved_floors(FALSE);
5511 /* Old game is loaded. But new game is requested. */
5514 /* Initialize the saved floors data */
5515 init_saved_floors(TRUE);
5518 /* Process old character */
5521 /* Process the player name */
5522 process_player_name(FALSE);
5526 if (init_random_seed)
5531 /* Roll new character */
5534 /* The dungeon is not ready */
5535 character_dungeon = FALSE;
5538 current_floor_ptr->dun_level = 0;
5539 p_ptr->inside_quest = 0;
5540 p_ptr->inside_arena = FALSE;
5541 p_ptr->inside_battle = FALSE;
5545 /* Hack -- seed for flavors */
5546 seed_flavor = randint0(0x10000000);
5548 /* Hack -- seed for town layout */
5549 seed_town = randint0(0x10000000);
5551 /* Roll up a new character */
5559 determine_bounty_uniques();
5560 determine_today_mon(FALSE);
5562 /* Initialize object array */
5567 write_level = FALSE;
5569 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5571 " ---- Restart Game ----"));
5574 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5575 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5577 if (p_ptr->riding == -1)
5580 for (i = m_max; i > 0; i--)
5582 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5591 creating_savefile = FALSE;
5593 p_ptr->teleport_town = FALSE;
5594 p_ptr->sutemi = FALSE;
5595 current_world_ptr->timewalk_m_idx = 0;
5596 p_ptr->now_damaged = FALSE;
5598 start_time = time(NULL) - 1;
5599 record_o_name[0] = '\0';
5601 /* Reset map panel */
5602 panel_row_min = current_floor_ptr->height;
5603 panel_col_min = current_floor_ptr->width;
5605 /* Sexy gal gets bonus to maximum weapon skill of whip */
5606 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5607 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5609 /* Fill the arrays of floors and walls in the good proportions */
5610 set_floor_and_wall(p_ptr->dungeon_idx);
5612 /* Flavor the objects */
5615 /* Flash a message */
5616 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5618 /* Flush the message */
5622 /* Hack -- Enter wizard mode */
5625 if (enter_wizard_mode())
5627 p_ptr->wizard = TRUE;
5629 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5631 /* Initialize the saved floors data */
5632 init_saved_floors(TRUE);
5635 p_ptr->inside_quest = 0;
5637 /* Avoid crash in update_view() */
5638 p_ptr->y = p_ptr->x = 10;
5641 else if (p_ptr->is_dead)
5643 quit("Already dead.");
5647 /* Initialize the town-buildings if necessary */
5648 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5650 /* Init the wilderness */
5652 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5655 init_flags = INIT_ONLY_BUILDINGS;
5657 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5659 select_floor_music();
5663 /* Generate a dungeon level if needed */
5664 if (!character_dungeon)
5671 /* HACK -- Restore from panic-save */
5672 if (p_ptr->panic_save)
5674 /* No player? -- Try to regenerate floor */
5675 if (!p_ptr->y || !p_ptr->x)
5677 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5681 /* Still no player? -- Try to locate random place */
5682 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5684 /* No longer in panic */
5685 p_ptr->panic_save = 0;
5689 /* Character is now "complete" */
5690 character_generated = TRUE;
5693 /* Hack -- Character is no longer "icky" */
5694 character_icky = FALSE;
5700 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5701 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5706 p_ptr->playing = TRUE;
5708 /* Reset the visual mappings */
5711 /* Load the "pref" files */
5712 load_all_pref_files();
5714 /* Give startup outfit (after loading pref files) */
5720 /* React to changes */
5721 Term_xtra(TERM_XTRA_REACT, 0);
5723 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5724 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5727 /* Set or clear "rogue_like_commands" if requested */
5728 if (arg_force_original) rogue_like_commands = FALSE;
5729 if (arg_force_roguelike) rogue_like_commands = TRUE;
5731 /* Hack -- Enforce "delayed death" */
5732 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5734 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5736 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5738 monster_type *m_ptr;
5739 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5740 monster_race *r_ptr = &r_info[pet_r_idx];
5741 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5742 (PM_FORCE_PET | PM_NO_KAGE));
5743 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5744 m_ptr->mspeed = r_ptr->speed;
5745 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5746 m_ptr->max_maxhp = m_ptr->maxhp;
5747 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5748 m_ptr->dealt_damage = 0;
5749 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5752 (void)combine_and_reorder_home(STORE_HOME);
5753 (void)combine_and_reorder_home(STORE_MUSEUM);
5755 select_floor_music();
5760 /* Process the level */
5763 /* Hack -- prevent "icky" message */
5764 character_xtra = TRUE;
5768 character_xtra = FALSE;
5770 /* Cancel the target */
5773 /* Cancel the health bar */
5780 /* Handle "quit and save" */
5781 if (!p_ptr->playing && !p_ptr->is_dead) break;
5783 /* Erase the old current_floor_ptr->grid_array */
5785 if (!p_ptr->is_dead) wipe_m_list();
5792 /* Accidental Death */
5793 if (p_ptr->playing && p_ptr->is_dead)
5795 if (p_ptr->inside_arena)
5797 p_ptr->inside_arena = FALSE;
5798 if (p_ptr->arena_number > MAX_ARENA_MONS)
5799 p_ptr->arena_number++;
5801 p_ptr->arena_number = -1 - p_ptr->arena_number;
5802 p_ptr->is_dead = FALSE;
5804 p_ptr->chp_frac = 0;
5805 p_ptr->exit_bldg = TRUE;
5808 /* Leave through the exit */
5809 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5811 /* prepare next floor */
5816 /* Mega-Hack -- Allow player to cheat death */
5817 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5824 /* Handle "death" */
5825 if (p_ptr->is_dead) break;
5827 /* Make a new level */
5839 * @brief ゲームターンからの実時間換算を行うための補正をかける
5840 * @param hoge ゲームターン
5841 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5842 * @return 修正をかけた後のゲームターン
5844 s32b turn_real(s32b hoge)
5846 switch (p_ptr->start_race)
5852 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5859 * @brief ターンのオーバーフローに対する対処
5860 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5861 * @return 修正をかけた後のゲームターン
5863 void prevent_turn_overflow(void)
5865 int rollback_days, i, j;
5866 s32b rollback_turns;
5868 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5870 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5871 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5873 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5874 else current_world_ptr->game_turn = 1;
5875 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
5876 else current_floor_ptr->generated_turn = 1;
5877 if (old_battle > rollback_turns) old_battle -= rollback_turns;
5878 else old_battle = 1;
5879 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5880 else p_ptr->feeling_turn = 1;
5882 for (i = 1; i < max_towns; i++)
5884 for (j = 0; j < MAX_STORES; j++)
5886 store_type *st_ptr = &town_info[i].store[j];
5888 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5890 st_ptr->last_visit -= rollback_turns;
5891 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5894 if (st_ptr->store_open)
5896 st_ptr->store_open -= rollback_turns;
5897 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5905 * Close up the current game (player may or may not be dead)
5909 * This function is called only from "main.c" and "signals.c".
5912 void close_game(void)
5915 bool do_send = TRUE;
5917 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5920 /* Flush the messages */
5923 /* Flush the input */
5927 /* No suspending now */
5928 signals_ignore_tstp();
5931 /* Hack -- Character is now "icky" */
5932 character_icky = TRUE;
5935 /* Build the filename */
5936 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5938 /* Grab permissions */
5941 /* Open the high score file, for reading/writing */
5942 highscore_fd = fd_open(buf, O_RDWR);
5944 /* Drop permissions */
5950 /* Handle retirement */
5951 if (p_ptr->total_winner) kingly();
5954 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5956 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5958 else do_send = FALSE;
5965 /* Show more info */
5971 if ((!send_world_score(do_send)))
5973 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5974 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5976 p_ptr->wait_report_score = TRUE;
5977 p_ptr->is_dead = FALSE;
5978 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5981 if (!p_ptr->wait_report_score)
5984 else if (highscore_fd >= 0)
5986 display_scores_aux(0, 10, -1, NULL);
5989 /* Dump bones file */
5998 do_cmd_save_game(FALSE);
6000 /* Prompt for scores */
6001 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
6002 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
6004 /* Predict score (or ESCAPE) */
6005 if (inkey() != ESCAPE) predict_score();
6009 /* Shut the high score file */
6010 (void)fd_close(highscore_fd);
6012 /* Forget the high score fd */
6015 /* Kill all temporal files */
6016 clear_saved_floor_files();
6018 /* Allow suspending now */
6019 signals_handle_tstp();