3 @brief Angbandゲームエンジン / Angband game engine
6 Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 This software may be copied and distributed for educational, research, and\n
8 not for profit purposes provided that this copyright and statement are\n
9 included in all such copies.\n
10 2013 Deskull rearranged comment for Doxygen.
14 #include "cmd-activate.h"
16 #include "cmd-hissatsu.h"
18 #include "cmd-magiceat.h"
20 #include "cmd-quaff.h"
22 #include "cmd-smith.h"
23 #include "cmd-usestaff.h"
24 #include "cmd-zaprod.h"
25 #include "cmd-zapwand.h"
28 #include "floor-events.h"
29 #include "object-curse.h"
31 #include "spells-summon.h"
32 #include "spells-object.h"
33 #include "spells-status.h"
34 #include "spells-floor.h"
35 #include "monsterrace-hook.h"
41 #include "player-move.h"
42 #include "player-status.h"
43 #include "cmd-spell.h"
44 #include "realm-hex.h"
45 #include "object-hook.h"
47 #include "monster-status.h"
48 #include "floor-save.h"
51 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
52 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
55 * @brief 擬似鑑定を実際に行い判定を反映する
56 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
57 * @param heavy 重度の擬似鑑定を行うならばTRUE
60 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
63 object_type *o_ptr = &inventory[slot];
64 GAME_TEXT o_name[MAX_NLEN];
66 /* We know about it already, do not tell us again */
67 if (o_ptr->ident & (IDENT_SENSE))return;
69 /* It is fully known, no information needed */
70 if (object_is_known(o_ptr)) return;
72 /* Check for a feeling */
73 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
75 /* Skip non-feelings */
79 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
90 feel = FEEL_EXCELLENT;
96 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
103 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
109 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
116 feel = FEEL_WORTHLESS;
121 feel = FEEL_TERRIBLE;
127 /* Stop everything */
128 if (disturb_minor) disturb(FALSE, FALSE);
130 /* Get an object description */
131 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
133 /* Message (equipment) */
134 if (slot >= INVEN_RARM)
137 msg_format("%s%s(%c)は%sという感じがする...",
138 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
140 msg_format("You feel the %s (%c) you are %s %s %s...",
141 o_name, index_to_label(slot), describe_use(slot),
142 ((o_ptr->number == 1) ? "is" : "are"),
143 game_inscriptions[feel]);
148 /* Message (inventory) */
152 msg_format("ザックの中の%s(%c)は%sという感じがする...",
153 o_name, index_to_label(slot),game_inscriptions[feel]);
155 msg_format("You feel the %s (%c) in your pack %s %s...",
156 o_name, index_to_label(slot),
157 ((o_ptr->number == 1) ? "is" : "are"),
158 game_inscriptions[feel]);
163 o_ptr->ident |= (IDENT_SENSE);
165 /* Set the "inscription" */
166 o_ptr->feeling = feel;
168 /* Auto-inscription/destroy */
169 autopick_alter_item(slot, destroy_feeling);
170 p_ptr->update |= (PU_COMBINE | PU_REORDER);
172 p_ptr->window |= (PW_INVEN | PW_EQUIP);
178 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
181 * Sense the inventory\n
183 * Class 0 = Warrior --> fast and heavy\n
184 * Class 1 = Mage --> slow and light\n
185 * Class 2 = Priest --> fast but light\n
186 * Class 3 = Rogue --> okay and heavy\n
187 * Class 4 = Ranger --> slow but heavy (changed!)\n
188 * Class 5 = Paladin --> slow but heavy\n
190 static void sense_inventory1(void)
193 PLAYER_LEVEL plev = p_ptr->lev;
198 /*** Check for "sensing" ***/
200 /* No sensing when confused */
201 if (p_ptr->confused) return;
203 /* Analyze the class */
204 switch (p_ptr->pclass)
212 if (0 != randint0(9000L / (plev * plev + 40))) return;
223 if (0 != randint0(6000L / (plev * plev + 50))) return;
232 case CLASS_HIGH_MAGE:
234 case CLASS_MAGIC_EATER:
236 /* Very bad (light) sensing */
237 if (0 != randint0(240000L / (plev + 5))) return;
245 /* Good (light) sensing */
246 if (0 != randint0(10000L / (plev * plev + 40))) return;
255 if (0 != randint0(20000L / (plev * plev + 40))) return;
266 if (0 != randint0(95000L / (plev * plev + 40))) return;
278 if (0 != randint0(77777L / (plev * plev + 40))) return;
286 case CLASS_WARRIOR_MAGE:
290 if (0 != randint0(75000L / (plev * plev + 40))) return;
295 case CLASS_MINDCRAFTER:
297 case CLASS_BLUE_MAGE:
298 case CLASS_MIRROR_MASTER:
301 if (0 != randint0(55000L / (plev * plev + 40))) return;
306 case CLASS_CHAOS_WARRIOR:
309 if (0 != randint0(80000L / (plev * plev + 40))) return;
318 case CLASS_FORCETRAINER:
321 if (0 != randint0(20000L / (plev * plev + 40))) return;
329 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
337 case CLASS_BEASTMASTER:
340 if (0 != randint0(65000L / (plev * plev + 40))) return;
344 case CLASS_BERSERKER:
353 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
355 /*** Sense everything ***/
357 /* Check everything */
358 for (i = 0; i < INVEN_TOTAL; i++)
362 o_ptr = &inventory[i];
364 /* Skip empty slots */
365 if (!o_ptr->k_idx) continue;
367 /* Valid "tval" codes */
394 /* Skip non-sense machines */
397 /* Occasional failure on inventory items */
398 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
401 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
406 sense_inventory_aux(i, heavy);
411 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
414 static void sense_inventory2(void)
417 PLAYER_LEVEL plev = p_ptr->lev;
421 /*** Check for "sensing" ***/
423 /* No sensing when confused */
424 if (p_ptr->confused) return;
426 /* Analyze the class */
427 switch (p_ptr->pclass)
433 case CLASS_BERSERKER:
441 case CLASS_CHAOS_WARRIOR:
443 case CLASS_BEASTMASTER:
446 /* Very bad (light) sensing */
447 if (0 != randint0(240000L / (plev + 5))) return;
453 case CLASS_WARRIOR_MAGE:
458 if (0 != randint0(95000L / (plev * plev + 40))) return;
466 case CLASS_FORCETRAINER:
467 case CLASS_MINDCRAFTER:
470 if (0 != randint0(20000L / (plev * plev + 40))) return;
476 case CLASS_HIGH_MAGE:
478 case CLASS_MAGIC_EATER:
479 case CLASS_MIRROR_MASTER:
480 case CLASS_BLUE_MAGE:
483 if (0 != randint0(9000L / (plev * plev + 40))) return;
491 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
497 /*** Sense everything ***/
499 /* Check everything */
500 for (i = 0; i < INVEN_TOTAL; i++)
504 o_ptr = &inventory[i];
506 /* Skip empty slots */
507 if (!o_ptr->k_idx) continue;
509 /* Valid "tval" codes */
522 /* Skip non-sense machines */
525 /* Occasional failure on inventory items */
526 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
528 sense_inventory_aux(i, TRUE);
533 * @brief パターン終点到達時のテレポート処理を行う
536 static void pattern_teleport(void)
539 DEPTH max_level = 99;
542 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
547 /* Only downward in ironman mode */
548 if (ironman_downward)
549 min_level = current_floor_ptr->dun_level;
552 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
554 if (current_floor_ptr->dun_level > 100)
555 max_level = MAX_DEPTH - 1;
556 else if (current_floor_ptr->dun_level == 100)
561 max_level = d_info[p_ptr->dungeon_idx].maxdepth;
562 min_level = d_info[p_ptr->dungeon_idx].mindepth;
566 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
569 sprintf(tmp_val, "%d", (int)current_floor_ptr->dun_level);
571 /* Ask for a level */
572 if (!get_string(ppp, tmp_val, 10)) return;
574 /* Extract request */
575 command_arg = (COMMAND_ARG)atoi(tmp_val);
577 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
579 teleport_player(200, 0L);
586 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
587 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
590 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
592 if (autosave_l) do_cmd_save_game(TRUE);
595 current_floor_ptr->dun_level = command_arg;
599 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE, 0, NULL);
601 p_ptr->inside_quest = 0;
605 * Clear all saved floors
606 * and create a first saved floor
608 prepare_change_floor_mode(CFM_FIRST_FLOOR);
609 p_ptr->leaving = TRUE;
613 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
614 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
616 static bool pattern_effect(void)
620 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
622 if ((prace_is_(RACE_AMBERITE)) &&
623 (p_ptr->cut > 0) && one_in_(10))
628 pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
630 switch (pattern_type)
632 case PATTERN_TILE_END:
634 (void)restore_all_status();
635 (void)restore_level();
636 (void)cure_critical_wounds(1000);
638 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
639 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
642 * We could make the healing effect of the
643 * Pattern center one-time only to avoid various kinds
644 * of abuse, like luring the win monster into fighting you
645 * in the middle of the pattern...
649 case PATTERN_TILE_OLD:
653 case PATTERN_TILE_TELEPORT:
657 case PATTERN_TILE_WRECKED:
659 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
663 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
665 else if (!IS_INVULN())
666 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
675 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
676 * @param percent 回復比率
679 static void regenhp(int percent)
685 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
686 if (p_ptr->action == ACTION_HAYAGAKE) return;
688 /* Save the old hitpoints */
689 old_chp = p_ptr->chp;
692 * Extract the new hitpoints
694 * 'percent' is the Regen factor in unit (1/2^16)
697 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
699 /* Convert the unit (1/2^16) to (1/2^32) */
700 s64b_LSHIFT(new_chp, new_chp_frac, 16);
703 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
707 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
709 p_ptr->chp = p_ptr->mhp;
714 if (old_chp != p_ptr->chp)
716 p_ptr->redraw |= (PR_HP);
717 p_ptr->window |= (PW_PLAYER);
724 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
725 * @param upkeep_factor ペット維持によるMPコスト量
726 * @param regen_amount 回復量
729 static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount)
731 MANA_POINT old_csp = p_ptr->csp;
732 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
735 * Excess mana will decay 32 times faster than normal
738 if (p_ptr->csp > p_ptr->msp)
740 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
742 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
744 /* Convert the unit (1/2^16) to (1/2^32) */
745 s64b_LSHIFT(decay, decay_frac, 16);
748 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
751 if (p_ptr->csp < p_ptr->msp)
753 p_ptr->csp = p_ptr->msp;
758 /* Regenerating mana (unless the player has excess mana) */
759 else if (regen_rate > 0)
761 /* (percent/100) is the Regen factor in unit (1/2^16) */
762 MANA_POINT new_mana = 0;
763 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
765 /* Convert the unit (1/2^16) to (1/2^32) */
766 s64b_LSHIFT(new_mana, new_mana_frac, 16);
769 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
771 /* Must set frac to zero even if equal */
772 if (p_ptr->csp >= p_ptr->msp)
774 p_ptr->csp = p_ptr->msp;
780 /* Reduce mana (even when the player has excess mana) */
783 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
784 s32b reduce_mana = 0;
785 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
787 /* Convert the unit (1/2^16) to (1/2^32) */
788 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
791 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
801 if (old_csp != p_ptr->csp)
803 p_ptr->redraw |= (PR_MANA);
804 p_ptr->window |= (PW_PLAYER);
805 p_ptr->window |= (PW_SPELL);
811 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
812 * @param regen_amount 回復量
815 static void regenmagic(int regen_amount)
820 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
822 for (i = 0; i < EATER_EXT*2; i++)
824 if (!p_ptr->magic_num2[i]) continue;
825 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
827 /* Increase remaining charge number like float value */
828 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
829 p_ptr->magic_num1[i] += new_mana;
831 /* Check maximum charge */
832 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
834 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
838 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
840 if (!p_ptr->magic_num1[i]) continue;
841 if (!p_ptr->magic_num2[i]) continue;
843 /* Decrease remaining period for charging */
844 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
845 / (dev * 16 * PY_REGEN_NORMAL);
846 p_ptr->magic_num1[i] -= new_mana;
848 /* Check minimum remaining period for charging */
849 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
856 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
858 * @note Should probably be done during monster turns.
860 static void regen_monsters(void)
865 /* Regenerate everyone */
866 for (i = 1; i < m_max; i++)
868 /* Check the i'th monster */
869 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
870 monster_race *r_ptr = &r_info[m_ptr->r_idx];
872 if (!monster_is_valid(m_ptr)) continue;
874 /* Allow regeneration (if needed) */
875 if (m_ptr->hp < m_ptr->maxhp)
877 /* Hack -- Base regeneration */
878 frac = m_ptr->maxhp / 100;
880 /* Hack -- Minimal regeneration rate */
881 if (!frac) if (one_in_(2)) frac = 1;
883 /* Hack -- Some monsters regenerate quickly */
884 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
886 /* Hack -- Regenerate */
889 /* Do not over-regenerate */
890 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
892 /* Redraw (later) if needed */
893 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
894 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
901 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
903 * @note Should probably be done during monster turns.
905 static void regen_captured_monsters(void)
910 /* Regenerate everyone */
911 for (i = 0; i < INVEN_TOTAL; i++)
914 object_type *o_ptr = &inventory[i];
916 if (!o_ptr->k_idx) continue;
917 if (o_ptr->tval != TV_CAPTURE) continue;
918 if (!o_ptr->pval) continue;
922 r_ptr = &r_info[o_ptr->pval];
924 /* Allow regeneration (if needed) */
925 if (o_ptr->xtra4 < o_ptr->xtra5)
927 /* Hack -- Base regeneration */
928 frac = o_ptr->xtra5 / 100;
930 /* Hack -- Minimal regeneration rate */
931 if (!frac) if (one_in_(2)) frac = 1;
933 /* Hack -- Some monsters regenerate quickly */
934 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
936 /* Hack -- Regenerate */
937 o_ptr->xtra4 += (XTRA16)frac;
939 /* Do not over-regenerate */
940 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
947 p_ptr->update |= (PU_COMBINE);
948 p_ptr->window |= (PW_INVEN);
949 p_ptr->window |= (PW_EQUIP);
955 * @brief 寿命つき光源の警告メッセージ処理
956 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
959 static void notice_lite_change(object_type *o_ptr)
961 /* Hack -- notice interesting fuel steps */
962 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
964 p_ptr->window |= (PW_EQUIP);
967 /* Hack -- Special treatment when blind */
970 /* Hack -- save some light for later */
971 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
974 /* The light is now out */
975 else if (o_ptr->xtra4 == 0)
977 disturb(FALSE, TRUE);
978 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
980 /* Recalculate torch radius */
981 p_ptr->update |= (PU_TORCH);
983 /* Some ego light lose its effects without fuel */
984 p_ptr->update |= (PU_BONUS);
987 /* The light is getting dim */
988 else if (o_ptr->name2 == EGO_LITE_LONG)
990 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
991 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
993 if (disturb_minor) disturb(FALSE, TRUE);
994 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
998 /* The light is getting dim */
999 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1001 if (disturb_minor) disturb(FALSE, TRUE);
1002 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1008 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1009 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1012 static void recharged_notice(object_type *o_ptr)
1014 GAME_TEXT o_name[MAX_NLEN];
1018 /* No inscription */
1019 if (!o_ptr->inscription) return;
1022 s = my_strchr(quark_str(o_ptr->inscription), '!');
1024 /* Process notification request. */
1027 /* Find another '!' */
1030 /* Describe (briefly) */
1031 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1033 /* Notify the player */
1035 msg_format("%sは再充填された。", o_name);
1037 if (o_ptr->number > 1)
1038 msg_format("Your %s are recharged.", o_name);
1040 msg_format("Your %s is recharged.", o_name);
1043 disturb(FALSE, FALSE);
1049 /* Keep looking for '!'s */
1050 s = my_strchr(s + 1, '!');
1055 * @brief プレイヤーの歌に関する継続処理
1058 static void check_music(void)
1060 const magic_type *s_ptr;
1062 MANA_POINT need_mana;
1063 u32b need_mana_frac;
1065 /* Music singed by player */
1066 if (p_ptr->pclass != CLASS_BARD) return;
1067 if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return;
1069 if (p_ptr->anti_magic)
1071 stop_singing(p_ptr);
1075 spell = SINGING_SONG_ID(p_ptr);
1076 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1078 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1082 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1084 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1086 stop_singing(p_ptr);
1091 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1093 p_ptr->redraw |= PR_MANA;
1094 if (INTERUPTING_SONG_EFFECT(p_ptr))
1096 SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr);
1097 INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
1098 msg_print(_("歌を再開した。", "You restart singing."));
1099 p_ptr->action = ACTION_SING;
1100 p_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1101 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1102 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1105 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1106 p_ptr->spell_exp[spell] += 5;
1107 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1108 { 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; }
1109 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1110 { 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; }
1111 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1112 { 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; }
1114 /* Do any effects of continual song */
1115 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1119 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1120 * @param flag 探し出したい呪いフラグ配列
1121 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1124 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1127 int choices[INVEN_TOTAL-INVEN_RARM];
1130 /* Paranoia -- Player has no warning-item */
1131 if (!(p_ptr->cursed & flag)) return NULL;
1133 /* Search Inventry */
1134 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1136 object_type *o_ptr = &inventory[i];
1138 if (o_ptr->curse_flags & flag)
1140 choices[number] = i;
1143 else if ((flag == TRC_ADD_L_CURSE) ||
1144 (flag == TRC_ADD_H_CURSE) ||
1145 (flag == TRC_DRAIN_HP) ||
1146 (flag == TRC_DRAIN_MANA) ||
1147 (flag == TRC_CALL_ANIMAL) ||
1148 (flag == TRC_CALL_DEMON) ||
1149 (flag == TRC_CALL_DRAGON) ||
1150 (flag == TRC_CALL_UNDEAD) ||
1151 (flag == TRC_COWARDICE) ||
1152 (flag == TRC_LOW_MELEE) ||
1153 (flag == TRC_LOW_AC) ||
1154 (flag == TRC_LOW_MAGIC) ||
1155 (flag == TRC_FAST_DIGEST) ||
1156 (flag == TRC_SLOW_REGEN) )
1159 BIT_FLAGS flgs[TR_FLAG_SIZE];
1160 object_flags(o_ptr, flgs);
1163 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1164 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1165 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1166 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1167 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1168 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1169 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1170 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1171 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1172 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1173 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1174 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1175 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1176 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1179 if (have_flag(flgs, cf))
1181 choices[number] = i;
1187 /* Choice one of them */
1188 return (&inventory[choices[randint0(number)]]);
1191 static void process_world_aux_digestion(void)
1193 if (!p_ptr->inside_battle)
1195 /* Digest quickly when gorged */
1196 if (p_ptr->food >= PY_FOOD_MAX)
1198 /* Digest a lot of food */
1199 (void)set_food(p_ptr->food - 100);
1202 /* Digest normally -- Every 50 game turns */
1203 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1205 /* Basic digestion rate based on speed */
1206 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
1208 /* Regeneration takes more food */
1209 if (p_ptr->regenerate)
1211 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1213 if (p_ptr->cursed & TRC_FAST_DIGEST)
1216 /* Slow digestion takes less food */
1217 if (p_ptr->slow_digest)
1220 /* Minimal digestion */
1221 if (digestion < 1) digestion = 1;
1222 /* Maximal digestion */
1223 if (digestion > 100) digestion = 100;
1225 /* Digest some food */
1226 (void)set_food(p_ptr->food - digestion);
1231 if ((p_ptr->food < PY_FOOD_FAINT))
1233 /* Faint occasionally */
1234 if (!p_ptr->paralyzed && (randint0(100) < 10))
1236 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1237 disturb(TRUE, TRUE);
1239 /* Hack -- faint (bypass free action) */
1240 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
1243 /* Starve to death (slowly) */
1244 if (p_ptr->food < PY_FOOD_STARVE)
1246 /* Calculate damage */
1247 HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
1249 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1256 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1257 * / Handle timed damage and regeneration every 10 game turns
1260 static void process_world_aux_hp_and_sp(void)
1262 feature_type *f_ptr = &f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat];
1263 bool cave_no_regen = FALSE;
1264 int upkeep_factor = 0;
1266 /* Default regeneration */
1267 int regen_amount = PY_REGEN_NORMAL;
1270 /*** Damage over Time ***/
1272 /* Take damage from poison */
1273 if (p_ptr->poisoned && !IS_INVULN())
1275 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1278 /* Take damage from cuts */
1279 if (p_ptr->cut && !IS_INVULN())
1283 /* Mortal wound or Deep Gash */
1284 if (p_ptr->cut > 1000)
1289 else if (p_ptr->cut > 200)
1295 else if (p_ptr->cut > 100)
1300 else if (p_ptr->cut > 50)
1305 else if (p_ptr->cut > 25)
1310 else if (p_ptr->cut > 10)
1321 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1324 /* (Vampires) Take damage from sunlight */
1325 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1327 if (!current_floor_ptr->dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1329 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1331 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1332 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1333 cave_no_regen = TRUE;
1337 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1338 !p_ptr->resist_lite)
1340 object_type * o_ptr = &inventory[INVEN_LITE];
1341 GAME_TEXT o_name [MAX_NLEN];
1342 char ouch [MAX_NLEN+40];
1344 /* Get an object description */
1345 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1346 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1348 cave_no_regen = TRUE;
1350 /* Get an object description */
1351 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1352 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1354 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1358 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1362 if (have_flag(f_ptr->flags, FF_DEEP))
1364 damage = 6000 + randint0(4000);
1366 else if (!p_ptr->levitation)
1368 damage = 3000 + randint0(2000);
1373 if(prace_is_(RACE_ENT)) damage += damage / 3;
1374 if(p_ptr->resist_fire) damage = damage / 3;
1375 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1376 if(p_ptr->levitation) damage = damage / 5;
1378 damage = damage / 100 + (randint0(100) < (damage % 100));
1380 if (p_ptr->levitation)
1382 msg_print(_("熱で火傷した!", "The heat burns you!"));
1383 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1384 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1388 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1389 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1390 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1393 cave_no_regen = TRUE;
1397 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold)
1401 if (have_flag(f_ptr->flags, FF_DEEP))
1403 damage = 6000 + randint0(4000);
1405 else if (!p_ptr->levitation)
1407 damage = 3000 + randint0(2000);
1412 if (p_ptr->resist_cold) damage = damage / 3;
1413 if (IS_OPPOSE_COLD()) damage = damage / 3;
1414 if (p_ptr->levitation) damage = damage / 5;
1416 damage = damage / 100 + (randint0(100) < (damage % 100));
1418 if (p_ptr->levitation)
1420 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1421 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1422 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1426 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1427 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1428 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1431 cave_no_regen = TRUE;
1435 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec)
1439 if (have_flag(f_ptr->flags, FF_DEEP))
1441 damage = 6000 + randint0(4000);
1443 else if (!p_ptr->levitation)
1445 damage = 3000 + randint0(2000);
1450 if (p_ptr->resist_elec) damage = damage / 3;
1451 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1452 if (p_ptr->levitation) damage = damage / 5;
1454 damage = damage / 100 + (randint0(100) < (damage % 100));
1456 if (p_ptr->levitation)
1458 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1459 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1460 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1464 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1465 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1466 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1469 cave_no_regen = TRUE;
1473 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid)
1477 if (have_flag(f_ptr->flags, FF_DEEP))
1479 damage = 6000 + randint0(4000);
1481 else if (!p_ptr->levitation)
1483 damage = 3000 + randint0(2000);
1488 if (p_ptr->resist_acid) damage = damage / 3;
1489 if (IS_OPPOSE_ACID()) damage = damage / 3;
1490 if (p_ptr->levitation) damage = damage / 5;
1492 damage = damage / 100 + (randint0(100) < (damage % 100));
1494 if (p_ptr->levitation)
1496 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1497 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1498 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1502 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1503 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1504 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1507 cave_no_regen = TRUE;
1511 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1515 if (have_flag(f_ptr->flags, FF_DEEP))
1517 damage = 6000 + randint0(4000);
1519 else if (!p_ptr->levitation)
1521 damage = 3000 + randint0(2000);
1526 if (p_ptr->resist_pois) damage = damage / 3;
1527 if (IS_OPPOSE_POIS()) damage = damage / 3;
1528 if (p_ptr->levitation) damage = damage / 5;
1530 damage = damage / 100 + (randint0(100) < (damage % 100));
1532 if (p_ptr->levitation)
1534 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1535 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1536 f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name), -1);
1537 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1);
1541 concptr name = f_name + f_info[get_feat_mimic(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])].name;
1542 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1543 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1544 if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3);
1547 cave_no_regen = TRUE;
1551 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1552 !p_ptr->levitation && !p_ptr->can_swim && !p_ptr->resist_water)
1554 if (p_ptr->total_weight > weight_limit())
1556 msg_print(_("溺れている!", "You are drowning!"));
1557 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1558 cave_no_regen = TRUE;
1565 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1567 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1568 if (prace_is_(RACE_ENT)) damage += damage / 3;
1569 if (p_ptr->resist_fire) damage = damage / 3;
1570 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1571 msg_print(_("熱い!", "It's hot!"));
1572 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1574 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1576 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1577 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1578 if (p_ptr->resist_elec) damage = damage / 3;
1579 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1580 msg_print(_("痛い!", "It hurts!"));
1581 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1583 if ((r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1585 damage = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level / 2;
1586 if (p_ptr->resist_cold) damage = damage / 3;
1587 if (IS_OPPOSE_COLD()) damage = damage / 3;
1588 msg_print(_("冷たい!", "It's cold!"));
1589 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1593 /* Spectres -- take damage when moving through walls */
1595 * Added: ANYBODY takes damage if inside through walls
1596 * without wraith form -- NOTE: Spectres will never be
1597 * reduced below 0 hp by being inside a stone wall; others
1600 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1602 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1605 cave_no_regen = TRUE;
1607 if (p_ptr->pass_wall)
1609 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1610 dam_desc = _("密度", "density");
1614 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1615 dam_desc = _("硬い岩", "solid rock");
1618 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1623 /*** handle regeneration ***/
1626 if (p_ptr->food < PY_FOOD_WEAK)
1628 /* Lower regeneration */
1629 if (p_ptr->food < PY_FOOD_STARVE)
1633 else if (p_ptr->food < PY_FOOD_FAINT)
1635 regen_amount = PY_REGEN_FAINT;
1639 regen_amount = PY_REGEN_WEAK;
1643 /* Are we walking the pattern? */
1644 if (pattern_effect())
1646 cave_no_regen = TRUE;
1650 /* Regeneration ability */
1651 if (p_ptr->regenerate)
1653 regen_amount = regen_amount * 2;
1655 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1659 if (p_ptr->cursed & TRC_SLOW_REGEN)
1666 /* Searching or Resting */
1667 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1669 regen_amount = regen_amount * 2;
1672 upkeep_factor = calculate_upkeep();
1674 /* No regeneration while special action */
1675 if ((p_ptr->action == ACTION_LEARN) ||
1676 (p_ptr->action == ACTION_HAYAGAKE) ||
1677 (p_ptr->special_defense & KATA_KOUKIJIN))
1679 upkeep_factor += 100;
1682 /* Regenerate the mana */
1683 regenmana(upkeep_factor, regen_amount);
1686 /* Recharge magic eater's power */
1687 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1689 regenmagic(regen_amount);
1692 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1694 while (upkeep_factor > 100)
1696 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1698 do_cmd_pet_dismiss();
1700 upkeep_factor = calculate_upkeep();
1702 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1707 /* Poisoned or cut yields no healing */
1708 if (p_ptr->poisoned) regen_amount = 0;
1709 if (p_ptr->cut) regen_amount = 0;
1711 /* Special floor -- Pattern, in a wall -- yields no healing */
1712 if (cave_no_regen) regen_amount = 0;
1714 regen_amount = (regen_amount * p_ptr->mutant_regenerate_mod) / 100;
1716 /* Regenerate Hit Points if needed */
1717 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1719 regenhp(regen_amount);
1724 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1725 * / Handle timeout every 10 game turns
1728 static void process_world_aux_timeout(void)
1730 const int dec_count = (easy_band ? 2 : 1);
1732 /*** Timeout Various Things ***/
1735 if (p_ptr->tim_mimic)
1737 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1740 /* Hack -- Hallucinating */
1743 (void)set_image(p_ptr->image - dec_count);
1749 (void)set_blind(p_ptr->blind - dec_count);
1752 /* Times see-invisible */
1753 if (p_ptr->tim_invis)
1755 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1766 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1769 /* Timed temporary elemental brands. -LM- */
1770 if (p_ptr->ele_attack)
1772 p_ptr->ele_attack--;
1774 /* Clear all temporary elemental brands. */
1775 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1778 /* Timed temporary elemental immune. -LM- */
1779 if (p_ptr->ele_immune)
1781 p_ptr->ele_immune--;
1783 /* Clear all temporary elemental brands. */
1784 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1787 /* Timed infra-vision */
1788 if (p_ptr->tim_infra)
1790 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1794 if (p_ptr->tim_stealth)
1796 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1799 /* Timed levitation */
1800 if (p_ptr->tim_levitation)
1802 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1805 /* Timed sh_touki */
1806 if (p_ptr->tim_sh_touki)
1808 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1812 if (p_ptr->tim_sh_fire)
1814 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1818 if (p_ptr->tim_sh_holy)
1820 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1824 if (p_ptr->tim_eyeeye)
1826 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1829 /* Timed resist-magic */
1830 if (p_ptr->resist_magic)
1832 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1835 /* Timed regeneration */
1836 if (p_ptr->tim_regen)
1838 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1841 /* Timed resist nether */
1842 if (p_ptr->tim_res_nether)
1844 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1847 /* Timed resist time */
1848 if (p_ptr->tim_res_time)
1850 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1854 if (p_ptr->tim_reflect)
1856 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1860 if (p_ptr->multishadow)
1862 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1865 /* Timed Robe of dust */
1866 if (p_ptr->dustrobe)
1868 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
1871 /* Timed infra-vision */
1872 if (p_ptr->kabenuke)
1874 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
1878 if (p_ptr->paralyzed)
1880 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
1884 if (p_ptr->confused)
1886 (void)set_confused(p_ptr->confused - dec_count);
1892 (void)set_afraid(p_ptr->afraid - dec_count);
1898 (void)set_fast(p_ptr->fast - 1, TRUE);
1904 (void)set_slow(p_ptr->slow - dec_count, TRUE);
1907 /* Protection from evil */
1908 if (p_ptr->protevil)
1910 (void)set_protevil(p_ptr->protevil - 1, TRUE);
1913 /* Invulnerability */
1916 (void)set_invuln(p_ptr->invuln - 1, TRUE);
1920 if (p_ptr->wraith_form)
1922 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
1928 (void)set_hero(p_ptr->hero - 1, TRUE);
1934 (void)set_shero(p_ptr->shero - 1, TRUE);
1940 (void)set_blessed(p_ptr->blessed - 1, TRUE);
1946 (void)set_shield(p_ptr->shield - 1, TRUE);
1950 if (p_ptr->tsubureru)
1952 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
1956 if (p_ptr->magicdef)
1958 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
1962 if (p_ptr->tsuyoshi)
1964 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
1968 if (p_ptr->oppose_acid)
1970 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
1973 /* Oppose Lightning */
1974 if (p_ptr->oppose_elec)
1976 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
1980 if (p_ptr->oppose_fire)
1982 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
1986 if (p_ptr->oppose_cold)
1988 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
1992 if (p_ptr->oppose_pois)
1994 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
1999 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2002 /*** Poison and Stun and Cut ***/
2005 if (p_ptr->poisoned)
2007 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2009 /* Apply some healing */
2010 (void)set_poisoned(p_ptr->poisoned - adjust);
2016 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2018 /* Apply some healing */
2019 (void)set_stun(p_ptr->stun - adjust);
2025 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2027 /* Hack -- Truly "mortal" wound */
2028 if (p_ptr->cut > 1000) adjust = 0;
2030 /* Apply some healing */
2031 (void)set_cut(p_ptr->cut - adjust);
2037 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2038 * / Handle burning fuel every 10 game turns
2041 static void process_world_aux_light(void)
2043 /* Check for light being wielded */
2044 object_type *o_ptr = &inventory[INVEN_LITE];
2046 /* Burn some fuel in the current lite */
2047 if (o_ptr->tval == TV_LITE)
2049 /* Hack -- Use some fuel (except on artifacts) */
2050 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2052 /* Decrease life-span */
2053 if (o_ptr->name2 == EGO_LITE_LONG)
2055 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2057 else o_ptr->xtra4--;
2059 /* Notice interesting fuel steps */
2060 notice_lite_change(o_ptr);
2067 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2068 * / Handle mutation effects once every 10 game turns
2071 static void process_world_aux_mutation(void)
2073 /* No mutation with effects */
2074 if (!p_ptr->muta2) return;
2076 /* No effect on monster arena */
2077 if (p_ptr->inside_battle) return;
2079 /* No effect on the global map */
2080 if (p_ptr->wild_mode) return;
2082 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2084 disturb(FALSE, TRUE);
2085 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2086 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2087 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2088 (void)set_afraid(0);
2091 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2093 if (!p_ptr->resist_fear)
2095 disturb(FALSE, TRUE);
2096 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2097 set_afraid(p_ptr->afraid + 13 + randint1(26));
2101 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2103 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele)
2105 disturb(FALSE, TRUE);
2106 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2108 teleport_player(40, TELEPORT_PASSIVE);
2112 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2114 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2116 disturb(FALSE, TRUE);
2117 p_ptr->redraw |= PR_EXTRA;
2118 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2121 if (!p_ptr->resist_conf)
2123 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2126 if (!p_ptr->resist_chaos)
2131 if (one_in_(3)) lose_all_info();
2133 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2135 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2136 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2142 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2143 (void)set_image(p_ptr->image + randint0(150) + 150);
2149 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2151 if (!p_ptr->resist_chaos)
2153 disturb(FALSE, TRUE);
2154 p_ptr->redraw |= PR_EXTRA;
2155 (void)set_image(p_ptr->image + randint0(50) + 20);
2159 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2161 disturb(FALSE, TRUE);
2162 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2164 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2167 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2168 !p_ptr->anti_magic && one_in_(9000))
2171 disturb(FALSE, TRUE);
2172 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2173 "Magical energy flows through you! You must release it!"));
2177 (void)get_hack_dir(&dire);
2178 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2181 if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666))
2183 bool pet = one_in_(6);
2184 BIT_FLAGS mode = PM_ALLOW_GROUP;
2186 if (pet) mode |= PM_FORCE_PET;
2187 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2189 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, mode, '\0'))
2191 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2192 disturb(FALSE, TRUE);
2196 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2198 disturb(FALSE, TRUE);
2201 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2203 if (p_ptr->fast > 0)
2209 set_slow(randint1(30) + 10, FALSE);
2214 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2216 if (p_ptr->slow > 0)
2222 set_fast(randint1(30) + 10, FALSE);
2227 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2229 disturb(FALSE, TRUE);
2230 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2232 banish_monsters(100);
2233 if (!current_floor_ptr->dun_level && p_ptr->town_num)
2237 /* Pick a random shop (except home) */
2240 n = randint0(MAX_STORES);
2242 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2244 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2250 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2254 msg_print(_("影につつまれた。", "A shadow passes over you."));
2257 /* Absorb light from the current possition */
2258 if ((current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2263 o_ptr = &inventory[INVEN_LITE];
2265 /* Absorb some fuel in the current lite */
2266 if (o_ptr->tval == TV_LITE)
2268 /* Use some fuel (except on artifacts) */
2269 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2271 /* Heal the player a bit */
2272 hp_player(o_ptr->xtra4 / 20);
2274 /* Decrease life-span of lite */
2276 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2278 /* Notice interesting fuel steps */
2279 notice_lite_change(o_ptr);
2284 * Unlite the area (radius 10) around player and
2285 * do 50 points damage to every affected monster
2287 unlite_area(50, 10);
2290 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000))
2292 bool pet = one_in_(3);
2293 BIT_FLAGS mode = PM_ALLOW_GROUP;
2295 if (pet) mode |= PM_FORCE_PET;
2296 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2298 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_ANIMAL, mode, '\0'))
2300 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2301 disturb(FALSE, TRUE);
2305 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000))
2307 disturb(FALSE, TRUE);
2308 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2311 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2313 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2315 if (!lose_mutation(0))
2316 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2318 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2320 disturb(FALSE, TRUE);
2321 msg_print(_("非物質化した!", "You feel insubstantial!"));
2324 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2326 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2330 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2332 int which_stat = randint0(A_MAX);
2333 int sustained = FALSE;
2338 if (p_ptr->sustain_str) sustained = TRUE;
2341 if (p_ptr->sustain_int) sustained = TRUE;
2344 if (p_ptr->sustain_wis) sustained = TRUE;
2347 if (p_ptr->sustain_dex) sustained = TRUE;
2350 if (p_ptr->sustain_con) sustained = TRUE;
2353 if (p_ptr->sustain_chr) sustained = TRUE;
2356 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2362 disturb(FALSE, TRUE);
2363 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2365 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2368 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000))
2370 bool pet = one_in_(5);
2371 BIT_FLAGS mode = PM_ALLOW_GROUP;
2373 if (pet) mode |= PM_FORCE_PET;
2374 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2376 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON, mode, '\0'))
2378 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2379 disturb(FALSE, TRUE);
2382 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000))
2384 if (p_ptr->tim_esp > 0)
2386 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2387 set_tim_esp(0, TRUE);
2391 msg_print(_("精神が広がった!", "Your mind expands!"));
2392 set_tim_esp(p_ptr->lev, FALSE);
2395 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000))
2397 disturb(FALSE, TRUE);
2398 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2400 set_food(PY_FOOD_WEAK);
2401 if (music_singing_any()) stop_singing(p_ptr);
2402 if (hex_spelling_any()) stop_hex_spell_all();
2405 if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2410 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2412 int danger_amount = 0;
2413 MONSTER_IDX monster;
2415 for (monster = 0; monster < m_max; monster++)
2417 monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
2418 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2419 if (!monster_is_valid(m_ptr)) continue;
2421 if (r_ptr->level >= p_ptr->lev)
2423 danger_amount += r_ptr->level - p_ptr->lev + 1;
2427 if (danger_amount > 100)
2428 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2429 else if (danger_amount > 50)
2430 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2431 else if (danger_amount > 20)
2432 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2433 else if (danger_amount > 10)
2434 msg_print(_("心配な気がする!", "You feel paranoid!"));
2435 else if (danger_amount > 5)
2436 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2438 msg_print(_("寂しい気がする。", "You feel lonely."));
2441 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000))
2443 disturb(FALSE, TRUE);
2444 msg_print(_("無敵な気がする!", "You feel invincible!"));
2446 (void)set_invuln(randint1(8) + 8, FALSE);
2449 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2451 MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp);
2455 HIT_POINT healing = p_ptr->csp;
2456 if (healing > wounds) healing = wounds;
2459 p_ptr->csp -= healing;
2460 p_ptr->redraw |= (PR_HP | PR_MANA);
2464 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000))
2466 HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp);
2470 HIT_POINT healing = p_ptr->chp;
2471 if (healing > wounds) healing = wounds;
2473 p_ptr->csp += healing;
2474 p_ptr->redraw |= (PR_HP | PR_MANA);
2475 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2479 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2481 INVENTORY_IDX slot = 0;
2482 object_type *o_ptr = NULL;
2484 disturb(FALSE, TRUE);
2485 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2486 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2489 if (has_melee_weapon(INVEN_RARM))
2492 o_ptr = &inventory[INVEN_RARM];
2494 if (has_melee_weapon(INVEN_LARM) && one_in_(2))
2496 o_ptr = &inventory[INVEN_LARM];
2500 else if (has_melee_weapon(INVEN_LARM))
2502 o_ptr = &inventory[INVEN_LARM];
2505 if (slot && !object_is_cursed(o_ptr))
2507 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2508 inven_drop(slot, 1);
2515 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2516 * / Handle curse effects once every 10 game turns
2519 static void process_world_aux_curse(void)
2521 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2524 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2525 * can actually be useful!
2527 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2529 GAME_TEXT o_name[MAX_NLEN];
2531 int i, i_keep = 0, count = 0;
2533 /* Scan the equipment with random teleport ability */
2534 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2536 BIT_FLAGS flgs[TR_FLAG_SIZE];
2537 o_ptr = &inventory[i];
2539 /* Skip non-objects */
2540 if (!o_ptr->k_idx) continue;
2542 /* Extract the item flags */
2543 object_flags(o_ptr, flgs);
2545 if (have_flag(flgs, TR_TELEPORT))
2547 /* {.} will stop random teleportation. */
2548 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2551 if (one_in_(count)) i_keep = i;
2556 o_ptr = &inventory[i_keep];
2557 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2558 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2559 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2561 disturb(FALSE, TRUE);
2562 teleport_player(50, 0L);
2566 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2567 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2568 disturb(TRUE, TRUE);
2571 /* Make a chainsword noise */
2572 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2575 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2577 disturb(FALSE, FALSE);
2580 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2583 (void)activate_ty_curse(FALSE, &count);
2585 /* Handle experience draining */
2586 if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2588 p_ptr->exp -= (p_ptr->lev + 1) / 2;
2589 if (p_ptr->exp < 0) p_ptr->exp = 0;
2590 p_ptr->max_exp -= (p_ptr->lev + 1) / 2;
2591 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2594 /* Add light curse (Later) */
2595 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2597 BIT_FLAGS new_curse;
2600 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2602 new_curse = get_curse(0, o_ptr);
2603 if (!(o_ptr->curse_flags & new_curse))
2605 GAME_TEXT o_name[MAX_NLEN];
2607 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2609 o_ptr->curse_flags |= new_curse;
2610 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2612 o_ptr->feeling = FEEL_NONE;
2614 p_ptr->update |= (PU_BONUS);
2617 /* Add heavy curse (Later) */
2618 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2620 BIT_FLAGS new_curse;
2623 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2625 new_curse = get_curse(1, o_ptr);
2626 if (!(o_ptr->curse_flags & new_curse))
2628 GAME_TEXT o_name[MAX_NLEN];
2630 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2632 o_ptr->curse_flags |= new_curse;
2633 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2634 o_ptr->feeling = FEEL_NONE;
2636 p_ptr->update |= (PU_BONUS);
2640 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2642 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'))
2644 GAME_TEXT o_name[MAX_NLEN];
2646 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2647 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2648 disturb(FALSE, TRUE);
2652 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2654 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'))
2656 GAME_TEXT o_name[MAX_NLEN];
2658 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2659 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2660 disturb(FALSE, TRUE);
2664 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2666 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DRAGON,
2667 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2669 GAME_TEXT o_name[MAX_NLEN];
2671 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2672 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2673 disturb(FALSE, TRUE);
2677 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2679 if (summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD,
2680 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0'))
2682 GAME_TEXT o_name[MAX_NLEN];
2684 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2685 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2686 disturb(FALSE, TRUE);
2689 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2691 if (!p_ptr->resist_fear)
2693 disturb(FALSE, TRUE);
2694 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2695 set_afraid(p_ptr->afraid + 13 + randint1(26));
2698 /* Teleport player */
2699 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2701 disturb(FALSE, TRUE);
2703 /* Teleport player */
2704 teleport_player(40, TELEPORT_PASSIVE);
2706 /* Handle HP draining */
2707 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2709 GAME_TEXT o_name[MAX_NLEN];
2711 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2712 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2713 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2715 /* Handle mana draining */
2716 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2718 GAME_TEXT o_name[MAX_NLEN];
2720 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2721 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2722 p_ptr->csp -= MIN(p_ptr->lev, 50);
2726 p_ptr->csp_frac = 0;
2728 p_ptr->redraw |= PR_MANA;
2732 /* Rarely, take damage from the Jewel of Judgement */
2733 if (one_in_(999) && !p_ptr->anti_magic)
2735 object_type *o_ptr = &inventory[INVEN_LITE];
2737 if (o_ptr->name1 == ART_JUDGE)
2739 if (object_is_known(o_ptr))
2740 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2742 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2743 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2750 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2751 * / Handle recharging objects once every 10 game turns
2754 static void process_world_aux_recharge(void)
2759 /* Process equipment */
2760 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2762 /* Get the object */
2763 object_type *o_ptr = &inventory[i];
2765 /* Skip non-objects */
2766 if (!o_ptr->k_idx) continue;
2768 /* Recharge activatable objects */
2769 if (o_ptr->timeout > 0)
2774 /* Notice changes */
2775 if (!o_ptr->timeout)
2777 recharged_notice(o_ptr);
2783 /* Notice changes */
2786 p_ptr->window |= (PW_EQUIP);
2791 * Recharge rods. Rods now use timeout to control charging status,
2792 * and each charging rod in a stack decreases the stack's timeout by
2793 * one per current_world_ptr->game_turn. -LM-
2795 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2797 object_type *o_ptr = &inventory[i];
2798 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2800 /* Skip non-objects */
2801 if (!o_ptr->k_idx) continue;
2803 /* Examine all charging rods or stacks of charging rods. */
2804 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2806 /* Determine how many rods are charging. */
2807 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2808 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2810 /* Decrease timeout by that number. */
2811 o_ptr->timeout -= temp;
2813 /* Boundary control. */
2814 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2816 /* Notice changes, provide message if object is inscribed. */
2817 if (!(o_ptr->timeout))
2819 recharged_notice(o_ptr);
2823 /* One of the stack of rod is charged */
2824 else if (o_ptr->timeout % k_ptr->pval)
2831 /* Notice changes */
2834 p_ptr->window |= (PW_INVEN);
2838 /* Process objects on floor */
2839 for (i = 1; i < o_max; i++)
2841 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
2843 /* Skip dead objects */
2844 if (!o_ptr->k_idx) continue;
2846 /* Recharge rods on the ground. No messages. */
2847 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2850 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2852 /* Boundary control. */
2853 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2860 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2861 * / Handle involuntary movement once every 10 game turns
2864 static void process_world_aux_movement(void)
2866 /* Delayed Word-of-Recall */
2867 if (p_ptr->word_recall)
2870 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2871 * The player is yanked up/down as soon as
2872 * he loads the autosaved game.
2874 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
2875 do_cmd_save_game(TRUE);
2877 /* Count down towards recall */
2878 p_ptr->word_recall--;
2880 p_ptr->redraw |= (PR_STATUS);
2882 /* Activate the recall */
2883 if (!p_ptr->word_recall)
2886 disturb(FALSE, TRUE);
2888 /* Determine the level */
2889 if (current_floor_ptr->dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
2891 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2893 if (p_ptr->dungeon_idx) p_ptr->recall_dungeon = p_ptr->dungeon_idx;
2895 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2897 current_floor_ptr->dun_level = 0;
2898 p_ptr->dungeon_idx = 0;
2900 leave_quest_check();
2901 leave_tower_check();
2903 p_ptr->inside_quest = 0;
2905 p_ptr->leaving = TRUE;
2909 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2911 p_ptr->dungeon_idx = p_ptr->recall_dungeon;
2914 do_cmd_write_nikki(NIKKI_RECALL, current_floor_ptr->dun_level, NULL);
2917 current_floor_ptr->dun_level = max_dlv[p_ptr->dungeon_idx];
2918 if (current_floor_ptr->dun_level < 1) current_floor_ptr->dun_level = 1;
2920 /* Nightmare mode makes recall more dangerous */
2921 if (ironman_nightmare && !randint0(666) && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
2923 if (current_floor_ptr->dun_level < 50)
2925 current_floor_ptr->dun_level *= 2;
2927 else if (current_floor_ptr->dun_level < 99)
2929 current_floor_ptr->dun_level = (current_floor_ptr->dun_level + 99) / 2;
2931 else if (current_floor_ptr->dun_level > 100)
2933 current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].maxdepth - 1;
2937 if (p_ptr->wild_mode)
2939 p_ptr->wilderness_y = p_ptr->y;
2940 p_ptr->wilderness_x = p_ptr->x;
2944 /* Save player position */
2945 p_ptr->oldpx = p_ptr->x;
2946 p_ptr->oldpy = p_ptr->y;
2948 p_ptr->wild_mode = FALSE;
2951 * Clear all saved floors
2952 * and create a first saved floor
2954 prepare_change_floor_mode(CFM_FIRST_FLOOR);
2955 p_ptr->leaving = TRUE;
2957 if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
2961 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2963 quest_type* const q_ptr = &quest[i];
2966 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2967 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2968 (q_ptr->level < current_floor_ptr->dun_level))
2970 q_ptr->status = QUEST_STATUS_FAILED;
2971 q_ptr->complev = (byte)p_ptr->lev;
2973 q_ptr->comptime = current_world_ptr->play_time;
2974 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2980 sound(SOUND_TPLEVEL);
2985 /* Delayed Alter reality */
2986 if (p_ptr->alter_reality)
2988 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
2989 do_cmd_save_game(TRUE);
2991 /* Count down towards alter */
2992 p_ptr->alter_reality--;
2994 p_ptr->redraw |= (PR_STATUS);
2996 /* Activate the alter reality */
2997 if (!p_ptr->alter_reality)
3000 disturb(FALSE, TRUE);
3002 /* Determine the level */
3003 if (!quest_number(current_floor_ptr->dun_level) && current_floor_ptr->dun_level)
3005 msg_print(_("世界が変わった!", "The world changes!"));
3008 * Clear all saved floors
3009 * and create a first saved floor
3011 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3012 p_ptr->leaving = TRUE;
3016 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3019 sound(SOUND_TPLEVEL);
3026 * @brief 指定したモンスターに隣接しているモンスターの数を返す。
3027 * / Count number of adjacent monsters
3028 * @param m_idx 隣接数を調べたいモンスターのID
3029 * @return 隣接しているモンスターの数
3031 static int get_monster_crowd_number(MONSTER_IDX m_idx)
3033 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
3034 POSITION my = m_ptr->fy;
3035 POSITION mx = m_ptr->fx;
3039 for (i = 0; i < 7; i++)
3041 int ay = my + ddy_ddd[i];
3042 int ax = mx + ddx_ddd[i];
3044 if (!in_bounds(ay, ax)) continue;
3046 /* Count number of monsters */
3047 if (current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++;
3056 * ダンジョンの雰囲気を計算するための非線形基準値 / Dungeon rating is no longer linear
3058 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3061 * @brief ダンジョンの雰囲気を算出する。
3062 * / Examine all monsters and unidentified objects, and get the feeling of current dungeon floor
3063 * @return 算出されたダンジョンの雰囲気ランク
3065 static byte get_dungeon_feeling(void)
3067 const int base = 10;
3071 /* Hack -- no feeling in the town */
3072 if (!current_floor_ptr->dun_level) return 0;
3074 /* Examine each monster */
3075 for (i = 1; i < m_max; i++)
3077 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
3078 monster_race *r_ptr;
3080 if (!monster_is_valid(m_ptr)) continue;
3083 if (is_pet(m_ptr)) continue;
3085 r_ptr = &r_info[m_ptr->r_idx];
3087 /* Unique monsters */
3088 if (r_ptr->flags1 & (RF1_UNIQUE))
3090 /* Nearly out-of-depth unique monsters */
3091 if (r_ptr->level + 10 > current_floor_ptr->dun_level)
3093 /* Boost rating by twice delta-depth */
3094 delta += (r_ptr->level + 10 - current_floor_ptr->dun_level) * 2 * base;
3099 /* Out-of-depth monsters */
3100 if (r_ptr->level > current_floor_ptr->dun_level)
3102 /* Boost rating by delta-depth */
3103 delta += (r_ptr->level - current_floor_ptr->dun_level) * base;
3107 /* Unusually crowded monsters get a little bit of rating boost */
3108 if (r_ptr->flags1 & RF1_FRIENDS)
3110 if (5 <= get_monster_crowd_number(i)) delta += 1;
3114 if (2 <= get_monster_crowd_number(i)) delta += 1;
3118 rating += RATING_BOOST(delta);
3121 /* Examine each unidentified object */
3122 for (i = 1; i < o_max; i++)
3124 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
3125 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3128 /* Skip dead objects */
3129 if (!o_ptr->k_idx) continue;
3131 /* Skip known objects */
3132 if (object_is_known(o_ptr))
3135 if (o_ptr->marked & OM_TOUCHED) continue;
3138 /* Skip pseudo-known objects */
3139 if (o_ptr->ident & IDENT_SENSE) continue;
3142 if (object_is_ego(o_ptr))
3144 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3146 delta += e_ptr->rating * base;
3150 if (object_is_artifact(o_ptr))
3152 PRICE cost = object_value_real(o_ptr);
3155 if (cost > 10000L) delta += 10 * base;
3156 if (cost > 50000L) delta += 10 * base;
3157 if (cost > 100000L) delta += 10 * base;
3159 /* Special feeling */
3160 if (!preserve_mode) return 1;
3163 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3164 if (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3165 if (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3166 if (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3167 if (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3168 if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_SPEED && !object_is_cursed(o_ptr)) delta += 25 * base;
3169 if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY && !object_is_cursed(o_ptr)) delta += 15 * base;
3170 if (o_ptr->tval == TV_AMULET && o_ptr->sval == SV_AMULET_THE_MAGI && !object_is_cursed(o_ptr)) delta += 15 * base;
3172 /* Out-of-depth objects */
3173 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) && k_ptr->level > current_floor_ptr->dun_level)
3175 /* Rating increase */
3176 delta += (k_ptr->level - current_floor_ptr->dun_level) * base;
3179 rating += RATING_BOOST(delta);
3183 if (rating > RATING_BOOST(1000)) return 2;
3184 if (rating > RATING_BOOST(800)) return 3;
3185 if (rating > RATING_BOOST(600)) return 4;
3186 if (rating > RATING_BOOST(400)) return 5;
3187 if (rating > RATING_BOOST(300)) return 6;
3188 if (rating > RATING_BOOST(200)) return 7;
3189 if (rating > RATING_BOOST(100)) return 8;
3190 if (rating > RATING_BOOST(0)) return 9;
3196 * @brief ダンジョンの雰囲気を更新し、変化があった場合メッセージを表示する
3197 * / Update dungeon feeling, and announce it if changed
3200 static void update_dungeon_feeling(void)
3206 /* No feeling on the surface */
3207 if (!current_floor_ptr->dun_level) return;
3209 /* No feeling in the arena */
3210 if (p_ptr->inside_battle) return;
3212 /* Extract delay time */
3213 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - current_floor_ptr->dun_level) * TURNS_PER_TICK / 100;
3215 /* Not yet felt anything */
3216 if (current_world_ptr->game_turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
3218 /* Extract quest number (if any) */
3219 quest_num = quest_number(current_floor_ptr->dun_level);
3221 /* No feeling in a quest */
3223 (is_fixed_quest_idx(quest_num) &&
3224 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
3225 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
3228 /* Get new dungeon feeling */
3229 new_feeling = get_dungeon_feeling();
3231 /* Remember last time updated */
3232 p_ptr->feeling_turn = current_world_ptr->game_turn;
3235 if (p_ptr->feeling == new_feeling) return;
3237 /* Dungeon feeling is changed */
3238 p_ptr->feeling = new_feeling;
3240 /* Announce feeling */
3243 select_floor_music();
3245 /* Update the level indicator */
3246 p_ptr->redraw |= (PR_DEPTH);
3248 if (disturb_minor) disturb(FALSE, FALSE);
3252 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3253 * / Handle certain things once every 10 game turns
3256 static void process_world(void)
3260 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3261 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3262 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3264 extract_day_hour_min(&day, &hour, &min);
3266 /* Update dungeon feeling, and announce it if changed */
3267 update_dungeon_feeling();
3269 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3270 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3272 current_floor_ptr->dun_level = 0;
3273 p_ptr->dungeon_idx = 0;
3274 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3275 p_ptr->inside_arena = FALSE;
3276 p_ptr->wild_mode = FALSE;
3277 p_ptr->leaving = TRUE;
3280 /*** Check monster arena ***/
3281 if (p_ptr->inside_battle && !p_ptr->leaving)
3287 /* Count all hostile monsters */
3288 for (i2 = 0; i2 < current_floor_ptr->width; ++i2)
3289 for (j2 = 0; j2 < current_floor_ptr->height; j2++)
3291 grid_type *g_ptr = ¤t_floor_ptr->grid_array[j2][i2];
3293 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3296 win_m_idx = g_ptr->m_idx;
3300 if (number_mon == 0)
3302 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3304 p_ptr->energy_need = 0;
3307 else if ((number_mon-1) == 0)
3309 GAME_TEXT m_name[MAX_NLEN];
3310 monster_type *wm_ptr;
3312 wm_ptr = ¤t_floor_ptr->m_list[win_m_idx];
3314 monster_desc(m_name, wm_ptr, 0);
3315 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3318 if (win_m_idx == (sel_monster+1))
3320 msg_print(_("おめでとうございます。", "Congratulations."));
3321 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3322 p_ptr->au += battle_odds;
3326 msg_print(_("残念でした。", "You lost gold."));
3329 p_ptr->energy_need = 0;
3332 else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3334 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3335 p_ptr->au += kakekin;
3337 p_ptr->energy_need = 0;
3342 /* Every 10 game turns */
3343 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3345 /*** Check the Time and Load ***/
3347 if (!(current_world_ptr->game_turn % (50*TURNS_PER_TICK)))
3349 /* Check time and load */
3350 if ((0 != check_time()) || (0 != check_load()))
3353 if (closing_flag <= 2)
3355 disturb(FALSE, TRUE);
3357 /* Count warnings */
3360 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3361 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3368 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3371 p_ptr->playing = FALSE;
3372 p_ptr->leaving = TRUE;
3377 /*** Attempt timed autosave ***/
3378 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3380 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3381 do_cmd_save_game(TRUE);
3384 if (mon_fight && !ignore_unview)
3386 msg_print(_("何かが聞こえた。", "You hear noise."));
3389 /*** Handle the wilderness/town (sunshine) ***/
3391 /* While in town/wilderness */
3392 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3394 /* Hack -- Daybreak/Nighfall in town */
3395 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3399 /* Check for dawn */
3400 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3402 if (dawn) day_break();
3408 /* While in the dungeon (vanilla_town or lite_town mode only) */
3409 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && current_floor_ptr->dun_level)
3411 /*** Shuffle the Storekeepers ***/
3413 /* Chance is only once a day (while in dungeon) */
3414 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3416 /* Sometimes, shuffle the shop-keepers */
3417 if (one_in_(STORE_SHUFFLE))
3422 /* Pick a random shop (except home and museum) */
3425 n = randint0(MAX_STORES);
3427 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3429 /* Check every feature */
3430 for (i = 1; i < max_f_idx; i++)
3432 feature_type *f_ptr = &f_info[i];
3434 /* Skip empty index */
3435 if (!f_ptr->name) continue;
3437 /* Skip non-store features */
3438 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3440 /* Verify store type */
3441 if (f_ptr->subtype == n)
3443 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3456 /*** Process the monsters ***/
3458 /* Check for creature generation. */
3459 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3460 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3462 /* Make a new monster */
3463 (void)alloc_monster(MAX_SIGHT + 5, 0);
3466 /* Hack -- Check for creature regeneration */
3467 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters();
3468 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3470 if (!p_ptr->leaving)
3474 /* Hack -- Process the counters of monsters if needed */
3475 for (i = 0; i < MAX_MTIMED; i++)
3477 if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3485 if (min != prev_min)
3487 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3488 determine_today_mon(FALSE);
3493 * Nightmare mode activates the TY_CURSE at midnight
3494 * Require exact minute -- Don't activate multiple times in a minute
3497 if (ironman_nightmare && (min != prev_min))
3500 /* Every 15 minutes after 11:00 pm */
3501 if ((hour == 23) && !(min % 15))
3503 disturb(FALSE, TRUE);
3508 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3512 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3516 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3520 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3525 /* TY_CURSE activates at midnight! */
3529 disturb(TRUE, TRUE);
3530 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3532 if (p_ptr->wild_mode)
3534 /* Go into large wilderness view */
3535 p_ptr->oldpy = randint1(MAX_HGT - 2);
3536 p_ptr->oldpx = randint1(MAX_WID - 2);
3539 /* Give first move to monsters */
3540 take_turn(p_ptr, 100);
3542 /* HACk -- set the encouter flag for the wilderness generation */
3543 generate_encounter = TRUE;
3546 invoking_midnight_curse = TRUE;
3552 /* Check the Food */
3553 process_world_aux_digestion();
3555 /* Process timed damage and regeneration */
3556 process_world_aux_hp_and_sp();
3558 /* Process timeout */
3559 process_world_aux_timeout();
3562 process_world_aux_light();
3564 /* Process mutation effects */
3565 process_world_aux_mutation();
3567 /* Process curse effects */
3568 process_world_aux_curse();
3570 /* Process recharging */
3571 process_world_aux_recharge();
3573 /* Feel the inventory */
3577 /* Involuntary Movement */
3578 process_world_aux_movement();
3582 * @brief ウィザードモードへの導入処理
3583 * / Verify use of "wizard" mode
3584 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3586 static bool enter_wizard_mode(void)
3588 /* Ask first time */
3589 if (!p_ptr->noscore)
3591 /* Wizard mode is not permitted */
3592 if (!allow_debug_opts || arg_wizard)
3594 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3598 /* Mention effects */
3599 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3600 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3603 /* Verify request */
3604 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3609 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3611 p_ptr->noscore |= 0x0002;
3622 * @brief デバッグコマンドへの導入処理
3623 * / Verify use of "debug" commands
3624 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3626 static bool enter_debug_mode(void)
3628 /* Ask first time */
3629 if (!p_ptr->noscore)
3631 /* Debug mode is not permitted */
3632 if (!allow_debug_opts)
3634 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3638 /* Mention effects */
3639 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3640 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3644 /* Verify request */
3645 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3650 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3652 p_ptr->noscore |= 0x0008;
3660 * Hack -- Declare the Debug Routines
3662 extern void do_cmd_debug(void);
3664 #endif /* ALLOW_WIZARD */
3670 * @brief ボーグコマンドへの導入処理
3671 * / Verify use of "borg" commands
3672 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3674 static bool enter_borg_mode(void)
3676 /* Ask first time */
3677 if (!(p_ptr->noscore & 0x0010))
3679 /* Mention effects */
3680 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3681 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3685 /* Verify request */
3686 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3691 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3693 p_ptr->noscore |= 0x0010;
3701 * Hack -- Declare the Ben Borg
3703 extern void do_cmd_borg(void);
3705 #endif /* ALLOW_BORG */
3709 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3710 * / Parse and execute the current command Give "Warning" on illegal commands.
3711 * @todo Make some "blocks"
3714 static void process_command(void)
3716 COMMAND_CODE old_now_message = now_message;
3718 /* Handle repeating the last command */
3724 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
3725 reset_concent = TRUE;
3727 /* Parse the command */
3728 switch (command_cmd)
3744 /*** Wizard Commands ***/
3746 /* Toggle Wizard Mode */
3751 p_ptr->wizard = FALSE;
3752 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3754 else if (enter_wizard_mode())
3756 p_ptr->wizard = TRUE;
3757 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3759 p_ptr->update |= (PU_MONSTERS);
3761 /* Redraw "title" */
3762 p_ptr->redraw |= (PR_TITLE);
3770 /* Special "debug" commands */
3773 /* Enter debug mode */
3774 if (enter_debug_mode())
3781 #endif /* ALLOW_WIZARD */
3786 /* Special "borg" commands */
3789 /* Enter borg mode */
3790 if (enter_borg_mode())
3792 if (!p_ptr->wild_mode) do_cmd_borg();
3798 #endif /* ALLOW_BORG */
3802 /*** Inventory Commands ***/
3804 /* Wear/wield equipment */
3807 if (!p_ptr->wild_mode) do_cmd_wield();
3811 /* Take off equipment */
3814 if (!p_ptr->wild_mode) do_cmd_takeoff();
3821 if (!p_ptr->wild_mode) do_cmd_drop();
3825 /* Destroy an item */
3832 /* Equipment list */
3839 /* Inventory list */
3847 /*** Various commands ***/
3849 /* Identify an object */
3856 /* Hack -- toggle windows */
3859 toggle_inven_equip();
3864 /*** Standard "Movement" Commands ***/
3869 if (!p_ptr->wild_mode) do_cmd_alter();
3876 if (!p_ptr->wild_mode) do_cmd_tunnel();
3880 /* Move (usually pick up things) */
3887 /* Move (usually do not pick up) */
3895 /*** Running, Resting, Searching, Staying */
3897 /* Begin Running -- Arg is Max Distance */
3900 if (!p_ptr->wild_mode) do_cmd_run();
3904 /* Stay still (usually pick things up) */
3907 do_cmd_stay(always_pickup);
3911 /* Stay still (usually do not pick up) */
3914 do_cmd_stay(!always_pickup);
3918 /* Rest -- Arg is time */
3925 /* Search for traps/doors */
3932 /* Toggle search mode */
3935 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
3936 else set_action(ACTION_SEARCH);
3941 /*** Stairs and Doors and Chests and Traps ***/
3944 case SPECIAL_KEY_STORE:
3950 /* Enter building -KMW- */
3951 case SPECIAL_KEY_BUILDING:
3957 /* Enter quest level -KMW- */
3958 case SPECIAL_KEY_QUEST:
3964 /* Go up staircase */
3967 if (!p_ptr->wild_mode && !current_floor_ptr->dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
3969 if (vanilla_town) break;
3971 if (p_ptr->ambush_flag)
3973 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3977 if (p_ptr->food < PY_FOOD_WEAK)
3979 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3990 /* Go down staircase */
3993 if (p_ptr->wild_mode)
4000 /* Open a door or chest */
4014 /* Jam a door with spikes */
4028 /* Disarm a trap or chest */
4036 /*** Magic and Prayers ***/
4038 /* Gain new spells/prayers */
4041 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4042 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
4043 else if (p_ptr->pclass == CLASS_SAMURAI)
4044 do_cmd_gain_hissatsu();
4045 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4046 import_magic_device();
4055 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4056 (p_ptr->pclass == CLASS_BERSERKER) ||
4057 (p_ptr->pclass == CLASS_NINJA) ||
4058 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4059 ) do_cmd_mind_browse();
4060 else if (p_ptr->pclass == CLASS_SMITH)
4062 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4063 do_cmd_magic_eater(TRUE, FALSE);
4064 else if (p_ptr->pclass == CLASS_SNIPER)
4065 do_cmd_snipe_browse();
4066 else do_cmd_browse();
4074 if (!p_ptr->wild_mode)
4076 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4078 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
4080 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))
4082 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
4085 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4087 concptr which_power = _("魔法", "magic");
4088 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4089 which_power = _("超能力", "psionic powers");
4090 else if (p_ptr->pclass == CLASS_IMITATOR)
4091 which_power = _("ものまね", "imitation");
4092 else if (p_ptr->pclass == CLASS_SAMURAI)
4093 which_power = _("必殺剣", "hissatsu");
4094 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4095 which_power = _("鏡魔法", "mirror magic");
4096 else if (p_ptr->pclass == CLASS_NINJA)
4097 which_power = _("忍術", "ninjutsu");
4098 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4099 which_power = _("祈り", "prayer");
4101 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
4104 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4106 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
4111 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4112 (p_ptr->pclass == CLASS_BERSERKER) ||
4113 (p_ptr->pclass == CLASS_NINJA) ||
4114 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4117 else if (p_ptr->pclass == CLASS_IMITATOR)
4119 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4120 do_cmd_magic_eater(FALSE, FALSE);
4121 else if (p_ptr->pclass == CLASS_SAMURAI)
4123 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4124 do_cmd_cast_learned();
4125 else if (p_ptr->pclass == CLASS_SMITH)
4127 else if (p_ptr->pclass == CLASS_SNIPER)
4136 /* Issue a pet command */
4143 /*** Use various objects ***/
4145 /* Inscribe an object */
4152 /* Uninscribe an object */
4155 do_cmd_uninscribe();
4159 /* Activate an artifact */
4173 /* Fuel your lantern/torch */
4183 do_cmd_fire(SP_NONE);
4190 do_cmd_throw(1, FALSE, -1);
4204 if (use_command && rogue_like_commands)
4215 /* Quaff a potion */
4218 do_cmd_quaff_potion();
4225 do_cmd_read_scroll();
4232 if (use_command && !rogue_like_commands)
4239 /* Use racial power */
4242 do_cmd_racial_power();
4247 /*** Looking at Things (nearby or on map) ***/
4249 /* Full dungeon map */
4256 /* Locate player on map */
4270 /* Target monster or location */
4279 /*** Help and Such ***/
4288 /* Identify symbol */
4291 do_cmd_query_symbol();
4295 /* Character description */
4298 do_cmd_change_name();
4303 /*** System Commands ***/
4305 /* Hack -- User interface */
4312 /* Single line from a pref file */
4321 do_cmd_reload_autopick();
4327 do_cmd_edit_autopick();
4331 /* Interact with macros */
4338 /* Interact with visuals */
4346 /* Interact with colors */
4354 /* Interact with options */
4358 (void)combine_and_reorder_home(STORE_HOME);
4363 /*** Misc Commands ***/
4379 /* Repeat level feeling */
4386 /* Show previous message */
4389 do_cmd_message_one();
4393 /* Show previous messages */
4396 do_cmd_messages(old_now_message);
4400 /* Show quest status -KMW- */
4403 do_cmd_checkquest();
4407 /* Redraw the screen */
4410 now_message = old_now_message;
4415 #ifndef VERIFY_SAVEFILE
4417 /* Hack -- Save and don't quit */
4420 do_cmd_save_game(FALSE);
4424 #endif /* VERIFY_SAVEFILE */
4434 case SPECIAL_KEY_QUIT:
4436 do_cmd_save_and_exit();
4440 /* Quit (commit suicide) */
4453 /* Check artifacts, uniques, objects */
4460 /* Load "screen dump" */
4463 do_cmd_load_screen();
4467 /* Save "screen dump" */
4470 do_cmd_save_screen();
4474 /* Record/stop "Movie" */
4477 prepare_movie_hooks();
4481 /* Make random artifact list */
4484 spoil_random_artifact("randifact.txt");
4491 if (!p_ptr->wild_mode) do_cmd_travel();
4492 if (p_ptr->special_defense & KATA_MUSOU)
4494 set_action(ACTION_NONE);
4500 /* Hack -- Unknown command */
4503 if (flush_failure) flush();
4507 sound(SOUND_ILLEGAL);
4508 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4513 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4519 if (!p_ptr->energy_use && !now_message)
4520 now_message = old_now_message;
4524 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4527 static void pack_overflow(void)
4529 if (inventory[INVEN_PACK].k_idx)
4531 GAME_TEXT o_name[MAX_NLEN];
4534 /* Is auto-destroy done? */
4535 update_creature(p_ptr);
4536 if (!inventory[INVEN_PACK].k_idx) return;
4538 /* Access the slot to be dropped */
4539 o_ptr = &inventory[INVEN_PACK];
4541 disturb(FALSE, TRUE);
4544 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4545 object_desc(o_name, o_ptr, 0);
4547 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4549 /* Drop it (carefully) near the player */
4550 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4552 /* Modify, Describe, Optimize */
4553 inven_item_increase(INVEN_PACK, -255);
4554 inven_item_describe(INVEN_PACK);
4555 inven_item_optimize(INVEN_PACK);
4562 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4565 static void process_upkeep_with_speed(void)
4567 /* Give the player some energy */
4568 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4570 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4573 /* No current_world_ptr->game_turn yet */
4574 if (p_ptr->enchant_energy_need > 0) return;
4576 while (p_ptr->enchant_energy_need <= 0)
4578 /* Handle the player song */
4579 if (!load) check_music();
4581 /* Hex - Handle the hex spells */
4582 if (!load) check_hex();
4583 if (!load) revenge_spell();
4585 /* There is some randomness of needed energy */
4586 p_ptr->enchant_energy_need += ENERGY_NEED();
4591 * @brief プレイヤーの行動処理 / Process the player
4594 * Notice the annoying code to handle "pack overflow", which\n
4595 * must come first just in case somebody manages to corrupt\n
4596 * the savefiles by clever use of menu commands or something.\n
4598 static void process_player(void)
4602 /*** Apply energy ***/
4606 msg_print(_("何か変わった気がする!", "You feel different!"));
4608 (void)gain_mutation(p_ptr, 0);
4609 hack_mutation = FALSE;
4612 if (invoking_midnight_curse)
4615 activate_ty_curse(FALSE, &count);
4616 invoking_midnight_curse = FALSE;
4619 if (p_ptr->inside_battle)
4621 for(m_idx = 1; m_idx < m_max; m_idx++)
4623 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
4625 if (!monster_is_valid(m_ptr)) continue;
4627 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4628 update_monster(m_idx, FALSE);
4633 /* Give the player some energy */
4634 else if (!(load && p_ptr->energy_need <= 0))
4636 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4639 /* No current_world_ptr->game_turn yet */
4640 if (p_ptr->energy_need > 0) return;
4641 if (!command_rep) prt_time();
4643 /*** Check for interupts ***/
4645 /* Complete resting */
4646 if (p_ptr->resting < 0)
4649 if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4652 if ((p_ptr->chp == p_ptr->mhp) &&
4653 (p_ptr->csp >= p_ptr->msp))
4655 set_action(ACTION_NONE);
4659 /* Complete resting */
4660 else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4663 if ((p_ptr->chp == p_ptr->mhp) &&
4664 (p_ptr->csp >= p_ptr->msp) &&
4665 !p_ptr->blind && !p_ptr->confused &&
4666 !p_ptr->poisoned && !p_ptr->afraid &&
4667 !p_ptr->stun && !p_ptr->cut &&
4668 !p_ptr->slow && !p_ptr->paralyzed &&
4669 !p_ptr->image && !p_ptr->word_recall &&
4670 !p_ptr->alter_reality)
4672 set_action(ACTION_NONE);
4677 if (p_ptr->action == ACTION_FISH)
4679 Term_xtra(TERM_XTRA_DELAY, 10);
4683 bool success = FALSE;
4684 get_mon_num_prep(monster_is_fishing_target,NULL);
4685 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);
4687 if (r_idx && one_in_(2))
4690 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4691 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4692 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4694 GAME_TEXT m_name[MAX_NLEN];
4695 monster_desc(m_name, ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
4696 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4702 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4704 disturb(FALSE, TRUE);
4708 /* Handle "abort" */
4711 /* Check for "player abort" (semi-efficiently for resting) */
4712 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
4717 /* Check for a key */
4720 flush(); /* Flush input */
4722 disturb(FALSE, TRUE);
4724 /* Hack -- Show a Message */
4725 msg_print(_("中断しました。", "Canceled."));
4730 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
4732 monster_type *m_ptr = ¤t_floor_ptr->m_list[p_ptr->riding];
4733 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4735 if (MON_CSLEEP(m_ptr))
4737 GAME_TEXT m_name[MAX_NLEN];
4740 (void)set_monster_csleep(p_ptr->riding, 0);
4741 monster_desc(m_name, m_ptr, 0);
4742 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4745 if (MON_STUNNED(m_ptr))
4747 /* Hack -- Recover from stun */
4748 if (set_monster_stunned(p_ptr->riding,
4749 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4751 GAME_TEXT m_name[MAX_NLEN];
4752 monster_desc(m_name, m_ptr, 0);
4753 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4757 if (MON_CONFUSED(m_ptr))
4759 /* Hack -- Recover from confusion */
4760 if (set_monster_confused(p_ptr->riding,
4761 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4763 GAME_TEXT m_name[MAX_NLEN];
4764 monster_desc(m_name, m_ptr, 0);
4765 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4769 if (MON_MONFEAR(m_ptr))
4771 /* Hack -- Recover from fear */
4772 if(set_monster_monfear(p_ptr->riding,
4773 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4775 GAME_TEXT m_name[MAX_NLEN];
4776 monster_desc(m_name, m_ptr, 0);
4777 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4787 if (p_ptr->lightspeed)
4789 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
4791 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4793 if(P_PTR_KI < 40) P_PTR_KI = 0;
4794 else P_PTR_KI -= 40;
4795 p_ptr->update |= (PU_BONUS);
4797 if (p_ptr->action == ACTION_LEARN)
4800 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
4802 /* Convert the unit (1/2^16) to (1/2^32) */
4803 s64b_LSHIFT(cost, cost_frac, 16);
4805 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
4809 p_ptr->csp_frac = 0;
4810 set_action(ACTION_NONE);
4815 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
4817 p_ptr->redraw |= PR_MANA;
4820 if (p_ptr->special_defense & KATA_MASK)
4822 if (p_ptr->special_defense & KATA_MUSOU)
4826 set_action(ACTION_NONE);
4831 p_ptr->redraw |= (PR_MANA);
4836 /*** Handle actual user input ***/
4838 /* Repeat until out of energy */
4839 while (p_ptr->energy_need <= 0)
4841 p_ptr->window |= PW_PLAYER;
4842 p_ptr->sutemi = FALSE;
4843 p_ptr->counter = FALSE;
4844 p_ptr->now_damaged = FALSE;
4848 /* Place the cursor on the player */
4849 move_cursor_relative(p_ptr->y, p_ptr->x);
4851 /* Refresh (optional) */
4852 if (fresh_before) Term_fresh();
4854 /* Hack -- Pack Overflow */
4857 /* Hack -- cancel "lurking browse mode" */
4858 if (!command_new) command_see = FALSE;
4860 /* Assume free current_world_ptr->game_turn */
4863 if (p_ptr->inside_battle)
4865 /* Place the cursor on the player */
4866 move_cursor_relative(p_ptr->y, p_ptr->x);
4868 command_cmd = SPECIAL_KEY_BUILDING;
4870 /* Process the command */
4874 /* Paralyzed or Knocked Out */
4875 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
4877 take_turn(p_ptr, 100);
4881 else if (p_ptr->action == ACTION_REST)
4884 if (p_ptr->resting > 0)
4886 /* Reduce rest count */
4889 if (!p_ptr->resting) set_action(ACTION_NONE);
4890 p_ptr->redraw |= (PR_STATE);
4893 take_turn(p_ptr, 100);
4897 else if (p_ptr->action == ACTION_FISH)
4899 take_turn(p_ptr, 100);
4911 else if (travel.run)
4918 /* Repeated command */
4919 else if (command_rep)
4921 /* Count this execution */
4924 p_ptr->redraw |= (PR_STATE);
4927 /* Hack -- Assume messages were seen */
4930 /* Clear the top line */
4933 /* Process the command */
4937 /* Normal command */
4940 /* Place the cursor on the player */
4941 move_cursor_relative(p_ptr->y, p_ptr->x);
4943 if(refresh_mon_list)
4945 p_ptr->window |= PW_MONSTER_LIST;
4950 /* Get a command (normal) */
4951 request_command(FALSE);
4954 /* Process the command */
4958 /* Hack -- Pack Overflow */
4964 if (p_ptr->energy_use)
4966 /* Use some energy */
4967 if (p_ptr->timewalk || p_ptr->energy_use > 400)
4969 /* The Randomness is irrelevant */
4970 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
4974 /* There is some randomness of needed energy */
4975 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
4978 /* Hack -- constant hallucination */
4979 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
4982 /* Shimmer monsters if needed */
4983 if (shimmer_monsters)
4985 /* Clear the flag */
4986 shimmer_monsters = FALSE;
4988 /* Shimmer multi-hued monsters */
4989 for (m_idx = 1; m_idx < m_max; m_idx++)
4991 monster_type *m_ptr;
4992 monster_race *r_ptr;
4994 m_ptr = ¤t_floor_ptr->m_list[m_idx];
4995 if (!monster_is_valid(m_ptr)) continue;
4997 /* Skip unseen monsters */
4998 if (!m_ptr->ml) continue;
5000 /* Access the monster race */
5001 r_ptr = &r_info[m_ptr->ap_r_idx];
5003 /* Skip non-multi-hued monsters */
5004 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
5007 /* Reset the flag */
5008 shimmer_monsters = TRUE;
5010 /* Redraw regardless */
5011 lite_spot(m_ptr->fy, m_ptr->fx);
5016 /* Handle monster detection */
5017 if (repair_monsters)
5019 /* Reset the flag */
5020 repair_monsters = FALSE;
5022 /* Rotate detection flags */
5023 for (m_idx = 1; m_idx < m_max; m_idx++)
5025 monster_type *m_ptr;
5026 m_ptr = ¤t_floor_ptr->m_list[m_idx];
5027 if (!monster_is_valid(m_ptr)) continue;
5029 /* Nice monsters get mean */
5030 if (m_ptr->mflag & MFLAG_NICE)
5032 /* Nice monsters get mean */
5033 m_ptr->mflag &= ~(MFLAG_NICE);
5036 /* Handle memorized monsters */
5037 if (m_ptr->mflag2 & MFLAG2_MARK)
5039 /* Maintain detection */
5040 if (m_ptr->mflag2 & MFLAG2_SHOW)
5043 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
5045 /* Still need repairs */
5046 repair_monsters = TRUE;
5049 /* Remove detection */
5053 m_ptr->mflag2 &= ~(MFLAG2_MARK);
5055 /* Assume invisible */
5057 update_monster(m_idx, FALSE);
5059 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
5060 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
5062 /* Redraw regardless */
5063 lite_spot(m_ptr->fy, m_ptr->fx);
5068 if (p_ptr->pclass == CLASS_IMITATOR)
5071 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5074 for (j = 0; j < p_ptr->mane_num; j++)
5076 p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
5077 p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
5081 p_ptr->redraw |= (PR_IMITATION);
5083 if (p_ptr->action == ACTION_LEARN)
5086 p_ptr->redraw |= (PR_STATE);
5089 if (p_ptr->timewalk && (p_ptr->energy_need > - 1000))
5092 p_ptr->redraw |= (PR_MAP);
5093 p_ptr->update |= (PU_MONSTERS);
5094 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5096 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
5098 p_ptr->timewalk = FALSE;
5099 p_ptr->energy_need = ENERGY_NEED();
5105 /* Hack -- notice death */
5106 if (!p_ptr->playing || p_ptr->is_dead)
5108 p_ptr->timewalk = FALSE;
5113 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
5115 /* Handle "leaving" */
5116 if (p_ptr->leaving) break;
5119 /* Update scent trail */
5124 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
5128 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
5129 * ゲームを終了するかのいずれかまでループする。
5132 * This function will not exit until the level is completed,\n
5133 * the user dies, or the game is terminated.\n
5136 static void dungeon(bool load_game)
5140 /* Set the base level */
5141 current_floor_ptr->base_level = current_floor_ptr->dun_level;
5143 /* Reset various flags */
5144 is_loading_now = FALSE;
5147 p_ptr->leaving = FALSE;
5149 /* Reset the "command" vars */
5152 #if 0 /* Don't reset here --- It's used for Arena */
5161 /* Cancel the target */
5165 p_ptr->ambush_flag = FALSE;
5167 /* Cancel the health bar */
5170 /* Check visual effects */
5171 shimmer_monsters = TRUE;
5172 shimmer_objects = TRUE;
5173 repair_monsters = TRUE;
5174 repair_objects = TRUE;
5177 disturb(TRUE, TRUE);
5179 /* Get index of current quest (if any) */
5180 quest_num = quest_number(current_floor_ptr->dun_level);
5182 /* Inside a quest? */
5185 /* Mark the quest monster */
5186 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
5189 /* Track maximum player level */
5190 if (p_ptr->max_plv < p_ptr->lev)
5192 p_ptr->max_plv = p_ptr->lev;
5196 /* Track maximum dungeon level (if not in quest -KMW-) */
5197 if ((max_dlv[p_ptr->dungeon_idx] < current_floor_ptr->dun_level) && !p_ptr->inside_quest)
5199 max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
5200 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
5203 (void)calculate_upkeep();
5205 /* Validate the panel */
5206 panel_bounds_center();
5208 /* Verify the panel */
5214 /* Enter "xtra" mode */
5215 character_xtra = TRUE;
5217 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5218 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
5219 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);
5223 /* Leave "xtra" mode */
5224 character_xtra = FALSE;
5226 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5227 p_ptr->update |= (PU_COMBINE | PU_REORDER);
5231 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5232 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5233 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5235 if (p_ptr->inside_battle)
5239 p_ptr->energy_need = 0;
5244 msg_print(_("試合開始!", "Ready..Fight!"));
5249 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5250 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5252 /* Hack -- notice death or departure */
5253 if (!p_ptr->playing || p_ptr->is_dead) return;
5255 /* Print quest message if appropriate */
5256 if (!p_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5258 quest_discovery(random_quest_number(current_floor_ptr->dun_level));
5259 p_ptr->inside_quest = random_quest_number(current_floor_ptr->dun_level);
5261 if ((current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5263 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5265 msg_format("この階には%sの主である%sが棲んでいる。",
5266 d_name+d_info[p_ptr->dungeon_idx].name,
5267 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5269 msg_format("%^s lives in this level as the keeper of %s.",
5270 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5271 d_name+d_info[p_ptr->dungeon_idx].name);
5275 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5277 /*** Process this dungeon level ***/
5279 /* Reset the monster generation level */
5280 current_floor_ptr->monster_level = current_floor_ptr->base_level;
5282 /* Reset the object generation level */
5283 current_floor_ptr->object_level = current_floor_ptr->base_level;
5285 is_loading_now = TRUE;
5287 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5288 (current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5289 p_ptr->energy_need = 0;
5291 /* Not leaving dungeon */
5292 p_ptr->leaving_dungeon = FALSE;
5294 /* Initialize monster process */
5300 /* Hack -- Compact the monster list occasionally */
5301 if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5303 /* Hack -- Compress the monster list occasionally */
5304 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5307 /* Hack -- Compact the object list occasionally */
5308 if (o_cnt + 32 > current_floor_ptr->max_o_idx) compact_objects(64);
5310 /* Hack -- Compress the object list occasionally */
5311 if (o_cnt + 32 < o_max) compact_objects(0);
5313 /* Process the player */
5315 process_upkeep_with_speed();
5319 /* Hack -- Hilite the player */
5320 move_cursor_relative(p_ptr->y, p_ptr->x);
5322 /* Optional fresh */
5323 if (fresh_after) Term_fresh();
5325 /* Hack -- Notice death or departure */
5326 if (!p_ptr->playing || p_ptr->is_dead) break;
5328 /* Process all of the monsters */
5333 /* Hack -- Hilite the player */
5334 move_cursor_relative(p_ptr->y, p_ptr->x);
5336 /* Optional fresh */
5337 if (fresh_after) Term_fresh();
5339 /* Hack -- Notice death or departure */
5340 if (!p_ptr->playing || p_ptr->is_dead) break;
5342 /* Process the world */
5347 /* Hack -- Hilite the player */
5348 move_cursor_relative(p_ptr->y, p_ptr->x);
5350 /* Optional fresh */
5351 if (fresh_after) Term_fresh();
5353 /* Hack -- Notice death or departure */
5354 if (!p_ptr->playing || p_ptr->is_dead) break;
5356 /* Count game turns */
5357 current_world_ptr->game_turn++;
5359 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5361 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5362 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5365 prevent_turn_overflow();
5367 /* Handle "leaving" */
5368 if (p_ptr->leaving) break;
5370 if (wild_regen) wild_regen--;
5373 /* Inside a quest and non-unique questor? */
5374 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5376 /* Un-mark the quest monster */
5377 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5380 /* Not save-and-quit and not dead? */
5381 if (p_ptr->playing && !p_ptr->is_dead)
5384 * Maintain Unique monsters and artifact, save current
5385 * floor, then prepare next floor
5389 /* Forget the flag */
5390 reinit_wilderness = FALSE;
5393 /* Write about current level on the play record once per level */
5399 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5402 * Modified by Arcum Dagsson to support
5403 * separate macro files for different realms.
5405 static void load_all_pref_files(void)
5409 /* Access the "user" pref file */
5410 sprintf(buf, "user.prf");
5412 /* Process that file */
5413 process_pref_file(buf);
5415 /* Access the "user" system pref file */
5416 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5418 /* Process that file */
5419 process_pref_file(buf);
5421 /* Access the "race" pref file */
5422 sprintf(buf, "%s.prf", rp_ptr->title);
5424 /* Process that file */
5425 process_pref_file(buf);
5427 /* Access the "class" pref file */
5428 sprintf(buf, "%s.prf", cp_ptr->title);
5430 /* Process that file */
5431 process_pref_file(buf);
5433 /* Access the "character" pref file */
5434 sprintf(buf, "%s.prf", player_base);
5436 /* Process that file */
5437 process_pref_file(buf);
5439 /* Access the "realm 1" pref file */
5440 if (p_ptr->realm1 != REALM_NONE)
5442 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5444 /* Process that file */
5445 process_pref_file(buf);
5448 /* Access the "realm 2" pref file */
5449 if (p_ptr->realm2 != REALM_NONE)
5451 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5453 /* Process that file */
5454 process_pref_file(buf);
5458 /* Load an autopick preference file */
5459 autopick_load_pref(FALSE);
5464 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
5467 void extract_option_vars(void)
5471 for (i = 0; option_info[i].o_desc; i++)
5473 int os = option_info[i].o_set;
5474 int ob = option_info[i].o_bit;
5476 /* Set the "default" options */
5477 if (option_info[i].o_var)
5480 if (option_flag[os] & (1L << ob))
5483 (*option_info[i].o_var) = TRUE;
5490 (*option_info[i].o_var) = FALSE;
5498 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
5501 void determine_bounty_uniques(void)
5505 monster_race *r_ptr;
5507 get_mon_num_prep(NULL, NULL);
5508 for (i = 0; i < MAX_KUBI; i++)
5512 current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
5513 r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
5515 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
5517 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
5519 if (r_ptr->rarity > 100) continue;
5521 if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
5523 for (j = 0; j < i; j++)
5524 if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
5531 for (i = 0; i < MAX_KUBI - 1; i++)
5533 for (j = i; j < MAX_KUBI; j++)
5535 if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
5537 tmp = current_world_ptr->bounty_r_idx[i];
5538 current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
5539 current_world_ptr->bounty_r_idx[j] = tmp;
5547 * @brief 今日の賞金首を確定する / Determine today's bounty monster
5549 * @note conv_old is used if loaded 0.0.3 or older save file
5551 void determine_today_mon(bool conv_old)
5554 bool old_inside_battle = p_ptr->inside_battle;
5555 monster_race *r_ptr;
5559 for (i = 0; i < max_d_idx; i++)
5561 if (max_dlv[i] < d_info[i].mindepth) continue;
5562 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
5565 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
5567 p_ptr->inside_battle = TRUE;
5568 get_mon_num_prep(NULL, NULL);
5572 today_mon = get_mon_num(max_dl);
5573 r_ptr = &r_info[today_mon];
5575 if (r_ptr->flags1 & RF1_UNIQUE) continue;
5576 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
5577 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
5578 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
5579 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
5580 if (r_ptr->rarity > 10) continue;
5584 p_ptr->today_mon = 0;
5585 p_ptr->inside_battle = old_inside_battle;
5589 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5592 * If the "new_game" parameter is true, then, after loading the
5593 * savefile, we will commit suicide, if necessary, to allow the
5594 * player to start a new game.
5596 void play_game(bool new_game)
5599 bool load_game = TRUE;
5600 bool init_random_seed = FALSE;
5610 else if (chuukei_server)
5612 prepare_chuukei_hooks();
5623 hack_mutation = FALSE;
5625 /* Hack -- Character is "icky" */
5626 character_icky = TRUE;
5628 /* Make sure main term is active */
5629 Term_activate(angband_term[0]);
5631 /* Initialise the resize hooks */
5632 angband_term[0]->resize_hook = resize_map;
5634 for (i = 1; i < 8; i++)
5636 /* Does the term exist? */
5637 if (angband_term[i])
5639 /* Add the redraw on resize hook */
5640 angband_term[i]->resize_hook = redraw_window;
5644 /* Hack -- current_world_ptr->game_turn off the cursor */
5645 (void)Term_set_cursor(0);
5648 /* Attempt to load */
5651 quit(_("セーブファイルが壊れています", "broken savefile"));
5654 /* Extract the options */
5655 extract_option_vars();
5657 /* Report waited score */
5658 if (p_ptr->wait_report_score)
5663 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5666 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5667 update_creature(p_ptr);
5669 p_ptr->is_dead = TRUE;
5671 start_time = (u32b)time(NULL);
5673 /* No suspending now */
5674 signals_ignore_tstp();
5676 /* Hack -- Character is now "icky" */
5677 character_icky = TRUE;
5679 /* Build the filename */
5680 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5682 /* Open the high score file, for reading/writing */
5683 highscore_fd = fd_open(buf, O_RDWR);
5685 /* 町名消失バグ対策(#38205) Init the wilderness */
5686 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5688 /* Handle score, show Top scores */
5689 success = send_world_score(TRUE);
5691 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5693 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5698 p_ptr->wait_report_score = FALSE;
5700 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5702 /* Shut the high score file */
5703 (void)fd_close(highscore_fd);
5705 /* Forget the high score fd */
5708 /* Allow suspending now */
5709 signals_handle_tstp();
5714 creating_savefile = new_game;
5716 /* Nothing loaded */
5717 if (!character_loaded)
5719 /* Make new player */
5722 /* The dungeon is not ready */
5723 character_dungeon = FALSE;
5725 /* Prepare to init the RNG */
5726 init_random_seed = TRUE;
5728 /* Initialize the saved floors data */
5729 init_saved_floors(FALSE);
5732 /* Old game is loaded. But new game is requested. */
5735 /* Initialize the saved floors data */
5736 init_saved_floors(TRUE);
5739 /* Process old character */
5742 /* Process the player name */
5743 process_player_name(FALSE);
5747 if (init_random_seed)
5752 /* Roll new character */
5755 /* The dungeon is not ready */
5756 character_dungeon = FALSE;
5759 current_floor_ptr->dun_level = 0;
5760 p_ptr->inside_quest = 0;
5761 p_ptr->inside_arena = FALSE;
5762 p_ptr->inside_battle = FALSE;
5766 /* Hack -- seed for flavors */
5767 seed_flavor = randint0(0x10000000);
5769 /* Hack -- seed for town layout */
5770 seed_town = randint0(0x10000000);
5772 /* Roll up a new character */
5780 determine_bounty_uniques();
5781 determine_today_mon(FALSE);
5783 /* Initialize object array */
5788 write_level = FALSE;
5790 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
5792 " ---- Restart Game ----"));
5795 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5796 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5798 if (p_ptr->riding == -1)
5801 for (i = m_max; i > 0; i--)
5803 if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx))
5812 creating_savefile = FALSE;
5814 p_ptr->teleport_town = FALSE;
5815 p_ptr->sutemi = FALSE;
5816 current_world_ptr->timewalk_m_idx = 0;
5817 p_ptr->now_damaged = FALSE;
5819 start_time = time(NULL) - 1;
5820 record_o_name[0] = '\0';
5822 /* Reset map panel */
5823 panel_row_min = current_floor_ptr->height;
5824 panel_col_min = current_floor_ptr->width;
5826 /* Sexy gal gets bonus to maximum weapon skill of whip */
5827 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5828 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5830 /* Fill the arrays of floors and walls in the good proportions */
5831 set_floor_and_wall(p_ptr->dungeon_idx);
5833 /* Flavor the objects */
5836 /* Flash a message */
5837 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5839 /* Flush the message */
5843 /* Hack -- Enter wizard mode */
5846 if (enter_wizard_mode())
5848 p_ptr->wizard = TRUE;
5850 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5852 /* Initialize the saved floors data */
5853 init_saved_floors(TRUE);
5856 p_ptr->inside_quest = 0;
5858 /* Avoid crash in update_view() */
5859 p_ptr->y = p_ptr->x = 10;
5862 else if (p_ptr->is_dead)
5864 quit("Already dead.");
5868 /* Initialize the town-buildings if necessary */
5869 if (!current_floor_ptr->dun_level && !p_ptr->inside_quest)
5871 /* Init the wilderness */
5873 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5876 init_flags = INIT_ONLY_BUILDINGS;
5878 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5880 select_floor_music();
5884 /* Generate a dungeon level if needed */
5885 if (!character_dungeon)
5892 /* HACK -- Restore from panic-save */
5893 if (p_ptr->panic_save)
5895 /* No player? -- Try to regenerate floor */
5896 if (!p_ptr->y || !p_ptr->x)
5898 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5902 /* Still no player? -- Try to locate random place */
5903 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5905 /* No longer in panic */
5906 p_ptr->panic_save = 0;
5910 /* Character is now "complete" */
5911 character_generated = TRUE;
5914 /* Hack -- Character is no longer "icky" */
5915 character_icky = FALSE;
5921 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5922 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
5927 p_ptr->playing = TRUE;
5929 /* Reset the visual mappings */
5932 /* Load the "pref" files */
5933 load_all_pref_files();
5935 /* Give startup outfit (after loading pref files) */
5941 /* React to changes */
5942 Term_xtra(TERM_XTRA_REACT, 0);
5944 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5945 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5948 /* Set or clear "rogue_like_commands" if requested */
5949 if (arg_force_original) rogue_like_commands = FALSE;
5950 if (arg_force_roguelike) rogue_like_commands = TRUE;
5952 /* Hack -- Enforce "delayed death" */
5953 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5955 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
5957 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5959 monster_type *m_ptr;
5960 IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5961 monster_race *r_ptr = &r_info[pet_r_idx];
5962 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5963 (PM_FORCE_PET | PM_NO_KAGE));
5964 m_ptr = ¤t_floor_ptr->m_list[hack_m_idx_ii];
5965 m_ptr->mspeed = r_ptr->speed;
5966 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5967 m_ptr->max_maxhp = m_ptr->maxhp;
5968 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5969 m_ptr->dealt_damage = 0;
5970 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5973 (void)combine_and_reorder_home(STORE_HOME);
5974 (void)combine_and_reorder_home(STORE_MUSEUM);
5976 select_floor_music();
5981 /* Process the level */
5984 /* Hack -- prevent "icky" message */
5985 character_xtra = TRUE;
5989 character_xtra = FALSE;
5991 /* Cancel the target */
5994 /* Cancel the health bar */
6001 /* Handle "quit and save" */
6002 if (!p_ptr->playing && !p_ptr->is_dead) break;
6004 /* Erase the old current_floor_ptr->grid_array */
6006 if (!p_ptr->is_dead) wipe_m_list();
6013 /* Accidental Death */
6014 if (p_ptr->playing && p_ptr->is_dead)
6016 if (p_ptr->inside_arena)
6018 p_ptr->inside_arena = FALSE;
6019 if (p_ptr->arena_number > MAX_ARENA_MONS)
6020 p_ptr->arena_number++;
6022 p_ptr->arena_number = -1 - p_ptr->arena_number;
6023 p_ptr->is_dead = FALSE;
6025 p_ptr->chp_frac = 0;
6026 p_ptr->exit_bldg = TRUE;
6029 /* Leave through the exit */
6030 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
6032 /* prepare next floor */
6037 /* Mega-Hack -- Allow player to cheat death */
6038 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
6045 /* Handle "death" */
6046 if (p_ptr->is_dead) break;
6048 /* Make a new level */
6060 * @brief ゲームターンからの実時間換算を行うための補正をかける
6061 * @param hoge ゲームターン
6062 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
6063 * @return 修正をかけた後のゲームターン
6065 s32b turn_real(s32b hoge)
6067 switch (p_ptr->start_race)
6073 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
6080 * @brief ターンのオーバーフローに対する対処
6081 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
6082 * @return 修正をかけた後のゲームターン
6084 void prevent_turn_overflow(void)
6086 int rollback_days, i, j;
6087 s32b rollback_turns;
6089 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
6091 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
6092 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
6094 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
6095 else current_world_ptr->game_turn = 1;
6096 if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
6097 else current_floor_ptr->generated_turn = 1;
6098 if (old_battle > rollback_turns) old_battle -= rollback_turns;
6099 else old_battle = 1;
6100 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
6101 else p_ptr->feeling_turn = 1;
6103 for (i = 1; i < max_towns; i++)
6105 for (j = 0; j < MAX_STORES; j++)
6107 store_type *st_ptr = &town_info[i].store[j];
6109 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
6111 st_ptr->last_visit -= rollback_turns;
6112 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
6115 if (st_ptr->store_open)
6117 st_ptr->store_open -= rollback_turns;
6118 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
6126 * Close up the current game (player may or may not be dead)
6130 * This function is called only from "main.c" and "signals.c".
6133 void close_game(void)
6136 bool do_send = TRUE;
6138 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
6141 /* Flush the messages */
6144 /* Flush the input */
6148 /* No suspending now */
6149 signals_ignore_tstp();
6152 /* Hack -- Character is now "icky" */
6153 character_icky = TRUE;
6156 /* Build the filename */
6157 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6159 /* Grab permissions */
6162 /* Open the high score file, for reading/writing */
6163 highscore_fd = fd_open(buf, O_RDWR);
6165 /* Drop permissions */
6171 /* Handle retirement */
6172 if (p_ptr->total_winner) kingly();
6175 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
6177 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
6179 else do_send = FALSE;
6186 /* Show more info */
6192 if ((!send_world_score(do_send)))
6194 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
6195 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
6197 p_ptr->wait_report_score = TRUE;
6198 p_ptr->is_dead = FALSE;
6199 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
6202 if (!p_ptr->wait_report_score)
6205 else if (highscore_fd >= 0)
6207 display_scores_aux(0, 10, -1, NULL);
6210 /* Dump bones file */
6219 do_cmd_save_game(FALSE);
6221 /* Prompt for scores */
6222 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
6223 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
6225 /* Predict score (or ESCAPE) */
6226 if (inkey() != ESCAPE) predict_score();
6230 /* Shut the high score file */
6231 (void)fd_close(highscore_fd);
6233 /* Forget the high score fd */
6236 /* Kill all temporal files */
6237 clear_saved_floor_files();
6239 /* Allow suspending now */
6240 signals_handle_tstp();