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.
24 #include "cmd-activate.h"
27 #include "cmd-hissatsu.h"
29 #include "cmd-magiceat.h"
31 #include "cmd-quaff.h"
33 #include "cmd-smith.h"
34 #include "cmd-usestaff.h"
35 #include "cmd-zaprod.h"
36 #include "cmd-zapwand.h"
38 #include "cmd-basic.h"
44 #include "floor-events.h"
45 #include "floor-town.h"
47 #include "object-ego.h"
48 #include "object-curse.h"
49 #include "object-flavor.h"
52 #include "spells-summon.h"
53 #include "spells-object.h"
54 #include "spells-status.h"
55 #include "spells-floor.h"
56 #include "monster-spell.h"
63 #include "player-move.h"
64 #include "player-status.h"
65 #include "player-class.h"
66 #include "player-race.h"
67 #include "player-personality.h"
68 #include "player-damage.h"
69 #include "player-effects.h"
70 #include "cmd-spell.h"
71 #include "realm-hex.h"
72 #include "objectkind.h"
73 #include "object-hook.h"
75 #include "monster-process.h"
76 #include "monster-status.h"
77 #include "monsterrace-hook.h"
78 #include "floor-save.h"
80 #include "player-skill.h"
81 #include "player-inventory.h"
83 #include "view-mainwindow.h"
84 #include "dungeon-file.h"
90 #include "realm-song.h"
91 #include "targeting.h"
95 * Hack -- Link a copyright message into the executable
97 const concptr copyright[5] =
99 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
101 "This software may be copied and distributed for educational, research,",
102 "and not for profit purposes provided that this copyright and statement",
103 "are included in all such copies."
106 bool can_save = FALSE;
108 COMMAND_CODE now_message;
110 bool repair_monsters;
113 concptr ANGBAND_SYS = "xxx";
116 concptr ANGBAND_KEYBOARD = "JAPAN";
118 concptr ANGBAND_KEYBOARD = "0";
121 concptr ANGBAND_GRAF = "ascii";
123 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
124 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
127 * Flags for initialization
132 * @brief 擬似鑑定を実際に行い判定を反映する
133 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
134 * @param creature_ptr プレーヤーへの参照ポインタ
135 * @param heavy 重度の擬似鑑定を行うならばTRUE
138 static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
141 object_type *o_ptr = &creature_ptr->inventory_list[slot];
142 GAME_TEXT o_name[MAX_NLEN];
143 if (o_ptr->ident & (IDENT_SENSE))return;
144 if (object_is_known(o_ptr)) return;
146 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
149 if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
160 feel = FEEL_EXCELLENT;
166 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
168 feel = FEEL_UNCURSED;
173 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
179 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
186 feel = FEEL_WORTHLESS;
191 feel = FEEL_TERRIBLE;
197 if (disturb_minor) disturb(creature_ptr, FALSE, FALSE);
199 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
200 if (slot >= INVEN_RARM)
203 msg_format("%s%s(%c)は%sという感じがする...",
204 describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
206 msg_format("You feel the %s (%c) you are %s %s %s...",
207 o_name, index_to_label(slot), describe_use(creature_ptr, slot),
208 ((o_ptr->number == 1) ? "is" : "are"),
209 game_inscriptions[feel]);
216 msg_format("ザックの中の%s(%c)は%sという感じがする...",
217 o_name, index_to_label(slot), game_inscriptions[feel]);
219 msg_format("You feel the %s (%c) in your pack %s %s...",
220 o_name, index_to_label(slot),
221 ((o_ptr->number == 1) ? "is" : "are"),
222 game_inscriptions[feel]);
227 o_ptr->ident |= (IDENT_SENSE);
228 o_ptr->feeling = feel;
230 autopick_alter_item(creature_ptr, slot, destroy_feeling);
231 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
232 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
237 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
240 * Sense the inventory\n
242 * Class 0 = Warrior --> fast and heavy\n
243 * Class 1 = Mage --> slow and light\n
244 * Class 2 = Priest --> fast but light\n
245 * Class 3 = Rogue --> okay and heavy\n
246 * Class 4 = Ranger --> slow but heavy (changed!)\n
247 * Class 5 = Paladin --> slow but heavy\n
249 static void sense_inventory1(player_type *creature_ptr)
251 PLAYER_LEVEL plev = creature_ptr->lev;
254 if (creature_ptr->confused) return;
256 switch (creature_ptr->pclass)
263 if (0 != randint0(9000L / (plev * plev + 40))) return;
270 if (0 != randint0(6000L / (plev * plev + 50))) return;
276 case CLASS_HIGH_MAGE:
278 case CLASS_MAGIC_EATER:
280 if (0 != randint0(240000L / (plev + 5))) return;
287 if (0 != randint0(10000L / (plev * plev + 40))) return;
294 if (0 != randint0(20000L / (plev * plev + 40))) return;
301 if (0 != randint0(95000L / (plev * plev + 40))) return;
309 if (0 != randint0(77777L / (plev * plev + 40))) return;
314 case CLASS_WARRIOR_MAGE:
317 if (0 != randint0(75000L / (plev * plev + 40))) return;
321 case CLASS_MINDCRAFTER:
323 case CLASS_BLUE_MAGE:
324 case CLASS_MIRROR_MASTER:
326 if (0 != randint0(55000L / (plev * plev + 40))) return;
330 case CLASS_CHAOS_WARRIOR:
332 if (0 != randint0(80000L / (plev * plev + 40))) return;
338 case CLASS_FORCETRAINER:
340 if (0 != randint0(20000L / (plev * plev + 40))) return;
346 if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
351 case CLASS_BEASTMASTER:
353 if (0 != randint0(65000L / (plev * plev + 40))) return;
357 case CLASS_BERSERKER:
364 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
366 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
370 o_ptr = &creature_ptr->inventory_list[i];
372 if (!o_ptr->k_idx) continue;
401 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
403 if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
408 sense_inventory_aux(creature_ptr, i, heavy);
414 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
417 static void sense_inventory2(player_type *creature_ptr)
419 PLAYER_LEVEL plev = creature_ptr->lev;
422 if (creature_ptr->confused) return;
424 switch (creature_ptr->pclass)
430 case CLASS_BERSERKER:
437 case CLASS_CHAOS_WARRIOR:
439 case CLASS_BEASTMASTER:
442 if (0 != randint0(240000L / (plev + 5))) return;
447 case CLASS_WARRIOR_MAGE:
451 if (0 != randint0(95000L / (plev * plev + 40))) return;
458 case CLASS_FORCETRAINER:
459 case CLASS_MINDCRAFTER:
461 if (0 != randint0(20000L / (plev * plev + 40))) return;
466 case CLASS_HIGH_MAGE:
468 case CLASS_MAGIC_EATER:
469 case CLASS_MIRROR_MASTER:
470 case CLASS_BLUE_MAGE:
472 if (0 != randint0(9000L / (plev * plev + 40))) return;
478 if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
484 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
487 o_ptr = &creature_ptr->inventory_list[i];
488 if (!o_ptr->k_idx) continue;
503 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
505 sense_inventory_aux(creature_ptr, i, TRUE);
511 * @brief パターン終点到達時のテレポート処理を行う
512 * @param creature_ptr プレーヤーへの参照ポインタ
515 static void pattern_teleport(player_type *creature_ptr)
518 DEPTH max_level = 99;
520 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
525 if (ironman_downward)
526 min_level = creature_ptr->current_floor_ptr->dun_level;
528 if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
530 if (creature_ptr->current_floor_ptr->dun_level > 100)
531 max_level = MAX_DEPTH - 1;
532 else if (creature_ptr->current_floor_ptr->dun_level == 100)
537 max_level = d_info[creature_ptr->dungeon_idx].maxdepth;
538 min_level = d_info[creature_ptr->dungeon_idx].mindepth;
541 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
542 sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
543 if (!get_string(ppp, tmp_val, 10)) return;
545 command_arg = (COMMAND_ARG)atoi(tmp_val);
547 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
549 teleport_player(creature_ptr, 200, 0L);
557 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
558 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
560 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
561 if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
563 creature_ptr->current_floor_ptr->dun_level = command_arg;
564 leave_quest_check(creature_ptr);
565 if (record_stair) exe_write_diary(creature_ptr, DIARY_PAT_TELE, 0, NULL);
567 creature_ptr->current_floor_ptr->inside_quest = 0;
568 free_turn(creature_ptr);
571 * Clear all saved floors
572 * and create a first saved floor
574 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
575 creature_ptr->leaving = TRUE;
580 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
581 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
583 static bool pattern_effect(player_type *creature_ptr)
585 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
586 if (!pattern_tile(floor_ptr, creature_ptr->y, creature_ptr->x)) return FALSE;
588 if ((PRACE_IS_(creature_ptr, RACE_AMBERITE)) &&
589 (creature_ptr->cut > 0) && one_in_(10))
591 wreck_the_pattern(creature_ptr);
594 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
595 switch (pattern_type)
597 case PATTERN_TILE_END:
598 (void)set_image(creature_ptr, 0);
599 (void)restore_all_status(creature_ptr);
600 (void)restore_level(creature_ptr);
601 (void)cure_critical_wounds(creature_ptr, 1000);
603 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
604 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
607 * We could make the healing effect of the
608 * Pattern center one-time only to avoid various kinds
609 * of abuse, like luring the win monster into fighting you
610 * in the middle of the pattern...
614 case PATTERN_TILE_OLD:
618 case PATTERN_TILE_TELEPORT:
619 pattern_teleport(creature_ptr);
622 case PATTERN_TILE_WRECKED:
623 if (!IS_INVULN(creature_ptr))
624 take_hit(creature_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
628 if (PRACE_IS_(creature_ptr, RACE_AMBERITE) && !one_in_(2))
630 else if (!IS_INVULN(creature_ptr))
631 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
640 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
641 * @param percent 回復比率
644 static void regenhp(player_type *creature_ptr, int percent)
646 if (creature_ptr->special_defense & KATA_KOUKIJIN) return;
647 if (creature_ptr->action == ACTION_HAYAGAKE) return;
649 HIT_POINT old_chp = creature_ptr->chp;
652 * Extract the new hitpoints
654 * 'percent' is the Regen factor in unit (1/2^16)
656 HIT_POINT new_chp = 0;
657 u32b new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
658 s64b_LSHIFT(new_chp, new_chp_frac, 16);
659 s64b_add(&(creature_ptr->chp), &(creature_ptr->chp_frac), new_chp, new_chp_frac);
660 if (0 < s64b_cmp(creature_ptr->chp, creature_ptr->chp_frac, creature_ptr->mhp, 0))
662 creature_ptr->chp = creature_ptr->mhp;
663 creature_ptr->chp_frac = 0;
666 if (old_chp != creature_ptr->chp)
668 creature_ptr->redraw |= (PR_HP);
669 creature_ptr->window |= (PW_PLAYER);
676 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
677 * @param upkeep_factor ペット維持によるMPコスト量
678 * @param regen_amount 回復量
681 static void regenmana(player_type *creature_ptr, MANA_POINT upkeep_factor, MANA_POINT regen_amount)
683 MANA_POINT old_csp = creature_ptr->csp;
684 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
687 * Excess mana will decay 32 times faster than normal
690 if (creature_ptr->csp > creature_ptr->msp)
693 u32b decay_frac = (creature_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
694 s64b_LSHIFT(decay, decay_frac, 16);
695 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), decay, decay_frac);
696 if (creature_ptr->csp < creature_ptr->msp)
698 creature_ptr->csp = creature_ptr->msp;
699 creature_ptr->csp_frac = 0;
703 /* Regenerating mana (unless the player has excess mana) */
704 else if (regen_rate > 0)
706 MANA_POINT new_mana = 0;
707 u32b new_mana_frac = (creature_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
708 s64b_LSHIFT(new_mana, new_mana_frac, 16);
709 s64b_add(&(creature_ptr->csp), &(creature_ptr->csp_frac), new_mana, new_mana_frac);
710 if (creature_ptr->csp >= creature_ptr->msp)
712 creature_ptr->csp = creature_ptr->msp;
713 creature_ptr->csp_frac = 0;
717 /* Reduce mana (even when the player has excess mana) */
720 s32b reduce_mana = 0;
721 u32b reduce_mana_frac = (creature_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
722 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
723 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), reduce_mana, reduce_mana_frac);
724 if (creature_ptr->csp < 0)
726 creature_ptr->csp = 0;
727 creature_ptr->csp_frac = 0;
731 if (old_csp != creature_ptr->csp)
733 creature_ptr->redraw |= (PR_MANA);
734 creature_ptr->window |= (PW_PLAYER);
735 creature_ptr->window |= (PW_SPELL);
742 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
743 * @param regen_amount 回復量
746 static void regenmagic(player_type *creature_ptr, int regen_amount)
750 int mult = (dev + adj_mag_mana[creature_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
752 for (int i = 0; i < EATER_EXT * 2; i++)
754 if (!creature_ptr->magic_num2[i]) continue;
755 if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
757 /* Increase remaining charge number like float value */
758 new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 13)) / (dev * 8);
759 creature_ptr->magic_num1[i] += new_mana;
761 /* Check maximum charge */
762 if (creature_ptr->magic_num1[i] > (creature_ptr->magic_num2[i] << 16))
764 creature_ptr->magic_num1[i] = ((long)creature_ptr->magic_num2[i] << 16);
770 for (int i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
772 if (!creature_ptr->magic_num1[i]) continue;
773 if (!creature_ptr->magic_num2[i]) continue;
775 /* Decrease remaining period for charging */
776 new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
777 / (dev * 16 * PY_REGEN_NORMAL);
778 creature_ptr->magic_num1[i] -= new_mana;
780 /* Check minimum remaining period for charging */
781 if (creature_ptr->magic_num1[i] < 0) creature_ptr->magic_num1[i] = 0;
788 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
789 * @param player_ptr プレーヤーへの参照ポインタ
791 * @note Should probably be done during monster turns.
793 static void regenerate_monsters(player_type *player_ptr)
795 for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++)
797 monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
798 monster_race *r_ptr = &r_info[m_ptr->r_idx];
800 if (!monster_is_valid(m_ptr)) continue;
802 if (m_ptr->hp < m_ptr->maxhp)
804 int frac = m_ptr->maxhp / 100;
805 if (!frac) if (one_in_(2)) frac = 1;
807 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
810 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
812 if (player_ptr->health_who == i) player_ptr->redraw |= (PR_HEALTH);
813 if (player_ptr->riding == i) player_ptr->redraw |= (PR_UHEALTH);
820 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
821 * @param creature_ptr プレーヤーへの参照ポインタ
823 * @note Should probably be done during monster turns.
825 static void regenerate_captured_monsters(player_type *creature_ptr)
828 for (int i = 0; i < INVEN_TOTAL; i++)
831 object_type *o_ptr = &creature_ptr->inventory_list[i];
832 if (!o_ptr->k_idx) continue;
833 if (o_ptr->tval != TV_CAPTURE) continue;
834 if (!o_ptr->pval) continue;
837 r_ptr = &r_info[o_ptr->pval];
838 if (o_ptr->xtra4 < o_ptr->xtra5)
840 int frac = o_ptr->xtra5 / 100;
841 if (!frac) if (one_in_(2)) frac = 1;
843 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
845 o_ptr->xtra4 += (XTRA16)frac;
846 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
852 creature_ptr->update |= (PU_COMBINE);
853 creature_ptr->window |= (PW_INVEN);
854 creature_ptr->window |= (PW_EQUIP);
861 * @brief 寿命つき光源の警告メッセージ処理
862 * @param creature_ptr プレーヤーへの参照ポインタ
863 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
866 static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
868 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
870 creature_ptr->window |= (PW_EQUIP);
873 if (creature_ptr->blind)
875 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
877 else if (o_ptr->xtra4 == 0)
879 disturb(creature_ptr, FALSE, TRUE);
880 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
881 creature_ptr->update |= (PU_TORCH);
882 creature_ptr->update |= (PU_BONUS);
884 else if (o_ptr->name2 == EGO_LITE_LONG)
886 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
887 && (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)))
889 if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
890 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
893 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
895 if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
896 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
902 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
903 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
906 static void recharged_notice(player_type *owner_ptr, object_type *o_ptr)
908 if (!o_ptr->inscription) return;
910 concptr s = my_strchr(quark_str(o_ptr->inscription), '!');
915 GAME_TEXT o_name[MAX_NLEN];
916 object_desc(owner_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
918 msg_format("%sは再充填された。", o_name);
920 if (o_ptr->number > 1)
921 msg_format("Your %s are recharged.", o_name);
923 msg_format("Your %s is recharged.", o_name);
925 disturb(owner_ptr, FALSE, FALSE);
929 s = my_strchr(s + 1, '!');
935 * @brief プレイヤーの歌に関する継続処理
938 static void check_music(player_type *caster_ptr)
940 if (caster_ptr->pclass != CLASS_BARD) return;
941 if (!SINGING_SONG_EFFECT(caster_ptr) && !INTERUPTING_SONG_EFFECT(caster_ptr)) return;
943 if (caster_ptr->anti_magic)
945 stop_singing(caster_ptr);
949 int spell = SINGING_SONG_ID(caster_ptr);
950 const magic_type *s_ptr;
951 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
953 MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
954 u32b need_mana_frac = 0;
956 s64b_RSHIFT(need_mana, need_mana_frac, 1);
957 if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
959 stop_singing(caster_ptr);
964 s64b_sub(&(caster_ptr->csp), &(caster_ptr->csp_frac), need_mana, need_mana_frac);
966 caster_ptr->redraw |= PR_MANA;
967 if (INTERUPTING_SONG_EFFECT(caster_ptr))
969 SINGING_SONG_EFFECT(caster_ptr) = INTERUPTING_SONG_EFFECT(caster_ptr);
970 INTERUPTING_SONG_EFFECT(caster_ptr) = MUSIC_NONE;
971 msg_print(_("歌を再開した。", "You restart singing."));
972 caster_ptr->action = ACTION_SING;
973 caster_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
974 caster_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
975 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
979 if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
980 caster_ptr->spell_exp[spell] += 5;
981 else if (caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
983 if (one_in_(2) && (caster_ptr->current_floor_ptr->dun_level > 4) && ((caster_ptr->current_floor_ptr->dun_level + 10) > caster_ptr->lev)) caster_ptr->spell_exp[spell] += 1;
985 else if (caster_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
987 if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && ((caster_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
989 else if (caster_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
991 if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (caster_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
994 exe_spell(caster_ptr, REALM_MUSIC, spell, SPELL_CONT);
999 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1000 * @param flag 探し出したい呪いフラグ配列
1001 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1004 static object_type *choose_cursed_obj_name(player_type *player_ptr, BIT_FLAGS flag)
1006 int choices[INVEN_TOTAL - INVEN_RARM];
1008 if (!(player_ptr->cursed & flag)) return NULL;
1010 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
1012 object_type *o_ptr = &player_ptr->inventory_list[i];
1013 if (o_ptr->curse_flags & flag)
1015 choices[number] = i;
1018 else if ((flag == TRC_ADD_L_CURSE) ||
1019 (flag == TRC_ADD_H_CURSE) ||
1020 (flag == TRC_DRAIN_HP) ||
1021 (flag == TRC_DRAIN_MANA) ||
1022 (flag == TRC_CALL_ANIMAL) ||
1023 (flag == TRC_CALL_DEMON) ||
1024 (flag == TRC_CALL_DRAGON) ||
1025 (flag == TRC_CALL_UNDEAD) ||
1026 (flag == TRC_COWARDICE) ||
1027 (flag == TRC_LOW_MELEE) ||
1028 (flag == TRC_LOW_AC) ||
1029 (flag == TRC_LOW_MAGIC) ||
1030 (flag == TRC_FAST_DIGEST) ||
1031 (flag == TRC_SLOW_REGEN))
1034 BIT_FLAGS flgs[TR_FLAG_SIZE];
1035 object_flags(o_ptr, flgs);
1038 case TRC_ADD_L_CURSE: cf = TR_ADD_L_CURSE; break;
1039 case TRC_ADD_H_CURSE: cf = TR_ADD_H_CURSE; break;
1040 case TRC_DRAIN_HP: cf = TR_DRAIN_HP; break;
1041 case TRC_DRAIN_MANA: cf = TR_DRAIN_MANA; break;
1042 case TRC_CALL_ANIMAL: cf = TR_CALL_ANIMAL; break;
1043 case TRC_CALL_DEMON: cf = TR_CALL_DEMON; break;
1044 case TRC_CALL_DRAGON: cf = TR_CALL_DRAGON; break;
1045 case TRC_CALL_UNDEAD: cf = TR_CALL_UNDEAD; break;
1046 case TRC_COWARDICE: cf = TR_COWARDICE; break;
1047 case TRC_LOW_MELEE: cf = TR_LOW_MELEE; break;
1048 case TRC_LOW_AC: cf = TR_LOW_AC; break;
1049 case TRC_LOW_MAGIC: cf = TR_LOW_MAGIC; break;
1050 case TRC_FAST_DIGEST: cf = TR_FAST_DIGEST; break;
1051 case TRC_SLOW_REGEN: cf = TR_SLOW_REGEN; break;
1054 if (have_flag(flgs, cf))
1056 choices[number] = i;
1062 return &player_ptr->inventory_list[choices[randint0(number)]];
1066 static void process_world_aux_digestion(player_type *creature_ptr)
1068 if (!creature_ptr->phase_out)
1070 if (creature_ptr->food >= PY_FOOD_MAX)
1072 (void)set_food(creature_ptr, creature_ptr->food - 100);
1074 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1076 int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
1077 if (creature_ptr->regenerate)
1079 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1081 if (creature_ptr->cursed & TRC_FAST_DIGEST)
1084 if (creature_ptr->slow_digest)
1087 if (digestion < 1) digestion = 1;
1088 if (digestion > 100) digestion = 100;
1090 (void)set_food(creature_ptr, creature_ptr->food - digestion);
1093 if ((creature_ptr->food < PY_FOOD_FAINT))
1095 if (!creature_ptr->paralyzed && (randint0(100) < 10))
1097 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1098 disturb(creature_ptr, TRUE, TRUE);
1099 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
1102 if (creature_ptr->food < PY_FOOD_STARVE)
1104 HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
1105 if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1113 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1114 * / Handle timed damage and regeneration every 10 game turns
1117 static void process_world_aux_hp_and_sp(player_type *creature_ptr)
1119 feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1120 bool cave_no_regen = FALSE;
1121 int upkeep_factor = 0;
1122 int regen_amount = PY_REGEN_NORMAL;
1123 if (creature_ptr->poisoned && !IS_INVULN(creature_ptr))
1125 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1128 if (creature_ptr->cut && !IS_INVULN(creature_ptr))
1131 if (creature_ptr->cut > 1000)
1135 else if (creature_ptr->cut > 200)
1139 else if (creature_ptr->cut > 100)
1143 else if (creature_ptr->cut > 50)
1147 else if (creature_ptr->cut > 25)
1151 else if (creature_ptr->cut > 10)
1160 take_hit(creature_ptr, DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1163 if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
1165 if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN(creature_ptr) && is_daytime())
1167 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1169 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1170 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1171 cave_no_regen = TRUE;
1175 if (creature_ptr->inventory_list[INVEN_LITE].tval && (creature_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1176 !creature_ptr->resist_lite)
1178 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1179 GAME_TEXT o_name[MAX_NLEN];
1180 char ouch[MAX_NLEN + 40];
1181 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1182 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1184 cave_no_regen = TRUE;
1185 object_desc(creature_ptr, o_name, o_ptr, OD_NAME_ONLY);
1186 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1188 if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
1192 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_fire)
1196 if (have_flag(f_ptr->flags, FF_DEEP))
1198 damage = 6000 + randint0(4000);
1200 else if (!creature_ptr->levitation)
1202 damage = 3000 + randint0(2000);
1207 if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
1208 if (creature_ptr->resist_fire) damage = damage / 3;
1209 if (is_oppose_fire(creature_ptr)) damage = damage / 3;
1210 if (creature_ptr->levitation) damage = damage / 5;
1212 damage = damage / 100 + (randint0(100) < (damage % 100));
1214 if (creature_ptr->levitation)
1216 msg_print(_("熱で火傷した!", "The heat burns you!"));
1217 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1218 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1222 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1223 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1224 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1227 cave_no_regen = TRUE;
1231 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_cold)
1235 if (have_flag(f_ptr->flags, FF_DEEP))
1237 damage = 6000 + randint0(4000);
1239 else if (!creature_ptr->levitation)
1241 damage = 3000 + randint0(2000);
1246 if (creature_ptr->resist_cold) damage = damage / 3;
1247 if (is_oppose_cold(creature_ptr)) damage = damage / 3;
1248 if (creature_ptr->levitation) damage = damage / 5;
1250 damage = damage / 100 + (randint0(100) < (damage % 100));
1252 if (creature_ptr->levitation)
1254 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1255 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1256 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1260 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1261 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1262 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1265 cave_no_regen = TRUE;
1269 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_elec)
1273 if (have_flag(f_ptr->flags, FF_DEEP))
1275 damage = 6000 + randint0(4000);
1277 else if (!creature_ptr->levitation)
1279 damage = 3000 + randint0(2000);
1284 if (creature_ptr->resist_elec) damage = damage / 3;
1285 if (is_oppose_elec(creature_ptr)) damage = damage / 3;
1286 if (creature_ptr->levitation) damage = damage / 5;
1288 damage = damage / 100 + (randint0(100) < (damage % 100));
1290 if (creature_ptr->levitation)
1292 msg_print(_("電撃を受けた!", "The electricity shocks you!"));
1293 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1294 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1298 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1299 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1300 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1303 cave_no_regen = TRUE;
1307 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_acid)
1311 if (have_flag(f_ptr->flags, FF_DEEP))
1313 damage = 6000 + randint0(4000);
1315 else if (!creature_ptr->levitation)
1317 damage = 3000 + randint0(2000);
1322 if (creature_ptr->resist_acid) damage = damage / 3;
1323 if (is_oppose_acid(creature_ptr)) damage = damage / 3;
1324 if (creature_ptr->levitation) damage = damage / 5;
1326 damage = damage / 100 + (randint0(100) < (damage % 100));
1328 if (creature_ptr->levitation)
1330 msg_print(_("酸が飛び散った!", "The acid melts you!"));
1331 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1332 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1336 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1337 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1338 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1341 cave_no_regen = TRUE;
1345 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN(creature_ptr))
1349 if (have_flag(f_ptr->flags, FF_DEEP))
1351 damage = 6000 + randint0(4000);
1353 else if (!creature_ptr->levitation)
1355 damage = 3000 + randint0(2000);
1360 if (creature_ptr->resist_pois) damage = damage / 3;
1361 if (is_oppose_pois(creature_ptr)) damage = damage / 3;
1362 if (creature_ptr->levitation) damage = damage / 5;
1364 damage = damage / 100 + (randint0(100) < (damage % 100));
1366 if (creature_ptr->levitation)
1368 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1369 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1370 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1371 if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 1);
1375 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1376 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1377 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1378 if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 3);
1381 cave_no_regen = TRUE;
1385 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1386 !creature_ptr->levitation && !creature_ptr->can_swim && !creature_ptr->resist_water)
1388 if (creature_ptr->total_weight > weight_limit(creature_ptr))
1390 msg_print(_("溺れている!", "You are drowning!"));
1391 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->lev), _("溺れ", "drowning"), -1);
1392 cave_no_regen = TRUE;
1396 if (creature_ptr->riding)
1399 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !creature_ptr->immune_fire)
1401 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1402 if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
1403 if (creature_ptr->resist_fire) damage = damage / 3;
1404 if (is_oppose_fire(creature_ptr)) damage = damage / 3;
1405 msg_print(_("熱い!", "It's hot!"));
1406 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1408 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !creature_ptr->immune_elec)
1410 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1411 if (PRACE_IS_(creature_ptr, RACE_ANDROID)) damage += damage / 3;
1412 if (creature_ptr->resist_elec) damage = damage / 3;
1413 if (is_oppose_elec(creature_ptr)) damage = damage / 3;
1414 msg_print(_("痛い!", "It hurts!"));
1415 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1417 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !creature_ptr->immune_cold)
1419 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1420 if (creature_ptr->resist_cold) damage = damage / 3;
1421 if (is_oppose_cold(creature_ptr)) damage = damage / 3;
1422 msg_print(_("冷たい!", "It's cold!"));
1423 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1427 /* Spectres -- take damage when moving through walls */
1429 * Added: ANYBODY takes damage if inside through walls
1430 * without wraith form -- NOTE: Spectres will never be
1431 * reduced below 0 hp by being inside a stone wall; others
1434 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1436 if (!IS_INVULN(creature_ptr) && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
1439 cave_no_regen = TRUE;
1441 if (creature_ptr->pass_wall)
1443 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1444 dam_desc = _("密度", "density");
1448 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1449 dam_desc = _("硬い岩", "solid rock");
1452 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1 + (creature_ptr->lev / 5), dam_desc, -1);
1456 if (creature_ptr->food < PY_FOOD_WEAK)
1458 if (creature_ptr->food < PY_FOOD_STARVE)
1462 else if (creature_ptr->food < PY_FOOD_FAINT)
1464 regen_amount = PY_REGEN_FAINT;
1468 regen_amount = PY_REGEN_WEAK;
1472 if (pattern_effect(creature_ptr))
1474 cave_no_regen = TRUE;
1478 if (creature_ptr->regenerate)
1480 regen_amount = regen_amount * 2;
1482 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1486 if (creature_ptr->cursed & TRC_SLOW_REGEN)
1492 if ((creature_ptr->action == ACTION_SEARCH) || (creature_ptr->action == ACTION_REST))
1494 regen_amount = regen_amount * 2;
1497 upkeep_factor = calculate_upkeep(creature_ptr);
1498 if ((creature_ptr->action == ACTION_LEARN) ||
1499 (creature_ptr->action == ACTION_HAYAGAKE) ||
1500 (creature_ptr->special_defense & KATA_KOUKIJIN))
1502 upkeep_factor += 100;
1505 regenmana(creature_ptr, upkeep_factor, regen_amount);
1506 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
1508 regenmagic(creature_ptr, regen_amount);
1511 if ((creature_ptr->csp == 0) && (creature_ptr->csp_frac == 0))
1513 while (upkeep_factor > 100)
1515 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1517 do_cmd_pet_dismiss(creature_ptr);
1519 upkeep_factor = calculate_upkeep(creature_ptr);
1521 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1526 if (creature_ptr->poisoned) regen_amount = 0;
1527 if (creature_ptr->cut) regen_amount = 0;
1528 if (cave_no_regen) regen_amount = 0;
1530 regen_amount = (regen_amount * creature_ptr->mutant_regenerate_mod) / 100;
1531 if ((creature_ptr->chp < creature_ptr->mhp) && !cave_no_regen)
1533 regenhp(creature_ptr, regen_amount);
1539 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1540 * / Handle timeout every 10 game turns
1543 static void process_world_aux_timeout(player_type *creature_ptr)
1545 const int dec_count = (easy_band ? 2 : 1);
1546 if (creature_ptr->tim_mimic)
1548 (void)set_mimic(creature_ptr, creature_ptr->tim_mimic - 1, creature_ptr->mimic_form, TRUE);
1551 if (creature_ptr->image)
1553 (void)set_image(creature_ptr, creature_ptr->image - dec_count);
1556 if (creature_ptr->blind)
1558 (void)set_blind(creature_ptr, creature_ptr->blind - dec_count);
1561 if (creature_ptr->tim_invis)
1563 (void)set_tim_invis(creature_ptr, creature_ptr->tim_invis - 1, TRUE);
1566 if (creature_ptr->suppress_multi_reward)
1568 creature_ptr->suppress_multi_reward = FALSE;
1571 if (creature_ptr->tim_esp)
1573 (void)set_tim_esp(creature_ptr, creature_ptr->tim_esp - 1, TRUE);
1576 if (creature_ptr->ele_attack)
1578 creature_ptr->ele_attack--;
1579 if (!creature_ptr->ele_attack) set_ele_attack(creature_ptr, 0, 0);
1582 if (creature_ptr->ele_immune)
1584 creature_ptr->ele_immune--;
1585 if (!creature_ptr->ele_immune) set_ele_immune(creature_ptr, 0, 0);
1588 if (creature_ptr->tim_infra)
1590 (void)set_tim_infra(creature_ptr, creature_ptr->tim_infra - 1, TRUE);
1593 if (creature_ptr->tim_stealth)
1595 (void)set_tim_stealth(creature_ptr, creature_ptr->tim_stealth - 1, TRUE);
1598 if (creature_ptr->tim_levitation)
1600 (void)set_tim_levitation(creature_ptr, creature_ptr->tim_levitation - 1, TRUE);
1603 if (creature_ptr->tim_sh_touki)
1605 (void)set_tim_sh_touki(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
1608 if (creature_ptr->tim_sh_fire)
1610 (void)set_tim_sh_fire(creature_ptr, creature_ptr->tim_sh_fire - 1, TRUE);
1613 if (creature_ptr->tim_sh_holy)
1615 (void)set_tim_sh_holy(creature_ptr, creature_ptr->tim_sh_holy - 1, TRUE);
1618 if (creature_ptr->tim_eyeeye)
1620 (void)set_tim_eyeeye(creature_ptr, creature_ptr->tim_eyeeye - 1, TRUE);
1623 if (creature_ptr->resist_magic)
1625 (void)set_resist_magic(creature_ptr, creature_ptr->resist_magic - 1, TRUE);
1628 if (creature_ptr->tim_regen)
1630 (void)set_tim_regen(creature_ptr, creature_ptr->tim_regen - 1, TRUE);
1633 if (creature_ptr->tim_res_nether)
1635 (void)set_tim_res_nether(creature_ptr, creature_ptr->tim_res_nether - 1, TRUE);
1638 if (creature_ptr->tim_res_time)
1640 (void)set_tim_res_time(creature_ptr, creature_ptr->tim_res_time - 1, TRUE);
1643 if (creature_ptr->tim_reflect)
1645 (void)set_tim_reflect(creature_ptr, creature_ptr->tim_reflect - 1, TRUE);
1648 if (creature_ptr->multishadow)
1650 (void)set_multishadow(creature_ptr, creature_ptr->multishadow - 1, TRUE);
1653 if (creature_ptr->dustrobe)
1655 (void)set_dustrobe(creature_ptr, creature_ptr->dustrobe - 1, TRUE);
1658 if (creature_ptr->kabenuke)
1660 (void)set_kabenuke(creature_ptr, creature_ptr->kabenuke - 1, TRUE);
1663 if (creature_ptr->paralyzed)
1665 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed - dec_count);
1668 if (creature_ptr->confused)
1670 (void)set_confused(creature_ptr, creature_ptr->confused - dec_count);
1673 if (creature_ptr->afraid)
1675 (void)set_afraid(creature_ptr, creature_ptr->afraid - dec_count);
1678 if (creature_ptr->fast)
1680 (void)set_fast(creature_ptr, creature_ptr->fast - 1, TRUE);
1683 if (creature_ptr->slow)
1685 (void)set_slow(creature_ptr, creature_ptr->slow - dec_count, TRUE);
1688 if (creature_ptr->protevil)
1690 (void)set_protevil(creature_ptr, creature_ptr->protevil - 1, TRUE);
1693 if (creature_ptr->invuln)
1695 (void)set_invuln(creature_ptr, creature_ptr->invuln - 1, TRUE);
1698 if (creature_ptr->wraith_form)
1700 (void)set_wraith_form(creature_ptr, creature_ptr->wraith_form - 1, TRUE);
1703 if (creature_ptr->hero)
1705 (void)set_hero(creature_ptr, creature_ptr->hero - 1, TRUE);
1708 if (creature_ptr->shero)
1710 (void)set_shero(creature_ptr, creature_ptr->shero - 1, TRUE);
1713 if (creature_ptr->blessed)
1715 (void)set_blessed(creature_ptr, creature_ptr->blessed - 1, TRUE);
1718 if (creature_ptr->shield)
1720 (void)set_shield(creature_ptr, creature_ptr->shield - 1, TRUE);
1723 if (creature_ptr->tsubureru)
1725 (void)set_tsubureru(creature_ptr, creature_ptr->tsubureru - 1, TRUE);
1728 if (creature_ptr->magicdef)
1730 (void)set_magicdef(creature_ptr, creature_ptr->magicdef - 1, TRUE);
1733 if (creature_ptr->tsuyoshi)
1735 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi - 1, TRUE);
1738 if (creature_ptr->oppose_acid)
1740 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid - 1, TRUE);
1743 if (creature_ptr->oppose_elec)
1745 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec - 1, TRUE);
1748 if (creature_ptr->oppose_fire)
1750 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire - 1, TRUE);
1753 if (creature_ptr->oppose_cold)
1755 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold - 1, TRUE);
1758 if (creature_ptr->oppose_pois)
1760 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois - 1, TRUE);
1763 if (creature_ptr->ult_res)
1765 (void)set_ultimate_res(creature_ptr, creature_ptr->ult_res - 1, TRUE);
1768 if (creature_ptr->poisoned)
1770 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
1771 (void)set_poisoned(creature_ptr, creature_ptr->poisoned - adjust);
1774 if (creature_ptr->stun)
1776 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
1777 (void)set_stun(creature_ptr, creature_ptr->stun - adjust);
1780 if (creature_ptr->cut)
1782 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
1783 if (creature_ptr->cut > 1000) adjust = 0;
1784 (void)set_cut(creature_ptr, creature_ptr->cut - adjust);
1790 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
1791 * / Handle burning fuel every 10 game turns
1794 static void process_world_aux_light(player_type *creature_ptr)
1796 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1797 if (o_ptr->tval == TV_LITE)
1799 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
1801 if (o_ptr->name2 == EGO_LITE_LONG)
1803 if (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)) o_ptr->xtra4--;
1805 else o_ptr->xtra4--;
1807 notice_lite_change(creature_ptr, o_ptr);
1814 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
1815 * / Handle mutation effects once every 10 game turns
1818 static void process_world_aux_mutation(player_type *creature_ptr)
1820 if (!creature_ptr->muta2) return;
1821 if (creature_ptr->phase_out) return;
1822 if (creature_ptr->wild_mode) return;
1824 if ((creature_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
1826 disturb(creature_ptr, FALSE, TRUE);
1827 msg_print(_("ウガァァア!", "RAAAAGHH!"));
1828 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
1829 (void)set_shero(creature_ptr, 10 + randint1(creature_ptr->lev), FALSE);
1830 (void)set_afraid(creature_ptr, 0);
1833 if ((creature_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
1835 if (!creature_ptr->resist_fear)
1837 disturb(creature_ptr, FALSE, TRUE);
1838 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
1839 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
1843 if ((creature_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
1845 if (!creature_ptr->resist_nexus && !(creature_ptr->muta1 & MUT1_VTELEPORT) && !creature_ptr->anti_tele)
1847 disturb(creature_ptr, FALSE, TRUE);
1848 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
1850 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
1854 if ((creature_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
1856 if (!creature_ptr->resist_conf && !creature_ptr->resist_chaos)
1858 disturb(creature_ptr, FALSE, TRUE);
1859 creature_ptr->redraw |= PR_EXTRA;
1860 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
1863 if (!creature_ptr->resist_conf)
1865 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(20) + 15);
1868 if (!creature_ptr->resist_chaos)
1873 if (one_in_(3)) lose_all_info(creature_ptr);
1874 else wiz_dark(creature_ptr);
1875 (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
1876 wiz_dark(creature_ptr);
1877 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
1878 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!"));
1884 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
1885 (void)set_image(creature_ptr, creature_ptr->image + randint0(150) + 150);
1891 if ((creature_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
1893 if (!creature_ptr->resist_chaos)
1895 disturb(creature_ptr, FALSE, TRUE);
1896 creature_ptr->redraw |= PR_EXTRA;
1897 (void)set_image(creature_ptr, creature_ptr->image + randint0(50) + 20);
1901 if ((creature_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
1903 disturb(creature_ptr, FALSE, TRUE);
1904 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
1906 fire_ball(creature_ptr, GF_POIS, 0, creature_ptr->lev, 3);
1909 if ((creature_ptr->muta2 & MUT2_PROD_MANA) &&
1910 !creature_ptr->anti_magic && one_in_(9000))
1913 disturb(creature_ptr, FALSE, TRUE);
1914 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
1915 "Magical energy flows through you! You must release it!"));
1919 (void)get_hack_dir(creature_ptr, &dire);
1920 fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
1923 if ((creature_ptr->muta2 & MUT2_ATT_DEMON) && !creature_ptr->anti_magic && (randint1(6666) == 666))
1925 bool pet = one_in_(6);
1926 BIT_FLAGS mode = PM_ALLOW_GROUP;
1928 if (pet) mode |= PM_FORCE_PET;
1929 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
1931 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode))
1933 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
1934 disturb(creature_ptr, FALSE, TRUE);
1938 if ((creature_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
1940 disturb(creature_ptr, FALSE, TRUE);
1943 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
1945 if (creature_ptr->fast > 0)
1947 set_fast(creature_ptr, 0, TRUE);
1951 set_slow(creature_ptr, randint1(30) + 10, FALSE);
1956 msg_print(_("精力的になった気がする。", "You feel more energetic."));
1958 if (creature_ptr->slow > 0)
1960 set_slow(creature_ptr, 0, TRUE);
1964 set_fast(creature_ptr, randint1(30) + 10, FALSE);
1969 if ((creature_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
1971 disturb(creature_ptr, FALSE, TRUE);
1972 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
1974 banish_monsters(creature_ptr, 100);
1975 if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
1980 n = randint0(MAX_STORES);
1981 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
1983 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
1984 store_shuffle(creature_ptr, n);
1989 if ((creature_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
1993 msg_print(_("影につつまれた。", "A shadow passes over you."));
1996 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1998 hp_player(creature_ptr, 10);
2001 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2003 if (o_ptr->tval == TV_LITE)
2005 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2007 hp_player(creature_ptr, o_ptr->xtra4 / 20);
2009 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2010 notice_lite_change(creature_ptr, o_ptr);
2015 * Unlite the area (radius 10) around player and
2016 * do 50 points damage to every affected monster
2018 unlite_area(creature_ptr, 50, 10);
2021 if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000))
2023 bool pet = one_in_(3);
2024 BIT_FLAGS mode = PM_ALLOW_GROUP;
2026 if (pet) mode |= PM_FORCE_PET;
2027 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2029 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2031 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2032 disturb(creature_ptr, FALSE, TRUE);
2036 if ((creature_ptr->muta2 & MUT2_RAW_CHAOS) && !creature_ptr->anti_magic && one_in_(8000))
2038 disturb(creature_ptr, FALSE, TRUE);
2039 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2042 fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
2045 if ((creature_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2047 if (!lose_mutation(creature_ptr, 0))
2048 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2051 if ((creature_ptr->muta2 & MUT2_WRAITH) && !creature_ptr->anti_magic && one_in_(3000))
2053 disturb(creature_ptr, FALSE, TRUE);
2054 msg_print(_("非物質化した!", "You feel insubstantial!"));
2057 set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
2060 if ((creature_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2062 do_poly_wounds(creature_ptr);
2065 if ((creature_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2067 int which_stat = randint0(A_MAX);
2068 int sustained = FALSE;
2073 if (creature_ptr->sustain_str) sustained = TRUE;
2076 if (creature_ptr->sustain_int) sustained = TRUE;
2079 if (creature_ptr->sustain_wis) sustained = TRUE;
2082 if (creature_ptr->sustain_dex) sustained = TRUE;
2085 if (creature_ptr->sustain_con) sustained = TRUE;
2088 if (creature_ptr->sustain_chr) sustained = TRUE;
2091 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2097 disturb(creature_ptr, FALSE, TRUE);
2098 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2100 (void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
2104 if ((creature_ptr->muta2 & MUT2_ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000))
2106 bool pet = one_in_(5);
2107 BIT_FLAGS mode = PM_ALLOW_GROUP;
2109 if (pet) mode |= PM_FORCE_PET;
2110 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2112 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2114 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2115 disturb(creature_ptr, FALSE, TRUE);
2119 if ((creature_ptr->muta2 & MUT2_WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000))
2121 if (creature_ptr->tim_esp > 0)
2123 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2124 set_tim_esp(creature_ptr, 0, TRUE);
2128 msg_print(_("精神が広がった!", "Your mind expands!"));
2129 set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
2133 if ((creature_ptr->muta2 & MUT2_NAUSEA) && !creature_ptr->slow_digest && one_in_(9000))
2135 disturb(creature_ptr, FALSE, TRUE);
2136 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2138 set_food(creature_ptr, PY_FOOD_WEAK);
2139 if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
2140 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
2143 if ((creature_ptr->muta2 & MUT2_WALK_SHAD) && !creature_ptr->anti_magic && one_in_(12000) && !creature_ptr->current_floor_ptr->inside_arena)
2145 reserve_alter_reality(creature_ptr);
2148 if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2150 int danger_amount = 0;
2151 for (MONSTER_IDX monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
2153 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
2154 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2155 if (!monster_is_valid(m_ptr)) continue;
2157 if (r_ptr->level >= creature_ptr->lev)
2159 danger_amount += r_ptr->level - creature_ptr->lev + 1;
2163 if (danger_amount > 100)
2164 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2165 else if (danger_amount > 50)
2166 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2167 else if (danger_amount > 20)
2168 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2169 else if (danger_amount > 10)
2170 msg_print(_("心配な気がする!", "You feel paranoid!"));
2171 else if (danger_amount > 5)
2172 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2174 msg_print(_("寂しい気がする。", "You feel lonely."));
2177 if ((creature_ptr->muta2 & MUT2_INVULN) && !creature_ptr->anti_magic && one_in_(5000))
2179 disturb(creature_ptr, FALSE, TRUE);
2180 msg_print(_("無敵な気がする!", "You feel invincible!"));
2182 (void)set_invuln(creature_ptr, randint1(8) + 8, FALSE);
2185 if ((creature_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2187 MANA_POINT wounds = (MANA_POINT)(creature_ptr->mhp - creature_ptr->chp);
2191 HIT_POINT healing = creature_ptr->csp;
2192 if (healing > wounds) healing = wounds;
2194 hp_player(creature_ptr, healing);
2195 creature_ptr->csp -= healing;
2196 creature_ptr->redraw |= (PR_HP | PR_MANA);
2200 if ((creature_ptr->muta2 & MUT2_HP_TO_SP) && !creature_ptr->anti_magic && one_in_(4000))
2202 HIT_POINT wounds = (HIT_POINT)(creature_ptr->msp - creature_ptr->csp);
2206 HIT_POINT healing = creature_ptr->chp;
2207 if (healing > wounds) healing = wounds;
2209 creature_ptr->csp += healing;
2210 creature_ptr->redraw |= (PR_HP | PR_MANA);
2211 take_hit(creature_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2215 if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2217 INVENTORY_IDX slot = 0;
2218 object_type *o_ptr = NULL;
2220 disturb(creature_ptr, FALSE, TRUE);
2221 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2222 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
2225 if (has_melee_weapon(creature_ptr, INVEN_RARM))
2228 o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
2230 if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
2232 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2236 else if (has_melee_weapon(creature_ptr, INVEN_LARM))
2238 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2241 if (slot && !object_is_cursed(o_ptr))
2243 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2244 drop_from_inventory(creature_ptr, slot, 1);
2251 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2252 * / Handle curse effects once every 10 game turns
2255 static void process_world_aux_curse(player_type *creature_ptr)
2257 if ((creature_ptr->cursed & TRC_P_FLAG_MASK) && !creature_ptr->phase_out && !creature_ptr->wild_mode)
2260 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2261 * can actually be useful!
2263 if ((creature_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2265 GAME_TEXT o_name[MAX_NLEN];
2267 int i_keep = 0, count = 0;
2268 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
2270 BIT_FLAGS flgs[TR_FLAG_SIZE];
2271 o_ptr = &creature_ptr->inventory_list[i];
2272 if (!o_ptr->k_idx) continue;
2274 object_flags(o_ptr, flgs);
2276 if (have_flag(flgs, TR_TELEPORT))
2278 /* {.} will stop random teleportation. */
2279 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2282 if (one_in_(count)) i_keep = i;
2287 o_ptr = &creature_ptr->inventory_list[i_keep];
2288 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2289 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2290 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2292 disturb(creature_ptr, FALSE, TRUE);
2293 teleport_player(creature_ptr, 50, 0L);
2297 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2298 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2299 disturb(creature_ptr, TRUE, TRUE);
2303 if ((creature_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2306 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2308 disturb(creature_ptr, FALSE, FALSE);
2311 if ((creature_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2314 (void)activate_ty_curse(creature_ptr, FALSE, &count);
2317 if (creature_ptr->prace != RACE_ANDROID && ((creature_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2319 creature_ptr->exp -= (creature_ptr->lev + 1) / 2;
2320 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
2321 creature_ptr->max_exp -= (creature_ptr->lev + 1) / 2;
2322 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
2323 check_experience(creature_ptr);
2326 if ((creature_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2329 o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_L_CURSE);
2330 BIT_FLAGS new_curse = get_curse(0, o_ptr);
2331 if (!(o_ptr->curse_flags & new_curse))
2333 GAME_TEXT o_name[MAX_NLEN];
2334 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2335 o_ptr->curse_flags |= new_curse;
2336 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2337 o_ptr->feeling = FEEL_NONE;
2338 creature_ptr->update |= (PU_BONUS);
2342 if ((creature_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2345 o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_H_CURSE);
2346 BIT_FLAGS new_curse = get_curse(1, o_ptr);
2347 if (!(o_ptr->curse_flags & new_curse))
2349 GAME_TEXT o_name[MAX_NLEN];
2351 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2353 o_ptr->curse_flags |= new_curse;
2354 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2355 o_ptr->feeling = FEEL_NONE;
2357 creature_ptr->update |= (PU_BONUS);
2361 if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2363 if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2365 GAME_TEXT o_name[MAX_NLEN];
2366 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2367 msg_format(_("%sが動物を引き寄せた!", "Your %s has attracted an animal!"), o_name);
2368 disturb(creature_ptr, FALSE, TRUE);
2372 if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2374 if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2376 GAME_TEXT o_name[MAX_NLEN];
2377 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2378 msg_format(_("%sが悪魔を引き寄せた!", "Your %s has attracted a demon!"), o_name);
2379 disturb(creature_ptr, FALSE, TRUE);
2383 if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2385 if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
2386 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2388 GAME_TEXT o_name[MAX_NLEN];
2389 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2390 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s has attracted an dragon!"), o_name);
2391 disturb(creature_ptr, FALSE, TRUE);
2395 if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2397 if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
2398 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2400 GAME_TEXT o_name[MAX_NLEN];
2401 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2402 msg_format(_("%sが死霊を引き寄せた!", "Your %s has attracted an undead!"), o_name);
2403 disturb(creature_ptr, FALSE, TRUE);
2407 if ((creature_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2409 if (!creature_ptr->resist_fear)
2411 disturb(creature_ptr, FALSE, TRUE);
2412 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2413 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
2417 if ((creature_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !creature_ptr->anti_tele)
2419 disturb(creature_ptr, FALSE, TRUE);
2420 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
2423 if ((creature_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2425 GAME_TEXT o_name[MAX_NLEN];
2426 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2427 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2428 take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev * 2, 100), o_name, -1);
2431 if ((creature_ptr->cursed & TRC_DRAIN_MANA) && creature_ptr->csp && one_in_(666))
2433 GAME_TEXT o_name[MAX_NLEN];
2434 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2435 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2436 creature_ptr->csp -= MIN(creature_ptr->lev, 50);
2437 if (creature_ptr->csp < 0)
2439 creature_ptr->csp = 0;
2440 creature_ptr->csp_frac = 0;
2443 creature_ptr->redraw |= PR_MANA;
2447 if (one_in_(999) && !creature_ptr->anti_magic)
2449 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2450 if (o_ptr->name1 == ART_JUDGE)
2452 if (object_is_known(o_ptr))
2453 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2455 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2456 take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2463 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2464 * / Handle recharging objects once every 10 game turns
2467 static void process_world_aux_recharge(player_type *creature_ptr)
2472 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2474 object_type *o_ptr = &creature_ptr->inventory_list[i];
2475 if (!o_ptr->k_idx) continue;
2477 if (o_ptr->timeout > 0)
2480 if (!o_ptr->timeout)
2482 recharged_notice(creature_ptr, o_ptr);
2490 creature_ptr->window |= (PW_EQUIP);
2495 * Recharge rods. Rods now use timeout to control charging status,
2496 * and each charging rod in a stack decreases the stack's timeout by
2497 * one per turn. -LM-
2499 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2501 object_type *o_ptr = &creature_ptr->inventory_list[i];
2502 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2503 if (!o_ptr->k_idx) continue;
2505 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2507 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2508 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2510 o_ptr->timeout -= temp;
2511 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2513 if (!(o_ptr->timeout))
2515 recharged_notice(creature_ptr, o_ptr);
2518 else if (o_ptr->timeout % k_ptr->pval)
2527 creature_ptr->window |= (PW_INVEN);
2531 for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
2533 object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
2534 if (!OBJECT_IS_VALID(o_ptr)) continue;
2536 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2538 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2539 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2546 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2547 * / Handle involuntary movement once every 10 game turns
2550 static void process_world_aux_movement(player_type *creature_ptr)
2552 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2553 if (creature_ptr->word_recall)
2556 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2557 * The player is yanked up/down as soon as
2558 * he loads the autosaved game.
2560 if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
2561 do_cmd_save_game(creature_ptr, TRUE);
2563 creature_ptr->word_recall--;
2564 creature_ptr->redraw |= (PR_STATUS);
2565 if (!creature_ptr->word_recall)
2567 disturb(creature_ptr, FALSE, TRUE);
2568 if (floor_ptr->dun_level || creature_ptr->current_floor_ptr->inside_quest || creature_ptr->enter_dungeon)
2570 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2571 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
2573 exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
2575 floor_ptr->dun_level = 0;
2576 creature_ptr->dungeon_idx = 0;
2577 leave_quest_check(creature_ptr);
2578 leave_tower_check(creature_ptr);
2579 creature_ptr->current_floor_ptr->inside_quest = 0;
2580 creature_ptr->leaving = TRUE;
2584 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2585 creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
2587 exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
2589 floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
2590 if (floor_ptr->dun_level < 1) floor_ptr->dun_level = 1;
2591 if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND))
2593 if (floor_ptr->dun_level < 50)
2595 floor_ptr->dun_level *= 2;
2597 else if (floor_ptr->dun_level < 99)
2599 floor_ptr->dun_level = (floor_ptr->dun_level + 99) / 2;
2601 else if (floor_ptr->dun_level > 100)
2603 floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].maxdepth - 1;
2607 if (creature_ptr->wild_mode)
2609 creature_ptr->wilderness_y = creature_ptr->y;
2610 creature_ptr->wilderness_x = creature_ptr->x;
2614 creature_ptr->oldpx = creature_ptr->x;
2615 creature_ptr->oldpy = creature_ptr->y;
2618 creature_ptr->wild_mode = FALSE;
2621 * Clear all saved floors
2622 * and create a first saved floor
2624 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
2625 creature_ptr->leaving = TRUE;
2627 if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
2629 for (int i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2631 quest_type* const q_ptr = &quest[i];
2632 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2633 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2634 (q_ptr->level < floor_ptr->dun_level))
2636 q_ptr->status = QUEST_STATUS_FAILED;
2637 q_ptr->complev = (byte)creature_ptr->lev;
2639 q_ptr->comptime = current_world_ptr->play_time;
2640 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2646 sound(SOUND_TPLEVEL);
2650 if (creature_ptr->alter_reality)
2652 if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
2653 do_cmd_save_game(creature_ptr, TRUE);
2655 creature_ptr->alter_reality--;
2656 creature_ptr->redraw |= (PR_STATUS);
2657 if (!creature_ptr->alter_reality)
2659 disturb(creature_ptr, FALSE, TRUE);
2660 if (!quest_number(creature_ptr, floor_ptr->dun_level) && floor_ptr->dun_level)
2662 msg_print(_("世界が変わった!", "The world changes!"));
2665 * Clear all saved floors
2666 * and create a first saved floor
2668 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
2669 creature_ptr->leaving = TRUE;
2673 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
2676 sound(SOUND_TPLEVEL);
2683 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
2684 * / Handle certain things once every 10 game turns
2687 static void process_world(player_type *player_ptr)
2689 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
2690 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
2691 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
2694 extract_day_hour_min(player_ptr, &day, &hour, &min);
2695 update_dungeon_feeling(player_ptr);
2697 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
2698 floor_type *floor_ptr = player_ptr->current_floor_ptr;
2699 if (ironman_downward && (player_ptr->dungeon_idx != DUNGEON_ANGBAND && player_ptr->dungeon_idx != 0))
2701 floor_ptr->dun_level = 0;
2702 player_ptr->dungeon_idx = 0;
2703 prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
2704 floor_ptr->inside_arena = FALSE;
2705 player_ptr->wild_mode = FALSE;
2706 player_ptr->leaving = TRUE;
2709 if (player_ptr->phase_out && !player_ptr->leaving)
2713 for (int i2 = 0; i2 < floor_ptr->width; ++i2)
2715 for (int j2 = 0; j2 < floor_ptr->height; j2++)
2717 grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
2718 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
2721 win_m_idx = g_ptr->m_idx;
2726 if (number_mon == 0)
2728 msg_print(_("相打ちに終わりました。", "Nothing survived."));
2730 player_ptr->energy_need = 0;
2731 update_gambling_monsters(player_ptr);
2733 else if ((number_mon - 1) == 0)
2735 GAME_TEXT m_name[MAX_NLEN];
2736 monster_type *wm_ptr;
2737 wm_ptr = &floor_ptr->m_list[win_m_idx];
2738 monster_desc(player_ptr, m_name, wm_ptr, 0);
2739 msg_format(_("%sが勝利した!", "%s won!"), m_name);
2742 if (win_m_idx == (sel_monster + 1))
2744 msg_print(_("おめでとうございます。", "Congratulations."));
2745 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
2746 player_ptr->au += battle_odds;
2750 msg_print(_("残念でした。", "You lost gold."));
2754 player_ptr->energy_need = 0;
2755 update_gambling_monsters(player_ptr);
2757 else if (current_world_ptr->game_turn - floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
2759 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle ended in a draw."));
2760 player_ptr->au += kakekin;
2762 player_ptr->energy_need = 0;
2763 update_gambling_monsters(player_ptr);
2767 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
2769 if (autosave_t && autosave_freq && !player_ptr->phase_out)
2771 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2772 do_cmd_save_game(player_ptr, TRUE);
2775 if (floor_ptr->monster_noise && !ignore_unview)
2777 msg_print(_("何かが聞こえた。", "You hear noise."));
2780 if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
2782 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2784 bool dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
2785 if (dawn) day_break(player_ptr);
2786 else night_falls(player_ptr);
2790 else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
2792 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
2794 if (one_in_(STORE_SHUFFLE))
2799 n = randint0(MAX_STORES);
2800 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2802 for (FEAT_IDX i = 1; i < max_f_idx; i++)
2804 feature_type *f_ptr = &f_info[i];
2805 if (!f_ptr->name) continue;
2806 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
2808 if (f_ptr->subtype == n)
2811 msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
2813 store_shuffle(player_ptr, n);
2821 if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
2822 !floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
2824 (void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0);
2827 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out)
2828 regenerate_monsters(player_ptr);
2829 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3)))
2830 regenerate_captured_monsters(player_ptr);
2832 if (!player_ptr->leaving)
2834 for (int i = 0; i < MAX_MTIMED; i++)
2836 if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
2842 if (min != prev_min)
2844 exe_write_diary(player_ptr, DIARY_DIALY, 0, NULL);
2845 determine_daily_bounty(player_ptr, FALSE);
2850 * Nightmare mode activates the TY_CURSE at midnight
2851 * Require exact minute -- Don't activate multiple times in a minute
2853 if (ironman_nightmare && (min != prev_min))
2855 if ((hour == 23) && !(min % 15))
2857 disturb(player_ptr, FALSE, TRUE);
2861 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
2865 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
2869 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
2873 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
2880 disturb(player_ptr, TRUE, TRUE);
2881 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
2882 if (player_ptr->wild_mode)
2884 player_ptr->oldpy = randint1(MAX_HGT - 2);
2885 player_ptr->oldpx = randint1(MAX_WID - 2);
2886 change_wild_mode(player_ptr, TRUE);
2887 take_turn(player_ptr, 100);
2891 player_ptr->invoking_midnight_curse = TRUE;
2895 process_world_aux_digestion(player_ptr);
2896 process_world_aux_hp_and_sp(player_ptr);
2897 process_world_aux_timeout(player_ptr);
2898 process_world_aux_light(player_ptr);
2899 process_world_aux_mutation(player_ptr);
2900 process_world_aux_curse(player_ptr);
2901 process_world_aux_recharge(player_ptr);
2902 sense_inventory1(player_ptr);
2903 sense_inventory2(player_ptr);
2904 process_world_aux_movement(player_ptr);
2909 * @brief ウィザードモードへの導入処理
2910 * / Verify use of "wizard" mode
2911 * @param player_ptr プレーヤーへの参照ポインタ
2912 * @return 実際にウィザードモードへ移行したらTRUEを返す。
2914 static bool enter_wizard_mode(player_type *player_ptr)
2916 if (!current_world_ptr->noscore)
2918 if (!allow_debug_opts || arg_wizard)
2920 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
2924 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
2925 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
2927 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
2932 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
2933 current_world_ptr->noscore |= 0x0002;
2941 * @brief デバッグコマンドへの導入処理
2942 * / Verify use of "debug" commands
2943 * @param player_ptr プレーヤーへの参照ポインタ
2944 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
2946 static bool enter_debug_mode(player_type *player_ptr)
2948 if (!current_world_ptr->noscore)
2950 if (!allow_debug_opts)
2952 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
2956 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
2957 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
2959 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
2964 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
2965 current_world_ptr->noscore |= 0x0008;
2972 * todo これが多重インクルード問題の原因 (の1つ)かもしれない、wizard2.cに同名の関数が存在する
2973 * Hack -- Declare the Debug Routines
2975 extern void do_cmd_debug(player_type *creature_ptr);
2978 * @brief プレイヤーから受けた入力コマンドの分岐処理。
2979 * / Parse and execute the current command Give "Warning" on illegal commands.
2980 * @todo Make some "blocks"
2983 static void process_command(player_type *creature_ptr)
2985 COMMAND_CODE old_now_message = now_message;
2988 if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
2989 creature_ptr->reset_concent = TRUE;
2991 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2992 switch (command_cmd)
3003 /* todo 嘘。returnしていない
3010 if (current_world_ptr->wizard)
3012 current_world_ptr->wizard = FALSE;
3013 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3015 else if (enter_wizard_mode(creature_ptr))
3017 current_world_ptr->wizard = TRUE;
3018 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3020 creature_ptr->update |= (PU_MONSTERS);
3021 creature_ptr->redraw |= (PR_TITLE);
3027 if (enter_debug_mode(creature_ptr))
3029 do_cmd_debug(creature_ptr);
3035 if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
3040 if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
3045 if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
3050 do_cmd_destroy(creature_ptr);
3055 do_cmd_equip(creature_ptr);
3060 do_cmd_inven(creature_ptr);
3065 do_cmd_observe(creature_ptr);
3071 toggle_inventory_equipment(creature_ptr);
3076 if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
3081 if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
3086 do_cmd_walk(creature_ptr, FALSE);
3091 do_cmd_walk(creature_ptr, TRUE);
3096 if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
3101 do_cmd_stay(creature_ptr, always_pickup);
3106 do_cmd_stay(creature_ptr, !always_pickup);
3111 do_cmd_rest(creature_ptr);
3116 do_cmd_search(creature_ptr);
3121 if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
3122 else set_action(creature_ptr, ACTION_SEARCH);
3125 case SPECIAL_KEY_STORE:
3127 do_cmd_store(creature_ptr);
3130 case SPECIAL_KEY_BUILDING:
3132 do_cmd_bldg(creature_ptr);
3135 case SPECIAL_KEY_QUEST:
3137 do_cmd_quest(creature_ptr);
3142 if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
3144 if (vanilla_town) break;
3146 if (creature_ptr->ambush_flag)
3148 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3152 if (creature_ptr->food < PY_FOOD_WEAK)
3154 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3158 change_wild_mode(creature_ptr, FALSE);
3161 do_cmd_go_up(creature_ptr);
3167 if (creature_ptr->wild_mode)
3168 change_wild_mode(creature_ptr, FALSE);
3170 do_cmd_go_down(creature_ptr);
3175 do_cmd_open(creature_ptr);
3180 do_cmd_close(creature_ptr);
3185 do_cmd_spike(creature_ptr);
3190 do_cmd_bash(creature_ptr);
3195 do_cmd_disarm(creature_ptr);
3200 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
3201 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3202 else if (creature_ptr->pclass == CLASS_SAMURAI)
3203 do_cmd_gain_hissatsu(creature_ptr);
3204 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3205 import_magic_device(creature_ptr);
3207 do_cmd_study(creature_ptr);
3212 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3213 (creature_ptr->pclass == CLASS_BERSERKER) ||
3214 (creature_ptr->pclass == CLASS_NINJA) ||
3215 (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3216 ) do_cmd_mind_browse(creature_ptr);
3217 else if (creature_ptr->pclass == CLASS_SMITH)
3218 do_cmd_kaji(creature_ptr, TRUE);
3219 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3220 do_cmd_magic_eater(creature_ptr, TRUE, FALSE);
3221 else if (creature_ptr->pclass == CLASS_SNIPER)
3222 do_cmd_snipe_browse(creature_ptr);
3223 else do_cmd_browse(creature_ptr);
3228 if (!creature_ptr->wild_mode)
3230 if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
3232 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3234 else if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
3236 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3239 else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
3241 concptr which_power = _("魔法", "magic");
3242 if (creature_ptr->pclass == CLASS_MINDCRAFTER)
3243 which_power = _("超能力", "psionic powers");
3244 else if (creature_ptr->pclass == CLASS_IMITATOR)
3245 which_power = _("ものまね", "imitation");
3246 else if (creature_ptr->pclass == CLASS_SAMURAI)
3247 which_power = _("必殺剣", "hissatsu");
3248 else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3249 which_power = _("鏡魔法", "mirror magic");
3250 else if (creature_ptr->pclass == CLASS_NINJA)
3251 which_power = _("忍術", "ninjutsu");
3252 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3253 which_power = _("祈り", "prayer");
3255 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3256 free_turn(creature_ptr);
3258 else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
3260 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3261 free_turn(creature_ptr);
3265 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3266 (creature_ptr->pclass == CLASS_BERSERKER) ||
3267 (creature_ptr->pclass == CLASS_NINJA) ||
3268 (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3270 do_cmd_mind(creature_ptr);
3271 else if (creature_ptr->pclass == CLASS_IMITATOR)
3272 do_cmd_mane(creature_ptr, FALSE);
3273 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3274 do_cmd_magic_eater(creature_ptr, FALSE, FALSE);
3275 else if (creature_ptr->pclass == CLASS_SAMURAI)
3276 do_cmd_hissatsu(creature_ptr);
3277 else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
3278 do_cmd_cast_learned(creature_ptr);
3279 else if (creature_ptr->pclass == CLASS_SMITH)
3280 do_cmd_kaji(creature_ptr, FALSE);
3281 else if (creature_ptr->pclass == CLASS_SNIPER)
3282 do_cmd_snipe(creature_ptr);
3284 do_cmd_cast(creature_ptr);
3292 do_cmd_pet(creature_ptr);
3297 do_cmd_inscribe(creature_ptr);
3302 do_cmd_uninscribe(creature_ptr);
3307 do_cmd_activate(creature_ptr);
3312 do_cmd_eat_food(creature_ptr);
3317 do_cmd_refill(creature_ptr);
3322 do_cmd_fire(creature_ptr, SP_NONE);
3327 do_cmd_throw(creature_ptr, 1, FALSE, -1);
3332 do_cmd_aim_wand(creature_ptr);
3337 if (use_command && rogue_like_commands)
3339 do_cmd_use(creature_ptr);
3343 do_cmd_zap_rod(creature_ptr);
3349 do_cmd_quaff_potion(creature_ptr);
3354 do_cmd_read_scroll(creature_ptr);
3359 if (use_command && !rogue_like_commands)
3360 do_cmd_use(creature_ptr);
3362 do_cmd_use_staff(creature_ptr);
3367 do_cmd_racial_power(creature_ptr);
3372 do_cmd_view_map(creature_ptr);
3377 do_cmd_locate(creature_ptr);
3382 do_cmd_look(creature_ptr);
3387 do_cmd_target(creature_ptr);
3392 do_cmd_help(creature_ptr);
3397 do_cmd_query_symbol(creature_ptr);
3402 do_cmd_player_status(creature_ptr);
3412 do_cmd_pref(creature_ptr);
3417 do_cmd_reload_autopick(creature_ptr);
3422 do_cmd_edit_autopick(creature_ptr);
3427 do_cmd_macros(creature_ptr);
3432 do_cmd_visuals(creature_ptr);
3433 do_cmd_redraw(creature_ptr);
3438 do_cmd_colors(creature_ptr);
3439 do_cmd_redraw(creature_ptr);
3445 (void)combine_and_reorder_home(STORE_HOME);
3446 do_cmd_redraw(creature_ptr);
3461 do_cmd_feeling(creature_ptr);
3466 do_cmd_message_one();
3471 do_cmd_messages(old_now_message);
3476 do_cmd_checkquest(creature_ptr);
3481 now_message = old_now_message;
3482 do_cmd_redraw(creature_ptr);
3487 do_cmd_save_game(creature_ptr, FALSE);
3492 do_cmd_time(creature_ptr);
3496 case SPECIAL_KEY_QUIT:
3498 do_cmd_save_and_exit(creature_ptr);
3503 do_cmd_suicide(creature_ptr);
3508 do_cmd_diary(creature_ptr);
3513 do_cmd_knowledge(creature_ptr);
3518 do_cmd_load_screen();
3523 do_cmd_save_screen(creature_ptr);
3528 prepare_movie_hooks();
3533 spoil_random_artifact(creature_ptr, "randifact.txt");
3538 if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
3539 if (creature_ptr->special_defense & KATA_MUSOU)
3541 set_action(creature_ptr, ACTION_NONE);
3547 if (flush_failure) flush();
3551 sound(SOUND_ILLEGAL);
3552 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
3557 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
3564 if (!creature_ptr->energy_use && !now_message)
3565 now_message = old_now_message;
3570 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
3573 static void pack_overflow(player_type *owner_ptr)
3575 if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0) return;
3577 GAME_TEXT o_name[MAX_NLEN];
3579 update_creature(owner_ptr);
3580 if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
3582 o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
3583 disturb(owner_ptr, FALSE, TRUE);
3584 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
3586 object_desc(owner_ptr, o_name, o_ptr, 0);
3587 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
3588 (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
3590 vary_item(owner_ptr, INVEN_PACK, -255);
3591 handle_stuff(owner_ptr);
3596 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
3599 static void process_upkeep_with_speed(player_type *creature_ptr)
3601 if (!load && creature_ptr->enchant_energy_need > 0 && !creature_ptr->leaving)
3603 creature_ptr->enchant_energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
3606 if (creature_ptr->enchant_energy_need > 0) return;
3608 while (creature_ptr->enchant_energy_need <= 0)
3610 if (!load) check_music(creature_ptr);
3611 if (!load) check_hex(creature_ptr);
3612 if (!load) revenge_spell(creature_ptr);
3614 creature_ptr->enchant_energy_need += ENERGY_NEED();
3619 static void process_fishing(player_type *creature_ptr)
3621 Term_xtra(TERM_XTRA_DELAY, 10);
3625 bool success = FALSE;
3626 get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
3627 r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
3629 if (r_idx && one_in_(2))
3632 y = creature_ptr->y + ddy[creature_ptr->fishing_dir];
3633 x = creature_ptr->x + ddx[creature_ptr->fishing_dir];
3634 if (place_monster_aux(creature_ptr, 0, y, x, r_idx, PM_NO_KAGE))
3636 GAME_TEXT m_name[MAX_NLEN];
3637 monster_desc(creature_ptr, m_name, &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0);
3638 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
3645 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
3648 disturb(creature_ptr, FALSE, TRUE);
3654 * @brief プレイヤーの行動処理 / Process the player
3657 * Notice the annoying code to handle "pack overflow", which\n
3658 * must come first just in case somebody manages to corrupt\n
3659 * the savefiles by clever use of menu commands or something.\n
3661 static void process_player(player_type *creature_ptr)
3663 if (creature_ptr->hack_mutation)
3665 msg_print(_("何か変わった気がする!", "You feel different!"));
3667 (void)gain_mutation(creature_ptr, 0);
3668 creature_ptr->hack_mutation = FALSE;
3671 if (creature_ptr->invoking_midnight_curse)
3674 activate_ty_curse(creature_ptr, FALSE, &count);
3675 creature_ptr->invoking_midnight_curse = FALSE;
3678 if (creature_ptr->phase_out)
3680 for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
3682 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
3683 if (!monster_is_valid(m_ptr)) continue;
3685 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
3686 update_monster(creature_ptr, m_idx, FALSE);
3689 print_time(creature_ptr);
3691 else if (!(load && creature_ptr->energy_need <= 0))
3693 creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
3696 if (creature_ptr->energy_need > 0) return;
3697 if (!command_rep) print_time(creature_ptr);
3699 if (creature_ptr->resting < 0)
3701 if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
3703 if ((creature_ptr->chp == creature_ptr->mhp) &&
3704 (creature_ptr->csp >= creature_ptr->msp))
3706 set_action(creature_ptr, ACTION_NONE);
3709 else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
3711 if ((creature_ptr->chp == creature_ptr->mhp) &&
3712 (creature_ptr->csp >= creature_ptr->msp) &&
3713 !creature_ptr->blind && !creature_ptr->confused &&
3714 !creature_ptr->poisoned && !creature_ptr->afraid &&
3715 !creature_ptr->stun && !creature_ptr->cut &&
3716 !creature_ptr->slow && !creature_ptr->paralyzed &&
3717 !creature_ptr->image && !creature_ptr->word_recall &&
3718 !creature_ptr->alter_reality)
3720 set_action(creature_ptr, ACTION_NONE);
3725 if (creature_ptr->action == ACTION_FISH) process_fishing(creature_ptr);
3729 if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
3735 disturb(creature_ptr, FALSE, TRUE);
3736 msg_print(_("中断しました。", "Canceled."));
3741 if (creature_ptr->riding && !creature_ptr->confused && !creature_ptr->blind)
3743 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
3744 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3745 if (MON_CSLEEP(m_ptr))
3747 GAME_TEXT m_name[MAX_NLEN];
3748 (void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
3749 monster_desc(creature_ptr, m_name, m_ptr, 0);
3750 msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
3753 if (MON_STUNNED(m_ptr))
3755 if (set_monster_stunned(creature_ptr, creature_ptr->riding,
3756 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
3758 GAME_TEXT m_name[MAX_NLEN];
3759 monster_desc(creature_ptr, m_name, m_ptr, 0);
3760 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
3764 if (MON_CONFUSED(m_ptr))
3766 if (set_monster_confused(creature_ptr, creature_ptr->riding,
3767 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
3769 GAME_TEXT m_name[MAX_NLEN];
3770 monster_desc(creature_ptr, m_name, m_ptr, 0);
3771 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
3775 if (MON_MONFEAR(m_ptr))
3777 if (set_monster_monfear(creature_ptr, creature_ptr->riding,
3778 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
3780 GAME_TEXT m_name[MAX_NLEN];
3781 monster_desc(creature_ptr, m_name, m_ptr, 0);
3782 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer afraid."), m_name);
3786 handle_stuff(creature_ptr);
3790 if (creature_ptr->lightspeed)
3792 (void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
3795 if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
3797 if (P_PTR_KI < 40) P_PTR_KI = 0;
3798 else P_PTR_KI -= 40;
3799 creature_ptr->update |= (PU_BONUS);
3802 if (creature_ptr->action == ACTION_LEARN)
3805 u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
3806 s64b_LSHIFT(cost, cost_frac, 16);
3807 if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
3809 creature_ptr->csp = 0;
3810 creature_ptr->csp_frac = 0;
3811 set_action(creature_ptr, ACTION_NONE);
3815 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
3818 creature_ptr->redraw |= PR_MANA;
3821 if (creature_ptr->special_defense & KATA_MASK)
3823 if (creature_ptr->special_defense & KATA_MUSOU)
3825 if (creature_ptr->csp < 3)
3827 set_action(creature_ptr, ACTION_NONE);
3831 creature_ptr->csp -= 2;
3832 creature_ptr->redraw |= (PR_MANA);
3837 /*** Handle actual user input ***/
3838 while (creature_ptr->energy_need <= 0)
3840 creature_ptr->window |= PW_PLAYER;
3841 creature_ptr->sutemi = FALSE;
3842 creature_ptr->counter = FALSE;
3843 creature_ptr->now_damaged = FALSE;
3845 handle_stuff(creature_ptr);
3846 move_cursor_relative(creature_ptr->y, creature_ptr->x);
3847 if (fresh_before) Term_fresh();
3849 pack_overflow(creature_ptr);
3850 if (!command_new) command_see = FALSE;
3852 free_turn(creature_ptr);
3853 if (creature_ptr->phase_out)
3855 move_cursor_relative(creature_ptr->y, creature_ptr->x);
3856 command_cmd = SPECIAL_KEY_BUILDING;
3857 process_command(creature_ptr);
3859 else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
3861 take_turn(creature_ptr, 100);
3863 else if (creature_ptr->action == ACTION_REST)
3865 if (creature_ptr->resting > 0)
3867 creature_ptr->resting--;
3868 if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
3869 creature_ptr->redraw |= (PR_STATE);
3872 take_turn(creature_ptr, 100);
3874 else if (creature_ptr->action == ACTION_FISH)
3876 take_turn(creature_ptr, 100);
3878 else if (creature_ptr->running)
3880 run_step(creature_ptr, 0);
3882 else if (travel.run)
3884 travel_step(creature_ptr);
3886 else if (command_rep)
3889 creature_ptr->redraw |= (PR_STATE);
3890 handle_stuff(creature_ptr);
3893 process_command(creature_ptr);
3897 move_cursor_relative(creature_ptr->y, creature_ptr->x);
3899 request_command(creature_ptr, FALSE);
3901 process_command(creature_ptr);
3904 pack_overflow(creature_ptr);
3905 if (creature_ptr->energy_use)
3907 if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
3909 creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
3913 creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
3916 if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
3918 for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
3920 monster_type *m_ptr;
3921 monster_race *r_ptr;
3922 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
3923 if (!monster_is_valid(m_ptr)) continue;
3924 if (!m_ptr->ml) continue;
3926 r_ptr = &r_info[m_ptr->ap_r_idx];
3927 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
3930 lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
3933 if (repair_monsters)
3935 repair_monsters = FALSE;
3936 for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
3938 monster_type *m_ptr;
3939 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
3940 if (!monster_is_valid(m_ptr)) continue;
3942 if (m_ptr->mflag & MFLAG_NICE)
3944 m_ptr->mflag &= ~(MFLAG_NICE);
3947 if (m_ptr->mflag2 & MFLAG2_MARK)
3949 if (m_ptr->mflag2 & MFLAG2_SHOW)
3951 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
3952 repair_monsters = TRUE;
3956 m_ptr->mflag2 &= ~(MFLAG2_MARK);
3958 update_monster(creature_ptr, m_idx, FALSE);
3959 if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
3960 if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
3962 lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
3968 if (creature_ptr->pclass == CLASS_IMITATOR)
3970 if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
3972 creature_ptr->mane_num--;
3973 for (int j = 0; j < creature_ptr->mane_num; j++)
3975 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
3976 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
3980 creature_ptr->new_mane = FALSE;
3981 creature_ptr->redraw |= (PR_IMITATION);
3984 if (creature_ptr->action == ACTION_LEARN)
3986 creature_ptr->new_mane = FALSE;
3987 creature_ptr->redraw |= (PR_STATE);
3990 if (creature_ptr->timewalk && (creature_ptr->energy_need > -1000))
3993 creature_ptr->redraw |= (PR_MAP);
3994 creature_ptr->update |= (PU_MONSTERS);
3995 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3997 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
3999 creature_ptr->timewalk = FALSE;
4000 creature_ptr->energy_need = ENERGY_NEED();
4002 handle_stuff(creature_ptr);
4006 if (!creature_ptr->playing || creature_ptr->is_dead)
4008 creature_ptr->timewalk = FALSE;
4012 if (creature_ptr->energy_use && creature_ptr->reset_concent)
4013 reset_concentration(creature_ptr, TRUE);
4015 if (creature_ptr->leaving) break;
4018 update_smell(creature_ptr->current_floor_ptr, creature_ptr);
4023 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4027 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4028 * ゲームを終了するかのいずれかまでループする。
4031 * This function will not exit until the level is completed,\n
4032 * the user dies, or the game is terminated.\n
4035 static void dungeon(player_type *player_ptr, bool load_game)
4037 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4038 floor_ptr->base_level = floor_ptr->dun_level;
4039 current_world_ptr->is_loading_now = FALSE;
4040 player_ptr->leaving = FALSE;
4048 player_ptr->pet_t_m_idx = 0;
4049 player_ptr->riding_t_m_idx = 0;
4050 player_ptr->ambush_flag = FALSE;
4051 health_track(player_ptr, 0);
4052 repair_monsters = TRUE;
4053 repair_objects = TRUE;
4055 disturb(player_ptr, TRUE, TRUE);
4056 int quest_num = quest_num = quest_number(player_ptr, floor_ptr->dun_level);
4059 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4062 if (player_ptr->max_plv < player_ptr->lev)
4064 player_ptr->max_plv = player_ptr->lev;
4067 if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
4069 max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
4070 if (record_maxdepth) exe_write_diary(player_ptr, DIARY_MAXDEAPTH, floor_ptr->dun_level, NULL);
4073 (void)calculate_upkeep(player_ptr);
4074 panel_bounds_center();
4075 verify_panel(player_ptr);
4078 current_world_ptr->character_xtra = TRUE;
4079 player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4080 player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4081 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
4082 handle_stuff(player_ptr);
4084 current_world_ptr->character_xtra = FALSE;
4085 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4086 player_ptr->update |= (PU_COMBINE | PU_REORDER);
4087 handle_stuff(player_ptr);
4090 if (quest_num && (is_fixed_quest_idx(quest_num) &&
4091 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
4092 !(quest[quest_num].flags & QUEST_FLAG_PRESET))))
4093 do_cmd_feeling(player_ptr);
4095 if (player_ptr->phase_out)
4099 player_ptr->energy_need = 0;
4100 update_gambling_monsters(player_ptr);
4104 msg_print(_("試合開始!", "Ready..Fight!"));
4109 if ((player_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(player_ptr) > MUSIC_DETECT))
4110 SINGING_SONG_EFFECT(player_ptr) = MUSIC_DETECT;
4112 if (!player_ptr->playing || player_ptr->is_dead) return;
4114 if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
4116 quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
4117 floor_ptr->inside_quest = random_quest_number(player_ptr, floor_ptr->dun_level);
4119 if ((floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
4121 if (r_info[d_info[player_ptr->dungeon_idx].final_guardian].max_num)
4123 msg_format("この階には%sの主である%sが棲んでいる。",
4124 d_name + d_info[player_ptr->dungeon_idx].name,
4125 r_name + r_info[d_info[player_ptr->dungeon_idx].final_guardian].name);
4127 msg_format("%^s lives in this level as the keeper of %s.",
4128 r_name + r_info[d_info[player_ptr->dungeon_idx].final_guardian].name,
4129 d_name + d_info[player_ptr->dungeon_idx].name);
4133 if (!load_game && (player_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(player_ptr, FALSE);
4135 floor_ptr->monster_level = floor_ptr->base_level;
4136 floor_ptr->object_level = floor_ptr->base_level;
4137 current_world_ptr->is_loading_now = TRUE;
4138 if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
4139 (floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
4140 player_ptr->energy_need = 0;
4142 player_ptr->leaving_dungeon = FALSE;
4143 mproc_init(floor_ptr);
4147 if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out)
4148 compact_monsters(player_ptr, 64);
4150 if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out)
4151 compact_monsters(player_ptr, 0);
4153 if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx)
4154 compact_objects(player_ptr, 64);
4156 if (floor_ptr->o_cnt + 32 < floor_ptr->o_max)
4157 compact_objects(player_ptr, 0);
4159 process_player(player_ptr);
4160 process_upkeep_with_speed(player_ptr);
4161 handle_stuff(player_ptr);
4163 move_cursor_relative(player_ptr->y, player_ptr->x);
4164 if (fresh_after) Term_fresh();
4166 if (!player_ptr->playing || player_ptr->is_dead) break;
4168 process_monsters(player_ptr);
4169 handle_stuff(player_ptr);
4171 move_cursor_relative(player_ptr->y, player_ptr->x);
4172 if (fresh_after) Term_fresh();
4174 if (!player_ptr->playing || player_ptr->is_dead) break;
4176 process_world(player_ptr);
4177 handle_stuff(player_ptr);
4179 move_cursor_relative(player_ptr->y, player_ptr->x);
4180 if (fresh_after) Term_fresh();
4182 if (!player_ptr->playing || player_ptr->is_dead) break;
4184 current_world_ptr->game_turn++;
4185 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
4187 if (!player_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
4188 else if (player_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
4191 prevent_turn_overflow(player_ptr);
4193 if (player_ptr->leaving) break;
4195 if (wild_regen) wild_regen--;
4198 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
4200 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
4203 if (player_ptr->playing && !player_ptr->is_dead)
4206 * Maintain Unique monsters and artifact, save current
4207 * floor, then prepare next floor
4209 leave_floor(player_ptr);
4210 reinit_wilderness = FALSE;
4218 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
4219 * @paaram player_ptr プレーヤーへの参照ポインタ
4222 * Modified by Arcum Dagsson to support
4223 * separate macro files for different realms.
4225 static void load_all_pref_files(player_type *player_ptr)
4228 sprintf(buf, "user.prf");
4229 process_pref_file(player_ptr, buf);
4230 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
4231 process_pref_file(player_ptr, buf);
4232 sprintf(buf, "%s.prf", rp_ptr->title);
4233 process_pref_file(player_ptr, buf);
4234 sprintf(buf, "%s.prf", cp_ptr->title);
4235 process_pref_file(player_ptr, buf);
4236 sprintf(buf, "%s.prf", player_ptr->base_name);
4237 process_pref_file(player_ptr, buf);
4238 if (player_ptr->realm1 != REALM_NONE)
4240 sprintf(buf, "%s.prf", realm_names[player_ptr->realm1]);
4241 process_pref_file(player_ptr, buf);
4244 if (player_ptr->realm2 != REALM_NONE)
4246 sprintf(buf, "%s.prf", realm_names[player_ptr->realm2]);
4247 process_pref_file(player_ptr, buf);
4250 autopick_load_pref(player_ptr, FALSE);
4255 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
4258 * If the "new_game" parameter is true, then, after loading the
4259 * savefile, we will commit suicide, if necessary, to allow the
4260 * player to start a new game.
4262 void play_game(player_type *player_ptr, bool new_game)
4264 bool load_game = TRUE;
4265 bool init_random_seed = FALSE;
4275 else if (chuukei_server)
4277 prepare_chuukei_hooks();
4283 reset_visuals(player_ptr);
4288 player_ptr->hack_mutation = FALSE;
4289 current_world_ptr->character_icky = TRUE;
4290 Term_activate(angband_term[0]);
4291 angband_term[0]->resize_hook = resize_map;
4292 for (MONSTER_IDX i = 1; i < 8; i++)
4294 if (angband_term[i])
4296 angband_term[i]->resize_hook = redraw_window;
4300 (void)Term_set_cursor(0);
4301 if (!load_player(player_ptr))
4303 quit(_("セーブファイルが壊れています", "broken savefile"));
4306 extract_option_vars();
4307 if (player_ptr->wait_report_score)
4312 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
4315 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4316 update_creature(player_ptr);
4317 player_ptr->is_dead = TRUE;
4318 current_world_ptr->start_time = (u32b)time(NULL);
4319 signals_ignore_tstp();
4320 current_world_ptr->character_icky = TRUE;
4321 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
4322 highscore_fd = fd_open(buf, O_RDWR);
4324 /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
4325 process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
4326 success = send_world_score(player_ptr, TRUE);
4328 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
4330 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
4335 player_ptr->wait_report_score = FALSE;
4336 top_twenty(player_ptr);
4337 if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
4340 (void)fd_close(highscore_fd);
4342 signals_handle_tstp();
4347 current_world_ptr->creating_savefile = new_game;
4349 if (!current_world_ptr->character_loaded)
4352 current_world_ptr->character_dungeon = FALSE;
4353 init_random_seed = TRUE;
4354 init_saved_floors(player_ptr, FALSE);
4358 init_saved_floors(player_ptr, TRUE);
4363 process_player_name(player_ptr, FALSE);
4366 if (init_random_seed)
4371 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4374 current_world_ptr->character_dungeon = FALSE;
4376 floor_ptr->dun_level = 0;
4377 floor_ptr->inside_quest = 0;
4378 floor_ptr->inside_arena = FALSE;
4379 player_ptr->phase_out = FALSE;
4382 current_world_ptr->seed_flavor = randint0(0x10000000);
4383 current_world_ptr->seed_town = randint0(0x10000000);
4385 player_birth(player_ptr);
4386 counts_write(player_ptr, 2, 0);
4387 player_ptr->count = 0;
4389 determine_bounty_uniques(player_ptr);
4390 determine_daily_bounty(player_ptr, FALSE);
4391 wipe_o_list(floor_ptr);
4395 write_level = FALSE;
4396 exe_write_diary(player_ptr, DIARY_GAMESTART, 1,
4398 " ---- Restart Game ----"));
4401 * todo もう2.2.Xなので互換性は打ち切ってもいいのでは?
4402 * 1.0.9 以前はセーブ前に player_ptr->riding = -1 としていたので、再設定が必要だった。
4403 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
4405 if (player_ptr->riding == -1)
4407 player_ptr->riding = 0;
4408 for (MONSTER_IDX i = floor_ptr->m_max; i > 0; i--)
4410 if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
4412 player_ptr->riding = i;
4419 current_world_ptr->creating_savefile = FALSE;
4421 player_ptr->teleport_town = FALSE;
4422 player_ptr->sutemi = FALSE;
4423 current_world_ptr->timewalk_m_idx = 0;
4424 player_ptr->now_damaged = FALSE;
4426 current_world_ptr->start_time = time(NULL) - 1;
4427 record_o_name[0] = '\0';
4429 panel_row_min = floor_ptr->height;
4430 panel_col_min = floor_ptr->width;
4431 if (player_ptr->pseikaku == SEIKAKU_SEXY)
4432 s_info[player_ptr->pclass].w_max[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
4434 set_floor_and_wall(player_ptr->dungeon_idx);
4436 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
4441 if (enter_wizard_mode(player_ptr))
4443 current_world_ptr->wizard = TRUE;
4445 if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
4447 init_saved_floors(player_ptr, TRUE);
4448 floor_ptr->inside_quest = 0;
4449 player_ptr->y = player_ptr->x = 10;
4452 else if (player_ptr->is_dead)
4454 quit("Already dead.");
4458 if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
4460 process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
4461 init_flags = INIT_ONLY_BUILDINGS;
4462 process_dungeon_file(player_ptr, "t_info.txt", 0, 0, MAX_HGT, MAX_WID);
4463 select_floor_music(player_ptr);
4466 if (!current_world_ptr->character_dungeon)
4468 change_floor(player_ptr);
4472 if (player_ptr->panic_save)
4474 if (!player_ptr->y || !player_ptr->x)
4476 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location, regenerate the dungeon floor."));
4477 change_floor(player_ptr);
4480 if (!player_ptr->y || !player_ptr->x) player_ptr->y = player_ptr->x = 10;
4482 player_ptr->panic_save = 0;
4486 current_world_ptr->character_generated = TRUE;
4487 current_world_ptr->character_icky = FALSE;
4492 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name(player_ptr));
4493 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, buf);
4496 player_ptr->playing = TRUE;
4497 reset_visuals(player_ptr);
4498 load_all_pref_files(player_ptr);
4501 player_outfit(player_ptr);
4504 Term_xtra(TERM_XTRA_REACT, 0);
4506 player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
4507 player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
4508 handle_stuff(player_ptr);
4510 if (arg_force_original) rogue_like_commands = FALSE;
4511 if (arg_force_roguelike) rogue_like_commands = TRUE;
4513 if (player_ptr->chp < 0) player_ptr->is_dead = TRUE;
4515 if (player_ptr->prace == RACE_ANDROID) calc_android_exp(player_ptr);
4517 if (new_game && ((player_ptr->pclass == CLASS_CAVALRY) || (player_ptr->pclass == CLASS_BEASTMASTER)))
4519 monster_type *m_ptr;
4520 MONRACE_IDX pet_r_idx = ((player_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
4521 monster_race *r_ptr = &r_info[pet_r_idx];
4522 place_monster_aux(player_ptr, 0, player_ptr->y, player_ptr->x - 1, pet_r_idx,
4523 (PM_FORCE_PET | PM_NO_KAGE));
4524 m_ptr = &floor_ptr->m_list[hack_m_idx_ii];
4525 m_ptr->mspeed = r_ptr->speed;
4526 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside + 1) / 2;
4527 m_ptr->max_maxhp = m_ptr->maxhp;
4528 m_ptr->hp = r_ptr->hdice*(r_ptr->hside + 1) / 2;
4529 m_ptr->dealt_damage = 0;
4530 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
4533 (void)combine_and_reorder_home(STORE_HOME);
4534 (void)combine_and_reorder_home(STORE_MUSEUM);
4535 select_floor_music(player_ptr);
4539 dungeon(player_ptr, load_game);
4540 current_world_ptr->character_xtra = TRUE;
4541 handle_stuff(player_ptr);
4543 current_world_ptr->character_xtra = FALSE;
4545 health_track(player_ptr, 0);
4546 forget_lite(floor_ptr);
4547 forget_view(floor_ptr);
4548 clear_mon_lite(floor_ptr);
4549 if (!player_ptr->playing && !player_ptr->is_dead) break;
4551 wipe_o_list(floor_ptr);
4552 if (!player_ptr->is_dead) wipe_monsters_list(player_ptr);
4556 if (player_ptr->playing && player_ptr->is_dead)
4558 if (floor_ptr->inside_arena)
4560 floor_ptr->inside_arena = FALSE;
4561 if (player_ptr->arena_number > MAX_ARENA_MONS)
4562 player_ptr->arena_number++;
4564 player_ptr->arena_number = -1 - player_ptr->arena_number;
4565 player_ptr->is_dead = FALSE;
4566 player_ptr->chp = 0;
4567 player_ptr->chp_frac = 0;
4568 player_ptr->exit_bldg = TRUE;
4569 reset_tim_flags(player_ptr);
4570 prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
4571 leave_floor(player_ptr);
4575 if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
4577 cheat_death(player_ptr);
4582 if (player_ptr->is_dead) break;
4584 change_floor(player_ptr);
4587 close_game(player_ptr);
4593 * @brief ゲームターンからの実時間換算を行うための補正をかける
4594 * @param hoge ゲームターン
4595 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
4596 * @return 修正をかけた後のゲームターン
4598 s32b turn_real(player_type *player_ptr, s32b hoge)
4600 switch (player_ptr->start_race)
4606 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
4614 * @brief ターンのオーバーフローに対する対処
4615 * @param player_ptr プレーヤーへの参照ポインタ
4616 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
4617 * @return 修正をかけた後のゲームターン
4619 void prevent_turn_overflow(player_type *player_ptr)
4621 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
4623 int rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
4624 s32b rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
4626 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
4627 else current_world_ptr->game_turn = 1;
4628 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4629 if (floor_ptr->generated_turn > rollback_turns) floor_ptr->generated_turn -= rollback_turns;
4630 else floor_ptr->generated_turn = 1;
4631 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
4632 else current_world_ptr->arena_start_turn = 1;
4633 if (player_ptr->feeling_turn > rollback_turns) player_ptr->feeling_turn -= rollback_turns;
4634 else player_ptr->feeling_turn = 1;
4636 for (int i = 1; i < max_towns; i++)
4638 for (int j = 0; j < MAX_STORES; j++)
4640 store_type *st_ptr = &town_info[i].store[j];
4642 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
4644 st_ptr->last_visit -= rollback_turns;
4645 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
4648 if (st_ptr->store_open)
4650 st_ptr->store_open -= rollback_turns;
4651 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
4660 * Close up the current game (player may or may not be dead)
4661 * @param creature_ptr プレーヤーへの参照ポインタ
4665 * This function is called only from "main.c" and "signals.c".
4668 void close_game(player_type *player_ptr)
4671 bool do_send = TRUE;
4672 handle_stuff(player_ptr);
4677 signals_ignore_tstp();
4679 current_world_ptr->character_icky = TRUE;
4680 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
4682 highscore_fd = fd_open(buf, O_RDWR);
4685 if (player_ptr->is_dead)
4687 if (current_world_ptr->total_winner) kingly(player_ptr);
4689 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
4691 if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
4693 else do_send = FALSE;
4695 print_tomb(player_ptr);
4698 show_info(player_ptr);
4701 if (check_score(player_ptr))
4703 if ((!send_world_score(player_ptr, do_send)))
4705 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
4706 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
4708 player_ptr->wait_report_score = TRUE;
4709 player_ptr->is_dead = FALSE;
4710 if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
4713 if (!player_ptr->wait_report_score)
4714 (void)top_twenty(player_ptr);
4716 else if (highscore_fd >= 0)
4718 display_scores_aux(0, 10, -1, NULL);
4723 do_cmd_save_game(player_ptr, FALSE);
4724 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
4725 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
4726 if (inkey() != ESCAPE) predict_score(player_ptr);
4729 (void)fd_close(highscore_fd);
4731 clear_saved_floor_files(player_ptr);
4732 signals_handle_tstp();
4737 * @brief 全更新処理をチェックして処理していく
4738 * Handle "player_ptr->update" and "player_ptr->redraw" and "player_ptr->window"
4741 void handle_stuff(player_type *player_ptr)
4743 if (player_ptr->update) update_creature(player_ptr);
4744 if (player_ptr->redraw) redraw_stuff(player_ptr);
4745 if (player_ptr->window) window_stuff(player_ptr);
4749 void update_output(player_type *player_ptr)
4751 if (player_ptr->redraw) redraw_stuff(player_ptr);
4752 if (player_ptr->window) window_stuff(player_ptr);