3 @brief Angbandゲームエンジン / Angband game engine
6 Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 This software may be copied and distributed for educational, research, and\n
8 not for profit purposes provided that this copyright and statement are\n
9 included in all such copies.\n
10 2013 Deskull rearranged comment for Doxygen.
14 #include "signal-handlers.h"
25 #include "cmd-activate.h"
28 #include "cmd-hissatsu.h"
30 #include "cmd-magiceat.h"
32 #include "cmd-quaff.h"
34 #include "cmd-smith.h"
35 #include "cmd-usestaff.h"
36 #include "cmd-zaprod.h"
37 #include "cmd-zapwand.h"
39 #include "cmd-basic.h"
45 #include "floor-events.h"
46 #include "floor-town.h"
48 #include "object-ego.h"
49 #include "object-curse.h"
50 #include "object-flavor.h"
53 #include "spells-summon.h"
54 #include "spells-object.h"
55 #include "spells-status.h"
56 #include "spells-floor.h"
57 #include "monster-spell.h"
64 #include "player-move.h"
65 #include "player-status.h"
66 #include "player-class.h"
67 #include "player-race.h"
68 #include "player-personality.h"
69 #include "player-damage.h"
70 #include "player-effects.h"
71 #include "cmd-spell.h"
72 #include "realm-hex.h"
73 #include "objectkind.h"
74 #include "object-hook.h"
76 #include "monster-process.h"
77 #include "monster-status.h"
78 #include "monsterrace-hook.h"
79 #include "floor-save.h"
81 #include "player-skill.h"
82 #include "player-inventory.h"
84 #include "view-mainwindow.h"
85 #include "dungeon-file.h"
86 #include "uid-checker.h"
87 #include "view/process-death.h"
93 #include "realm-song.h"
94 #include "targeting.h"
98 * Hack -- Link a copyright message into the executable
100 const concptr copyright[5] =
102 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
104 "This software may be copied and distributed for educational, research,",
105 "and not for profit purposes provided that this copyright and statement",
106 "are included in all such copies."
109 bool can_save = FALSE;
111 COMMAND_CODE now_message;
113 bool repair_monsters;
116 concptr ANGBAND_SYS = "xxx";
119 concptr ANGBAND_KEYBOARD = "JAPAN";
121 concptr ANGBAND_KEYBOARD = "0";
124 concptr ANGBAND_GRAF = "ascii";
126 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
127 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
130 * Flags for initialization
135 * @brief 擬似鑑定を実際に行い判定を反映する
136 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
137 * @param creature_ptr プレーヤーへの参照ポインタ
138 * @param heavy 重度の擬似鑑定を行うならばTRUE
141 static void sense_inventory_aux(player_type *creature_ptr, INVENTORY_IDX slot, bool heavy)
144 object_type *o_ptr = &creature_ptr->inventory_list[slot];
145 GAME_TEXT o_name[MAX_NLEN];
146 if (o_ptr->ident & (IDENT_SENSE))return;
147 if (object_is_known(o_ptr)) return;
149 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
152 if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
163 feel = FEEL_EXCELLENT;
169 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
171 feel = FEEL_UNCURSED;
176 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
182 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
189 feel = FEEL_WORTHLESS;
194 feel = FEEL_TERRIBLE;
200 if (disturb_minor) disturb(creature_ptr, FALSE, FALSE);
202 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
203 if (slot >= INVEN_RARM)
206 msg_format("%s%s(%c)は%sという感じがする...",
207 describe_use(creature_ptr, slot), o_name, index_to_label(slot), game_inscriptions[feel]);
209 msg_format("You feel the %s (%c) you are %s %s %s...",
210 o_name, index_to_label(slot), describe_use(creature_ptr, slot),
211 ((o_ptr->number == 1) ? "is" : "are"),
212 game_inscriptions[feel]);
219 msg_format("ザックの中の%s(%c)は%sという感じがする...",
220 o_name, index_to_label(slot), game_inscriptions[feel]);
222 msg_format("You feel the %s (%c) in your pack %s %s...",
223 o_name, index_to_label(slot),
224 ((o_ptr->number == 1) ? "is" : "are"),
225 game_inscriptions[feel]);
230 o_ptr->ident |= (IDENT_SENSE);
231 o_ptr->feeling = feel;
233 autopick_alter_item(creature_ptr, slot, destroy_feeling);
234 creature_ptr->update |= (PU_COMBINE | PU_REORDER);
235 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
240 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
243 * Sense the inventory\n
245 * Class 0 = Warrior --> fast and heavy\n
246 * Class 1 = Mage --> slow and light\n
247 * Class 2 = Priest --> fast but light\n
248 * Class 3 = Rogue --> okay and heavy\n
249 * Class 4 = Ranger --> slow but heavy (changed!)\n
250 * Class 5 = Paladin --> slow but heavy\n
252 static void sense_inventory1(player_type *creature_ptr)
254 PLAYER_LEVEL plev = creature_ptr->lev;
257 if (creature_ptr->confused) return;
259 switch (creature_ptr->pclass)
266 if (0 != randint0(9000L / (plev * plev + 40))) return;
273 if (0 != randint0(6000L / (plev * plev + 50))) return;
279 case CLASS_HIGH_MAGE:
281 case CLASS_MAGIC_EATER:
283 if (0 != randint0(240000L / (plev + 5))) return;
290 if (0 != randint0(10000L / (plev * plev + 40))) return;
297 if (0 != randint0(20000L / (plev * plev + 40))) return;
304 if (0 != randint0(95000L / (plev * plev + 40))) return;
312 if (0 != randint0(77777L / (plev * plev + 40))) return;
317 case CLASS_WARRIOR_MAGE:
320 if (0 != randint0(75000L / (plev * plev + 40))) return;
324 case CLASS_MINDCRAFTER:
326 case CLASS_BLUE_MAGE:
327 case CLASS_MIRROR_MASTER:
329 if (0 != randint0(55000L / (plev * plev + 40))) return;
333 case CLASS_CHAOS_WARRIOR:
335 if (0 != randint0(80000L / (plev * plev + 40))) return;
341 case CLASS_FORCETRAINER:
343 if (0 != randint0(20000L / (plev * plev + 40))) return;
349 if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
354 case CLASS_BEASTMASTER:
356 if (0 != randint0(65000L / (plev * plev + 40))) return;
360 case CLASS_BERSERKER:
367 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
369 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
373 o_ptr = &creature_ptr->inventory_list[i];
375 if (!o_ptr->k_idx) continue;
404 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
406 if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
411 sense_inventory_aux(creature_ptr, i, heavy);
417 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
420 static void sense_inventory2(player_type *creature_ptr)
422 PLAYER_LEVEL plev = creature_ptr->lev;
425 if (creature_ptr->confused) return;
427 switch (creature_ptr->pclass)
433 case CLASS_BERSERKER:
440 case CLASS_CHAOS_WARRIOR:
442 case CLASS_BEASTMASTER:
445 if (0 != randint0(240000L / (plev + 5))) return;
450 case CLASS_WARRIOR_MAGE:
454 if (0 != randint0(95000L / (plev * plev + 40))) return;
461 case CLASS_FORCETRAINER:
462 case CLASS_MINDCRAFTER:
464 if (0 != randint0(20000L / (plev * plev + 40))) return;
469 case CLASS_HIGH_MAGE:
471 case CLASS_MAGIC_EATER:
472 case CLASS_MIRROR_MASTER:
473 case CLASS_BLUE_MAGE:
475 if (0 != randint0(9000L / (plev * plev + 40))) return;
481 if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
487 for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
490 o_ptr = &creature_ptr->inventory_list[i];
491 if (!o_ptr->k_idx) continue;
506 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
508 sense_inventory_aux(creature_ptr, i, TRUE);
514 * @brief パターン終点到達時のテレポート処理を行う
515 * @param creature_ptr プレーヤーへの参照ポインタ
518 static void pattern_teleport(player_type *creature_ptr)
521 DEPTH max_level = 99;
523 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
528 if (ironman_downward)
529 min_level = creature_ptr->current_floor_ptr->dun_level;
531 if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
533 if (creature_ptr->current_floor_ptr->dun_level > 100)
534 max_level = MAX_DEPTH - 1;
535 else if (creature_ptr->current_floor_ptr->dun_level == 100)
540 max_level = d_info[creature_ptr->dungeon_idx].maxdepth;
541 min_level = d_info[creature_ptr->dungeon_idx].mindepth;
544 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
545 sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
546 if (!get_string(ppp, tmp_val, 10)) return;
548 command_arg = (COMMAND_ARG)atoi(tmp_val);
550 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
552 teleport_player(creature_ptr, 200, 0L);
560 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
561 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
563 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
564 if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
566 creature_ptr->current_floor_ptr->dun_level = command_arg;
567 leave_quest_check(creature_ptr);
568 if (record_stair) exe_write_diary(creature_ptr, DIARY_PAT_TELE, 0, NULL);
570 creature_ptr->current_floor_ptr->inside_quest = 0;
571 free_turn(creature_ptr);
574 * Clear all saved floors
575 * and create a first saved floor
577 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
578 creature_ptr->leaving = TRUE;
583 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
584 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
586 static bool pattern_effect(player_type *creature_ptr)
588 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
589 if (!pattern_tile(floor_ptr, creature_ptr->y, creature_ptr->x)) return FALSE;
591 if ((PRACE_IS_(creature_ptr, RACE_AMBERITE)) &&
592 (creature_ptr->cut > 0) && one_in_(10))
594 wreck_the_pattern(creature_ptr);
597 int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
598 switch (pattern_type)
600 case PATTERN_TILE_END:
601 (void)set_image(creature_ptr, 0);
602 (void)restore_all_status(creature_ptr);
603 (void)restore_level(creature_ptr);
604 (void)cure_critical_wounds(creature_ptr, 1000);
606 cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
607 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
610 * We could make the healing effect of the
611 * Pattern center one-time only to avoid various kinds
612 * of abuse, like luring the win monster into fighting you
613 * in the middle of the pattern...
617 case PATTERN_TILE_OLD:
621 case PATTERN_TILE_TELEPORT:
622 pattern_teleport(creature_ptr);
625 case PATTERN_TILE_WRECKED:
626 if (!IS_INVULN(creature_ptr))
627 take_hit(creature_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
631 if (PRACE_IS_(creature_ptr, RACE_AMBERITE) && !one_in_(2))
633 else if (!IS_INVULN(creature_ptr))
634 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
643 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
644 * @param percent 回復比率
647 static void regenhp(player_type *creature_ptr, int percent)
649 if (creature_ptr->special_defense & KATA_KOUKIJIN) return;
650 if (creature_ptr->action == ACTION_HAYAGAKE) return;
652 HIT_POINT old_chp = creature_ptr->chp;
655 * Extract the new hitpoints
657 * 'percent' is the Regen factor in unit (1/2^16)
659 HIT_POINT new_chp = 0;
660 u32b new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
661 s64b_LSHIFT(new_chp, new_chp_frac, 16);
662 s64b_add(&(creature_ptr->chp), &(creature_ptr->chp_frac), new_chp, new_chp_frac);
663 if (0 < s64b_cmp(creature_ptr->chp, creature_ptr->chp_frac, creature_ptr->mhp, 0))
665 creature_ptr->chp = creature_ptr->mhp;
666 creature_ptr->chp_frac = 0;
669 if (old_chp != creature_ptr->chp)
671 creature_ptr->redraw |= (PR_HP);
672 creature_ptr->window |= (PW_PLAYER);
679 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
680 * @param upkeep_factor ペット維持によるMPコスト量
681 * @param regen_amount 回復量
684 static void regenmana(player_type *creature_ptr, MANA_POINT upkeep_factor, MANA_POINT regen_amount)
686 MANA_POINT old_csp = creature_ptr->csp;
687 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
690 * Excess mana will decay 32 times faster than normal
693 if (creature_ptr->csp > creature_ptr->msp)
696 u32b decay_frac = (creature_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
697 s64b_LSHIFT(decay, decay_frac, 16);
698 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), decay, decay_frac);
699 if (creature_ptr->csp < creature_ptr->msp)
701 creature_ptr->csp = creature_ptr->msp;
702 creature_ptr->csp_frac = 0;
706 /* Regenerating mana (unless the player has excess mana) */
707 else if (regen_rate > 0)
709 MANA_POINT new_mana = 0;
710 u32b new_mana_frac = (creature_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
711 s64b_LSHIFT(new_mana, new_mana_frac, 16);
712 s64b_add(&(creature_ptr->csp), &(creature_ptr->csp_frac), new_mana, new_mana_frac);
713 if (creature_ptr->csp >= creature_ptr->msp)
715 creature_ptr->csp = creature_ptr->msp;
716 creature_ptr->csp_frac = 0;
720 /* Reduce mana (even when the player has excess mana) */
723 s32b reduce_mana = 0;
724 u32b reduce_mana_frac = (creature_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
725 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
726 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), reduce_mana, reduce_mana_frac);
727 if (creature_ptr->csp < 0)
729 creature_ptr->csp = 0;
730 creature_ptr->csp_frac = 0;
734 if (old_csp != creature_ptr->csp)
736 creature_ptr->redraw |= (PR_MANA);
737 creature_ptr->window |= (PW_PLAYER);
738 creature_ptr->window |= (PW_SPELL);
745 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
746 * @param regen_amount 回復量
749 static void regenmagic(player_type *creature_ptr, int regen_amount)
753 int mult = (dev + adj_mag_mana[creature_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
755 for (int i = 0; i < EATER_EXT * 2; i++)
757 if (!creature_ptr->magic_num2[i]) continue;
758 if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
760 /* Increase remaining charge number like float value */
761 new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 13)) / (dev * 8);
762 creature_ptr->magic_num1[i] += new_mana;
764 /* Check maximum charge */
765 if (creature_ptr->magic_num1[i] > (creature_ptr->magic_num2[i] << 16))
767 creature_ptr->magic_num1[i] = ((long)creature_ptr->magic_num2[i] << 16);
773 for (int i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
775 if (!creature_ptr->magic_num1[i]) continue;
776 if (!creature_ptr->magic_num2[i]) continue;
778 /* Decrease remaining period for charging */
779 new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
780 / (dev * 16 * PY_REGEN_NORMAL);
781 creature_ptr->magic_num1[i] -= new_mana;
783 /* Check minimum remaining period for charging */
784 if (creature_ptr->magic_num1[i] < 0) creature_ptr->magic_num1[i] = 0;
791 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
792 * @param player_ptr プレーヤーへの参照ポインタ
794 * @note Should probably be done during monster turns.
796 static void regenerate_monsters(player_type *player_ptr)
798 for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++)
800 monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
801 monster_race *r_ptr = &r_info[m_ptr->r_idx];
803 if (!monster_is_valid(m_ptr)) continue;
805 if (m_ptr->hp < m_ptr->maxhp)
807 int frac = m_ptr->maxhp / 100;
808 if (!frac) if (one_in_(2)) frac = 1;
810 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
813 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
815 if (player_ptr->health_who == i) player_ptr->redraw |= (PR_HEALTH);
816 if (player_ptr->riding == i) player_ptr->redraw |= (PR_UHEALTH);
823 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
824 * @param creature_ptr プレーヤーへの参照ポインタ
826 * @note Should probably be done during monster turns.
828 static void regenerate_captured_monsters(player_type *creature_ptr)
831 for (int i = 0; i < INVEN_TOTAL; i++)
834 object_type *o_ptr = &creature_ptr->inventory_list[i];
835 if (!o_ptr->k_idx) continue;
836 if (o_ptr->tval != TV_CAPTURE) continue;
837 if (!o_ptr->pval) continue;
840 r_ptr = &r_info[o_ptr->pval];
841 if (o_ptr->xtra4 < o_ptr->xtra5)
843 int frac = o_ptr->xtra5 / 100;
844 if (!frac) if (one_in_(2)) frac = 1;
846 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
848 o_ptr->xtra4 += (XTRA16)frac;
849 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
855 creature_ptr->update |= (PU_COMBINE);
856 creature_ptr->window |= (PW_INVEN);
857 creature_ptr->window |= (PW_EQUIP);
864 * @brief 寿命つき光源の警告メッセージ処理
865 * @param creature_ptr プレーヤーへの参照ポインタ
866 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
869 static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
871 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
873 creature_ptr->window |= (PW_EQUIP);
876 if (creature_ptr->blind)
878 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
880 else if (o_ptr->xtra4 == 0)
882 disturb(creature_ptr, FALSE, TRUE);
883 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
884 creature_ptr->update |= (PU_TORCH);
885 creature_ptr->update |= (PU_BONUS);
887 else if (o_ptr->name2 == EGO_LITE_LONG)
889 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
890 && (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)))
892 if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
893 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
896 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
898 if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
899 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
905 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
906 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
909 static void recharged_notice(player_type *owner_ptr, object_type *o_ptr)
911 if (!o_ptr->inscription) return;
913 concptr s = my_strchr(quark_str(o_ptr->inscription), '!');
918 GAME_TEXT o_name[MAX_NLEN];
919 object_desc(owner_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
921 msg_format("%sは再充填された。", o_name);
923 if (o_ptr->number > 1)
924 msg_format("Your %s are recharged.", o_name);
926 msg_format("Your %s is recharged.", o_name);
928 disturb(owner_ptr, FALSE, FALSE);
932 s = my_strchr(s + 1, '!');
938 * @brief プレイヤーの歌に関する継続処理
941 static void check_music(player_type *caster_ptr)
943 if (caster_ptr->pclass != CLASS_BARD) return;
944 if (!SINGING_SONG_EFFECT(caster_ptr) && !INTERUPTING_SONG_EFFECT(caster_ptr)) return;
946 if (caster_ptr->anti_magic)
948 stop_singing(caster_ptr);
952 int spell = SINGING_SONG_ID(caster_ptr);
953 const magic_type *s_ptr;
954 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
956 MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
957 u32b need_mana_frac = 0;
959 s64b_RSHIFT(need_mana, need_mana_frac, 1);
960 if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
962 stop_singing(caster_ptr);
967 s64b_sub(&(caster_ptr->csp), &(caster_ptr->csp_frac), need_mana, need_mana_frac);
969 caster_ptr->redraw |= PR_MANA;
970 if (INTERUPTING_SONG_EFFECT(caster_ptr))
972 SINGING_SONG_EFFECT(caster_ptr) = INTERUPTING_SONG_EFFECT(caster_ptr);
973 INTERUPTING_SONG_EFFECT(caster_ptr) = MUSIC_NONE;
974 msg_print(_("歌を再開した。", "You restart singing."));
975 caster_ptr->action = ACTION_SING;
976 caster_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
977 caster_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
978 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
982 if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
983 caster_ptr->spell_exp[spell] += 5;
984 else if (caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
986 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;
988 else if (caster_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
990 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;
992 else if (caster_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
994 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;
997 exe_spell(caster_ptr, REALM_MUSIC, spell, SPELL_CONT);
1002 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1003 * @param flag 探し出したい呪いフラグ配列
1004 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1007 static object_type *choose_cursed_obj_name(player_type *player_ptr, BIT_FLAGS flag)
1009 int choices[INVEN_TOTAL - INVEN_RARM];
1011 if (!(player_ptr->cursed & flag)) return NULL;
1013 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
1015 object_type *o_ptr = &player_ptr->inventory_list[i];
1016 if (o_ptr->curse_flags & flag)
1018 choices[number] = i;
1021 else if ((flag == TRC_ADD_L_CURSE) ||
1022 (flag == TRC_ADD_H_CURSE) ||
1023 (flag == TRC_DRAIN_HP) ||
1024 (flag == TRC_DRAIN_MANA) ||
1025 (flag == TRC_CALL_ANIMAL) ||
1026 (flag == TRC_CALL_DEMON) ||
1027 (flag == TRC_CALL_DRAGON) ||
1028 (flag == TRC_CALL_UNDEAD) ||
1029 (flag == TRC_COWARDICE) ||
1030 (flag == TRC_LOW_MELEE) ||
1031 (flag == TRC_LOW_AC) ||
1032 (flag == TRC_LOW_MAGIC) ||
1033 (flag == TRC_FAST_DIGEST) ||
1034 (flag == TRC_SLOW_REGEN))
1037 BIT_FLAGS flgs[TR_FLAG_SIZE];
1038 object_flags(o_ptr, flgs);
1041 case TRC_ADD_L_CURSE: cf = TR_ADD_L_CURSE; break;
1042 case TRC_ADD_H_CURSE: cf = TR_ADD_H_CURSE; break;
1043 case TRC_DRAIN_HP: cf = TR_DRAIN_HP; break;
1044 case TRC_DRAIN_MANA: cf = TR_DRAIN_MANA; break;
1045 case TRC_CALL_ANIMAL: cf = TR_CALL_ANIMAL; break;
1046 case TRC_CALL_DEMON: cf = TR_CALL_DEMON; break;
1047 case TRC_CALL_DRAGON: cf = TR_CALL_DRAGON; break;
1048 case TRC_CALL_UNDEAD: cf = TR_CALL_UNDEAD; break;
1049 case TRC_COWARDICE: cf = TR_COWARDICE; break;
1050 case TRC_LOW_MELEE: cf = TR_LOW_MELEE; break;
1051 case TRC_LOW_AC: cf = TR_LOW_AC; break;
1052 case TRC_LOW_MAGIC: cf = TR_LOW_MAGIC; break;
1053 case TRC_FAST_DIGEST: cf = TR_FAST_DIGEST; break;
1054 case TRC_SLOW_REGEN: cf = TR_SLOW_REGEN; break;
1057 if (have_flag(flgs, cf))
1059 choices[number] = i;
1065 return &player_ptr->inventory_list[choices[randint0(number)]];
1069 static void process_world_aux_digestion(player_type *creature_ptr)
1071 if (!creature_ptr->phase_out)
1073 if (creature_ptr->food >= PY_FOOD_MAX)
1075 (void)set_food(creature_ptr, creature_ptr->food - 100);
1077 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1079 int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
1080 if (creature_ptr->regenerate)
1082 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1084 if (creature_ptr->cursed & TRC_FAST_DIGEST)
1087 if (creature_ptr->slow_digest)
1090 if (digestion < 1) digestion = 1;
1091 if (digestion > 100) digestion = 100;
1093 (void)set_food(creature_ptr, creature_ptr->food - digestion);
1096 if ((creature_ptr->food < PY_FOOD_FAINT))
1098 if (!creature_ptr->paralyzed && (randint0(100) < 10))
1100 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1101 disturb(creature_ptr, TRUE, TRUE);
1102 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
1105 if (creature_ptr->food < PY_FOOD_STARVE)
1107 HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
1108 if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1116 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1117 * / Handle timed damage and regeneration every 10 game turns
1120 static void process_world_aux_hp_and_sp(player_type *creature_ptr)
1122 feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1123 bool cave_no_regen = FALSE;
1124 int upkeep_factor = 0;
1125 int regen_amount = PY_REGEN_NORMAL;
1126 if (creature_ptr->poisoned && !IS_INVULN(creature_ptr))
1128 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1131 if (creature_ptr->cut && !IS_INVULN(creature_ptr))
1134 if (creature_ptr->cut > 1000)
1138 else if (creature_ptr->cut > 200)
1142 else if (creature_ptr->cut > 100)
1146 else if (creature_ptr->cut > 50)
1150 else if (creature_ptr->cut > 25)
1154 else if (creature_ptr->cut > 10)
1163 take_hit(creature_ptr, DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1166 if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
1168 if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN(creature_ptr) && is_daytime())
1170 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1172 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1173 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1174 cave_no_regen = TRUE;
1178 if (creature_ptr->inventory_list[INVEN_LITE].tval && (creature_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1179 !creature_ptr->resist_lite)
1181 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1182 GAME_TEXT o_name[MAX_NLEN];
1183 char ouch[MAX_NLEN + 40];
1184 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1185 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1187 cave_no_regen = TRUE;
1188 object_desc(creature_ptr, o_name, o_ptr, OD_NAME_ONLY);
1189 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1191 if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
1195 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_fire)
1199 if (have_flag(f_ptr->flags, FF_DEEP))
1201 damage = 6000 + randint0(4000);
1203 else if (!creature_ptr->levitation)
1205 damage = 3000 + randint0(2000);
1210 if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
1211 if (creature_ptr->resist_fire) damage = damage / 3;
1212 if (is_oppose_fire(creature_ptr)) damage = damage / 3;
1213 if (creature_ptr->levitation) damage = damage / 5;
1215 damage = damage / 100 + (randint0(100) < (damage % 100));
1217 if (creature_ptr->levitation)
1219 msg_print(_("熱で火傷した!", "The heat burns you!"));
1220 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1221 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1225 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1226 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1227 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1230 cave_no_regen = TRUE;
1234 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_cold)
1238 if (have_flag(f_ptr->flags, FF_DEEP))
1240 damage = 6000 + randint0(4000);
1242 else if (!creature_ptr->levitation)
1244 damage = 3000 + randint0(2000);
1249 if (creature_ptr->resist_cold) damage = damage / 3;
1250 if (is_oppose_cold(creature_ptr)) damage = damage / 3;
1251 if (creature_ptr->levitation) damage = damage / 5;
1253 damage = damage / 100 + (randint0(100) < (damage % 100));
1255 if (creature_ptr->levitation)
1257 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1258 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1259 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1263 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1264 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1265 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1268 cave_no_regen = TRUE;
1272 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_elec)
1276 if (have_flag(f_ptr->flags, FF_DEEP))
1278 damage = 6000 + randint0(4000);
1280 else if (!creature_ptr->levitation)
1282 damage = 3000 + randint0(2000);
1287 if (creature_ptr->resist_elec) damage = damage / 3;
1288 if (is_oppose_elec(creature_ptr)) damage = damage / 3;
1289 if (creature_ptr->levitation) damage = damage / 5;
1291 damage = damage / 100 + (randint0(100) < (damage % 100));
1293 if (creature_ptr->levitation)
1295 msg_print(_("電撃を受けた!", "The electricity shocks you!"));
1296 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1297 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1301 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1302 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1303 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1306 cave_no_regen = TRUE;
1310 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_acid)
1314 if (have_flag(f_ptr->flags, FF_DEEP))
1316 damage = 6000 + randint0(4000);
1318 else if (!creature_ptr->levitation)
1320 damage = 3000 + randint0(2000);
1325 if (creature_ptr->resist_acid) damage = damage / 3;
1326 if (is_oppose_acid(creature_ptr)) damage = damage / 3;
1327 if (creature_ptr->levitation) damage = damage / 5;
1329 damage = damage / 100 + (randint0(100) < (damage % 100));
1331 if (creature_ptr->levitation)
1333 msg_print(_("酸が飛び散った!", "The acid melts you!"));
1334 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1335 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1339 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1340 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1341 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1344 cave_no_regen = TRUE;
1348 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN(creature_ptr))
1352 if (have_flag(f_ptr->flags, FF_DEEP))
1354 damage = 6000 + randint0(4000);
1356 else if (!creature_ptr->levitation)
1358 damage = 3000 + randint0(2000);
1363 if (creature_ptr->resist_pois) damage = damage / 3;
1364 if (is_oppose_pois(creature_ptr)) damage = damage / 3;
1365 if (creature_ptr->levitation) damage = damage / 5;
1367 damage = damage / 100 + (randint0(100) < (damage % 100));
1369 if (creature_ptr->levitation)
1371 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1372 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1373 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1374 if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 1);
1378 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1379 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1380 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1381 if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 3);
1384 cave_no_regen = TRUE;
1388 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1389 !creature_ptr->levitation && !creature_ptr->can_swim && !creature_ptr->resist_water)
1391 if (creature_ptr->total_weight > weight_limit(creature_ptr))
1393 msg_print(_("溺れている!", "You are drowning!"));
1394 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->lev), _("溺れ", "drowning"), -1);
1395 cave_no_regen = TRUE;
1399 if (creature_ptr->riding)
1402 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !creature_ptr->immune_fire)
1404 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1405 if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
1406 if (creature_ptr->resist_fire) damage = damage / 3;
1407 if (is_oppose_fire(creature_ptr)) damage = damage / 3;
1408 msg_print(_("熱い!", "It's hot!"));
1409 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1411 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !creature_ptr->immune_elec)
1413 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1414 if (PRACE_IS_(creature_ptr, RACE_ANDROID)) damage += damage / 3;
1415 if (creature_ptr->resist_elec) damage = damage / 3;
1416 if (is_oppose_elec(creature_ptr)) damage = damage / 3;
1417 msg_print(_("痛い!", "It hurts!"));
1418 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1420 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !creature_ptr->immune_cold)
1422 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1423 if (creature_ptr->resist_cold) damage = damage / 3;
1424 if (is_oppose_cold(creature_ptr)) damage = damage / 3;
1425 msg_print(_("冷たい!", "It's cold!"));
1426 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1430 /* Spectres -- take damage when moving through walls */
1432 * Added: ANYBODY takes damage if inside through walls
1433 * without wraith form -- NOTE: Spectres will never be
1434 * reduced below 0 hp by being inside a stone wall; others
1437 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1439 if (!IS_INVULN(creature_ptr) && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
1442 cave_no_regen = TRUE;
1444 if (creature_ptr->pass_wall)
1446 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1447 dam_desc = _("密度", "density");
1451 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1452 dam_desc = _("硬い岩", "solid rock");
1455 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1 + (creature_ptr->lev / 5), dam_desc, -1);
1459 if (creature_ptr->food < PY_FOOD_WEAK)
1461 if (creature_ptr->food < PY_FOOD_STARVE)
1465 else if (creature_ptr->food < PY_FOOD_FAINT)
1467 regen_amount = PY_REGEN_FAINT;
1471 regen_amount = PY_REGEN_WEAK;
1475 if (pattern_effect(creature_ptr))
1477 cave_no_regen = TRUE;
1481 if (creature_ptr->regenerate)
1483 regen_amount = regen_amount * 2;
1485 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1489 if (creature_ptr->cursed & TRC_SLOW_REGEN)
1495 if ((creature_ptr->action == ACTION_SEARCH) || (creature_ptr->action == ACTION_REST))
1497 regen_amount = regen_amount * 2;
1500 upkeep_factor = calculate_upkeep(creature_ptr);
1501 if ((creature_ptr->action == ACTION_LEARN) ||
1502 (creature_ptr->action == ACTION_HAYAGAKE) ||
1503 (creature_ptr->special_defense & KATA_KOUKIJIN))
1505 upkeep_factor += 100;
1508 regenmana(creature_ptr, upkeep_factor, regen_amount);
1509 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
1511 regenmagic(creature_ptr, regen_amount);
1514 if ((creature_ptr->csp == 0) && (creature_ptr->csp_frac == 0))
1516 while (upkeep_factor > 100)
1518 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1520 do_cmd_pet_dismiss(creature_ptr);
1522 upkeep_factor = calculate_upkeep(creature_ptr);
1524 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1529 if (creature_ptr->poisoned) regen_amount = 0;
1530 if (creature_ptr->cut) regen_amount = 0;
1531 if (cave_no_regen) regen_amount = 0;
1533 regen_amount = (regen_amount * creature_ptr->mutant_regenerate_mod) / 100;
1534 if ((creature_ptr->chp < creature_ptr->mhp) && !cave_no_regen)
1536 regenhp(creature_ptr, regen_amount);
1542 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1543 * / Handle timeout every 10 game turns
1546 static void process_world_aux_timeout(player_type *creature_ptr)
1548 const int dec_count = (easy_band ? 2 : 1);
1549 if (creature_ptr->tim_mimic)
1551 (void)set_mimic(creature_ptr, creature_ptr->tim_mimic - 1, creature_ptr->mimic_form, TRUE);
1554 if (creature_ptr->image)
1556 (void)set_image(creature_ptr, creature_ptr->image - dec_count);
1559 if (creature_ptr->blind)
1561 (void)set_blind(creature_ptr, creature_ptr->blind - dec_count);
1564 if (creature_ptr->tim_invis)
1566 (void)set_tim_invis(creature_ptr, creature_ptr->tim_invis - 1, TRUE);
1569 if (creature_ptr->suppress_multi_reward)
1571 creature_ptr->suppress_multi_reward = FALSE;
1574 if (creature_ptr->tim_esp)
1576 (void)set_tim_esp(creature_ptr, creature_ptr->tim_esp - 1, TRUE);
1579 if (creature_ptr->ele_attack)
1581 creature_ptr->ele_attack--;
1582 if (!creature_ptr->ele_attack) set_ele_attack(creature_ptr, 0, 0);
1585 if (creature_ptr->ele_immune)
1587 creature_ptr->ele_immune--;
1588 if (!creature_ptr->ele_immune) set_ele_immune(creature_ptr, 0, 0);
1591 if (creature_ptr->tim_infra)
1593 (void)set_tim_infra(creature_ptr, creature_ptr->tim_infra - 1, TRUE);
1596 if (creature_ptr->tim_stealth)
1598 (void)set_tim_stealth(creature_ptr, creature_ptr->tim_stealth - 1, TRUE);
1601 if (creature_ptr->tim_levitation)
1603 (void)set_tim_levitation(creature_ptr, creature_ptr->tim_levitation - 1, TRUE);
1606 if (creature_ptr->tim_sh_touki)
1608 (void)set_tim_sh_touki(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
1611 if (creature_ptr->tim_sh_fire)
1613 (void)set_tim_sh_fire(creature_ptr, creature_ptr->tim_sh_fire - 1, TRUE);
1616 if (creature_ptr->tim_sh_holy)
1618 (void)set_tim_sh_holy(creature_ptr, creature_ptr->tim_sh_holy - 1, TRUE);
1621 if (creature_ptr->tim_eyeeye)
1623 (void)set_tim_eyeeye(creature_ptr, creature_ptr->tim_eyeeye - 1, TRUE);
1626 if (creature_ptr->resist_magic)
1628 (void)set_resist_magic(creature_ptr, creature_ptr->resist_magic - 1, TRUE);
1631 if (creature_ptr->tim_regen)
1633 (void)set_tim_regen(creature_ptr, creature_ptr->tim_regen - 1, TRUE);
1636 if (creature_ptr->tim_res_nether)
1638 (void)set_tim_res_nether(creature_ptr, creature_ptr->tim_res_nether - 1, TRUE);
1641 if (creature_ptr->tim_res_time)
1643 (void)set_tim_res_time(creature_ptr, creature_ptr->tim_res_time - 1, TRUE);
1646 if (creature_ptr->tim_reflect)
1648 (void)set_tim_reflect(creature_ptr, creature_ptr->tim_reflect - 1, TRUE);
1651 if (creature_ptr->multishadow)
1653 (void)set_multishadow(creature_ptr, creature_ptr->multishadow - 1, TRUE);
1656 if (creature_ptr->dustrobe)
1658 (void)set_dustrobe(creature_ptr, creature_ptr->dustrobe - 1, TRUE);
1661 if (creature_ptr->kabenuke)
1663 (void)set_kabenuke(creature_ptr, creature_ptr->kabenuke - 1, TRUE);
1666 if (creature_ptr->paralyzed)
1668 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed - dec_count);
1671 if (creature_ptr->confused)
1673 (void)set_confused(creature_ptr, creature_ptr->confused - dec_count);
1676 if (creature_ptr->afraid)
1678 (void)set_afraid(creature_ptr, creature_ptr->afraid - dec_count);
1681 if (creature_ptr->fast)
1683 (void)set_fast(creature_ptr, creature_ptr->fast - 1, TRUE);
1686 if (creature_ptr->slow)
1688 (void)set_slow(creature_ptr, creature_ptr->slow - dec_count, TRUE);
1691 if (creature_ptr->protevil)
1693 (void)set_protevil(creature_ptr, creature_ptr->protevil - 1, TRUE);
1696 if (creature_ptr->invuln)
1698 (void)set_invuln(creature_ptr, creature_ptr->invuln - 1, TRUE);
1701 if (creature_ptr->wraith_form)
1703 (void)set_wraith_form(creature_ptr, creature_ptr->wraith_form - 1, TRUE);
1706 if (creature_ptr->hero)
1708 (void)set_hero(creature_ptr, creature_ptr->hero - 1, TRUE);
1711 if (creature_ptr->shero)
1713 (void)set_shero(creature_ptr, creature_ptr->shero - 1, TRUE);
1716 if (creature_ptr->blessed)
1718 (void)set_blessed(creature_ptr, creature_ptr->blessed - 1, TRUE);
1721 if (creature_ptr->shield)
1723 (void)set_shield(creature_ptr, creature_ptr->shield - 1, TRUE);
1726 if (creature_ptr->tsubureru)
1728 (void)set_tsubureru(creature_ptr, creature_ptr->tsubureru - 1, TRUE);
1731 if (creature_ptr->magicdef)
1733 (void)set_magicdef(creature_ptr, creature_ptr->magicdef - 1, TRUE);
1736 if (creature_ptr->tsuyoshi)
1738 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi - 1, TRUE);
1741 if (creature_ptr->oppose_acid)
1743 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid - 1, TRUE);
1746 if (creature_ptr->oppose_elec)
1748 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec - 1, TRUE);
1751 if (creature_ptr->oppose_fire)
1753 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire - 1, TRUE);
1756 if (creature_ptr->oppose_cold)
1758 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold - 1, TRUE);
1761 if (creature_ptr->oppose_pois)
1763 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois - 1, TRUE);
1766 if (creature_ptr->ult_res)
1768 (void)set_ultimate_res(creature_ptr, creature_ptr->ult_res - 1, TRUE);
1771 if (creature_ptr->poisoned)
1773 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
1774 (void)set_poisoned(creature_ptr, creature_ptr->poisoned - adjust);
1777 if (creature_ptr->stun)
1779 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
1780 (void)set_stun(creature_ptr, creature_ptr->stun - adjust);
1783 if (creature_ptr->cut)
1785 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
1786 if (creature_ptr->cut > 1000) adjust = 0;
1787 (void)set_cut(creature_ptr, creature_ptr->cut - adjust);
1793 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
1794 * / Handle burning fuel every 10 game turns
1797 static void process_world_aux_light(player_type *creature_ptr)
1799 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1800 if (o_ptr->tval == TV_LITE)
1802 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
1804 if (o_ptr->name2 == EGO_LITE_LONG)
1806 if (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)) o_ptr->xtra4--;
1808 else o_ptr->xtra4--;
1810 notice_lite_change(creature_ptr, o_ptr);
1817 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
1818 * / Handle mutation effects once every 10 game turns
1821 static void process_world_aux_mutation(player_type *creature_ptr)
1823 if (!creature_ptr->muta2) return;
1824 if (creature_ptr->phase_out) return;
1825 if (creature_ptr->wild_mode) return;
1827 if ((creature_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
1829 disturb(creature_ptr, FALSE, TRUE);
1830 msg_print(_("ウガァァア!", "RAAAAGHH!"));
1831 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
1832 (void)set_shero(creature_ptr, 10 + randint1(creature_ptr->lev), FALSE);
1833 (void)set_afraid(creature_ptr, 0);
1836 if ((creature_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
1838 if (!creature_ptr->resist_fear)
1840 disturb(creature_ptr, FALSE, TRUE);
1841 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
1842 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
1846 if ((creature_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
1848 if (!creature_ptr->resist_nexus && !(creature_ptr->muta1 & MUT1_VTELEPORT) && !creature_ptr->anti_tele)
1850 disturb(creature_ptr, FALSE, TRUE);
1851 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
1853 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
1857 if ((creature_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
1859 if (!creature_ptr->resist_conf && !creature_ptr->resist_chaos)
1861 disturb(creature_ptr, FALSE, TRUE);
1862 creature_ptr->redraw |= PR_EXTRA;
1863 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
1866 if (!creature_ptr->resist_conf)
1868 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(20) + 15);
1871 if (!creature_ptr->resist_chaos)
1876 if (one_in_(3)) lose_all_info(creature_ptr);
1877 else wiz_dark(creature_ptr);
1878 (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
1879 wiz_dark(creature_ptr);
1880 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
1881 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!"));
1887 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
1888 (void)set_image(creature_ptr, creature_ptr->image + randint0(150) + 150);
1894 if ((creature_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
1896 if (!creature_ptr->resist_chaos)
1898 disturb(creature_ptr, FALSE, TRUE);
1899 creature_ptr->redraw |= PR_EXTRA;
1900 (void)set_image(creature_ptr, creature_ptr->image + randint0(50) + 20);
1904 if ((creature_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
1906 disturb(creature_ptr, FALSE, TRUE);
1907 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
1909 fire_ball(creature_ptr, GF_POIS, 0, creature_ptr->lev, 3);
1912 if ((creature_ptr->muta2 & MUT2_PROD_MANA) &&
1913 !creature_ptr->anti_magic && one_in_(9000))
1916 disturb(creature_ptr, FALSE, TRUE);
1917 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
1918 "Magical energy flows through you! You must release it!"));
1922 (void)get_hack_dir(creature_ptr, &dire);
1923 fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
1926 if ((creature_ptr->muta2 & MUT2_ATT_DEMON) && !creature_ptr->anti_magic && (randint1(6666) == 666))
1928 bool pet = one_in_(6);
1929 BIT_FLAGS mode = PM_ALLOW_GROUP;
1931 if (pet) mode |= PM_FORCE_PET;
1932 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
1934 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode))
1936 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
1937 disturb(creature_ptr, FALSE, TRUE);
1941 if ((creature_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
1943 disturb(creature_ptr, FALSE, TRUE);
1946 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
1948 if (creature_ptr->fast > 0)
1950 set_fast(creature_ptr, 0, TRUE);
1954 set_slow(creature_ptr, randint1(30) + 10, FALSE);
1959 msg_print(_("精力的になった気がする。", "You feel more energetic."));
1961 if (creature_ptr->slow > 0)
1963 set_slow(creature_ptr, 0, TRUE);
1967 set_fast(creature_ptr, randint1(30) + 10, FALSE);
1972 if ((creature_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
1974 disturb(creature_ptr, FALSE, TRUE);
1975 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
1977 banish_monsters(creature_ptr, 100);
1978 if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
1983 n = randint0(MAX_STORES);
1984 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
1986 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
1987 store_shuffle(creature_ptr, n);
1992 if ((creature_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
1996 msg_print(_("影につつまれた。", "A shadow passes over you."));
1999 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2001 hp_player(creature_ptr, 10);
2004 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2006 if (o_ptr->tval == TV_LITE)
2008 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2010 hp_player(creature_ptr, o_ptr->xtra4 / 20);
2012 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2013 notice_lite_change(creature_ptr, o_ptr);
2018 * Unlite the area (radius 10) around player and
2019 * do 50 points damage to every affected monster
2021 unlite_area(creature_ptr, 50, 10);
2024 if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000))
2026 bool pet = one_in_(3);
2027 BIT_FLAGS mode = PM_ALLOW_GROUP;
2029 if (pet) mode |= PM_FORCE_PET;
2030 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2032 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2034 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2035 disturb(creature_ptr, FALSE, TRUE);
2039 if ((creature_ptr->muta2 & MUT2_RAW_CHAOS) && !creature_ptr->anti_magic && one_in_(8000))
2041 disturb(creature_ptr, FALSE, TRUE);
2042 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2045 fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
2048 if ((creature_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2050 if (!lose_mutation(creature_ptr, 0))
2051 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2054 if ((creature_ptr->muta2 & MUT2_WRAITH) && !creature_ptr->anti_magic && one_in_(3000))
2056 disturb(creature_ptr, FALSE, TRUE);
2057 msg_print(_("非物質化した!", "You feel insubstantial!"));
2060 set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
2063 if ((creature_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2065 do_poly_wounds(creature_ptr);
2068 if ((creature_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2070 int which_stat = randint0(A_MAX);
2071 int sustained = FALSE;
2076 if (creature_ptr->sustain_str) sustained = TRUE;
2079 if (creature_ptr->sustain_int) sustained = TRUE;
2082 if (creature_ptr->sustain_wis) sustained = TRUE;
2085 if (creature_ptr->sustain_dex) sustained = TRUE;
2088 if (creature_ptr->sustain_con) sustained = TRUE;
2091 if (creature_ptr->sustain_chr) sustained = TRUE;
2094 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2100 disturb(creature_ptr, FALSE, TRUE);
2101 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2103 (void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
2107 if ((creature_ptr->muta2 & MUT2_ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000))
2109 bool pet = one_in_(5);
2110 BIT_FLAGS mode = PM_ALLOW_GROUP;
2112 if (pet) mode |= PM_FORCE_PET;
2113 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2115 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2117 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2118 disturb(creature_ptr, FALSE, TRUE);
2122 if ((creature_ptr->muta2 & MUT2_WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000))
2124 if (creature_ptr->tim_esp > 0)
2126 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2127 set_tim_esp(creature_ptr, 0, TRUE);
2131 msg_print(_("精神が広がった!", "Your mind expands!"));
2132 set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
2136 if ((creature_ptr->muta2 & MUT2_NAUSEA) && !creature_ptr->slow_digest && one_in_(9000))
2138 disturb(creature_ptr, FALSE, TRUE);
2139 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2141 set_food(creature_ptr, PY_FOOD_WEAK);
2142 if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
2143 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
2146 if ((creature_ptr->muta2 & MUT2_WALK_SHAD) && !creature_ptr->anti_magic && one_in_(12000) && !creature_ptr->current_floor_ptr->inside_arena)
2148 reserve_alter_reality(creature_ptr);
2151 if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2153 int danger_amount = 0;
2154 for (MONSTER_IDX monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
2156 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
2157 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2158 if (!monster_is_valid(m_ptr)) continue;
2160 if (r_ptr->level >= creature_ptr->lev)
2162 danger_amount += r_ptr->level - creature_ptr->lev + 1;
2166 if (danger_amount > 100)
2167 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2168 else if (danger_amount > 50)
2169 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2170 else if (danger_amount > 20)
2171 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2172 else if (danger_amount > 10)
2173 msg_print(_("心配な気がする!", "You feel paranoid!"));
2174 else if (danger_amount > 5)
2175 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2177 msg_print(_("寂しい気がする。", "You feel lonely."));
2180 if ((creature_ptr->muta2 & MUT2_INVULN) && !creature_ptr->anti_magic && one_in_(5000))
2182 disturb(creature_ptr, FALSE, TRUE);
2183 msg_print(_("無敵な気がする!", "You feel invincible!"));
2185 (void)set_invuln(creature_ptr, randint1(8) + 8, FALSE);
2188 if ((creature_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2190 MANA_POINT wounds = (MANA_POINT)(creature_ptr->mhp - creature_ptr->chp);
2194 HIT_POINT healing = creature_ptr->csp;
2195 if (healing > wounds) healing = wounds;
2197 hp_player(creature_ptr, healing);
2198 creature_ptr->csp -= healing;
2199 creature_ptr->redraw |= (PR_HP | PR_MANA);
2203 if ((creature_ptr->muta2 & MUT2_HP_TO_SP) && !creature_ptr->anti_magic && one_in_(4000))
2205 HIT_POINT wounds = (HIT_POINT)(creature_ptr->msp - creature_ptr->csp);
2209 HIT_POINT healing = creature_ptr->chp;
2210 if (healing > wounds) healing = wounds;
2212 creature_ptr->csp += healing;
2213 creature_ptr->redraw |= (PR_HP | PR_MANA);
2214 take_hit(creature_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2218 if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2220 INVENTORY_IDX slot = 0;
2221 object_type *o_ptr = NULL;
2223 disturb(creature_ptr, FALSE, TRUE);
2224 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2225 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
2228 if (has_melee_weapon(creature_ptr, INVEN_RARM))
2231 o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
2233 if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
2235 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2239 else if (has_melee_weapon(creature_ptr, INVEN_LARM))
2241 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2244 if (slot && !object_is_cursed(o_ptr))
2246 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2247 drop_from_inventory(creature_ptr, slot, 1);
2254 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2255 * / Handle curse effects once every 10 game turns
2258 static void process_world_aux_curse(player_type *creature_ptr)
2260 if ((creature_ptr->cursed & TRC_P_FLAG_MASK) && !creature_ptr->phase_out && !creature_ptr->wild_mode)
2263 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2264 * can actually be useful!
2266 if ((creature_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2268 GAME_TEXT o_name[MAX_NLEN];
2270 int i_keep = 0, count = 0;
2271 for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
2273 BIT_FLAGS flgs[TR_FLAG_SIZE];
2274 o_ptr = &creature_ptr->inventory_list[i];
2275 if (!o_ptr->k_idx) continue;
2277 object_flags(o_ptr, flgs);
2279 if (have_flag(flgs, TR_TELEPORT))
2281 /* {.} will stop random teleportation. */
2282 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2285 if (one_in_(count)) i_keep = i;
2290 o_ptr = &creature_ptr->inventory_list[i_keep];
2291 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2292 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2293 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2295 disturb(creature_ptr, FALSE, TRUE);
2296 teleport_player(creature_ptr, 50, 0L);
2300 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2301 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2302 disturb(creature_ptr, TRUE, TRUE);
2306 if ((creature_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2309 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2311 disturb(creature_ptr, FALSE, FALSE);
2314 if ((creature_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2317 (void)activate_ty_curse(creature_ptr, FALSE, &count);
2320 if (creature_ptr->prace != RACE_ANDROID && ((creature_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2322 creature_ptr->exp -= (creature_ptr->lev + 1) / 2;
2323 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
2324 creature_ptr->max_exp -= (creature_ptr->lev + 1) / 2;
2325 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
2326 check_experience(creature_ptr);
2329 if ((creature_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2332 o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_L_CURSE);
2333 BIT_FLAGS new_curse = get_curse(0, o_ptr);
2334 if (!(o_ptr->curse_flags & new_curse))
2336 GAME_TEXT o_name[MAX_NLEN];
2337 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2338 o_ptr->curse_flags |= new_curse;
2339 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2340 o_ptr->feeling = FEEL_NONE;
2341 creature_ptr->update |= (PU_BONUS);
2345 if ((creature_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2348 o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_H_CURSE);
2349 BIT_FLAGS new_curse = get_curse(1, o_ptr);
2350 if (!(o_ptr->curse_flags & new_curse))
2352 GAME_TEXT o_name[MAX_NLEN];
2354 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2356 o_ptr->curse_flags |= new_curse;
2357 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2358 o_ptr->feeling = FEEL_NONE;
2360 creature_ptr->update |= (PU_BONUS);
2364 if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2366 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)))
2368 GAME_TEXT o_name[MAX_NLEN];
2369 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2370 msg_format(_("%sが動物を引き寄せた!", "Your %s has attracted an animal!"), o_name);
2371 disturb(creature_ptr, FALSE, TRUE);
2375 if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2377 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)))
2379 GAME_TEXT o_name[MAX_NLEN];
2380 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2381 msg_format(_("%sが悪魔を引き寄せた!", "Your %s has attracted a demon!"), o_name);
2382 disturb(creature_ptr, FALSE, TRUE);
2386 if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2388 if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
2389 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2391 GAME_TEXT o_name[MAX_NLEN];
2392 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2393 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s has attracted an dragon!"), o_name);
2394 disturb(creature_ptr, FALSE, TRUE);
2398 if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2400 if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
2401 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2403 GAME_TEXT o_name[MAX_NLEN];
2404 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2405 msg_format(_("%sが死霊を引き寄せた!", "Your %s has attracted an undead!"), o_name);
2406 disturb(creature_ptr, FALSE, TRUE);
2410 if ((creature_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2412 if (!creature_ptr->resist_fear)
2414 disturb(creature_ptr, FALSE, TRUE);
2415 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2416 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
2420 if ((creature_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !creature_ptr->anti_tele)
2422 disturb(creature_ptr, FALSE, TRUE);
2423 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
2426 if ((creature_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2428 GAME_TEXT o_name[MAX_NLEN];
2429 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2430 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2431 take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev * 2, 100), o_name, -1);
2434 if ((creature_ptr->cursed & TRC_DRAIN_MANA) && creature_ptr->csp && one_in_(666))
2436 GAME_TEXT o_name[MAX_NLEN];
2437 object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2438 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2439 creature_ptr->csp -= MIN(creature_ptr->lev, 50);
2440 if (creature_ptr->csp < 0)
2442 creature_ptr->csp = 0;
2443 creature_ptr->csp_frac = 0;
2446 creature_ptr->redraw |= PR_MANA;
2450 if (one_in_(999) && !creature_ptr->anti_magic)
2452 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2453 if (o_ptr->name1 == ART_JUDGE)
2455 if (object_is_known(o_ptr))
2456 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2458 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2459 take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2466 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2467 * / Handle recharging objects once every 10 game turns
2470 static void process_world_aux_recharge(player_type *creature_ptr)
2475 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2477 object_type *o_ptr = &creature_ptr->inventory_list[i];
2478 if (!o_ptr->k_idx) continue;
2480 if (o_ptr->timeout > 0)
2483 if (!o_ptr->timeout)
2485 recharged_notice(creature_ptr, o_ptr);
2493 creature_ptr->window |= (PW_EQUIP);
2498 * Recharge rods. Rods now use timeout to control charging status,
2499 * and each charging rod in a stack decreases the stack's timeout by
2500 * one per turn. -LM-
2502 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2504 object_type *o_ptr = &creature_ptr->inventory_list[i];
2505 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2506 if (!o_ptr->k_idx) continue;
2508 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2510 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2511 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2513 o_ptr->timeout -= temp;
2514 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2516 if (!(o_ptr->timeout))
2518 recharged_notice(creature_ptr, o_ptr);
2521 else if (o_ptr->timeout % k_ptr->pval)
2530 creature_ptr->window |= (PW_INVEN);
2534 for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
2536 object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
2537 if (!OBJECT_IS_VALID(o_ptr)) continue;
2539 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2541 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2542 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2549 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2550 * / Handle involuntary movement once every 10 game turns
2553 static void process_world_aux_movement(player_type *creature_ptr)
2555 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2556 if (creature_ptr->word_recall)
2559 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2560 * The player is yanked up/down as soon as
2561 * he loads the autosaved game.
2563 if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
2564 do_cmd_save_game(creature_ptr, TRUE);
2566 creature_ptr->word_recall--;
2567 creature_ptr->redraw |= (PR_STATUS);
2568 if (!creature_ptr->word_recall)
2570 disturb(creature_ptr, FALSE, TRUE);
2571 if (floor_ptr->dun_level || creature_ptr->current_floor_ptr->inside_quest || creature_ptr->enter_dungeon)
2573 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2574 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
2576 exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
2578 floor_ptr->dun_level = 0;
2579 creature_ptr->dungeon_idx = 0;
2580 leave_quest_check(creature_ptr);
2581 leave_tower_check(creature_ptr);
2582 creature_ptr->current_floor_ptr->inside_quest = 0;
2583 creature_ptr->leaving = TRUE;
2587 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2588 creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
2590 exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
2592 floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
2593 if (floor_ptr->dun_level < 1) floor_ptr->dun_level = 1;
2594 if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND))
2596 if (floor_ptr->dun_level < 50)
2598 floor_ptr->dun_level *= 2;
2600 else if (floor_ptr->dun_level < 99)
2602 floor_ptr->dun_level = (floor_ptr->dun_level + 99) / 2;
2604 else if (floor_ptr->dun_level > 100)
2606 floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].maxdepth - 1;
2610 if (creature_ptr->wild_mode)
2612 creature_ptr->wilderness_y = creature_ptr->y;
2613 creature_ptr->wilderness_x = creature_ptr->x;
2617 creature_ptr->oldpx = creature_ptr->x;
2618 creature_ptr->oldpy = creature_ptr->y;
2621 creature_ptr->wild_mode = FALSE;
2624 * Clear all saved floors
2625 * and create a first saved floor
2627 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
2628 creature_ptr->leaving = TRUE;
2630 if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
2632 for (int i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
2634 quest_type* const q_ptr = &quest[i];
2635 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
2636 (q_ptr->status == QUEST_STATUS_TAKEN) &&
2637 (q_ptr->level < floor_ptr->dun_level))
2639 q_ptr->status = QUEST_STATUS_FAILED;
2640 q_ptr->complev = (byte)creature_ptr->lev;
2642 q_ptr->comptime = current_world_ptr->play_time;
2643 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
2649 sound(SOUND_TPLEVEL);
2653 if (creature_ptr->alter_reality)
2655 if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
2656 do_cmd_save_game(creature_ptr, TRUE);
2658 creature_ptr->alter_reality--;
2659 creature_ptr->redraw |= (PR_STATUS);
2660 if (!creature_ptr->alter_reality)
2662 disturb(creature_ptr, FALSE, TRUE);
2663 if (!quest_number(creature_ptr, floor_ptr->dun_level) && floor_ptr->dun_level)
2665 msg_print(_("世界が変わった!", "The world changes!"));
2668 * Clear all saved floors
2669 * and create a first saved floor
2671 prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
2672 creature_ptr->leaving = TRUE;
2676 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
2679 sound(SOUND_TPLEVEL);
2686 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
2687 * / Handle certain things once every 10 game turns
2690 static void process_world(player_type *player_ptr)
2692 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
2693 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
2694 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
2697 extract_day_hour_min(player_ptr, &day, &hour, &min);
2698 update_dungeon_feeling(player_ptr);
2700 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
2701 floor_type *floor_ptr = player_ptr->current_floor_ptr;
2702 if (ironman_downward && (player_ptr->dungeon_idx != DUNGEON_ANGBAND && player_ptr->dungeon_idx != 0))
2704 floor_ptr->dun_level = 0;
2705 player_ptr->dungeon_idx = 0;
2706 prepare_change_floor_mode(player_ptr, CFM_FIRST_FLOOR | CFM_RAND_PLACE);
2707 floor_ptr->inside_arena = FALSE;
2708 player_ptr->wild_mode = FALSE;
2709 player_ptr->leaving = TRUE;
2712 if (player_ptr->phase_out && !player_ptr->leaving)
2716 for (int i2 = 0; i2 < floor_ptr->width; ++i2)
2718 for (int j2 = 0; j2 < floor_ptr->height; j2++)
2720 grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
2721 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
2724 win_m_idx = g_ptr->m_idx;
2729 if (number_mon == 0)
2731 msg_print(_("相打ちに終わりました。", "Nothing survived."));
2733 player_ptr->energy_need = 0;
2734 update_gambling_monsters(player_ptr);
2736 else if ((number_mon - 1) == 0)
2738 GAME_TEXT m_name[MAX_NLEN];
2739 monster_type *wm_ptr;
2740 wm_ptr = &floor_ptr->m_list[win_m_idx];
2741 monster_desc(player_ptr, m_name, wm_ptr, 0);
2742 msg_format(_("%sが勝利した!", "%s won!"), m_name);
2745 if (win_m_idx == (sel_monster + 1))
2747 msg_print(_("おめでとうございます。", "Congratulations."));
2748 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
2749 player_ptr->au += battle_odds;
2753 msg_print(_("残念でした。", "You lost gold."));
2757 player_ptr->energy_need = 0;
2758 update_gambling_monsters(player_ptr);
2760 else if (current_world_ptr->game_turn - floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
2762 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle ended in a draw."));
2763 player_ptr->au += kakekin;
2765 player_ptr->energy_need = 0;
2766 update_gambling_monsters(player_ptr);
2770 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
2772 if (autosave_t && autosave_freq && !player_ptr->phase_out)
2774 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
2775 do_cmd_save_game(player_ptr, TRUE);
2778 if (floor_ptr->monster_noise && !ignore_unview)
2780 msg_print(_("何かが聞こえた。", "You hear noise."));
2783 if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
2785 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
2787 bool dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
2788 if (dawn) day_break(player_ptr);
2789 else night_falls(player_ptr);
2793 else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
2795 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
2797 if (one_in_(STORE_SHUFFLE))
2802 n = randint0(MAX_STORES);
2803 } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2805 for (FEAT_IDX i = 1; i < max_f_idx; i++)
2807 feature_type *f_ptr = &f_info[i];
2808 if (!f_ptr->name) continue;
2809 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
2811 if (f_ptr->subtype == n)
2814 msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
2816 store_shuffle(player_ptr, n);
2824 if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
2825 !floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
2827 (void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0);
2830 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out)
2831 regenerate_monsters(player_ptr);
2832 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3)))
2833 regenerate_captured_monsters(player_ptr);
2835 if (!player_ptr->leaving)
2837 for (int i = 0; i < MAX_MTIMED; i++)
2839 if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
2845 if (min != prev_min)
2847 exe_write_diary(player_ptr, DIARY_DIALY, 0, NULL);
2848 determine_daily_bounty(player_ptr, FALSE);
2853 * Nightmare mode activates the TY_CURSE at midnight
2854 * Require exact minute -- Don't activate multiple times in a minute
2856 if (ironman_nightmare && (min != prev_min))
2858 if ((hour == 23) && !(min % 15))
2860 disturb(player_ptr, FALSE, TRUE);
2864 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
2868 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
2872 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
2876 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
2883 disturb(player_ptr, TRUE, TRUE);
2884 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
2885 if (player_ptr->wild_mode)
2887 player_ptr->oldpy = randint1(MAX_HGT - 2);
2888 player_ptr->oldpx = randint1(MAX_WID - 2);
2889 change_wild_mode(player_ptr, TRUE);
2890 take_turn(player_ptr, 100);
2894 player_ptr->invoking_midnight_curse = TRUE;
2898 process_world_aux_digestion(player_ptr);
2899 process_world_aux_hp_and_sp(player_ptr);
2900 process_world_aux_timeout(player_ptr);
2901 process_world_aux_light(player_ptr);
2902 process_world_aux_mutation(player_ptr);
2903 process_world_aux_curse(player_ptr);
2904 process_world_aux_recharge(player_ptr);
2905 sense_inventory1(player_ptr);
2906 sense_inventory2(player_ptr);
2907 process_world_aux_movement(player_ptr);
2912 * @brief ウィザードモードへの導入処理
2913 * / Verify use of "wizard" mode
2914 * @param player_ptr プレーヤーへの参照ポインタ
2915 * @return 実際にウィザードモードへ移行したらTRUEを返す。
2917 static bool enter_wizard_mode(player_type *player_ptr)
2919 if (!current_world_ptr->noscore)
2921 if (!allow_debug_opts || arg_wizard)
2923 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
2927 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
2928 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
2930 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
2935 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
2936 current_world_ptr->noscore |= 0x0002;
2944 * @brief デバッグコマンドへの導入処理
2945 * / Verify use of "debug" commands
2946 * @param player_ptr プレーヤーへの参照ポインタ
2947 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
2949 static bool enter_debug_mode(player_type *player_ptr)
2951 if (!current_world_ptr->noscore)
2953 if (!allow_debug_opts)
2955 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
2959 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
2960 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
2962 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
2967 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
2968 current_world_ptr->noscore |= 0x0008;
2975 * todo これが多重インクルード問題の原因 (の1つ)かもしれない、wizard2.cに同名の関数が存在する
2976 * Hack -- Declare the Debug Routines
2978 extern void do_cmd_debug(player_type *creature_ptr);
2981 * @brief プレイヤーから受けた入力コマンドの分岐処理。
2982 * / Parse and execute the current command Give "Warning" on illegal commands.
2983 * @todo Make some "blocks"
2986 static void process_command(player_type *creature_ptr)
2988 COMMAND_CODE old_now_message = now_message;
2991 if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
2992 creature_ptr->reset_concent = TRUE;
2994 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2995 switch (command_cmd)
3006 /* todo 嘘。returnしていない
3013 if (current_world_ptr->wizard)
3015 current_world_ptr->wizard = FALSE;
3016 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3018 else if (enter_wizard_mode(creature_ptr))
3020 current_world_ptr->wizard = TRUE;
3021 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3023 creature_ptr->update |= (PU_MONSTERS);
3024 creature_ptr->redraw |= (PR_TITLE);
3030 if (enter_debug_mode(creature_ptr))
3032 do_cmd_debug(creature_ptr);
3038 if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
3043 if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
3048 if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
3053 do_cmd_destroy(creature_ptr);
3058 do_cmd_equip(creature_ptr);
3063 do_cmd_inven(creature_ptr);
3068 do_cmd_observe(creature_ptr);
3074 toggle_inventory_equipment(creature_ptr);
3079 if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
3084 if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
3089 do_cmd_walk(creature_ptr, FALSE);
3094 do_cmd_walk(creature_ptr, TRUE);
3099 if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
3104 do_cmd_stay(creature_ptr, always_pickup);
3109 do_cmd_stay(creature_ptr, !always_pickup);
3114 do_cmd_rest(creature_ptr);
3119 do_cmd_search(creature_ptr);
3124 if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
3125 else set_action(creature_ptr, ACTION_SEARCH);
3128 case SPECIAL_KEY_STORE:
3130 do_cmd_store(creature_ptr);
3133 case SPECIAL_KEY_BUILDING:
3135 do_cmd_bldg(creature_ptr);
3138 case SPECIAL_KEY_QUEST:
3140 do_cmd_quest(creature_ptr);
3145 if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
3147 if (vanilla_town) break;
3149 if (creature_ptr->ambush_flag)
3151 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3155 if (creature_ptr->food < PY_FOOD_WEAK)
3157 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3161 change_wild_mode(creature_ptr, FALSE);
3164 do_cmd_go_up(creature_ptr);
3170 if (creature_ptr->wild_mode)
3171 change_wild_mode(creature_ptr, FALSE);
3173 do_cmd_go_down(creature_ptr);
3178 do_cmd_open(creature_ptr);
3183 do_cmd_close(creature_ptr);
3188 do_cmd_spike(creature_ptr);
3193 do_cmd_bash(creature_ptr);
3198 do_cmd_disarm(creature_ptr);
3203 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
3204 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3205 else if (creature_ptr->pclass == CLASS_SAMURAI)
3206 do_cmd_gain_hissatsu(creature_ptr);
3207 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3208 import_magic_device(creature_ptr);
3210 do_cmd_study(creature_ptr);
3215 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3216 (creature_ptr->pclass == CLASS_BERSERKER) ||
3217 (creature_ptr->pclass == CLASS_NINJA) ||
3218 (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3219 ) do_cmd_mind_browse(creature_ptr);
3220 else if (creature_ptr->pclass == CLASS_SMITH)
3221 do_cmd_kaji(creature_ptr, TRUE);
3222 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3223 do_cmd_magic_eater(creature_ptr, TRUE, FALSE);
3224 else if (creature_ptr->pclass == CLASS_SNIPER)
3225 do_cmd_snipe_browse(creature_ptr);
3226 else do_cmd_browse(creature_ptr);
3231 if (!creature_ptr->wild_mode)
3233 if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
3235 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3237 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))
3239 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3242 else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
3244 concptr which_power = _("魔法", "magic");
3245 if (creature_ptr->pclass == CLASS_MINDCRAFTER)
3246 which_power = _("超能力", "psionic powers");
3247 else if (creature_ptr->pclass == CLASS_IMITATOR)
3248 which_power = _("ものまね", "imitation");
3249 else if (creature_ptr->pclass == CLASS_SAMURAI)
3250 which_power = _("必殺剣", "hissatsu");
3251 else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3252 which_power = _("鏡魔法", "mirror magic");
3253 else if (creature_ptr->pclass == CLASS_NINJA)
3254 which_power = _("忍術", "ninjutsu");
3255 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3256 which_power = _("祈り", "prayer");
3258 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3259 free_turn(creature_ptr);
3261 else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
3263 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3264 free_turn(creature_ptr);
3268 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3269 (creature_ptr->pclass == CLASS_BERSERKER) ||
3270 (creature_ptr->pclass == CLASS_NINJA) ||
3271 (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3273 do_cmd_mind(creature_ptr);
3274 else if (creature_ptr->pclass == CLASS_IMITATOR)
3275 do_cmd_mane(creature_ptr, FALSE);
3276 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3277 do_cmd_magic_eater(creature_ptr, FALSE, FALSE);
3278 else if (creature_ptr->pclass == CLASS_SAMURAI)
3279 do_cmd_hissatsu(creature_ptr);
3280 else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
3281 do_cmd_cast_learned(creature_ptr);
3282 else if (creature_ptr->pclass == CLASS_SMITH)
3283 do_cmd_kaji(creature_ptr, FALSE);
3284 else if (creature_ptr->pclass == CLASS_SNIPER)
3285 do_cmd_snipe(creature_ptr);
3287 do_cmd_cast(creature_ptr);
3295 do_cmd_pet(creature_ptr);
3300 do_cmd_inscribe(creature_ptr);
3305 do_cmd_uninscribe(creature_ptr);
3310 do_cmd_activate(creature_ptr);
3315 do_cmd_eat_food(creature_ptr);
3320 do_cmd_refill(creature_ptr);
3325 do_cmd_fire(creature_ptr, SP_NONE);
3330 do_cmd_throw(creature_ptr, 1, FALSE, -1);
3335 do_cmd_aim_wand(creature_ptr);
3340 if (use_command && rogue_like_commands)
3342 do_cmd_use(creature_ptr);
3346 do_cmd_zap_rod(creature_ptr);
3352 do_cmd_quaff_potion(creature_ptr);
3357 do_cmd_read_scroll(creature_ptr);
3362 if (use_command && !rogue_like_commands)
3363 do_cmd_use(creature_ptr);
3365 do_cmd_use_staff(creature_ptr);
3370 do_cmd_racial_power(creature_ptr);
3375 do_cmd_view_map(creature_ptr);
3380 do_cmd_locate(creature_ptr);
3385 do_cmd_look(creature_ptr);
3390 do_cmd_target(creature_ptr);
3395 do_cmd_help(creature_ptr);
3400 do_cmd_query_symbol(creature_ptr);
3405 do_cmd_player_status(creature_ptr);
3415 do_cmd_pref(creature_ptr);
3420 do_cmd_reload_autopick(creature_ptr);
3425 do_cmd_edit_autopick(creature_ptr);
3430 do_cmd_macros(creature_ptr);
3435 do_cmd_visuals(creature_ptr);
3436 do_cmd_redraw(creature_ptr);
3441 do_cmd_colors(creature_ptr);
3442 do_cmd_redraw(creature_ptr);
3448 (void)combine_and_reorder_home(STORE_HOME);
3449 do_cmd_redraw(creature_ptr);
3464 do_cmd_feeling(creature_ptr);
3469 do_cmd_message_one();
3474 do_cmd_messages(old_now_message);
3479 do_cmd_checkquest(creature_ptr);
3484 now_message = old_now_message;
3485 do_cmd_redraw(creature_ptr);
3490 do_cmd_save_game(creature_ptr, FALSE);
3495 do_cmd_time(creature_ptr);
3499 case SPECIAL_KEY_QUIT:
3501 do_cmd_save_and_exit(creature_ptr);
3506 do_cmd_suicide(creature_ptr);
3511 do_cmd_diary(creature_ptr);
3516 do_cmd_knowledge(creature_ptr);
3521 do_cmd_load_screen();
3526 do_cmd_save_screen(creature_ptr);
3531 prepare_movie_hooks();
3536 spoil_random_artifact(creature_ptr, "randifact.txt");
3541 if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
3542 if (creature_ptr->special_defense & KATA_MUSOU)
3544 set_action(creature_ptr, ACTION_NONE);
3550 if (flush_failure) flush();
3554 sound(SOUND_ILLEGAL);
3555 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
3560 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
3567 if (!creature_ptr->energy_use && !now_message)
3568 now_message = old_now_message;
3573 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
3576 static void pack_overflow(player_type *owner_ptr)
3578 if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0) return;
3580 GAME_TEXT o_name[MAX_NLEN];
3582 update_creature(owner_ptr);
3583 if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
3585 o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
3586 disturb(owner_ptr, FALSE, TRUE);
3587 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
3589 object_desc(owner_ptr, o_name, o_ptr, 0);
3590 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
3591 (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
3593 vary_item(owner_ptr, INVEN_PACK, -255);
3594 handle_stuff(owner_ptr);
3599 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
3602 static void process_upkeep_with_speed(player_type *creature_ptr)
3604 if (!load && creature_ptr->enchant_energy_need > 0 && !creature_ptr->leaving)
3606 creature_ptr->enchant_energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
3609 if (creature_ptr->enchant_energy_need > 0) return;
3611 while (creature_ptr->enchant_energy_need <= 0)
3613 if (!load) check_music(creature_ptr);
3614 if (!load) check_hex(creature_ptr);
3615 if (!load) revenge_spell(creature_ptr);
3617 creature_ptr->enchant_energy_need += ENERGY_NEED();
3622 static void process_fishing(player_type *creature_ptr)
3624 Term_xtra(TERM_XTRA_DELAY, 10);
3628 bool success = FALSE;
3629 get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
3630 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);
3632 if (r_idx && one_in_(2))
3635 y = creature_ptr->y + ddy[creature_ptr->fishing_dir];
3636 x = creature_ptr->x + ddx[creature_ptr->fishing_dir];
3637 if (place_monster_aux(creature_ptr, 0, y, x, r_idx, PM_NO_KAGE))
3639 GAME_TEXT m_name[MAX_NLEN];
3640 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);
3641 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
3648 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
3651 disturb(creature_ptr, FALSE, TRUE);
3657 * @brief プレイヤーの行動処理 / Process the player
3660 * Notice the annoying code to handle "pack overflow", which\n
3661 * must come first just in case somebody manages to corrupt\n
3662 * the savefiles by clever use of menu commands or something.\n
3664 static void process_player(player_type *creature_ptr)
3666 if (creature_ptr->hack_mutation)
3668 msg_print(_("何か変わった気がする!", "You feel different!"));
3670 (void)gain_mutation(creature_ptr, 0);
3671 creature_ptr->hack_mutation = FALSE;
3674 if (creature_ptr->invoking_midnight_curse)
3677 activate_ty_curse(creature_ptr, FALSE, &count);
3678 creature_ptr->invoking_midnight_curse = FALSE;
3681 if (creature_ptr->phase_out)
3683 for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
3685 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
3686 if (!monster_is_valid(m_ptr)) continue;
3688 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
3689 update_monster(creature_ptr, m_idx, FALSE);
3692 print_time(creature_ptr);
3694 else if (!(load && creature_ptr->energy_need <= 0))
3696 creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
3699 if (creature_ptr->energy_need > 0) return;
3700 if (!command_rep) print_time(creature_ptr);
3702 if (creature_ptr->resting < 0)
3704 if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
3706 if ((creature_ptr->chp == creature_ptr->mhp) &&
3707 (creature_ptr->csp >= creature_ptr->msp))
3709 set_action(creature_ptr, ACTION_NONE);
3712 else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
3714 if ((creature_ptr->chp == creature_ptr->mhp) &&
3715 (creature_ptr->csp >= creature_ptr->msp) &&
3716 !creature_ptr->blind && !creature_ptr->confused &&
3717 !creature_ptr->poisoned && !creature_ptr->afraid &&
3718 !creature_ptr->stun && !creature_ptr->cut &&
3719 !creature_ptr->slow && !creature_ptr->paralyzed &&
3720 !creature_ptr->image && !creature_ptr->word_recall &&
3721 !creature_ptr->alter_reality)
3723 set_action(creature_ptr, ACTION_NONE);
3728 if (creature_ptr->action == ACTION_FISH) process_fishing(creature_ptr);
3732 if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
3738 disturb(creature_ptr, FALSE, TRUE);
3739 msg_print(_("中断しました。", "Canceled."));
3744 if (creature_ptr->riding && !creature_ptr->confused && !creature_ptr->blind)
3746 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
3747 monster_race *r_ptr = &r_info[m_ptr->r_idx];
3748 if (MON_CSLEEP(m_ptr))
3750 GAME_TEXT m_name[MAX_NLEN];
3751 (void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
3752 monster_desc(creature_ptr, m_name, m_ptr, 0);
3753 msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
3756 if (MON_STUNNED(m_ptr))
3758 if (set_monster_stunned(creature_ptr, creature_ptr->riding,
3759 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
3761 GAME_TEXT m_name[MAX_NLEN];
3762 monster_desc(creature_ptr, m_name, m_ptr, 0);
3763 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
3767 if (MON_CONFUSED(m_ptr))
3769 if (set_monster_confused(creature_ptr, creature_ptr->riding,
3770 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
3772 GAME_TEXT m_name[MAX_NLEN];
3773 monster_desc(creature_ptr, m_name, m_ptr, 0);
3774 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
3778 if (MON_MONFEAR(m_ptr))
3780 if (set_monster_monfear(creature_ptr, creature_ptr->riding,
3781 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
3783 GAME_TEXT m_name[MAX_NLEN];
3784 monster_desc(creature_ptr, m_name, m_ptr, 0);
3785 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer afraid."), m_name);
3789 handle_stuff(creature_ptr);
3793 if (creature_ptr->lightspeed)
3795 (void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
3798 if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
3800 if (P_PTR_KI < 40) P_PTR_KI = 0;
3801 else P_PTR_KI -= 40;
3802 creature_ptr->update |= (PU_BONUS);
3805 if (creature_ptr->action == ACTION_LEARN)
3808 u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
3809 s64b_LSHIFT(cost, cost_frac, 16);
3810 if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
3812 creature_ptr->csp = 0;
3813 creature_ptr->csp_frac = 0;
3814 set_action(creature_ptr, ACTION_NONE);
3818 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
3821 creature_ptr->redraw |= PR_MANA;
3824 if (creature_ptr->special_defense & KATA_MASK)
3826 if (creature_ptr->special_defense & KATA_MUSOU)
3828 if (creature_ptr->csp < 3)
3830 set_action(creature_ptr, ACTION_NONE);
3834 creature_ptr->csp -= 2;
3835 creature_ptr->redraw |= (PR_MANA);
3840 /*** Handle actual user input ***/
3841 while (creature_ptr->energy_need <= 0)
3843 creature_ptr->window |= PW_PLAYER;
3844 creature_ptr->sutemi = FALSE;
3845 creature_ptr->counter = FALSE;
3846 creature_ptr->now_damaged = FALSE;
3848 handle_stuff(creature_ptr);
3849 move_cursor_relative(creature_ptr->y, creature_ptr->x);
3850 if (fresh_before) Term_fresh();
3852 pack_overflow(creature_ptr);
3853 if (!command_new) command_see = FALSE;
3855 free_turn(creature_ptr);
3856 if (creature_ptr->phase_out)
3858 move_cursor_relative(creature_ptr->y, creature_ptr->x);
3859 command_cmd = SPECIAL_KEY_BUILDING;
3860 process_command(creature_ptr);
3862 else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
3864 take_turn(creature_ptr, 100);
3866 else if (creature_ptr->action == ACTION_REST)
3868 if (creature_ptr->resting > 0)
3870 creature_ptr->resting--;
3871 if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
3872 creature_ptr->redraw |= (PR_STATE);
3875 take_turn(creature_ptr, 100);
3877 else if (creature_ptr->action == ACTION_FISH)
3879 take_turn(creature_ptr, 100);
3881 else if (creature_ptr->running)
3883 run_step(creature_ptr, 0);
3885 else if (travel.run)
3887 travel_step(creature_ptr);
3889 else if (command_rep)
3892 creature_ptr->redraw |= (PR_STATE);
3893 handle_stuff(creature_ptr);
3896 process_command(creature_ptr);
3900 move_cursor_relative(creature_ptr->y, creature_ptr->x);
3902 request_command(creature_ptr, FALSE);
3904 process_command(creature_ptr);
3907 pack_overflow(creature_ptr);
3908 if (creature_ptr->energy_use)
3910 if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
3912 creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
3916 creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
3919 if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
3921 for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
3923 monster_type *m_ptr;
3924 monster_race *r_ptr;
3925 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
3926 if (!monster_is_valid(m_ptr)) continue;
3927 if (!m_ptr->ml) continue;
3929 r_ptr = &r_info[m_ptr->ap_r_idx];
3930 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
3933 lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
3936 if (repair_monsters)
3938 repair_monsters = FALSE;
3939 for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
3941 monster_type *m_ptr;
3942 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
3943 if (!monster_is_valid(m_ptr)) continue;
3945 if (m_ptr->mflag & MFLAG_NICE)
3947 m_ptr->mflag &= ~(MFLAG_NICE);
3950 if (m_ptr->mflag2 & MFLAG2_MARK)
3952 if (m_ptr->mflag2 & MFLAG2_SHOW)
3954 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
3955 repair_monsters = TRUE;
3959 m_ptr->mflag2 &= ~(MFLAG2_MARK);
3961 update_monster(creature_ptr, m_idx, FALSE);
3962 if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
3963 if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
3965 lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
3971 if (creature_ptr->pclass == CLASS_IMITATOR)
3973 if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
3975 creature_ptr->mane_num--;
3976 for (int j = 0; j < creature_ptr->mane_num; j++)
3978 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
3979 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
3983 creature_ptr->new_mane = FALSE;
3984 creature_ptr->redraw |= (PR_IMITATION);
3987 if (creature_ptr->action == ACTION_LEARN)
3989 creature_ptr->new_mane = FALSE;
3990 creature_ptr->redraw |= (PR_STATE);
3993 if (creature_ptr->timewalk && (creature_ptr->energy_need > -1000))
3996 creature_ptr->redraw |= (PR_MAP);
3997 creature_ptr->update |= (PU_MONSTERS);
3998 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4000 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4002 creature_ptr->timewalk = FALSE;
4003 creature_ptr->energy_need = ENERGY_NEED();
4005 handle_stuff(creature_ptr);
4009 if (!creature_ptr->playing || creature_ptr->is_dead)
4011 creature_ptr->timewalk = FALSE;
4015 if (creature_ptr->energy_use && creature_ptr->reset_concent)
4016 reset_concentration(creature_ptr, TRUE);
4018 if (creature_ptr->leaving) break;
4021 update_smell(creature_ptr->current_floor_ptr, creature_ptr);
4026 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4030 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4031 * ゲームを終了するかのいずれかまでループする。
4034 * This function will not exit until the level is completed,\n
4035 * the user dies, or the game is terminated.\n
4038 static void dungeon(player_type *player_ptr, bool load_game)
4040 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4041 floor_ptr->base_level = floor_ptr->dun_level;
4042 current_world_ptr->is_loading_now = FALSE;
4043 player_ptr->leaving = FALSE;
4051 player_ptr->pet_t_m_idx = 0;
4052 player_ptr->riding_t_m_idx = 0;
4053 player_ptr->ambush_flag = FALSE;
4054 health_track(player_ptr, 0);
4055 repair_monsters = TRUE;
4056 repair_objects = TRUE;
4058 disturb(player_ptr, TRUE, TRUE);
4059 int quest_num = quest_num = quest_number(player_ptr, floor_ptr->dun_level);
4062 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4065 if (player_ptr->max_plv < player_ptr->lev)
4067 player_ptr->max_plv = player_ptr->lev;
4070 if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
4072 max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
4073 if (record_maxdepth) exe_write_diary(player_ptr, DIARY_MAXDEAPTH, floor_ptr->dun_level, NULL);
4076 (void)calculate_upkeep(player_ptr);
4077 panel_bounds_center();
4078 verify_panel(player_ptr);
4081 current_world_ptr->character_xtra = TRUE;
4082 player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4083 player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4084 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);
4085 handle_stuff(player_ptr);
4087 current_world_ptr->character_xtra = FALSE;
4088 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4089 player_ptr->update |= (PU_COMBINE | PU_REORDER);
4090 handle_stuff(player_ptr);
4093 if (quest_num && (is_fixed_quest_idx(quest_num) &&
4094 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
4095 !(quest[quest_num].flags & QUEST_FLAG_PRESET))))
4096 do_cmd_feeling(player_ptr);
4098 if (player_ptr->phase_out)
4102 player_ptr->energy_need = 0;
4103 update_gambling_monsters(player_ptr);
4107 msg_print(_("試合開始!", "Ready..Fight!"));
4112 if ((player_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(player_ptr) > MUSIC_DETECT))
4113 SINGING_SONG_EFFECT(player_ptr) = MUSIC_DETECT;
4115 if (!player_ptr->playing || player_ptr->is_dead) return;
4117 if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
4119 quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
4120 floor_ptr->inside_quest = random_quest_number(player_ptr, floor_ptr->dun_level);
4122 if ((floor_ptr->dun_level == d_info[player_ptr->dungeon_idx].maxdepth) && d_info[player_ptr->dungeon_idx].final_guardian)
4124 if (r_info[d_info[player_ptr->dungeon_idx].final_guardian].max_num)
4126 msg_format("この階には%sの主である%sが棲んでいる。",
4127 d_name + d_info[player_ptr->dungeon_idx].name,
4128 r_name + r_info[d_info[player_ptr->dungeon_idx].final_guardian].name);
4130 msg_format("%^s lives in this level as the keeper of %s.",
4131 r_name + r_info[d_info[player_ptr->dungeon_idx].final_guardian].name,
4132 d_name + d_info[player_ptr->dungeon_idx].name);
4136 if (!load_game && (player_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(player_ptr, FALSE);
4138 floor_ptr->monster_level = floor_ptr->base_level;
4139 floor_ptr->object_level = floor_ptr->base_level;
4140 current_world_ptr->is_loading_now = TRUE;
4141 if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
4142 (floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
4143 player_ptr->energy_need = 0;
4145 player_ptr->leaving_dungeon = FALSE;
4146 mproc_init(floor_ptr);
4150 if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out)
4151 compact_monsters(player_ptr, 64);
4153 if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out)
4154 compact_monsters(player_ptr, 0);
4156 if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx)
4157 compact_objects(player_ptr, 64);
4159 if (floor_ptr->o_cnt + 32 < floor_ptr->o_max)
4160 compact_objects(player_ptr, 0);
4162 process_player(player_ptr);
4163 process_upkeep_with_speed(player_ptr);
4164 handle_stuff(player_ptr);
4166 move_cursor_relative(player_ptr->y, player_ptr->x);
4167 if (fresh_after) Term_fresh();
4169 if (!player_ptr->playing || player_ptr->is_dead) break;
4171 process_monsters(player_ptr);
4172 handle_stuff(player_ptr);
4174 move_cursor_relative(player_ptr->y, player_ptr->x);
4175 if (fresh_after) Term_fresh();
4177 if (!player_ptr->playing || player_ptr->is_dead) break;
4179 process_world(player_ptr);
4180 handle_stuff(player_ptr);
4182 move_cursor_relative(player_ptr->y, player_ptr->x);
4183 if (fresh_after) Term_fresh();
4185 if (!player_ptr->playing || player_ptr->is_dead) break;
4187 current_world_ptr->game_turn++;
4188 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
4190 if (!player_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
4191 else if (player_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
4194 prevent_turn_overflow(player_ptr);
4196 if (player_ptr->leaving) break;
4198 if (wild_regen) wild_regen--;
4201 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
4203 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
4206 if (player_ptr->playing && !player_ptr->is_dead)
4209 * Maintain Unique monsters and artifact, save current
4210 * floor, then prepare next floor
4212 leave_floor(player_ptr);
4213 reinit_wilderness = FALSE;
4221 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
4222 * @paaram player_ptr プレーヤーへの参照ポインタ
4225 * Modified by Arcum Dagsson to support
4226 * separate macro files for different realms.
4228 static void load_all_pref_files(player_type *player_ptr)
4231 sprintf(buf, "user.prf");
4232 process_pref_file(player_ptr, buf);
4233 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
4234 process_pref_file(player_ptr, buf);
4235 sprintf(buf, "%s.prf", rp_ptr->title);
4236 process_pref_file(player_ptr, buf);
4237 sprintf(buf, "%s.prf", cp_ptr->title);
4238 process_pref_file(player_ptr, buf);
4239 sprintf(buf, "%s.prf", player_ptr->base_name);
4240 process_pref_file(player_ptr, buf);
4241 if (player_ptr->realm1 != REALM_NONE)
4243 sprintf(buf, "%s.prf", realm_names[player_ptr->realm1]);
4244 process_pref_file(player_ptr, buf);
4247 if (player_ptr->realm2 != REALM_NONE)
4249 sprintf(buf, "%s.prf", realm_names[player_ptr->realm2]);
4250 process_pref_file(player_ptr, buf);
4253 autopick_load_pref(player_ptr, FALSE);
4258 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
4261 * If the "new_game" parameter is true, then, after loading the
4262 * savefile, we will commit suicide, if necessary, to allow the
4263 * player to start a new game.
4265 void play_game(player_type *player_ptr, bool new_game)
4267 bool load_game = TRUE;
4268 bool init_random_seed = FALSE;
4278 else if (chuukei_server)
4280 prepare_chuukei_hooks();
4286 reset_visuals(player_ptr);
4291 player_ptr->hack_mutation = FALSE;
4292 current_world_ptr->character_icky = TRUE;
4293 Term_activate(angband_term[0]);
4294 angband_term[0]->resize_hook = resize_map;
4295 for (MONSTER_IDX i = 1; i < 8; i++)
4297 if (angband_term[i])
4299 angband_term[i]->resize_hook = redraw_window;
4303 (void)Term_set_cursor(0);
4304 if (!load_player(player_ptr))
4306 quit(_("セーブファイルが壊れています", "broken savefile"));
4309 extract_option_vars();
4310 if (player_ptr->wait_report_score)
4315 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
4318 player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4319 update_creature(player_ptr);
4320 player_ptr->is_dead = TRUE;
4321 current_world_ptr->start_time = (u32b)time(NULL);
4322 signals_ignore_tstp();
4323 current_world_ptr->character_icky = TRUE;
4324 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
4325 highscore_fd = fd_open(buf, O_RDWR);
4327 /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
4328 process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
4329 success = send_world_score(player_ptr, TRUE, update_playtime);
4331 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
4333 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
4338 player_ptr->wait_report_score = FALSE;
4339 top_twenty(player_ptr);
4340 if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
4343 (void)fd_close(highscore_fd);
4345 signals_handle_tstp();
4350 current_world_ptr->creating_savefile = new_game;
4352 if (!current_world_ptr->character_loaded)
4355 current_world_ptr->character_dungeon = FALSE;
4356 init_random_seed = TRUE;
4357 init_saved_floors(player_ptr, FALSE);
4361 init_saved_floors(player_ptr, TRUE);
4366 process_player_name(player_ptr, FALSE);
4369 if (init_random_seed)
4374 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4377 current_world_ptr->character_dungeon = FALSE;
4379 floor_ptr->dun_level = 0;
4380 floor_ptr->inside_quest = 0;
4381 floor_ptr->inside_arena = FALSE;
4382 player_ptr->phase_out = FALSE;
4385 current_world_ptr->seed_flavor = randint0(0x10000000);
4386 current_world_ptr->seed_town = randint0(0x10000000);
4388 player_birth(player_ptr);
4389 counts_write(player_ptr, 2, 0);
4390 player_ptr->count = 0;
4392 determine_bounty_uniques(player_ptr);
4393 determine_daily_bounty(player_ptr, FALSE);
4394 wipe_o_list(floor_ptr);
4398 write_level = FALSE;
4399 exe_write_diary(player_ptr, DIARY_GAMESTART, 1,
4401 " ---- Restart Game ----"));
4404 * todo もう2.2.Xなので互換性は打ち切ってもいいのでは?
4405 * 1.0.9 以前はセーブ前に player_ptr->riding = -1 としていたので、再設定が必要だった。
4406 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
4408 if (player_ptr->riding == -1)
4410 player_ptr->riding = 0;
4411 for (MONSTER_IDX i = floor_ptr->m_max; i > 0; i--)
4413 if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
4415 player_ptr->riding = i;
4422 current_world_ptr->creating_savefile = FALSE;
4424 player_ptr->teleport_town = FALSE;
4425 player_ptr->sutemi = FALSE;
4426 current_world_ptr->timewalk_m_idx = 0;
4427 player_ptr->now_damaged = FALSE;
4429 current_world_ptr->start_time = time(NULL) - 1;
4430 record_o_name[0] = '\0';
4432 panel_row_min = floor_ptr->height;
4433 panel_col_min = floor_ptr->width;
4434 if (player_ptr->pseikaku == SEIKAKU_SEXY)
4435 s_info[player_ptr->pclass].w_max[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
4437 set_floor_and_wall(player_ptr->dungeon_idx);
4439 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
4444 if (enter_wizard_mode(player_ptr))
4446 current_world_ptr->wizard = TRUE;
4448 if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
4450 init_saved_floors(player_ptr, TRUE);
4451 floor_ptr->inside_quest = 0;
4452 player_ptr->y = player_ptr->x = 10;
4455 else if (player_ptr->is_dead)
4457 quit("Already dead.");
4461 if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
4463 process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
4464 init_flags = INIT_ONLY_BUILDINGS;
4465 process_dungeon_file(player_ptr, "t_info.txt", 0, 0, MAX_HGT, MAX_WID);
4466 select_floor_music(player_ptr);
4469 if (!current_world_ptr->character_dungeon)
4471 change_floor(player_ptr);
4475 if (player_ptr->panic_save)
4477 if (!player_ptr->y || !player_ptr->x)
4479 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location, regenerate the dungeon floor."));
4480 change_floor(player_ptr);
4483 if (!player_ptr->y || !player_ptr->x) player_ptr->y = player_ptr->x = 10;
4485 player_ptr->panic_save = 0;
4489 current_world_ptr->character_generated = TRUE;
4490 current_world_ptr->character_icky = FALSE;
4495 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name(player_ptr));
4496 exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, buf);
4499 player_ptr->playing = TRUE;
4500 reset_visuals(player_ptr);
4501 load_all_pref_files(player_ptr);
4504 player_outfit(player_ptr);
4507 Term_xtra(TERM_XTRA_REACT, 0);
4509 player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
4510 player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
4511 handle_stuff(player_ptr);
4513 if (arg_force_original) rogue_like_commands = FALSE;
4514 if (arg_force_roguelike) rogue_like_commands = TRUE;
4516 if (player_ptr->chp < 0) player_ptr->is_dead = TRUE;
4518 if (player_ptr->prace == RACE_ANDROID) calc_android_exp(player_ptr);
4520 if (new_game && ((player_ptr->pclass == CLASS_CAVALRY) || (player_ptr->pclass == CLASS_BEASTMASTER)))
4522 monster_type *m_ptr;
4523 MONRACE_IDX pet_r_idx = ((player_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
4524 monster_race *r_ptr = &r_info[pet_r_idx];
4525 place_monster_aux(player_ptr, 0, player_ptr->y, player_ptr->x - 1, pet_r_idx,
4526 (PM_FORCE_PET | PM_NO_KAGE));
4527 m_ptr = &floor_ptr->m_list[hack_m_idx_ii];
4528 m_ptr->mspeed = r_ptr->speed;
4529 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside + 1) / 2;
4530 m_ptr->max_maxhp = m_ptr->maxhp;
4531 m_ptr->hp = r_ptr->hdice*(r_ptr->hside + 1) / 2;
4532 m_ptr->dealt_damage = 0;
4533 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
4536 (void)combine_and_reorder_home(STORE_HOME);
4537 (void)combine_and_reorder_home(STORE_MUSEUM);
4538 select_floor_music(player_ptr);
4542 dungeon(player_ptr, load_game);
4543 current_world_ptr->character_xtra = TRUE;
4544 handle_stuff(player_ptr);
4546 current_world_ptr->character_xtra = FALSE;
4548 health_track(player_ptr, 0);
4549 forget_lite(floor_ptr);
4550 forget_view(floor_ptr);
4551 clear_mon_lite(floor_ptr);
4552 if (!player_ptr->playing && !player_ptr->is_dead) break;
4554 wipe_o_list(floor_ptr);
4555 if (!player_ptr->is_dead) wipe_monsters_list(player_ptr);
4559 if (player_ptr->playing && player_ptr->is_dead)
4561 if (floor_ptr->inside_arena)
4563 floor_ptr->inside_arena = FALSE;
4564 if (player_ptr->arena_number > MAX_ARENA_MONS)
4565 player_ptr->arena_number++;
4567 player_ptr->arena_number = -1 - player_ptr->arena_number;
4568 player_ptr->is_dead = FALSE;
4569 player_ptr->chp = 0;
4570 player_ptr->chp_frac = 0;
4571 player_ptr->exit_bldg = TRUE;
4572 reset_tim_flags(player_ptr);
4573 prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
4574 leave_floor(player_ptr);
4578 if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
4580 cheat_death(player_ptr);
4585 if (player_ptr->is_dead) break;
4587 change_floor(player_ptr);
4590 close_game(player_ptr);
4596 * @brief ゲームターンからの実時間換算を行うための補正をかける
4597 * @param hoge ゲームターン
4598 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
4599 * @return 修正をかけた後のゲームターン
4601 s32b turn_real(player_type *player_ptr, s32b hoge)
4603 switch (player_ptr->start_race)
4609 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
4617 * @brief ターンのオーバーフローに対する対処
4618 * @param player_ptr プレーヤーへの参照ポインタ
4619 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
4620 * @return 修正をかけた後のゲームターン
4622 void prevent_turn_overflow(player_type *player_ptr)
4624 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
4626 int rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
4627 s32b rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
4629 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
4630 else current_world_ptr->game_turn = 1;
4631 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4632 if (floor_ptr->generated_turn > rollback_turns) floor_ptr->generated_turn -= rollback_turns;
4633 else floor_ptr->generated_turn = 1;
4634 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
4635 else current_world_ptr->arena_start_turn = 1;
4636 if (player_ptr->feeling_turn > rollback_turns) player_ptr->feeling_turn -= rollback_turns;
4637 else player_ptr->feeling_turn = 1;
4639 for (int i = 1; i < max_towns; i++)
4641 for (int j = 0; j < MAX_STORES; j++)
4643 store_type *st_ptr = &town_info[i].store[j];
4645 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
4647 st_ptr->last_visit -= rollback_turns;
4648 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
4651 if (st_ptr->store_open)
4653 st_ptr->store_open -= rollback_turns;
4654 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
4663 * Close up the current game (player may or may not be dead)
4664 * @param creature_ptr プレーヤーへの参照ポインタ
4668 * This function is called only from "main.c" and "signals.c".
4671 void close_game(player_type *player_ptr)
4674 bool do_send = TRUE;
4675 handle_stuff(player_ptr);
4680 signals_ignore_tstp();
4682 current_world_ptr->character_icky = TRUE;
4683 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
4685 highscore_fd = fd_open(buf, O_RDWR);
4688 if (player_ptr->is_dead)
4690 if (current_world_ptr->total_winner) kingly(player_ptr);
4692 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
4694 if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
4696 else do_send = FALSE;
4698 print_tomb(player_ptr, read_dead_file);
4701 show_info(player_ptr, handle_stuff, file_character, update_playtime, display_player);
4704 if (check_score(player_ptr))
4706 if ((!send_world_score(player_ptr, do_send, update_playtime)))
4708 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
4709 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
4711 player_ptr->wait_report_score = TRUE;
4712 player_ptr->is_dead = FALSE;
4713 if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
4716 if (!player_ptr->wait_report_score)
4717 (void)top_twenty(player_ptr);
4719 else if (highscore_fd >= 0)
4721 display_scores_aux(0, 10, -1, NULL);
4726 do_cmd_save_game(player_ptr, FALSE);
4727 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
4728 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
4729 if (inkey() != ESCAPE) predict_score(player_ptr);
4732 (void)fd_close(highscore_fd);
4734 clear_saved_floor_files(player_ptr);
4735 signals_handle_tstp();
4740 * @brief 全更新処理をチェックして処理していく
4741 * Handle "player_ptr->update" and "player_ptr->redraw" and "player_ptr->window"
4744 void handle_stuff(player_type *player_ptr)
4746 if (player_ptr->update) update_creature(player_ptr);
4747 if (player_ptr->redraw) redraw_stuff(player_ptr);
4748 if (player_ptr->window) window_stuff(player_ptr);
4752 void update_output(player_type *player_ptr)
4754 if (player_ptr->redraw) redraw_stuff(player_ptr);
4755 if (player_ptr->window) window_stuff(player_ptr);