3 @brief Angbandゲームエンジン / Angband game engine
6 Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 This software may be copied and distributed for educational, research, and\n
8 not for profit purposes provided that this copyright and statement are\n
9 included in all such copies.\n
10 2013 Deskull rearranged comment for Doxygen.
15 #define TY_CURSE_CHANCE 200 /*!<太古の怨念の1ターン毎の発動確率(1/n)*/
16 #define CHAINSWORD_NOISE 100 /*!<チェンソーの1ターン毎の発動確率(1/n)*/
18 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
19 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
22 * @brief 重度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 1 (Heavy).
23 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
24 * @return 擬似鑑定結果のIDを返す。
26 static byte value_check_aux1(object_type *o_ptr)
29 if (object_is_artifact(o_ptr))
32 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_TERRIBLE;
39 if (object_is_ego(o_ptr))
42 if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_WORTHLESS;
45 return FEEL_EXCELLENT;
49 if (object_is_cursed(o_ptr)) return FEEL_CURSED;
52 if (object_is_broken(o_ptr)) return FEEL_BROKEN;
54 if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE;
56 /* Good "armor" bonus */
57 if (o_ptr->to_a > 0) return FEEL_GOOD;
59 /* Good "weapon" bonus */
60 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
62 /* Default to "average" */
67 * @brief 軽度擬似鑑定の判断処理 / Return a "feeling" (or NULL) about an item. Method 2 (Light).
68 * @param o_ptr 擬似鑑定を行うオブジェクトの参照ポインタ。
69 * @return 擬似鑑定結果のIDを返す。
71 static byte value_check_aux2(object_type *o_ptr)
73 /* Cursed items (all of them) */
74 if (object_is_cursed(o_ptr)) return FEEL_CURSED;
76 /* Broken items (all of them) */
77 if (object_is_broken(o_ptr)) return FEEL_BROKEN;
79 /* Artifacts -- except cursed/broken ones */
80 if (object_is_artifact(o_ptr)) return FEEL_UNCURSED;
82 /* Ego-Items -- except cursed/broken ones */
83 if (object_is_ego(o_ptr)) return FEEL_UNCURSED;
85 /* Good armor bonus */
86 if (o_ptr->to_a > 0) return FEEL_UNCURSED;
88 /* Good weapon bonuses */
89 if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
97 * @brief 擬似鑑定を実際に行い判定を反映する
98 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
99 * @param heavy 重度の擬似鑑定を行うならばTRUE
102 static void sense_inventory_aux(int slot, bool heavy)
105 object_type *o_ptr = &inventory[slot];
106 char o_name[MAX_NLEN];
108 /* We know about it already, do not tell us again */
109 if (o_ptr->ident & (IDENT_SENSE))return;
111 /* It is fully known, no information needed */
112 if (object_is_known(o_ptr)) return;
114 /* Check for a feeling */
115 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
117 /* Skip non-feelings */
121 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
132 feel = FEEL_EXCELLENT;
138 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
140 feel = FEEL_UNCURSED;
145 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
151 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
158 feel = FEEL_WORTHLESS;
163 feel = FEEL_TERRIBLE;
169 /* Stop everything */
170 if (disturb_minor) disturb(0, 0);
172 /* Get an object description */
173 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
175 /* Message (equipment) */
176 if (slot >= INVEN_RARM)
179 msg_format("%s%s(%c)は%sという感じがする...",
180 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
182 msg_format("You feel the %s (%c) you are %s %s %s...",
183 o_name, index_to_label(slot), describe_use(slot),
184 ((o_ptr->number == 1) ? "is" : "are"),
185 game_inscriptions[feel]);
190 /* Message (inventory) */
194 msg_format("ザックの中の%s(%c)は%sという感じがする...",
195 o_name, index_to_label(slot),game_inscriptions[feel]);
197 msg_format("You feel the %s (%c) in your pack %s %s...",
198 o_name, index_to_label(slot),
199 ((o_ptr->number == 1) ? "is" : "are"),
200 game_inscriptions[feel]);
205 /* We have "felt" it */
206 o_ptr->ident |= (IDENT_SENSE);
208 /* Set the "inscription" */
209 o_ptr->feeling = feel;
211 /* Auto-inscription/destroy */
212 autopick_alter_item(slot, destroy_feeling);
214 /* Combine / Reorder the pack (later) */
215 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
218 p_ptr->window |= (PW_INVEN | PW_EQUIP);
224 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
227 * Sense the inventory\n
229 * Class 0 = Warrior --> fast and heavy\n
230 * Class 1 = Mage --> slow and light\n
231 * Class 2 = Priest --> fast but light\n
232 * Class 3 = Rogue --> okay and heavy\n
233 * Class 4 = Ranger --> slow but heavy (changed!)\n
234 * Class 5 = Paladin --> slow but heavy\n
236 static void sense_inventory1(void)
239 int plev = p_ptr->lev;
244 /*** Check for "sensing" ***/
246 /* No sensing when confused */
247 if (p_ptr->confused) return;
249 /* Analyze the class */
250 switch (p_ptr->pclass)
258 if (0 != randint0(9000L / (plev * plev + 40))) return;
270 if (0 != randint0(6000L / (plev * plev + 50))) return;
280 case CLASS_HIGH_MAGE:
282 case CLASS_MAGIC_EATER:
284 /* Very bad (light) sensing */
285 if (0 != randint0(240000L / (plev + 5))) return;
294 /* Good (light) sensing */
295 if (0 != randint0(10000L / (plev * plev + 40))) return;
305 if (0 != randint0(20000L / (plev * plev + 40))) return;
317 if (0 != randint0(95000L / (plev * plev + 40))) return;
330 if (0 != randint0(77777L / (plev * plev + 40))) return;
339 case CLASS_WARRIOR_MAGE:
343 if (0 != randint0(75000L / (plev * plev + 40))) return;
349 case CLASS_MINDCRAFTER:
351 case CLASS_BLUE_MAGE:
352 case CLASS_MIRROR_MASTER:
355 if (0 != randint0(55000L / (plev * plev + 40))) return;
361 case CLASS_CHAOS_WARRIOR:
364 if (0 != randint0(80000L / (plev * plev + 40))) return;
374 case CLASS_FORCETRAINER:
377 if (0 != randint0(20000L / (plev * plev + 40))) return;
386 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
395 case CLASS_BEASTMASTER:
398 if (0 != randint0(65000L / (plev * plev + 40))) return;
403 case CLASS_BERSERKER:
413 if (compare_virtue(V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
415 /*** Sense everything ***/
417 /* Check everything */
418 for (i = 0; i < INVEN_TOTAL; i++)
422 o_ptr = &inventory[i];
424 /* Skip empty slots */
425 if (!o_ptr->k_idx) continue;
427 /* Valid "tval" codes */
454 /* Skip non-sense machines */
457 /* Occasional failure on inventory items */
458 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
461 if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
466 sense_inventory_aux(i, heavy);
471 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
474 static void sense_inventory2(void)
477 int plev = p_ptr->lev;
481 /*** Check for "sensing" ***/
483 /* No sensing when confused */
484 if (p_ptr->confused) return;
486 /* Analyze the class */
487 switch (p_ptr->pclass)
493 case CLASS_BERSERKER:
501 case CLASS_CHAOS_WARRIOR:
503 case CLASS_BEASTMASTER:
506 /* Very bad (light) sensing */
507 if (0 != randint0(240000L / (plev + 5))) return;
514 case CLASS_WARRIOR_MAGE:
519 if (0 != randint0(95000L / (plev * plev + 40))) return;
528 case CLASS_FORCETRAINER:
529 case CLASS_MINDCRAFTER:
532 if (0 != randint0(20000L / (plev * plev + 40))) return;
539 case CLASS_HIGH_MAGE:
541 case CLASS_MAGIC_EATER:
542 case CLASS_MIRROR_MASTER:
543 case CLASS_BLUE_MAGE:
546 if (0 != randint0(9000L / (plev * plev + 40))) return;
555 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
562 /*** Sense everything ***/
564 /* Check everything */
565 for (i = 0; i < INVEN_TOTAL; i++)
569 o_ptr = &inventory[i];
571 /* Skip empty slots */
572 if (!o_ptr->k_idx) continue;
574 /* Valid "tval" codes */
587 /* Skip non-sense machines */
590 /* Occasional failure on inventory items */
591 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
593 sense_inventory_aux(i, TRUE);
598 * @brief パターン終点到達時のテレポート処理を行う
601 static void pattern_teleport(void)
607 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
612 /* Only downward in ironman mode */
613 if (ironman_downward)
614 min_level = dun_level;
617 if (dungeon_type == DUNGEON_ANGBAND)
620 max_level = MAX_DEPTH - 1;
621 else if (dun_level == 100)
626 max_level = d_info[dungeon_type].maxdepth;
627 min_level = d_info[dungeon_type].mindepth;
631 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), min_level, max_level);
634 sprintf(tmp_val, "%d", dun_level);
636 /* Ask for a level */
637 if (!get_string(ppp, tmp_val, 10)) return;
639 /* Extract request */
640 command_arg = atoi(tmp_val);
642 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
644 teleport_player(200, 0L);
653 if (command_arg < min_level) command_arg = min_level;
656 if (command_arg > max_level) command_arg = max_level;
659 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
661 if (autosave_l) do_cmd_save_game(TRUE);
664 dun_level = command_arg;
668 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
670 p_ptr->inside_quest = 0;
671 p_ptr->energy_use = 0;
674 * Clear all saved floors
675 * and create a first saved floor
677 prepare_change_floor_mode(CFM_FIRST_FLOOR);
680 p_ptr->leaving = TRUE;
684 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
687 static void wreck_the_pattern(void)
689 int to_ruin = 0, r_y, r_x;
690 int pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype;
692 if (pattern_type == PATTERN_TILE_WRECKED)
698 msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
699 msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
702 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
704 to_ruin = randint1(45) + 35;
708 scatter(&r_y, &r_x, p_ptr->y, p_ptr->x, 4, 0);
710 if (pattern_tile(r_y, r_x) &&
711 (f_info[cave[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
713 cave_set_feat(r_y, r_x, feat_pattern_corrupted);
717 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_corrupted);
721 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
722 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
724 static bool pattern_effect(void)
728 if (!pattern_tile(p_ptr->y, p_ptr->x)) return FALSE;
730 if ((prace_is_(RACE_AMBERITE)) &&
731 (p_ptr->cut > 0) && one_in_(10))
736 pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype;
738 switch (pattern_type)
740 case PATTERN_TILE_END:
741 (void)set_poisoned(0);
747 (void)do_res_stat(A_STR);
748 (void)do_res_stat(A_INT);
749 (void)do_res_stat(A_WIS);
750 (void)do_res_stat(A_DEX);
751 (void)do_res_stat(A_CON);
752 (void)do_res_stat(A_CHR);
753 (void)restore_level();
754 (void)hp_player(1000);
756 cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old);
757 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
760 * We could make the healing effect of the
761 * Pattern center one-time only to avoid various kinds
762 * of abuse, like luring the win monster into fighting you
763 * in the middle of the pattern...
767 case PATTERN_TILE_OLD:
771 case PATTERN_TILE_TELEPORT:
775 case PATTERN_TILE_WRECKED:
777 take_hit(DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
781 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
783 else if (!IS_INVULN())
784 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
793 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
794 * @param percent 回復比率
797 static void regenhp(int percent)
803 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
804 if (p_ptr->action == ACTION_HAYAGAKE) return;
806 /* Save the old hitpoints */
807 old_chp = p_ptr->chp;
810 * Extract the new hitpoints
812 * 'percent' is the Regen factor in unit (1/2^16)
815 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
817 /* Convert the unit (1/2^16) to (1/2^32) */
818 s64b_LSHIFT(new_chp, new_chp_frac, 16);
821 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
825 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
827 p_ptr->chp = p_ptr->mhp;
832 if (old_chp != p_ptr->chp)
835 p_ptr->redraw |= (PR_HP);
838 p_ptr->window |= (PW_PLAYER);
846 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
847 * @param upkeep_factor ペット維持によるMPコスト量
848 * @param regen_amount 回復量
851 static void regenmana(int upkeep_factor, int regen_amount)
853 s32b old_csp = p_ptr->csp;
854 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
857 * Excess mana will decay 32 times faster than normal
860 if (p_ptr->csp > p_ptr->msp)
862 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
864 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
866 /* Convert the unit (1/2^16) to (1/2^32) */
867 s64b_LSHIFT(decay, decay_frac, 16);
870 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
873 if (p_ptr->csp < p_ptr->msp)
875 p_ptr->csp = p_ptr->msp;
880 /* Regenerating mana (unless the player has excess mana) */
881 else if (regen_rate > 0)
883 /* (percent/100) is the Regen factor in unit (1/2^16) */
885 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
887 /* Convert the unit (1/2^16) to (1/2^32) */
888 s64b_LSHIFT(new_mana, new_mana_frac, 16);
891 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
893 /* Must set frac to zero even if equal */
894 if (p_ptr->csp >= p_ptr->msp)
896 p_ptr->csp = p_ptr->msp;
902 /* Reduce mana (even when the player has excess mana) */
905 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
906 s32b reduce_mana = 0;
907 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
909 /* Convert the unit (1/2^16) to (1/2^32) */
910 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
913 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
925 if (old_csp != p_ptr->csp)
928 p_ptr->redraw |= (PR_MANA);
931 p_ptr->window |= (PW_PLAYER);
932 p_ptr->window |= (PW_SPELL);
939 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
940 * @param regen_amount 回復量
943 static void regenmagic(int regen_amount)
948 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
950 for (i = 0; i < EATER_EXT*2; i++)
952 if (!p_ptr->magic_num2[i]) continue;
953 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
955 /* Increase remaining charge number like float value */
956 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
957 p_ptr->magic_num1[i] += new_mana;
959 /* Check maximum charge */
960 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
962 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
966 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
968 if (!p_ptr->magic_num1[i]) continue;
969 if (!p_ptr->magic_num2[i]) continue;
971 /* Decrease remaining period for charging */
972 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
973 / (dev * 16 * PY_REGEN_NORMAL);
974 p_ptr->magic_num1[i] -= new_mana;
976 /* Check minimum remaining period for charging */
977 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
984 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
986 * @note XXX XXX XXX Should probably be done during monster turns.
988 static void regen_monsters(void)
993 /* Regenerate everyone */
994 for (i = 1; i < m_max; i++)
996 /* Check the i'th monster */
997 monster_type *m_ptr = &m_list[i];
998 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1001 /* Skip dead monsters */
1002 if (!m_ptr->r_idx) continue;
1004 /* Allow regeneration (if needed) */
1005 if (m_ptr->hp < m_ptr->maxhp)
1007 /* Hack -- Base regeneration */
1008 frac = m_ptr->maxhp / 100;
1010 /* Hack -- Minimal regeneration rate */
1011 if (!frac) if (one_in_(2)) frac = 1;
1013 /* Hack -- Some monsters regenerate quickly */
1014 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1016 /* Hack -- Regenerate */
1019 /* Do not over-regenerate */
1020 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1022 /* Redraw (later) if needed */
1023 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1024 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1031 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
1033 * @note XXX XXX XXX Should probably be done during monster turns.
1035 static void regen_captured_monsters(void)
1040 /* Regenerate everyone */
1041 for (i = 0; i < INVEN_TOTAL; i++)
1043 monster_race *r_ptr;
1044 object_type *o_ptr = &inventory[i];
1046 if (!o_ptr->k_idx) continue;
1047 if (o_ptr->tval != TV_CAPTURE) continue;
1048 if (!o_ptr->pval) continue;
1052 r_ptr = &r_info[o_ptr->pval];
1054 /* Allow regeneration (if needed) */
1055 if (o_ptr->xtra4 < o_ptr->xtra5)
1057 /* Hack -- Base regeneration */
1058 frac = o_ptr->xtra5 / 100;
1060 /* Hack -- Minimal regeneration rate */
1061 if (!frac) if (one_in_(2)) frac = 1;
1063 /* Hack -- Some monsters regenerate quickly */
1064 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1066 /* Hack -- Regenerate */
1067 o_ptr->xtra4 += frac;
1069 /* Do not over-regenerate */
1070 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1077 p_ptr->notice |= (PN_COMBINE);
1080 p_ptr->window |= (PW_INVEN);
1081 p_ptr->window |= (PW_EQUIP);
1087 * @brief 寿命つき光源の警告メッセージ処理
1088 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1091 static void notice_lite_change(object_type *o_ptr)
1093 /* Hack -- notice interesting fuel steps */
1094 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1097 p_ptr->window |= (PW_EQUIP);
1100 /* Hack -- Special treatment when blind */
1103 /* Hack -- save some light for later */
1104 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1107 /* The light is now out */
1108 else if (o_ptr->xtra4 == 0)
1111 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1113 /* Recalculate torch radius */
1114 p_ptr->update |= (PU_TORCH);
1116 /* Some ego light lose its effects without fuel */
1117 p_ptr->update |= (PU_BONUS);
1120 /* The light is getting dim */
1121 else if (o_ptr->name2 == EGO_LITE_LONG)
1123 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1124 && (turn % (TURNS_PER_TICK*2)))
1126 if (disturb_minor) disturb(0, 1);
1127 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1131 /* The light is getting dim */
1132 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1134 if (disturb_minor) disturb(0, 1);
1135 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1140 * @brief クエスト階層から離脱する際の処理
1143 void leave_quest_check(void)
1145 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1146 leaving_quest = p_ptr->inside_quest;
1148 /* Leaving an 'only once' quest marks it as failed */
1151 quest_type* const q_ptr = &quest[leaving_quest];
1153 if(((q_ptr->flags & QUEST_FLAG_ONCE) || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
1154 (q_ptr->status == QUEST_STATUS_TAKEN))
1156 q_ptr->status = QUEST_STATUS_FAILED;
1157 q_ptr->complev = (byte)p_ptr->lev;
1159 q_ptr->comptime = playtime;
1161 /* Additional settings */
1162 switch (q_ptr->type)
1164 case QUEST_TYPE_TOWER:
1165 quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
1166 quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
1168 case QUEST_TYPE_FIND_ARTIFACT:
1169 a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
1171 case QUEST_TYPE_RANDOM:
1172 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
1174 /* Floor of random quest will be blocked */
1175 prepare_change_floor_mode(CFM_NO_RETURN);
1179 /* Record finishing a quest */
1180 if (q_ptr->type == QUEST_TYPE_RANDOM)
1182 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1186 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1193 * @brief 「塔」クエストの各階層から離脱する際の処理
1196 void leave_tower_check(void)
1198 leaving_quest = p_ptr->inside_quest;
1199 /* Check for Tower Quest */
1200 if (leaving_quest &&
1201 (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
1202 (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
1204 if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
1206 quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
1207 quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
1209 quest[QUEST_TOWER1].comptime = playtime;
1215 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
1217 * @todo mind.cにこの関数を移動させるべき。
1219 * currently this function allows pseudo-id of any object,
1220 * including silly ones like potions & scrolls, which always
1221 * get '{average}'. This should be changed, either to stop such
1222 * items from being pseudo-id'd, or to allow psychometry to
1223 * detect whether the unidentified potion/scroll/etc is
1224 * good (Cure Light Wounds, Restore Strength, etc) or
1225 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1227 bool psychometry(void)
1231 char o_name[MAX_NLEN];
1236 item_tester_no_ryoute = TRUE;
1238 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
1239 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
1241 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1243 /* Get the item (in the pack) */
1246 o_ptr = &inventory[item];
1249 /* Get the item (on the floor) */
1252 o_ptr = &o_list[0 - item];
1255 /* It is fully known, no information needed */
1256 if (object_is_known(o_ptr))
1258 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
1262 /* Check for a feeling */
1263 feel = value_check_aux1(o_ptr);
1265 /* Get an object description */
1266 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1268 /* Skip non-feelings */
1271 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
1276 msg_format("%sは%sという感じがする...",
1277 o_name, game_inscriptions[feel]);
1279 msg_format("You feel that the %s %s %s...",
1280 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1281 game_inscriptions[feel]);
1285 /* We have "felt" it */
1286 o_ptr->ident |= (IDENT_SENSE);
1289 o_ptr->feeling = feel;
1291 /* Player touches it */
1292 o_ptr->marked |= OM_TOUCHED;
1294 /* Combine / Reorder the pack (later) */
1295 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1298 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1300 /* Valid "tval" codes */
1301 switch (o_ptr->tval)
1329 /* Auto-inscription/destroy */
1330 autopick_alter_item(item, (bool)(okay && destroy_feeling));
1332 /* Something happened */
1337 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1338 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1341 static void recharged_notice(object_type *o_ptr)
1343 char o_name[MAX_NLEN];
1347 /* No inscription */
1348 if (!o_ptr->inscription) return;
1351 s = my_strchr(quark_str(o_ptr->inscription), '!');
1353 /* Process notification request. */
1356 /* Find another '!' */
1359 /* Describe (briefly) */
1360 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1362 /* Notify the player */
1364 msg_format("%sは再充填された。", o_name);
1366 if (o_ptr->number > 1)
1367 msg_format("Your %s are recharged.", o_name);
1369 msg_format("Your %s is recharged.", o_name);
1378 /* Keep looking for '!'s */
1379 s = my_strchr(s + 1, '!');
1384 * @brief プレイヤーの歌に関する継続処理
1387 static void check_music(void)
1389 const magic_type *s_ptr;
1392 u32b need_mana_frac;
1394 /* Music singed by player */
1395 if (p_ptr->pclass != CLASS_BARD) return;
1396 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1398 if (p_ptr->anti_magic)
1404 spell = p_ptr->magic_num2[0];
1405 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1407 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1411 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1413 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1420 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1422 p_ptr->redraw |= PR_MANA;
1423 if (p_ptr->magic_num1[1])
1425 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1426 p_ptr->magic_num1[1] = 0;
1427 msg_print(_("歌を再開した。", "You restart singing."));
1428 p_ptr->action = ACTION_SING;
1430 /* Recalculate bonuses */
1431 p_ptr->update |= (PU_BONUS | PU_HP);
1433 /* Redraw map and status bar */
1434 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1436 /* Update monsters */
1437 p_ptr->update |= (PU_MONSTERS);
1440 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1443 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1444 p_ptr->spell_exp[spell] += 5;
1445 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1446 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1447 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1448 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1449 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1450 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1452 /* Do any effects of continual song */
1453 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1457 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1458 * @param flag 探し出したい呪いフラグ配列
1459 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1462 static object_type *choose_cursed_obj_name(u32b flag)
1465 int choices[INVEN_TOTAL-INVEN_RARM];
1468 /* Paranoia -- Player has no warning-item */
1469 if (!(p_ptr->cursed & flag)) return NULL;
1471 /* Search Inventry */
1472 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1474 object_type *o_ptr = &inventory[i];
1476 if (o_ptr->curse_flags & flag)
1478 choices[number] = i;
1481 else if ((flag == TRC_ADD_L_CURSE) ||
1482 (flag == TRC_ADD_H_CURSE) ||
1483 (flag == TRC_DRAIN_HP) ||
1484 (flag == TRC_DRAIN_MANA) ||
1485 (flag == TRC_CALL_ANIMAL) ||
1486 (flag == TRC_CALL_DEMON) ||
1487 (flag == TRC_CALL_DRAGON) ||
1488 (flag == TRC_CALL_UNDEAD) ||
1489 (flag == TRC_COWARDICE) ||
1490 (flag == TRC_LOW_MELEE) ||
1491 (flag == TRC_LOW_AC) ||
1492 (flag == TRC_LOW_MAGIC) ||
1493 (flag == TRC_FAST_DIGEST) ||
1494 (flag == TRC_SLOW_REGEN) )
1497 u32b flgs[TR_FLAG_SIZE];
1498 object_flags(o_ptr, flgs);
1501 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1502 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1503 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1504 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1505 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1506 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1507 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1508 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1509 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1510 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1511 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1512 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1513 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1514 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1517 if (have_flag(flgs, cf))
1519 choices[number] = i;
1525 /* Choice one of them */
1526 return (&inventory[choices[randint0(number)]]);
1530 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1531 * / Handle timed damage and regeneration every 10 game turns
1534 static void process_world_aux_hp_and_sp(void)
1536 feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
1537 bool cave_no_regen = FALSE;
1538 int upkeep_factor = 0;
1540 /* Default regeneration */
1541 int regen_amount = PY_REGEN_NORMAL;
1544 /*** Damage over Time ***/
1546 /* Take damage from poison */
1547 if (p_ptr->poisoned && !IS_INVULN())
1550 take_hit(DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1553 /* Take damage from cuts */
1554 if (p_ptr->cut && !IS_INVULN())
1558 /* Mortal wound or Deep Gash */
1559 if (p_ptr->cut > 1000)
1564 else if (p_ptr->cut > 200)
1570 else if (p_ptr->cut > 100)
1575 else if (p_ptr->cut > 50)
1580 else if (p_ptr->cut > 25)
1585 else if (p_ptr->cut > 10)
1597 take_hit(DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1601 /* (Vampires) Take damage from sunlight */
1602 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1604 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1606 if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1609 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1610 take_hit(DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1612 cave_no_regen = TRUE;
1616 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1617 !p_ptr->resist_lite)
1619 object_type * o_ptr = &inventory[INVEN_LITE];
1620 char o_name [MAX_NLEN];
1621 char ouch [MAX_NLEN+40];
1623 /* Get an object description */
1624 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1625 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1627 cave_no_regen = TRUE;
1629 /* Get an object description */
1630 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1631 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1633 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1637 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1641 if (have_flag(f_ptr->flags, FF_DEEP))
1643 damage = 6000 + randint0(4000);
1645 else if (!p_ptr->levitation)
1647 damage = 3000 + randint0(2000);
1652 if (prace_is_(RACE_ENT)) damage += damage / 3;
1653 if (p_ptr->resist_fire) damage = damage / 3;
1654 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1656 if (p_ptr->levitation) damage = damage / 5;
1658 damage = damage / 100 + (randint0(100) < (damage % 100));
1660 if (p_ptr->levitation)
1662 msg_print(_("熱で火傷した!", "The heat burns you!"));
1663 take_hit(DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1664 f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1);
1668 cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name;
1669 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1670 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1673 cave_no_regen = TRUE;
1677 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1678 !p_ptr->levitation && !p_ptr->can_swim)
1680 if (p_ptr->total_weight > weight_limit())
1683 msg_print(_("溺れている!", "You are drowning!"));
1684 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺れ", "drowning"), -1);
1685 cave_no_regen = TRUE;
1692 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1694 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1695 if (prace_is_(RACE_ENT)) damage += damage / 3;
1696 if (p_ptr->resist_fire) damage = damage / 3;
1697 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1698 msg_print(_("熱い!", "It's hot!"));
1699 take_hit(DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1701 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1703 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1704 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1705 if (p_ptr->resist_elec) damage = damage / 3;
1706 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1707 msg_print(_("痛い!", "It hurts!"));
1708 take_hit(DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1710 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1712 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1713 if (p_ptr->resist_cold) damage = damage / 3;
1714 if (IS_OPPOSE_COLD()) damage = damage / 3;
1715 msg_print(_("冷たい!", "It's cold!"));
1716 take_hit(DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1720 /* Spectres -- take damage when moving through walls */
1722 * Added: ANYBODY takes damage if inside through walls
1723 * without wraith form -- NOTE: Spectres will never be
1724 * reduced below 0 hp by being inside a stone wall; others
1727 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1729 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
1730 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1734 cave_no_regen = TRUE;
1736 if (p_ptr->pass_wall)
1738 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1739 dam_desc = _("密度", "density");
1743 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1744 dam_desc = _("硬い岩", "solid rock");
1747 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1752 /*** handle regeneration ***/
1755 if (p_ptr->food < PY_FOOD_WEAK)
1757 /* Lower regeneration */
1758 if (p_ptr->food < PY_FOOD_STARVE)
1762 else if (p_ptr->food < PY_FOOD_FAINT)
1764 regen_amount = PY_REGEN_FAINT;
1768 regen_amount = PY_REGEN_WEAK;
1772 /* Are we walking the pattern? */
1773 if (pattern_effect())
1775 cave_no_regen = TRUE;
1779 /* Regeneration ability */
1780 if (p_ptr->regenerate)
1782 regen_amount = regen_amount * 2;
1784 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1788 if (p_ptr->cursed & TRC_SLOW_REGEN)
1795 /* Searching or Resting */
1796 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1798 regen_amount = regen_amount * 2;
1801 upkeep_factor = calculate_upkeep();
1803 /* No regeneration while special action */
1804 if ((p_ptr->action == ACTION_LEARN) ||
1805 (p_ptr->action == ACTION_HAYAGAKE) ||
1806 (p_ptr->special_defense & KATA_KOUKIJIN))
1808 upkeep_factor += 100;
1811 /* Regenerate the mana */
1812 regenmana(upkeep_factor, regen_amount);
1815 /* Recharge magic eater's power */
1816 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1818 regenmagic(regen_amount);
1821 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1823 while (upkeep_factor > 100)
1825 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1827 do_cmd_pet_dismiss();
1829 upkeep_factor = calculate_upkeep();
1831 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1836 /* Poisoned or cut yields no healing */
1837 if (p_ptr->poisoned) regen_amount = 0;
1838 if (p_ptr->cut) regen_amount = 0;
1840 /* Special floor -- Pattern, in a wall -- yields no healing */
1841 if (cave_no_regen) regen_amount = 0;
1843 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
1845 /* Regenerate Hit Points if needed */
1846 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1848 regenhp(regen_amount);
1853 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1854 * / Handle timeout every 10 game turns
1857 static void process_world_aux_timeout(void)
1859 const int dec_count = (easy_band ? 2 : 1);
1861 /*** Timeout Various Things ***/
1864 if (p_ptr->tim_mimic)
1866 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
1869 /* Hack -- Hallucinating */
1872 (void)set_image(p_ptr->image - dec_count);
1878 (void)set_blind(p_ptr->blind - dec_count);
1881 /* Times see-invisible */
1882 if (p_ptr->tim_invis)
1884 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
1895 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
1898 /* Timed temporary elemental brands. -LM- */
1899 if (p_ptr->ele_attack)
1901 p_ptr->ele_attack--;
1903 /* Clear all temporary elemental brands. */
1904 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
1907 /* Timed temporary elemental immune. -LM- */
1908 if (p_ptr->ele_immune)
1910 p_ptr->ele_immune--;
1912 /* Clear all temporary elemental brands. */
1913 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
1916 /* Timed infra-vision */
1917 if (p_ptr->tim_infra)
1919 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
1923 if (p_ptr->tim_stealth)
1925 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
1928 /* Timed levitation */
1929 if (p_ptr->tim_levitation)
1931 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
1934 /* Timed sh_touki */
1935 if (p_ptr->tim_sh_touki)
1937 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
1941 if (p_ptr->tim_sh_fire)
1943 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
1947 if (p_ptr->tim_sh_holy)
1949 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
1953 if (p_ptr->tim_eyeeye)
1955 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
1958 /* Timed resist-magic */
1959 if (p_ptr->resist_magic)
1961 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
1964 /* Timed regeneration */
1965 if (p_ptr->tim_regen)
1967 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
1970 /* Timed resist nether */
1971 if (p_ptr->tim_res_nether)
1973 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
1976 /* Timed resist time */
1977 if (p_ptr->tim_res_time)
1979 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
1983 if (p_ptr->tim_reflect)
1985 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
1989 if (p_ptr->multishadow)
1991 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
1994 /* Timed Robe of dust */
1995 if (p_ptr->dustrobe)
1997 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2000 /* Timed infra-vision */
2001 if (p_ptr->kabenuke)
2003 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2007 if (p_ptr->paralyzed)
2009 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2013 if (p_ptr->confused)
2015 (void)set_confused(p_ptr->confused - dec_count);
2021 (void)set_afraid(p_ptr->afraid - dec_count);
2027 (void)set_fast(p_ptr->fast - 1, TRUE);
2033 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2036 /* Protection from evil */
2037 if (p_ptr->protevil)
2039 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2042 /* Invulnerability */
2045 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2049 if (p_ptr->wraith_form)
2051 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2057 (void)set_hero(p_ptr->hero - 1, TRUE);
2063 (void)set_shero(p_ptr->shero - 1, TRUE);
2069 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2075 (void)set_shield(p_ptr->shield - 1, TRUE);
2079 if (p_ptr->tsubureru)
2081 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2085 if (p_ptr->magicdef)
2087 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2091 if (p_ptr->tsuyoshi)
2093 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2097 if (p_ptr->oppose_acid)
2099 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2102 /* Oppose Lightning */
2103 if (p_ptr->oppose_elec)
2105 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2109 if (p_ptr->oppose_fire)
2111 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2115 if (p_ptr->oppose_cold)
2117 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2121 if (p_ptr->oppose_pois)
2123 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2128 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2131 /*** Poison and Stun and Cut ***/
2134 if (p_ptr->poisoned)
2136 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2138 /* Apply some healing */
2139 (void)set_poisoned(p_ptr->poisoned - adjust);
2145 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2147 /* Apply some healing */
2148 (void)set_stun(p_ptr->stun - adjust);
2154 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2156 /* Hack -- Truly "mortal" wound */
2157 if (p_ptr->cut > 1000) adjust = 0;
2159 /* Apply some healing */
2160 (void)set_cut(p_ptr->cut - adjust);
2166 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2167 * / Handle burning fuel every 10 game turns
2170 static void process_world_aux_light(void)
2172 /* Check for light being wielded */
2173 object_type *o_ptr = &inventory[INVEN_LITE];
2175 /* Burn some fuel in the current lite */
2176 if (o_ptr->tval == TV_LITE)
2178 /* Hack -- Use some fuel (except on artifacts) */
2179 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2181 /* Decrease life-span */
2182 if (o_ptr->name2 == EGO_LITE_LONG)
2184 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2186 else o_ptr->xtra4--;
2188 /* Notice interesting fuel steps */
2189 notice_lite_change(o_ptr);
2196 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2197 * / Handle mutation effects once every 10 game turns
2200 static void process_world_aux_mutation(void)
2202 /* No mutation with effects */
2203 if (!p_ptr->muta2) return;
2205 /* No effect on monster arena */
2206 if (p_ptr->inside_battle) return;
2208 /* No effect on the global map */
2209 if (p_ptr->wild_mode) return;
2212 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2215 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2216 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2218 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2219 (void)set_afraid(0);
2222 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2224 if (!p_ptr->resist_fear)
2227 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2228 set_afraid(p_ptr->afraid + 13 + randint1(26));
2232 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2234 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2239 /* Teleport player */
2240 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2242 teleport_player(40, TELEPORT_PASSIVE);
2246 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2248 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2251 p_ptr->redraw |= PR_EXTRA;
2252 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2255 if (!p_ptr->resist_conf)
2257 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2260 if (!p_ptr->resist_chaos)
2265 if (one_in_(3)) lose_all_info();
2267 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2269 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2270 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2276 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2277 (void)set_image(p_ptr->image + randint0(150) + 150);
2283 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2285 if (!p_ptr->resist_chaos)
2288 p_ptr->redraw |= PR_EXTRA;
2289 (void)set_image(p_ptr->image + randint0(50) + 20);
2293 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2297 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2300 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2303 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2304 !p_ptr->anti_magic && one_in_(9000))
2308 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2309 "Magical energy flows through you! You must release it!"));
2313 (void)get_hack_dir(&dire);
2314 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2317 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2318 !p_ptr->anti_magic && (randint1(6666) == 666))
2320 bool pet = one_in_(6);
2321 u32b mode = PM_ALLOW_GROUP;
2323 if (pet) mode |= PM_FORCE_PET;
2324 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2326 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x,
2327 dun_level, SUMMON_DEMON, mode))
2329 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2334 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2339 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2341 if (p_ptr->fast > 0)
2347 set_slow(randint1(30) + 10, FALSE);
2352 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2354 if (p_ptr->slow > 0)
2360 set_fast(randint1(30) + 10, FALSE);
2365 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2368 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2370 banish_monsters(100);
2371 if (!dun_level && p_ptr->town_num)
2375 /* Pick a random shop (except home) */
2378 n = randint0(MAX_STORES);
2380 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2382 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2388 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2392 msg_print(_("影につつまれた。", "A shadow passes over you."));
2395 /* Absorb light from the current possition */
2396 if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2401 o_ptr = &inventory[INVEN_LITE];
2403 /* Absorb some fuel in the current lite */
2404 if (o_ptr->tval == TV_LITE)
2406 /* Use some fuel (except on artifacts) */
2407 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2409 /* Heal the player a bit */
2410 hp_player(o_ptr->xtra4 / 20);
2412 /* Decrease life-span of lite */
2414 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2416 /* Notice interesting fuel steps */
2417 notice_lite_change(o_ptr);
2422 * Unlite the area (radius 10) around player and
2423 * do 50 points damage to every affected monster
2425 unlite_area(50, 10);
2428 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
2429 !p_ptr->anti_magic && one_in_(7000))
2431 bool pet = one_in_(3);
2432 u32b mode = PM_ALLOW_GROUP;
2434 if (pet) mode |= PM_FORCE_PET;
2435 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2437 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL, mode))
2439 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2444 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
2445 !p_ptr->anti_magic && one_in_(8000))
2448 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2451 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2453 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2455 if (!lose_mutation(0))
2456 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2458 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2461 msg_print(_("非物質化した!", "You feel insubstantial!"));
2464 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2466 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2470 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2472 int which_stat = randint0(6);
2473 int sustained = FALSE;
2478 if (p_ptr->sustain_str) sustained = TRUE;
2481 if (p_ptr->sustain_int) sustained = TRUE;
2484 if (p_ptr->sustain_wis) sustained = TRUE;
2487 if (p_ptr->sustain_dex) sustained = TRUE;
2490 if (p_ptr->sustain_con) sustained = TRUE;
2493 if (p_ptr->sustain_chr) sustained = TRUE;
2496 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2503 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2505 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2508 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
2509 !p_ptr->anti_magic && one_in_(3000))
2511 bool pet = one_in_(5);
2512 u32b mode = PM_ALLOW_GROUP;
2514 if (pet) mode |= PM_FORCE_PET;
2515 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2517 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON, mode))
2519 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2523 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
2526 if (p_ptr->tim_esp > 0)
2528 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2529 set_tim_esp(0, TRUE);
2533 msg_print(_("精神が広がった!", "Your mind expands!"));
2534 set_tim_esp(p_ptr->lev, FALSE);
2537 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
2541 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2543 set_food(PY_FOOD_WEAK);
2544 if (music_singing_any()) stop_singing();
2545 if (hex_spelling_any()) stop_hex_spell_all();
2548 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
2549 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2554 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2556 int danger_amount = 0;
2559 for (monster = 0; monster < m_max; monster++)
2561 monster_type *m_ptr = &m_list[monster];
2562 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2564 /* Paranoia -- Skip dead monsters */
2565 if (!m_ptr->r_idx) continue;
2567 if (r_ptr->level >= p_ptr->lev)
2569 danger_amount += r_ptr->level - p_ptr->lev + 1;
2573 if (danger_amount > 100)
2574 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2575 else if (danger_amount > 50)
2576 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2577 else if (danger_amount > 20)
2578 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2579 else if (danger_amount > 10)
2580 msg_print(_("心配な気がする!", "You feel paranoid!"));
2581 else if (danger_amount > 5)
2582 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2584 msg_print(_("寂しい気がする。", "You feel lonely."));
2586 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
2590 msg_print(_("無敵な気がする!", "You feel invincible!"));
2592 (void)set_invuln(randint1(8) + 8, FALSE);
2594 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2596 int wounds = p_ptr->mhp - p_ptr->chp;
2600 int healing = p_ptr->csp;
2602 if (healing > wounds)
2608 p_ptr->csp -= healing;
2611 p_ptr->redraw |= (PR_MANA);
2614 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
2617 int wounds = p_ptr->msp - p_ptr->csp;
2621 int healing = p_ptr->chp;
2623 if (healing > wounds)
2628 p_ptr->csp += healing;
2631 p_ptr->redraw |= (PR_MANA);
2632 take_hit(DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2635 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2638 object_type *o_ptr = NULL;
2641 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2642 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1);
2645 if (buki_motteruka(INVEN_RARM))
2648 o_ptr = &inventory[INVEN_RARM];
2650 if (buki_motteruka(INVEN_LARM) && one_in_(2))
2652 o_ptr = &inventory[INVEN_LARM];
2656 else if (buki_motteruka(INVEN_LARM))
2658 o_ptr = &inventory[INVEN_LARM];
2662 if (slot && !object_is_cursed(o_ptr))
2664 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2665 inven_drop(slot, 1);
2671 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2672 * / Handle curse effects once every 10 game turns
2675 static void process_world_aux_curse(void)
2677 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2680 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2681 * can actually be useful!
2683 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2685 char o_name[MAX_NLEN];
2687 int i, i_keep = 0, count = 0;
2689 /* Scan the equipment with random teleport ability */
2690 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2692 u32b flgs[TR_FLAG_SIZE];
2693 o_ptr = &inventory[i];
2695 /* Skip non-objects */
2696 if (!o_ptr->k_idx) continue;
2698 /* Extract the item flags */
2699 object_flags(o_ptr, flgs);
2701 if (have_flag(flgs, TR_TELEPORT))
2703 /* {.} will stop random teleportation. */
2704 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2707 if (one_in_(count)) i_keep = i;
2712 o_ptr = &inventory[i_keep];
2713 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2714 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2715 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2718 teleport_player(50, 0L);
2722 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2723 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2727 /* Make a chainsword noise */
2728 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2731 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2733 disturb(FALSE, FALSE);
2736 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2739 (void)activate_ty_curse(FALSE, &count);
2741 /* Handle experience draining */
2742 if (p_ptr->prace != RACE_ANDROID &&
2743 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2745 p_ptr->exp -= (p_ptr->lev+1)/2;
2746 if (p_ptr->exp < 0) p_ptr->exp = 0;
2747 p_ptr->max_exp -= (p_ptr->lev+1)/2;
2748 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
2751 /* Add light curse (Later) */
2752 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2757 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2759 new_curse = get_curse(0, o_ptr);
2760 if (!(o_ptr->curse_flags & new_curse))
2762 char o_name[MAX_NLEN];
2764 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2766 o_ptr->curse_flags |= new_curse;
2767 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2769 o_ptr->feeling = FEEL_NONE;
2771 p_ptr->update |= (PU_BONUS);
2774 /* Add heavy curse (Later) */
2775 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2780 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2782 new_curse = get_curse(1, o_ptr);
2783 if (!(o_ptr->curse_flags & new_curse))
2785 char o_name[MAX_NLEN];
2787 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2789 o_ptr->curse_flags |= new_curse;
2790 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2791 o_ptr->feeling = FEEL_NONE;
2793 p_ptr->update |= (PU_BONUS);
2797 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2799 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL,
2800 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2802 char o_name[MAX_NLEN];
2804 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2805 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2810 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2812 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2814 char o_name[MAX_NLEN];
2816 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2817 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2822 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2824 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON,
2825 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2827 char o_name[MAX_NLEN];
2829 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2830 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2835 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2837 if (summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD,
2838 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2840 char o_name[MAX_NLEN];
2842 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2843 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2847 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2849 if (!p_ptr->resist_fear)
2852 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2853 set_afraid(p_ptr->afraid + 13 + randint1(26));
2856 /* Teleport player */
2857 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
2861 /* Teleport player */
2862 teleport_player(40, TELEPORT_PASSIVE);
2864 /* Handle HP draining */
2865 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2867 char o_name[MAX_NLEN];
2869 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2870 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2871 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
2873 /* Handle mana draining */
2874 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
2876 char o_name[MAX_NLEN];
2878 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2879 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2880 p_ptr->csp -= MIN(p_ptr->lev, 50);
2884 p_ptr->csp_frac = 0;
2886 p_ptr->redraw |= PR_MANA;
2890 /* Rarely, take damage from the Jewel of Judgement */
2891 if (one_in_(999) && !p_ptr->anti_magic)
2893 object_type *o_ptr = &inventory[INVEN_LITE];
2895 if (o_ptr->name1 == ART_JUDGE)
2898 if (object_is_known(o_ptr))
2899 msg_print("『審判の宝石』はあなたの体力を吸収した!");
2901 msg_print("なにかがあなたの体力を吸収した!");
2902 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "審判の宝石", -1);
2904 if (object_is_known(o_ptr))
2905 msg_print("The Jewel of Judgement drains life from you!");
2907 msg_print("Something drains life from you!");
2908 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
2916 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2917 * / Handle recharging objects once every 10 game turns
2920 static void process_world_aux_recharge(void)
2925 /* Process equipment */
2926 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2928 /* Get the object */
2929 object_type *o_ptr = &inventory[i];
2931 /* Skip non-objects */
2932 if (!o_ptr->k_idx) continue;
2934 /* Recharge activatable objects */
2935 if (o_ptr->timeout > 0)
2940 /* Notice changes */
2941 if (!o_ptr->timeout)
2943 recharged_notice(o_ptr);
2949 /* Notice changes */
2953 p_ptr->window |= (PW_EQUIP);
2958 * Recharge rods. Rods now use timeout to control charging status,
2959 * and each charging rod in a stack decreases the stack's timeout by
2960 * one per turn. -LM-
2962 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2964 object_type *o_ptr = &inventory[i];
2965 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2967 /* Skip non-objects */
2968 if (!o_ptr->k_idx) continue;
2970 /* Examine all charging rods or stacks of charging rods. */
2971 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2973 /* Determine how many rods are charging. */
2974 int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2975 if (temp > o_ptr->number) temp = o_ptr->number;
2977 /* Decrease timeout by that number. */
2978 o_ptr->timeout -= temp;
2980 /* Boundary control. */
2981 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2983 /* Notice changes, provide message if object is inscribed. */
2984 if (!(o_ptr->timeout))
2986 recharged_notice(o_ptr);
2990 /* One of the stack of rod is charged */
2991 else if (o_ptr->timeout % k_ptr->pval)
2998 /* Notice changes */
3002 p_ptr->window |= (PW_INVEN);
3006 /* Process objects on floor */
3007 for (i = 1; i < o_max; i++)
3010 object_type *o_ptr = &o_list[i];
3012 /* Skip dead objects */
3013 if (!o_ptr->k_idx) continue;
3015 /* Recharge rods on the ground. No messages. */
3016 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3019 o_ptr->timeout -= o_ptr->number;
3021 /* Boundary control. */
3022 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3029 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
3030 * / Handle involuntary movement once every 10 game turns
3033 static void process_world_aux_movement(void)
3035 /* Delayed Word-of-Recall */
3036 if (p_ptr->word_recall)
3039 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3040 * The player is yanked up/down as soon as
3041 * he loads the autosaved game.
3043 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3044 do_cmd_save_game(TRUE);
3046 /* Count down towards recall */
3047 p_ptr->word_recall--;
3049 p_ptr->redraw |= (PR_STATUS);
3051 /* Activate the recall */
3052 if (!p_ptr->word_recall)
3057 /* Determine the level */
3058 if (dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
3060 msg_print(_("上に引っ張りあげられる感じがする!",
3061 "You feel yourself yanked upwards!"));
3063 if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
3065 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3070 leave_quest_check();
3071 leave_tower_check();
3073 p_ptr->inside_quest = 0;
3075 p_ptr->leaving = TRUE;
3079 msg_print(_("下に引きずり降ろされる感じがする!",
3080 "You feel yourself yanked downwards!"));
3082 dungeon_type = p_ptr->recall_dungeon;
3085 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3088 dun_level = max_dlv[dungeon_type];
3089 if (dun_level < 1) dun_level = 1;
3091 /* Nightmare mode makes recall more dangerous */
3092 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3098 else if (dun_level < 99)
3100 dun_level = (dun_level + 99) / 2;
3102 else if (dun_level > 100)
3104 dun_level = d_info[dungeon_type].maxdepth - 1;
3108 if (p_ptr->wild_mode)
3110 p_ptr->wilderness_y = p_ptr->y;
3111 p_ptr->wilderness_x = p_ptr->x;
3115 /* Save player position */
3116 p_ptr->oldpx = p_ptr->x;
3117 p_ptr->oldpy = p_ptr->y;
3119 p_ptr->wild_mode = FALSE;
3122 * Clear all saved floors
3123 * and create a first saved floor
3125 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3128 p_ptr->leaving = TRUE;
3130 if (dungeon_type == DUNGEON_ANGBAND)
3134 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3136 quest_type* const q_ptr = &quest[i];
3139 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3140 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3141 (q_ptr->level < dun_level))
3143 q_ptr->status = QUEST_STATUS_FAILED;
3144 q_ptr->complev = (byte)p_ptr->lev;
3146 q_ptr->comptime = playtime;
3147 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3154 sound(SOUND_TPLEVEL);
3159 /* Delayed Alter reality */
3160 if (p_ptr->alter_reality)
3162 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3163 do_cmd_save_game(TRUE);
3165 /* Count down towards alter */
3166 p_ptr->alter_reality--;
3168 p_ptr->redraw |= (PR_STATUS);
3170 /* Activate the alter reality */
3171 if (!p_ptr->alter_reality)
3176 /* Determine the level */
3177 if (!quest_number(dun_level) && dun_level)
3179 msg_print(_("世界が変わった!", "The world changes!"));
3182 * Clear all saved floors
3183 * and create a first saved floor
3185 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3188 p_ptr->leaving = TRUE;
3192 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3196 sound(SOUND_TPLEVEL);
3203 * @brief 指定したモンスターに隣接しているモンスターの数を返す。
3204 * / Count number of adjacent monsters
3205 * @param m_idx 隣接数を調べたいモンスターのID
3206 * @return 隣接しているモンスターの数
3208 static int get_monster_crowd_number(int m_idx)
3210 monster_type *m_ptr = &m_list[m_idx];
3216 for (i = 0; i < 7; i++)
3218 int ay = my + ddy_ddd[i];
3219 int ax = mx + ddx_ddd[i];
3221 if (!in_bounds(ay, ax)) continue;
3223 /* Count number of monsters */
3224 if (cave[ay][ax].m_idx > 0) count++;
3233 * ダンジョンの雰囲気を計算するための非線形基準値 / Dungeon rating is no longer linear
3235 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3238 * @brief ダンジョンの雰囲気を算出する。
3239 * / Examine all monsters and unidentified objects, and get the feeling of current dungeon floor
3240 * @return 算出されたダンジョンの雰囲気ランク
3242 static byte get_dungeon_feeling(void)
3244 const int base = 10;
3248 /* Hack -- no feeling in the town */
3249 if (!dun_level) return 0;
3251 /* Examine each monster */
3252 for (i = 1; i < m_max; i++)
3254 monster_type *m_ptr = &m_list[i];
3255 monster_race *r_ptr;
3258 /* Skip dead monsters */
3259 if (!m_ptr->r_idx) continue;
3262 if (is_pet(m_ptr)) continue;
3264 r_ptr = &r_info[m_ptr->r_idx];
3266 /* Unique monsters */
3267 if (r_ptr->flags1 & (RF1_UNIQUE))
3269 /* Nearly out-of-depth unique monsters */
3270 if (r_ptr->level + 10 > dun_level)
3272 /* Boost rating by twice delta-depth */
3273 delta += (r_ptr->level + 10 - dun_level) * 2 * base;
3278 /* Out-of-depth monsters */
3279 if (r_ptr->level > dun_level)
3281 /* Boost rating by delta-depth */
3282 delta += (r_ptr->level - dun_level) * base;
3286 /* Unusually crowded monsters get a little bit of rating boost */
3287 if (r_ptr->flags1 & RF1_FRIENDS)
3289 if (5 <= get_monster_crowd_number(i)) delta += 1;
3293 if (2 <= get_monster_crowd_number(i)) delta += 1;
3297 rating += RATING_BOOST(delta);
3300 /* Examine each unidentified object */
3301 for (i = 1; i < o_max; i++)
3303 object_type *o_ptr = &o_list[i];
3304 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3307 /* Skip dead objects */
3308 if (!o_ptr->k_idx) continue;
3310 /* Skip known objects */
3311 if (object_is_known(o_ptr))
3314 if (o_ptr->marked & OM_TOUCHED) continue;
3317 /* Skip pseudo-known objects */
3318 if (o_ptr->ident & IDENT_SENSE) continue;
3321 if (object_is_ego(o_ptr))
3323 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3325 delta += e_ptr->rating * base;
3329 if (object_is_artifact(o_ptr))
3331 s32b cost = object_value_real(o_ptr);
3334 if (cost > 10000L) delta += 10 * base;
3335 if (cost > 50000L) delta += 10 * base;
3336 if (cost > 100000L) delta += 10 * base;
3338 /* Special feeling */
3339 if (!preserve_mode) return 1;
3342 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3343 if (o_ptr->tval == TV_SHIELD &&
3344 o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3345 if (o_ptr->tval == TV_GLOVES &&
3346 o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3347 if (o_ptr->tval == TV_BOOTS &&
3348 o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3349 if (o_ptr->tval == TV_HELM &&
3350 o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3351 if (o_ptr->tval == TV_RING &&
3352 o_ptr->sval == SV_RING_SPEED &&
3353 !object_is_cursed(o_ptr)) delta += 25 * base;
3354 if (o_ptr->tval == TV_RING &&
3355 o_ptr->sval == SV_RING_LORDLY &&
3356 !object_is_cursed(o_ptr)) delta += 15 * base;
3357 if (o_ptr->tval == TV_AMULET &&
3358 o_ptr->sval == SV_AMULET_THE_MAGI &&
3359 !object_is_cursed(o_ptr)) delta += 15 * base;
3361 /* Out-of-depth objects */
3362 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) &&
3363 k_ptr->level > dun_level)
3365 /* Rating increase */
3366 delta += (k_ptr->level - dun_level) * base;
3369 rating += RATING_BOOST(delta);
3373 if (rating > RATING_BOOST(1000)) return 2;
3374 if (rating > RATING_BOOST(800)) return 3;
3375 if (rating > RATING_BOOST(600)) return 4;
3376 if (rating > RATING_BOOST(400)) return 5;
3377 if (rating > RATING_BOOST(300)) return 6;
3378 if (rating > RATING_BOOST(200)) return 7;
3379 if (rating > RATING_BOOST(100)) return 8;
3380 if (rating > RATING_BOOST(0)) return 9;
3386 * @brief ダンジョンの雰囲気を更新し、変化があった場合メッセージを表示する
3387 * / Update dungeon feeling, and announce it if changed
3390 static void update_dungeon_feeling(void)
3396 /* No feeling on the surface */
3397 if (!dun_level) return;
3399 /* No feeling in the arena */
3400 if (p_ptr->inside_battle) return;
3402 /* Extract delay time */
3403 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - dun_level) * TURNS_PER_TICK / 100;
3405 /* Not yet felt anything */
3406 if (turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
3408 /* Extract quest number (if any) */
3409 quest_num = quest_number(dun_level);
3411 /* No feeling in a quest */
3413 (is_fixed_quest_idx(quest_num) &&
3414 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
3415 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
3418 /* Get new dungeon feeling */
3419 new_feeling = get_dungeon_feeling();
3421 /* Remember last time updated */
3422 p_ptr->feeling_turn = turn;
3425 if (p_ptr->feeling == new_feeling) return;
3427 /* Dungeon feeling is changed */
3428 p_ptr->feeling = new_feeling;
3430 /* Announce feeling */
3433 select_floor_music();
3435 /* Update the level indicator */
3436 p_ptr->redraw |= (PR_DEPTH);
3439 if (disturb_minor) disturb(0, 0);
3443 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3444 * / Handle certain things once every 10 game turns
3447 static void process_world(void)
3451 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3452 s32b prev_turn_in_today = ((turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3453 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3455 extract_day_hour_min(&day, &hour, &min);
3457 /* Update dungeon feeling, and announce it if changed */
3458 update_dungeon_feeling();
3460 /*** Check monster arena ***/
3461 if (p_ptr->inside_battle && !p_ptr->leaving)
3467 /* Count all hostile monsters */
3468 for (i2 = 0; i2 < cur_wid; ++i2)
3469 for (j2 = 0; j2 < cur_hgt; j2++)
3471 cave_type *c_ptr = &cave[j2][i2];
3473 if ((c_ptr->m_idx > 0) && (c_ptr->m_idx != p_ptr->riding))
3476 win_m_idx = c_ptr->m_idx;
3480 if (number_mon == 0)
3482 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3484 p_ptr->energy_need = 0;
3487 else if ((number_mon-1) == 0)
3490 monster_type *wm_ptr;
3492 wm_ptr = &m_list[win_m_idx];
3494 monster_desc(m_name, wm_ptr, 0);
3495 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3498 if (win_m_idx == (sel_monster+1))
3500 msg_print(_("おめでとうございます。", "Congratulations."));
3501 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3502 p_ptr->au += battle_odds;
3506 msg_print(_("残念でした。", "You lost gold."));
3509 p_ptr->energy_need = 0;
3512 else if (turn - old_turn == 150*TURNS_PER_TICK)
3514 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3515 p_ptr->au += kakekin;
3517 p_ptr->energy_need = 0;
3522 /* Every 10 game turns */
3523 if (turn % TURNS_PER_TICK) return;
3525 /*** Check the Time and Load ***/
3527 if (!(turn % (50*TURNS_PER_TICK)))
3529 /* Check time and load */
3530 if ((0 != check_time()) || (0 != check_load()))
3533 if (closing_flag <= 2)
3538 /* Count warnings */
3542 msg_print(_("アングバンドへの門が閉じかかっています...", "The gates to ANGBAND are closing..."));
3543 msg_print(_("ゲームを終了するかセーブするかして下さい。", "Please finish up and/or save your game."));
3551 msg_print(_("今、アングバンドへの門が閉ざされました。", "The gates to ANGBAND are now closed."));
3554 p_ptr->playing = FALSE;
3557 p_ptr->leaving = TRUE;
3562 /*** Attempt timed autosave ***/
3563 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3565 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3566 do_cmd_save_game(TRUE);
3569 if (mon_fight && !ignore_unview)
3571 msg_print(_("何かが聞こえた。", "You hear noise."));
3574 /*** Handle the wilderness/town (sunshine) ***/
3576 /* While in town/wilderness */
3577 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3579 /* Hack -- Daybreak/Nighfall in town */
3580 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3584 /* Check for dawn */
3585 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
3593 msg_print(_("夜が明けた。", "The sun has risen."));
3595 if (!p_ptr->wild_mode)
3597 /* Hack -- Scan the town */
3598 for (y = 0; y < cur_hgt; y++)
3600 for (x = 0; x < cur_wid; x++)
3602 /* Get the cave grid */
3603 cave_type *c_ptr = &cave[y][x];
3606 c_ptr->info |= (CAVE_GLOW);
3608 /* Hack -- Memorize lit grids if allowed */
3609 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
3611 /* Hack -- Notice spot */
3624 msg_print(_("日が沈んだ。", "The sun has fallen."));
3626 if (!p_ptr->wild_mode)
3628 /* Hack -- Scan the town */
3629 for (y = 0; y < cur_hgt; y++)
3631 for (x = 0; x < cur_wid; x++)
3633 /* Get the cave grid */
3634 cave_type *c_ptr = &cave[y][x];
3636 /* Feature code (applying "mimic" field) */
3637 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
3639 if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
3640 !have_flag(f_ptr->flags, FF_ENTRANCE))
3643 c_ptr->info &= ~(CAVE_GLOW);
3645 if (!have_flag(f_ptr->flags, FF_REMEMBER))
3647 /* Forget the normal floor grid */
3648 c_ptr->info &= ~(CAVE_MARK);
3650 /* Hack -- Notice spot */
3656 /* Glow deep lava and building entrances */
3657 glow_deep_lava_and_bldg();
3662 /* Update the monsters */
3663 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3666 p_ptr->redraw |= (PR_MAP);
3669 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3671 if (p_ptr->special_defense & NINJA_S_STEALTH)
3673 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
3678 /* While in the dungeon (vanilla_town or lite_town mode only) */
3679 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
3681 /*** Shuffle the Storekeepers ***/
3683 /* Chance is only once a day (while in dungeon) */
3684 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
3686 /* Sometimes, shuffle the shop-keepers */
3687 if (one_in_(STORE_SHUFFLE))
3691 /* Pick a random shop (except home and museum) */
3694 n = randint0(MAX_STORES);
3696 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3698 /* Check every feature */
3699 for (i = 1; i < max_f_idx; i++)
3701 /* Access the index */
3702 feature_type *f_ptr = &f_info[i];
3704 /* Skip empty index */
3705 if (!f_ptr->name) continue;
3707 /* Skip non-store features */
3708 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3710 /* Verify store type */
3711 if (f_ptr->subtype == n)
3714 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3727 /*** Process the monsters ***/
3729 /* Check for creature generation. */
3730 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
3731 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
3733 /* Make a new monster */
3734 (void)alloc_monster(MAX_SIGHT + 5, 0);
3737 /* Hack -- Check for creature regeneration */
3738 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
3739 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
3741 if (!p_ptr->leaving)
3745 /* Hack -- Process the counters of monsters if needed */
3746 for (i = 0; i < MAX_MTIMED; i++)
3748 if (mproc_max[i] > 0) process_monsters_mtimed(i);
3756 if (min != prev_min)
3758 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
3759 determine_today_mon(FALSE);
3764 * Nightmare mode activates the TY_CURSE at midnight
3766 * Require exact minute -- Don't activate multiple times in a minute
3768 if (ironman_nightmare && (min != prev_min))
3770 /* Every 15 minutes after 11:00 pm */
3771 if ((hour == 23) && !(min % 15))
3779 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3783 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3787 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3791 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3796 /* TY_CURSE activates at midnight! */
3802 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3803 activate_ty_curse(FALSE, &count);
3808 /*** Check the Food, and Regenerate ***/
3810 if (!p_ptr->inside_battle)
3812 /* Digest quickly when gorged */
3813 if (p_ptr->food >= PY_FOOD_MAX)
3815 /* Digest a lot of food */
3816 (void)set_food(p_ptr->food - 100);
3819 /* Digest normally -- Every 50 game turns */
3820 else if (!(turn % (TURNS_PER_TICK*5)))
3822 /* Basic digestion rate based on speed */
3823 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
3825 /* Regeneration takes more food */
3826 if (p_ptr->regenerate)
3828 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
3830 if (p_ptr->cursed & TRC_FAST_DIGEST)
3833 /* Slow digestion takes less food */
3834 if (p_ptr->slow_digest)
3837 /* Minimal digestion */
3838 if (digestion < 1) digestion = 1;
3839 /* Maximal digestion */
3840 if (digestion > 100) digestion = 100;
3842 /* Digest some food */
3843 (void)set_food(p_ptr->food - digestion);
3848 if ((p_ptr->food < PY_FOOD_FAINT))
3850 /* Faint occasionally */
3851 if (!p_ptr->paralyzed && (randint0(100) < 10))
3854 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
3857 /* Hack -- faint (bypass free action) */
3858 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
3861 /* Starve to death (slowly) */
3862 if (p_ptr->food < PY_FOOD_STARVE)
3864 /* Calculate damage */
3865 int dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
3868 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
3875 /* Process timed damage and regeneration */
3876 process_world_aux_hp_and_sp();
3878 /* Process timeout */
3879 process_world_aux_timeout();
3882 process_world_aux_light();
3884 /* Process mutation effects */
3885 process_world_aux_mutation();
3887 /* Process curse effects */
3888 process_world_aux_curse();
3890 /* Process recharging */
3891 process_world_aux_recharge();
3893 /* Feel the inventory */
3897 /* Involuntary Movement */
3898 process_world_aux_movement();
3902 * @brief ウィザードモードへの導入処理
3903 * / Verify use of "wizard" mode
3904 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3906 static bool enter_wizard_mode(void)
3908 /* Ask first time */
3909 if (!p_ptr->noscore)
3911 /* Wizard mode is not permitted */
3912 if (!allow_debug_opts || arg_wizard)
3914 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3918 /* Mention effects */
3919 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3920 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3923 /* Verify request */
3924 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3929 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3931 p_ptr->noscore |= 0x0002;
3942 * @brief デバッグコマンドへの導入処理
3943 * / Verify use of "debug" commands
3944 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3946 static bool enter_debug_mode(void)
3948 /* Ask first time */
3949 if (!p_ptr->noscore)
3951 /* Debug mode is not permitted */
3952 if (!allow_debug_opts)
3954 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3958 /* Mention effects */
3959 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3960 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3964 /* Verify request */
3965 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3970 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3972 p_ptr->noscore |= 0x0008;
3980 * Hack -- Declare the Debug Routines
3982 extern void do_cmd_debug(void);
3984 #endif /* ALLOW_WIZARD */
3990 * @brief ボーグコマンドへの導入処理
3991 * / Verify use of "borg" commands
3992 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3994 static bool enter_borg_mode(void)
3996 /* Ask first time */
3997 if (!(p_ptr->noscore & 0x0010))
3999 /* Mention effects */
4000 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
4001 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
4005 /* Verify request */
4006 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
4011 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
4013 p_ptr->noscore |= 0x0010;
4021 * Hack -- Declare the Ben Borg
4023 extern void do_cmd_borg(void);
4025 #endif /* ALLOW_BORG */
4029 * @brief プレイヤーから受けた入力コマンドの分岐処理。
4030 * / Parse and execute the current command Give "Warning" on illegal commands.
4031 * @todo XXX XXX XXX Make some "blocks"
4034 static void process_command(void)
4036 int old_now_message = now_message;
4038 #ifdef ALLOW_REPEAT /* TNB */
4040 /* Handle repeating the last command */
4043 #endif /* ALLOW_REPEAT -- TNB */
4048 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
4049 reset_concent = TRUE;
4051 /* Parse the command */
4052 switch (command_cmd)
4068 /*** Wizard Commands ***/
4070 /* Toggle Wizard Mode */
4075 p_ptr->wizard = FALSE;
4076 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
4078 else if (enter_wizard_mode())
4080 p_ptr->wizard = TRUE;
4081 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
4084 /* Update monsters */
4085 p_ptr->update |= (PU_MONSTERS);
4087 /* Redraw "title" */
4088 p_ptr->redraw |= (PR_TITLE);
4096 /* Special "debug" commands */
4099 /* Enter debug mode */
4100 if (enter_debug_mode())
4107 #endif /* ALLOW_WIZARD */
4112 /* Special "borg" commands */
4115 /* Enter borg mode */
4116 if (enter_borg_mode())
4118 if (!p_ptr->wild_mode) do_cmd_borg();
4124 #endif /* ALLOW_BORG */
4128 /*** Inventory Commands ***/
4130 /* Wear/wield equipment */
4133 if (!p_ptr->wild_mode) do_cmd_wield();
4137 /* Take off equipment */
4140 if (!p_ptr->wild_mode) do_cmd_takeoff();
4147 if (!p_ptr->wild_mode) do_cmd_drop();
4151 /* Destroy an item */
4158 /* Equipment list */
4165 /* Inventory list */
4173 /*** Various commands ***/
4175 /* Identify an object */
4182 /* Hack -- toggle windows */
4185 toggle_inven_equip();
4190 /*** Standard "Movement" Commands ***/
4195 if (!p_ptr->wild_mode) do_cmd_alter();
4202 if (!p_ptr->wild_mode) do_cmd_tunnel();
4206 /* Move (usually pick up things) */
4209 #ifdef ALLOW_EASY_DISARM /* TNB */
4213 #else /* ALLOW_EASY_DISARM -- TNB */
4215 do_cmd_walk(always_pickup);
4217 #endif /* ALLOW_EASY_DISARM -- TNB */
4222 /* Move (usually do not pick up) */
4225 #ifdef ALLOW_EASY_DISARM /* TNB */
4229 #else /* ALLOW_EASY_DISARM -- TNB */
4231 do_cmd_walk(!always_pickup);
4233 #endif /* ALLOW_EASY_DISARM -- TNB */
4239 /*** Running, Resting, Searching, Staying */
4241 /* Begin Running -- Arg is Max Distance */
4244 if (!p_ptr->wild_mode) do_cmd_run();
4248 /* Stay still (usually pick things up) */
4251 do_cmd_stay(always_pickup);
4255 /* Stay still (usually do not pick up) */
4258 do_cmd_stay(!always_pickup);
4262 /* Rest -- Arg is time */
4269 /* Search for traps/doors */
4276 /* Toggle search mode */
4279 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4280 else set_action(ACTION_SEARCH);
4285 /*** Stairs and Doors and Chests and Traps ***/
4288 case SPECIAL_KEY_STORE:
4290 if (!p_ptr->wild_mode) do_cmd_store();
4294 /* Enter building -KMW- */
4295 case SPECIAL_KEY_BUILDING:
4297 if (!p_ptr->wild_mode) do_cmd_bldg();
4301 /* Enter quest level -KMW- */
4302 case SPECIAL_KEY_QUEST:
4304 if (!p_ptr->wild_mode) do_cmd_quest();
4308 /* Go up staircase */
4311 if (!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4313 if (vanilla_town) break;
4317 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
4321 if (p_ptr->food < PY_FOOD_WEAK)
4323 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
4334 /* Go down staircase */
4337 if (p_ptr->wild_mode)
4345 /* Open a door or chest */
4348 if (!p_ptr->wild_mode) do_cmd_open();
4355 if (!p_ptr->wild_mode) do_cmd_close();
4359 /* Jam a door with spikes */
4362 if (!p_ptr->wild_mode) do_cmd_spike();
4369 if (!p_ptr->wild_mode) do_cmd_bash();
4373 /* Disarm a trap or chest */
4376 if (!p_ptr->wild_mode) do_cmd_disarm();
4381 /*** Magic and Prayers ***/
4383 /* Gain new spells/prayers */
4386 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4387 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
4388 else if (p_ptr->pclass == CLASS_SAMURAI)
4389 do_cmd_gain_hissatsu();
4390 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4400 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4401 (p_ptr->pclass == CLASS_BERSERKER) ||
4402 (p_ptr->pclass == CLASS_NINJA) ||
4403 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4404 ) do_cmd_mind_browse();
4405 else if (p_ptr->pclass == CLASS_SMITH)
4407 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4408 do_cmd_magic_eater(TRUE, FALSE);
4409 else if (p_ptr->pclass == CLASS_SNIPER)
4410 do_cmd_snipe_browse();
4411 else do_cmd_browse();
4419 if (!p_ptr->wild_mode)
4421 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4423 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
4425 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4427 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
4430 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4432 cptr which_power = _("魔法", "magic");
4433 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4434 which_power = _("超能力", "psionic powers");
4435 else if (p_ptr->pclass == CLASS_IMITATOR)
4436 which_power = _("ものまね", "imitation");
4437 else if (p_ptr->pclass == CLASS_SAMURAI)
4438 which_power = _("必殺剣", "hissatsu");
4439 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4440 which_power = _("鏡魔法", "mirror magic");
4441 else if (p_ptr->pclass == CLASS_NINJA)
4442 which_power = _("忍術", "ninjutsu");
4443 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4444 which_power = _("祈り", "prayer");
4446 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
4447 p_ptr->energy_use = 0;
4449 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4451 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
4452 p_ptr->energy_use = 0;
4456 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4457 (p_ptr->pclass == CLASS_BERSERKER) ||
4458 (p_ptr->pclass == CLASS_NINJA) ||
4459 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4462 else if (p_ptr->pclass == CLASS_IMITATOR)
4464 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4465 do_cmd_magic_eater(FALSE, FALSE);
4466 else if (p_ptr->pclass == CLASS_SAMURAI)
4468 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
4469 do_cmd_cast_learned();
4470 else if (p_ptr->pclass == CLASS_SMITH)
4472 else if (p_ptr->pclass == CLASS_SNIPER)
4481 /* Issue a pet command */
4484 if (!p_ptr->wild_mode) do_cmd_pet();
4488 /*** Use various objects ***/
4490 /* Inscribe an object */
4497 /* Uninscribe an object */
4500 do_cmd_uninscribe();
4504 /* Activate an artifact */
4507 if (!p_ptr->wild_mode)
4509 if (!p_ptr->inside_arena)
4513 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
4527 /* Fuel your lantern/torch */
4537 if (!p_ptr->wild_mode) do_cmd_fire();
4544 if (!p_ptr->wild_mode)
4554 if (!p_ptr->wild_mode)
4556 if (!p_ptr->inside_arena)
4560 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
4570 if (!p_ptr->wild_mode)
4572 if (p_ptr->inside_arena)
4574 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
4577 else if (use_command && rogue_like_commands)
4589 /* Quaff a potion */
4592 if (!p_ptr->wild_mode)
4594 if (!p_ptr->inside_arena)
4595 do_cmd_quaff_potion();
4598 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
4608 if (!p_ptr->wild_mode)
4610 if (!p_ptr->inside_arena)
4611 do_cmd_read_scroll();
4614 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
4624 if (!p_ptr->wild_mode)
4626 if (p_ptr->inside_arena)
4628 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
4631 else if (use_command && !rogue_like_commands)
4641 /* Use racial power */
4644 if (!p_ptr->wild_mode) do_cmd_racial_power();
4649 /*** Looking at Things (nearby or on map) ***/
4651 /* Full dungeon map */
4658 /* Locate player on map */
4672 /* Target monster or location */
4675 if (!p_ptr->wild_mode) do_cmd_target();
4681 /*** Help and Such ***/
4690 /* Identify symbol */
4693 do_cmd_query_symbol();
4697 /* Character description */
4700 do_cmd_change_name();
4705 /*** System Commands ***/
4707 /* Hack -- User interface */
4714 /* Single line from a pref file */
4723 do_cmd_reload_autopick();
4729 do_cmd_edit_autopick();
4733 /* Interact with macros */
4740 /* Interact with visuals */
4748 /* Interact with colors */
4756 /* Interact with options */
4760 (void)combine_and_reorder_home(STORE_HOME);
4765 /*** Misc Commands ***/
4781 /* Repeat level feeling */
4784 if (!p_ptr->wild_mode) do_cmd_feeling();
4788 /* Show previous message */
4791 do_cmd_message_one();
4795 /* Show previous messages */
4798 do_cmd_messages(old_now_message);
4802 /* Show quest status -KMW- */
4805 do_cmd_checkquest();
4809 /* Redraw the screen */
4812 now_message = old_now_message;
4817 #ifndef VERIFY_SAVEFILE
4819 /* Hack -- Save and don't quit */
4822 do_cmd_save_game(FALSE);
4826 #endif /* VERIFY_SAVEFILE */
4836 case SPECIAL_KEY_QUIT:
4838 do_cmd_save_and_exit();
4842 /* Quit (commit suicide) */
4855 /* Check artifacts, uniques, objects */
4862 /* Load "screen dump" */
4865 do_cmd_load_screen();
4869 /* Save "screen dump" */
4872 do_cmd_save_screen();
4876 /* Record/stop "Movie" */
4879 prepare_movie_hooks();
4883 /* Make random artifact list */
4886 spoil_random_artifact("randifact.txt");
4893 if (!p_ptr->wild_mode) do_cmd_travel();
4894 if (p_ptr->special_defense & KATA_MUSOU)
4896 set_action(ACTION_NONE);
4902 /* Hack -- Unknown command */
4905 if (flush_failure) flush();
4909 sound(SOUND_ILLEGAL);
4910 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4915 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4921 if (!p_ptr->energy_use && !now_message)
4922 now_message = old_now_message;
4926 * @brief モンスター種族が釣れる種族かどうかを判定する。
4927 * @param r_idx 判定したいモンスター種族のID
4928 * @return 釣れる対象ならばTRUEを返す
4930 static bool monster_tsuri(int r_idx)
4932 monster_race *r_ptr = &r_info[r_idx];
4934 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
4942 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4945 static void pack_overflow(void)
4947 if (inventory[INVEN_PACK].k_idx)
4949 char o_name[MAX_NLEN];
4952 /* Is auto-destroy done? */
4954 if (!inventory[INVEN_PACK].k_idx) return;
4956 /* Access the slot to be dropped */
4957 o_ptr = &inventory[INVEN_PACK];
4963 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4966 object_desc(o_name, o_ptr, 0);
4969 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4971 /* Drop it (carefully) near the player */
4972 (void)drop_near(o_ptr, 0, p_ptr->y, p_ptr->x);
4974 /* Modify, Describe, Optimize */
4975 inven_item_increase(INVEN_PACK, -255);
4976 inven_item_describe(INVEN_PACK);
4977 inven_item_optimize(INVEN_PACK);
4979 /* Handle "p_ptr->notice" */
4982 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
4988 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4991 static void process_upkeep_with_speed(void)
4993 /* Give the player some energy */
4994 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4996 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5000 if (p_ptr->enchant_energy_need > 0) return;
5002 while (p_ptr->enchant_energy_need <= 0)
5004 /* Handle the player song */
5005 if (!load) check_music();
5007 /* Hex - Handle the hex spells */
5008 if (!load) check_hex();
5009 if (!load) revenge_spell();
5011 /* There is some randomness of needed energy */
5012 p_ptr->enchant_energy_need += ENERGY_NEED();
5017 * @brief プレイヤーの行動処理 / Process the player
5020 * Notice the annoying code to handle "pack overflow", which\n
5021 * must come first just in case somebody manages to corrupt\n
5022 * the savefiles by clever use of menu commands or something.\n
5024 static void process_player(void)
5028 /*** Apply energy ***/
5032 msg_print(_("何か変わった気がする!", "You feel different!"));
5034 (void)gain_random_mutation(0);
5035 hack_mutation = FALSE;
5038 if (p_ptr->inside_battle)
5040 for(i = 1; i < m_max; i++)
5042 monster_type *m_ptr = &m_list[i];
5044 if (!m_ptr->r_idx) continue;
5046 /* Hack -- Detect monster */
5047 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5049 /* Update the monster */
5050 update_mon(i, FALSE);
5055 /* Give the player some energy */
5056 else if (!(load && p_ptr->energy_need <= 0))
5058 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5062 if (p_ptr->energy_need > 0) return;
5063 if (!command_rep) prt_time();
5065 /*** Check for interupts ***/
5067 /* Complete resting */
5074 if ((p_ptr->chp == p_ptr->mhp) &&
5075 (p_ptr->csp >= p_ptr->msp))
5077 set_action(ACTION_NONE);
5081 /* Complete resting */
5082 else if (resting == -2)
5085 if ((p_ptr->chp == p_ptr->mhp) &&
5086 (p_ptr->csp >= p_ptr->msp) &&
5087 !p_ptr->blind && !p_ptr->confused &&
5088 !p_ptr->poisoned && !p_ptr->afraid &&
5089 !p_ptr->stun && !p_ptr->cut &&
5090 !p_ptr->slow && !p_ptr->paralyzed &&
5091 !p_ptr->image && !p_ptr->word_recall &&
5092 !p_ptr->alter_reality)
5094 set_action(ACTION_NONE);
5099 if (p_ptr->action == ACTION_FISH)
5102 Term_xtra(TERM_XTRA_DELAY, 10);
5106 bool success = FALSE;
5107 get_mon_num_prep(monster_tsuri,NULL);
5108 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5110 if (r_idx && one_in_(2))
5113 y = p_ptr->y+ddy[tsuri_dir];
5114 x = p_ptr->x+ddx[tsuri_dir];
5115 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5118 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5119 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
5125 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
5131 /* Handle "abort" */
5134 /* Check for "player abort" (semi-efficiently for resting) */
5135 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5140 /* Check for a key */
5149 /* Hack -- Show a Message */
5150 msg_print(_("中断しました。", "Canceled."));
5155 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5157 monster_type *m_ptr = &m_list[p_ptr->riding];
5158 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5160 if (MON_CSLEEP(m_ptr))
5165 (void)set_monster_csleep(p_ptr->riding, 0);
5167 /* Acquire the monster name */
5168 monster_desc(m_name, m_ptr, 0);
5169 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
5172 if (MON_STUNNED(m_ptr))
5174 /* Hack -- Recover from stun */
5175 if (set_monster_stunned(p_ptr->riding,
5176 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
5180 /* Acquire the monster name */
5181 monster_desc(m_name, m_ptr, 0);
5183 /* Dump a message */
5184 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
5188 if (MON_CONFUSED(m_ptr))
5190 /* Hack -- Recover from confusion */
5191 if (set_monster_confused(p_ptr->riding,
5192 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
5196 /* Acquire the monster name */
5197 monster_desc(m_name, m_ptr, 0);
5199 /* Dump a message */
5200 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
5204 if (MON_MONFEAR(m_ptr))
5206 /* Hack -- Recover from fear */
5207 if (set_monster_monfear(p_ptr->riding,
5208 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
5212 /* Acquire the monster name */
5213 monster_desc(m_name, m_ptr, 0);
5215 /* Dump a message */
5216 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
5220 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5227 if (p_ptr->lightspeed)
5229 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5231 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5233 if (p_ptr->magic_num1[0] < 40)
5235 p_ptr->magic_num1[0] = 0;
5237 else p_ptr->magic_num1[0] -= 40;
5238 p_ptr->update |= (PU_BONUS);
5240 if (p_ptr->action == ACTION_LEARN)
5243 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
5245 /* Convert the unit (1/2^16) to (1/2^32) */
5246 s64b_LSHIFT(cost, cost_frac, 16);
5249 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
5253 p_ptr->csp_frac = 0;
5254 set_action(ACTION_NONE);
5259 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
5261 p_ptr->redraw |= PR_MANA;
5264 if (p_ptr->special_defense & KATA_MASK)
5266 if (p_ptr->special_defense & KATA_MUSOU)
5270 set_action(ACTION_NONE);
5275 p_ptr->redraw |= (PR_MANA);
5280 /*** Handle actual user input ***/
5282 /* Repeat until out of energy */
5283 while (p_ptr->energy_need <= 0)
5285 p_ptr->window |= PW_PLAYER;
5286 p_ptr->sutemi = FALSE;
5287 p_ptr->counter = FALSE;
5288 now_damaged = FALSE;
5290 /* Handle "p_ptr->notice" */
5293 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5296 /* Place the cursor on the player */
5297 move_cursor_relative(p_ptr->y, p_ptr->x);
5299 /* Refresh (optional) */
5300 if (fresh_before) Term_fresh();
5303 /* Hack -- Pack Overflow */
5307 /* Hack -- cancel "lurking browse mode" */
5308 if (!command_new) command_see = FALSE;
5311 /* Assume free turn */
5312 p_ptr->energy_use = 0;
5315 if (p_ptr->inside_battle)
5317 /* Place the cursor on the player */
5318 move_cursor_relative(p_ptr->y, p_ptr->x);
5320 command_cmd = SPECIAL_KEY_BUILDING;
5322 /* Process the command */
5326 /* Paralyzed or Knocked Out */
5327 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5330 p_ptr->energy_use = 100;
5334 else if (p_ptr->action == ACTION_REST)
5339 /* Reduce rest count */
5342 if (!resting) set_action(ACTION_NONE);
5344 /* Redraw the state */
5345 p_ptr->redraw |= (PR_STATE);
5349 p_ptr->energy_use = 100;
5353 else if (p_ptr->action == ACTION_FISH)
5356 p_ptr->energy_use = 100;
5368 else if (travel.run)
5375 /* Repeated command */
5376 else if (command_rep)
5378 /* Count this execution */
5381 /* Redraw the state */
5382 p_ptr->redraw |= (PR_STATE);
5387 /* Hack -- Assume messages were seen */
5390 /* Clear the top line */
5393 /* Process the command */
5397 /* Normal command */
5400 /* Place the cursor on the player */
5401 move_cursor_relative(p_ptr->y, p_ptr->x);
5404 /* Get a command (normal) */
5405 request_command(FALSE);
5408 /* Process the command */
5413 /* Hack -- Pack Overflow */
5420 if (p_ptr->energy_use)
5422 /* Use some energy */
5423 if (world_player || p_ptr->energy_use > 400)
5425 /* The Randomness is irrelevant */
5426 p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10;
5430 /* There is some randomness of needed energy */
5431 p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L);
5434 /* Hack -- constant hallucination */
5435 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
5438 /* Shimmer monsters if needed */
5439 if (shimmer_monsters)
5441 /* Clear the flag */
5442 shimmer_monsters = FALSE;
5444 /* Shimmer multi-hued monsters */
5445 for (i = 1; i < m_max; i++)
5447 monster_type *m_ptr;
5448 monster_race *r_ptr;
5450 /* Access monster */
5453 /* Skip dead monsters */
5454 if (!m_ptr->r_idx) continue;
5456 /* Skip unseen monsters */
5457 if (!m_ptr->ml) continue;
5459 /* Access the monster race */
5460 r_ptr = &r_info[m_ptr->ap_r_idx];
5462 /* Skip non-multi-hued monsters */
5463 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
5466 /* Reset the flag */
5467 shimmer_monsters = TRUE;
5469 /* Redraw regardless */
5470 lite_spot(m_ptr->fy, m_ptr->fx);
5475 /* Handle monster detection */
5476 if (repair_monsters)
5478 /* Reset the flag */
5479 repair_monsters = FALSE;
5481 /* Rotate detection flags */
5482 for (i = 1; i < m_max; i++)
5484 monster_type *m_ptr;
5486 /* Access monster */
5489 /* Skip dead monsters */
5490 if (!m_ptr->r_idx) continue;
5492 /* Nice monsters get mean */
5493 if (m_ptr->mflag & MFLAG_NICE)
5495 /* Nice monsters get mean */
5496 m_ptr->mflag &= ~(MFLAG_NICE);
5499 /* Handle memorized monsters */
5500 if (m_ptr->mflag2 & MFLAG2_MARK)
5502 /* Maintain detection */
5503 if (m_ptr->mflag2 & MFLAG2_SHOW)
5506 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
5508 /* Still need repairs */
5509 repair_monsters = TRUE;
5512 /* Remove detection */
5516 m_ptr->mflag2 &= ~(MFLAG2_MARK);
5518 /* Assume invisible */
5521 /* Update the monster */
5522 update_mon(i, FALSE);
5524 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
5525 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
5527 /* Redraw regardless */
5528 lite_spot(m_ptr->fy, m_ptr->fx);
5533 if (p_ptr->pclass == CLASS_IMITATOR)
5535 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
5538 for (i = 0; i < p_ptr->mane_num; i++)
5540 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
5541 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
5545 p_ptr->redraw |= (PR_IMITATION);
5547 if (p_ptr->action == ACTION_LEARN)
5550 p_ptr->redraw |= (PR_STATE);
5553 if (world_player && (p_ptr->energy_need > - 1000))
5556 p_ptr->redraw |= (PR_MAP);
5558 /* Update monsters */
5559 p_ptr->update |= (PU_MONSTERS);
5562 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5564 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
5566 world_player = FALSE;
5567 p_ptr->energy_need = ENERGY_NEED();
5569 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5574 /* Hack -- notice death */
5575 if (!p_ptr->playing || p_ptr->is_dead)
5577 world_player = FALSE;
5582 if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE);
5584 /* Handle "leaving" */
5585 if (p_ptr->leaving) break;
5588 /* Update scent trail */
5593 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
5596 * This function will not exit until the level is completed,\n
5597 * the user dies, or the game is terminated.\n
5599 static void dungeon(bool load_game)
5603 /* Set the base level */
5604 base_level = dun_level;
5606 /* Reset various flags */
5610 p_ptr->leaving = FALSE;
5612 /* Reset the "command" vars */
5615 #if 0 /* Don't reset here --- It's used for Arena */
5624 /* Cancel the target */
5628 ambush_flag = FALSE;
5630 /* Cancel the health bar */
5633 /* Check visual effects */
5634 shimmer_monsters = TRUE;
5635 shimmer_objects = TRUE;
5636 repair_monsters = TRUE;
5637 repair_objects = TRUE;
5643 /* Get index of current quest (if any) */
5644 quest_num = quest_number(dun_level);
5646 /* Inside a quest? */
5649 /* Mark the quest monster */
5650 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
5653 /* Track maximum player level */
5654 if (p_ptr->max_plv < p_ptr->lev)
5656 p_ptr->max_plv = p_ptr->lev;
5660 /* Track maximum dungeon level (if not in quest -KMW-) */
5661 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
5663 max_dlv[dungeon_type] = dun_level;
5664 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
5667 (void)calculate_upkeep();
5669 /* Validate the panel */
5670 panel_bounds_center();
5672 /* Verify the panel */
5675 /* Flush messages */
5679 /* Enter "xtra" mode */
5680 character_xtra = TRUE;
5683 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
5685 /* Redraw dungeon */
5686 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
5689 p_ptr->redraw |= (PR_MAP);
5692 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5694 /* Update lite/view */
5695 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
5697 /* Update monsters */
5698 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
5700 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5703 /* Leave "xtra" mode */
5704 character_xtra = FALSE;
5707 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5709 /* Combine / Reorder the pack */
5710 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5712 /* Handle "p_ptr->notice" */
5715 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5721 if (quest_num && (is_fixed_quest_idx(quest_num) &&
5722 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
5723 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
5725 if (p_ptr->inside_battle)
5729 p_ptr->energy_need = 0;
5734 msg_print(_("試合開始!", "Ready..Fight!"));
5739 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
5740 p_ptr->magic_num1[0] = MUSIC_DETECT;
5742 /* Hack -- notice death or departure */
5743 if (!p_ptr->playing || p_ptr->is_dead) return;
5745 /* Print quest message if appropriate */
5746 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
5748 quest_discovery(random_quest_number(dun_level));
5749 p_ptr->inside_quest = random_quest_number(dun_level);
5751 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
5753 if (r_info[d_info[dungeon_type].final_guardian].max_num)
5755 msg_format("この階には%sの主である%sが棲んでいる。",
5756 d_name+d_info[dungeon_type].name,
5757 r_name+r_info[d_info[dungeon_type].final_guardian].name);
5759 msg_format("%^s lives in this level as the keeper of %s.",
5760 r_name+r_info[d_info[dungeon_type].final_guardian].name,
5761 d_name+d_info[dungeon_type].name);
5765 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
5767 /*** Process this dungeon level ***/
5769 /* Reset the monster generation level */
5770 monster_level = base_level;
5772 /* Reset the object generation level */
5773 object_level = base_level;
5777 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
5778 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
5779 p_ptr->energy_need = 0;
5781 /* Not leaving dungeon */
5782 p_ptr->leaving_dungeon = FALSE;
5784 /* Initialize monster process */
5790 /* Hack -- Compact the monster list occasionally */
5791 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
5793 /* Hack -- Compress the monster list occasionally */
5794 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
5797 /* Hack -- Compact the object list occasionally */
5798 if (o_cnt + 32 > max_o_idx) compact_objects(64);
5800 /* Hack -- Compress the object list occasionally */
5801 if (o_cnt + 32 < o_max) compact_objects(0);
5804 /* Process the player */
5807 process_upkeep_with_speed();
5809 /* Handle "p_ptr->notice" */
5812 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5815 /* Hack -- Hilite the player */
5816 move_cursor_relative(p_ptr->y, p_ptr->x);
5818 /* Optional fresh */
5819 if (fresh_after) Term_fresh();
5821 /* Hack -- Notice death or departure */
5822 if (!p_ptr->playing || p_ptr->is_dead) break;
5824 /* Process all of the monsters */
5827 /* Handle "p_ptr->notice" */
5830 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5833 /* Hack -- Hilite the player */
5834 move_cursor_relative(p_ptr->y, p_ptr->x);
5836 /* Optional fresh */
5837 if (fresh_after) Term_fresh();
5839 /* Hack -- Notice death or departure */
5840 if (!p_ptr->playing || p_ptr->is_dead) break;
5843 /* Process the world */
5846 /* Handle "p_ptr->notice" */
5849 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5852 /* Hack -- Hilite the player */
5853 move_cursor_relative(p_ptr->y, p_ptr->x);
5855 /* Optional fresh */
5856 if (fresh_after) Term_fresh();
5858 /* Hack -- Notice death or departure */
5859 if (!p_ptr->playing || p_ptr->is_dead) break;
5861 /* Handle "leaving" */
5862 if (p_ptr->leaving) break;
5864 /* Count game turns */
5867 if (dungeon_turn < dungeon_turn_limit)
5869 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
5870 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
5873 prevent_turn_overflow();
5875 if (wild_regen) wild_regen--;
5878 /* Inside a quest and non-unique questor? */
5879 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5881 /* Un-mark the quest monster */
5882 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5885 /* Not save-and-quit and not dead? */
5886 if (p_ptr->playing && !p_ptr->is_dead)
5889 * Maintain Unique monsters and artifact, save current
5890 * floor, then prepare next floor
5894 /* Forget the flag */
5895 reinit_wilderness = FALSE;
5898 /* Write about current level on the play record once per level */
5904 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5907 * Modified by Arcum Dagsson to support
5908 * separate macro files for different realms.
5910 static void load_all_pref_files(void)
5914 /* Access the "user" pref file */
5915 sprintf(buf, "user.prf");
5917 /* Process that file */
5918 process_pref_file(buf);
5920 /* Access the "user" system pref file */
5921 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5923 /* Process that file */
5924 process_pref_file(buf);
5926 /* Access the "race" pref file */
5927 sprintf(buf, "%s.prf", rp_ptr->title);
5929 /* Process that file */
5930 process_pref_file(buf);
5932 /* Access the "class" pref file */
5933 sprintf(buf, "%s.prf", cp_ptr->title);
5935 /* Process that file */
5936 process_pref_file(buf);
5938 /* Access the "character" pref file */
5939 sprintf(buf, "%s.prf", player_base);
5941 /* Process that file */
5942 process_pref_file(buf);
5944 /* Access the "realm 1" pref file */
5945 if (p_ptr->realm1 != REALM_NONE)
5947 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5949 /* Process that file */
5950 process_pref_file(buf);
5953 /* Access the "realm 2" pref file */
5954 if (p_ptr->realm2 != REALM_NONE)
5956 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5958 /* Process that file */
5959 process_pref_file(buf);
5963 /* Load an autopick preference file */
5964 autopick_load_pref(FALSE);
5969 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
5972 void extract_option_vars(void)
5976 for (i = 0; option_info[i].o_desc; i++)
5978 int os = option_info[i].o_set;
5979 int ob = option_info[i].o_bit;
5981 /* Set the "default" options */
5982 if (option_info[i].o_var)
5985 if (option_flag[os] & (1L << ob))
5988 (*option_info[i].o_var) = TRUE;
5995 (*option_info[i].o_var) = FALSE;
6003 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
6006 void determine_bounty_uniques(void)
6009 monster_race *r_ptr;
6011 get_mon_num_prep(NULL, NULL);
6012 for (i = 0; i < MAX_KUBI; i++)
6016 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6017 r_ptr = &r_info[kubi_r_idx[i]];
6019 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6021 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6023 if (r_ptr->rarity > 100) continue;
6025 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6027 for (j = 0; j < i; j++)
6028 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6035 for (i = 0; i < MAX_KUBI - 1; i++)
6037 for (j = i; j < MAX_KUBI; j++)
6039 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6041 tmp = kubi_r_idx[i];
6042 kubi_r_idx[i] = kubi_r_idx[j];
6043 kubi_r_idx[j] = tmp;
6051 * @brief 今日の賞金首を確定する / Determine today's bounty monster
6053 * @note conv_old is used if loaded 0.0.3 or older save file
6055 void determine_today_mon(bool conv_old)
6058 bool old_inside_battle = p_ptr->inside_battle;
6059 monster_race *r_ptr;
6063 for (i = 0; i < max_d_idx; i++)
6065 if (max_dlv[i] < d_info[i].mindepth) continue;
6066 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6069 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6071 p_ptr->inside_battle = TRUE;
6072 get_mon_num_prep(NULL, NULL);
6076 today_mon = get_mon_num(max_dl);
6077 r_ptr = &r_info[today_mon];
6079 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6080 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6081 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6082 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6083 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6084 if (r_ptr->rarity > 10) continue;
6088 p_ptr->today_mon = 0;
6089 p_ptr->inside_battle = old_inside_battle;
6093 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
6096 * If the "new_game" parameter is true, then, after loading the
6097 * savefile, we will commit suicide, if necessary, to allow the
6098 * player to start a new game.
6100 void play_game(bool new_game)
6103 bool load_game = TRUE;
6104 bool init_random_seed = FALSE;
6114 else if (chuukei_server)
6116 prepare_chuukei_hooks();
6127 hack_mutation = FALSE;
6129 /* Hack -- Character is "icky" */
6130 character_icky = TRUE;
6132 /* Make sure main term is active */
6133 Term_activate(angband_term[0]);
6135 /* Initialise the resize hooks */
6136 angband_term[0]->resize_hook = resize_map;
6138 for (i = 1; i < 8; i++)
6140 /* Does the term exist? */
6141 if (angband_term[i])
6143 /* Add the redraw on resize hook */
6144 angband_term[i]->resize_hook = redraw_window;
6148 /* Hack -- turn off the cursor */
6149 (void)Term_set_cursor(0);
6152 /* Attempt to load */
6156 quit(_("セーブファイルが壊れています", "broken savefile"));
6159 /* Extract the options */
6160 extract_option_vars();
6162 /* Report waited score */
6163 if (p_ptr->wait_report_score)
6168 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
6172 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6177 p_ptr->is_dead = TRUE;
6179 start_time = time(NULL);
6181 /* No suspending now */
6182 signals_ignore_tstp();
6184 /* Hack -- Character is now "icky" */
6185 character_icky = TRUE;
6187 /* Build the filename */
6188 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6190 /* Open the high score file, for reading/writing */
6191 highscore_fd = fd_open(buf, O_RDWR);
6193 /* Handle score, show Top scores */
6194 success = send_world_score(TRUE);
6196 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
6198 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
6203 p_ptr->wait_report_score = FALSE;
6205 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
6207 /* Shut the high score file */
6208 (void)fd_close(highscore_fd);
6210 /* Forget the high score fd */
6213 /* Allow suspending now */
6214 signals_handle_tstp();
6219 creating_savefile = new_game;
6221 /* Nothing loaded */
6222 if (!character_loaded)
6224 /* Make new player */
6227 /* The dungeon is not ready */
6228 character_dungeon = FALSE;
6230 /* Prepare to init the RNG */
6231 init_random_seed = TRUE;
6233 /* Initialize the saved floors data */
6234 init_saved_floors(FALSE);
6237 /* Old game is loaded. But new game is requested. */
6240 /* Initialize the saved floors data */
6241 init_saved_floors(TRUE);
6244 /* Process old character */
6247 /* Process the player name */
6248 process_player_name(FALSE);
6252 if (init_random_seed)
6257 /* Roll new character */
6260 /* The dungeon is not ready */
6261 character_dungeon = FALSE;
6265 p_ptr->inside_quest = 0;
6266 p_ptr->inside_arena = FALSE;
6267 p_ptr->inside_battle = FALSE;
6271 /* Hack -- seed for flavors */
6272 seed_flavor = randint0(0x10000000);
6274 /* Hack -- seed for town layout */
6275 seed_town = randint0(0x10000000);
6277 /* Roll up a new character */
6285 determine_bounty_uniques();
6286 determine_today_mon(FALSE);
6288 /* Initialize object array */
6293 write_level = FALSE;
6295 do_cmd_write_nikki(NIKKI_GAMESTART, 1,
6297 " ---- Restart Game ----"));
6300 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
6301 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
6303 if (p_ptr->riding == -1)
6306 for (i = m_max; i > 0; i--)
6308 if (player_bold(m_list[i].fy, m_list[i].fx))
6317 creating_savefile = FALSE;
6319 p_ptr->teleport_town = FALSE;
6320 p_ptr->sutemi = FALSE;
6321 world_monster = FALSE;
6322 now_damaged = FALSE;
6324 start_time = time(NULL) - 1;
6325 record_o_name[0] = '\0';
6327 /* Reset map panel */
6328 panel_row_min = cur_hgt;
6329 panel_col_min = cur_wid;
6331 /* Sexy gal gets bonus to maximum weapon skill of whip */
6332 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6333 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
6335 /* Fill the arrays of floors and walls in the good proportions */
6336 set_floor_and_wall(dungeon_type);
6338 /* Flavor the objects */
6341 /* Flash a message */
6342 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
6344 /* Flush the message */
6348 /* Hack -- Enter wizard mode */
6351 if (enter_wizard_mode())
6353 p_ptr->wizard = TRUE;
6355 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
6357 /* Initialize the saved floors data */
6358 init_saved_floors(TRUE);
6361 p_ptr->inside_quest = 0;
6363 /* Avoid crash in update_view() */
6364 p_ptr->y = p_ptr->x = 10;
6367 else if (p_ptr->is_dead)
6369 quit("Already dead.");
6373 /* Initialize the town-buildings if necessary */
6374 if (!dun_level && !p_ptr->inside_quest)
6376 /* Init the wilderness */
6378 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
6381 init_flags = INIT_ONLY_BUILDINGS;
6383 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
6385 select_floor_music();
6389 /* Generate a dungeon level if needed */
6390 if (!character_dungeon)
6397 /* HACK -- Restore from panic-save */
6398 if (p_ptr->panic_save)
6400 /* No player? -- Try to regenerate floor */
6401 if (!p_ptr->y || !p_ptr->x)
6403 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
6407 /* Still no player? -- Try to locate random place */
6408 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
6410 /* No longer in panic */
6411 p_ptr->panic_save = 0;
6415 /* Character is now "complete" */
6416 character_generated = TRUE;
6419 /* Hack -- Character is no longer "icky" */
6420 character_icky = FALSE;
6426 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
6427 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
6432 p_ptr->playing = TRUE;
6434 /* Reset the visual mappings */
6437 /* Load the "pref" files */
6438 load_all_pref_files();
6440 /* Give startup outfit (after loading pref files) */
6446 /* React to changes */
6447 Term_xtra(TERM_XTRA_REACT, 0);
6450 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
6453 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
6459 /* Set or clear "rogue_like_commands" if requested */
6460 if (arg_force_original) rogue_like_commands = FALSE;
6461 if (arg_force_roguelike) rogue_like_commands = TRUE;
6463 /* Hack -- Enforce "delayed death" */
6464 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
6466 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
6468 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
6470 monster_type *m_ptr;
6471 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
6472 monster_race *r_ptr = &r_info[pet_r_idx];
6473 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
6474 (PM_FORCE_PET | PM_NO_KAGE));
6475 m_ptr = &m_list[hack_m_idx_ii];
6476 m_ptr->mspeed = r_ptr->speed;
6477 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
6478 m_ptr->max_maxhp = m_ptr->maxhp;
6479 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
6480 m_ptr->dealt_damage = 0;
6481 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
6484 (void)combine_and_reorder_home(STORE_HOME);
6485 (void)combine_and_reorder_home(STORE_MUSEUM);
6487 select_floor_music();
6492 /* Process the level */
6495 /* Handle "p_ptr->notice" */
6498 /* Hack -- prevent "icky" message */
6499 character_xtra = TRUE;
6501 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6504 character_xtra = FALSE;
6506 /* Cancel the target */
6509 /* Cancel the health bar */
6513 /* Forget the lite */
6516 /* Forget the view */
6519 /* Forget the view */
6522 /* Handle "quit and save" */
6523 if (!p_ptr->playing && !p_ptr->is_dead) break;
6525 /* Erase the old cave */
6527 if (!p_ptr->is_dead) wipe_m_list();
6535 /* Accidental Death */
6536 if (p_ptr->playing && p_ptr->is_dead)
6538 if (p_ptr->inside_arena)
6540 p_ptr->inside_arena = FALSE;
6541 if (p_ptr->arena_number > MAX_ARENA_MONS)
6542 p_ptr->arena_number++;
6544 p_ptr->arena_number = -1 - p_ptr->arena_number;
6545 p_ptr->is_dead = FALSE;
6547 p_ptr->chp_frac = 0;
6548 p_ptr->exit_bldg = TRUE;
6551 /* Leave through the exit */
6552 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
6554 /* prepare next floor */
6559 /* Mega-Hack -- Allow player to cheat death */
6560 if ((p_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
6562 /* Mark social class, reset age, if needed */
6563 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
6569 p_ptr->noscore |= 0x0001;
6572 msg_print(_("ウィザードモードに念を送り、死を欺いた。", "You invoke wizard mode and cheat death."));
6575 /* Restore hit points */
6576 p_ptr->chp = p_ptr->mhp;
6577 p_ptr->chp_frac = 0;
6579 if (p_ptr->pclass == CLASS_MAGIC_EATER)
6581 for (i = 0; i < EATER_EXT*2; i++)
6583 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
6585 for (; i < EATER_EXT*3; i++)
6587 p_ptr->magic_num1[i] = 0;
6590 /* Restore spell points */
6591 p_ptr->csp = p_ptr->msp;
6592 p_ptr->csp_frac = 0;
6594 /* Hack -- cancel recall */
6595 if (p_ptr->word_recall)
6598 msg_print(_("張りつめた大気が流れ去った...", "A tension leaves the air around you..."));
6601 /* Hack -- Prevent recall */
6602 p_ptr->word_recall = 0;
6603 p_ptr->redraw |= (PR_STATUS);
6606 /* Hack -- cancel alter */
6607 if (p_ptr->alter_reality)
6609 /* Hack -- Prevent alter */
6610 p_ptr->alter_reality = 0;
6611 p_ptr->redraw |= (PR_STATUS);
6614 /* Note cause of death XXX XXX XXX */
6615 (void)strcpy(p_ptr->died_from, _("死の欺き", "Cheating death"));
6618 p_ptr->is_dead = FALSE;
6620 /* Hack -- Healing */
6622 (void)set_confused(0);
6623 (void)set_poisoned(0);
6624 (void)set_afraid(0);
6625 (void)set_paralyzed(0);
6630 /* Hack -- Prevent starvation */
6631 (void)set_food(PY_FOOD_MAX - 1);
6634 p_ptr->inside_arena = FALSE;
6635 p_ptr->inside_battle = FALSE;
6637 p_ptr->inside_quest = 0;
6638 if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
6640 if (lite_town || vanilla_town)
6642 p_ptr->wilderness_y = 1;
6643 p_ptr->wilderness_x = 1;
6657 p_ptr->wilderness_y = 48;
6658 p_ptr->wilderness_x = 5;
6664 p_ptr->wild_mode = FALSE;
6665 p_ptr->leaving = TRUE;
6667 do_cmd_write_nikki(NIKKI_BUNSHOU, 1,
6671 /* Prepare next floor */
6678 /* Handle "death" */
6679 if (p_ptr->is_dead) break;
6681 /* Make a new level */
6693 * @brief ゲームターンからの実時間換算を行うための補正をかける
6694 * @param hoge ゲームターン
6695 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
6696 * @return 修正をかけた後のゲームターン
6698 s32b turn_real(s32b hoge)
6700 switch (p_ptr->start_race)
6706 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
6713 * @brief ターンのオーバーフローに対する対処
6714 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
6715 * @return 修正をかけた後のゲームターン
6717 void prevent_turn_overflow(void)
6719 int rollback_days, i, j;
6720 s32b rollback_turns;
6722 if (turn < turn_limit) return;
6724 rollback_days = 1 + (turn - turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
6725 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
6727 if (turn > rollback_turns) turn -= rollback_turns;
6728 else turn = 1; /* Paranoia */
6729 if (old_turn > rollback_turns) old_turn -= rollback_turns;
6731 if (old_battle > rollback_turns) old_battle -= rollback_turns;
6732 else old_battle = 1;
6733 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
6734 else p_ptr->feeling_turn = 1;
6736 for (i = 1; i < max_towns; i++)
6738 for (j = 0; j < MAX_STORES; j++)
6740 store_type *st_ptr = &town[i].store[j];
6742 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
6744 st_ptr->last_visit -= rollback_turns;
6745 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
6748 if (st_ptr->store_open)
6750 st_ptr->store_open -= rollback_turns;
6751 if (st_ptr->store_open < 1) st_ptr->store_open = 1;