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)
608 if (get_check("他の階にテレポートしますか?"))
610 if (get_check("Teleport level? "))
617 /* Only downward in ironman mode */
618 if (ironman_downward)
619 min_level = dun_level;
622 if (dungeon_type == DUNGEON_ANGBAND)
625 max_level = MAX_DEPTH - 1;
626 else if (dun_level == 100)
631 max_level = d_info[dungeon_type].maxdepth;
632 min_level = d_info[dungeon_type].mindepth;
637 sprintf(ppp, "テレポート先:(%d-%d)", min_level, max_level);
639 sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
644 sprintf(tmp_val, "%d", dun_level);
646 /* Ask for a level */
647 if (!get_string(ppp, tmp_val, 10)) return;
649 /* Extract request */
650 command_arg = atoi(tmp_val);
653 else if (get_check("通常テレポート?"))
655 else if (get_check("Normal teleport? "))
658 teleport_player(200, 0L);
667 if (command_arg < min_level) command_arg = min_level;
670 if (command_arg > max_level) command_arg = max_level;
674 msg_format("%d 階にテレポートしました。", command_arg);
676 msg_format("You teleport to dungeon level %d.", command_arg);
680 if (autosave_l) do_cmd_save_game(TRUE);
683 dun_level = command_arg;
687 if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
689 p_ptr->inside_quest = 0;
693 * Clear all saved floors
694 * and create a first saved floor
696 prepare_change_floor_mode(CFM_FIRST_FLOOR);
699 p_ptr->leaving = TRUE;
703 * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
706 static void wreck_the_pattern(void)
708 int to_ruin = 0, r_y, r_x;
709 int pattern_type = f_info[cave[py][px].feat].subtype;
711 if (pattern_type == PATTERN_TILE_WRECKED)
718 msg_print("パターンを血で汚してしまった!");
719 msg_print("何か恐ろしい事が起こった!");
721 msg_print("You bleed on the Pattern!");
722 msg_print("Something terrible happens!");
727 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "パターン損壊", -1);
729 take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
732 to_ruin = randint1(45) + 35;
736 scatter(&r_y, &r_x, py, px, 4, 0);
738 if (pattern_tile(r_y, r_x) &&
739 (f_info[cave[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
741 cave_set_feat(r_y, r_x, feat_pattern_corrupted);
745 cave_set_feat(py, px, feat_pattern_corrupted);
749 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
750 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
752 static bool pattern_effect(void)
756 if (!pattern_tile(py, px)) return FALSE;
758 if ((prace_is_(RACE_AMBERITE)) &&
759 (p_ptr->cut > 0) && one_in_(10))
764 pattern_type = f_info[cave[py][px].feat].subtype;
766 switch (pattern_type)
768 case PATTERN_TILE_END:
769 (void)set_poisoned(0);
775 (void)do_res_stat(A_STR);
776 (void)do_res_stat(A_INT);
777 (void)do_res_stat(A_WIS);
778 (void)do_res_stat(A_DEX);
779 (void)do_res_stat(A_CON);
780 (void)do_res_stat(A_CHR);
781 (void)restore_level();
782 (void)hp_player(1000);
784 cave_set_feat(py, px, feat_pattern_old);
787 msg_print("「パターン」のこの部分は他の部分より強力でないようだ。");
789 msg_print("This section of the Pattern looks less powerful.");
793 * We could make the healing effect of the
794 * Pattern center one-time only to avoid various kinds
795 * of abuse, like luring the win monster into fighting you
796 * in the middle of the pattern...
800 case PATTERN_TILE_OLD:
804 case PATTERN_TILE_TELEPORT:
808 case PATTERN_TILE_WRECKED:
811 take_hit(DAMAGE_NOESCAPE, 200, "壊れた「パターン」を歩いたダメージ", -1);
813 take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
818 if (prace_is_(RACE_AMBERITE) && !one_in_(2))
820 else if (!IS_INVULN())
822 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "「パターン」を歩いたダメージ", -1);
824 take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
834 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
835 * @param percent 回復比率
838 static void regenhp(int percent)
844 if (p_ptr->special_defense & KATA_KOUKIJIN) return;
845 if (p_ptr->action == ACTION_HAYAGAKE) return;
847 /* Save the old hitpoints */
848 old_chp = p_ptr->chp;
851 * Extract the new hitpoints
853 * 'percent' is the Regen factor in unit (1/2^16)
856 new_chp_frac = (p_ptr->mhp * percent + PY_REGEN_HPBASE);
858 /* Convert the unit (1/2^16) to (1/2^32) */
859 s64b_LSHIFT(new_chp, new_chp_frac, 16);
862 s64b_add(&(p_ptr->chp), &(p_ptr->chp_frac), new_chp, new_chp_frac);
866 if (0 < s64b_cmp(p_ptr->chp, p_ptr->chp_frac, p_ptr->mhp, 0))
868 p_ptr->chp = p_ptr->mhp;
873 if (old_chp != p_ptr->chp)
876 p_ptr->redraw |= (PR_HP);
879 p_ptr->window |= (PW_PLAYER);
887 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
888 * @param upkeep_factor ペット維持によるMPコスト量
889 * @param regen_amount 回復量
892 static void regenmana(int upkeep_factor, int regen_amount)
894 s32b old_csp = p_ptr->csp;
895 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
898 * Excess mana will decay 32 times faster than normal
901 if (p_ptr->csp > p_ptr->msp)
903 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
905 u32b decay_frac = (p_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
907 /* Convert the unit (1/2^16) to (1/2^32) */
908 s64b_LSHIFT(decay, decay_frac, 16);
911 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), decay, decay_frac);
914 if (p_ptr->csp < p_ptr->msp)
916 p_ptr->csp = p_ptr->msp;
921 /* Regenerating mana (unless the player has excess mana) */
922 else if (regen_rate > 0)
924 /* (percent/100) is the Regen factor in unit (1/2^16) */
926 u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
928 /* Convert the unit (1/2^16) to (1/2^32) */
929 s64b_LSHIFT(new_mana, new_mana_frac, 16);
932 s64b_add(&(p_ptr->csp), &(p_ptr->csp_frac), new_mana, new_mana_frac);
934 /* Must set frac to zero even if equal */
935 if (p_ptr->csp >= p_ptr->msp)
937 p_ptr->csp = p_ptr->msp;
943 /* Reduce mana (even when the player has excess mana) */
946 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
947 s32b reduce_mana = 0;
948 u32b reduce_mana_frac = (p_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
950 /* Convert the unit (1/2^16) to (1/2^32) */
951 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
954 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), reduce_mana, reduce_mana_frac);
966 if (old_csp != p_ptr->csp)
969 p_ptr->redraw |= (PR_MANA);
972 p_ptr->window |= (PW_PLAYER);
973 p_ptr->window |= (PW_SPELL);
980 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
981 * @param regen_amount 回復量
984 static void regenmagic(int regen_amount)
989 int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
991 for (i = 0; i < EATER_EXT*2; i++)
993 if (!p_ptr->magic_num2[i]) continue;
994 if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
996 /* Increase remaining charge number like float value */
997 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
998 p_ptr->magic_num1[i] += new_mana;
1000 /* Check maximum charge */
1001 if (p_ptr->magic_num1[i] > (p_ptr->magic_num2[i] << 16))
1003 p_ptr->magic_num1[i] = ((long)p_ptr->magic_num2[i] << 16);
1007 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
1009 if (!p_ptr->magic_num1[i]) continue;
1010 if (!p_ptr->magic_num2[i]) continue;
1012 /* Decrease remaining period for charging */
1013 new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
1014 / (dev * 16 * PY_REGEN_NORMAL);
1015 p_ptr->magic_num1[i] -= new_mana;
1017 /* Check minimum remaining period for charging */
1018 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
1025 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
1027 * @note XXX XXX XXX Should probably be done during monster turns.
1029 static void regen_monsters(void)
1034 /* Regenerate everyone */
1035 for (i = 1; i < m_max; i++)
1037 /* Check the i'th monster */
1038 monster_type *m_ptr = &m_list[i];
1039 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1042 /* Skip dead monsters */
1043 if (!m_ptr->r_idx) continue;
1045 /* Allow regeneration (if needed) */
1046 if (m_ptr->hp < m_ptr->maxhp)
1048 /* Hack -- Base regeneration */
1049 frac = m_ptr->maxhp / 100;
1051 /* Hack -- Minimal regeneration rate */
1052 if (!frac) if (one_in_(2)) frac = 1;
1054 /* Hack -- Some monsters regenerate quickly */
1055 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1057 /* Hack -- Regenerate */
1060 /* Do not over-regenerate */
1061 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1063 /* Redraw (later) if needed */
1064 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
1065 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
1072 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
1074 * @note XXX XXX XXX Should probably be done during monster turns.
1076 static void regen_captured_monsters(void)
1081 /* Regenerate everyone */
1082 for (i = 0; i < INVEN_TOTAL; i++)
1084 monster_race *r_ptr;
1085 object_type *o_ptr = &inventory[i];
1087 if (!o_ptr->k_idx) continue;
1088 if (o_ptr->tval != TV_CAPTURE) continue;
1089 if (!o_ptr->pval) continue;
1093 r_ptr = &r_info[o_ptr->pval];
1095 /* Allow regeneration (if needed) */
1096 if (o_ptr->xtra4 < o_ptr->xtra5)
1098 /* Hack -- Base regeneration */
1099 frac = o_ptr->xtra5 / 100;
1101 /* Hack -- Minimal regeneration rate */
1102 if (!frac) if (one_in_(2)) frac = 1;
1104 /* Hack -- Some monsters regenerate quickly */
1105 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1107 /* Hack -- Regenerate */
1108 o_ptr->xtra4 += frac;
1110 /* Do not over-regenerate */
1111 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1118 p_ptr->notice |= (PN_COMBINE);
1121 p_ptr->window |= (PW_INVEN);
1122 p_ptr->window |= (PW_EQUIP);
1128 * @brief 寿命つき光源の警告メッセージ処理
1129 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1132 static void notice_lite_change(object_type *o_ptr)
1134 /* Hack -- notice interesting fuel steps */
1135 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1138 p_ptr->window |= (PW_EQUIP);
1141 /* Hack -- Special treatment when blind */
1144 /* Hack -- save some light for later */
1145 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1148 /* The light is now out */
1149 else if (o_ptr->xtra4 == 0)
1153 msg_print("明かりが消えてしまった!");
1155 msg_print("Your light has gone out!");
1158 /* Recalculate torch radius */
1159 p_ptr->update |= (PU_TORCH);
1161 /* Some ego light lose its effects without fuel */
1162 p_ptr->update |= (PU_BONUS);
1165 /* The light is getting dim */
1166 else if (o_ptr->name2 == EGO_LITE_LONG)
1168 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1169 && (turn % (TURNS_PER_TICK*2)))
1171 if (disturb_minor) disturb(0, 1);
1173 msg_print("明かりが微かになってきている。");
1175 msg_print("Your light is growing faint.");
1181 /* The light is getting dim */
1182 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1184 if (disturb_minor) disturb(0, 1);
1186 msg_print("明かりが微かになってきている。");
1188 msg_print("Your light is growing faint.");
1195 * @brief クエスト階層から離脱する際の処理
1198 void leave_quest_check(void)
1200 /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
1201 leaving_quest = p_ptr->inside_quest;
1203 /* Leaving an 'only once' quest marks it as failed */
1206 quest_type* const q_ptr = &quest[leaving_quest];
1208 if(((q_ptr->flags & QUEST_FLAG_ONCE) || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
1209 (q_ptr->status == QUEST_STATUS_TAKEN))
1211 q_ptr->status = QUEST_STATUS_FAILED;
1212 q_ptr->complev = (byte)p_ptr->lev;
1214 q_ptr->comptime = playtime;
1216 /* Additional settings */
1217 switch (q_ptr->type)
1219 case QUEST_TYPE_TOWER:
1220 quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
1221 quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
1223 case QUEST_TYPE_FIND_ARTIFACT:
1224 a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
1226 case QUEST_TYPE_RANDOM:
1227 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
1229 /* Floor of random quest will be blocked */
1230 prepare_change_floor_mode(CFM_NO_RETURN);
1234 /* Record finishing a quest */
1235 if (q_ptr->type == QUEST_TYPE_RANDOM)
1237 if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
1241 if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
1248 * @brief 「塔」クエストの各階層から離脱する際の処理
1251 void leave_tower_check(void)
1253 leaving_quest = p_ptr->inside_quest;
1254 /* Check for Tower Quest */
1255 if (leaving_quest &&
1256 (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
1257 (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
1259 if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
1261 quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
1262 quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
1264 quest[QUEST_TOWER1].comptime = playtime;
1270 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
1272 * @todo mind.cにこの関数を移動させるべき。
1274 * currently this function allows pseudo-id of any object,
1275 * including silly ones like potions & scrolls, which always
1276 * get '{average}'. This should be changed, either to stop such
1277 * items from being pseudo-id'd, or to allow psychometry to
1278 * detect whether the unidentified potion/scroll/etc is
1279 * good (Cure Light Wounds, Restore Strength, etc) or
1280 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
1282 bool psychometry(void)
1286 char o_name[MAX_NLEN];
1291 item_tester_no_ryoute = TRUE;
1294 q = "どのアイテムを調べますか?";
1295 s = "調べるアイテムがありません。";
1297 q = "Meditate on which item? ";
1298 s = "You have nothing appropriate.";
1301 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
1303 /* Get the item (in the pack) */
1306 o_ptr = &inventory[item];
1309 /* Get the item (on the floor) */
1312 o_ptr = &o_list[0 - item];
1315 /* It is fully known, no information needed */
1316 if (object_is_known(o_ptr))
1319 msg_print("何も新しいことは判らなかった。");
1321 msg_print("You cannot find out anything more about that.");
1327 /* Check for a feeling */
1328 feel = value_check_aux1(o_ptr);
1330 /* Get an object description */
1331 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1333 /* Skip non-feelings */
1337 msg_format("%sからは特に変わった事は感じとれなかった。", o_name);
1339 msg_format("You do not perceive anything unusual about the %s.", o_name);
1346 msg_format("%sは%sという感じがする...",
1347 o_name, game_inscriptions[feel]);
1349 msg_format("You feel that the %s %s %s...",
1350 o_name, ((o_ptr->number == 1) ? "is" : "are"),
1351 game_inscriptions[feel]);
1355 /* We have "felt" it */
1356 o_ptr->ident |= (IDENT_SENSE);
1359 o_ptr->feeling = feel;
1361 /* Player touches it */
1362 o_ptr->marked |= OM_TOUCHED;
1364 /* Combine / Reorder the pack (later) */
1365 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
1368 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
1370 /* Valid "tval" codes */
1371 switch (o_ptr->tval)
1399 /* Auto-inscription/destroy */
1400 autopick_alter_item(item, (bool)(okay && destroy_feeling));
1402 /* Something happened */
1407 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1408 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1411 static void recharged_notice(object_type *o_ptr)
1413 char o_name[MAX_NLEN];
1417 /* No inscription */
1418 if (!o_ptr->inscription) return;
1421 s = my_strchr(quark_str(o_ptr->inscription), '!');
1423 /* Process notification request. */
1426 /* Find another '!' */
1429 /* Describe (briefly) */
1430 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1432 /* Notify the player */
1434 msg_format("%sは再充填された。", o_name);
1436 if (o_ptr->number > 1)
1437 msg_format("Your %s are recharged.", o_name);
1439 msg_format("Your %s is recharged.", o_name);
1448 /* Keep looking for '!'s */
1449 s = my_strchr(s + 1, '!');
1454 * @brief プレイヤーの歌に関する継続処理
1457 static void check_music(void)
1459 const magic_type *s_ptr;
1462 u32b need_mana_frac;
1464 /* Music singed by player */
1465 if (p_ptr->pclass != CLASS_BARD) return;
1466 if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
1468 if (p_ptr->anti_magic)
1474 spell = p_ptr->magic_num2[0];
1475 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1477 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1481 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1483 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1490 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
1492 p_ptr->redraw |= PR_MANA;
1493 if (p_ptr->magic_num1[1])
1495 p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
1496 p_ptr->magic_num1[1] = 0;
1498 msg_print("歌を再開した。");
1500 msg_print("You restart singing.");
1502 p_ptr->action = ACTION_SING;
1504 /* Recalculate bonuses */
1505 p_ptr->update |= (PU_BONUS | PU_HP);
1507 /* Redraw map and status bar */
1508 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1510 /* Update monsters */
1511 p_ptr->update |= (PU_MONSTERS);
1514 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1517 if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1518 p_ptr->spell_exp[spell] += 5;
1519 else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1520 { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
1521 else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1522 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1523 else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1524 { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
1526 /* Do any effects of continual song */
1527 do_spell(REALM_MUSIC, spell, SPELL_CONT);
1531 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1532 * @param flag 探し出したい呪いフラグ配列
1533 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1536 static object_type *choose_cursed_obj_name(u32b flag)
1539 int choices[INVEN_TOTAL-INVEN_RARM];
1542 /* Paranoia -- Player has no warning-item */
1543 if (!(p_ptr->cursed & flag)) return NULL;
1545 /* Search Inventry */
1546 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1548 object_type *o_ptr = &inventory[i];
1550 if (o_ptr->curse_flags & flag)
1552 choices[number] = i;
1555 else if ((flag == TRC_ADD_L_CURSE) ||
1556 (flag == TRC_ADD_H_CURSE) ||
1557 (flag == TRC_DRAIN_HP) ||
1558 (flag == TRC_DRAIN_MANA) ||
1559 (flag == TRC_CALL_ANIMAL) ||
1560 (flag == TRC_CALL_DEMON) ||
1561 (flag == TRC_CALL_DRAGON) ||
1562 (flag == TRC_CALL_UNDEAD) ||
1563 (flag == TRC_COWARDICE) ||
1564 (flag == TRC_LOW_MELEE) ||
1565 (flag == TRC_LOW_AC) ||
1566 (flag == TRC_LOW_MAGIC) ||
1567 (flag == TRC_FAST_DIGEST) ||
1568 (flag == TRC_SLOW_REGEN) )
1571 u32b flgs[TR_FLAG_SIZE];
1572 object_flags(o_ptr, flgs);
1575 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1576 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1577 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1578 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1579 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1580 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1581 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1582 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1583 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1584 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1585 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1586 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1587 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1588 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1591 if (have_flag(flgs, cf))
1593 choices[number] = i;
1599 /* Choice one of them */
1600 return (&inventory[choices[randint0(number)]]);
1604 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1605 * / Handle timed damage and regeneration every 10 game turns
1608 static void process_world_aux_hp_and_sp(void)
1610 feature_type *f_ptr = &f_info[cave[py][px].feat];
1611 bool cave_no_regen = FALSE;
1612 int upkeep_factor = 0;
1614 /* Default regeneration */
1615 int regen_amount = PY_REGEN_NORMAL;
1618 /*** Damage over Time ***/
1620 /* Take damage from poison */
1621 if (p_ptr->poisoned && !IS_INVULN())
1625 take_hit(DAMAGE_NOESCAPE, 1, "毒", -1);
1627 take_hit(DAMAGE_NOESCAPE, 1, "poison", -1);
1632 /* Take damage from cuts */
1633 if (p_ptr->cut && !IS_INVULN())
1637 /* Mortal wound or Deep Gash */
1638 if (p_ptr->cut > 1000)
1643 else if (p_ptr->cut > 200)
1649 else if (p_ptr->cut > 100)
1654 else if (p_ptr->cut > 50)
1659 else if (p_ptr->cut > 25)
1664 else if (p_ptr->cut > 10)
1677 take_hit(DAMAGE_NOESCAPE, dam, "致命傷", -1);
1679 take_hit(DAMAGE_NOESCAPE, dam, "a fatal wound", -1);
1685 /* (Vampires) Take damage from sunlight */
1686 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
1688 if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
1690 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1694 msg_print("日光があなたのアンデッドの肉体を焼き焦がした!");
1695 take_hit(DAMAGE_NOESCAPE, 1, "日光", -1);
1697 msg_print("The sun's rays scorch your undead flesh!");
1698 take_hit(DAMAGE_NOESCAPE, 1, "sunlight", -1);
1701 cave_no_regen = TRUE;
1705 if (inventory[INVEN_LITE].tval && (inventory[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1706 !p_ptr->resist_lite)
1708 object_type * o_ptr = &inventory[INVEN_LITE];
1709 char o_name [MAX_NLEN];
1710 char ouch [MAX_NLEN+40];
1712 /* Get an object description */
1713 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1716 msg_format("%sがあなたのアンデッドの肉体を焼き焦がした!", o_name);
1718 msg_format("The %s scorches your undead flesh!", o_name);
1722 cave_no_regen = TRUE;
1724 /* Get an object description */
1725 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1728 sprintf(ouch, "%sを装備したダメージ", o_name);
1730 sprintf(ouch, "wielding %s", o_name);
1733 if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, 1, ouch, -1);
1737 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
1741 if (have_flag(f_ptr->flags, FF_DEEP))
1743 damage = 6000 + randint0(4000);
1745 else if (!p_ptr->levitation)
1747 damage = 3000 + randint0(2000);
1752 if (prace_is_(RACE_ENT)) damage += damage / 3;
1753 if (p_ptr->resist_fire) damage = damage / 3;
1754 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1756 if (p_ptr->levitation) damage = damage / 5;
1758 damage = damage / 100 + (randint0(100) < (damage % 100));
1760 if (p_ptr->levitation)
1763 msg_print("熱で火傷した!");
1764 take_hit(DAMAGE_NOESCAPE, damage, format("%sの上に浮遊したダメージ", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
1766 msg_print("The heat burns you!");
1767 take_hit(DAMAGE_NOESCAPE, damage, format("flying over %s", f_name + f_info[get_feat_mimic(&cave[py][px])].name), -1);
1772 cptr name = f_name + f_info[get_feat_mimic(&cave[py][px])].name;
1774 msg_format("%sで火傷した!", name);
1776 msg_format("The %s burns you!", name);
1778 take_hit(DAMAGE_NOESCAPE, damage, name, -1);
1781 cave_no_regen = TRUE;
1785 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1786 !p_ptr->levitation && !p_ptr->can_swim)
1788 if (p_ptr->total_weight > weight_limit())
1792 msg_print("溺れている!");
1793 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "溺れ", -1);
1795 msg_print("You are drowning!");
1796 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
1799 cave_no_regen = TRUE;
1806 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire)
1808 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1809 if (prace_is_(RACE_ENT)) damage += damage / 3;
1810 if (p_ptr->resist_fire) damage = damage / 3;
1811 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1814 take_hit(DAMAGE_NOESCAPE, damage, "炎のオーラ", -1);
1816 msg_print("It's hot!");
1817 take_hit(DAMAGE_NOESCAPE, damage, "Fire aura", -1);
1820 if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !p_ptr->immune_elec)
1822 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1823 if (prace_is_(RACE_ANDROID)) damage += damage / 3;
1824 if (p_ptr->resist_elec) damage = damage / 3;
1825 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1828 take_hit(DAMAGE_NOESCAPE, damage, "電気のオーラ", -1);
1830 msg_print("It hurts!");
1831 take_hit(DAMAGE_NOESCAPE, damage, "Elec aura", -1);
1834 if ((r_info[m_list[p_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !p_ptr->immune_cold)
1836 damage = r_info[m_list[p_ptr->riding].r_idx].level / 2;
1837 if (p_ptr->resist_cold) damage = damage / 3;
1838 if (IS_OPPOSE_COLD()) damage = damage / 3;
1841 take_hit(DAMAGE_NOESCAPE, damage, "冷気のオーラ", -1);
1843 msg_print("It's cold!");
1844 take_hit(DAMAGE_NOESCAPE, damage, "Cold aura", -1);
1849 /* Spectres -- take damage when moving through walls */
1851 * Added: ANYBODY takes damage if inside through walls
1852 * without wraith form -- NOTE: Spectres will never be
1853 * reduced below 0 hp by being inside a stone wall; others
1856 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1858 if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke &&
1859 ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall))
1863 cave_no_regen = TRUE;
1865 if (p_ptr->pass_wall)
1868 msg_print("体の分子が分解した気がする!");
1871 msg_print("Your molecules feel disrupted!");
1872 dam_desc = "density";
1878 msg_print("崩れた岩に押し潰された!");
1881 msg_print("You are being crushed!");
1882 dam_desc = "solid rock";
1886 take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
1891 /*** handle regeneration ***/
1894 if (p_ptr->food < PY_FOOD_WEAK)
1896 /* Lower regeneration */
1897 if (p_ptr->food < PY_FOOD_STARVE)
1901 else if (p_ptr->food < PY_FOOD_FAINT)
1903 regen_amount = PY_REGEN_FAINT;
1907 regen_amount = PY_REGEN_WEAK;
1911 /* Are we walking the pattern? */
1912 if (pattern_effect())
1914 cave_no_regen = TRUE;
1918 /* Regeneration ability */
1919 if (p_ptr->regenerate)
1921 regen_amount = regen_amount * 2;
1923 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1927 if (p_ptr->cursed & TRC_SLOW_REGEN)
1934 /* Searching or Resting */
1935 if ((p_ptr->action == ACTION_SEARCH) || (p_ptr->action == ACTION_REST))
1937 regen_amount = regen_amount * 2;
1940 upkeep_factor = calculate_upkeep();
1942 /* No regeneration while special action */
1943 if ((p_ptr->action == ACTION_LEARN) ||
1944 (p_ptr->action == ACTION_HAYAGAKE) ||
1945 (p_ptr->special_defense & KATA_KOUKIJIN))
1947 upkeep_factor += 100;
1950 /* Regenerate the mana */
1951 regenmana(upkeep_factor, regen_amount);
1954 /* Recharge magic eater's power */
1955 if (p_ptr->pclass == CLASS_MAGIC_EATER)
1957 regenmagic(regen_amount);
1960 if ((p_ptr->csp == 0) && (p_ptr->csp_frac == 0))
1962 while (upkeep_factor > 100)
1965 msg_print("こんなに多くのペットを制御できない!");
1967 msg_print("Too many pets to control at once!");
1970 do_cmd_pet_dismiss();
1972 upkeep_factor = calculate_upkeep();
1975 msg_format("維持MPは %d%%", upkeep_factor);
1977 msg_format("Upkeep: %d%% mana.", upkeep_factor);
1983 /* Poisoned or cut yields no healing */
1984 if (p_ptr->poisoned) regen_amount = 0;
1985 if (p_ptr->cut) regen_amount = 0;
1987 /* Special floor -- Pattern, in a wall -- yields no healing */
1988 if (cave_no_regen) regen_amount = 0;
1990 regen_amount = (regen_amount * mutant_regenerate_mod) / 100;
1992 /* Regenerate Hit Points if needed */
1993 if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
1995 regenhp(regen_amount);
2000 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
2001 * / Handle timeout every 10 game turns
2004 static void process_world_aux_timeout(void)
2006 const int dec_count = (easy_band ? 2 : 1);
2008 /*** Timeout Various Things ***/
2011 if (p_ptr->tim_mimic)
2013 (void)set_mimic(p_ptr->tim_mimic - 1, p_ptr->mimic_form, TRUE);
2016 /* Hack -- Hallucinating */
2019 (void)set_image(p_ptr->image - dec_count);
2025 (void)set_blind(p_ptr->blind - dec_count);
2028 /* Times see-invisible */
2029 if (p_ptr->tim_invis)
2031 (void)set_tim_invis(p_ptr->tim_invis - 1, TRUE);
2042 (void)set_tim_esp(p_ptr->tim_esp - 1, TRUE);
2045 /* Timed temporary elemental brands. -LM- */
2046 if (p_ptr->ele_attack)
2048 p_ptr->ele_attack--;
2050 /* Clear all temporary elemental brands. */
2051 if (!p_ptr->ele_attack) set_ele_attack(0, 0);
2054 /* Timed temporary elemental immune. -LM- */
2055 if (p_ptr->ele_immune)
2057 p_ptr->ele_immune--;
2059 /* Clear all temporary elemental brands. */
2060 if (!p_ptr->ele_immune) set_ele_immune(0, 0);
2063 /* Timed infra-vision */
2064 if (p_ptr->tim_infra)
2066 (void)set_tim_infra(p_ptr->tim_infra - 1, TRUE);
2070 if (p_ptr->tim_stealth)
2072 (void)set_tim_stealth(p_ptr->tim_stealth - 1, TRUE);
2075 /* Timed levitation */
2076 if (p_ptr->tim_levitation)
2078 (void)set_tim_levitation(p_ptr->tim_levitation - 1, TRUE);
2081 /* Timed sh_touki */
2082 if (p_ptr->tim_sh_touki)
2084 (void)set_tim_sh_touki(p_ptr->tim_sh_touki - 1, TRUE);
2088 if (p_ptr->tim_sh_fire)
2090 (void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
2094 if (p_ptr->tim_sh_holy)
2096 (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
2100 if (p_ptr->tim_eyeeye)
2102 (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
2105 /* Timed resist-magic */
2106 if (p_ptr->resist_magic)
2108 (void)set_resist_magic(p_ptr->resist_magic - 1, TRUE);
2111 /* Timed regeneration */
2112 if (p_ptr->tim_regen)
2114 (void)set_tim_regen(p_ptr->tim_regen - 1, TRUE);
2117 /* Timed resist nether */
2118 if (p_ptr->tim_res_nether)
2120 (void)set_tim_res_nether(p_ptr->tim_res_nether - 1, TRUE);
2123 /* Timed resist time */
2124 if (p_ptr->tim_res_time)
2126 (void)set_tim_res_time(p_ptr->tim_res_time - 1, TRUE);
2130 if (p_ptr->tim_reflect)
2132 (void)set_tim_reflect(p_ptr->tim_reflect - 1, TRUE);
2136 if (p_ptr->multishadow)
2138 (void)set_multishadow(p_ptr->multishadow - 1, TRUE);
2141 /* Timed Robe of dust */
2142 if (p_ptr->dustrobe)
2144 (void)set_dustrobe(p_ptr->dustrobe - 1, TRUE);
2147 /* Timed infra-vision */
2148 if (p_ptr->kabenuke)
2150 (void)set_kabenuke(p_ptr->kabenuke - 1, TRUE);
2154 if (p_ptr->paralyzed)
2156 (void)set_paralyzed(p_ptr->paralyzed - dec_count);
2160 if (p_ptr->confused)
2162 (void)set_confused(p_ptr->confused - dec_count);
2168 (void)set_afraid(p_ptr->afraid - dec_count);
2174 (void)set_fast(p_ptr->fast - 1, TRUE);
2180 (void)set_slow(p_ptr->slow - dec_count, TRUE);
2183 /* Protection from evil */
2184 if (p_ptr->protevil)
2186 (void)set_protevil(p_ptr->protevil - 1, TRUE);
2189 /* Invulnerability */
2192 (void)set_invuln(p_ptr->invuln - 1, TRUE);
2196 if (p_ptr->wraith_form)
2198 (void)set_wraith_form(p_ptr->wraith_form - 1, TRUE);
2204 (void)set_hero(p_ptr->hero - 1, TRUE);
2210 (void)set_shero(p_ptr->shero - 1, TRUE);
2216 (void)set_blessed(p_ptr->blessed - 1, TRUE);
2222 (void)set_shield(p_ptr->shield - 1, TRUE);
2226 if (p_ptr->tsubureru)
2228 (void)set_tsubureru(p_ptr->tsubureru - 1, TRUE);
2232 if (p_ptr->magicdef)
2234 (void)set_magicdef(p_ptr->magicdef - 1, TRUE);
2238 if (p_ptr->tsuyoshi)
2240 (void)set_tsuyoshi(p_ptr->tsuyoshi - 1, TRUE);
2244 if (p_ptr->oppose_acid)
2246 (void)set_oppose_acid(p_ptr->oppose_acid - 1, TRUE);
2249 /* Oppose Lightning */
2250 if (p_ptr->oppose_elec)
2252 (void)set_oppose_elec(p_ptr->oppose_elec - 1, TRUE);
2256 if (p_ptr->oppose_fire)
2258 (void)set_oppose_fire(p_ptr->oppose_fire - 1, TRUE);
2262 if (p_ptr->oppose_cold)
2264 (void)set_oppose_cold(p_ptr->oppose_cold - 1, TRUE);
2268 if (p_ptr->oppose_pois)
2270 (void)set_oppose_pois(p_ptr->oppose_pois - 1, TRUE);
2275 (void)set_ultimate_res(p_ptr->ult_res - 1, TRUE);
2278 /*** Poison and Stun and Cut ***/
2281 if (p_ptr->poisoned)
2283 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2285 /* Apply some healing */
2286 (void)set_poisoned(p_ptr->poisoned - adjust);
2292 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2294 /* Apply some healing */
2295 (void)set_stun(p_ptr->stun - adjust);
2301 int adjust = adj_con_fix[p_ptr->stat_ind[A_CON]] + 1;
2303 /* Hack -- Truly "mortal" wound */
2304 if (p_ptr->cut > 1000) adjust = 0;
2306 /* Apply some healing */
2307 (void)set_cut(p_ptr->cut - adjust);
2313 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2314 * / Handle burning fuel every 10 game turns
2317 static void process_world_aux_light(void)
2319 /* Check for light being wielded */
2320 object_type *o_ptr = &inventory[INVEN_LITE];
2322 /* Burn some fuel in the current lite */
2323 if (o_ptr->tval == TV_LITE)
2325 /* Hack -- Use some fuel (except on artifacts) */
2326 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2328 /* Decrease life-span */
2329 if (o_ptr->name2 == EGO_LITE_LONG)
2331 if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2333 else o_ptr->xtra4--;
2335 /* Notice interesting fuel steps */
2336 notice_lite_change(o_ptr);
2343 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2344 * / Handle mutation effects once every 10 game turns
2347 static void process_world_aux_mutation(void)
2349 /* No mutation with effects */
2350 if (!p_ptr->muta2) return;
2352 /* No effect on monster arena */
2353 if (p_ptr->inside_battle) return;
2355 /* No effect on the global map */
2356 if (p_ptr->wild_mode) return;
2359 if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2363 msg_print("ウガァァア!");
2364 msg_print("激怒の発作に襲われた!");
2366 msg_print("RAAAAGHH!");
2367 msg_print("You feel a fit of rage coming over you!");
2370 (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
2371 (void)set_afraid(0);
2374 if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2376 if (!p_ptr->resist_fear)
2380 msg_print("とても暗い... とても恐い!");
2382 msg_print("It's so dark... so scary!");
2385 set_afraid(p_ptr->afraid + 13 + randint1(26));
2389 if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2391 if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
2396 /* Teleport player */
2398 msg_print("あなたの位置は突然ひじょうに不確定になった...");
2400 msg_print("Your position suddenly seems very uncertain...");
2404 teleport_player(40, TELEPORT_PASSIVE);
2408 if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2410 if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
2413 p_ptr->redraw |= PR_EXTRA;
2415 msg_print("いひきがもーろーとひてきたきがふる...ヒック!");
2417 msg_print("You feel a SSSCHtupor cOmINg over yOu... *HIC*!");
2422 if (!p_ptr->resist_conf)
2424 (void)set_confused(p_ptr->confused + randint0(20) + 15);
2427 if (!p_ptr->resist_chaos)
2432 if (one_in_(3)) lose_all_info();
2434 (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2437 msg_print("あなたは見知らぬ場所で目が醒めた...頭が痛い。");
2438 msg_print("何も覚えていない。どうやってここに来たかも分からない!");
2440 msg_print("You wake up somewhere with a sore head...");
2441 msg_print("You can't remember a thing, or how you got here!");
2450 msg_print("き~れいなちょおちょらとんれいる~");
2452 msg_print("Thishcischs GooDSChtuff!");
2455 (void)set_image(p_ptr->image + randint0(150) + 150);
2461 if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2463 if (!p_ptr->resist_chaos)
2466 p_ptr->redraw |= PR_EXTRA;
2467 (void)set_image(p_ptr->image + randint0(50) + 20);
2471 if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2476 msg_print("ブゥーーッ!おっと。");
2478 msg_print("BRRAAAP! Oops.");
2482 fire_ball(GF_POIS, 0, p_ptr->lev, 3);
2485 if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
2486 !p_ptr->anti_magic && one_in_(9000))
2491 msg_print("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!");
2493 msg_print("Magical energy flows through you! You must release it!");
2498 (void)get_hack_dir(&dire);
2499 fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3);
2502 if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
2503 !p_ptr->anti_magic && (randint1(6666) == 666))
2505 bool pet = one_in_(6);
2506 u32b mode = PM_ALLOW_GROUP;
2508 if (pet) mode |= PM_FORCE_PET;
2509 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2511 if (summon_specific((pet ? -1 : 0), py, px,
2512 dun_level, SUMMON_DEMON, mode))
2515 msg_print("あなたはデーモンを引き寄せた!");
2517 msg_print("You have attracted a demon!");
2524 if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2530 msg_print("精力的でなくなった気がする。");
2532 msg_print("You feel less energetic.");
2535 if (p_ptr->fast > 0)
2541 set_slow(randint1(30) + 10, FALSE);
2547 msg_print("精力的になった気がする。");
2549 msg_print("You feel more energetic.");
2552 if (p_ptr->slow > 0)
2558 set_fast(randint1(30) + 10, FALSE);
2563 if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2567 msg_print("突然ほとんど孤独になった気がする。");
2569 msg_print("You suddenly feel almost lonely.");
2572 banish_monsters(100);
2573 if (!dun_level && p_ptr->town_num)
2577 /* Pick a random shop (except home) */
2580 n = randint0(MAX_STORES);
2582 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2585 msg_print("店の主人が丘に向かって走っている!");
2587 msg_print("You see one of the shopkeepers running for the hills!");
2595 if ((p_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2600 msg_print("影につつまれた。");
2602 msg_print("A shadow passes over you.");
2607 /* Absorb light from the current possition */
2608 if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2613 o_ptr = &inventory[INVEN_LITE];
2615 /* Absorb some fuel in the current lite */
2616 if (o_ptr->tval == TV_LITE)
2618 /* Use some fuel (except on artifacts) */
2619 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2621 /* Heal the player a bit */
2622 hp_player(o_ptr->xtra4 / 20);
2624 /* Decrease life-span of lite */
2628 msg_print("光源からエネルギーを吸収した!");
2630 msg_print("You absorb energy from your light!");
2634 /* Notice interesting fuel steps */
2635 notice_lite_change(o_ptr);
2640 * Unlite the area (radius 10) around player and
2641 * do 50 points damage to every affected monster
2643 unlite_area(50, 10);
2646 if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
2647 !p_ptr->anti_magic && one_in_(7000))
2649 bool pet = one_in_(3);
2650 u32b mode = PM_ALLOW_GROUP;
2652 if (pet) mode |= PM_FORCE_PET;
2653 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2655 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
2658 msg_print("動物を引き寄せた!");
2660 msg_print("You have attracted an animal!");
2667 if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
2668 !p_ptr->anti_magic && one_in_(8000))
2672 msg_print("周りの空間が歪んでいる気がする!");
2674 msg_print("You feel the world warping around you!");
2678 fire_ball(GF_CHAOS, 0, p_ptr->lev, 8);
2680 if ((p_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2682 if (!lose_mutation(0))
2684 msg_print("奇妙なくらい普通になった気がする。");
2686 msg_print("You feel oddly normal.");
2690 if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
2694 msg_print("非物質化した!");
2696 msg_print("You feel insubstantial!");
2700 set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
2702 if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2706 if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2708 int which_stat = randint0(6);
2709 int sustained = FALSE;
2714 if (p_ptr->sustain_str) sustained = TRUE;
2717 if (p_ptr->sustain_int) sustained = TRUE;
2720 if (p_ptr->sustain_wis) sustained = TRUE;
2723 if (p_ptr->sustain_dex) sustained = TRUE;
2726 if (p_ptr->sustain_con) sustained = TRUE;
2729 if (p_ptr->sustain_chr) sustained = TRUE;
2733 msg_print("不正な状態!");
2735 msg_print("Invalid stat chosen!");
2745 msg_print("自分が衰弱していくのが分かる!");
2747 msg_print("You can feel yourself wasting away!");
2751 (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
2754 if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
2755 !p_ptr->anti_magic && one_in_(3000))
2757 bool pet = one_in_(5);
2758 u32b mode = PM_ALLOW_GROUP;
2760 if (pet) mode |= PM_FORCE_PET;
2761 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2763 if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
2766 msg_print("ドラゴンを引き寄せた!");
2768 msg_print("You have attracted a dragon!");
2774 if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
2777 if (p_ptr->tim_esp > 0)
2780 msg_print("精神にもやがかかった!");
2782 msg_print("Your mind feels cloudy!");
2785 set_tim_esp(0, TRUE);
2790 msg_print("精神が広がった!");
2792 msg_print("Your mind expands!");
2795 set_tim_esp(p_ptr->lev, FALSE);
2798 if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
2803 msg_print("胃が痙攣し、食事を失った!");
2805 msg_print("Your stomach roils, and you lose your lunch!");
2809 set_food(PY_FOOD_WEAK);
2810 if (music_singing_any()) stop_singing();
2811 if (hex_spelling_any()) stop_hex_spell_all();
2814 if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
2815 !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena)
2820 if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2822 int danger_amount = 0;
2825 for (monster = 0; monster < m_max; monster++)
2827 monster_type *m_ptr = &m_list[monster];
2828 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2830 /* Paranoia -- Skip dead monsters */
2831 if (!m_ptr->r_idx) continue;
2833 if (r_ptr->level >= p_ptr->lev)
2835 danger_amount += r_ptr->level - p_ptr->lev + 1;
2839 if (danger_amount > 100)
2841 msg_print("非常に恐ろしい気がする!");
2843 msg_print("You feel utterly terrified!");
2846 else if (danger_amount > 50)
2848 msg_print("恐ろしい気がする!");
2850 msg_print("You feel terrified!");
2853 else if (danger_amount > 20)
2855 msg_print("非常に心配な気がする!");
2857 msg_print("You feel very worried!");
2860 else if (danger_amount > 10)
2862 msg_print("心配な気がする!");
2864 msg_print("You feel paranoid!");
2867 else if (danger_amount > 5)
2869 msg_print("ほとんど安全な気がする。");
2871 msg_print("You feel almost safe.");
2876 msg_print("寂しい気がする。");
2878 msg_print("You feel lonely.");
2882 if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
2887 msg_print("無敵な気がする!");
2889 msg_print("You feel invincible!");
2893 (void)set_invuln(randint1(8) + 8, FALSE);
2895 if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2897 int wounds = p_ptr->mhp - p_ptr->chp;
2901 int healing = p_ptr->csp;
2903 if (healing > wounds)
2909 p_ptr->csp -= healing;
2912 p_ptr->redraw |= (PR_MANA);
2915 if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
2918 int wounds = p_ptr->msp - p_ptr->csp;
2922 int healing = p_ptr->chp;
2924 if (healing > wounds)
2929 p_ptr->csp += healing;
2932 p_ptr->redraw |= (PR_MANA);
2934 take_hit(DAMAGE_LOSELIFE, healing, "頭に昇った血", -1);
2936 take_hit(DAMAGE_LOSELIFE, healing, "blood rushing to the head", -1);
2941 if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2944 object_type *o_ptr = NULL;
2948 msg_print("足がもつれて転んだ!");
2949 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "転倒", -1);
2951 msg_print("You trip over your own feet!");
2952 take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
2956 if (buki_motteruka(INVEN_RARM))
2959 o_ptr = &inventory[INVEN_RARM];
2961 if (buki_motteruka(INVEN_LARM) && one_in_(2))
2963 o_ptr = &inventory[INVEN_LARM];
2967 else if (buki_motteruka(INVEN_LARM))
2969 o_ptr = &inventory[INVEN_LARM];
2973 if (slot && !object_is_cursed(o_ptr))
2976 msg_print("武器を落としてしまった!");
2978 msg_print("You drop your weapon!");
2980 inven_drop(slot, 1);
2986 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2987 * / Handle curse effects once every 10 game turns
2990 static void process_world_aux_curse(void)
2992 if ((p_ptr->cursed & TRC_P_FLAG_MASK) && !p_ptr->inside_battle && !p_ptr->wild_mode)
2995 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2996 * can actually be useful!
2998 if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
3000 char o_name[MAX_NLEN];
3002 int i, i_keep = 0, count = 0;
3004 /* Scan the equipment with random teleport ability */
3005 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3007 u32b flgs[TR_FLAG_SIZE];
3008 o_ptr = &inventory[i];
3010 /* Skip non-objects */
3011 if (!o_ptr->k_idx) continue;
3013 /* Extract the item flags */
3014 object_flags(o_ptr, flgs);
3016 if (have_flag(flgs, TR_TELEPORT))
3018 /* {.} will stop random teleportation. */
3019 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
3022 if (one_in_(count)) i_keep = i;
3027 o_ptr = &inventory[i_keep];
3028 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3031 msg_format("%sがテレポートの能力を発動させようとしている。", o_name);
3033 msg_format("Your %s is activating teleportation.", o_name);
3037 if (get_check_strict("テレポートしますか?", CHECK_OKAY_CANCEL))
3039 if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
3043 teleport_player(50, 0L);
3048 msg_format("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。", o_name);
3050 msg_format("You can inscribe {.} on your %s to disable random teleportation. ", o_name);
3055 /* Make a chainsword noise */
3056 if ((p_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
3059 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
3061 disturb(FALSE, FALSE);
3064 if ((p_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
3067 (void)activate_ty_curse(FALSE, &count);
3069 /* Handle experience draining */
3070 if (p_ptr->prace != RACE_ANDROID &&
3071 ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
3073 p_ptr->exp -= (p_ptr->lev+1)/2;
3074 if (p_ptr->exp < 0) p_ptr->exp = 0;
3075 p_ptr->max_exp -= (p_ptr->lev+1)/2;
3076 if (p_ptr->max_exp < 0) p_ptr->max_exp = 0;
3079 /* Add light curse (Later) */
3080 if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
3085 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
3087 new_curse = get_curse(0, o_ptr);
3088 if (!(o_ptr->curse_flags & new_curse))
3090 char o_name[MAX_NLEN];
3092 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3094 o_ptr->curse_flags |= new_curse;
3095 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
3097 o_ptr->feeling = FEEL_NONE;
3099 p_ptr->update |= (PU_BONUS);
3102 /* Add heavy curse (Later) */
3103 if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
3108 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
3110 new_curse = get_curse(1, o_ptr);
3111 if (!(o_ptr->curse_flags & new_curse))
3113 char o_name[MAX_NLEN];
3115 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3117 o_ptr->curse_flags |= new_curse;
3118 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
3119 o_ptr->feeling = FEEL_NONE;
3121 p_ptr->update |= (PU_BONUS);
3125 if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
3127 if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
3128 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3130 char o_name[MAX_NLEN];
3132 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3133 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
3138 if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
3140 if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3142 char o_name[MAX_NLEN];
3144 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3145 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
3150 if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
3152 if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
3153 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3155 char o_name[MAX_NLEN];
3157 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3158 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
3163 if ((p_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
3165 if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD,
3166 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
3168 char o_name[MAX_NLEN];
3170 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3171 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
3175 if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
3177 if (!p_ptr->resist_fear)
3180 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
3181 set_afraid(p_ptr->afraid + 13 + randint1(26));
3184 /* Teleport player */
3185 if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
3189 /* Teleport player */
3190 teleport_player(40, TELEPORT_PASSIVE);
3192 /* Handle HP draining */
3193 if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
3195 char o_name[MAX_NLEN];
3197 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3198 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
3199 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
3201 /* Handle mana draining */
3202 if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
3204 char o_name[MAX_NLEN];
3206 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
3207 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
3208 p_ptr->csp -= MIN(p_ptr->lev, 50);
3212 p_ptr->csp_frac = 0;
3214 p_ptr->redraw |= PR_MANA;
3218 /* Rarely, take damage from the Jewel of Judgement */
3219 if (one_in_(999) && !p_ptr->anti_magic)
3221 object_type *o_ptr = &inventory[INVEN_LITE];
3223 if (o_ptr->name1 == ART_JUDGE)
3226 if (object_is_known(o_ptr))
3227 msg_print("『審判の宝石』はあなたの体力を吸収した!");
3229 msg_print("なにかがあなたの体力を吸収した!");
3230 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "審判の宝石", -1);
3232 if (object_is_known(o_ptr))
3233 msg_print("The Jewel of Judgement drains life from you!");
3235 msg_print("Something drains life from you!");
3236 take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1);
3244 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
3245 * / Handle recharging objects once every 10 game turns
3248 static void process_world_aux_recharge(void)
3253 /* Process equipment */
3254 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
3256 /* Get the object */
3257 object_type *o_ptr = &inventory[i];
3259 /* Skip non-objects */
3260 if (!o_ptr->k_idx) continue;
3262 /* Recharge activatable objects */
3263 if (o_ptr->timeout > 0)
3268 /* Notice changes */
3269 if (!o_ptr->timeout)
3271 recharged_notice(o_ptr);
3277 /* Notice changes */
3281 p_ptr->window |= (PW_EQUIP);
3286 * Recharge rods. Rods now use timeout to control charging status,
3287 * and each charging rod in a stack decreases the stack's timeout by
3288 * one per turn. -LM-
3290 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
3292 object_type *o_ptr = &inventory[i];
3293 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3295 /* Skip non-objects */
3296 if (!o_ptr->k_idx) continue;
3298 /* Examine all charging rods or stacks of charging rods. */
3299 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3301 /* Determine how many rods are charging. */
3302 int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
3303 if (temp > o_ptr->number) temp = o_ptr->number;
3305 /* Decrease timeout by that number. */
3306 o_ptr->timeout -= temp;
3308 /* Boundary control. */
3309 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3311 /* Notice changes, provide message if object is inscribed. */
3312 if (!(o_ptr->timeout))
3314 recharged_notice(o_ptr);
3318 /* One of the stack of rod is charged */
3319 else if (o_ptr->timeout % k_ptr->pval)
3326 /* Notice changes */
3330 p_ptr->window |= (PW_INVEN);
3334 /* Process objects on floor */
3335 for (i = 1; i < o_max; i++)
3338 object_type *o_ptr = &o_list[i];
3340 /* Skip dead objects */
3341 if (!o_ptr->k_idx) continue;
3343 /* Recharge rods on the ground. No messages. */
3344 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
3347 o_ptr->timeout -= o_ptr->number;
3349 /* Boundary control. */
3350 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
3357 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
3358 * / Handle involuntary movement once every 10 game turns
3361 static void process_world_aux_movement(void)
3363 /* Delayed Word-of-Recall */
3364 if (p_ptr->word_recall)
3367 * HACK: Autosave BEFORE resetting the recall counter (rr9)
3368 * The player is yanked up/down as soon as
3369 * he loads the autosaved game.
3371 if (autosave_l && (p_ptr->word_recall == 1) && !p_ptr->inside_battle)
3372 do_cmd_save_game(TRUE);
3374 /* Count down towards recall */
3375 p_ptr->word_recall--;
3377 p_ptr->redraw |= (PR_STATUS);
3379 /* Activate the recall */
3380 if (!p_ptr->word_recall)
3385 /* Determine the level */
3386 if (dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
3388 msg_print(_("上に引っ張りあげられる感じがする!",
3389 "You feel yourself yanked upwards!"));
3391 if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
3393 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3398 leave_quest_check();
3399 leave_tower_check();
3401 p_ptr->inside_quest = 0;
3403 p_ptr->leaving = TRUE;
3407 msg_print(_("下に引きずり降ろされる感じがする!",
3408 "You feel yourself yanked downwards!"));
3410 dungeon_type = p_ptr->recall_dungeon;
3413 do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
3416 dun_level = max_dlv[dungeon_type];
3417 if (dun_level < 1) dun_level = 1;
3419 /* Nightmare mode makes recall more dangerous */
3420 if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
3426 else if (dun_level < 99)
3428 dun_level = (dun_level + 99) / 2;
3430 else if (dun_level > 100)
3432 dun_level = d_info[dungeon_type].maxdepth - 1;
3436 if (p_ptr->wild_mode)
3438 p_ptr->wilderness_y = py;
3439 p_ptr->wilderness_x = px;
3443 /* Save player position */
3447 p_ptr->wild_mode = FALSE;
3450 * Clear all saved floors
3451 * and create a first saved floor
3453 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3456 p_ptr->leaving = TRUE;
3458 if (dungeon_type == DUNGEON_ANGBAND)
3462 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3464 quest_type* const q_ptr = &quest[i];
3467 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3468 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3469 (q_ptr->level < dun_level))
3471 q_ptr->status = QUEST_STATUS_FAILED;
3472 q_ptr->complev = (byte)p_ptr->lev;
3474 q_ptr->comptime = playtime;
3475 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3482 sound(SOUND_TPLEVEL);
3487 /* Delayed Alter reality */
3488 if (p_ptr->alter_reality)
3490 if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
3491 do_cmd_save_game(TRUE);
3493 /* Count down towards alter */
3494 p_ptr->alter_reality--;
3496 p_ptr->redraw |= (PR_STATUS);
3498 /* Activate the alter reality */
3499 if (!p_ptr->alter_reality)
3504 /* Determine the level */
3505 if (!quest_number(dun_level) && dun_level)
3508 msg_print("世界が変わった!");
3510 msg_print("The world changes!");
3514 * Clear all saved floors
3515 * and create a first saved floor
3517 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3520 p_ptr->leaving = TRUE;
3525 msg_print("世界が少しの間変化したようだ。");
3527 msg_print("The world seems to change for a moment!");
3532 sound(SOUND_TPLEVEL);
3539 * @brief 指定したモンスターに隣接しているモンスターの数を返す。
3540 * / Count number of adjacent monsters
3541 * @param m_idx 隣接数を調べたいモンスターのID
3542 * @return 隣接しているモンスターの数
3544 static int get_monster_crowd_number(int m_idx)
3546 monster_type *m_ptr = &m_list[m_idx];
3552 for (i = 0; i < 7; i++)
3554 int ay = my + ddy_ddd[i];
3555 int ax = mx + ddx_ddd[i];
3557 if (!in_bounds(ay, ax)) continue;
3559 /* Count number of monsters */
3560 if (cave[ay][ax].m_idx > 0) count++;
3569 * ダンジョンの雰囲気を計算するための非線形基準値 / Dungeon rating is no longer linear
3571 #define RATING_BOOST(delta) (delta * delta + 50 * delta)
3574 * @brief ダンジョンの雰囲気を算出する。
3575 * / Examine all monsters and unidentified objects, and get the feeling of current dungeon floor
3576 * @return 算出されたダンジョンの雰囲気ランク
3578 static byte get_dungeon_feeling(void)
3580 const int base = 10;
3584 /* Hack -- no feeling in the town */
3585 if (!dun_level) return 0;
3587 /* Examine each monster */
3588 for (i = 1; i < m_max; i++)
3590 monster_type *m_ptr = &m_list[i];
3591 monster_race *r_ptr;
3594 /* Skip dead monsters */
3595 if (!m_ptr->r_idx) continue;
3598 if (is_pet(m_ptr)) continue;
3600 r_ptr = &r_info[m_ptr->r_idx];
3602 /* Unique monsters */
3603 if (r_ptr->flags1 & (RF1_UNIQUE))
3605 /* Nearly out-of-depth unique monsters */
3606 if (r_ptr->level + 10 > dun_level)
3608 /* Boost rating by twice delta-depth */
3609 delta += (r_ptr->level + 10 - dun_level) * 2 * base;
3614 /* Out-of-depth monsters */
3615 if (r_ptr->level > dun_level)
3617 /* Boost rating by delta-depth */
3618 delta += (r_ptr->level - dun_level) * base;
3622 /* Unusually crowded monsters get a little bit of rating boost */
3623 if (r_ptr->flags1 & RF1_FRIENDS)
3625 if (5 <= get_monster_crowd_number(i)) delta += 1;
3629 if (2 <= get_monster_crowd_number(i)) delta += 1;
3633 rating += RATING_BOOST(delta);
3636 /* Examine each unidentified object */
3637 for (i = 1; i < o_max; i++)
3639 object_type *o_ptr = &o_list[i];
3640 object_kind *k_ptr = &k_info[o_ptr->k_idx];
3643 /* Skip dead objects */
3644 if (!o_ptr->k_idx) continue;
3646 /* Skip known objects */
3647 if (object_is_known(o_ptr))
3650 if (o_ptr->marked & OM_TOUCHED) continue;
3653 /* Skip pseudo-known objects */
3654 if (o_ptr->ident & IDENT_SENSE) continue;
3657 if (object_is_ego(o_ptr))
3659 ego_item_type *e_ptr = &e_info[o_ptr->name2];
3661 delta += e_ptr->rating * base;
3665 if (object_is_artifact(o_ptr))
3667 s32b cost = object_value_real(o_ptr);
3670 if (cost > 10000L) delta += 10 * base;
3671 if (cost > 50000L) delta += 10 * base;
3672 if (cost > 100000L) delta += 10 * base;
3674 /* Special feeling */
3675 if (!preserve_mode) return 1;
3678 if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
3679 if (o_ptr->tval == TV_SHIELD &&
3680 o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
3681 if (o_ptr->tval == TV_GLOVES &&
3682 o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
3683 if (o_ptr->tval == TV_BOOTS &&
3684 o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
3685 if (o_ptr->tval == TV_HELM &&
3686 o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
3687 if (o_ptr->tval == TV_RING &&
3688 o_ptr->sval == SV_RING_SPEED &&
3689 !object_is_cursed(o_ptr)) delta += 25 * base;
3690 if (o_ptr->tval == TV_RING &&
3691 o_ptr->sval == SV_RING_LORDLY &&
3692 !object_is_cursed(o_ptr)) delta += 15 * base;
3693 if (o_ptr->tval == TV_AMULET &&
3694 o_ptr->sval == SV_AMULET_THE_MAGI &&
3695 !object_is_cursed(o_ptr)) delta += 15 * base;
3697 /* Out-of-depth objects */
3698 if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) &&
3699 k_ptr->level > dun_level)
3701 /* Rating increase */
3702 delta += (k_ptr->level - dun_level) * base;
3705 rating += RATING_BOOST(delta);
3709 if (rating > RATING_BOOST(1000)) return 2;
3710 if (rating > RATING_BOOST(800)) return 3;
3711 if (rating > RATING_BOOST(600)) return 4;
3712 if (rating > RATING_BOOST(400)) return 5;
3713 if (rating > RATING_BOOST(300)) return 6;
3714 if (rating > RATING_BOOST(200)) return 7;
3715 if (rating > RATING_BOOST(100)) return 8;
3716 if (rating > RATING_BOOST(0)) return 9;
3722 * @brief ダンジョンの雰囲気を更新し、変化があった場合メッセージを表示する
3723 * / Update dungeon feeling, and announce it if changed
3726 static void update_dungeon_feeling(void)
3732 /* No feeling on the surface */
3733 if (!dun_level) return;
3735 /* No feeling in the arena */
3736 if (p_ptr->inside_battle) return;
3738 /* Extract delay time */
3739 delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - dun_level) * TURNS_PER_TICK / 100;
3741 /* Not yet felt anything */
3742 if (turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
3744 /* Extract quest number (if any) */
3745 quest_num = quest_number(dun_level);
3747 /* No feeling in a quest */
3749 (is_fixed_quest_idx(quest_num) &&
3750 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
3751 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
3754 /* Get new dungeon feeling */
3755 new_feeling = get_dungeon_feeling();
3757 /* Remember last time updated */
3758 p_ptr->feeling_turn = turn;
3761 if (p_ptr->feeling == new_feeling) return;
3763 /* Dungeon feeling is changed */
3764 p_ptr->feeling = new_feeling;
3766 /* Announce feeling */
3769 select_floor_music();
3771 /* Update the level indicator */
3772 p_ptr->redraw |= (PR_DEPTH);
3775 if (disturb_minor) disturb(0, 0);
3779 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3780 * / Handle certain things once every 10 game turns
3783 static void process_world(void)
3787 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3788 s32b prev_turn_in_today = ((turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3789 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3791 extract_day_hour_min(&day, &hour, &min);
3793 /* Update dungeon feeling, and announce it if changed */
3794 update_dungeon_feeling();
3796 /*** Check monster arena ***/
3797 if (p_ptr->inside_battle && !p_ptr->leaving)
3803 /* Count all hostile monsters */
3804 for (i2 = 0; i2 < cur_wid; ++i2)
3805 for (j2 = 0; j2 < cur_hgt; j2++)
3807 cave_type *c_ptr = &cave[j2][i2];
3809 if ((c_ptr->m_idx > 0) && (c_ptr->m_idx != p_ptr->riding))
3812 win_m_idx = c_ptr->m_idx;
3816 if (number_mon == 0)
3819 msg_print("相打ちに終わりました。");
3821 msg_print("They have kill each other at the same time.");
3824 p_ptr->energy_need = 0;
3827 else if ((number_mon-1) == 0)
3830 monster_type *wm_ptr;
3832 wm_ptr = &m_list[win_m_idx];
3834 monster_desc(m_name, wm_ptr, 0);
3836 msg_format("%sが勝利した!", m_name);
3838 msg_format("%s is winner!", m_name);
3842 if (win_m_idx == (sel_monster+1))
3845 msg_print("おめでとうございます。");
3847 msg_print("Congratulations.");
3850 msg_format("%d$を受け取った。", battle_odds);
3852 msg_format("You received %d gold.", battle_odds);
3854 p_ptr->au += battle_odds;
3859 msg_print("残念でした。");
3861 msg_print("You lost gold.");
3865 p_ptr->energy_need = 0;
3868 else if (turn - old_turn == 150*TURNS_PER_TICK)
3871 msg_print("申し分けありませんが、この勝負は引き分けとさせていただきます。");
3873 msg_format("This battle have ended in a draw.");
3875 p_ptr->au += kakekin;
3877 p_ptr->energy_need = 0;
3882 /* Every 10 game turns */
3883 if (turn % TURNS_PER_TICK) return;
3885 /*** Check the Time and Load ***/
3887 if (!(turn % (50*TURNS_PER_TICK)))
3889 /* Check time and load */
3890 if ((0 != check_time()) || (0 != check_load()))
3893 if (closing_flag <= 2)
3898 /* Count warnings */
3903 msg_print("アングバンドへの門が閉じかかっています...");
3904 msg_print("ゲームを終了するかセーブするかして下さい。");
3906 msg_print("The gates to ANGBAND are closing...");
3907 msg_print("Please finish up and/or save your game.");
3917 msg_print("今、アングバンドへの門が閉ざされました。");
3919 msg_print("The gates to ANGBAND are now closed.");
3924 p_ptr->playing = FALSE;
3927 p_ptr->leaving = TRUE;
3932 /*** Attempt timed autosave ***/
3933 if (autosave_t && autosave_freq && !p_ptr->inside_battle)
3935 if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3936 do_cmd_save_game(TRUE);
3939 if (mon_fight && !ignore_unview)
3942 msg_print("何かが聞こえた。");
3944 msg_print("You hear noise.");
3948 /*** Handle the wilderness/town (sunshine) ***/
3950 /* While in town/wilderness */
3951 if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)
3953 /* Hack -- Daybreak/Nighfall in town */
3954 if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3958 /* Check for dawn */
3959 dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
3968 msg_print("夜が明けた。");
3970 msg_print("The sun has risen.");
3973 if (!p_ptr->wild_mode)
3975 /* Hack -- Scan the town */
3976 for (y = 0; y < cur_hgt; y++)
3978 for (x = 0; x < cur_wid; x++)
3980 /* Get the cave grid */
3981 cave_type *c_ptr = &cave[y][x];
3984 c_ptr->info |= (CAVE_GLOW);
3986 /* Hack -- Memorize lit grids if allowed */
3987 if (view_perma_grids) c_ptr->info |= (CAVE_MARK);
3989 /* Hack -- Notice spot */
4003 msg_print("日が沈んだ。");
4005 msg_print("The sun has fallen.");
4008 if (!p_ptr->wild_mode)
4010 /* Hack -- Scan the town */
4011 for (y = 0; y < cur_hgt; y++)
4013 for (x = 0; x < cur_wid; x++)
4015 /* Get the cave grid */
4016 cave_type *c_ptr = &cave[y][x];
4018 /* Feature code (applying "mimic" field) */
4019 feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)];
4021 if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
4022 !have_flag(f_ptr->flags, FF_ENTRANCE))
4025 c_ptr->info &= ~(CAVE_GLOW);
4027 if (!have_flag(f_ptr->flags, FF_REMEMBER))
4029 /* Forget the normal floor grid */
4030 c_ptr->info &= ~(CAVE_MARK);
4032 /* Hack -- Notice spot */
4038 /* Glow deep lava and building entrances */
4039 glow_deep_lava_and_bldg();
4044 /* Update the monsters */
4045 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
4048 p_ptr->redraw |= (PR_MAP);
4051 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4053 if (p_ptr->special_defense & NINJA_S_STEALTH)
4055 if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
4060 /* While in the dungeon (vanilla_town or lite_town mode only) */
4061 else if ((vanilla_town || (lite_town && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena)) && dun_level)
4063 /*** Shuffle the Storekeepers ***/
4065 /* Chance is only once a day (while in dungeon) */
4066 if (!(turn % (TURNS_PER_TICK * STORE_TICKS)))
4068 /* Sometimes, shuffle the shop-keepers */
4069 if (one_in_(STORE_SHUFFLE))
4073 /* Pick a random shop (except home and museum) */
4076 n = randint0(MAX_STORES);
4078 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
4080 /* Check every feature */
4081 for (i = 1; i < max_f_idx; i++)
4083 /* Access the index */
4084 feature_type *f_ptr = &f_info[i];
4086 /* Skip empty index */
4087 if (!f_ptr->name) continue;
4089 /* Skip non-store features */
4090 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
4092 /* Verify store type */
4093 if (f_ptr->subtype == n)
4097 if (cheat_xtra) msg_format("%sの店主をシャッフルします。", f_name + f_ptr->name);
4099 if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_ptr->name);
4113 /*** Process the monsters ***/
4115 /* Check for creature generation. */
4116 if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
4117 !p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
4119 /* Make a new monster */
4120 (void)alloc_monster(MAX_SIGHT + 5, 0);
4123 /* Hack -- Check for creature regeneration */
4124 if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
4125 if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
4127 if (!p_ptr->leaving)
4131 /* Hack -- Process the counters of monsters if needed */
4132 for (i = 0; i < MAX_MTIMED; i++)
4134 if (mproc_max[i] > 0) process_monsters_mtimed(i);
4142 if (min != prev_min)
4144 do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
4145 determine_today_mon(FALSE);
4150 * Nightmare mode activates the TY_CURSE at midnight
4152 * Require exact minute -- Don't activate multiple times in a minute
4154 if (ironman_nightmare && (min != prev_min))
4156 /* Every 15 minutes after 11:00 pm */
4157 if ((hour == 23) && !(min % 15))
4166 msg_print("遠くで不気味な鐘の音が鳴った。");
4168 msg_print("You hear a distant bell toll ominously.");
4174 msg_print("遠くで鐘が二回鳴った。");
4176 msg_print("A distant bell sounds twice.");
4182 msg_print("遠くで鐘が三回鳴った。");
4184 msg_print("A distant bell sounds three times.");
4190 msg_print("遠くで鐘が四回鳴った。");
4192 msg_print("A distant bell tolls four times.");
4198 /* TY_CURSE activates at midnight! */
4205 msg_print("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。");
4207 msg_print("A distant bell tolls many times, fading into an deathly silence.");
4210 activate_ty_curse(FALSE, &count);
4215 /*** Check the Food, and Regenerate ***/
4217 if (!p_ptr->inside_battle)
4219 /* Digest quickly when gorged */
4220 if (p_ptr->food >= PY_FOOD_MAX)
4222 /* Digest a lot of food */
4223 (void)set_food(p_ptr->food - 100);
4226 /* Digest normally -- Every 50 game turns */
4227 else if (!(turn % (TURNS_PER_TICK*5)))
4229 /* Basic digestion rate based on speed */
4230 int digestion = SPEED_TO_ENERGY(p_ptr->pspeed);
4232 /* Regeneration takes more food */
4233 if (p_ptr->regenerate)
4235 if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
4237 if (p_ptr->cursed & TRC_FAST_DIGEST)
4240 /* Slow digestion takes less food */
4241 if (p_ptr->slow_digest)
4244 /* Minimal digestion */
4245 if (digestion < 1) digestion = 1;
4246 /* Maximal digestion */
4247 if (digestion > 100) digestion = 100;
4249 /* Digest some food */
4250 (void)set_food(p_ptr->food - digestion);
4255 if ((p_ptr->food < PY_FOOD_FAINT))
4257 /* Faint occasionally */
4258 if (!p_ptr->paralyzed && (randint0(100) < 10))
4262 msg_print("あまりにも空腹で気絶してしまった。");
4264 msg_print("You faint from the lack of food.");
4269 /* Hack -- faint (bypass free action) */
4270 (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
4273 /* Starve to death (slowly) */
4274 if (p_ptr->food < PY_FOOD_STARVE)
4276 /* Calculate damage */
4277 int dam = (PY_FOOD_STARVE - p_ptr->food) / 10;
4281 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "空腹", -1);
4283 if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, "starvation", -1);
4291 /* Process timed damage and regeneration */
4292 process_world_aux_hp_and_sp();
4294 /* Process timeout */
4295 process_world_aux_timeout();
4298 process_world_aux_light();
4300 /* Process mutation effects */
4301 process_world_aux_mutation();
4303 /* Process curse effects */
4304 process_world_aux_curse();
4306 /* Process recharging */
4307 process_world_aux_recharge();
4309 /* Feel the inventory */
4313 /* Involuntary Movement */
4314 process_world_aux_movement();
4318 * @brief ウィザードモードへの導入処理
4319 * / Verify use of "wizard" mode
4320 * @return 実際にウィザードモードへ移行したらTRUEを返す。
4322 static bool enter_wizard_mode(void)
4324 /* Ask first time */
4325 if (!p_ptr->noscore)
4327 /* Wizard mode is not permitted */
4328 if (!allow_debug_opts || arg_wizard)
4331 msg_print("ウィザードモードは許可されていません。 ");
4333 msg_print("Wizard mode is not permitted.");
4338 /* Mention effects */
4340 msg_print("ウィザードモードはデバッグと実験のためのモードです。 ");
4341 msg_print("一度ウィザードモードに入るとスコアは記録されません。");
4343 msg_print("Wizard mode is for debugging and experimenting.");
4344 msg_print("The game will not be scored if you enter wizard mode.");
4349 /* Verify request */
4351 if (!get_check("本当にウィザードモードに入りたいのですか? "))
4353 if (!get_check("Are you sure you want to enter wizard mode? "))
4360 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ウィザードモードに突入してスコアを残せなくなった。");
4362 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to enter wizard mode.");
4365 p_ptr->noscore |= 0x0002;
4376 * @brief デバッグコマンドへの導入処理
4377 * / Verify use of "debug" commands
4378 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
4380 static bool enter_debug_mode(void)
4382 /* Ask first time */
4383 if (!p_ptr->noscore)
4385 /* Debug mode is not permitted */
4386 if (!allow_debug_opts)
4389 msg_print("デバッグコマンドは許可されていません。 ");
4391 msg_print("Use of debug command is not permitted.");
4396 /* Mention effects */
4398 msg_print("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ");
4399 msg_print("デバッグ・コマンドを使うとスコアは記録されません。");
4401 msg_print("The debug commands are for debugging and experimenting.");
4402 msg_print("The game will not be scored if you use debug commands.");
4407 /* Verify request */
4409 if (!get_check("本当にデバッグ・コマンドを使いますか? "))
4411 if (!get_check("Are you sure you want to use debug commands? "))
4418 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "デバッグモードに突入してスコアを残せなくなった。");
4420 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
4423 p_ptr->noscore |= 0x0008;
4431 * Hack -- Declare the Debug Routines
4433 extern void do_cmd_debug(void);
4435 #endif /* ALLOW_WIZARD */
4441 * @brief ボーグコマンドへの導入処理
4442 * / Verify use of "borg" commands
4443 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
4445 static bool enter_borg_mode(void)
4447 /* Ask first time */
4448 if (!(p_ptr->noscore & 0x0010))
4450 /* Mention effects */
4452 msg_print("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ");
4453 msg_print("ボーグ・コマンドを使うとスコアは記録されません。");
4455 msg_print("The borg commands are for debugging and experimenting.");
4456 msg_print("The game will not be scored if you use borg commands.");
4461 /* Verify request */
4463 if (!get_check("本当にボーグ・コマンドを使いますか? "))
4465 if (!get_check("Are you sure you want to use borg commands? "))
4472 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "ボーグ・コマンドを使用してスコアを残せなくなった。");
4474 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up recording score to use borg commands.");
4477 p_ptr->noscore |= 0x0010;
4485 * Hack -- Declare the Ben Borg
4487 extern void do_cmd_borg(void);
4489 #endif /* ALLOW_BORG */
4493 * @brief プレイヤーから受けた入力コマンドの分岐処理。
4494 * / Parse and execute the current command Give "Warning" on illegal commands.
4495 * @todo XXX XXX XXX Make some "blocks"
4498 static void process_command(void)
4500 int old_now_message = now_message;
4502 #ifdef ALLOW_REPEAT /* TNB */
4504 /* Handle repeating the last command */
4507 #endif /* ALLOW_REPEAT -- TNB */
4512 if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
4513 reset_concent = TRUE;
4515 /* Parse the command */
4516 switch (command_cmd)
4532 /*** Wizard Commands ***/
4534 /* Toggle Wizard Mode */
4539 p_ptr->wizard = FALSE;
4541 msg_print("ウィザードモード解除。");
4543 msg_print("Wizard mode off.");
4547 else if (enter_wizard_mode())
4549 p_ptr->wizard = TRUE;
4551 msg_print("ウィザードモード突入。");
4553 msg_print("Wizard mode on.");
4558 /* Update monsters */
4559 p_ptr->update |= (PU_MONSTERS);
4561 /* Redraw "title" */
4562 p_ptr->redraw |= (PR_TITLE);
4570 /* Special "debug" commands */
4573 /* Enter debug mode */
4574 if (enter_debug_mode())
4581 #endif /* ALLOW_WIZARD */
4586 /* Special "borg" commands */
4589 /* Enter borg mode */
4590 if (enter_borg_mode())
4592 if (!p_ptr->wild_mode) do_cmd_borg();
4598 #endif /* ALLOW_BORG */
4602 /*** Inventory Commands ***/
4604 /* Wear/wield equipment */
4607 if (!p_ptr->wild_mode) do_cmd_wield();
4611 /* Take off equipment */
4614 if (!p_ptr->wild_mode) do_cmd_takeoff();
4621 if (!p_ptr->wild_mode) do_cmd_drop();
4625 /* Destroy an item */
4632 /* Equipment list */
4639 /* Inventory list */
4647 /*** Various commands ***/
4649 /* Identify an object */
4656 /* Hack -- toggle windows */
4659 toggle_inven_equip();
4664 /*** Standard "Movement" Commands ***/
4669 if (!p_ptr->wild_mode) do_cmd_alter();
4676 if (!p_ptr->wild_mode) do_cmd_tunnel();
4680 /* Move (usually pick up things) */
4683 #ifdef ALLOW_EASY_DISARM /* TNB */
4687 #else /* ALLOW_EASY_DISARM -- TNB */
4689 do_cmd_walk(always_pickup);
4691 #endif /* ALLOW_EASY_DISARM -- TNB */
4696 /* Move (usually do not pick up) */
4699 #ifdef ALLOW_EASY_DISARM /* TNB */
4703 #else /* ALLOW_EASY_DISARM -- TNB */
4705 do_cmd_walk(!always_pickup);
4707 #endif /* ALLOW_EASY_DISARM -- TNB */
4713 /*** Running, Resting, Searching, Staying */
4715 /* Begin Running -- Arg is Max Distance */
4718 if (!p_ptr->wild_mode) do_cmd_run();
4722 /* Stay still (usually pick things up) */
4725 do_cmd_stay(always_pickup);
4729 /* Stay still (usually do not pick up) */
4732 do_cmd_stay(!always_pickup);
4736 /* Rest -- Arg is time */
4743 /* Search for traps/doors */
4750 /* Toggle search mode */
4753 if (p_ptr->action == ACTION_SEARCH) set_action(ACTION_NONE);
4754 else set_action(ACTION_SEARCH);
4759 /*** Stairs and Doors and Chests and Traps ***/
4762 case SPECIAL_KEY_STORE:
4764 if (!p_ptr->wild_mode) do_cmd_store();
4768 /* Enter building -KMW- */
4769 case SPECIAL_KEY_BUILDING:
4771 if (!p_ptr->wild_mode) do_cmd_bldg();
4775 /* Enter quest level -KMW- */
4776 case SPECIAL_KEY_QUEST:
4778 if (!p_ptr->wild_mode) do_cmd_quest();
4782 /* Go up staircase */
4785 if (!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
4787 if (vanilla_town) break;
4792 msg_print("襲撃から逃げるにはマップの端まで移動しなければならない。");
4794 msg_print("To flee the ambush you have to reach the edge of the map.");
4799 if (p_ptr->food < PY_FOOD_WEAK)
4802 msg_print("その前に食事をとらないと。");
4804 msg_print("You must eat something here.");
4816 /* Go down staircase */
4819 if (p_ptr->wild_mode)
4827 /* Open a door or chest */
4830 if (!p_ptr->wild_mode) do_cmd_open();
4837 if (!p_ptr->wild_mode) do_cmd_close();
4841 /* Jam a door with spikes */
4844 if (!p_ptr->wild_mode) do_cmd_spike();
4851 if (!p_ptr->wild_mode) do_cmd_bash();
4855 /* Disarm a trap or chest */
4858 if (!p_ptr->wild_mode) do_cmd_disarm();
4863 /*** Magic and Prayers ***/
4865 /* Gain new spells/prayers */
4868 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
4870 msg_print("呪文を学習する必要はない!");
4872 msg_print("You don't have to learn spells!");
4874 else if (p_ptr->pclass == CLASS_SAMURAI)
4875 do_cmd_gain_hissatsu();
4876 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4886 if ( (p_ptr->pclass == CLASS_MINDCRAFTER) ||
4887 (p_ptr->pclass == CLASS_BERSERKER) ||
4888 (p_ptr->pclass == CLASS_NINJA) ||
4889 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4890 ) do_cmd_mind_browse();
4891 else if (p_ptr->pclass == CLASS_SMITH)
4893 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4894 do_cmd_magic_eater(TRUE, FALSE);
4895 else if (p_ptr->pclass == CLASS_SNIPER)
4896 do_cmd_snipe_browse();
4897 else do_cmd_browse();
4905 if (!p_ptr->wild_mode)
4907 if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_ARCHER) || (p_ptr->pclass == CLASS_CAVALRY))
4910 msg_print("呪文を唱えられない!");
4912 msg_print("You cannot cast spells!");
4915 else if (dun_level && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4918 msg_print("ダンジョンが魔法を吸収した!");
4920 msg_print("The dungeon absorbs all attempted magic!");
4924 else if (p_ptr->anti_magic && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH))
4928 cptr which_power = "魔法";
4930 cptr which_power = "magic";
4932 if (p_ptr->pclass == CLASS_MINDCRAFTER)
4934 which_power = "超能力";
4936 which_power = "psionic powers";
4938 else if (p_ptr->pclass == CLASS_IMITATOR)
4940 which_power = "ものまね";
4942 which_power = "imitation";
4944 else if (p_ptr->pclass == CLASS_SAMURAI)
4946 which_power = "必殺剣";
4948 which_power = "hissatsu";
4950 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
4952 which_power = "鏡魔法";
4954 which_power = "mirror magic";
4956 else if (p_ptr->pclass == CLASS_NINJA)
4960 which_power = "ninjutsu";
4962 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
4966 which_power = "prayer";
4970 msg_format("反魔法バリアが%sを邪魔した!", which_power);
4972 msg_format("An anti-magic shell disrupts your %s!", which_power);
4976 else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER))
4979 msg_format("狂戦士化していて頭が回らない!");
4981 msg_format("You cannot think directly!");
4987 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
4988 (p_ptr->pclass == CLASS_BERSERKER) ||
4989 (p_ptr->pclass == CLASS_NINJA) ||
4990 (p_ptr->pclass == CLASS_MIRROR_MASTER)
4993 else if (p_ptr->pclass == CLASS_IMITATOR)
4995 else if (p_ptr->pclass == CLASS_MAGIC_EATER)
4996 do_cmd_magic_eater(FALSE, FALSE);
4997 else if (p_ptr->pclass == CLASS_SAMURAI)
4999 else if (p_ptr->pclass == CLASS_BLUE_MAGE)
5000 do_cmd_cast_learned();
5001 else if (p_ptr->pclass == CLASS_SMITH)
5003 else if (p_ptr->pclass == CLASS_SNIPER)
5012 /* Issue a pet command */
5015 if (!p_ptr->wild_mode) do_cmd_pet();
5019 /*** Use various objects ***/
5021 /* Inscribe an object */
5028 /* Uninscribe an object */
5031 do_cmd_uninscribe();
5035 /* Activate an artifact */
5038 if (!p_ptr->wild_mode)
5040 if (!p_ptr->inside_arena)
5045 msg_print("アリーナが魔法を吸収した!");
5047 msg_print("The arena absorbs all attempted magic!");
5063 /* Fuel your lantern/torch */
5073 if (!p_ptr->wild_mode) do_cmd_fire();
5080 if (!p_ptr->wild_mode)
5090 if (!p_ptr->wild_mode)
5092 if (!p_ptr->inside_arena)
5097 msg_print("アリーナが魔法を吸収した!");
5099 msg_print("The arena absorbs all attempted magic!");
5111 if (!p_ptr->wild_mode)
5113 if (p_ptr->inside_arena)
5116 msg_print("アリーナが魔法を吸収した!");
5118 msg_print("The arena absorbs all attempted magic!");
5123 else if (use_command && rogue_like_commands)
5135 /* Quaff a potion */
5138 if (!p_ptr->wild_mode)
5140 if (!p_ptr->inside_arena)
5141 do_cmd_quaff_potion();
5145 msg_print("アリーナが魔法を吸収した!");
5147 msg_print("The arena absorbs all attempted magic!");
5159 if (!p_ptr->wild_mode)
5161 if (!p_ptr->inside_arena)
5162 do_cmd_read_scroll();
5166 msg_print("アリーナが魔法を吸収した!");
5168 msg_print("The arena absorbs all attempted magic!");
5180 if (!p_ptr->wild_mode)
5182 if (p_ptr->inside_arena)
5185 msg_print("アリーナが魔法を吸収した!");
5187 msg_print("The arena absorbs all attempted magic!");
5192 else if (use_command && !rogue_like_commands)
5202 /* Use racial power */
5205 if (!p_ptr->wild_mode) do_cmd_racial_power();
5210 /*** Looking at Things (nearby or on map) ***/
5212 /* Full dungeon map */
5219 /* Locate player on map */
5233 /* Target monster or location */
5236 if (!p_ptr->wild_mode) do_cmd_target();
5242 /*** Help and Such ***/
5251 /* Identify symbol */
5254 do_cmd_query_symbol();
5258 /* Character description */
5261 do_cmd_change_name();
5266 /*** System Commands ***/
5268 /* Hack -- User interface */
5275 /* Single line from a pref file */
5284 do_cmd_reload_autopick();
5290 do_cmd_edit_autopick();
5294 /* Interact with macros */
5301 /* Interact with visuals */
5309 /* Interact with colors */
5317 /* Interact with options */
5321 (void)combine_and_reorder_home(STORE_HOME);
5326 /*** Misc Commands ***/
5342 /* Repeat level feeling */
5345 if (!p_ptr->wild_mode) do_cmd_feeling();
5349 /* Show previous message */
5352 do_cmd_message_one();
5356 /* Show previous messages */
5359 do_cmd_messages(old_now_message);
5363 /* Show quest status -KMW- */
5366 do_cmd_checkquest();
5370 /* Redraw the screen */
5373 now_message = old_now_message;
5378 #ifndef VERIFY_SAVEFILE
5380 /* Hack -- Save and don't quit */
5383 do_cmd_save_game(FALSE);
5387 #endif /* VERIFY_SAVEFILE */
5397 case SPECIAL_KEY_QUIT:
5399 do_cmd_save_and_exit();
5403 /* Quit (commit suicide) */
5416 /* Check artifacts, uniques, objects */
5423 /* Load "screen dump" */
5426 do_cmd_load_screen();
5430 /* Save "screen dump" */
5433 do_cmd_save_screen();
5437 /* Record/stop "Movie" */
5440 prepare_movie_hooks();
5444 /* Make random artifact list */
5447 spoil_random_artifact("randifact.txt");
5454 if (!p_ptr->wild_mode) do_cmd_travel();
5455 if (p_ptr->special_defense & KATA_MUSOU)
5457 set_action(ACTION_NONE);
5463 /* Hack -- Unknown command */
5466 if (flush_failure) flush();
5470 sound(SOUND_ILLEGAL);
5472 if (!get_rnd_line("error_j.txt", 0, error_m))
5474 if (!get_rnd_line("error.txt", 0, error_m))
5481 prt(" '?' でヘルプが表示されます。", 0, 0);
5483 prt("Type '?' for help.", 0, 0);
5489 if (!energy_use && !now_message)
5490 now_message = old_now_message;
5494 * @brief モンスター種族が釣れる種族かどうかを判定する。
5495 * @param r_idx 判定したいモンスター種族のID
5496 * @return 釣れる対象ならばTRUEを返す
5498 static bool monster_tsuri(int r_idx)
5500 monster_race *r_ptr = &r_info[r_idx];
5502 if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
5510 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
5513 static void pack_overflow(void)
5515 if (inventory[INVEN_PACK].k_idx)
5517 char o_name[MAX_NLEN];
5520 /* Is auto-destroy done? */
5522 if (!inventory[INVEN_PACK].k_idx) return;
5524 /* Access the slot to be dropped */
5525 o_ptr = &inventory[INVEN_PACK];
5532 msg_print("ザックからアイテムがあふれた!");
5534 msg_print("Your pack overflows!");
5538 object_desc(o_name, o_ptr, 0);
5542 msg_format("%s(%c)を落とした。", o_name, index_to_label(INVEN_PACK));
5544 msg_format("You drop %s (%c).", o_name, index_to_label(INVEN_PACK));
5547 /* Drop it (carefully) near the player */
5548 (void)drop_near(o_ptr, 0, py, px);
5550 /* Modify, Describe, Optimize */
5551 inven_item_increase(INVEN_PACK, -255);
5552 inven_item_describe(INVEN_PACK);
5553 inven_item_optimize(INVEN_PACK);
5555 /* Handle "p_ptr->notice" */
5558 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5564 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
5567 static void process_upkeep_with_speed(void)
5569 /* Give the player some energy */
5570 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
5572 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5576 if (p_ptr->enchant_energy_need > 0) return;
5578 while (p_ptr->enchant_energy_need <= 0)
5580 /* Handle the player song */
5581 if (!load) check_music();
5583 /* Hex - Handle the hex spells */
5584 if (!load) check_hex();
5585 if (!load) revenge_spell();
5587 /* There is some randomness of needed energy */
5588 p_ptr->enchant_energy_need += ENERGY_NEED();
5593 * @brief プレイヤーの行動処理 / Process the player
5596 * Notice the annoying code to handle "pack overflow", which\n
5597 * must come first just in case somebody manages to corrupt\n
5598 * the savefiles by clever use of menu commands or something.\n
5600 static void process_player(void)
5604 /*** Apply energy ***/
5609 msg_print("何か変わった気がする!");
5611 msg_print("You feel different!");
5614 (void)gain_random_mutation(0);
5615 hack_mutation = FALSE;
5618 if (p_ptr->inside_battle)
5620 for(i = 1; i < m_max; i++)
5622 monster_type *m_ptr = &m_list[i];
5624 if (!m_ptr->r_idx) continue;
5626 /* Hack -- Detect monster */
5627 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
5629 /* Update the monster */
5630 update_mon(i, FALSE);
5635 /* Give the player some energy */
5636 else if (!(load && p_ptr->energy_need <= 0))
5638 p_ptr->energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
5642 if (p_ptr->energy_need > 0) return;
5643 if (!command_rep) prt_time();
5645 /*** Check for interupts ***/
5647 /* Complete resting */
5654 if ((p_ptr->chp == p_ptr->mhp) &&
5655 (p_ptr->csp >= p_ptr->msp))
5657 set_action(ACTION_NONE);
5661 /* Complete resting */
5662 else if (resting == -2)
5665 if ((p_ptr->chp == p_ptr->mhp) &&
5666 (p_ptr->csp >= p_ptr->msp) &&
5667 !p_ptr->blind && !p_ptr->confused &&
5668 !p_ptr->poisoned && !p_ptr->afraid &&
5669 !p_ptr->stun && !p_ptr->cut &&
5670 !p_ptr->slow && !p_ptr->paralyzed &&
5671 !p_ptr->image && !p_ptr->word_recall &&
5672 !p_ptr->alter_reality)
5674 set_action(ACTION_NONE);
5679 if (p_ptr->action == ACTION_FISH)
5682 Term_xtra(TERM_XTRA_DELAY, 10);
5686 bool success = FALSE;
5687 get_mon_num_prep(monster_tsuri,NULL);
5688 r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
5690 if (r_idx && one_in_(2))
5693 y = py+ddy[tsuri_dir];
5694 x = px+ddx[tsuri_dir];
5695 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
5698 monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
5700 msg_format("%sが釣れた!", m_name);
5702 msg_format("You have a good catch!", m_name);
5710 msg_print("餌だけ食われてしまった!くっそ~!");
5712 msg_print("Damn! The fish stole your bait!");
5719 /* Handle "abort" */
5722 /* Check for "player abort" (semi-efficiently for resting) */
5723 if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
5728 /* Check for a key */
5737 /* Hack -- Show a Message */
5739 msg_print("中断しました。");
5741 msg_print("Canceled.");
5748 if (p_ptr->riding && !p_ptr->confused && !p_ptr->blind)
5750 monster_type *m_ptr = &m_list[p_ptr->riding];
5751 monster_race *r_ptr = &r_info[m_ptr->r_idx];
5753 if (MON_CSLEEP(m_ptr))
5758 (void)set_monster_csleep(p_ptr->riding, 0);
5760 /* Acquire the monster name */
5761 monster_desc(m_name, m_ptr, 0);
5763 msg_format("%^sを起こした。", m_name);
5765 msg_format("You have waked %s up.", m_name);
5769 if (MON_STUNNED(m_ptr))
5771 /* Hack -- Recover from stun */
5772 if (set_monster_stunned(p_ptr->riding,
5773 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
5777 /* Acquire the monster name */
5778 monster_desc(m_name, m_ptr, 0);
5780 /* Dump a message */
5782 msg_format("%^sを朦朧状態から立ち直らせた。", m_name);
5784 msg_format("%^s is no longer stunned.", m_name);
5789 if (MON_CONFUSED(m_ptr))
5791 /* Hack -- Recover from confusion */
5792 if (set_monster_confused(p_ptr->riding,
5793 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
5797 /* Acquire the monster name */
5798 monster_desc(m_name, m_ptr, 0);
5800 /* Dump a message */
5802 msg_format("%^sを混乱状態から立ち直らせた。", m_name);
5804 msg_format("%^s is no longer confused.", m_name);
5809 if (MON_MONFEAR(m_ptr))
5811 /* Hack -- Recover from fear */
5812 if (set_monster_monfear(p_ptr->riding,
5813 (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
5817 /* Acquire the monster name */
5818 monster_desc(m_name, m_ptr, 0);
5820 /* Dump a message */
5822 msg_format("%^sを恐怖から立ち直らせた。", m_name);
5824 msg_format("%^s is no longer fear.", m_name);
5829 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5836 if (p_ptr->lightspeed)
5838 (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE);
5840 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0]))
5842 if (p_ptr->magic_num1[0] < 40)
5844 p_ptr->magic_num1[0] = 0;
5846 else p_ptr->magic_num1[0] -= 40;
5847 p_ptr->update |= (PU_BONUS);
5849 if (p_ptr->action == ACTION_LEARN)
5852 u32b cost_frac = (p_ptr->msp + 30L) * 256L;
5854 /* Convert the unit (1/2^16) to (1/2^32) */
5855 s64b_LSHIFT(cost, cost_frac, 16);
5858 if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0)
5862 p_ptr->csp_frac = 0;
5863 set_action(ACTION_NONE);
5868 s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), cost, cost_frac);
5870 p_ptr->redraw |= PR_MANA;
5873 if (p_ptr->special_defense & KATA_MASK)
5875 if (p_ptr->special_defense & KATA_MUSOU)
5879 set_action(ACTION_NONE);
5884 p_ptr->redraw |= (PR_MANA);
5889 /*** Handle actual user input ***/
5891 /* Repeat until out of energy */
5892 while (p_ptr->energy_need <= 0)
5894 p_ptr->window |= PW_PLAYER;
5895 p_ptr->sutemi = FALSE;
5896 p_ptr->counter = FALSE;
5897 now_damaged = FALSE;
5899 /* Handle "p_ptr->notice" */
5902 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
5905 /* Place the cursor on the player */
5906 move_cursor_relative(py, px);
5908 /* Refresh (optional) */
5909 if (fresh_before) Term_fresh();
5912 /* Hack -- Pack Overflow */
5916 /* Hack -- cancel "lurking browse mode" */
5917 if (!command_new) command_see = FALSE;
5920 /* Assume free turn */
5924 if (p_ptr->inside_battle)
5926 /* Place the cursor on the player */
5927 move_cursor_relative(py, px);
5929 command_cmd = SPECIAL_KEY_BUILDING;
5931 /* Process the command */
5935 /* Paralyzed or Knocked Out */
5936 else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
5943 else if (p_ptr->action == ACTION_REST)
5948 /* Reduce rest count */
5951 if (!resting) set_action(ACTION_NONE);
5953 /* Redraw the state */
5954 p_ptr->redraw |= (PR_STATE);
5962 else if (p_ptr->action == ACTION_FISH)
5977 else if (travel.run)
5984 /* Repeated command */
5985 else if (command_rep)
5987 /* Count this execution */
5990 /* Redraw the state */
5991 p_ptr->redraw |= (PR_STATE);
5996 /* Hack -- Assume messages were seen */
5999 /* Clear the top line */
6002 /* Process the command */
6006 /* Normal command */
6009 /* Place the cursor on the player */
6010 move_cursor_relative(py, px);
6013 /* Get a command (normal) */
6014 request_command(FALSE);
6017 /* Process the command */
6022 /* Hack -- Pack Overflow */
6031 /* Use some energy */
6032 if (world_player || energy_use > 400)
6034 /* The Randomness is irrelevant */
6035 p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
6039 /* There is some randomness of needed energy */
6040 p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
6043 /* Hack -- constant hallucination */
6044 if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
6047 /* Shimmer monsters if needed */
6048 if (shimmer_monsters)
6050 /* Clear the flag */
6051 shimmer_monsters = FALSE;
6053 /* Shimmer multi-hued monsters */
6054 for (i = 1; i < m_max; i++)
6056 monster_type *m_ptr;
6057 monster_race *r_ptr;
6059 /* Access monster */
6062 /* Skip dead monsters */
6063 if (!m_ptr->r_idx) continue;
6065 /* Skip unseen monsters */
6066 if (!m_ptr->ml) continue;
6068 /* Access the monster race */
6069 r_ptr = &r_info[m_ptr->ap_r_idx];
6071 /* Skip non-multi-hued monsters */
6072 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
6075 /* Reset the flag */
6076 shimmer_monsters = TRUE;
6078 /* Redraw regardless */
6079 lite_spot(m_ptr->fy, m_ptr->fx);
6084 /* Handle monster detection */
6085 if (repair_monsters)
6087 /* Reset the flag */
6088 repair_monsters = FALSE;
6090 /* Rotate detection flags */
6091 for (i = 1; i < m_max; i++)
6093 monster_type *m_ptr;
6095 /* Access monster */
6098 /* Skip dead monsters */
6099 if (!m_ptr->r_idx) continue;
6101 /* Nice monsters get mean */
6102 if (m_ptr->mflag & MFLAG_NICE)
6104 /* Nice monsters get mean */
6105 m_ptr->mflag &= ~(MFLAG_NICE);
6108 /* Handle memorized monsters */
6109 if (m_ptr->mflag2 & MFLAG2_MARK)
6111 /* Maintain detection */
6112 if (m_ptr->mflag2 & MFLAG2_SHOW)
6115 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
6117 /* Still need repairs */
6118 repair_monsters = TRUE;
6121 /* Remove detection */
6125 m_ptr->mflag2 &= ~(MFLAG2_MARK);
6127 /* Assume invisible */
6130 /* Update the monster */
6131 update_mon(i, FALSE);
6133 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
6134 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
6136 /* Redraw regardless */
6137 lite_spot(m_ptr->fy, m_ptr->fx);
6142 if (p_ptr->pclass == CLASS_IMITATOR)
6144 if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
6147 for (i = 0; i < p_ptr->mane_num; i++)
6149 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
6150 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
6154 p_ptr->redraw |= (PR_IMITATION);
6156 if (p_ptr->action == ACTION_LEARN)
6159 p_ptr->redraw |= (PR_STATE);
6162 if (world_player && (p_ptr->energy_need > - 1000))
6165 p_ptr->redraw |= (PR_MAP);
6167 /* Update monsters */
6168 p_ptr->update |= (PU_MONSTERS);
6171 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6174 msg_print("「時は動きだす…」");
6176 msg_print("You feel time flowing around you once more.");
6179 world_player = FALSE;
6180 p_ptr->energy_need = ENERGY_NEED();
6182 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6187 /* Hack -- notice death */
6188 if (!p_ptr->playing || p_ptr->is_dead)
6190 world_player = FALSE;
6195 if (energy_use && reset_concent) reset_concentration(TRUE);
6197 /* Handle "leaving" */
6198 if (p_ptr->leaving) break;
6201 /* Update scent trail */
6206 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
6209 * This function will not exit until the level is completed,\n
6210 * the user dies, or the game is terminated.\n
6212 static void dungeon(bool load_game)
6216 /* Set the base level */
6217 base_level = dun_level;
6219 /* Reset various flags */
6223 p_ptr->leaving = FALSE;
6225 /* Reset the "command" vars */
6228 #if 0 /* Don't reset here --- It's used for Arena */
6237 /* Cancel the target */
6241 ambush_flag = FALSE;
6243 /* Cancel the health bar */
6246 /* Check visual effects */
6247 shimmer_monsters = TRUE;
6248 shimmer_objects = TRUE;
6249 repair_monsters = TRUE;
6250 repair_objects = TRUE;
6256 /* Get index of current quest (if any) */
6257 quest_num = quest_number(dun_level);
6259 /* Inside a quest? */
6262 /* Mark the quest monster */
6263 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
6266 /* Track maximum player level */
6267 if (p_ptr->max_plv < p_ptr->lev)
6269 p_ptr->max_plv = p_ptr->lev;
6273 /* Track maximum dungeon level (if not in quest -KMW-) */
6274 if ((max_dlv[dungeon_type] < dun_level) && !p_ptr->inside_quest)
6276 max_dlv[dungeon_type] = dun_level;
6277 if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
6280 (void)calculate_upkeep();
6282 /* Validate the panel */
6283 panel_bounds_center();
6285 /* Verify the panel */
6288 /* Flush messages */
6292 /* Enter "xtra" mode */
6293 character_xtra = TRUE;
6296 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
6298 /* Redraw dungeon */
6299 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
6302 p_ptr->redraw |= (PR_MAP);
6305 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6307 /* Update lite/view */
6308 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
6310 /* Update monsters */
6311 p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
6313 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6316 /* Leave "xtra" mode */
6317 character_xtra = FALSE;
6320 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6322 /* Combine / Reorder the pack */
6323 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
6325 /* Handle "p_ptr->notice" */
6328 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6334 if (quest_num && (is_fixed_quest_idx(quest_num) &&
6335 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
6336 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling();
6338 if (p_ptr->inside_battle)
6342 p_ptr->energy_need = 0;
6350 msg_format("Ready..Fight!");
6356 if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT))
6357 p_ptr->magic_num1[0] = MUSIC_DETECT;
6359 /* Hack -- notice death or departure */
6360 if (!p_ptr->playing || p_ptr->is_dead) return;
6362 /* Print quest message if appropriate */
6363 if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
6365 quest_discovery(random_quest_number(dun_level));
6366 p_ptr->inside_quest = random_quest_number(dun_level);
6368 if ((dun_level == d_info[dungeon_type].maxdepth) && d_info[dungeon_type].final_guardian)
6370 if (r_info[d_info[dungeon_type].final_guardian].max_num)
6372 msg_format("この階には%sの主である%sが棲んでいる。",
6373 d_name+d_info[dungeon_type].name,
6374 r_name+r_info[d_info[dungeon_type].final_guardian].name);
6376 msg_format("%^s lives in this level as the keeper of %s.",
6377 r_name+r_info[d_info[dungeon_type].final_guardian].name,
6378 d_name+d_info[dungeon_type].name);
6382 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(FALSE);
6384 /*** Process this dungeon level ***/
6386 /* Reset the monster generation level */
6387 monster_level = base_level;
6389 /* Reset the object generation level */
6390 object_level = base_level;
6394 if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
6395 (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
6396 p_ptr->energy_need = 0;
6398 /* Not leaving dungeon */
6399 p_ptr->leaving_dungeon = FALSE;
6401 /* Initialize monster process */
6407 /* Hack -- Compact the monster list occasionally */
6408 if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
6410 /* Hack -- Compress the monster list occasionally */
6411 if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0);
6414 /* Hack -- Compact the object list occasionally */
6415 if (o_cnt + 32 > max_o_idx) compact_objects(64);
6417 /* Hack -- Compress the object list occasionally */
6418 if (o_cnt + 32 < o_max) compact_objects(0);
6421 /* Process the player */
6424 process_upkeep_with_speed();
6426 /* Handle "p_ptr->notice" */
6429 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6432 /* Hack -- Hilite the player */
6433 move_cursor_relative(py, px);
6435 /* Optional fresh */
6436 if (fresh_after) Term_fresh();
6438 /* Hack -- Notice death or departure */
6439 if (!p_ptr->playing || p_ptr->is_dead) break;
6441 /* Process all of the monsters */
6444 /* Handle "p_ptr->notice" */
6447 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6450 /* Hack -- Hilite the player */
6451 move_cursor_relative(py, px);
6453 /* Optional fresh */
6454 if (fresh_after) Term_fresh();
6456 /* Hack -- Notice death or departure */
6457 if (!p_ptr->playing || p_ptr->is_dead) break;
6460 /* Process the world */
6463 /* Handle "p_ptr->notice" */
6466 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
6469 /* Hack -- Hilite the player */
6470 move_cursor_relative(py, px);
6472 /* Optional fresh */
6473 if (fresh_after) Term_fresh();
6475 /* Hack -- Notice death or departure */
6476 if (!p_ptr->playing || p_ptr->is_dead) break;
6478 /* Handle "leaving" */
6479 if (p_ptr->leaving) break;
6481 /* Count game turns */
6484 if (dungeon_turn < dungeon_turn_limit)
6486 if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
6487 else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
6490 prevent_turn_overflow();
6492 if (wild_regen) wild_regen--;
6495 /* Inside a quest and non-unique questor? */
6496 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
6498 /* Un-mark the quest monster */
6499 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
6502 /* Not save-and-quit and not dead? */
6503 if (p_ptr->playing && !p_ptr->is_dead)
6506 * Maintain Unique monsters and artifact, save current
6507 * floor, then prepare next floor
6511 /* Forget the flag */
6512 reinit_wilderness = FALSE;
6515 /* Write about current level on the play record once per level */
6521 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
6524 * Modified by Arcum Dagsson to support
6525 * separate macro files for different realms.
6527 static void load_all_pref_files(void)
6531 /* Access the "user" pref file */
6532 sprintf(buf, "user.prf");
6534 /* Process that file */
6535 process_pref_file(buf);
6537 /* Access the "user" system pref file */
6538 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
6540 /* Process that file */
6541 process_pref_file(buf);
6543 /* Access the "race" pref file */
6544 sprintf(buf, "%s.prf", rp_ptr->title);
6546 /* Process that file */
6547 process_pref_file(buf);
6549 /* Access the "class" pref file */
6550 sprintf(buf, "%s.prf", cp_ptr->title);
6552 /* Process that file */
6553 process_pref_file(buf);
6555 /* Access the "character" pref file */
6556 sprintf(buf, "%s.prf", player_base);
6558 /* Process that file */
6559 process_pref_file(buf);
6561 /* Access the "realm 1" pref file */
6562 if (p_ptr->realm1 != REALM_NONE)
6564 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
6566 /* Process that file */
6567 process_pref_file(buf);
6570 /* Access the "realm 2" pref file */
6571 if (p_ptr->realm2 != REALM_NONE)
6573 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
6575 /* Process that file */
6576 process_pref_file(buf);
6580 /* Load an autopick preference file */
6581 autopick_load_pref(FALSE);
6586 * @brief ビットセットからゲームオプションを展開する / Extract option variables from bit sets
6589 void extract_option_vars(void)
6593 for (i = 0; option_info[i].o_desc; i++)
6595 int os = option_info[i].o_set;
6596 int ob = option_info[i].o_bit;
6598 /* Set the "default" options */
6599 if (option_info[i].o_var)
6602 if (option_flag[os] & (1L << ob))
6605 (*option_info[i].o_var) = TRUE;
6612 (*option_info[i].o_var) = FALSE;
6620 * @brief 賞金首となるユニークを確定する / Determine bounty uniques
6623 void determine_bounty_uniques(void)
6626 monster_race *r_ptr;
6628 get_mon_num_prep(NULL, NULL);
6629 for (i = 0; i < MAX_KUBI; i++)
6633 kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
6634 r_ptr = &r_info[kubi_r_idx[i]];
6636 if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
6638 if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
6640 if (r_ptr->rarity > 100) continue;
6642 if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
6644 for (j = 0; j < i; j++)
6645 if (kubi_r_idx[i] == kubi_r_idx[j]) break;
6652 for (i = 0; i < MAX_KUBI - 1; i++)
6654 for (j = i; j < MAX_KUBI; j++)
6656 if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
6658 tmp = kubi_r_idx[i];
6659 kubi_r_idx[i] = kubi_r_idx[j];
6660 kubi_r_idx[j] = tmp;
6668 * @brief 今日の賞金首を確定する / Determine today's bounty monster
6670 * @note conv_old is used if loaded 0.0.3 or older save file
6672 void determine_today_mon(bool conv_old)
6675 bool old_inside_battle = p_ptr->inside_battle;
6676 monster_race *r_ptr;
6680 for (i = 0; i < max_d_idx; i++)
6682 if (max_dlv[i] < d_info[i].mindepth) continue;
6683 if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
6686 else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
6688 p_ptr->inside_battle = TRUE;
6689 get_mon_num_prep(NULL, NULL);
6693 today_mon = get_mon_num(max_dl);
6694 r_ptr = &r_info[today_mon];
6696 if (r_ptr->flags1 & RF1_UNIQUE) continue;
6697 if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
6698 if (r_ptr->flags2 & RF2_MULTIPLY) continue;
6699 if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
6700 if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
6701 if (r_ptr->rarity > 10) continue;
6705 p_ptr->today_mon = 0;
6706 p_ptr->inside_battle = old_inside_battle;
6710 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
6713 * If the "new_game" parameter is true, then, after loading the
6714 * savefile, we will commit suicide, if necessary, to allow the
6715 * player to start a new game.
6717 void play_game(bool new_game)
6720 bool load_game = TRUE;
6721 bool init_random_seed = FALSE;
6731 else if (chuukei_server)
6733 prepare_chuukei_hooks();
6744 hack_mutation = FALSE;
6746 /* Hack -- Character is "icky" */
6747 character_icky = TRUE;
6749 /* Make sure main term is active */
6750 Term_activate(angband_term[0]);
6752 /* Initialise the resize hooks */
6753 angband_term[0]->resize_hook = resize_map;
6755 for (i = 1; i < 8; i++)
6757 /* Does the term exist? */
6758 if (angband_term[i])
6760 /* Add the redraw on resize hook */
6761 angband_term[i]->resize_hook = redraw_window;
6765 /* Hack -- turn off the cursor */
6766 (void)Term_set_cursor(0);
6769 /* Attempt to load */
6774 quit("セーブファイルが壊れています");
6776 quit("broken savefile");
6781 /* Extract the options */
6782 extract_option_vars();
6784 /* Report waited score */
6785 if (p_ptr->wait_report_score)
6791 if (!get_check_strict("待機していたスコア登録を今行ないますか?", CHECK_NO_HISTORY))
6793 if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
6798 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
6803 p_ptr->is_dead = TRUE;
6805 start_time = time(NULL);
6807 /* No suspending now */
6808 signals_ignore_tstp();
6810 /* Hack -- Character is now "icky" */
6811 character_icky = TRUE;
6813 /* Build the filename */
6814 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
6816 /* Open the high score file, for reading/writing */
6817 highscore_fd = fd_open(buf, O_RDWR);
6819 /* Handle score, show Top scores */
6820 success = send_world_score(TRUE);
6823 if (!success && !get_check_strict("スコア登録を諦めますか?", CHECK_NO_HISTORY))
6825 if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
6829 prt("引き続き待機します。", 0, 0);
6831 prt("standing by for future registration...", 0, 0);
6837 p_ptr->wait_report_score = FALSE;
6840 if (!save_player()) msg_print("セーブ失敗!");
6842 if (!save_player()) msg_print("death save failed!");
6845 /* Shut the high score file */
6846 (void)fd_close(highscore_fd);
6848 /* Forget the high score fd */
6851 /* Allow suspending now */
6852 signals_handle_tstp();
6857 creating_savefile = new_game;
6859 /* Nothing loaded */
6860 if (!character_loaded)
6862 /* Make new player */
6865 /* The dungeon is not ready */
6866 character_dungeon = FALSE;
6868 /* Prepare to init the RNG */
6869 init_random_seed = TRUE;
6871 /* Initialize the saved floors data */
6872 init_saved_floors(FALSE);
6875 /* Old game is loaded. But new game is requested. */
6878 /* Initialize the saved floors data */
6879 init_saved_floors(TRUE);
6882 /* Process old character */
6885 /* Process the player name */
6886 process_player_name(FALSE);
6890 if (init_random_seed)
6895 /* Roll new character */
6898 /* The dungeon is not ready */
6899 character_dungeon = FALSE;
6903 p_ptr->inside_quest = 0;
6904 p_ptr->inside_arena = FALSE;
6905 p_ptr->inside_battle = FALSE;
6909 /* Hack -- seed for flavors */
6910 seed_flavor = randint0(0x10000000);
6912 /* Hack -- seed for town layout */
6913 seed_town = randint0(0x10000000);
6915 /* Roll up a new character */
6923 determine_bounty_uniques();
6924 determine_today_mon(FALSE);
6926 /* Initialize object array */
6931 write_level = FALSE;
6934 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ----ゲーム再開----");
6936 do_cmd_write_nikki(NIKKI_GAMESTART, 1, " ---- Restart Game ----");
6940 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
6941 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
6943 if (p_ptr->riding == -1)
6946 for (i = m_max; i > 0; i--)
6948 if (player_bold(m_list[i].fy, m_list[i].fx))
6957 creating_savefile = FALSE;
6959 p_ptr->teleport_town = FALSE;
6960 p_ptr->sutemi = FALSE;
6961 world_monster = FALSE;
6962 now_damaged = FALSE;
6964 start_time = time(NULL) - 1;
6965 record_o_name[0] = '\0';
6967 /* Reset map panel */
6968 panel_row_min = cur_hgt;
6969 panel_col_min = cur_wid;
6971 /* Sexy gal gets bonus to maximum weapon skill of whip */
6972 if (p_ptr->pseikaku == SEIKAKU_SEXY)
6973 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
6975 /* Fill the arrays of floors and walls in the good proportions */
6976 set_floor_and_wall(dungeon_type);
6978 /* Flavor the objects */
6981 /* Flash a message */
6983 prt("お待ち下さい...", 0, 0);
6985 prt("Please wait...", 0, 0);
6989 /* Flush the message */
6993 /* Hack -- Enter wizard mode */
6996 if (enter_wizard_mode())
6998 p_ptr->wizard = TRUE;
7000 if (p_ptr->is_dead || !py || !px)
7002 /* Initialize the saved floors data */
7003 init_saved_floors(TRUE);
7006 p_ptr->inside_quest = 0;
7008 /* Avoid crash in update_view() */
7012 else if (p_ptr->is_dead)
7014 quit("Already dead.");
7018 /* Initialize the town-buildings if necessary */
7019 if (!dun_level && !p_ptr->inside_quest)
7021 /* Init the wilderness */
7023 process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
7026 init_flags = INIT_ONLY_BUILDINGS;
7028 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
7030 select_floor_music();
7034 /* Generate a dungeon level if needed */
7035 if (!character_dungeon)
7042 /* HACK -- Restore from panic-save */
7043 if (p_ptr->panic_save)
7045 /* No player? -- Try to regenerate floor */
7049 msg_print("プレイヤーの位置がおかしい。フロアを再生成します。");
7051 msg_print("What a strange player location. Regenerate the dungeon floor.");
7056 /* Still no player? -- Try to locate random place */
7057 if (!py || !px) py = px = 10;
7059 /* No longer in panic */
7060 p_ptr->panic_save = 0;
7064 /* Character is now "complete" */
7065 character_generated = TRUE;
7068 /* Hack -- Character is no longer "icky" */
7069 character_icky = FALSE;
7077 sprintf(buf, "%sに降り立った。", map_name());
7079 sprintf(buf, "You are standing in the %s.", map_name());
7081 do_cmd_write_nikki(NIKKI_BUNSHOU, 0, buf);
7086 p_ptr->playing = TRUE;
7088 /* Reset the visual mappings */
7091 /* Load the "pref" files */
7092 load_all_pref_files();
7094 /* Give startup outfit (after loading pref files) */
7100 /* React to changes */
7101 Term_xtra(TERM_XTRA_REACT, 0);
7104 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
7107 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
7113 /* Set or clear "rogue_like_commands" if requested */
7114 if (arg_force_original) rogue_like_commands = FALSE;
7115 if (arg_force_roguelike) rogue_like_commands = TRUE;
7117 /* Hack -- Enforce "delayed death" */
7118 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
7120 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
7122 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
7124 monster_type *m_ptr;
7125 int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
7126 monster_race *r_ptr = &r_info[pet_r_idx];
7127 place_monster_aux(0, py, px - 1, pet_r_idx,
7128 (PM_FORCE_PET | PM_NO_KAGE));
7129 m_ptr = &m_list[hack_m_idx_ii];
7130 m_ptr->mspeed = r_ptr->speed;
7131 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
7132 m_ptr->max_maxhp = m_ptr->maxhp;
7133 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
7134 m_ptr->dealt_damage = 0;
7135 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
7138 (void)combine_and_reorder_home(STORE_HOME);
7139 (void)combine_and_reorder_home(STORE_MUSEUM);
7141 select_floor_music();
7146 /* Process the level */
7149 /* Handle "p_ptr->notice" */
7152 /* Hack -- prevent "icky" message */
7153 character_xtra = TRUE;
7155 /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
7158 character_xtra = FALSE;
7160 /* Cancel the target */
7163 /* Cancel the health bar */
7167 /* Forget the lite */
7170 /* Forget the view */
7173 /* Forget the view */
7176 /* Handle "quit and save" */
7177 if (!p_ptr->playing && !p_ptr->is_dead) break;
7179 /* Erase the old cave */
7181 if (!p_ptr->is_dead) wipe_m_list();
7189 /* Accidental Death */
7190 if (p_ptr->playing && p_ptr->is_dead)
7192 if (p_ptr->inside_arena)
7194 p_ptr->inside_arena = FALSE;
7195 if (p_ptr->arena_number > MAX_ARENA_MONS)
7196 p_ptr->arena_number++;
7198 p_ptr->arena_number = -1 - p_ptr->arena_number;
7199 p_ptr->is_dead = FALSE;
7201 p_ptr->chp_frac = 0;
7202 p_ptr->exit_bldg = TRUE;
7205 /* Leave through the exit */
7206 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
7208 /* prepare next floor */
7213 /* Mega-Hack -- Allow player to cheat death */
7215 if ((p_ptr->wizard || cheat_live) && !get_check("死にますか? "))
7217 if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
7220 /* Mark social class, reset age, if needed */
7221 if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
7227 p_ptr->noscore |= 0x0001;
7231 msg_print("ウィザードモードに念を送り、死を欺いた。");
7233 msg_print("You invoke wizard mode and cheat death.");
7237 /* Restore hit points */
7238 p_ptr->chp = p_ptr->mhp;
7239 p_ptr->chp_frac = 0;
7241 if (p_ptr->pclass == CLASS_MAGIC_EATER)
7243 for (i = 0; i < EATER_EXT*2; i++)
7245 p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
7247 for (; i < EATER_EXT*3; i++)
7249 p_ptr->magic_num1[i] = 0;
7252 /* Restore spell points */
7253 p_ptr->csp = p_ptr->msp;
7254 p_ptr->csp_frac = 0;
7256 /* Hack -- cancel recall */
7257 if (p_ptr->word_recall)
7261 msg_print("張りつめた大気が流れ去った...");
7263 msg_print("A tension leaves the air around you...");
7268 /* Hack -- Prevent recall */
7269 p_ptr->word_recall = 0;
7270 p_ptr->redraw |= (PR_STATUS);
7273 /* Hack -- cancel alter */
7274 if (p_ptr->alter_reality)
7276 /* Hack -- Prevent alter */
7277 p_ptr->alter_reality = 0;
7278 p_ptr->redraw |= (PR_STATUS);
7281 /* Note cause of death XXX XXX XXX */
7283 (void)strcpy(p_ptr->died_from, "死の欺き");
7285 (void)strcpy(p_ptr->died_from, "Cheating death");
7289 p_ptr->is_dead = FALSE;
7291 /* Hack -- Healing */
7293 (void)set_confused(0);
7294 (void)set_poisoned(0);
7295 (void)set_afraid(0);
7296 (void)set_paralyzed(0);
7301 /* Hack -- Prevent starvation */
7302 (void)set_food(PY_FOOD_MAX - 1);
7305 p_ptr->inside_arena = FALSE;
7306 p_ptr->inside_battle = FALSE;
7308 p_ptr->inside_quest = 0;
7309 if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
7311 if (lite_town || vanilla_town)
7313 p_ptr->wilderness_y = 1;
7314 p_ptr->wilderness_x = 1;
7328 p_ptr->wilderness_y = 48;
7329 p_ptr->wilderness_x = 5;
7335 p_ptr->wild_mode = FALSE;
7336 p_ptr->leaving = TRUE;
7339 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " しかし、生き返った。");
7341 do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
7344 /* Prepare next floor */
7351 /* Handle "death" */
7352 if (p_ptr->is_dead) break;
7354 /* Make a new level */
7366 * @brief ゲームターンからの実時間換算を行うための補正をかける
7367 * @param hoge ゲームターン
7368 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
7369 * @return 修正をかけた後のゲームターン
7371 s32b turn_real(s32b hoge)
7373 switch (p_ptr->start_race)
7379 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
7386 * @brief ターンのオーバーフローに対する対処
7387 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
7388 * @return 修正をかけた後のゲームターン
7390 void prevent_turn_overflow(void)
7392 int rollback_days, i, j;
7393 s32b rollback_turns;
7395 if (turn < turn_limit) return;
7397 rollback_days = 1 + (turn - turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
7398 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
7400 if (turn > rollback_turns) turn -= rollback_turns;
7401 else turn = 1; /* Paranoia */
7402 if (old_turn > rollback_turns) old_turn -= rollback_turns;
7404 if (old_battle > rollback_turns) old_battle -= rollback_turns;
7405 else old_battle = 1;
7406 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
7407 else p_ptr->feeling_turn = 1;
7409 for (i = 1; i < max_towns; i++)
7411 for (j = 0; j < MAX_STORES; j++)
7413 store_type *st_ptr = &town[i].store[j];
7415 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
7417 st_ptr->last_visit -= rollback_turns;
7418 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
7421 if (st_ptr->store_open)
7423 st_ptr->store_open -= rollback_turns;
7424 if (st_ptr->store_open < 1) st_ptr->store_open = 1;