3 @brief Angbandゲームエンジン / Angband game engine
6 Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 This software may be copied and distributed for educational, research, and\n
8 not for profit purposes provided that this copyright and statement are\n
9 included in all such copies.\n
10 2013 Deskull rearranged comment for Doxygen.
14 #include "cmd-activate.h"
16 #include "cmd-hissatsu.h"
18 #include "cmd-magiceat.h"
19 #include "cmd-quaff.h"
21 #include "cmd-smith.h"
22 #include "cmd-usestaff.h"
23 #include "cmd-zaprod.h"
24 #include "cmd-zapwand.h"
27 #include "floor-events.h"
28 #include "object-curse.h"
30 #include "spells-summon.h"
31 #include "spells-object.h"
32 #include "spells-status.h"
33 #include "spells-floor.h"
34 #include "monsterrace-hook.h"
40 #include "player-move.h"
41 #include "player-status.h"
42 #include "cmd-spell.h"
43 #include "realm-hex.h"
44 #include "object-hook.h"
46 #include "monster-status.h"
47 #include "floor-save.h"
50 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
51 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
54 * @brief 擬似鑑定を実際に行い判定を反映する
55 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
56 * @param heavy 重度の擬似鑑定を行うならばTRUE
59 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
62 object_type *o_ptr = &inventory[slot];
63 GAME_TEXT o_name[MAX_NLEN];
65 /* We know about it already, do not tell us again */
66 if (o_ptr->ident & (IDENT_SENSE))return;
68 /* It is fully known, no information needed */
69 if (object_is_known(o_ptr)) return;
71 /* Check for a feeling */
72 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
74 /* Skip non-feelings */
78 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
89 feel = FEEL_EXCELLENT;
95 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
102 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
108 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
115 feel = FEEL_WORTHLESS;
120 feel = FEEL_TERRIBLE;
126 /* Stop everything */
127 if (disturb_minor) disturb(FALSE, FALSE);
129 /* Get an object description */
130 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
132 /* Message (equipment) */
133 if (slot >= INVEN_RARM)
136 msg_format("%s%s(%c)は%sという感じがする...",
137 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
139 msg_format("You feel the %s (%c) you are %s %s %s...",
140 o_name, index_to_label(slot), describe_use(slot),
141 ((o_ptr->number == 1) ? "is" : "are"),
142 game_inscriptions[feel]);
147 /* Message (inventory) */
151 msg_format("ザックの中の%s(%c)は%sという感じがする...",
152 o_name, index_to_label(slot),game_inscriptions[feel]);
154 msg_format("You feel the %s (%c) in your pack %s %s...",
155 o_name, index_to_label(slot),
156 ((o_ptr->number == 1) ? "is" : "are"),
157 game_inscriptions[feel]);
162 o_ptr->ident |= (IDENT_SENSE);
164 /* Set the "inscription" */
165 o_ptr->feeling = feel;
167 /* Auto-inscription/destroy */
168 autopick_alter_item(slot, destroy_feeling);
169 p_ptr->update |= (PU_COMBINE | PU_REORDER);
171 p_ptr->window |= (PW_INVEN | PW_EQUIP);
177 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
180 * Sense the inventory\n
182 * Class 0 = Warrior --> fast and heavy\n
183 * Class 1 = Mage --> slow and light\n
184 * Class 2 = Priest --> fast but light\n
185 * Class 3 = Rogue --> okay and heavy\n
186 * Class 4 = Ranger --> slow but heavy (changed!)\n
187 * Class 5 = Paladin --> slow but heavy\n
189 static void sense_inventory1(void)
192 PLAYER_LEVEL plev = p_ptr->lev;
197 /*** Check for "sensing" ***/
199 /* No sensing when confused */
200 if (p_ptr->confused) return;
202 /* Analyze the class */
203 switch (p_ptr->pclass)
211 if (0 != randint0(9000L / (plev * plev + 40))) return;
222 if (0 != randint0(6000L / (plev * plev + 50))) return;
231 case CLASS_HIGH_MAGE:
233 case CLASS_MAGIC_EATER:
235 /* Very bad (light) sensing */
236 if (0 != randint0(240000L / (plev + 5))) return;
244 /* Good (light) sensing */
245 if (0 != randint0(10000L / (plev * plev + 40))) return;
254 if (0 != randint0(20000L / (plev * plev + 40))) return;
265 if (0 != randint0(95000L / (plev * plev + 40))) return;
277 if (0 != randint0(77777L / (plev * plev + 40))) return;
285 case CLASS_WARRIOR_MAGE:
289 if (0 != randint0(75000L / (plev * plev + 40))) return;
294 case CLASS_MINDCRAFTER:
296 case CLASS_BLUE_MAGE:
297 case CLASS_MIRROR_MASTER:
300 if (0 != randint0(55000L / (plev * plev + 40))) return;
305 case CLASS_CHAOS_WARRIOR:
308 if (0 != randint0(80000L / (plev * plev + 40))) return;
317 case CLASS_FORCETRAINER:
320 if (0 != randint0(20000L / (plev * plev + 40))) return;
328 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
336 case CLASS_BEASTMASTER:
339 if (0 != randint0(65000L / (plev * plev + 40))) return;
343 case CLASS_BERSERKER:
352 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
354 /*** Sense everything ***/
356 /* Check everything */
357 for (i = 0; i < INVEN_TOTAL; i++)
361 o_ptr = &inventory[i];
363 /* Skip empty slots */
364 if (!o_ptr->k_idx) continue;
366 /* Valid "tval" codes */
393 /* Skip non-sense machines */
396 /* Occasional failure on inventory items */
397 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
400 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
405 sense_inventory_aux(i, heavy);
410 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
413 static void sense_inventory2(void)
416 PLAYER_LEVEL plev = p_ptr->lev;
420 /*** Check for "sensing" ***/
422 /* No sensing when confused */
423 if (p_ptr->confused) return;
425 /* Analyze the class */
426 switch (p_ptr->pclass)
432 case CLASS_BERSERKER:
440 case CLASS_CHAOS_WARRIOR:
442 case CLASS_BEASTMASTER:
445 /* Very bad (light) sensing */
446 if (0 != randint0(240000L / (plev + 5))) return;
452 case CLASS_WARRIOR_MAGE:
457 if (0 != randint0(95000L / (plev * plev + 40))) return;
465 case CLASS_FORCETRAINER:
466 case CLASS_MINDCRAFTER:
469 if (0 != randint0(20000L / (plev * plev + 40))) return;
475 case CLASS_HIGH_MAGE:
477 case CLASS_MAGIC_EATER:
478 case CLASS_MIRROR_MASTER:
479 case CLASS_BLUE_MAGE:
482 if (0 != randint0(9000L / (plev * plev + 40))) return;
490 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
496 /*** Sense everything ***/
498 /* Check everything */
499 for (i = 0; i < INVEN_TOTAL; i++)
503 o_ptr = &inventory[i];
505 /* Skip empty slots */
506 if (!o_ptr->k_idx) continue;
508 /* Valid "tval" codes */
521 /* Skip non-sense machines */
524 /* Occasional failure on inventory items */
525 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
527 sense_inventory_aux(i, TRUE);
532 * @brief パターン終点到達時のテレポート処理を行う
535 static void pattern_teleport(void)
538 DEPTH max_level = 99;
541 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
546 /* Only downward in ironman mode */
547 if (ironman_downward)
548 min_level = current_floor_ptr->dun_level;
551 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
553 if (current_floor_ptr->dun_level > 100)
554 max_level = MAX_DEPTH - 1;
555 else if (current_floor_ptr->dun_level == 100)
560 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
561 min_level = d_info[p_ptr->dungeon_idx].mindepth;
565 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
568 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
570 /* Ask for a level */
571 if (!get_string(ppp, tmp_val, 10)) return;
573 /* Extract request */
574 command_arg = (COMMAND_ARG)atoi(tmp_val);
576 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
578 teleport_player(200, 0L);
585 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
586 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
589 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
591 if (autosave_l) do_cmd_save_game(TRUE);
594 current_floor_ptr->dun_level = command_arg;
598 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
600 p_ptr->inside_quest = 0;
604 * Clear all saved floors
605 * and create a first saved floor
607 prepare_change_floor_mode(CFM_FIRST_FLOOR);
608 p_ptr->leaving = TRUE;
612 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
613 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
615 static bool pattern_effect(void)
619 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
621 if ((prace_is_(RACE_AMBERITE)) &&
622 (p_ptr->cut > 0) && one_in_(10))
627 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
629 switch (pattern_type)
631 case PATTERN_TILE_END:
633 (void)restore_all_status();
634 (void)restore_level();
635 (void)cure_critical_wounds(1000);
637 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
638 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
641 * We could make the healing effect of the
642 * Pattern center one-time only to avoid various kinds
643 * of abuse, like luring the win monster into fighting you
644 * in the middle of the pattern...
648 case PATTERN_TILE_OLD:
652 case PATTERN_TILE_TELEPORT:
656 case PATTERN_TILE_WRECKED:
658 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
662 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
664 else if (!IS_INVULN())
665 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
674 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
675 * @param percent 回復比率
678 static void regenhp(int percent)
684 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
685 if (p_ptr->action == ACTION_HAYAGAKE) return;
687 /* Save the old hitpoints */
688 old_chp = p_ptr->chp;
691 * Extract the new hitpoints
693 * 'percent' is the Regen factor in unit (1/2^16)
696 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
698 /* Convert the unit (1/2^16) to (1/2^32) */
699 s64b_LSHIFT(new_chp, new_chp_frac, 16);
702 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
706 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
708 p_ptr->chp = p_ptr->mhp;
713 if (old_chp != p_ptr->chp)
715 p_ptr->redraw |= (PR_HP);
716 p_ptr->window |= (PW_PLAYER);
723 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
724 * @param upkeep_factor ペット維持によるMPコスト量
725 * @param regen_amount 回復量
728 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
730 MANA_POINT old_csp = p_ptr->csp;
731 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
734 * Excess mana will decay 32 times faster than normal
737 if (p_ptr->csp > p_ptr->msp)
739 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
741 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
743 /* Convert the unit (1/2^16) to (1/2^32) */
744 s64b_LSHIFT(decay, decay_frac, 16);
747 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
750 if (p_ptr->csp < p_ptr->msp)
752 p_ptr->csp = p_ptr->msp;
757 /* Regenerating mana (unless the player has excess mana) */
758 else if (regen_rate > 0)
760 /* (percent/100) is the Regen factor in unit (1/2^16) */
761 MANA_POINT new_mana = 0;
762 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
764 /* Convert the unit (1/2^16) to (1/2^32) */
765 s64b_LSHIFT(new_mana, new_mana_frac, 16);
768 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
770 /* Must set frac to zero even if equal */
771 if (p_ptr->csp >= p_ptr->msp)
773 p_ptr->csp = p_ptr->msp;
779 /* Reduce mana (even when the player has excess mana) */
782 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
783 s32b reduce_mana = 0;
784 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
786 /* Convert the unit (1/2^16) to (1/2^32) */
787 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
790 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
800 if (old_csp != p_ptr->csp)
802 p_ptr->redraw |= (PR_MANA);
803 p_ptr->window |= (PW_PLAYER);
804 p_ptr->window |= (PW_SPELL);
810 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
811 * @param regen_amount 回復量
814 static void regenmagic(int regen_amount)
819 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
821 for (i = 0; i < EATER_EXT*2; i++)
823 if (!p_ptr->magic_num2[i]) continue;
824 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
826 /* Increase remaining charge number like float value */
827 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
828 p_ptr->magic_num1[i] += new_mana;
830 /* Check maximum charge */
831 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
833 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
837 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
839 if (!p_ptr->magic_num1[i]) continue;
840 if (!p_ptr->magic_num2[i]) continue;
842 /* Decrease remaining period for charging */
843 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
844 / (dev * 16 * PY_REGEN_NORMAL);
845 p_ptr->magic_num1[i] -= new_mana;
847 /* Check minimum remaining period for charging */
848 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
855 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
857 * @note Should probably be done during monster turns.
859 static void regen_monsters(void)
864 /* Regenerate everyone */
865 for (i = 1; i < m_max; i++)
867 /* Check the i'th monster */
868 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
869 monster_race *r_ptr = &r_info[m_ptr->r_idx];
871 if (!monster_is_valid(m_ptr)) continue;
873 /* Allow regeneration (if needed) */
874 if (m_ptr->hp < m_ptr->maxhp)
876 /* Hack -- Base regeneration */
877 frac = m_ptr->maxhp / 100;
879 /* Hack -- Minimal regeneration rate */
880 if (!frac) if (one_in_(2)) frac = 1;
882 /* Hack -- Some monsters regenerate quickly */
883 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
885 /* Hack -- Regenerate */
888 /* Do not over-regenerate */
889 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
891 /* Redraw (later) if needed */
892 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
893 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
900 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
902 * @note Should probably be done during monster turns.
904 static void regen_captured_monsters(void)
909 /* Regenerate everyone */
910 for (i = 0; i < INVEN_TOTAL; i++)
913 object_type *o_ptr = &inventory[i];
915 if (!o_ptr->k_idx) continue;
916 if (o_ptr->tval != TV_CAPTURE) continue;
917 if (!o_ptr->pval) continue;
921 r_ptr = &r_info[o_ptr->pval];
923 /* Allow regeneration (if needed) */
924 if (o_ptr->xtra4 < o_ptr->xtra5)
926 /* Hack -- Base regeneration */
927 frac = o_ptr->xtra5 / 100;
929 /* Hack -- Minimal regeneration rate */
930 if (!frac) if (one_in_(2)) frac = 1;
932 /* Hack -- Some monsters regenerate quickly */
933 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
935 /* Hack -- Regenerate */
936 o_ptr->xtra4 += (XTRA16)frac;
938 /* Do not over-regenerate */
939 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
946 p_ptr->update |= (PU_COMBINE);
947 p_ptr->window |= (PW_INVEN);
948 p_ptr->window |= (PW_EQUIP);
954 * @brief 寿命つき光源の警告メッセージ処理
955 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
958 static void notice_lite_change(object_type *o_ptr)
960 /* Hack -- notice interesting fuel steps */
961 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
963 p_ptr->window |= (PW_EQUIP);
966 /* Hack -- Special treatment when blind */
969 /* Hack -- save some light for later */
970 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
973 /* The light is now out */
974 else if (o_ptr->xtra4 == 0)
976 disturb(FALSE, TRUE);
977 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
979 /* Recalculate torch radius */
980 p_ptr->update |= (PU_TORCH);
982 /* Some ego light lose its effects without fuel */
983 p_ptr->update |= (PU_BONUS);
986 /* The light is getting dim */
987 else if (o_ptr->name2 == EGO_LITE_LONG)
989 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
990 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
992 if (disturb_minor) disturb(FALSE, TRUE);
993 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
997 /* The light is getting dim */
998 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1000 if (disturb_minor) disturb(FALSE, TRUE);
1001 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1007 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1008 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1011 static void recharged_notice(object_type *o_ptr)
1013 GAME_TEXT o_name[MAX_NLEN];
1017 /* No inscription */
1018 if (!o_ptr->inscription) return;
1021 s = my_strchr(quark_str(o_ptr->inscription), '!');
1023 /* Process notification request. */
1026 /* Find another '!' */
1029 /* Describe (briefly) */
1030 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1032 /* Notify the player */
1034 msg_format("%sは再充填された。", o_name);
1036 if (o_ptr->number > 1)
1037 msg_format("Your %s are recharged.", o_name);
1039 msg_format("Your %s is recharged.", o_name);
1042 disturb(FALSE, FALSE);
1048 /* Keep looking for '!'s */
1049 s = my_strchr(s + 1, '!');
1054 * @brief プレイヤーの歌に関する継続処理
1057 static void check_music(void)
1059 const magic_type *s_ptr;
1061 MANA_POINT need_mana;
1062 u32b need_mana_frac;
1064 /* Music singed by player */
1065 if (p_ptr->pclass != CLASS_BARD) return;
1066 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1068 if (p_ptr->anti_magic)
1070 stop_singing(p_ptr);
1074 spell = SINGING_SONG_ID(p_ptr);
1075 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1077 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1081 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1083 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1085 stop_singing(p_ptr);
1090 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1092 p_ptr->redraw |= PR_MANA;
1093 if (INTERUPTING_SONG_EFFECT(p_ptr))
1095 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1096 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1097 msg_print(_("歌を再開した。", "You restart singing."));
1098 p_ptr->action = ACTION_SING;
1099 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1100 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1101 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1104 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1105 p_ptr->spell_exp[spell] += 5;
1106 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1107 { 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; }
1108 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1109 { 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; }
1110 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1111 { 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; }
1113 /* Do any effects of continual song */
1114 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1118 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1119 * @param flag 探し出したい呪いフラグ配列
1120 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1123 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1126 int choices[INVEN_TOTAL-INVEN_RARM];
1129 /* Paranoia -- Player has no warning-item */
1130 if (!(p_ptr->cursed & flag)) return NULL;
1132 /* Search Inventry */
1133 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1135 object_type *o_ptr = &inventory[i];
1137 if (o_ptr->curse_flags & flag)
1139 choices[number] = i;
1142 else if ((flag == TRC_ADD_L_CURSE) ||
1143 (flag == TRC_ADD_H_CURSE) ||
1144 (flag == TRC_DRAIN_HP) ||
1145 (flag == TRC_DRAIN_MANA) ||
1146 (flag == TRC_CALL_ANIMAL) ||
1147 (flag == TRC_CALL_DEMON) ||
1148 (flag == TRC_CALL_DRAGON) ||
1149 (flag == TRC_CALL_UNDEAD) ||
1150 (flag == TRC_COWARDICE) ||
1151 (flag == TRC_LOW_MELEE) ||
1152 (flag == TRC_LOW_AC) ||
1153 (flag == TRC_LOW_MAGIC) ||
1154 (flag == TRC_FAST_DIGEST) ||
1155 (flag == TRC_SLOW_REGEN) )
1158 BIT_FLAGS flgs[TR_FLAG_SIZE];
1159 object_flags(o_ptr, flgs);
1162 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1163 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1164 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1165 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1166 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1167 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1168 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1169 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1170 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1171 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1172 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1173 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1174 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1175 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1178 if (have_flag(flgs, cf))
1180 choices[number] = i;
1186 /* Choice one of them */
1187 return (&inventory[choices[randint0(number)]]);
1190 static void process_world_aux_digestion(void)
1192 if (!p_ptr->inside_battle)
1194 /* Digest quickly when gorged */
1195 if (p_ptr->food >= PY_FOOD_MAX)
1197 /* Digest a lot of food */
1198 (void)set_food(p_ptr->food - 100);
1201 /* Digest normally -- Every 50 game turns */
1202 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1204 /* Basic digestion rate based on speed */
1205 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1207 /* Regeneration takes more food */
1208 if (p_ptr->regenerate)
1210 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1212 if (p_ptr->cursed & TRC_FAST_DIGEST)
1215 /* Slow digestion takes less food */
1216 if (p_ptr->slow_digest)
1219 /* Minimal digestion */
1220 if (digestion < 1) digestion = 1;
1221 /* Maximal digestion */
1222 if (digestion > 100) digestion = 100;
1224 /* Digest some food */
1225 (void)set_food(p_ptr->food - digestion);
1230 if ((p_ptr->food < PY_FOOD_FAINT))
1232 /* Faint occasionally */
1233 if (!p_ptr->paralyzed && (randint0(100) < 10))
1235 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1236 disturb(TRUE, TRUE);
1238 /* Hack -- faint (bypass free action) */
1239 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1242 /* Starve to death (slowly) */
1243 if (p_ptr->food < PY_FOOD_STARVE)
1245 /* Calculate damage */
1246 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1248 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1255 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1256 * / Handle timed damage and regeneration every 10 game turns
1259 static void process_world_aux_hp_and_sp(void)
1261 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1262 bool cave_no_regen = FALSE;
1263 int upkeep_factor = 0;
1265 /* Default regeneration */
1266 int regen_amount = PY_REGEN_NORMAL;
1269 /*** Damage over Time ***/
1271 /* Take damage from poison */
1272 if (p_ptr->poisoned && !IS_INVULN())
1274 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1277 /* Take damage from cuts */
1278 if (p_ptr->cut && !IS_INVULN())
1282 /* Mortal wound or Deep Gash */
1283 if (p_ptr->cut > 1000)
1288 else if (p_ptr->cut > 200)
1294 else if (p_ptr->cut > 100)
1299 else if (p_ptr->cut > 50)
1304 else if (p_ptr->cut > 25)
1309 else if (p_ptr->cut > 10)
1320 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1323 /* (Vampires) Take damage from sunlight */
1324 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1326 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1328 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1330 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1331 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1332 cave_no_regen = TRUE;
1336 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1337 !p_ptr->resist_lite)
1339 object_type * o_ptr = &inventory[INVEN_LITE];
1340 GAME_TEXT o_name [MAX_NLEN];
1341 char ouch [MAX_NLEN+40];
1343 /* Get an object description */
1344 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1345 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1347 cave_no_regen = TRUE;
1349 /* Get an object description */
1350 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1351 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1353 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1357 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1361 if (have_flag(f_ptr->flags, FF_DEEP))
1363 damage = 6000 + randint0(4000);
1365 else if (!p_ptr->levitation)
1367 damage = 3000 + randint0(2000);
1372 if(prace_is_(RACE_ENT)) damage += damage / 3;
1373 if(p_ptr->resist_fire) damage = damage / 3;
1374 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1375 if(p_ptr->levitation) damage = damage / 5;
1377 damage = damage / 100 + (randint0(100) < (damage % 100));
1379 if (p_ptr->levitation)
1381 msg_print(_("熱で火傷した!", "The heat burns you!"));
1382 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1383 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1387 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1388 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1389 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1392 cave_no_regen = TRUE;
1396 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1400 if (have_flag(f_ptr->flags, FF_DEEP))
1402 damage = 6000 + randint0(4000);
1404 else if (!p_ptr->levitation)
1406 damage = 3000 + randint0(2000);
1411 if (p_ptr->resist_cold) damage = damage / 3;
1412 if (IS_OPPOSE_COLD()) damage = damage / 3;
1413 if (p_ptr->levitation) damage = damage / 5;
1415 damage = damage / 100 + (randint0(100) < (damage % 100));
1417 if (p_ptr->levitation)
1419 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1420 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1421 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1425 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1426 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1427 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1430 cave_no_regen = TRUE;
1434 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1438 if (have_flag(f_ptr->flags, FF_DEEP))
1440 damage = 6000 + randint0(4000);
1442 else if (!p_ptr->levitation)
1444 damage = 3000 + randint0(2000);
1449 if (p_ptr->resist_elec) damage = damage / 3;
1450 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1451 if (p_ptr->levitation) damage = damage / 5;
1453 damage = damage / 100 + (randint0(100) < (damage % 100));
1455 if (p_ptr->levitation)
1457 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1458 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1459 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1463 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1464 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1465 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1468 cave_no_regen = TRUE;
1472 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1476 if (have_flag(f_ptr->flags, FF_DEEP))
1478 damage = 6000 + randint0(4000);
1480 else if (!p_ptr->levitation)
1482 damage = 3000 + randint0(2000);
1487 if (p_ptr->resist_acid) damage = damage / 3;
1488 if (IS_OPPOSE_ACID()) damage = damage / 3;
1489 if (p_ptr->levitation) damage = damage / 5;
1491 damage = damage / 100 + (randint0(100) < (damage % 100));
1493 if (p_ptr->levitation)
1495 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1496 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1497 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1501 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1502 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1503 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1506 cave_no_regen = TRUE;
1510 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1514 if (have_flag(f_ptr->flags, FF_DEEP))
1516 damage = 6000 + randint0(4000);
1518 else if (!p_ptr->levitation)
1520 damage = 3000 + randint0(2000);
1525 if (p_ptr->resist_pois) damage = damage / 3;
1526 if (IS_OPPOSE_POIS()) damage = damage / 3;
1527 if (p_ptr->levitation) damage = damage / 5;
1529 damage = damage / 100 + (randint0(100) < (damage % 100));
1531 if (p_ptr->levitation)
1533 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1534 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1535 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1536 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1540 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1541 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1542 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1543 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1546 cave_no_regen = TRUE;
1550 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1551 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1553 if (p_ptr->total_weight > weight_limit())
1555 msg_print(_("溺れている!", "You are drowning!"));
1556 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1557 cave_no_regen = TRUE;
1564 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1566 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1567 if (prace_is_(RACE_ENT)) damage += damage / 3;
1568 if (p_ptr->resist_fire) damage = damage / 3;
1569 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1570 msg_print(_("熱い!", "It's hot!"));
1571 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1573 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1575 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1576 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1577 if (p_ptr->resist_elec) damage = damage / 3;
1578 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1579 msg_print(_("痛い!", "It hurts!"));
1580 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1582 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1584 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1585 if (p_ptr->resist_cold) damage = damage / 3;
1586 if (IS_OPPOSE_COLD()) damage = damage / 3;
1587 msg_print(_("冷たい!", "It's cold!"));
1588 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1592 /* Spectres -- take damage when moving through walls */
1594 * Added: ANYBODY takes damage if inside through walls
1595 * without wraith form -- NOTE: Spectres will never be
1596 * reduced below 0 hp by being inside a stone wall; others
1599 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1601 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1604 cave_no_regen = TRUE;
1606 if (p_ptr->pass_wall)
1608 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1609 dam_desc = _("密度", "density");
1613 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1614 dam_desc = _("硬い岩", "solid rock");
1617 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1622 /*** handle regeneration ***/
1625 if (p_ptr->food < PY_FOOD_WEAK)
1627 /* Lower regeneration */
1628 if (p_ptr->food < PY_FOOD_STARVE)
1632 else if (p_ptr->food < PY_FOOD_FAINT)
1634 regen_amount = PY_REGEN_FAINT;
1638 regen_amount = PY_REGEN_WEAK;
1642 /* Are we walking the pattern? */
1643 if (pattern_effect())
1645 cave_no_regen = TRUE;
1649 /* Regeneration ability */
1650 if (p_ptr->regenerate)
1652 regen_amount = regen_amount * 2;
1654 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1658 if (p_ptr->cursed & TRC_SLOW_REGEN)
1665 /* Searching or Resting */
1666 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1668 regen_amount = regen_amount * 2;
1671 upkeep_factor = calculate_upkeep();
1673 /* No regeneration while special action */
1674 if ((p_ptr->action == ACTION_LEARN) ||
1675 (p_ptr->action == ACTION_HAYAGAKE) ||
1676 (p_ptr->special_defense & KATA_KOUKIJIN))
1678 upkeep_factor += 100;
1681 /* Regenerate the mana */
1682 regenmana(upkeep_factor, regen_amount);
1685 /* Recharge magic eater's power */
1686 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1688 regenmagic(regen_amount);
1691 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1693 while (upkeep_factor > 100)
1695 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1697 do_cmd_pet_dismiss();
1699 upkeep_factor = calculate_upkeep();
1701 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1706 /* Poisoned or cut yields no healing */
1707 if (p_ptr->poisoned) regen_amount = 0;
1708 if (p_ptr->cut) regen_amount = 0;
1710 /* Special floor -- Pattern, in a wall -- yields no healing */
1711 if (cave_no_regen) regen_amount = 0;
1713 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1715 /* Regenerate Hit Points if needed */
1716 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1718 regenhp(regen_amount);
1723 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1724 * / Handle timeout every 10 game turns
1727 static void process_world_aux_timeout(void)
1729 const int dec_count = (easy_band ? 2 : 1);
1731 /*** Timeout Various Things ***/
1734 if (p_ptr->tim_mimic)
1736 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1739 /* Hack -- Hallucinating */
1742 (void)set_image(p_ptr->image - dec_count);
1748 (void)set_blind(p_ptr->blind - dec_count);
1751 /* Times see-invisible */
1752 if (p_ptr->tim_invis)
1754 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1765 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1768 /* Timed temporary elemental brands. -LM- */
1769 if (p_ptr->ele_attack)
1771 p_ptr->ele_attack--;
1773 /* Clear all temporary elemental brands. */
1774 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1777 /* Timed temporary elemental immune. -LM- */
1778 if (p_ptr->ele_immune)
1780 p_ptr->ele_immune--;
1782 /* Clear all temporary elemental brands. */
1783 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1786 /* Timed infra-vision */
1787 if (p_ptr->tim_infra)
1789 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1793 if (p_ptr->tim_stealth)
1795 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1798 /* Timed levitation */
1799 if (p_ptr->tim_levitation)
1801 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1804 /* Timed sh_touki */
1805 if (p_ptr->tim_sh_touki)
1807 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1811 if (p_ptr->tim_sh_fire)
1813 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1817 if (p_ptr->tim_sh_holy)
1819 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1823 if (p_ptr->tim_eyeeye)
1825 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1828 /* Timed resist-magic */
1829 if (p_ptr->resist_magic)
1831 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1834 /* Timed regeneration */
1835 if (p_ptr->tim_regen)
1837 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1840 /* Timed resist nether */
1841 if (p_ptr->tim_res_nether)
1843 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1846 /* Timed resist time */
1847 if (p_ptr->tim_res_time)
1849 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1853 if (p_ptr->tim_reflect)
1855 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1859 if (p_ptr->multishadow)
1861 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1864 /* Timed Robe of dust */
1865 if (p_ptr->dustrobe)
1867 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1870 /* Timed infra-vision */
1871 if (p_ptr->kabenuke)
1873 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1877 if (p_ptr->paralyzed)
1879 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1883 if (p_ptr->confused)
1885 (void)set_confused(p_ptr->confused - dec_count);
1891 (void)set_afraid(p_ptr->afraid - dec_count);
1897 (void)set_fast(p_ptr->fast - 1, TRUE);
1903 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1906 /* Protection from evil */
1907 if (p_ptr->protevil)
1909 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1912 /* Invulnerability */
1915 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1919 if (p_ptr->wraith_form)
1921 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1927 (void)set_hero(p_ptr->hero - 1, TRUE);
1933 (void)set_shero(p_ptr->shero - 1, TRUE);
1939 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1945 (void)set_shield(p_ptr->shield - 1, TRUE);
1949 if (p_ptr->tsubureru)
1951 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1955 if (p_ptr->magicdef)
1957 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1961 if (p_ptr->tsuyoshi)
1963 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1967 if (p_ptr->oppose_acid)
1969 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1972 /* Oppose Lightning */
1973 if (p_ptr->oppose_elec)
1975 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
1979 if (p_ptr->oppose_fire)
1981 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
1985 if (p_ptr->oppose_cold)
1987 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
1991 if (p_ptr->oppose_pois)
1993 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
1998 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2001 /*** Poison and Stun and Cut ***/
2004 if (p_ptr->poisoned)
2006 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2008 /* Apply some healing */
2009 (void)set_poisoned(p_ptr->poisoned - adjust);
2015 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2017 /* Apply some healing */
2018 (void)set_stun(p_ptr->stun - adjust);
2024 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2026 /* Hack -- Truly "mortal" wound */
2027 if (p_ptr->cut > 1000) adjust = 0;
2029 /* Apply some healing */
2030 (void)set_cut(p_ptr->cut - adjust);
2036 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2037 * / Handle burning fuel every 10 game turns
2040 static void process_world_aux_light(void)
2042 /* Check for light being wielded */
2043 object_type *o_ptr = &inventory[INVEN_LITE];
2045 /* Burn some fuel in the current lite */
2046 if (o_ptr->tval == TV_LITE)
2048 /* Hack -- Use some fuel (except on artifacts) */
2049 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2051 /* Decrease life-span */
2052 if (o_ptr->name2 == EGO_LITE_LONG)
2054 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2056 else o_ptr->xtra4--;
2058 /* Notice interesting fuel steps */
2059 notice_lite_change(o_ptr);
2066 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2067 * / Handle mutation effects once every 10 game turns
2070 static void process_world_aux_mutation(void)
2072 /* No mutation with effects */
2073 if (!p_ptr->muta2) return;
2075 /* No effect on monster arena */
2076 if (p_ptr->inside_battle) return;
2078 /* No effect on the global map */
2079 if (p_ptr->wild_mode) return;
2081 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2083 disturb(FALSE, TRUE);
2084 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2085 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2086 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2087 (void)set_afraid(0);
2090 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2092 if (!p_ptr->resist_fear)
2094 disturb(FALSE, TRUE);
2095 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2096 set_afraid(p_ptr->afraid + 13 + randint1(26));
2100 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2102 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2104 disturb(FALSE, TRUE);
2105 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2107 teleport_player(40, TELEPORT_PASSIVE);
2111 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2113 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2115 disturb(FALSE, TRUE);
2116 p_ptr->redraw |= PR_EXTRA;
2117 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2120 if (!p_ptr->resist_conf)
2122 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2125 if (!p_ptr->resist_chaos)
2130 if (one_in_(3)) lose_all_info();
2132 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2134 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2135 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2141 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2142 (void)set_image(p_ptr->image + randint0(150) + 150);
2148 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2150 if (!p_ptr->resist_chaos)
2152 disturb(FALSE, TRUE);
2153 p_ptr->redraw |= PR_EXTRA;
2154 (void)set_image(p_ptr->image + randint0(50) + 20);
2158 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2160 disturb(FALSE, TRUE);
2161 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2163 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2166 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2167 !p_ptr->anti_magic && one_in_(9000))
2170 disturb(FALSE, TRUE);
2171 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2172 "Magical energy flows through you! You must release it!"));
2176 (void)get_hack_dir(&dire);
2177 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2180 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2182 bool pet = one_in_(6);
2183 BIT_FLAGS mode = PM_ALLOW_GROUP;
2185 if (pet) mode |= PM_FORCE_PET;
2186 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2188 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2190 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2191 disturb(FALSE, TRUE);
2195 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2197 disturb(FALSE, TRUE);
2200 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2202 if (p_ptr->fast > 0)
2208 set_slow(randint1(30) + 10, FALSE);
2213 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2215 if (p_ptr->slow > 0)
2221 set_fast(randint1(30) + 10, FALSE);
2226 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2228 disturb(FALSE, TRUE);
2229 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2231 banish_monsters(100);
2232 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2236 /* Pick a random shop (except home) */
2239 n = randint0(MAX_STORES);
2241 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2243 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2249 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2253 msg_print(_("影につつまれた。", "A shadow passes over you."));
2256 /* Absorb light from the current possition */
2257 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2262 o_ptr = &inventory[INVEN_LITE];
2264 /* Absorb some fuel in the current lite */
2265 if (o_ptr->tval == TV_LITE)
2267 /* Use some fuel (except on artifacts) */
2268 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2270 /* Heal the player a bit */
2271 hp_player(o_ptr->xtra4 / 20);
2273 /* Decrease life-span of lite */
2275 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2277 /* Notice interesting fuel steps */
2278 notice_lite_change(o_ptr);
2283 * Unlite the area (radius 10) around player and
2284 * do 50 points damage to every affected monster
2286 unlite_area(50, 10);
2289 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2291 bool pet = one_in_(3);
2292 BIT_FLAGS mode = PM_ALLOW_GROUP;
2294 if (pet) mode |= PM_FORCE_PET;
2295 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2297 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2299 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2300 disturb(FALSE, TRUE);
2304 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2306 disturb(FALSE, TRUE);
2307 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2310 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2312 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2314 if (!lose_mutation(0))
2315 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2317 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2319 disturb(FALSE, TRUE);
2320 msg_print(_("非物質化した!", "You feel insubstantial!"));
2323 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2325 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2329 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2331 int which_stat = randint0(A_MAX);
2332 int sustained = FALSE;
2337 if (p_ptr->sustain_str) sustained = TRUE;
2340 if (p_ptr->sustain_int) sustained = TRUE;
2343 if (p_ptr->sustain_wis) sustained = TRUE;
2346 if (p_ptr->sustain_dex) sustained = TRUE;
2349 if (p_ptr->sustain_con) sustained = TRUE;
2352 if (p_ptr->sustain_chr) sustained = TRUE;
2355 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2361 disturb(FALSE, TRUE);
2362 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2364 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2367 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2369 bool pet = one_in_(5);
2370 BIT_FLAGS mode = PM_ALLOW_GROUP;
2372 if (pet) mode |= PM_FORCE_PET;
2373 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2375 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2377 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2378 disturb(FALSE, TRUE);
2381 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2383 if (p_ptr->tim_esp > 0)
2385 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2386 set_tim_esp(0, TRUE);
2390 msg_print(_("精神が広がった!", "Your mind expands!"));
2391 set_tim_esp(p_ptr->lev, FALSE);
2394 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2396 disturb(FALSE, TRUE);
2397 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2399 set_food(PY_FOOD_WEAK);
2400 if (music_singing_any()) stop_singing(p_ptr);
2401 if (hex_spelling_any()) stop_hex_spell_all();
2404 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2409 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2411 int danger_amount = 0;
2412 MONSTER_IDX monster;
2414 for (monster = 0; monster < m_max; monster++)
2416 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2417 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2418 if (!monster_is_valid(m_ptr)) continue;
2420 if (r_ptr->level >= p_ptr->lev)
2422 danger_amount += r_ptr->level - p_ptr->lev + 1;
2426 if (danger_amount > 100)
2427 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2428 else if (danger_amount > 50)
2429 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2430 else if (danger_amount > 20)
2431 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2432 else if (danger_amount > 10)
2433 msg_print(_("心配な気がする!", "You feel paranoid!"));
2434 else if (danger_amount > 5)
2435 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2437 msg_print(_("寂しい気がする。", "You feel lonely."));
2440 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2442 disturb(FALSE, TRUE);
2443 msg_print(_("無敵な気がする!", "You feel invincible!"));
2445 (void)set_invuln(randint1(8) + 8, FALSE);
2448 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2450 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2454 HIT_POINT healing = p_ptr->csp;
2455 if (healing > wounds) healing = wounds;
2458 p_ptr->csp -= healing;
2459 p_ptr->redraw |= (PR_HP | PR_MANA);
2463 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2465 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2469 HIT_POINT healing = p_ptr->chp;
2470 if (healing > wounds) healing = wounds;
2472 p_ptr->csp += healing;
2473 p_ptr->redraw |= (PR_HP | PR_MANA);
2474 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2478 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2480 INVENTORY_IDX slot = 0;
2481 object_type *o_ptr = NULL;
2483 disturb(FALSE, TRUE);
2484 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2485 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2488 if (has_melee_weapon(INVEN_RARM))
2491 o_ptr = &inventory[INVEN_RARM];
2493 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2495 o_ptr = &inventory[INVEN_LARM];
2499 else if (has_melee_weapon(INVEN_LARM))
2501 o_ptr = &inventory[INVEN_LARM];
2504 if (slot && !object_is_cursed(o_ptr))
2506 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2507 inven_drop(slot, 1);
2514 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2515 * / Handle curse effects once every 10 game turns
2518 static void process_world_aux_curse(void)
2520 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2523 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2524 * can actually be useful!
2526 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2528 GAME_TEXT o_name[MAX_NLEN];
2530 int i, i_keep = 0, count = 0;
2532 /* Scan the equipment with random teleport ability */
2533 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2535 BIT_FLAGS flgs[TR_FLAG_SIZE];
2536 o_ptr = &inventory[i];
2538 /* Skip non-objects */
2539 if (!o_ptr->k_idx) continue;
2541 /* Extract the item flags */
2542 object_flags(o_ptr, flgs);
2544 if (have_flag(flgs, TR_TELEPORT))
2546 /* {.} will stop random teleportation. */
2547 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2550 if (one_in_(count)) i_keep = i;
2555 o_ptr = &inventory[i_keep];
2556 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2557 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2558 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2560 disturb(FALSE, TRUE);
2561 teleport_player(50, 0L);
2565 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2566 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2567 disturb(TRUE, TRUE);
2570 /* Make a chainsword noise */
2571 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2574 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2576 disturb(FALSE, FALSE);
2579 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2582 (void)activate_ty_curse(FALSE, &count);
2584 /* Handle experience draining */
2585 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2587 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2588 if (p_ptr->exp < 0) p_ptr->exp = 0;
2589 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2590 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2593 /* Add light curse (Later) */
2594 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2596 BIT_FLAGS new_curse;
2599 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2601 new_curse = get_curse(0, o_ptr);
2602 if (!(o_ptr->curse_flags & new_curse))
2604 GAME_TEXT o_name[MAX_NLEN];
2606 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2608 o_ptr->curse_flags |= new_curse;
2609 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2611 o_ptr->feeling = FEEL_NONE;
2613 p_ptr->update |= (PU_BONUS);
2616 /* Add heavy curse (Later) */
2617 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2619 BIT_FLAGS new_curse;
2622 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2624 new_curse = get_curse(1, o_ptr);
2625 if (!(o_ptr->curse_flags & new_curse))
2627 GAME_TEXT o_name[MAX_NLEN];
2629 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2631 o_ptr->curse_flags |= new_curse;
2632 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2633 o_ptr->feeling = FEEL_NONE;
2635 p_ptr->update |= (PU_BONUS);
2639 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2641 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'))
2643 GAME_TEXT o_name[MAX_NLEN];
2645 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2646 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2647 disturb(FALSE, TRUE);
2651 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2653 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'))
2655 GAME_TEXT o_name[MAX_NLEN];
2657 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2658 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2659 disturb(FALSE, TRUE);
2663 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2665 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2666 (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_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2671 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2672 disturb(FALSE, TRUE);
2676 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2678 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
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_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2684 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2685 disturb(FALSE, TRUE);
2688 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2690 if (!p_ptr->resist_fear)
2692 disturb(FALSE, TRUE);
2693 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2694 set_afraid(p_ptr->afraid + 13 + randint1(26));
2697 /* Teleport player */
2698 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2700 disturb(FALSE, TRUE);
2702 /* Teleport player */
2703 teleport_player(40, TELEPORT_PASSIVE);
2705 /* Handle HP draining */
2706 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2708 GAME_TEXT o_name[MAX_NLEN];
2710 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2711 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2712 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2714 /* Handle mana draining */
2715 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2717 GAME_TEXT o_name[MAX_NLEN];
2719 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2720 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2721 p_ptr->csp -= MIN(p_ptr->lev, 50);
2725 p_ptr->csp_frac = 0;
2727 p_ptr->redraw |= PR_MANA;
2731 /* Rarely, take damage from the Jewel of Judgement */
2732 if (one_in_(999) && !p_ptr->anti_magic)
2734 object_type *o_ptr = &inventory[INVEN_LITE];
2736 if (o_ptr->name1 == ART_JUDGE)
2738 if (object_is_known(o_ptr))
2739 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2741 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2742 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2749 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2750 * / Handle recharging objects once every 10 game turns
2753 static void process_world_aux_recharge(void)
2758 /* Process equipment */
2759 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2761 /* Get the object */
2762 object_type *o_ptr = &inventory[i];
2764 /* Skip non-objects */
2765 if (!o_ptr->k_idx) continue;
2767 /* Recharge activatable objects */
2768 if (o_ptr->timeout > 0)
2773 /* Notice changes */
2774 if (!o_ptr->timeout)
2776 recharged_notice(o_ptr);
2782 /* Notice changes */
2785 p_ptr->window |= (PW_EQUIP);
2790 * Recharge rods. Rods now use timeout to control charging status,
2791 * and each charging rod in a stack decreases the stack's timeout by
2792 * one per current_world_ptr->game_turn. -LM-
2794 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2796 object_type *o_ptr = &inventory[i];
2797 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2799 /* Skip non-objects */
2800 if (!o_ptr->k_idx) continue;
2802 /* Examine all charging rods or stacks of charging rods. */
2803 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2805 /* Determine how many rods are charging. */
2806 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2807 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2809 /* Decrease timeout by that number. */
2810 o_ptr->timeout -= temp;
2812 /* Boundary control. */
2813 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2815 /* Notice changes, provide message if object is inscribed. */
2816 if (!(o_ptr->timeout))
2818 recharged_notice(o_ptr);
2822 /* One of the stack of rod is charged */
2823 else if (o_ptr->timeout % k_ptr->pval)
2830 /* Notice changes */
2833 p_ptr->window |= (PW_INVEN);
2837 /* Process objects on floor */
2838 for (i = 1; i < o_max; i++)
2840 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2842 /* Skip dead objects */
2843 if (!o_ptr->k_idx) continue;
2845 /* Recharge rods on the ground. No messages. */
2846 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2849 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2851 /* Boundary control. */
2852 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2859 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2860 * / Handle involuntary movement once every 10 game turns
2863 static void process_world_aux_movement(void)
2865 /* Delayed Word-of-Recall */
2866 if (p_ptr->word_recall)
2869 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2870 * The player is yanked up/down as soon as
2871 * he loads the autosaved game.
2873 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2874 do_cmd_save_game(TRUE);
2876 /* Count down towards recall */
2877 p_ptr->word_recall--;
2879 p_ptr->redraw |= (PR_STATUS);
2881 /* Activate the recall */
2882 if (!p_ptr->word_recall)
2885 disturb(FALSE, TRUE);
2887 /* Determine the level */
2888 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2890 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2892 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2894 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2896 current_floor_ptr->dun_level = 0;
2897 p_ptr->dungeon_idx = 0;
2899 leave_quest_check();
2900 leave_tower_check();
2902 p_ptr->inside_quest = 0;
2904 p_ptr->leaving = TRUE;
2908 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2910 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2913 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2916 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2917 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2919 /* Nightmare mode makes recall more dangerous */
2920 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2922 if (current_floor_ptr->dun_level < 50)
2924 current_floor_ptr->dun_level *= 2;
2926 else if (current_floor_ptr->dun_level < 99)
2928 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2930 else if (current_floor_ptr->dun_level > 100)
2932 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2936 if (p_ptr->wild_mode)
2938 p_ptr->wilderness_y = p_ptr->y;
2939 p_ptr->wilderness_x = p_ptr->x;
2943 /* Save player position */
2944 p_ptr->oldpx = p_ptr->x;
2945 p_ptr->oldpy = p_ptr->y;
2947 p_ptr->wild_mode = FALSE;
2950 * Clear all saved floors
2951 * and create a first saved floor
2953 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2954 p_ptr->leaving = TRUE;
2956 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2960 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2962 quest_type* const q_ptr = &quest[i];
2965 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2966 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2967 (q_ptr->level < current_floor_ptr->dun_level))
2969 q_ptr->status = QUEST_STATUS_FAILED;
2970 q_ptr->complev = (byte)p_ptr->lev;
2972 q_ptr->comptime = current_world_ptr->play_time;
2973 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2979 sound(SOUND_TPLEVEL);
2984 /* Delayed Alter reality */
2985 if (p_ptr->alter_reality)
2987 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
2988 do_cmd_save_game(TRUE);
2990 /* Count down towards alter */
2991 p_ptr->alter_reality--;
2993 p_ptr->redraw |= (PR_STATUS);
2995 /* Activate the alter reality */
2996 if (!p_ptr->alter_reality)
2999 disturb(FALSE, TRUE);
3001 /* Determine the level */
3002 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3004 msg_print(_("世界が変わった!", "The world changes!"));
3007 * Clear all saved floors
3008 * and create a first saved floor
3010 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3011 p_ptr->leaving = TRUE;
3015 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3018 sound(SOUND_TPLEVEL);
3025 * @brief 指定したモンスターに隣接しているモンスターの数を返す。
3026 * / Count number of adjacent monsters
3027 * @param m_idx 隣接数を調べたいモンスターのID
3028 * @return 隣接しているモンスターの数
3030 static int get_monster_crowd_number(MONSTER_IDX m_idx)
3032 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
3033 POSITION my = m_ptr->fy;
3034 POSITION mx = m_ptr->fx;
3038 for (i = 0; i < 7; i++)
3040 int ay = my + ddy_ddd[i];
3041 int ax = mx + ddx_ddd[i];
3043 if (!in_bounds(ay, ax)) continue;
3045 /* Count number of monsters */
3046 if (current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++;
3055 * ダンジョンの雰囲気を計算するための非線形基準値 / Dungeon rating is no longer linear
3057 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3060 * @brief ダンジョンの雰囲気を算出する。
3061 * / Examine all monsters and unidentified objects, and get the feeling of current dungeon floor
3062 * @return 算出されたダンジョンの雰囲気ランク
3064 static byte get_dungeon_feeling(void)
3066 const int base = 10;
3070 /* Hack -- no feeling in the town */
3071 if (!current_floor_ptr->dun_level) return 0;
3073 /* Examine each monster */
3074 for (i = 1; i < m_max; i++)
3076 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
3077 monster_race *r_ptr;
3079 if (!monster_is_valid(m_ptr)) continue;
3082 if (is_pet(m_ptr)) continue;
3084 r_ptr = &r_info[m_ptr->r_idx];
3086 /* Unique monsters */
3087 if (r_ptr->flags1 & (RF1_UNIQUE))
3089 /* Nearly out-of-depth unique monsters */
3090 if (r_ptr->level + 10 > current_floor_ptr->dun_level)
3092 /* Boost rating by twice delta-depth */
3093 delta += (r_ptr->level + 10 - current_floor_ptr->dun_level) * 2 * base;
3098 /* Out-of-depth monsters */
3099 if (r_ptr->level > current_floor_ptr->dun_level)
3101 /* Boost rating by delta-depth */
3102 delta += (r_ptr->level - current_floor_ptr->dun_level) * base;
3106 /* Unusually crowded monsters get a little bit of rating boost */
3107 if (r_ptr->flags1 & RF1_FRIENDS)
3109 if (5 <= get_monster_crowd_number(i)) delta += 1;
3113 if (2 <= get_monster_crowd_number(i)) delta += 1;
3117 rating += RATING_BOOST(delta);
3120 /* Examine each unidentified object */
3121 for (i = 1; i < o_max; i++)
3123 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
3124 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3127 /* Skip dead objects */
3128 if (!o_ptr->k_idx) continue;
3130 /* Skip known objects */
3131 if (object_is_known(o_ptr))
3134 if (o_ptr->marked & OM_TOUCHED) continue;
3137 /* Skip pseudo-known objects */
3138 if (o_ptr->ident & IDENT_SENSE) continue;
3141 if (object_is_ego(o_ptr))
3143 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3145 delta += e_ptr->rating * base;
3149 if (object_is_artifact(o_ptr))
3151 PRICE cost = object_value_real(o_ptr);
3154 if (cost > 10000L) delta += 10 * base;
3155 if (cost > 50000L) delta += 10 * base;
3156 if (cost > 100000L) delta += 10 * base;
3158 /* Special feeling */
3159 if (!preserve_mode) return 1;
3162 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3163 if (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3164 if (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3165 if (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3166 if (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3167 if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_SPEED && !object_is_cursed(o_ptr)) delta += 25 * base;
3168 if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY && !object_is_cursed(o_ptr)) delta += 15 * base;
3169 if (o_ptr->tval == TV_AMULET && o_ptr->sval == SV_AMULET_THE_MAGI && !object_is_cursed(o_ptr)) delta += 15 * base;
3171 /* Out-of-depth objects */
3172 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) && k_ptr->level > current_floor_ptr->dun_level)
3174 /* Rating increase */
3175 delta += (k_ptr->level - current_floor_ptr->dun_level) * base;
3178 rating += RATING_BOOST(delta);
3182 if (rating > RATING_BOOST(1000)) return 2;
3183 if (rating > RATING_BOOST(800)) return 3;
3184 if (rating > RATING_BOOST(600)) return 4;
3185 if (rating > RATING_BOOST(400)) return 5;
3186 if (rating > RATING_BOOST(300)) return 6;
3187 if (rating > RATING_BOOST(200)) return 7;
3188 if (rating > RATING_BOOST(100)) return 8;
3189 if (rating > RATING_BOOST(0)) return 9;
3195 * @brief ダンジョンの雰囲気を更新し、変化があった場合メッセージを表示する
3196 * / Update dungeon feeling, and announce it if changed
3199 static void update_dungeon_feeling(void)
3205 /* No feeling on the surface */
3206 if (!current_floor_ptr->dun_level) return;
3208 /* No feeling in the arena */
3209 if (p_ptr->inside_battle) return;
3211 /* Extract delay time */
3212 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - current_floor_ptr->dun_level) * TURNS_PER_TICK / 100;
3214 /* Not yet felt anything */
3215 if (current_world_ptr->game_turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
3217 /* Extract quest number (if any) */
3218 quest_num = quest_number(current_floor_ptr->dun_level);
3220 /* No feeling in a quest */
3222 (is_fixed_quest_idx(quest_num) &&
3223 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
3224 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
3227 /* Get new dungeon feeling */
3228 new_feeling = get_dungeon_feeling();
3230 /* Remember last time updated */
3231 p_ptr->feeling_turn = current_world_ptr->game_turn;
3234 if (p_ptr->feeling == new_feeling) return;
3236 /* Dungeon feeling is changed */
3237 p_ptr->feeling = new_feeling;
3239 /* Announce feeling */
3242 select_floor_music();
3244 /* Update the level indicator */
3245 p_ptr->redraw |= (PR_DEPTH);
3247 if (disturb_minor) disturb(FALSE, FALSE);
3251 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3252 * / Handle certain things once every 10 game turns
3255 static void process_world(void)
3259 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3260 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3261 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3263 extract_day_hour_min(&day, &hour, &min);
3265 /* Update dungeon feeling, and announce it if changed */
3266 update_dungeon_feeling();
3268 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3269 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3271 current_floor_ptr->dun_level = 0;
3272 p_ptr->dungeon_idx = 0;
3273 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3274 p_ptr->inside_arena = FALSE;
3275 p_ptr->wild_mode = FALSE;
3276 p_ptr->leaving = TRUE;
3279 /*** Check monster arena ***/
3280 if (p_ptr->inside_battle && !p_ptr->leaving)
3286 /* Count all hostile monsters */
3287 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3288 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3290 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3292 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3295 win_m_idx = g_ptr->m_idx;
3299 if (number_mon == 0)
3301 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3303 p_ptr->energy_need = 0;
3306 else if ((number_mon-1) == 0)
3308 GAME_TEXT m_name[MAX_NLEN];
3309 monster_type *wm_ptr;
3311 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3313 monster_desc(m_name, wm_ptr, 0);
3314 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3317 if (win_m_idx == (sel_monster+1))
3319 msg_print(_("おめでとうございます。", "Congratulations."));
3320 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3321 p_ptr->au += battle_odds;
3325 msg_print(_("残念でした。", "You lost gold."));
3328 p_ptr->energy_need = 0;
3331 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3333 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3334 p_ptr->au += kakekin;
3336 p_ptr->energy_need = 0;
3341 /* Every 10 game turns */
3342 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3344 /*** Check the Time and Load ***/
3346 if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
3348 /* Check time and load */
3349 if ((0 != check_time()) || (0 != check_load()))
3352 if (closing_flag <= 2)
3354 disturb(FALSE, TRUE);
3356 /* Count warnings */
3359 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3360 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3367 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3370 p_ptr->playing = FALSE;
3371 p_ptr->leaving = TRUE;
3376 /*** Attempt timed autosave ***/
3377 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3379 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3380 do_cmd_save_game(TRUE);
3383 if (mon_fight && !ignore_unview)
3385 msg_print(_("何かが聞こえた。", "You hear noise."));
3388 /*** Handle the wilderness/town (sunshine) ***/
3390 /* While in town/wilderness */
3391 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3393 /* Hack -- Daybreak/Nighfall in town */
3394 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3398 /* Check for dawn */
3399 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3401 if (dawn) day_break();
3407 /* While in the dungeon (vanilla_town or lite_town mode only) */
3408 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3410 /*** Shuffle the Storekeepers ***/
3412 /* Chance is only once a day (while in dungeon) */
3413 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3415 /* Sometimes, shuffle the shop-keepers */
3416 if (one_in_(STORE_SHUFFLE))
3421 /* Pick a random shop (except home and museum) */
3424 n = randint0(MAX_STORES);
3426 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3428 /* Check every feature */
3429 for (i = 1; i < max_f_idx; i++)
3431 feature_type *f_ptr = &f_info[i];
3433 /* Skip empty index */
3434 if (!f_ptr->name) continue;
3436 /* Skip non-store features */
3437 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3439 /* Verify store type */
3440 if (f_ptr->subtype == n)
3442 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3455 /*** Process the monsters ***/
3457 /* Check for creature generation. */
3458 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3459 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3461 /* Make a new monster */
3462 (void)alloc_monster(MAX_SIGHT + 5, 0);
3465 /* Hack -- Check for creature regeneration */
3466 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3467 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3469 if (!p_ptr->leaving)
3473 /* Hack -- Process the counters of monsters if needed */
3474 for (i = 0; i < MAX_MTIMED; i++)
3476 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3484 if (min != prev_min)
3486 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3487 determine_today_mon(FALSE);
3492 * Nightmare mode activates the TY_CURSE at midnight
3493 * Require exact minute -- Don't activate multiple times in a minute
3496 if (ironman_nightmare && (min != prev_min))
3499 /* Every 15 minutes after 11:00 pm */
3500 if ((hour == 23) && !(min % 15))
3502 disturb(FALSE, TRUE);
3507 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3511 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3515 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3519 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3524 /* TY_CURSE activates at midnight! */
3528 disturb(TRUE, TRUE);
3529 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3531 if (p_ptr->wild_mode)
3533 /* Go into large wilderness view */
3534 p_ptr->oldpy = randint1(MAX_HGT - 2);
3535 p_ptr->oldpx = randint1(MAX_WID - 2);
3538 /* Give first move to monsters */
3539 take_turn(p_ptr, 100);
3541 /* HACk -- set the encouter flag for the wilderness generation */
3542 generate_encounter = TRUE;
3545 invoking_midnight_curse = TRUE;
3551 /* Check the Food */
3552 process_world_aux_digestion();
3554 /* Process timed damage and regeneration */
3555 process_world_aux_hp_and_sp();
3557 /* Process timeout */
3558 process_world_aux_timeout();
3561 process_world_aux_light();
3563 /* Process mutation effects */
3564 process_world_aux_mutation();
3566 /* Process curse effects */
3567 process_world_aux_curse();
3569 /* Process recharging */
3570 process_world_aux_recharge();
3572 /* Feel the inventory */
3576 /* Involuntary Movement */
3577 process_world_aux_movement();
3581 * @brief ウィザードモードへの導入処理
3582 * / Verify use of "wizard" mode
3583 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3585 static bool enter_wizard_mode(void)
3587 /* Ask first time */
3588 if (!p_ptr->noscore)
3590 /* Wizard mode is not permitted */
3591 if (!allow_debug_opts || arg_wizard)
3593 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3597 /* Mention effects */
3598 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3599 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3602 /* Verify request */
3603 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3608 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3610 p_ptr->noscore |= 0x0002;
3621 * @brief デバッグコマンドへの導入処理
3622 * / Verify use of "debug" commands
3623 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3625 static bool enter_debug_mode(void)
3627 /* Ask first time */
3628 if (!p_ptr->noscore)
3630 /* Debug mode is not permitted */
3631 if (!allow_debug_opts)
3633 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3637 /* Mention effects */
3638 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3639 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3643 /* Verify request */
3644 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3649 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3651 p_ptr->noscore |= 0x0008;
3659 * Hack -- Declare the Debug Routines
3661 extern void do_cmd_debug(void);
3663 #endif /* ALLOW_WIZARD */
3669 * @brief ボーグコマンドへの導入処理
3670 * / Verify use of "borg" commands
3671 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3673 static bool enter_borg_mode(void)
3675 /* Ask first time */
3676 if (!(p_ptr->noscore & 0x0010))
3678 /* Mention effects */
3679 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3680 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3684 /* Verify request */
3685 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3690 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3692 p_ptr->noscore |= 0x0010;
3700 * Hack -- Declare the Ben Borg
3702 extern void do_cmd_borg(void);
3704 #endif /* ALLOW_BORG */
3708 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3709 * / Parse and execute the current command Give "Warning" on illegal commands.
3710 * @todo Make some "blocks"
3713 static void process_command(void)
3715 COMMAND_CODE old_now_message = now_message;
3717 /* Handle repeating the last command */
3723 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3724 reset_concent = TRUE;
3726 /* Parse the command */
3727 switch (command_cmd)
3743 /*** Wizard Commands ***/
3745 /* Toggle Wizard Mode */
3750 p_ptr->wizard = FALSE;
3751 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3753 else if (enter_wizard_mode())
3755 p_ptr->wizard = TRUE;
3756 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3758 p_ptr->update |= (PU_MONSTERS);
3760 /* Redraw "title" */
3761 p_ptr->redraw |= (PR_TITLE);
3769 /* Special "debug" commands */
3772 /* Enter debug mode */
3773 if (enter_debug_mode())
3780 #endif /* ALLOW_WIZARD */
3785 /* Special "borg" commands */
3788 /* Enter borg mode */
3789 if (enter_borg_mode())
3791 if (!p_ptr->wild_mode) do_cmd_borg();
3797 #endif /* ALLOW_BORG */
3801 /*** Inventory Commands ***/
3803 /* Wear/wield equipment */
3806 if (!p_ptr->wild_mode) do_cmd_wield();
3810 /* Take off equipment */
3813 if (!p_ptr->wild_mode) do_cmd_takeoff();
3820 if (!p_ptr->wild_mode) do_cmd_drop();
3824 /* Destroy an item */
3831 /* Equipment list */
3838 /* Inventory list */
3846 /*** Various commands ***/
3848 /* Identify an object */
3855 /* Hack -- toggle windows */
3858 toggle_inven_equip();
3863 /*** Standard "Movement" Commands ***/
3868 if (!p_ptr->wild_mode) do_cmd_alter();
3875 if (!p_ptr->wild_mode) do_cmd_tunnel();
3879 /* Move (usually pick up things) */
3886 /* Move (usually do not pick up) */
3894 /*** Running, Resting, Searching, Staying */
3896 /* Begin Running -- Arg is Max Distance */
3899 if (!p_ptr->wild_mode) do_cmd_run();
3903 /* Stay still (usually pick things up) */
3906 do_cmd_stay(always_pickup);
3910 /* Stay still (usually do not pick up) */
3913 do_cmd_stay(!always_pickup);
3917 /* Rest -- Arg is time */
3924 /* Search for traps/doors */
3931 /* Toggle search mode */
3934 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3935 else set_action(ACTION_SEARCH);
3940 /*** Stairs and Doors and Chests and Traps ***/
3943 case SPECIAL_KEY_STORE:
3949 /* Enter building -KMW- */
3950 case SPECIAL_KEY_BUILDING:
3956 /* Enter quest level -KMW- */
3957 case SPECIAL_KEY_QUEST:
3963 /* Go up staircase */
3966 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3968 if (vanilla_town) break;
3970 if (p_ptr->ambush_flag)
3972 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3976 if (p_ptr->food < PY_FOOD_WEAK)
3978 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3989 /* Go down staircase */
3992 if (p_ptr->wild_mode)
3999 /* Open a door or chest */
4013 /* Jam a door with spikes */
4027 /* Disarm a trap or chest */
4035 /*** Magic and Prayers ***/
4037 /* Gain new spells/prayers */
4040 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4041 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
4042 else if (p_ptr->pclass == CLASS_SAMURAI)
4043 do_cmd_gain_hissatsu();
4044 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4045 import_magic_device();
4054 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4055 (p_ptr->pclass == CLASS_BERSERKER) ||
4056 (p_ptr->pclass == CLASS_NINJA) ||
4057 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4058 ) do_cmd_mind_browse();
4059 else if (p_ptr->pclass == CLASS_SMITH)
4061 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4062 do_cmd_magic_eater(TRUE, FALSE);
4063 else if (p_ptr->pclass == CLASS_SNIPER)
4064 do_cmd_snipe_browse();
4065 else do_cmd_browse();
4073 if (!p_ptr->wild_mode)
4075 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4077 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
4079 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))
4081 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
4084 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4086 concptr which_power = _("魔法", "magic");
4087 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4088 which_power = _("超能力", "psionic powers");
4089 else if (p_ptr->pclass == CLASS_IMITATOR)
4090 which_power = _("ものまね", "imitation");
4091 else if (p_ptr->pclass == CLASS_SAMURAI)
4092 which_power = _("必殺剣", "hissatsu");
4093 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4094 which_power = _("鏡魔法", "mirror magic");
4095 else if (p_ptr->pclass == CLASS_NINJA)
4096 which_power = _("忍術", "ninjutsu");
4097 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4098 which_power = _("祈り", "prayer");
4100 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
4103 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4105 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
4110 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4111 (p_ptr->pclass == CLASS_BERSERKER) ||
4112 (p_ptr->pclass == CLASS_NINJA) ||
4113 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4116 else if (p_ptr->pclass == CLASS_IMITATOR)
4118 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4119 do_cmd_magic_eater(FALSE, FALSE);
4120 else if (p_ptr->pclass == CLASS_SAMURAI)
4122 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4123 do_cmd_cast_learned();
4124 else if (p_ptr->pclass == CLASS_SMITH)
4126 else if (p_ptr->pclass == CLASS_SNIPER)
4135 /* Issue a pet command */
4142 /*** Use various objects ***/
4144 /* Inscribe an object */
4151 /* Uninscribe an object */
4154 do_cmd_uninscribe();
4158 /* Activate an artifact */
4172 /* Fuel your lantern/torch */
4182 do_cmd_fire(SP_NONE);
4189 do_cmd_throw(1, FALSE, -1);
4203 if (use_command && rogue_like_commands)
4214 /* Quaff a potion */
4217 do_cmd_quaff_potion();
4224 do_cmd_read_scroll();
4231 if (use_command && !rogue_like_commands)
4238 /* Use racial power */
4241 do_cmd_racial_power();
4246 /*** Looking at Things (nearby or on map) ***/
4248 /* Full dungeon map */
4255 /* Locate player on map */
4269 /* Target monster or location */
4278 /*** Help and Such ***/
4287 /* Identify symbol */
4290 do_cmd_query_symbol();
4294 /* Character description */
4297 do_cmd_change_name();
4302 /*** System Commands ***/
4304 /* Hack -- User interface */
4311 /* Single line from a pref file */
4320 do_cmd_reload_autopick();
4326 do_cmd_edit_autopick();
4330 /* Interact with macros */
4337 /* Interact with visuals */
4345 /* Interact with colors */
4353 /* Interact with options */
4357 (void)combine_and_reorder_home(STORE_HOME);
4362 /*** Misc Commands ***/
4378 /* Repeat level feeling */
4385 /* Show previous message */
4388 do_cmd_message_one();
4392 /* Show previous messages */
4395 do_cmd_messages(old_now_message);
4399 /* Show quest status -KMW- */
4402 do_cmd_checkquest();
4406 /* Redraw the screen */
4409 now_message = old_now_message;
4414 #ifndef VERIFY_SAVEFILE
4416 /* Hack -- Save and don't quit */
4419 do_cmd_save_game(FALSE);
4423 #endif /* VERIFY_SAVEFILE */
4433 case SPECIAL_KEY_QUIT:
4435 do_cmd_save_and_exit();
4439 /* Quit (commit suicide) */
4452 /* Check artifacts, uniques, objects */
4459 /* Load "screen dump" */
4462 do_cmd_load_screen();
4466 /* Save "screen dump" */
4469 do_cmd_save_screen();
4473 /* Record/stop "Movie" */
4476 prepare_movie_hooks();
4480 /* Make random artifact list */
4483 spoil_random_artifact("randifact.txt");
4490 if (!p_ptr->wild_mode) do_cmd_travel();
4491 if (p_ptr->special_defense & KATA_MUSOU)
4493 set_action(ACTION_NONE);
4499 /* Hack -- Unknown command */
4502 if (flush_failure) flush();
4506 sound(SOUND_ILLEGAL);
4507 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4512 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4518 if (!p_ptr->energy_use && !now_message)
4519 now_message = old_now_message;
4523 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4526 static void pack_overflow(void)
4528 if (inventory[INVEN_PACK].k_idx)
4530 GAME_TEXT o_name[MAX_NLEN];
4533 /* Is auto-destroy done? */
4534 update_creature(p_ptr);
4535 if (!inventory[INVEN_PACK].k_idx) return;
4537 /* Access the slot to be dropped */
4538 o_ptr = &inventory[INVEN_PACK];
4540 disturb(FALSE, TRUE);
4543 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4544 object_desc(o_name, o_ptr, 0);
4546 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4548 /* Drop it (carefully) near the player */
4549 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4551 /* Modify, Describe, Optimize */
4552 inven_item_increase(INVEN_PACK, -255);
4553 inven_item_describe(INVEN_PACK);
4554 inven_item_optimize(INVEN_PACK);
4561 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4564 static void process_upkeep_with_speed(void)
4566 /* Give the player some energy */
4567 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4569 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4572 /* No current_world_ptr->game_turn yet */
4573 if (p_ptr->enchant_energy_need > 0) return;
4575 while (p_ptr->enchant_energy_need <= 0)
4577 /* Handle the player song */
4578 if (!load) check_music();
4580 /* Hex - Handle the hex spells */
4581 if (!load) check_hex();
4582 if (!load) revenge_spell();
4584 /* There is some randomness of needed energy */
4585 p_ptr->enchant_energy_need += ENERGY_NEED();
4590 * @brief プレイヤーの行動処理 / Process the player
4593 * Notice the annoying code to handle "pack overflow", which\n
4594 * must come first just in case somebody manages to corrupt\n
4595 * the savefiles by clever use of menu commands or something.\n
4597 static void process_player(void)
4601 /*** Apply energy ***/
4605 msg_print(_("何か変わった気がする!", "You feel different!"));
4607 (void)gain_mutation(p_ptr, 0);
4608 hack_mutation = FALSE;
4611 if (invoking_midnight_curse)
4614 activate_ty_curse(FALSE, &count);
4615 invoking_midnight_curse = FALSE;
4618 if (p_ptr->inside_battle)
4620 for(m_idx = 1; m_idx < m_max; m_idx++)
4622 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4624 if (!monster_is_valid(m_ptr)) continue;
4626 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4627 update_monster(m_idx, FALSE);
4632 /* Give the player some energy */
4633 else if (!(load && p_ptr->energy_need <= 0))
4635 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4638 /* No current_world_ptr->game_turn yet */
4639 if (p_ptr->energy_need > 0) return;
4640 if (!command_rep) prt_time();
4642 /*** Check for interupts ***/
4644 /* Complete resting */
4645 if (p_ptr->resting < 0)
4648 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4651 if ((p_ptr->chp == p_ptr->mhp) &&
4652 (p_ptr->csp >= p_ptr->msp))
4654 set_action(ACTION_NONE);
4658 /* Complete resting */
4659 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4662 if ((p_ptr->chp == p_ptr->mhp) &&
4663 (p_ptr->csp >= p_ptr->msp) &&
4664 !p_ptr->blind && !p_ptr->confused &&
4665 !p_ptr->poisoned && !p_ptr->afraid &&
4666 !p_ptr->stun && !p_ptr->cut &&
4667 !p_ptr->slow && !p_ptr->paralyzed &&
4668 !p_ptr->image && !p_ptr->word_recall &&
4669 !p_ptr->alter_reality)
4671 set_action(ACTION_NONE);
4676 if (p_ptr->action == ACTION_FISH)
4678 Term_xtra(TERM_XTRA_DELAY, 10);
4682 bool success = FALSE;
4683 get_mon_num_prep(monster_is_fishing_target,NULL);
4684 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);
4686 if (r_idx && one_in_(2))
4689 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4690 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4691 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4693 GAME_TEXT m_name[MAX_NLEN];
4694 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4695 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4701 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4703 disturb(FALSE, TRUE);
4707 /* Handle "abort" */
4710 /* Check for "player abort" (semi-efficiently for resting) */
4711 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4716 /* Check for a key */
4719 flush(); /* Flush input */
4721 disturb(FALSE, TRUE);
4723 /* Hack -- Show a Message */
4724 msg_print(_("中断しました。", "Canceled."));
4729 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4731 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4732 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4734 if (MON_CSLEEP(m_ptr))
4736 GAME_TEXT m_name[MAX_NLEN];
4739 (void)set_monster_csleep(p_ptr->riding, 0);
4740 monster_desc(m_name, m_ptr, 0);
4741 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4744 if (MON_STUNNED(m_ptr))
4746 /* Hack -- Recover from stun */
4747 if (set_monster_stunned(p_ptr->riding,
4748 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4750 GAME_TEXT m_name[MAX_NLEN];
4751 monster_desc(m_name, m_ptr, 0);
4752 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4756 if (MON_CONFUSED(m_ptr))
4758 /* Hack -- Recover from confusion */
4759 if (set_monster_confused(p_ptr->riding,
4760 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4762 GAME_TEXT m_name[MAX_NLEN];
4763 monster_desc(m_name, m_ptr, 0);
4764 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4768 if (MON_MONFEAR(m_ptr))
4770 /* Hack -- Recover from fear */
4771 if(set_monster_monfear(p_ptr->riding,
4772 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4774 GAME_TEXT m_name[MAX_NLEN];
4775 monster_desc(m_name, m_ptr, 0);
4776 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4786 if (p_ptr->lightspeed)
4788 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4790 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4792 if(P_PTR_KI < 40) P_PTR_KI = 0;
4793 else P_PTR_KI -= 40;
4794 p_ptr->update |= (PU_BONUS);
4796 if (p_ptr->action == ACTION_LEARN)
4799 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4801 /* Convert the unit (1/2^16) to (1/2^32) */
4802 s64b_LSHIFT(cost, cost_frac, 16);
4804 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4808 p_ptr->csp_frac = 0;
4809 set_action(ACTION_NONE);
4814 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4816 p_ptr->redraw |= PR_MANA;
4819 if (p_ptr->special_defense & KATA_MASK)
4821 if (p_ptr->special_defense & KATA_MUSOU)
4825 set_action(ACTION_NONE);
4830 p_ptr->redraw |= (PR_MANA);
4835 /*** Handle actual user input ***/
4837 /* Repeat until out of energy */
4838 while (p_ptr->energy_need <= 0)
4840 p_ptr->window |= PW_PLAYER;
4841 p_ptr->sutemi = FALSE;
4842 p_ptr->counter = FALSE;
4843 p_ptr->now_damaged = FALSE;
4847 /* Place the cursor on the player */
4848 move_cursor_relative(p_ptr->y, p_ptr->x);
4850 /* Refresh (optional) */
4851 if (fresh_before) Term_fresh();
4853 /* Hack -- Pack Overflow */
4856 /* Hack -- cancel "lurking browse mode" */
4857 if (!command_new) command_see = FALSE;
4859 /* Assume free current_world_ptr->game_turn */
4862 if (p_ptr->inside_battle)
4864 /* Place the cursor on the player */
4865 move_cursor_relative(p_ptr->y, p_ptr->x);
4867 command_cmd = SPECIAL_KEY_BUILDING;
4869 /* Process the command */
4873 /* Paralyzed or Knocked Out */
4874 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4876 take_turn(p_ptr, 100);
4880 else if (p_ptr->action == ACTION_REST)
4883 if (p_ptr->resting > 0)
4885 /* Reduce rest count */
4888 if (!p_ptr->resting) set_action(ACTION_NONE);
4889 p_ptr->redraw |= (PR_STATE);
4892 take_turn(p_ptr, 100);
4896 else if (p_ptr->action == ACTION_FISH)
4898 take_turn(p_ptr, 100);
4910 else if (travel.run)
4917 /* Repeated command */
4918 else if (command_rep)
4920 /* Count this execution */
4923 p_ptr->redraw |= (PR_STATE);
4926 /* Hack -- Assume messages were seen */
4929 /* Clear the top line */
4932 /* Process the command */
4936 /* Normal command */
4939 /* Place the cursor on the player */
4940 move_cursor_relative(p_ptr->y, p_ptr->x);
4943 /* Get a command (normal) */
4944 request_command(FALSE);
4947 /* Process the command */
4951 /* Hack -- Pack Overflow */
4957 if (p_ptr->energy_use)
4959 /* Use some energy */
4960 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4962 /* The Randomness is irrelevant */
4963 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4967 /* There is some randomness of needed energy */
4968 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4971 /* Hack -- constant hallucination */
4972 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4975 /* Shimmer monsters if needed */
4976 if (shimmer_monsters)
4978 /* Clear the flag */
4979 shimmer_monsters = FALSE;
4981 /* Shimmer multi-hued monsters */
4982 for (m_idx = 1; m_idx < m_max; m_idx++)
4984 monster_type *m_ptr;
4985 monster_race *r_ptr;
4987 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4988 if (!monster_is_valid(m_ptr)) continue;
4990 /* Skip unseen monsters */
4991 if (!m_ptr->ml) continue;
4993 /* Access the monster race */
4994 r_ptr = &r_info[m_ptr->ap_r_idx];
4996 /* Skip non-multi-hued monsters */
4997 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
5000 /* Reset the flag */
5001 shimmer_monsters = TRUE;
5003 /* Redraw regardless */
5004 lite_spot(m_ptr->fy, m_ptr->fx);
5009 /* Handle monster detection */
5010 if (repair_monsters)
5012 /* Reset the flag */
5013 repair_monsters = FALSE;
5015 /* Rotate detection flags */
5016 for (m_idx = 1; m_idx < m_max; m_idx++)
5018 monster_type *m_ptr;
5019 m_ptr = ¤t_floor_ptr->m_list[m_idx];
5020 if (!monster_is_valid(m_ptr)) continue;
5022 /* Nice monsters get mean */
5023 if (m_ptr->mflag & MFLAG_NICE)
5025 /* Nice monsters get mean */
5026 m_ptr->mflag &= ~(MFLAG_NICE);
5029 /* Handle memorized monsters */
5030 if (m_ptr->mflag2 & MFLAG2_MARK)
5032 /* Maintain detection */
5033 if (m_ptr->mflag2 & MFLAG2_SHOW)
5036 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
5038 /* Still need repairs */
5039 repair_monsters = TRUE;
5042 /* Remove detection */
5046 m_ptr->mflag2 &= ~(MFLAG2_MARK);
5048 /* Assume invisible */
5050 update_monster(m_idx, FALSE);
5052 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
5053 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
5055 /* Redraw regardless */
5056 lite_spot(m_ptr->fy, m_ptr->fx);
5061 if (p_ptr->pclass == CLASS_IMITATOR)
5064 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5067 for (j = 0; j < p_ptr->mane_num; j++)
5069 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
5070 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
5074 p_ptr->redraw |= (PR_IMITATION);
5076 if (p_ptr->action == ACTION_LEARN)
5079 p_ptr->redraw |= (PR_STATE);
5082 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
5085 p_ptr->redraw |= (PR_MAP);
5086 p_ptr->update |= (PU_MONSTERS);
5087 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5089 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
5091 p_ptr->timewalk = FALSE;
5092 p_ptr->energy_need = ENERGY_NEED();
5098 /* Hack -- notice death */
5099 if (!p_ptr->playing || p_ptr->is_dead)
5101 p_ptr->timewalk = FALSE;
5106 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
5108 /* Handle "leaving" */
5109 if (p_ptr->leaving) break;
5112 /* Update scent trail */
5117 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
5121 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
5122 * ゲームを終了するかのいずれかまでループする。
5125 * This function will not exit until the level is completed,\n
5126 * the user dies, or the game is terminated.\n
5129 static void dungeon(bool load_game)
5133 /* Set the base level */
5134 current_floor_ptr->base_level = current_floor_ptr->dun_level;
5136 /* Reset various flags */
5137 is_loading_now = FALSE;
5140 p_ptr->leaving = FALSE;
5142 /* Reset the "command" vars */
5145 #if 0 /* Don't reset here --- It's used for Arena */
5154 /* Cancel the target */
5158 p_ptr->ambush_flag = FALSE;
5160 /* Cancel the health bar */
5163 /* Check visual effects */
5164 shimmer_monsters = TRUE;
5165 shimmer_objects = TRUE;
5166 repair_monsters = TRUE;
5167 repair_objects = TRUE;
5170 disturb(TRUE, TRUE);
5172 /* Get index of current quest (if any) */
5173 quest_num = quest_number(current_floor_ptr->dun_level);
5175 /* Inside a quest? */
5178 /* Mark the quest monster */
5179 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
5182 /* Track maximum player level */
5183 if (p_ptr->max_plv < p_ptr->lev)
5185 p_ptr->max_plv = p_ptr->lev;
5189 /* Track maximum dungeon level (if not in quest -KMW-) */
5190 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
5192 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
5193 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
5196 (void)calculate_upkeep();
5198 /* Validate the panel */
5199 panel_bounds_center();
5201 /* Verify the panel */
5207 /* Enter "xtra" mode */
5208 character_xtra = TRUE;
5210 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5211 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5212 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);
5216 /* Leave "xtra" mode */
5217 character_xtra = FALSE;
5219 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5220 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5224 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5225 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5226 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5228 if (p_ptr->inside_battle)
5232 p_ptr->energy_need = 0;
5237 msg_print(_("試合開始!", "Ready..Fight!"));
5242 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5243 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5245 /* Hack -- notice death or departure */
5246 if (!p_ptr->playing || p_ptr->is_dead) return;
5248 /* Print quest message if appropriate */
5249 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5251 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5252 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5254 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5256 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5258 msg_format("この階には%sの主である%sが棲んでいる。",
5259 d_name+d_info[p_ptr->dungeon_idx].name,
5260 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5262 msg_format("%^s lives in this level as the keeper of %s.",
5263 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5264 d_name+d_info[p_ptr->dungeon_idx].name);
5268 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5270 /*** Process this dungeon level ***/
5272 /* Reset the monster generation level */
5273 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5275 /* Reset the object generation level */
5276 current_floor_ptr->object_level = current_floor_ptr->base_level;
5278 is_loading_now = TRUE;
5280 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5281 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5282 p_ptr->energy_need = 0;
5284 /* Not leaving dungeon */
5285 p_ptr->leaving_dungeon = FALSE;
5287 /* Initialize monster process */
5293 /* Hack -- Compact the monster list occasionally */
5294 if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5296 /* Hack -- Compress the monster list occasionally */
5297 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5300 /* Hack -- Compact the object list occasionally */
5301 if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5303 /* Hack -- Compress the object list occasionally */
5304 if (o_cnt + 32 < o_max) compact_objects(0);
5306 /* Process the player */
5308 process_upkeep_with_speed();
5312 /* Hack -- Hilite the player */
5313 move_cursor_relative(p_ptr->y, p_ptr->x);
5315 /* Optional fresh */
5316 if (fresh_after) Term_fresh();
5318 /* Hack -- Notice death or departure */
5319 if (!p_ptr->playing || p_ptr->is_dead) break;
5321 /* Process all of the monsters */
5326 /* Hack -- Hilite the player */
5327 move_cursor_relative(p_ptr->y, p_ptr->x);
5329 /* Optional fresh */
5330 if (fresh_after) Term_fresh();
5332 /* Hack -- Notice death or departure */
5333 if (!p_ptr->playing || p_ptr->is_dead) break;
5335 /* Process the world */
5340 /* Hack -- Hilite the player */
5341 move_cursor_relative(p_ptr->y, p_ptr->x);
5343 /* Optional fresh */
5344 if (fresh_after) Term_fresh();
5346 /* Hack -- Notice death or departure */
5347 if (!p_ptr->playing || p_ptr->is_dead) break;
5349 /* Count game turns */
5350 current_world_ptr->game_turn++;
5352 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5354 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5355 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5358 prevent_turn_overflow();
5360 /* Handle "leaving" */
5361 if (p_ptr->leaving) break;
5363 if (wild_regen) wild_regen--;
5366 /* Inside a quest and non-unique questor? */
5367 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5369 /* Un-mark the quest monster */
5370 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5373 /* Not save-and-quit and not dead? */
5374 if (p_ptr->playing && !p_ptr->is_dead)
5377 * Maintain Unique monsters and artifact, save current
5378 * floor, then prepare next floor
5382 /* Forget the flag */
5383 reinit_wilderness = FALSE;
5386 /* Write about current level on the play record once per level */
5392 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5395 * Modified by Arcum Dagsson to support
5396 * separate macro files for different realms.
5398 static void load_all_pref_files(void)
5402 /* Access the "user" pref file */
5403 sprintf(buf, "user.prf");
5405 /* Process that file */
5406 process_pref_file(buf);
5408 /* Access the "user" system pref file */
5409 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5411 /* Process that file */
5412 process_pref_file(buf);
5414 /* Access the "race" pref file */
5415 sprintf(buf, "%s.prf", rp_ptr->title);
5417 /* Process that file */
5418 process_pref_file(buf);
5420 /* Access the "class" pref file */
5421 sprintf(buf, "%s.prf", cp_ptr->title);
5423 /* Process that file */
5424 process_pref_file(buf);
5426 /* Access the "character" pref file */
5427 sprintf(buf, "%s.prf", player_base);
5429 /* Process that file */
5430 process_pref_file(buf);
5432 /* Access the "realm 1" pref file */
5433 if (p_ptr->realm1 != REALM_NONE)
5435 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5437 /* Process that file */
5438 process_pref_file(buf);
5441 /* Access the "realm 2" pref file */
5442 if (p_ptr->realm2 != REALM_NONE)
5444 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5446 /* Process that file */
5447 process_pref_file(buf);
5451 /* Load an autopick preference file */
5452 autopick_load_pref(FALSE);
5457 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
5460 void extract_option_vars(void)
5464 for (i = 0; option_info[i].o_desc; i++)
5466 int os = option_info[i].o_set;
5467 int ob = option_info[i].o_bit;
5469 /* Set the "default" options */
5470 if (option_info[i].o_var)
5473 if (option_flag[os] & (1L << ob))
5476 (*option_info[i].o_var) = TRUE;
5483 (*option_info[i].o_var) = FALSE;
5491 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
5494 void determine_bounty_uniques(void)
5498 monster_race *r_ptr;
5500 get_mon_num_prep(NULL, NULL);
5501 for (i = 0; i < MAX_KUBI; i++)
5505 current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
5506 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
5508 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5510 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
5512 if (r_ptr->rarity > 100) continue;
5514 if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
5516 for (j = 0; j < i; j++)
5517 if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
5524 for (i = 0; i < MAX_KUBI - 1; i++)
5526 for (j = i; j < MAX_KUBI; j++)
5528 if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
5530 tmp = current_world_ptr->bounty_r_idx[i];
5531 current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
5532 current_world_ptr->bounty_r_idx[j] = tmp;
5540 * @brief 今日の賞金首を確定する / Determine today's bounty monster
5542 * @note conv_old is used if loaded 0.0.3 or older save file
5544 void determine_today_mon(bool conv_old)
5547 bool old_inside_battle = p_ptr->inside_battle;
5548 monster_race *r_ptr;
5552 for (i = 0; i < max_d_idx; i++)
5554 if (max_dlv[i] < d_info[i].mindepth) continue;
5555 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
5558 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
5560 p_ptr->inside_battle = TRUE;
5561 get_mon_num_prep(NULL, NULL);
5565 today_mon = get_mon_num(max_dl);
5566 r_ptr = &r_info[today_mon];
5568 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5569 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
5570 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
5571 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
5572 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
5573 if (r_ptr->rarity > 10) continue;
5577 p_ptr->today_mon = 0;
5578 p_ptr->inside_battle = old_inside_battle;
5582 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5585 * If the "new_game" parameter is true, then, after loading the
5586 * savefile, we will commit suicide, if necessary, to allow the
5587 * player to start a new game.
5589 void play_game(bool new_game)
5592 bool load_game = TRUE;
5593 bool init_random_seed = FALSE;
5603 else if (chuukei_server)
5605 prepare_chuukei_hooks();
5616 hack_mutation = FALSE;
5618 /* Hack -- Character is "icky" */
5619 character_icky = TRUE;
5621 /* Make sure main term is active */
5622 Term_activate(angband_term[0]);
5624 /* Initialise the resize hooks */
5625 angband_term[0]->resize_hook = resize_map;
5627 for (i = 1; i < 8; i++)
5629 /* Does the term exist? */
5630 if (angband_term[i])
5632 /* Add the redraw on resize hook */
5633 angband_term[i]->resize_hook = redraw_window;
5637 /* Hack -- current_world_ptr->game_turn off the cursor */
5638 (void)Term_set_cursor(0);
5641 /* Attempt to load */
5644 quit(_("セーブファイルが壊れています", "broken savefile"));
5647 /* Extract the options */
5648 extract_option_vars();
5650 /* Report waited score */
5651 if (p_ptr->wait_report_score)
5656 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5659 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5660 update_creature(p_ptr);
5662 p_ptr->is_dead = TRUE;
5664 start_time = (u32b)time(NULL);
5666 /* No suspending now */
5667 signals_ignore_tstp();
5669 /* Hack -- Character is now "icky" */
5670 character_icky = TRUE;
5672 /* Build the filename */
5673 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5675 /* Open the high score file, for reading/writing */
5676 highscore_fd = fd_open(buf, O_RDWR);
5678 /* 町名消失バグ対策(#38205) Init the wilderness */
5679 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5681 /* Handle score, show Top scores */
5682 success = send_world_score(TRUE);
5684 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5686 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5691 p_ptr->wait_report_score = FALSE;
5693 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5695 /* Shut the high score file */
5696 (void)fd_close(highscore_fd);
5698 /* Forget the high score fd */
5701 /* Allow suspending now */
5702 signals_handle_tstp();
5707 creating_savefile = new_game;
5709 /* Nothing loaded */
5710 if (!character_loaded)
5712 /* Make new player */
5715 /* The dungeon is not ready */
5716 character_dungeon = FALSE;
5718 /* Prepare to init the RNG */
5719 init_random_seed = TRUE;
5721 /* Initialize the saved floors data */
5722 init_saved_floors(FALSE);
5725 /* Old game is loaded. But new game is requested. */
5728 /* Initialize the saved floors data */
5729 init_saved_floors(TRUE);
5732 /* Process old character */
5735 /* Process the player name */
5736 process_player_name(FALSE);
5740 if (init_random_seed)
5745 /* Roll new character */
5748 /* The dungeon is not ready */
5749 character_dungeon = FALSE;
5752 current_floor_ptr->dun_level = 0;
5753 p_ptr->inside_quest = 0;
5754 p_ptr->inside_arena = FALSE;
5755 p_ptr->inside_battle = FALSE;
5759 /* Hack -- seed for flavors */
5760 seed_flavor = randint0(0x10000000);
5762 /* Hack -- seed for town layout */
5763 seed_town = randint0(0x10000000);
5765 /* Roll up a new character */
5773 determine_bounty_uniques();
5774 determine_today_mon(FALSE);
5776 /* Initialize object array */
5781 write_level = FALSE;
5783 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5785 " ---- Restart Game ----"));
5788 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5789 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5791 if (p_ptr->riding == -1)
5794 for (i = m_max; i > 0; i--)
5796 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5805 creating_savefile = FALSE;
5807 p_ptr->teleport_town = FALSE;
5808 p_ptr->sutemi = FALSE;
5809 current_world_ptr->timewalk_m_idx = 0;
5810 p_ptr->now_damaged = FALSE;
5812 start_time = time(NULL) - 1;
5813 record_o_name[0] = '\0';
5815 /* Reset map panel */
5816 panel_row_min = current_floor_ptr->height;
5817 panel_col_min = current_floor_ptr->width;
5819 /* Sexy gal gets bonus to maximum weapon skill of whip */
5820 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5821 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5823 /* Fill the arrays of floors and walls in the good proportions */
5824 set_floor_and_wall(p_ptr->dungeon_idx);
5826 /* Flavor the objects */
5829 /* Flash a message */
5830 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5832 /* Flush the message */
5836 /* Hack -- Enter wizard mode */
5839 if (enter_wizard_mode())
5841 p_ptr->wizard = TRUE;
5843 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5845 /* Initialize the saved floors data */
5846 init_saved_floors(TRUE);
5849 p_ptr->inside_quest = 0;
5851 /* Avoid crash in update_view() */
5852 p_ptr->y = p_ptr->x = 10;
5855 else if (p_ptr->is_dead)
5857 quit("Already dead.");
5861 /* Initialize the town-buildings if necessary */
5862 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5864 /* Init the wilderness */
5866 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5869 init_flags = INIT_ONLY_BUILDINGS;
5871 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5873 select_floor_music();
5877 /* Generate a dungeon level if needed */
5878 if (!character_dungeon)
5885 /* HACK -- Restore from panic-save */
5886 if (p_ptr->panic_save)
5888 /* No player? -- Try to regenerate floor */
5889 if (!p_ptr->y || !p_ptr->x)
5891 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5895 /* Still no player? -- Try to locate random place */
5896 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5898 /* No longer in panic */
5899 p_ptr->panic_save = 0;
5903 /* Character is now "complete" */
5904 character_generated = TRUE;
5907 /* Hack -- Character is no longer "icky" */
5908 character_icky = FALSE;
5914 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5915 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5920 p_ptr->playing = TRUE;
5922 /* Reset the visual mappings */
5925 /* Load the "pref" files */
5926 load_all_pref_files();
5928 /* Give startup outfit (after loading pref files) */
5934 /* React to changes */
5935 Term_xtra(TERM_XTRA_REACT, 0);
5937 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5938 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5941 /* Set or clear "rogue_like_commands" if requested */
5942 if (arg_force_original) rogue_like_commands = FALSE;
5943 if (arg_force_roguelike) rogue_like_commands = TRUE;
5945 /* Hack -- Enforce "delayed death" */
5946 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5948 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5950 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5952 monster_type *m_ptr;
5953 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5954 monster_race *r_ptr = &r_info[pet_r_idx];
5955 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5956 (PM_FORCE_PET | PM_NO_KAGE));
5957 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5958 m_ptr->mspeed = r_ptr->speed;
5959 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5960 m_ptr->max_maxhp = m_ptr->maxhp;
5961 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5962 m_ptr->dealt_damage = 0;
5963 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5966 (void)combine_and_reorder_home(STORE_HOME);
5967 (void)combine_and_reorder_home(STORE_MUSEUM);
5969 select_floor_music();
5974 /* Process the level */
5977 /* Hack -- prevent "icky" message */
5978 character_xtra = TRUE;
5982 character_xtra = FALSE;
5984 /* Cancel the target */
5987 /* Cancel the health bar */
5994 /* Handle "quit and save" */
5995 if (!p_ptr->playing && !p_ptr->is_dead) break;
5997 /* Erase the old current_floor_ptr->grid_array */
5999 if (!p_ptr->is_dead) wipe_m_list();
6006 /* Accidental Death */
6007 if (p_ptr->playing && p_ptr->is_dead)
6009 if (p_ptr->inside_arena)
6011 p_ptr->inside_arena = FALSE;
6012 if (p_ptr->arena_number > MAX_ARENA_MONS)
6013 p_ptr->arena_number++;
6015 p_ptr->arena_number = -1 - p_ptr->arena_number;
6016 p_ptr->is_dead = FALSE;
6018 p_ptr->chp_frac = 0;
6019 p_ptr->exit_bldg = TRUE;
6022 /* Leave through the exit */
6023 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
6025 /* prepare next floor */
6030 /* Mega-Hack -- Allow player to cheat death */
6031 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
6038 /* Handle "death" */
6039 if (p_ptr->is_dead) break;
6041 /* Make a new level */
6053 * @brief ゲームターンからの実時間換算を行うための補正をかける
6054 * @param hoge ゲームターン
6055 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
6056 * @return 修正をかけた後のゲームターン
6058 s32b turn_real(s32b hoge)
6060 switch (p_ptr->start_race)
6066 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
6073 * @brief ターンのオーバーフローに対する対処
6074 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
6075 * @return 修正をかけた後のゲームターン
6077 void prevent_turn_overflow(void)
6079 int rollback_days, i, j;
6080 s32b rollback_turns;
6082 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
6084 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
6085 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
6087 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
6088 else current_world_ptr->game_turn = 1;
6089 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
6090 else current_floor_ptr->generated_turn = 1;
6091 if (old_battle > rollback_turns) old_battle -= rollback_turns;
6092 else old_battle = 1;
6093 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
6094 else p_ptr->feeling_turn = 1;
6096 for (i = 1; i < max_towns; i++)
6098 for (j = 0; j < MAX_STORES; j++)
6100 store_type *st_ptr = &town_info[i].store[j];
6102 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
6104 st_ptr->last_visit -= rollback_turns;
6105 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
6108 if (st_ptr->store_open)
6110 st_ptr->store_open -= rollback_turns;
6111 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
6119 * Close up the current game (player may or may not be dead)
6123 * This function is called only from "main.c" and "signals.c".
6126 void close_game(void)
6129 bool do_send = TRUE;
6131 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
6134 /* Flush the messages */
6137 /* Flush the input */
6141 /* No suspending now */
6142 signals_ignore_tstp();
6145 /* Hack -- Character is now "icky" */
6146 character_icky = TRUE;
6149 /* Build the filename */
6150 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6152 /* Grab permissions */
6155 /* Open the high score file, for reading/writing */
6156 highscore_fd = fd_open(buf, O_RDWR);
6158 /* Drop permissions */
6164 /* Handle retirement */
6165 if (p_ptr->total_winner) kingly();
6168 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
6170 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
6172 else do_send = FALSE;
6179 /* Show more info */
6185 if ((!send_world_score(do_send)))
6187 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
6188 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
6190 p_ptr->wait_report_score = TRUE;
6191 p_ptr->is_dead = FALSE;
6192 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
6195 if (!p_ptr->wait_report_score)
6198 else if (highscore_fd >= 0)
6200 display_scores_aux(0, 10, -1, NULL);
6203 /* Dump bones file */
6212 do_cmd_save_game(FALSE);
6214 /* Prompt for scores */
6215 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
6216 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
6218 /* Predict score (or ESCAPE) */
6219 if (inkey() != ESCAPE) predict_score();
6223 /* Shut the high score file */
6224 (void)fd_close(highscore_fd);
6226 /* Forget the high score fd */
6229 /* Kill all temporal files */
6230 clear_saved_floor_files();
6232 /* Allow suspending now */
6233 signals_handle_tstp();