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.
23 #include "cmd-activate.h"
26 #include "cmd-hissatsu.h"
28 #include "cmd-magiceat.h"
30 #include "cmd-quaff.h"
32 #include "cmd-smith.h"
33 #include "cmd-usestaff.h"
34 #include "cmd-zaprod.h"
35 #include "cmd-zapwand.h"
37 #include "cmd-basic.h"
43 #include "floor-events.h"
44 #include "floor-town.h"
46 #include "object-ego.h"
47 #include "object-curse.h"
48 #include "object-flavor.h"
51 #include "spells-summon.h"
52 #include "spells-object.h"
53 #include "spells-status.h"
54 #include "spells-floor.h"
55 #include "monster-spell.h"
62 #include "player-move.h"
63 #include "player-status.h"
64 #include "player-class.h"
65 #include "player-race.h"
66 #include "player-personality.h"
67 #include "player-damage.h"
68 #include "player-effects.h"
69 #include "cmd-spell.h"
70 #include "realm-hex.h"
71 #include "objectkind.h"
72 #include "object-hook.h"
74 #include "monster-process.h"
75 #include "monster-status.h"
76 #include "monsterrace-hook.h"
77 #include "floor-save.h"
79 #include "player-skill.h"
80 #include "player-inventory.h"
82 #include "view-mainwindow.h"
83 #include "dungeon-file.h"
89 #include "realm-song.h"
90 #include "targeting.h"
94 * Hack -- Link a copyright message into the executable
96 const concptr copyright[5] =
98 "Copyright (c) 1989 James E. Wilson, Robert A. Keoneke",
100 "This software may be copied and distributed for educational, research,",
101 "and not for profit purposes provided that this copyright and statement",
102 "are included in all such copies."
105 bool can_save = FALSE; /* Game can be saved */
107 COMMAND_CODE now_message;
109 bool repair_monsters; /* Hack -- optimize detect monsters */
110 bool repair_objects; /* Hack -- optimize detect objects */
112 concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
115 concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
117 concptr ANGBAND_KEYBOARD = "0";
120 concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
122 static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
123 static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
126 * Flags for initialization
131 * @brief 擬似鑑定を実際に行い判定を反映する
132 * @param slot 擬似鑑定を行うプレイヤーの所持リストID
133 * @param heavy 重度の擬似鑑定を行うならばTRUE
136 static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy)
139 object_type *o_ptr = &p_ptr->inventory_list[slot];
140 GAME_TEXT o_name[MAX_NLEN];
142 /* We know about it already, do not tell us again */
143 if (o_ptr->ident & (IDENT_SENSE))return;
145 /* It is fully known, no information needed */
146 if (object_is_known(o_ptr)) return;
148 /* Check for a feeling */
149 feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
151 /* Skip non-feelings */
155 if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
166 feel = FEEL_EXCELLENT;
172 feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
174 feel = FEEL_UNCURSED;
179 feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
185 feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
192 feel = FEEL_WORTHLESS;
197 feel = FEEL_TERRIBLE;
203 /* Stop everything */
204 if (disturb_minor) disturb(p_ptr, FALSE, FALSE);
206 /* Get an object description */
207 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
209 /* Message (equipment) */
210 if (slot >= INVEN_RARM)
213 msg_format("%s%s(%c)は%sという感じがする...",
214 describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
216 msg_format("You feel the %s (%c) you are %s %s %s...",
217 o_name, index_to_label(slot), describe_use(slot),
218 ((o_ptr->number == 1) ? "is" : "are"),
219 game_inscriptions[feel]);
224 /* Message (p_ptr->inventory_list) */
228 msg_format("ザックの中の%s(%c)は%sという感じがする...",
229 o_name, index_to_label(slot),game_inscriptions[feel]);
231 msg_format("You feel the %s (%c) in your pack %s %s...",
232 o_name, index_to_label(slot),
233 ((o_ptr->number == 1) ? "is" : "are"),
234 game_inscriptions[feel]);
239 o_ptr->ident |= (IDENT_SENSE);
241 /* Set the "inscription" */
242 o_ptr->feeling = feel;
244 /* Auto-inscription/destroy */
245 autopick_alter_item(slot, destroy_feeling);
246 p_ptr->update |= (PU_COMBINE | PU_REORDER);
248 p_ptr->window |= (PW_INVEN | PW_EQUIP);
254 * @brief 1プレイヤーターン毎に武器、防具の擬似鑑定が行われるかを判定する。
257 * Sense the p_ptr->inventory_list\n
259 * Class 0 = Warrior --> fast and heavy\n
260 * Class 1 = Mage --> slow and light\n
261 * Class 2 = Priest --> fast but light\n
262 * Class 3 = Rogue --> okay and heavy\n
263 * Class 4 = Ranger --> slow but heavy (changed!)\n
264 * Class 5 = Paladin --> slow but heavy\n
266 static void sense_inventory1(player_type *creature_ptr)
269 PLAYER_LEVEL plev = creature_ptr->lev;
274 /*** Check for "sensing" ***/
276 /* No sensing when confused */
277 if (creature_ptr->confused) return;
279 /* Analyze the class */
280 switch (creature_ptr->pclass)
288 if (0 != randint0(9000L / (plev * plev + 40))) return;
299 if (0 != randint0(6000L / (plev * plev + 50))) return;
308 case CLASS_HIGH_MAGE:
310 case CLASS_MAGIC_EATER:
312 /* Very bad (light) sensing */
313 if (0 != randint0(240000L / (plev + 5))) return;
321 /* Good (light) sensing */
322 if (0 != randint0(10000L / (plev * plev + 40))) return;
331 if (0 != randint0(20000L / (plev * plev + 40))) return;
342 if (0 != randint0(95000L / (plev * plev + 40))) return;
354 if (0 != randint0(77777L / (plev * plev + 40))) return;
362 case CLASS_WARRIOR_MAGE:
366 if (0 != randint0(75000L / (plev * plev + 40))) return;
371 case CLASS_MINDCRAFTER:
373 case CLASS_BLUE_MAGE:
374 case CLASS_MIRROR_MASTER:
377 if (0 != randint0(55000L / (plev * plev + 40))) return;
382 case CLASS_CHAOS_WARRIOR:
385 if (0 != randint0(80000L / (plev * plev + 40))) return;
394 case CLASS_FORCETRAINER:
397 if (0 != randint0(20000L / (plev * plev + 40))) return;
405 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
413 case CLASS_BEASTMASTER:
416 if (0 != randint0(65000L / (plev * plev + 40))) return;
420 case CLASS_BERSERKER:
429 if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
431 /*** Sense everything ***/
433 /* Check everything */
434 for (i = 0; i < INVEN_TOTAL; i++)
438 o_ptr = &creature_ptr->inventory_list[i];
440 /* Skip empty slots */
441 if (!o_ptr->k_idx) continue;
443 /* Valid "tval" codes */
470 /* Skip non-sense machines */
473 /* Occasional failure on creature_ptr->inventory_list items */
474 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
477 if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
482 sense_inventory_aux(i, heavy);
487 * @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
490 static void sense_inventory2(player_type *creature_ptr)
493 PLAYER_LEVEL plev = creature_ptr->lev;
497 /*** Check for "sensing" ***/
499 /* No sensing when confused */
500 if (creature_ptr->confused) return;
502 /* Analyze the class */
503 switch (creature_ptr->pclass)
509 case CLASS_BERSERKER:
517 case CLASS_CHAOS_WARRIOR:
519 case CLASS_BEASTMASTER:
522 /* Very bad (light) sensing */
523 if (0 != randint0(240000L / (plev + 5))) return;
529 case CLASS_WARRIOR_MAGE:
534 if (0 != randint0(95000L / (plev * plev + 40))) return;
542 case CLASS_FORCETRAINER:
543 case CLASS_MINDCRAFTER:
546 if (0 != randint0(20000L / (plev * plev + 40))) return;
552 case CLASS_HIGH_MAGE:
554 case CLASS_MAGIC_EATER:
555 case CLASS_MIRROR_MASTER:
556 case CLASS_BLUE_MAGE:
559 if (0 != randint0(9000L / (plev * plev + 40))) return;
567 if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
573 /*** Sense everything ***/
575 /* Check everything */
576 for (i = 0; i < INVEN_TOTAL; i++)
580 o_ptr = &creature_ptr->inventory_list[i];
582 /* Skip empty slots */
583 if (!o_ptr->k_idx) continue;
585 /* Valid "tval" codes */
598 /* Skip non-sense machines */
601 /* Occasional failure on creature_ptr->inventory_list items */
602 if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
604 sense_inventory_aux(i, TRUE);
609 * @brief パターン終点到達時のテレポート処理を行う
612 static void pattern_teleport(player_type *creature_ptr)
615 DEPTH max_level = 99;
618 if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
623 /* Only downward in ironman mode */
624 if (ironman_downward)
625 min_level = creature_ptr->current_floor_ptr->dun_level;
628 if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
630 if (creature_ptr->current_floor_ptr->dun_level > 100)
631 max_level = MAX_DEPTH - 1;
632 else if (creature_ptr->current_floor_ptr->dun_level == 100)
637 max_level = d_info[creature_ptr->dungeon_idx].maxdepth;
638 min_level = d_info[creature_ptr->dungeon_idx].mindepth;
642 sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
645 sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
647 /* Ask for a level */
648 if (!get_string(ppp, tmp_val, 10)) return;
650 /* Extract request */
651 command_arg = (COMMAND_ARG)atoi(tmp_val);
653 else if (get_check(_("通常テレポート?", "Normal teleport? ")))
655 teleport_player(creature_ptr, 200, 0L);
662 if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
663 if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
666 msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
668 if (autosave_l) do_cmd_save_game(TRUE);
671 creature_ptr->current_floor_ptr->dun_level = command_arg;
675 if (record_stair) exe_write_diary(creature_ptr, NIKKI_PAT_TELE, 0, NULL);
677 creature_ptr->current_floor_ptr->inside_quest = 0;
678 free_turn(creature_ptr);
681 * Clear all saved floors
682 * and create a first saved floor
684 prepare_change_floor_mode(CFM_FIRST_FLOOR);
685 creature_ptr->leaving = TRUE;
689 * @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
690 * @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
692 static bool pattern_effect(player_type *creature_ptr)
696 if (!pattern_tile(creature_ptr->y, creature_ptr->x)) return FALSE;
698 if ((PRACE_IS_(creature_ptr, RACE_AMBERITE)) &&
699 (creature_ptr->cut > 0) && one_in_(10))
701 wreck_the_pattern(creature_ptr);
704 pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
706 switch (pattern_type)
708 case PATTERN_TILE_END:
709 (void)set_image(creature_ptr, 0);
710 (void)restore_all_status(creature_ptr);
711 (void)restore_level(creature_ptr);
712 (void)cure_critical_wounds(creature_ptr, 1000);
714 cave_set_feat(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_old);
715 msg_print(_("「パターン」のこの部分は他の部分より強力でないようだ。", "This section of the Pattern looks less powerful."));
718 * We could make the healing effect of the
719 * Pattern center one-time only to avoid various kinds
720 * of abuse, like luring the win monster into fighting you
721 * in the middle of the pattern...
725 case PATTERN_TILE_OLD:
729 case PATTERN_TILE_TELEPORT:
730 pattern_teleport(creature_ptr);
733 case PATTERN_TILE_WRECKED:
735 take_hit(creature_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
739 if (PRACE_IS_(creature_ptr, RACE_AMBERITE) && !one_in_(2))
741 else if (!IS_INVULN())
742 take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
751 * @brief プレイヤーのHP自然回復処理 / Regenerate hit points -RAK-
752 * @param percent 回復比率
755 static void regenhp(player_type *creature_ptr, int percent)
761 if (creature_ptr->special_defense & KATA_KOUKIJIN) return;
762 if (creature_ptr->action == ACTION_HAYAGAKE) return;
764 /* Save the old hitpoints */
765 old_chp = creature_ptr->chp;
768 * Extract the new hitpoints
770 * 'percent' is the Regen factor in unit (1/2^16)
773 new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
775 /* Convert the unit (1/2^16) to (1/2^32) */
776 s64b_LSHIFT(new_chp, new_chp_frac, 16);
779 s64b_add(&(creature_ptr->chp), &(creature_ptr->chp_frac), new_chp, new_chp_frac);
783 if (0 < s64b_cmp(creature_ptr->chp, creature_ptr->chp_frac, creature_ptr->mhp, 0))
785 creature_ptr->chp = creature_ptr->mhp;
786 creature_ptr->chp_frac = 0;
790 if (old_chp != creature_ptr->chp)
792 creature_ptr->redraw |= (PR_HP);
793 creature_ptr->window |= (PW_PLAYER);
800 * @brief プレイヤーのMP自然回復処理(regen_magic()のサブセット) / Regenerate mana points
801 * @param upkeep_factor ペット維持によるMPコスト量
802 * @param regen_amount 回復量
805 static void regenmana(player_type *creature_ptr, MANA_POINT upkeep_factor, MANA_POINT regen_amount)
807 MANA_POINT old_csp = creature_ptr->csp;
808 s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
811 * Excess mana will decay 32 times faster than normal
814 if (creature_ptr->csp > creature_ptr->msp)
816 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
818 u32b decay_frac = (creature_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
820 /* Convert the unit (1/2^16) to (1/2^32) */
821 s64b_LSHIFT(decay, decay_frac, 16);
824 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), decay, decay_frac);
827 if (creature_ptr->csp < creature_ptr->msp)
829 creature_ptr->csp = creature_ptr->msp;
830 creature_ptr->csp_frac = 0;
834 /* Regenerating mana (unless the player has excess mana) */
835 else if (regen_rate > 0)
837 /* (percent/100) is the Regen factor in unit (1/2^16) */
838 MANA_POINT new_mana = 0;
839 u32b new_mana_frac = (creature_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
841 /* Convert the unit (1/2^16) to (1/2^32) */
842 s64b_LSHIFT(new_mana, new_mana_frac, 16);
845 s64b_add(&(creature_ptr->csp), &(creature_ptr->csp_frac), new_mana, new_mana_frac);
847 /* Must set frac to zero even if equal */
848 if (creature_ptr->csp >= creature_ptr->msp)
850 creature_ptr->csp = creature_ptr->msp;
851 creature_ptr->csp_frac = 0;
856 /* Reduce mana (even when the player has excess mana) */
859 /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
860 s32b reduce_mana = 0;
861 u32b reduce_mana_frac = (creature_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
863 /* Convert the unit (1/2^16) to (1/2^32) */
864 s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
867 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), reduce_mana, reduce_mana_frac);
870 if (creature_ptr->csp < 0)
872 creature_ptr->csp = 0;
873 creature_ptr->csp_frac = 0;
877 if (old_csp != creature_ptr->csp)
879 creature_ptr->redraw |= (PR_MANA);
880 creature_ptr->window |= (PW_PLAYER);
881 creature_ptr->window |= (PW_SPELL);
887 * @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
888 * @param regen_amount 回復量
891 static void regenmagic(player_type *creature_ptr, int regen_amount)
896 int mult = (dev + adj_mag_mana[creature_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
898 for (i = 0; i < EATER_EXT*2; i++)
900 if (!creature_ptr->magic_num2[i]) continue;
901 if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
903 /* Increase remaining charge number like float value */
904 new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 13)) / (dev * 8);
905 creature_ptr->magic_num1[i] += new_mana;
907 /* Check maximum charge */
908 if (creature_ptr->magic_num1[i] > (creature_ptr->magic_num2[i] << 16))
910 creature_ptr->magic_num1[i] = ((long)creature_ptr->magic_num2[i] << 16);
914 for (i = EATER_EXT*2; i < EATER_EXT*3; i++)
916 if (!creature_ptr->magic_num1[i]) continue;
917 if (!creature_ptr->magic_num2[i]) continue;
919 /* Decrease remaining period for charging */
920 new_mana = (regen_amount * mult * ((long)creature_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
921 / (dev * 16 * PY_REGEN_NORMAL);
922 creature_ptr->magic_num1[i] -= new_mana;
924 /* Check minimum remaining period for charging */
925 if (creature_ptr->magic_num1[i] < 0) creature_ptr->magic_num1[i] = 0;
932 * @brief 100ゲームターン毎のモンスターのHP自然回復処理 / Regenerate the monsters (once per 100 game turns)
934 * @note Should probably be done during monster turns.
936 static void regen_monsters(void)
941 /* Regenerate everyone */
942 for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
944 /* Check the i'th monster */
945 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
946 monster_race *r_ptr = &r_info[m_ptr->r_idx];
948 if (!monster_is_valid(m_ptr)) continue;
950 /* Allow regeneration (if needed) */
951 if (m_ptr->hp < m_ptr->maxhp)
953 /* Hack -- Base regeneration */
954 frac = m_ptr->maxhp / 100;
956 /* Hack -- Minimal regeneration rate */
957 if (!frac) if (one_in_(2)) frac = 1;
959 /* Hack -- Some monsters regenerate quickly */
960 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
962 /* Hack -- Regenerate */
965 /* Do not over-regenerate */
966 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
968 /* Redraw (later) if needed */
969 if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
970 if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
977 * @brief 30ゲームターン毎のボール中モンスターのHP自然回復処理 / Regenerate the captured monsters (once per 30 game turns)
979 * @note Should probably be done during monster turns.
981 static void regen_captured_monsters(void)
986 /* Regenerate everyone */
987 for (i = 0; i < INVEN_TOTAL; i++)
990 object_type *o_ptr = &p_ptr->inventory_list[i];
992 if (!o_ptr->k_idx) continue;
993 if (o_ptr->tval != TV_CAPTURE) continue;
994 if (!o_ptr->pval) continue;
998 r_ptr = &r_info[o_ptr->pval];
1000 /* Allow regeneration (if needed) */
1001 if (o_ptr->xtra4 < o_ptr->xtra5)
1003 /* Hack -- Base regeneration */
1004 frac = o_ptr->xtra5 / 100;
1006 /* Hack -- Minimal regeneration rate */
1007 if (!frac) if (one_in_(2)) frac = 1;
1009 /* Hack -- Some monsters regenerate quickly */
1010 if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
1012 /* Hack -- Regenerate */
1013 o_ptr->xtra4 += (XTRA16)frac;
1015 /* Do not over-regenerate */
1016 if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
1023 p_ptr->update |= (PU_COMBINE);
1024 p_ptr->window |= (PW_INVEN);
1025 p_ptr->window |= (PW_EQUIP);
1031 * @brief 寿命つき光源の警告メッセージ処理
1032 * @param o_ptr 現在光源として使っているオブジェクトの構造体参照ポインタ
1035 static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
1037 /* Hack -- notice interesting fuel steps */
1038 if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
1040 creature_ptr->window |= (PW_EQUIP);
1043 /* Hack -- Special treatment when blind */
1044 if (creature_ptr->blind)
1046 /* Hack -- save some light for later */
1047 if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
1050 /* The light is now out */
1051 else if (o_ptr->xtra4 == 0)
1053 disturb(creature_ptr, FALSE, TRUE);
1054 msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
1056 /* Recalculate torch radius */
1057 creature_ptr->update |= (PU_TORCH);
1059 /* Some ego light lose its effects without fuel */
1060 creature_ptr->update |= (PU_BONUS);
1063 /* The light is getting dim */
1064 else if (o_ptr->name2 == EGO_LITE_LONG)
1066 if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
1067 && (current_world_ptr->game_turn % (TURNS_PER_TICK*2)))
1069 if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
1070 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1074 /* The light is getting dim */
1075 else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
1077 if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
1078 msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
1084 * @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
1085 * @param o_ptr 対象オブジェクトの構造体参照ポインタ
1088 static void recharged_notice(object_type *o_ptr)
1090 GAME_TEXT o_name[MAX_NLEN];
1094 /* No inscription */
1095 if (!o_ptr->inscription) return;
1098 s = my_strchr(quark_str(o_ptr->inscription), '!');
1100 /* Process notification request. */
1103 /* Find another '!' */
1106 /* Describe (briefly) */
1107 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1109 /* Notify the player */
1111 msg_format("%sは再充填された。", o_name);
1113 if (o_ptr->number > 1)
1114 msg_format("Your %s are recharged.", o_name);
1116 msg_format("Your %s is recharged.", o_name);
1119 disturb(p_ptr, FALSE, FALSE);
1125 /* Keep looking for '!'s */
1126 s = my_strchr(s + 1, '!');
1131 * @brief プレイヤーの歌に関する継続処理
1134 static void check_music(player_type *creature_ptr)
1136 const magic_type *s_ptr;
1138 MANA_POINT need_mana;
1139 u32b need_mana_frac;
1141 /* Music singed by player */
1142 if (creature_ptr->pclass != CLASS_BARD) return;
1143 if (!SINGING_SONG_EFFECT(creature_ptr) && !INTERUPTING_SONG_EFFECT(creature_ptr)) return;
1145 if (creature_ptr->anti_magic)
1147 stop_singing(creature_ptr);
1151 spell = SINGING_SONG_ID(creature_ptr);
1152 s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
1154 need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC);
1158 s64b_RSHIFT(need_mana, need_mana_frac, 1);
1160 if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, need_mana, need_mana_frac) < 0)
1162 stop_singing(creature_ptr);
1167 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), need_mana, need_mana_frac);
1169 creature_ptr->redraw |= PR_MANA;
1170 if (INTERUPTING_SONG_EFFECT(creature_ptr))
1172 SINGING_SONG_EFFECT(creature_ptr) = INTERUPTING_SONG_EFFECT(creature_ptr);
1173 INTERUPTING_SONG_EFFECT(creature_ptr) = MUSIC_NONE;
1174 msg_print(_("歌を再開した。", "You restart singing."));
1175 creature_ptr->action = ACTION_SING;
1176 creature_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
1177 creature_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1178 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1181 if (creature_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
1182 creature_ptr->spell_exp[spell] += 5;
1183 else if(creature_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
1184 { if (one_in_(2) && (p_ptr->current_floor_ptr->dun_level > 4) && ((p_ptr->current_floor_ptr->dun_level + 10) > creature_ptr->lev)) creature_ptr->spell_exp[spell] += 1; }
1185 else if(creature_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
1186 { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > creature_ptr->lev) && ((p_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; }
1187 else if(creature_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
1188 { if (one_in_(5) && ((p_ptr->current_floor_ptr->dun_level + 5) > creature_ptr->lev) && (p_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) creature_ptr->spell_exp[spell] += 1; }
1190 /* Do any effects of continual song */
1191 exe_spell(creature_ptr, REALM_MUSIC, spell, SPELL_CONT);
1195 * @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
1196 * @param flag 探し出したい呪いフラグ配列
1197 * @return 該当の呪いが一つでもあった場合にランダムに選ばれた装備品のオブジェクト構造体参照ポインタを返す。\n
1200 static object_type *choose_cursed_obj_name(BIT_FLAGS flag)
1203 int choices[INVEN_TOTAL-INVEN_RARM];
1206 /* Paranoia -- Player has no warning-item */
1207 if (!(p_ptr->cursed & flag)) return NULL;
1209 /* Search Inventry */
1210 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
1212 object_type *o_ptr = &p_ptr->inventory_list[i];
1214 if (o_ptr->curse_flags & flag)
1216 choices[number] = i;
1219 else if ((flag == TRC_ADD_L_CURSE) ||
1220 (flag == TRC_ADD_H_CURSE) ||
1221 (flag == TRC_DRAIN_HP) ||
1222 (flag == TRC_DRAIN_MANA) ||
1223 (flag == TRC_CALL_ANIMAL) ||
1224 (flag == TRC_CALL_DEMON) ||
1225 (flag == TRC_CALL_DRAGON) ||
1226 (flag == TRC_CALL_UNDEAD) ||
1227 (flag == TRC_COWARDICE) ||
1228 (flag == TRC_LOW_MELEE) ||
1229 (flag == TRC_LOW_AC) ||
1230 (flag == TRC_LOW_MAGIC) ||
1231 (flag == TRC_FAST_DIGEST) ||
1232 (flag == TRC_SLOW_REGEN) )
1235 BIT_FLAGS flgs[TR_FLAG_SIZE];
1236 object_flags(o_ptr, flgs);
1239 case TRC_ADD_L_CURSE : cf = TR_ADD_L_CURSE; break;
1240 case TRC_ADD_H_CURSE : cf = TR_ADD_H_CURSE; break;
1241 case TRC_DRAIN_HP : cf = TR_DRAIN_HP; break;
1242 case TRC_DRAIN_MANA : cf = TR_DRAIN_MANA; break;
1243 case TRC_CALL_ANIMAL : cf = TR_CALL_ANIMAL; break;
1244 case TRC_CALL_DEMON : cf = TR_CALL_DEMON; break;
1245 case TRC_CALL_DRAGON : cf = TR_CALL_DRAGON; break;
1246 case TRC_CALL_UNDEAD : cf = TR_CALL_UNDEAD; break;
1247 case TRC_COWARDICE : cf = TR_COWARDICE; break;
1248 case TRC_LOW_MELEE : cf = TR_LOW_MELEE; break;
1249 case TRC_LOW_AC : cf = TR_LOW_AC; break;
1250 case TRC_LOW_MAGIC : cf = TR_LOW_MAGIC; break;
1251 case TRC_FAST_DIGEST : cf = TR_FAST_DIGEST; break;
1252 case TRC_SLOW_REGEN : cf = TR_SLOW_REGEN; break;
1255 if (have_flag(flgs, cf))
1257 choices[number] = i;
1263 /* Choice one of them */
1264 return (&p_ptr->inventory_list[choices[randint0(number)]]);
1267 static void process_world_aux_digestion(player_type *creature_ptr)
1269 if (!creature_ptr->phase_out)
1271 /* Digest quickly when gorged */
1272 if (creature_ptr->food >= PY_FOOD_MAX)
1274 /* Digest a lot of food */
1275 (void)set_food(creature_ptr, creature_ptr->food - 100);
1278 /* Digest normally -- Every 50 game turns */
1279 else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
1281 /* Basic digestion rate based on speed */
1282 int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
1284 /* Regeneration takes more food */
1285 if (creature_ptr->regenerate)
1287 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1289 if (creature_ptr->cursed & TRC_FAST_DIGEST)
1292 /* Slow digestion takes less food */
1293 if (creature_ptr->slow_digest)
1296 /* Minimal digestion */
1297 if (digestion < 1) digestion = 1;
1298 /* Maximal digestion */
1299 if (digestion > 100) digestion = 100;
1301 /* Digest some food */
1302 (void)set_food(creature_ptr, creature_ptr->food - digestion);
1307 if ((creature_ptr->food < PY_FOOD_FAINT))
1309 /* Faint occasionally */
1310 if (!creature_ptr->paralyzed && (randint0(100) < 10))
1312 msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
1313 disturb(creature_ptr, TRUE, TRUE);
1315 /* Hack -- faint (bypass free action) */
1316 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
1319 /* Starve to death (slowly) */
1320 if (creature_ptr->food < PY_FOOD_STARVE)
1322 /* Calculate damage */
1323 HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
1325 if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
1332 * @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
1333 * / Handle timed damage and regeneration every 10 game turns
1336 static void process_world_aux_hp_and_sp(player_type *creature_ptr)
1338 feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
1339 bool cave_no_regen = FALSE;
1340 int upkeep_factor = 0;
1342 /* Default regeneration */
1343 int regen_amount = PY_REGEN_NORMAL;
1346 /*** Damage over Time ***/
1348 /* Take damage from poison */
1349 if (creature_ptr->poisoned && !IS_INVULN())
1351 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
1354 /* Take damage from cuts */
1355 if (creature_ptr->cut && !IS_INVULN())
1359 /* Mortal wound or Deep Gash */
1360 if (creature_ptr->cut > 1000)
1365 else if (creature_ptr->cut > 200)
1371 else if (creature_ptr->cut > 100)
1376 else if (creature_ptr->cut > 50)
1381 else if (creature_ptr->cut > 25)
1386 else if (creature_ptr->cut > 10)
1397 take_hit(creature_ptr, DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
1400 /* (Vampires) Take damage from sunlight */
1401 if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
1403 if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN() && is_daytime())
1405 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
1407 msg_print(_("日光があなたのアンデッドの肉体を焼き焦がした!", "The sun's rays scorch your undead flesh!"));
1408 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("日光", "sunlight"), -1);
1409 cave_no_regen = TRUE;
1413 if (creature_ptr->inventory_list[INVEN_LITE].tval && (creature_ptr->inventory_list[INVEN_LITE].name2 != EGO_LITE_DARKNESS) &&
1414 !creature_ptr->resist_lite)
1416 object_type * o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1417 GAME_TEXT o_name [MAX_NLEN];
1418 char ouch [MAX_NLEN+40];
1420 /* Get an object description */
1421 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1422 msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
1424 cave_no_regen = TRUE;
1426 /* Get an object description */
1427 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1428 sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
1430 if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
1434 if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !creature_ptr->immune_fire)
1438 if (have_flag(f_ptr->flags, FF_DEEP))
1440 damage = 6000 + randint0(4000);
1442 else if (!creature_ptr->levitation)
1444 damage = 3000 + randint0(2000);
1449 if(PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
1450 if(creature_ptr->resist_fire) damage = damage / 3;
1451 if(IS_OPPOSE_FIRE()) damage = damage / 3;
1452 if(creature_ptr->levitation) damage = damage / 5;
1454 damage = damage / 100 + (randint0(100) < (damage % 100));
1456 if (creature_ptr->levitation)
1458 msg_print(_("熱で火傷した!", "The heat burns you!"));
1459 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1460 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1464 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1465 msg_format(_("%sで火傷した!", "The %s burns you!"), name);
1466 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1469 cave_no_regen = TRUE;
1473 if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_cold)
1477 if (have_flag(f_ptr->flags, FF_DEEP))
1479 damage = 6000 + randint0(4000);
1481 else if (!creature_ptr->levitation)
1483 damage = 3000 + randint0(2000);
1488 if (creature_ptr->resist_cold) damage = damage / 3;
1489 if (IS_OPPOSE_COLD()) damage = damage / 3;
1490 if (creature_ptr->levitation) damage = damage / 5;
1492 damage = damage / 100 + (randint0(100) < (damage % 100));
1494 if (creature_ptr->levitation)
1496 msg_print(_("冷気に覆われた!", "The cold engulfs you!"));
1497 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1498 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1502 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1503 msg_format(_("%sに凍えた!", "The %s frostbites you!"), name);
1504 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1507 cave_no_regen = TRUE;
1511 if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_elec)
1515 if (have_flag(f_ptr->flags, FF_DEEP))
1517 damage = 6000 + randint0(4000);
1519 else if (!creature_ptr->levitation)
1521 damage = 3000 + randint0(2000);
1526 if (creature_ptr->resist_elec) damage = damage / 3;
1527 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1528 if (creature_ptr->levitation) damage = damage / 5;
1530 damage = damage / 100 + (randint0(100) < (damage % 100));
1532 if (creature_ptr->levitation)
1534 msg_print(_("電撃を受けた!", "The electric shocks you!"));
1535 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1536 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1540 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1541 msg_format(_("%sに感電した!", "The %s shocks you!"), name);
1542 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1545 cave_no_regen = TRUE;
1549 if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_acid)
1553 if (have_flag(f_ptr->flags, FF_DEEP))
1555 damage = 6000 + randint0(4000);
1557 else if (!creature_ptr->levitation)
1559 damage = 3000 + randint0(2000);
1564 if (creature_ptr->resist_acid) damage = damage / 3;
1565 if (IS_OPPOSE_ACID()) damage = damage / 3;
1566 if (creature_ptr->levitation) damage = damage / 5;
1568 damage = damage / 100 + (randint0(100) < (damage % 100));
1570 if (creature_ptr->levitation)
1572 msg_print(_("酸が飛び散った!", "The acid melt you!"));
1573 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1574 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1578 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1579 msg_format(_("%sに溶かされた!", "The %s melts you!"), name);
1580 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1583 cave_no_regen = TRUE;
1587 if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
1591 if (have_flag(f_ptr->flags, FF_DEEP))
1593 damage = 6000 + randint0(4000);
1595 else if (!creature_ptr->levitation)
1597 damage = 3000 + randint0(2000);
1602 if (creature_ptr->resist_pois) damage = damage / 3;
1603 if (IS_OPPOSE_POIS()) damage = damage / 3;
1604 if (creature_ptr->levitation) damage = damage / 5;
1606 damage = damage / 100 + (randint0(100) < (damage % 100));
1608 if (creature_ptr->levitation)
1610 msg_print(_("毒気を吸い込んだ!", "The gas poisons you!"));
1611 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, format(_("%sの上に浮遊したダメージ", "flying over %s"),
1612 f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name), -1);
1613 if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 1);
1617 concptr name = f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name;
1618 msg_format(_("%sに毒された!", "The %s poisons you!"), name);
1619 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, name, -1);
1620 if (creature_ptr->resist_pois) (void)set_poisoned(creature_ptr, creature_ptr->poisoned + 3);
1623 cave_no_regen = TRUE;
1627 if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
1628 !creature_ptr->levitation && !creature_ptr->can_swim && !creature_ptr->resist_water)
1630 if (creature_ptr->total_weight > weight_limit(creature_ptr))
1632 msg_print(_("溺れている!", "You are drowning!"));
1633 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->lev), _("溺れ", "drowning"), -1);
1634 cave_no_regen = TRUE;
1638 if (creature_ptr->riding)
1641 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !creature_ptr->immune_fire)
1643 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1644 if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
1645 if (creature_ptr->resist_fire) damage = damage / 3;
1646 if (IS_OPPOSE_FIRE()) damage = damage / 3;
1647 msg_print(_("熱い!", "It's hot!"));
1648 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
1650 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags2 & RF2_AURA_ELEC) && !creature_ptr->immune_elec)
1652 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1653 if (PRACE_IS_(creature_ptr, RACE_ANDROID)) damage += damage / 3;
1654 if (creature_ptr->resist_elec) damage = damage / 3;
1655 if (IS_OPPOSE_ELEC()) damage = damage / 3;
1656 msg_print(_("痛い!", "It hurts!"));
1657 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
1659 if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !creature_ptr->immune_cold)
1661 damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
1662 if (creature_ptr->resist_cold) damage = damage / 3;
1663 if (IS_OPPOSE_COLD()) damage = damage / 3;
1664 msg_print(_("冷たい!", "It's cold!"));
1665 take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
1669 /* Spectres -- take damage when moving through walls */
1671 * Added: ANYBODY takes damage if inside through walls
1672 * without wraith form -- NOTE: Spectres will never be
1673 * reduced below 0 hp by being inside a stone wall; others
1676 if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
1678 if (!IS_INVULN() && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
1681 cave_no_regen = TRUE;
1683 if (creature_ptr->pass_wall)
1685 msg_print(_("体の分子が分解した気がする!", "Your molecules feel disrupted!"));
1686 dam_desc = _("密度", "density");
1690 msg_print(_("崩れた岩に押し潰された!", "You are being crushed!"));
1691 dam_desc = _("硬い岩", "solid rock");
1694 take_hit(creature_ptr, DAMAGE_NOESCAPE, 1 + (creature_ptr->lev / 5), dam_desc, -1);
1699 /*** handle regeneration ***/
1702 if (creature_ptr->food < PY_FOOD_WEAK)
1704 /* Lower regeneration */
1705 if (creature_ptr->food < PY_FOOD_STARVE)
1709 else if (creature_ptr->food < PY_FOOD_FAINT)
1711 regen_amount = PY_REGEN_FAINT;
1715 regen_amount = PY_REGEN_WEAK;
1719 /* Are we walking the pattern? */
1720 if (pattern_effect(creature_ptr))
1722 cave_no_regen = TRUE;
1726 /* Regeneration ability */
1727 if (creature_ptr->regenerate)
1729 regen_amount = regen_amount * 2;
1731 if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
1735 if (creature_ptr->cursed & TRC_SLOW_REGEN)
1742 /* Searching or Resting */
1743 if ((creature_ptr->action == ACTION_SEARCH) || (creature_ptr->action == ACTION_REST))
1745 regen_amount = regen_amount * 2;
1748 upkeep_factor = calculate_upkeep(creature_ptr);
1750 /* No regeneration while special action */
1751 if ((creature_ptr->action == ACTION_LEARN) ||
1752 (creature_ptr->action == ACTION_HAYAGAKE) ||
1753 (creature_ptr->special_defense & KATA_KOUKIJIN))
1755 upkeep_factor += 100;
1758 /* Regenerate the mana */
1759 regenmana(creature_ptr, upkeep_factor, regen_amount);
1762 /* Recharge magic eater's power */
1763 if (creature_ptr->pclass == CLASS_MAGIC_EATER)
1765 regenmagic(creature_ptr, regen_amount);
1768 if ((creature_ptr->csp == 0) && (creature_ptr->csp_frac == 0))
1770 while (upkeep_factor > 100)
1772 msg_print(_("こんなに多くのペットを制御できない!", "Too many pets to control at once!"));
1774 do_cmd_pet_dismiss(creature_ptr);
1776 upkeep_factor = calculate_upkeep(creature_ptr);
1778 msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
1783 /* Poisoned or cut yields no healing */
1784 if (creature_ptr->poisoned) regen_amount = 0;
1785 if (creature_ptr->cut) regen_amount = 0;
1787 /* Special floor -- Pattern, in a wall -- yields no healing */
1788 if (cave_no_regen) regen_amount = 0;
1790 regen_amount = (regen_amount * creature_ptr->mutant_regenerate_mod) / 100;
1792 /* Regenerate Hit Points if needed */
1793 if ((creature_ptr->chp < creature_ptr->mhp) && !cave_no_regen)
1795 regenhp(creature_ptr, regen_amount);
1800 * @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
1801 * / Handle timeout every 10 game turns
1804 static void process_world_aux_timeout(player_type *creature_ptr)
1806 const int dec_count = (easy_band ? 2 : 1);
1808 /*** Timeout Various Things ***/
1811 if (creature_ptr->tim_mimic)
1813 (void)set_mimic(creature_ptr, creature_ptr->tim_mimic - 1, creature_ptr->mimic_form, TRUE);
1816 /* Hack -- Hallucinating */
1817 if (creature_ptr->image)
1819 (void)set_image(creature_ptr, creature_ptr->image - dec_count);
1823 if (creature_ptr->blind)
1825 (void)set_blind(creature_ptr, creature_ptr->blind - dec_count);
1828 /* Times see-invisible */
1829 if (creature_ptr->tim_invis)
1831 (void)set_tim_invis(creature_ptr, creature_ptr->tim_invis - 1, TRUE);
1834 if (creature_ptr->suppress_multi_reward)
1836 creature_ptr->suppress_multi_reward = FALSE;
1840 if (creature_ptr->tim_esp)
1842 (void)set_tim_esp(creature_ptr, creature_ptr->tim_esp - 1, TRUE);
1845 /* Timed temporary elemental brands. -LM- */
1846 if (creature_ptr->ele_attack)
1848 creature_ptr->ele_attack--;
1850 /* Clear all temporary elemental brands. */
1851 if (!creature_ptr->ele_attack) set_ele_attack(creature_ptr, 0, 0);
1854 /* Timed temporary elemental immune. -LM- */
1855 if (creature_ptr->ele_immune)
1857 creature_ptr->ele_immune--;
1859 /* Clear all temporary elemental brands. */
1860 if (!creature_ptr->ele_immune) set_ele_immune(creature_ptr, 0, 0);
1863 /* Timed infra-vision */
1864 if (creature_ptr->tim_infra)
1866 (void)set_tim_infra(creature_ptr, creature_ptr->tim_infra - 1, TRUE);
1870 if (creature_ptr->tim_stealth)
1872 (void)set_tim_stealth(creature_ptr, creature_ptr->tim_stealth - 1, TRUE);
1875 /* Timed levitation */
1876 if (creature_ptr->tim_levitation)
1878 (void)set_tim_levitation(creature_ptr, creature_ptr->tim_levitation - 1, TRUE);
1881 /* Timed sh_touki */
1882 if (creature_ptr->tim_sh_touki)
1884 (void)set_tim_sh_touki(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
1888 if (creature_ptr->tim_sh_fire)
1890 (void)set_tim_sh_fire(creature_ptr, creature_ptr->tim_sh_fire - 1, TRUE);
1894 if (creature_ptr->tim_sh_holy)
1896 (void)set_tim_sh_holy(creature_ptr, creature_ptr->tim_sh_holy - 1, TRUE);
1900 if (creature_ptr->tim_eyeeye)
1902 (void)set_tim_eyeeye(creature_ptr, creature_ptr->tim_eyeeye - 1, TRUE);
1905 /* Timed resist-magic */
1906 if (creature_ptr->resist_magic)
1908 (void)set_resist_magic(creature_ptr, creature_ptr->resist_magic - 1, TRUE);
1911 /* Timed regeneration */
1912 if (creature_ptr->tim_regen)
1914 (void)set_tim_regen(creature_ptr, creature_ptr->tim_regen - 1, TRUE);
1917 /* Timed resist nether */
1918 if (creature_ptr->tim_res_nether)
1920 (void)set_tim_res_nether(creature_ptr, creature_ptr->tim_res_nether - 1, TRUE);
1923 /* Timed resist time */
1924 if (creature_ptr->tim_res_time)
1926 (void)set_tim_res_time(creature_ptr, creature_ptr->tim_res_time - 1, TRUE);
1930 if (creature_ptr->tim_reflect)
1932 (void)set_tim_reflect(creature_ptr, creature_ptr->tim_reflect - 1, TRUE);
1936 if (creature_ptr->multishadow)
1938 (void)set_multishadow(creature_ptr, creature_ptr->multishadow - 1, TRUE);
1941 /* Timed Robe of dust */
1942 if (creature_ptr->dustrobe)
1944 (void)set_dustrobe(creature_ptr, creature_ptr->dustrobe - 1, TRUE);
1947 /* Timed infra-vision */
1948 if (creature_ptr->kabenuke)
1950 (void)set_kabenuke(creature_ptr, creature_ptr->kabenuke - 1, TRUE);
1954 if (creature_ptr->paralyzed)
1956 (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed - dec_count);
1960 if (creature_ptr->confused)
1962 (void)set_confused(creature_ptr, creature_ptr->confused - dec_count);
1966 if (creature_ptr->afraid)
1968 (void)set_afraid(creature_ptr, creature_ptr->afraid - dec_count);
1972 if (creature_ptr->fast)
1974 (void)set_fast(creature_ptr, creature_ptr->fast - 1, TRUE);
1978 if (creature_ptr->slow)
1980 (void)set_slow(creature_ptr, creature_ptr->slow - dec_count, TRUE);
1983 /* Protection from evil */
1984 if (creature_ptr->protevil)
1986 (void)set_protevil(creature_ptr, creature_ptr->protevil - 1, TRUE);
1989 /* Invulnerability */
1990 if (creature_ptr->invuln)
1992 (void)set_invuln(creature_ptr, creature_ptr->invuln - 1, TRUE);
1996 if (creature_ptr->wraith_form)
1998 (void)set_wraith_form(creature_ptr, creature_ptr->wraith_form - 1, TRUE);
2002 if (creature_ptr->hero)
2004 (void)set_hero(creature_ptr, creature_ptr->hero - 1, TRUE);
2008 if (creature_ptr->shero)
2010 (void)set_shero(creature_ptr, creature_ptr->shero - 1, TRUE);
2014 if (creature_ptr->blessed)
2016 (void)set_blessed(creature_ptr, creature_ptr->blessed - 1, TRUE);
2020 if (creature_ptr->shield)
2022 (void)set_shield(creature_ptr, creature_ptr->shield - 1, TRUE);
2026 if (creature_ptr->tsubureru)
2028 (void)set_tsubureru(creature_ptr, creature_ptr->tsubureru - 1, TRUE);
2032 if (creature_ptr->magicdef)
2034 (void)set_magicdef(creature_ptr, creature_ptr->magicdef - 1, TRUE);
2038 if (creature_ptr->tsuyoshi)
2040 (void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi - 1, TRUE);
2044 if (creature_ptr->oppose_acid)
2046 (void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid - 1, TRUE);
2049 /* Oppose Lightning */
2050 if (creature_ptr->oppose_elec)
2052 (void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec - 1, TRUE);
2056 if (creature_ptr->oppose_fire)
2058 (void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire - 1, TRUE);
2062 if (creature_ptr->oppose_cold)
2064 (void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold - 1, TRUE);
2068 if (creature_ptr->oppose_pois)
2070 (void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois - 1, TRUE);
2073 if (creature_ptr->ult_res)
2075 (void)set_ultimate_res(creature_ptr, creature_ptr->ult_res - 1, TRUE);
2078 /*** Poison and Stun and Cut ***/
2081 if (creature_ptr->poisoned)
2083 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
2085 /* Apply some healing */
2086 (void)set_poisoned(creature_ptr, creature_ptr->poisoned - adjust);
2090 if (creature_ptr->stun)
2092 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
2094 /* Apply some healing */
2095 (void)set_stun(creature_ptr, creature_ptr->stun - adjust);
2099 if (creature_ptr->cut)
2101 int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
2103 /* Hack -- Truly "mortal" wound */
2104 if (creature_ptr->cut > 1000) adjust = 0;
2106 /* Apply some healing */
2107 (void)set_cut(creature_ptr,creature_ptr->cut - adjust);
2113 * @brief 10ゲームターンが進行する毎に光源の寿命を減らす処理
2114 * / Handle burning fuel every 10 game turns
2117 static void process_world_aux_light(player_type *creature_ptr)
2119 /* Check for light being wielded */
2120 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2122 /* Burn some fuel in the current lite */
2123 if (o_ptr->tval == TV_LITE)
2125 /* Hack -- Use some fuel (except on artifacts) */
2126 if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
2128 /* Decrease life-span */
2129 if (o_ptr->name2 == EGO_LITE_LONG)
2131 if (current_world_ptr->game_turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
2133 else o_ptr->xtra4--;
2135 /* Notice interesting fuel steps */
2136 notice_lite_change(creature_ptr, o_ptr);
2143 * @brief 10ゲームターンが進行するごとに突然変異の発動判定を行う処理
2144 * / Handle mutation effects once every 10 game turns
2147 static void process_world_aux_mutation(player_type *creature_ptr)
2149 /* No mutation with effects */
2150 if (!creature_ptr->muta2) return;
2152 /* No effect on monster arena */
2153 if (creature_ptr->phase_out) return;
2155 /* No effect on the global map */
2156 if (creature_ptr->wild_mode) return;
2158 if ((creature_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
2160 disturb(creature_ptr, FALSE, TRUE);
2161 msg_print(_("ウガァァア!", "RAAAAGHH!"));
2162 msg_print(_("激怒の発作に襲われた!", "You feel a fit of rage coming over you!"));
2163 (void)set_shero(creature_ptr, 10 + randint1(creature_ptr->lev), FALSE);
2164 (void)set_afraid(creature_ptr, 0);
2167 if ((creature_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
2169 if (!creature_ptr->resist_fear)
2171 disturb(creature_ptr, FALSE, TRUE);
2172 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2173 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
2177 if ((creature_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
2179 if (!creature_ptr->resist_nexus && !(creature_ptr->muta1 & MUT1_VTELEPORT) && !creature_ptr->anti_tele)
2181 disturb(creature_ptr, FALSE, TRUE);
2182 msg_print(_("あなたの位置は突然ひじょうに不確定になった...", "Your position suddenly seems very uncertain..."));
2184 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
2188 if ((creature_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
2190 if (!creature_ptr->resist_conf && !creature_ptr->resist_chaos)
2192 disturb(creature_ptr, FALSE, TRUE);
2193 creature_ptr->redraw |= PR_EXTRA;
2194 msg_print(_("いひきがもーろーとひてきたきがふる...ヒック!", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!"));
2197 if (!creature_ptr->resist_conf)
2199 (void)set_confused(creature_ptr, creature_ptr->confused + randint0(20) + 15);
2202 if (!creature_ptr->resist_chaos)
2207 if (one_in_(3)) lose_all_info(creature_ptr);
2208 else wiz_dark(creature_ptr);
2209 (void)teleport_player_aux(creature_ptr,100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
2210 wiz_dark(creature_ptr);
2211 msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
2212 msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!"));
2218 msg_print(_("き~れいなちょおちょらとんれいる~", "Thishcischs GooDSChtuff!"));
2219 (void)set_image(creature_ptr, creature_ptr->image + randint0(150) + 150);
2225 if ((creature_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
2227 if (!creature_ptr->resist_chaos)
2229 disturb(creature_ptr, FALSE, TRUE);
2230 creature_ptr->redraw |= PR_EXTRA;
2231 (void)set_image(creature_ptr, creature_ptr->image + randint0(50) + 20);
2235 if ((creature_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
2237 disturb(creature_ptr, FALSE, TRUE);
2238 msg_print(_("ブゥーーッ!おっと。", "BRRAAAP! Oops."));
2240 fire_ball(creature_ptr, GF_POIS, 0, creature_ptr->lev, 3);
2243 if ((creature_ptr->muta2 & MUT2_PROD_MANA) &&
2244 !creature_ptr->anti_magic && one_in_(9000))
2247 disturb(creature_ptr, FALSE, TRUE);
2248 msg_print(_("魔法のエネルギーが突然あなたの中に流れ込んできた!エネルギーを解放しなければならない!",
2249 "Magical energy flows through you! You must release it!"));
2253 (void)get_hack_dir(&dire);
2254 fire_ball(creature_ptr, GF_MANA, dire, creature_ptr->lev * 2, 3);
2257 if ((creature_ptr->muta2 & MUT2_ATT_DEMON) && !creature_ptr->anti_magic && (randint1(6666) == 666))
2259 bool pet = one_in_(6);
2260 BIT_FLAGS mode = PM_ALLOW_GROUP;
2262 if (pet) mode |= PM_FORCE_PET;
2263 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2265 if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, mode))
2267 msg_print(_("あなたはデーモンを引き寄せた!", "You have attracted a demon!"));
2268 disturb(creature_ptr, FALSE, TRUE);
2272 if ((creature_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
2274 disturb(creature_ptr, FALSE, TRUE);
2277 msg_print(_("精力的でなくなった気がする。", "You feel less energetic."));
2279 if (creature_ptr->fast > 0)
2281 set_fast(creature_ptr, 0, TRUE);
2285 set_slow(creature_ptr, randint1(30) + 10, FALSE);
2290 msg_print(_("精力的になった気がする。", "You feel more energetic."));
2292 if (creature_ptr->slow > 0)
2294 set_slow(creature_ptr, 0, TRUE);
2298 set_fast(creature_ptr, randint1(30) + 10, FALSE);
2303 if ((creature_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
2305 disturb(creature_ptr, FALSE, TRUE);
2306 msg_print(_("突然ほとんど孤独になった気がする。", "You suddenly feel almost lonely."));
2308 banish_monsters(100);
2309 if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
2313 /* Pick a random shop (except home) */
2316 n = randint0(MAX_STORES);
2318 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
2320 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
2326 if ((creature_ptr->muta2 & MUT2_EAT_LIGHT) && one_in_(3000))
2330 msg_print(_("影につつまれた。", "A shadow passes over you."));
2333 /* Absorb light from the current possition */
2334 if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
2336 hp_player(creature_ptr, 10);
2339 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2341 /* Absorb some fuel in the current lite */
2342 if (o_ptr->tval == TV_LITE)
2344 /* Use some fuel (except on artifacts) */
2345 if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
2347 /* Heal the player a bit */
2348 hp_player(creature_ptr, o_ptr->xtra4 / 20);
2350 /* Decrease life-span of lite */
2352 msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
2354 /* Notice interesting fuel steps */
2355 notice_lite_change(creature_ptr, o_ptr);
2360 * Unlite the area (radius 10) around player and
2361 * do 50 points damage to every affected monster
2363 unlite_area(50, 10);
2366 if ((creature_ptr->muta2 & MUT2_ATT_ANIMAL) && !creature_ptr->anti_magic && one_in_(7000))
2368 bool pet = one_in_(3);
2369 BIT_FLAGS mode = PM_ALLOW_GROUP;
2371 if (pet) mode |= PM_FORCE_PET;
2372 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2374 if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, mode))
2376 msg_print(_("動物を引き寄せた!", "You have attracted an animal!"));
2377 disturb(creature_ptr, FALSE, TRUE);
2381 if ((creature_ptr->muta2 & MUT2_RAW_CHAOS) && !creature_ptr->anti_magic && one_in_(8000))
2383 disturb(creature_ptr, FALSE, TRUE);
2384 msg_print(_("周りの空間が歪んでいる気がする!", "You feel the world warping around you!"));
2387 fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
2389 if ((creature_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
2391 if (!lose_mutation(creature_ptr, 0))
2392 msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
2394 if ((creature_ptr->muta2 & MUT2_WRAITH) && !creature_ptr->anti_magic && one_in_(3000))
2396 disturb(creature_ptr, FALSE, TRUE);
2397 msg_print(_("非物質化した!", "You feel insubstantial!"));
2400 set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
2402 if ((creature_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
2404 do_poly_wounds(creature_ptr);
2406 if ((creature_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
2408 int which_stat = randint0(A_MAX);
2409 int sustained = FALSE;
2414 if (creature_ptr->sustain_str) sustained = TRUE;
2417 if (creature_ptr->sustain_int) sustained = TRUE;
2420 if (creature_ptr->sustain_wis) sustained = TRUE;
2423 if (creature_ptr->sustain_dex) sustained = TRUE;
2426 if (creature_ptr->sustain_con) sustained = TRUE;
2429 if (creature_ptr->sustain_chr) sustained = TRUE;
2432 msg_print(_("不正な状態!", "Invalid stat chosen!"));
2438 disturb(creature_ptr, FALSE, TRUE);
2439 msg_print(_("自分が衰弱していくのが分かる!", "You can feel yourself wasting away!"));
2441 (void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
2444 if ((creature_ptr->muta2 & MUT2_ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000))
2446 bool pet = one_in_(5);
2447 BIT_FLAGS mode = PM_ALLOW_GROUP;
2449 if (pet) mode |= PM_FORCE_PET;
2450 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2452 if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON, mode))
2454 msg_print(_("ドラゴンを引き寄せた!", "You have attracted a dragon!"));
2455 disturb(creature_ptr, FALSE, TRUE);
2458 if ((creature_ptr->muta2 & MUT2_WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000))
2460 if (creature_ptr->tim_esp > 0)
2462 msg_print(_("精神にもやがかかった!", "Your mind feels cloudy!"));
2463 set_tim_esp(creature_ptr, 0, TRUE);
2467 msg_print(_("精神が広がった!", "Your mind expands!"));
2468 set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
2471 if ((creature_ptr->muta2 & MUT2_NAUSEA) && !creature_ptr->slow_digest && one_in_(9000))
2473 disturb(creature_ptr, FALSE, TRUE);
2474 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
2476 set_food(creature_ptr, PY_FOOD_WEAK);
2477 if (music_singing_any(creature_ptr)) stop_singing(creature_ptr);
2478 if (hex_spelling_any(creature_ptr)) stop_hex_spell_all(creature_ptr);
2481 if ((creature_ptr->muta2 & MUT2_WALK_SHAD) && !creature_ptr->anti_magic && one_in_(12000) && !creature_ptr->current_floor_ptr->inside_arena)
2483 reserve_alter_reality(creature_ptr);
2486 if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
2488 int danger_amount = 0;
2489 MONSTER_IDX monster;
2491 for (monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
2493 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
2494 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2495 if (!monster_is_valid(m_ptr)) continue;
2497 if (r_ptr->level >= creature_ptr->lev)
2499 danger_amount += r_ptr->level - creature_ptr->lev + 1;
2503 if (danger_amount > 100)
2504 msg_print(_("非常に恐ろしい気がする!", "You feel utterly terrified!"));
2505 else if (danger_amount > 50)
2506 msg_print(_("恐ろしい気がする!", "You feel terrified!"));
2507 else if (danger_amount > 20)
2508 msg_print(_("非常に心配な気がする!", "You feel very worried!"));
2509 else if (danger_amount > 10)
2510 msg_print(_("心配な気がする!", "You feel paranoid!"));
2511 else if (danger_amount > 5)
2512 msg_print(_("ほとんど安全な気がする。", "You feel almost safe."));
2514 msg_print(_("寂しい気がする。", "You feel lonely."));
2517 if ((creature_ptr->muta2 & MUT2_INVULN) && !creature_ptr->anti_magic && one_in_(5000))
2519 disturb(creature_ptr, FALSE, TRUE);
2520 msg_print(_("無敵な気がする!", "You feel invincible!"));
2522 (void)set_invuln(creature_ptr, randint1(8) + 8, FALSE);
2525 if ((creature_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
2527 MANA_POINT wounds = (MANA_POINT)(creature_ptr->mhp - creature_ptr->chp);
2531 HIT_POINT healing = creature_ptr->csp;
2532 if (healing > wounds) healing = wounds;
2534 hp_player(creature_ptr, healing);
2535 creature_ptr->csp -= healing;
2536 creature_ptr->redraw |= (PR_HP | PR_MANA);
2540 if ((creature_ptr->muta2 & MUT2_HP_TO_SP) && !creature_ptr->anti_magic && one_in_(4000))
2542 HIT_POINT wounds = (HIT_POINT)(creature_ptr->msp - creature_ptr->csp);
2546 HIT_POINT healing = creature_ptr->chp;
2547 if (healing > wounds) healing = wounds;
2549 creature_ptr->csp += healing;
2550 creature_ptr->redraw |= (PR_HP | PR_MANA);
2551 take_hit(creature_ptr, DAMAGE_LOSELIFE, healing, _("頭に昇った血", "blood rushing to the head"), -1);
2555 if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
2557 INVENTORY_IDX slot = 0;
2558 object_type *o_ptr = NULL;
2560 disturb(creature_ptr, FALSE, TRUE);
2561 msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
2562 take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
2565 if (has_melee_weapon(creature_ptr, INVEN_RARM))
2568 o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
2570 if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
2572 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2576 else if (has_melee_weapon(creature_ptr, INVEN_LARM))
2578 o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
2581 if (slot && !object_is_cursed(o_ptr))
2583 msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
2584 inven_drop(slot, 1);
2591 * @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
2592 * / Handle curse effects once every 10 game turns
2595 static void process_world_aux_curse(player_type *creature_ptr)
2597 if ((creature_ptr->cursed & TRC_P_FLAG_MASK) && !creature_ptr->phase_out && !creature_ptr->wild_mode)
2600 * Hack: Uncursed teleporting items (e.g. Trump Weapons)
2601 * can actually be useful!
2603 if ((creature_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
2605 GAME_TEXT o_name[MAX_NLEN];
2607 int i, i_keep = 0, count = 0;
2609 /* Scan the equipment with random teleport ability */
2610 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2612 BIT_FLAGS flgs[TR_FLAG_SIZE];
2613 o_ptr = &creature_ptr->inventory_list[i];
2614 if (!o_ptr->k_idx) continue;
2616 object_flags(o_ptr, flgs);
2618 if (have_flag(flgs, TR_TELEPORT))
2620 /* {.} will stop random teleportation. */
2621 if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
2624 if (one_in_(count)) i_keep = i;
2629 o_ptr = &creature_ptr->inventory_list[i_keep];
2630 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2631 msg_format(_("%sがテレポートの能力を発動させようとしている。", "Your %s is activating teleportation."), o_name);
2632 if (get_check_strict(_("テレポートしますか?", "Teleport? "), CHECK_OKAY_CANCEL))
2634 disturb(creature_ptr, FALSE, TRUE);
2635 teleport_player(creature_ptr, 50, 0L);
2639 msg_format(_("%sに{.}(ピリオド)と銘を刻むと発動を抑制できます。",
2640 "You can inscribe {.} on your %s to disable random teleportation. "), o_name);
2641 disturb(creature_ptr, TRUE, TRUE);
2644 /* Make a chainsword noise */
2645 if ((creature_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
2648 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, noise))
2650 disturb(creature_ptr, FALSE, FALSE);
2653 if ((creature_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
2656 (void)activate_ty_curse(FALSE, &count);
2658 /* Handle experience draining */
2659 if (creature_ptr->prace != RACE_ANDROID && ((creature_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
2661 creature_ptr->exp -= (creature_ptr->lev + 1) / 2;
2662 if (creature_ptr->exp < 0) creature_ptr->exp = 0;
2663 creature_ptr->max_exp -= (creature_ptr->lev + 1) / 2;
2664 if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
2665 check_experience(creature_ptr);
2667 /* Add light curse (Later) */
2668 if ((creature_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
2670 BIT_FLAGS new_curse;
2673 o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
2675 new_curse = get_curse(0, o_ptr);
2676 if (!(o_ptr->curse_flags & new_curse))
2678 GAME_TEXT o_name[MAX_NLEN];
2680 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2682 o_ptr->curse_flags |= new_curse;
2683 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2685 o_ptr->feeling = FEEL_NONE;
2687 creature_ptr->update |= (PU_BONUS);
2690 /* Add heavy curse (Later) */
2691 if ((creature_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
2693 BIT_FLAGS new_curse;
2696 o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
2698 new_curse = get_curse(1, o_ptr);
2699 if (!(o_ptr->curse_flags & new_curse))
2701 GAME_TEXT o_name[MAX_NLEN];
2703 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2705 o_ptr->curse_flags |= new_curse;
2706 msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
2707 o_ptr->feeling = FEEL_NONE;
2709 creature_ptr->update |= (PU_BONUS);
2713 if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
2715 if (summon_specific(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)))
2717 GAME_TEXT o_name[MAX_NLEN];
2719 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2720 msg_format(_("%sが動物を引き寄せた!", "Your %s have attracted an animal!"), o_name);
2721 disturb(creature_ptr, FALSE, TRUE);
2725 if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
2727 if (summon_specific(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)))
2729 GAME_TEXT o_name[MAX_NLEN];
2731 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2732 msg_format(_("%sが悪魔を引き寄せた!", "Your %s have attracted a demon!"), o_name);
2733 disturb(creature_ptr, FALSE, TRUE);
2737 if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
2739 if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
2740 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2742 GAME_TEXT o_name[MAX_NLEN];
2744 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2745 msg_format(_("%sがドラゴンを引き寄せた!", "Your %s have attracted an dragon!"), o_name);
2746 disturb(creature_ptr, FALSE, TRUE);
2750 if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
2752 if (summon_specific(0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
2753 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
2755 GAME_TEXT o_name[MAX_NLEN];
2757 object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2758 msg_format(_("%sが死霊を引き寄せた!", "Your %s have attracted an undead!"), o_name);
2759 disturb(creature_ptr, FALSE, TRUE);
2762 if ((creature_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
2764 if (!creature_ptr->resist_fear)
2766 disturb(creature_ptr, FALSE, TRUE);
2767 msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
2768 set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
2771 /* Teleport player */
2772 if ((creature_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !creature_ptr->anti_tele)
2774 disturb(creature_ptr, FALSE, TRUE);
2776 /* Teleport player */
2777 teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
2779 /* Handle HP draining */
2780 if ((creature_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
2782 GAME_TEXT o_name[MAX_NLEN];
2784 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2785 msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
2786 take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev*2, 100), o_name, -1);
2788 /* Handle mana draining */
2789 if ((creature_ptr->cursed & TRC_DRAIN_MANA) && creature_ptr->csp && one_in_(666))
2791 GAME_TEXT o_name[MAX_NLEN];
2793 object_desc(o_name, choose_cursed_obj_name(TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
2794 msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
2795 creature_ptr->csp -= MIN(creature_ptr->lev, 50);
2796 if (creature_ptr->csp < 0)
2798 creature_ptr->csp = 0;
2799 creature_ptr->csp_frac = 0;
2801 creature_ptr->redraw |= PR_MANA;
2805 /* Rarely, take damage from the Jewel of Judgement */
2806 if (one_in_(999) && !creature_ptr->anti_magic)
2808 object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
2810 if (o_ptr->name1 == ART_JUDGE)
2812 if (object_is_known(o_ptr))
2813 msg_print(_("『審判の宝石』はあなたの体力を吸収した!", "The Jewel of Judgement drains life from you!"));
2815 msg_print(_("なにかがあなたの体力を吸収した!", "Something drains life from you!"));
2816 take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev, 50), _("審判の宝石", "the Jewel of Judgement"), -1);
2823 * @brief 10ゲームターンが進行するごとに魔道具の自然充填を行う処理
2824 * / Handle recharging objects once every 10 game turns
2827 static void process_world_aux_recharge(player_type *creature_ptr)
2832 /* Process equipment */
2833 for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
2835 /* Get the object */
2836 object_type *o_ptr = &creature_ptr->inventory_list[i];
2837 if (!o_ptr->k_idx) continue;
2839 /* Recharge activatable objects */
2840 if (o_ptr->timeout > 0)
2845 /* Notice changes */
2846 if (!o_ptr->timeout)
2848 recharged_notice(o_ptr);
2854 /* Notice changes */
2857 creature_ptr->window |= (PW_EQUIP);
2862 * Recharge rods. Rods now use timeout to control charging status,
2863 * and each charging rod in a stack decreases the stack's timeout by
2864 * one per turn. -LM-
2866 for (changed = FALSE, i = 0; i < INVEN_PACK; i++)
2868 object_type *o_ptr = &creature_ptr->inventory_list[i];
2869 object_kind *k_ptr = &k_info[o_ptr->k_idx];
2870 if (!o_ptr->k_idx) continue;
2872 /* Examine all charging rods or stacks of charging rods. */
2873 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2875 /* Determine how many rods are charging. */
2876 TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
2877 if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
2879 /* Decrease timeout by that number. */
2880 o_ptr->timeout -= temp;
2882 /* Boundary control. */
2883 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2885 /* Notice changes, provide message if object is inscribed. */
2886 if (!(o_ptr->timeout))
2888 recharged_notice(o_ptr);
2892 /* One of the stack of rod is charged */
2893 else if (o_ptr->timeout % k_ptr->pval)
2900 /* Notice changes */
2903 creature_ptr->window |= (PW_INVEN);
2907 /* Process objects on floor */
2908 for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
2910 object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
2912 if (!OBJECT_IS_VALID(o_ptr)) continue;
2914 /* Recharge rods on the ground. No messages. */
2915 if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
2918 o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
2920 /* Boundary control. */
2921 if (o_ptr->timeout < 0) o_ptr->timeout = 0;
2928 * @brief 10ゲームターンが進行するごとに帰還や現実変容などの残り時間カウントダウンと発動を処理する。
2929 * / Handle involuntary movement once every 10 game turns
2932 static void process_world_aux_movement(player_type *creature_ptr)
2934 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
2935 /* Delayed Word-of-Recall */
2936 if (creature_ptr->word_recall)
2939 * HACK: Autosave BEFORE resetting the recall counter (rr9)
2940 * The player is yanked up/down as soon as
2941 * he loads the autosaved game.
2943 if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
2944 do_cmd_save_game(TRUE);
2946 /* Count down towards recall */
2947 creature_ptr->word_recall--;
2949 creature_ptr->redraw |= (PR_STATUS);
2951 /* Activate the recall */
2952 if (!creature_ptr->word_recall)
2955 disturb(creature_ptr, FALSE, TRUE);
2957 /* Determine the level */
2958 if (floor_ptr->dun_level || creature_ptr->current_floor_ptr->inside_quest || creature_ptr->enter_dungeon)
2960 msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
2962 if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
2964 exe_write_diary(creature_ptr, NIKKI_RECALL, floor_ptr->dun_level, NULL);
2966 floor_ptr->dun_level = 0;
2967 creature_ptr->dungeon_idx = 0;
2969 leave_quest_check();
2970 leave_tower_check();
2972 creature_ptr->current_floor_ptr->inside_quest = 0;
2974 creature_ptr->leaving = TRUE;
2978 msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
2980 creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
2983 exe_write_diary(creature_ptr, NIKKI_RECALL, floor_ptr->dun_level, NULL);
2986 floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
2987 if (floor_ptr->dun_level < 1) floor_ptr->dun_level = 1;
2989 /* Nightmare mode makes recall more dangerous */
2990 if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND))
2992 if (floor_ptr->dun_level < 50)
2994 floor_ptr->dun_level *= 2;
2996 else if (floor_ptr->dun_level < 99)
2998 floor_ptr->dun_level = (floor_ptr->dun_level + 99) / 2;
3000 else if (floor_ptr->dun_level > 100)
3002 floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].maxdepth - 1;
3006 if (creature_ptr->wild_mode)
3008 creature_ptr->wilderness_y = creature_ptr->y;
3009 creature_ptr->wilderness_x = creature_ptr->x;
3013 /* Save player position */
3014 creature_ptr->oldpx = creature_ptr->x;
3015 creature_ptr->oldpy = creature_ptr->y;
3017 creature_ptr->wild_mode = FALSE;
3020 * Clear all saved floors
3021 * and create a first saved floor
3023 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3024 creature_ptr->leaving = TRUE;
3026 if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
3030 for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
3032 quest_type* const q_ptr = &quest[i];
3035 if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
3036 (q_ptr->status == QUEST_STATUS_TAKEN) &&
3037 (q_ptr->level < floor_ptr->dun_level))
3039 q_ptr->status = QUEST_STATUS_FAILED;
3040 q_ptr->complev = (byte)creature_ptr->lev;
3042 q_ptr->comptime = current_world_ptr->play_time;
3043 r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
3049 sound(SOUND_TPLEVEL);
3054 /* Delayed Alter reality */
3055 if (creature_ptr->alter_reality)
3057 if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
3058 do_cmd_save_game(TRUE);
3060 /* Count down towards alter */
3061 creature_ptr->alter_reality--;
3063 creature_ptr->redraw |= (PR_STATUS);
3065 /* Activate the alter reality */
3066 if (!creature_ptr->alter_reality)
3069 disturb(creature_ptr, FALSE, TRUE);
3071 /* Determine the level */
3072 if (!quest_number(floor_ptr->dun_level) && floor_ptr->dun_level)
3074 msg_print(_("世界が変わった!", "The world changes!"));
3077 * Clear all saved floors
3078 * and create a first saved floor
3080 prepare_change_floor_mode(CFM_FIRST_FLOOR);
3081 creature_ptr->leaving = TRUE;
3085 msg_print(_("世界が少しの間変化したようだ。", "The world seems to change for a moment!"));
3088 sound(SOUND_TPLEVEL);
3094 * @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
3095 * / Handle certain things once every 10 game turns
3098 static void process_world(void)
3102 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
3103 s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
3104 int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
3106 extract_day_hour_min(&day, &hour, &min);
3108 /* Update dungeon feeling, and announce it if changed */
3109 update_dungeon_feeling(p_ptr, p_ptr->current_floor_ptr);
3111 /* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
3112 if (ironman_downward && (p_ptr->dungeon_idx != DUNGEON_ANGBAND && p_ptr->dungeon_idx != 0))
3114 p_ptr->current_floor_ptr->dun_level = 0;
3115 p_ptr->dungeon_idx = 0;
3116 prepare_change_floor_mode(CFM_FIRST_FLOOR | CFM_RAND_PLACE);
3117 p_ptr->current_floor_ptr->inside_arena = FALSE;
3118 p_ptr->wild_mode = FALSE;
3119 p_ptr->leaving = TRUE;
3122 /*** Check monster arena ***/
3123 if (p_ptr->phase_out && !p_ptr->leaving)
3129 /* Count all hostile monsters */
3130 for (i2 = 0; i2 < p_ptr->current_floor_ptr->width; ++i2)
3131 for (j2 = 0; j2 < p_ptr->current_floor_ptr->height; j2++)
3133 grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[j2][i2];
3135 if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != p_ptr->riding))
3138 win_m_idx = g_ptr->m_idx;
3142 if (number_mon == 0)
3144 msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
3146 p_ptr->energy_need = 0;
3147 update_gambling_monsters();
3149 else if ((number_mon-1) == 0)
3151 GAME_TEXT m_name[MAX_NLEN];
3152 monster_type *wm_ptr;
3154 wm_ptr = &p_ptr->current_floor_ptr->m_list[win_m_idx];
3156 monster_desc(m_name, wm_ptr, 0);
3157 msg_format(_("%sが勝利した!", "%s is winner!"), m_name);
3160 if (win_m_idx == (sel_monster+1))
3162 msg_print(_("おめでとうございます。", "Congratulations."));
3163 msg_format(_("%d$を受け取った。", "You received %d gold."), battle_odds);
3164 p_ptr->au += battle_odds;
3168 msg_print(_("残念でした。", "You lost gold."));
3171 p_ptr->energy_need = 0;
3172 update_gambling_monsters();
3174 else if (current_world_ptr->game_turn - p_ptr->current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
3176 msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
3177 p_ptr->au += kakekin;
3179 p_ptr->energy_need = 0;
3180 update_gambling_monsters();
3184 /* Every 10 game turns */
3185 if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
3187 /*** Attempt timed autosave ***/
3188 if (autosave_t && autosave_freq && !p_ptr->phase_out)
3190 if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
3191 do_cmd_save_game(TRUE);
3194 if (p_ptr->current_floor_ptr->monster_noise && !ignore_unview)
3196 msg_print(_("何かが聞こえた。", "You hear noise."));
3199 /*** Handle the wilderness/town (sunshine) ***/
3201 /* While in town/wilderness */
3202 if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->current_floor_ptr->inside_arena)
3204 /* Hack -- Daybreak/Nighfall in town */
3205 if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
3209 /* Check for dawn */
3210 dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
3212 if (dawn) day_break(p_ptr->current_floor_ptr);
3213 else night_falls(p_ptr->current_floor_ptr);
3218 /* While in the dungeon (vanilla_town or lite_town mode only) */
3219 else if ((vanilla_town || (lite_town && !p_ptr->current_floor_ptr->inside_quest && !p_ptr->phase_out && !p_ptr->current_floor_ptr->inside_arena)) && p_ptr->current_floor_ptr->dun_level)
3221 /*** Shuffle the Storekeepers ***/
3223 /* Chance is only once a day (while in dungeon) */
3224 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
3226 /* Sometimes, shuffle the shop-keepers */
3227 if (one_in_(STORE_SHUFFLE))
3232 /* Pick a random shop (except home and museum) */
3235 n = randint0(MAX_STORES);
3237 while ((n == STORE_HOME) || (n == STORE_MUSEUM));
3239 /* Check every feature */
3240 for (i = 1; i < max_f_idx; i++)
3242 feature_type *f_ptr = &f_info[i];
3244 /* Skip empty index */
3245 if (!f_ptr->name) continue;
3247 /* Skip non-store features */
3248 if (!have_flag(f_ptr->flags, FF_STORE)) continue;
3250 /* Verify store type */
3251 if (f_ptr->subtype == n)
3253 if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
3266 /*** Process the monsters ***/
3268 /* Check for creature generation. */
3269 if (one_in_(d_info[p_ptr->dungeon_idx].max_m_alloc_chance) &&
3270 !p_ptr->current_floor_ptr->inside_arena && !p_ptr->current_floor_ptr->inside_quest && !p_ptr->phase_out)
3272 /* Make a new monster */
3273 (void)alloc_monster(MAX_SIGHT + 5, 0);
3276 /* Hack -- Check for creature regeneration */
3277 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !p_ptr->phase_out) regen_monsters();
3278 if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regen_captured_monsters();
3280 if (!p_ptr->leaving)
3284 /* Hack -- Process the counters of monsters if needed */
3285 for (i = 0; i < MAX_MTIMED; i++)
3287 if (p_ptr->current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
3295 if (min != prev_min)
3297 exe_write_diary(p_ptr, NIKKI_HIGAWARI, 0, NULL);
3298 determine_today_mon(FALSE);
3303 * Nightmare mode activates the TY_CURSE at midnight
3304 * Require exact minute -- Don't activate multiple times in a minute
3307 if (ironman_nightmare && (min != prev_min))
3310 /* Every 15 minutes after 11:00 pm */
3311 if ((hour == 23) && !(min % 15))
3313 disturb(p_ptr, FALSE, TRUE);
3318 msg_print(_("遠くで不気味な鐘の音が鳴った。", "You hear a distant bell toll ominously."));
3322 msg_print(_("遠くで鐘が二回鳴った。", "A distant bell sounds twice."));
3326 msg_print(_("遠くで鐘が三回鳴った。", "A distant bell sounds three times."));
3330 msg_print(_("遠くで鐘が四回鳴った。", "A distant bell tolls four times."));
3335 /* TY_CURSE activates at midnight! */
3339 disturb(p_ptr, TRUE, TRUE);
3340 msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
3342 if (p_ptr->wild_mode)
3344 /* Go into large wilderness view */
3345 p_ptr->oldpy = randint1(MAX_HGT - 2);
3346 p_ptr->oldpx = randint1(MAX_WID - 2);
3347 change_wild_mode(p_ptr, TRUE);
3349 /* Give first move to monsters */
3350 take_turn(p_ptr, 100);
3354 p_ptr->invoking_midnight_curse = TRUE;
3358 process_world_aux_digestion(p_ptr);
3359 process_world_aux_hp_and_sp(p_ptr);
3360 process_world_aux_timeout(p_ptr);
3361 process_world_aux_light(p_ptr);
3362 process_world_aux_mutation(p_ptr);
3363 process_world_aux_curse(p_ptr);
3364 process_world_aux_recharge(p_ptr);
3365 sense_inventory1(p_ptr);
3366 sense_inventory2(p_ptr);
3367 process_world_aux_movement(p_ptr);
3371 * @brief ウィザードモードへの導入処理
3372 * / Verify use of "wizard" mode
3373 * @return 実際にウィザードモードへ移行したらTRUEを返す。
3375 static bool enter_wizard_mode(void)
3377 /* Ask first time */
3378 if (!p_ptr->noscore)
3380 /* Wizard mode is not permitted */
3381 if (!allow_debug_opts || arg_wizard)
3383 msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
3387 /* Mention effects */
3388 msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
3389 msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
3392 /* Verify request */
3393 if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
3398 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
3400 p_ptr->noscore |= 0x0002;
3411 * @brief デバッグコマンドへの導入処理
3412 * / Verify use of "debug" commands
3413 * @return 実際にデバッグコマンドへ移行したらTRUEを返す。
3415 static bool enter_debug_mode(void)
3417 /* Ask first time */
3418 if (!p_ptr->noscore)
3420 /* Debug mode is not permitted */
3421 if (!allow_debug_opts)
3423 msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
3427 /* Mention effects */
3428 msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
3429 msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
3433 /* Verify request */
3434 if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
3439 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
3441 p_ptr->noscore |= 0x0008;
3449 * Hack -- Declare the Debug Routines
3451 extern void do_cmd_debug(player_type *creature_ptr);
3453 #endif /* ALLOW_WIZARD */
3459 * @brief ボーグコマンドへの導入処理
3460 * / Verify use of "borg" commands
3461 * @return 実際にボーグコマンドへ移行したらTRUEを返す。
3463 static bool enter_borg_mode(void)
3465 /* Ask first time */
3466 if (!(p_ptr->noscore & 0x0010))
3468 /* Mention effects */
3469 msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
3470 msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
3474 /* Verify request */
3475 if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
3480 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
3482 p_ptr->noscore |= 0x0010;
3490 * Hack -- Declare the Ben Borg
3492 extern void do_cmd_borg(void);
3494 #endif /* ALLOW_BORG */
3498 * @brief プレイヤーから受けた入力コマンドの分岐処理。
3499 * / Parse and execute the current command Give "Warning" on illegal commands.
3500 * @todo Make some "blocks"
3503 static void process_command(player_type *creature_ptr)
3505 COMMAND_CODE old_now_message = now_message;
3507 /* Handle repeating the last command */
3513 if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
3514 creature_ptr->reset_concent = TRUE;
3516 /* Parse the command */
3517 switch (command_cmd)
3533 /*** Wizard Commands ***/
3536 if (current_world_ptr->wizard)
3538 current_world_ptr->wizard = FALSE;
3539 msg_print(_("ウィザードモード解除。", "Wizard mode off."));
3541 else if (enter_wizard_mode())
3543 current_world_ptr->wizard = TRUE;
3544 msg_print(_("ウィザードモード突入。", "Wizard mode on."));
3546 creature_ptr->update |= (PU_MONSTERS);
3547 creature_ptr->redraw |= (PR_TITLE);
3555 /* Special "debug" commands */
3558 if (enter_debug_mode())
3560 do_cmd_debug(creature_ptr);
3565 #endif /* ALLOW_WIZARD */
3570 /* Special "borg" commands */
3573 if (enter_borg_mode())
3575 if (!creature_ptr->wild_mode) do_cmd_borg();
3580 #endif /* ALLOW_BORG */
3584 /*** Inventory Commands ***/
3586 /* Wear/wield equipment */
3589 if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
3593 /* Take off equipment */
3596 if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
3603 if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
3607 /* Destroy an item */
3610 do_cmd_destroy(creature_ptr);
3614 /* Equipment list */
3617 do_cmd_equip(creature_ptr);
3621 /* Inventory list */
3624 do_cmd_inven(creature_ptr);
3629 /*** Various commands ***/
3631 /* Identify an object */
3634 do_cmd_observe(creature_ptr);
3640 toggle_inven_equip(creature_ptr);
3645 /*** Standard "Movement" Commands ***/
3650 if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
3657 if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
3661 /* Move (usually pick up things) */
3664 do_cmd_walk(creature_ptr, FALSE);
3668 /* Move (usually do not pick up) */
3671 do_cmd_walk(creature_ptr, TRUE);
3676 /*** Running, Resting, Searching, Staying */
3678 /* Begin Running -- Arg is Max Distance */
3681 if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
3685 /* Stay still (usually pick things up) */
3688 do_cmd_stay(creature_ptr, always_pickup);
3692 /* Stay still (usually do not pick up) */
3695 do_cmd_stay(creature_ptr, !always_pickup);
3699 /* Rest -- Arg is time */
3702 do_cmd_rest(creature_ptr);
3706 /* Search for traps/doors */
3709 do_cmd_search(creature_ptr);
3715 if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
3716 else set_action(creature_ptr, ACTION_SEARCH);
3721 /*** Stairs and Doors and Chests and Traps ***/
3724 case SPECIAL_KEY_STORE:
3730 /* Enter building -KMW- */
3731 case SPECIAL_KEY_BUILDING:
3737 /* Enter quest level -KMW- */
3738 case SPECIAL_KEY_QUEST:
3744 /* Go up staircase */
3747 if (!creature_ptr->wild_mode && !p_ptr->current_floor_ptr->dun_level && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->current_floor_ptr->inside_quest)
3749 if (vanilla_town) break;
3751 if (creature_ptr->ambush_flag)
3753 msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
3757 if (creature_ptr->food < PY_FOOD_WEAK)
3759 msg_print(_("その前に食事をとらないと。", "You must eat something here."));
3763 change_wild_mode(creature_ptr, FALSE);
3766 do_cmd_go_up(creature_ptr);
3770 /* Go down staircase */
3773 if (creature_ptr->wild_mode)
3774 change_wild_mode(creature_ptr, FALSE);
3776 do_cmd_go_down(creature_ptr);
3780 /* Open a door or chest */
3783 do_cmd_open(creature_ptr);
3790 do_cmd_close(creature_ptr);
3794 /* Jam a door with spikes */
3797 do_cmd_spike(creature_ptr);
3804 do_cmd_bash(creature_ptr);
3808 /* Disarm a trap or chest */
3811 do_cmd_disarm(creature_ptr);
3816 /*** Magic and Prayers ***/
3818 /* Gain new spells/prayers */
3821 if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
3822 msg_print(_("呪文を学習する必要はない!", "You don't have to learn spells!"));
3823 else if (creature_ptr->pclass == CLASS_SAMURAI)
3824 do_cmd_gain_hissatsu(creature_ptr);
3825 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3826 import_magic_device(creature_ptr);
3828 do_cmd_study(creature_ptr);
3835 if ( (creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3836 (creature_ptr->pclass == CLASS_BERSERKER) ||
3837 (creature_ptr->pclass == CLASS_NINJA) ||
3838 (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3839 ) do_cmd_mind_browse();
3840 else if (creature_ptr->pclass == CLASS_SMITH)
3841 do_cmd_kaji(creature_ptr, TRUE);
3842 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3843 do_cmd_magic_eater(creature_ptr, TRUE, FALSE);
3844 else if (creature_ptr->pclass == CLASS_SNIPER)
3845 do_cmd_snipe_browse(creature_ptr);
3846 else do_cmd_browse(creature_ptr);
3854 if (!creature_ptr->wild_mode)
3856 if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
3858 msg_print(_("呪文を唱えられない!", "You cannot cast spells!"));
3860 else if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC) && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
3862 msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
3865 else if (creature_ptr->anti_magic && (creature_ptr->pclass != CLASS_BERSERKER) && (creature_ptr->pclass != CLASS_SMITH))
3867 concptr which_power = _("魔法", "magic");
3868 if (creature_ptr->pclass == CLASS_MINDCRAFTER)
3869 which_power = _("超能力", "psionic powers");
3870 else if (creature_ptr->pclass == CLASS_IMITATOR)
3871 which_power = _("ものまね", "imitation");
3872 else if (creature_ptr->pclass == CLASS_SAMURAI)
3873 which_power = _("必殺剣", "hissatsu");
3874 else if (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3875 which_power = _("鏡魔法", "mirror magic");
3876 else if (creature_ptr->pclass == CLASS_NINJA)
3877 which_power = _("忍術", "ninjutsu");
3878 else if (mp_ptr->spell_book == TV_LIFE_BOOK)
3879 which_power = _("祈り", "prayer");
3881 msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power);
3882 free_turn(creature_ptr);
3884 else if (creature_ptr->shero && (creature_ptr->pclass != CLASS_BERSERKER))
3886 msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
3887 free_turn(creature_ptr);
3891 if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
3892 (creature_ptr->pclass == CLASS_BERSERKER) ||
3893 (creature_ptr->pclass == CLASS_NINJA) ||
3894 (creature_ptr->pclass == CLASS_MIRROR_MASTER)
3897 else if (creature_ptr->pclass == CLASS_IMITATOR)
3898 do_cmd_mane(creature_ptr, FALSE);
3899 else if (creature_ptr->pclass == CLASS_MAGIC_EATER)
3900 do_cmd_magic_eater(creature_ptr, FALSE, FALSE);
3901 else if (creature_ptr->pclass == CLASS_SAMURAI)
3902 do_cmd_hissatsu(creature_ptr);
3903 else if (creature_ptr->pclass == CLASS_BLUE_MAGE)
3904 do_cmd_cast_learned();
3905 else if (creature_ptr->pclass == CLASS_SMITH)
3906 do_cmd_kaji(creature_ptr, FALSE);
3907 else if (creature_ptr->pclass == CLASS_SNIPER)
3908 do_cmd_snipe(creature_ptr);
3910 do_cmd_cast(creature_ptr);
3916 /* Issue a pet command */
3919 do_cmd_pet(creature_ptr);
3923 /*** Use various objects ***/
3925 /* Inscribe an object */
3928 do_cmd_inscribe(creature_ptr);
3932 /* Uninscribe an object */
3935 do_cmd_uninscribe(creature_ptr);
3939 /* Activate an artifact */
3942 do_cmd_activate(creature_ptr);
3949 do_cmd_eat_food(creature_ptr);
3953 /* Fuel your lantern/torch */
3956 do_cmd_refill(creature_ptr);
3963 do_cmd_fire(creature_ptr, SP_NONE);
3970 do_cmd_throw(creature_ptr, 1, FALSE, -1);
3977 do_cmd_aim_wand(creature_ptr);
3984 if (use_command && rogue_like_commands)
3986 do_cmd_use(creature_ptr);
3990 do_cmd_zap_rod(creature_ptr);
3995 /* Quaff a potion */
3998 do_cmd_quaff_potion(creature_ptr);
4005 do_cmd_read_scroll(creature_ptr);
4012 if (use_command && !rogue_like_commands)
4013 do_cmd_use(creature_ptr);
4015 do_cmd_use_staff(creature_ptr);
4019 /* Use racial power */
4022 do_cmd_racial_power(creature_ptr);
4027 /*** Looking at Things (nearby or on map) ***/
4029 /* Full dungeon map */
4036 /* Locate player on map */
4039 do_cmd_locate(creature_ptr);
4046 do_cmd_look(creature_ptr);
4050 /* Target monster or location */
4053 do_cmd_target(creature_ptr);
4059 /*** Help and Such ***/
4068 /* Identify symbol */
4071 do_cmd_query_symbol();
4075 /* Character description */
4078 do_cmd_player_status(creature_ptr);
4083 /*** System Commands ***/
4085 /* Hack -- User interface */
4092 /* Single line from a pref file */
4101 do_cmd_reload_autopick();
4107 do_cmd_edit_autopick();
4111 /* Interact with macros */
4114 do_cmd_macros(creature_ptr);
4118 /* Interact with visuals */
4121 do_cmd_visuals(creature_ptr);
4122 do_cmd_redraw(creature_ptr);
4126 /* Interact with colors */
4129 do_cmd_colors(creature_ptr);
4130 do_cmd_redraw(creature_ptr);
4134 /* Interact with options */
4138 (void)combine_and_reorder_home(STORE_HOME);
4139 do_cmd_redraw(creature_ptr);
4143 /*** Misc Commands ***/
4159 /* Repeat level feeling */
4162 do_cmd_feeling(creature_ptr);
4166 /* Show previous message */
4169 do_cmd_message_one();
4173 /* Show previous messages */
4176 do_cmd_messages(old_now_message);
4180 /* Show quest status -KMW- */
4183 do_cmd_checkquest();
4187 /* Redraw the screen */
4190 now_message = old_now_message;
4191 do_cmd_redraw(creature_ptr);
4195 #ifndef VERIFY_SAVEFILE
4197 /* Hack -- Save and don't quit */
4200 do_cmd_save_game(FALSE);
4204 #endif /* VERIFY_SAVEFILE */
4214 case SPECIAL_KEY_QUIT:
4216 do_cmd_save_and_exit();
4220 /* Quit (commit suicide) */
4223 do_cmd_suicide(creature_ptr);
4233 /* Check artifacts, uniques, objects */
4240 /* Load "screen dump" */
4243 do_cmd_load_screen();
4247 /* Save "screen dump" */
4250 do_cmd_save_screen();
4254 /* Record/stop "Movie" */
4257 prepare_movie_hooks();
4261 /* Make random artifact list */
4264 spoil_random_artifact("randifact.txt");
4271 if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
4272 if (creature_ptr->special_defense & KATA_MUSOU)
4274 set_action(creature_ptr, ACTION_NONE);
4280 /* Hack -- Unknown command */
4283 if (flush_failure) flush();
4287 sound(SOUND_ILLEGAL);
4288 if (!get_rnd_line(_("error_j.txt", "error.txt"), 0, error_m))
4293 prt(_(" '?' でヘルプが表示されます。", "Type '?' for help."), 0, 0);
4299 if (!creature_ptr->energy_use && !now_message)
4300 now_message = old_now_message;
4304 * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
4307 static void pack_overflow(player_type *owner_ptr)
4309 if (owner_ptr->inventory_list[INVEN_PACK].k_idx)
4311 GAME_TEXT o_name[MAX_NLEN];
4314 /* Is auto-destroy done? */
4315 update_creature(owner_ptr);
4316 if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
4318 /* Access the slot to be dropped */
4319 o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
4321 disturb(owner_ptr, FALSE, TRUE);
4324 msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
4325 object_desc(o_name, o_ptr, 0);
4327 msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
4329 /* Drop it (carefully) near the player */
4330 (void)drop_near(o_ptr, 0, owner_ptr->y, owner_ptr->x);
4332 vary_item(INVEN_PACK, -255);
4338 * @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
4341 static void process_upkeep_with_speed(void)
4343 /* Give the player some energy */
4344 if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
4346 p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
4350 if (p_ptr->enchant_energy_need > 0) return;
4352 while (p_ptr->enchant_energy_need <= 0)
4354 /* Handle the player song */
4355 if (!load) check_music(p_ptr);
4357 /* Hex - Handle the hex spells */
4358 if (!load) check_hex(p_ptr);
4359 if (!load) revenge_spell(p_ptr);
4361 /* There is some randomness of needed energy */
4362 p_ptr->enchant_energy_need += ENERGY_NEED();
4366 static void process_fishing(void)
4368 Term_xtra(TERM_XTRA_DELAY, 10);
4372 bool success = FALSE;
4373 get_mon_num_prep(monster_is_fishing_target, NULL);
4374 r_idx = get_mon_num(p_ptr->current_floor_ptr->dun_level ? p_ptr->current_floor_ptr->dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level);
4376 if (r_idx && one_in_(2))
4379 y = p_ptr->y + ddy[p_ptr->fishing_dir];
4380 x = p_ptr->x + ddx[p_ptr->fishing_dir];
4381 if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
4383 GAME_TEXT m_name[MAX_NLEN];
4384 monster_desc(m_name, &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[y][x].m_idx], 0);
4385 msg_format(_("%sが釣れた!", "You have a good catch!"), m_name);
4391 msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
4393 disturb(p_ptr, FALSE, TRUE);
4398 * @brief プレイヤーの行動処理 / Process the player
4401 * Notice the annoying code to handle "pack overflow", which\n
4402 * must come first just in case somebody manages to corrupt\n
4403 * the savefiles by clever use of menu commands or something.\n
4405 static void process_player(player_type *creature_ptr)
4409 /*** Apply energy ***/
4411 if (creature_ptr->hack_mutation)
4413 msg_print(_("何か変わった気がする!", "You feel different!"));
4415 (void)gain_mutation(creature_ptr, 0);
4416 creature_ptr->hack_mutation = FALSE;
4419 if (creature_ptr->invoking_midnight_curse)
4422 activate_ty_curse(FALSE, &count);
4423 creature_ptr->invoking_midnight_curse = FALSE;
4426 if (creature_ptr->phase_out)
4428 for(m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
4430 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4432 if (!monster_is_valid(m_ptr)) continue;
4434 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
4435 update_monster(creature_ptr, m_idx, FALSE);
4440 /* Give the player some energy */
4441 else if (!(load && creature_ptr->energy_need <= 0))
4443 creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
4447 if (creature_ptr->energy_need > 0) return;
4448 if (!command_rep) prt_time();
4450 /*** Check for interupts ***/
4452 /* Complete resting */
4453 if (creature_ptr->resting < 0)
4456 if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
4459 if ((creature_ptr->chp == creature_ptr->mhp) &&
4460 (creature_ptr->csp >= creature_ptr->msp))
4462 set_action(creature_ptr, ACTION_NONE);
4466 /* Complete resting */
4467 else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
4470 if ((creature_ptr->chp == creature_ptr->mhp) &&
4471 (creature_ptr->csp >= creature_ptr->msp) &&
4472 !creature_ptr->blind && !creature_ptr->confused &&
4473 !creature_ptr->poisoned && !creature_ptr->afraid &&
4474 !creature_ptr->stun && !creature_ptr->cut &&
4475 !creature_ptr->slow && !creature_ptr->paralyzed &&
4476 !creature_ptr->image && !creature_ptr->word_recall &&
4477 !creature_ptr->alter_reality)
4479 set_action(creature_ptr, ACTION_NONE);
4484 if (creature_ptr->action == ACTION_FISH) process_fishing();
4486 /* Handle "abort" */
4489 /* Check for "player abort" (semi-efficiently for resting) */
4490 if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
4495 /* Check for a key */
4498 flush(); /* Flush input */
4500 disturb(creature_ptr, FALSE, TRUE);
4502 /* Hack -- Show a Message */
4503 msg_print(_("中断しました。", "Canceled."));
4508 if (creature_ptr->riding && !creature_ptr->confused && !creature_ptr->blind)
4510 monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
4511 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4513 if (MON_CSLEEP(m_ptr))
4515 GAME_TEXT m_name[MAX_NLEN];
4518 (void)set_monster_csleep(creature_ptr->riding, 0);
4519 monster_desc(m_name, m_ptr, 0);
4520 msg_format(_("%^sを起こした。", "You have waked %s up."), m_name);
4523 if (MON_STUNNED(m_ptr))
4525 /* Hack -- Recover from stun */
4526 if (set_monster_stunned(creature_ptr->riding,
4527 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
4529 GAME_TEXT m_name[MAX_NLEN];
4530 monster_desc(m_name, m_ptr, 0);
4531 msg_format(_("%^sを朦朧状態から立ち直らせた。", "%^s is no longer stunned."), m_name);
4535 if (MON_CONFUSED(m_ptr))
4537 /* Hack -- Recover from confusion */
4538 if (set_monster_confused(creature_ptr->riding,
4539 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
4541 GAME_TEXT m_name[MAX_NLEN];
4542 monster_desc(m_name, m_ptr, 0);
4543 msg_format(_("%^sを混乱状態から立ち直らせた。", "%^s is no longer confused."), m_name);
4547 if (MON_MONFEAR(m_ptr))
4549 /* Hack -- Recover from fear */
4550 if(set_monster_monfear(creature_ptr->riding,
4551 (randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
4553 GAME_TEXT m_name[MAX_NLEN];
4554 monster_desc(m_name, m_ptr, 0);
4555 msg_format(_("%^sを恐怖から立ち直らせた。", "%^s is no longer fear."), m_name);
4565 if (creature_ptr->lightspeed)
4567 (void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
4569 if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
4571 if(P_PTR_KI < 40) P_PTR_KI = 0;
4572 else P_PTR_KI -= 40;
4573 creature_ptr->update |= (PU_BONUS);
4575 if (creature_ptr->action == ACTION_LEARN)
4578 u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
4580 /* Convert the unit (1/2^16) to (1/2^32) */
4581 s64b_LSHIFT(cost, cost_frac, 16);
4583 if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
4586 creature_ptr->csp = 0;
4587 creature_ptr->csp_frac = 0;
4588 set_action(creature_ptr, ACTION_NONE);
4593 s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
4595 creature_ptr->redraw |= PR_MANA;
4598 if (creature_ptr->special_defense & KATA_MASK)
4600 if (creature_ptr->special_defense & KATA_MUSOU)
4602 if (creature_ptr->csp < 3)
4604 set_action(creature_ptr, ACTION_NONE);
4608 creature_ptr->csp -= 2;
4609 creature_ptr->redraw |= (PR_MANA);
4614 /*** Handle actual user input ***/
4616 /* Repeat until out of energy */
4617 while (creature_ptr->energy_need <= 0)
4619 creature_ptr->window |= PW_PLAYER;
4620 creature_ptr->sutemi = FALSE;
4621 creature_ptr->counter = FALSE;
4622 creature_ptr->now_damaged = FALSE;
4626 /* Place the cursor on the player */
4627 move_cursor_relative(creature_ptr->y, creature_ptr->x);
4629 /* Refresh (optional) */
4630 if (fresh_before) Term_fresh();
4632 /* Hack -- Pack Overflow */
4633 pack_overflow(creature_ptr);
4635 /* Hack -- cancel "lurking browse mode" */
4636 if (!command_new) command_see = FALSE;
4638 /* Assume free turn */
4639 free_turn(creature_ptr);
4641 if (creature_ptr->phase_out)
4643 /* Place the cursor on the player */
4644 move_cursor_relative(creature_ptr->y, creature_ptr->x);
4646 command_cmd = SPECIAL_KEY_BUILDING;
4648 /* Process the command */
4649 process_command(creature_ptr);
4652 /* Paralyzed or Knocked Out */
4653 else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
4655 take_turn(creature_ptr, 100);
4659 else if (creature_ptr->action == ACTION_REST)
4662 if (creature_ptr->resting > 0)
4664 /* Reduce rest count */
4665 creature_ptr->resting--;
4667 if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
4668 creature_ptr->redraw |= (PR_STATE);
4671 take_turn(creature_ptr, 100);
4675 else if (creature_ptr->action == ACTION_FISH)
4677 take_turn(creature_ptr, 100);
4681 else if (creature_ptr->running)
4689 else if (travel.run)
4696 /* Repeated command */
4697 else if (command_rep)
4699 /* Count this execution */
4702 creature_ptr->redraw |= (PR_STATE);
4705 /* Hack -- Assume messages were seen */
4708 /* Clear the top line */
4711 /* Process the command */
4712 process_command(creature_ptr);
4715 /* Normal command */
4718 /* Place the cursor on the player */
4719 move_cursor_relative(creature_ptr->y, creature_ptr->x);
4722 /* Get a command (normal) */
4723 request_command(FALSE);
4726 /* Process the command */
4727 process_command(creature_ptr);
4730 /* Hack -- Pack Overflow */
4731 pack_overflow(creature_ptr);
4736 if (creature_ptr->energy_use)
4738 /* Use some energy */
4739 if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
4741 /* The Randomness is irrelevant */
4742 creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
4746 /* There is some randomness of needed energy */
4747 creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
4750 /* Hack -- constant hallucination */
4751 if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
4753 /* Shimmer multi-hued monsters */
4754 for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
4756 monster_type *m_ptr;
4757 monster_race *r_ptr;
4759 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4760 if (!monster_is_valid(m_ptr)) continue;
4762 /* Skip unseen monsters */
4763 if (!m_ptr->ml) continue;
4765 /* Access the monster race */
4766 r_ptr = &r_info[m_ptr->ap_r_idx];
4768 /* Skip non-multi-hued monsters */
4769 if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
4772 /* Redraw regardless */
4773 lite_spot(m_ptr->fy, m_ptr->fx);
4777 /* Handle monster detection */
4778 if (repair_monsters)
4780 /* Reset the flag */
4781 repair_monsters = FALSE;
4783 /* Rotate detection flags */
4784 for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
4786 monster_type *m_ptr;
4787 m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
4788 if (!monster_is_valid(m_ptr)) continue;
4790 /* Nice monsters get mean */
4791 if (m_ptr->mflag & MFLAG_NICE)
4793 /* Nice monsters get mean */
4794 m_ptr->mflag &= ~(MFLAG_NICE);
4797 /* Handle memorized monsters */
4798 if (m_ptr->mflag2 & MFLAG2_MARK)
4800 /* Maintain detection */
4801 if (m_ptr->mflag2 & MFLAG2_SHOW)
4804 m_ptr->mflag2 &= ~(MFLAG2_SHOW);
4806 /* Still need repairs */
4807 repair_monsters = TRUE;
4810 /* Remove detection */
4814 m_ptr->mflag2 &= ~(MFLAG2_MARK);
4816 /* Assume invisible */
4818 update_monster(creature_ptr, m_idx, FALSE);
4820 if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
4821 if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
4823 /* Redraw regardless */
4824 lite_spot(m_ptr->fy, m_ptr->fx);
4829 if (creature_ptr->pclass == CLASS_IMITATOR)
4832 if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
4834 creature_ptr->mane_num--;
4835 for (j = 0; j < creature_ptr->mane_num; j++)
4837 creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
4838 creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
4841 creature_ptr->new_mane = FALSE;
4842 creature_ptr->redraw |= (PR_IMITATION);
4844 if (creature_ptr->action == ACTION_LEARN)
4846 creature_ptr->new_mane = FALSE;
4847 creature_ptr->redraw |= (PR_STATE);
4850 if (creature_ptr->timewalk && (creature_ptr->energy_need > - 1000))
4853 creature_ptr->redraw |= (PR_MAP);
4854 creature_ptr->update |= (PU_MONSTERS);
4855 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4857 msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
4859 creature_ptr->timewalk = FALSE;
4860 creature_ptr->energy_need = ENERGY_NEED();
4866 /* Hack -- notice death */
4867 if (!creature_ptr->playing || creature_ptr->is_dead)
4869 creature_ptr->timewalk = FALSE;
4874 if (creature_ptr->energy_use && creature_ptr->reset_concent) reset_concentration(creature_ptr, TRUE);
4876 /* Handle "leaving" */
4877 if (creature_ptr->leaving) break;
4880 /* Update scent trail */
4881 update_smell(creature_ptr->current_floor_ptr, creature_ptr);
4885 * @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
4889 * この関数から現在の階層を出る、プレイヤーがキャラが死ぬ、
4890 * ゲームを終了するかのいずれかまでループする。
4893 * This function will not exit until the level is completed,\n
4894 * the user dies, or the game is terminated.\n
4897 static void dungeon(bool load_game)
4901 /* Set the base level */
4902 p_ptr->current_floor_ptr->base_level = p_ptr->current_floor_ptr->dun_level;
4904 /* Reset various flags */
4905 current_world_ptr->is_loading_now = FALSE;
4908 p_ptr->leaving = FALSE;
4910 /* Reset the "command" vars */
4913 #if 0 /* Don't reset here --- It's used for Arena */
4922 /* Cancel the target */
4924 p_ptr->pet_t_m_idx = 0;
4925 p_ptr->riding_t_m_idx = 0;
4926 p_ptr->ambush_flag = FALSE;
4928 /* Cancel the health bar */
4931 /* Check visual effects */
4932 repair_monsters = TRUE;
4933 repair_objects = TRUE;
4936 disturb(p_ptr, TRUE, TRUE);
4938 /* Get index of current quest (if any) */
4939 quest_num = quest_number(p_ptr->current_floor_ptr->dun_level);
4941 /* Inside a quest? */
4944 /* Mark the quest monster */
4945 r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
4948 /* Track maximum player level */
4949 if (p_ptr->max_plv < p_ptr->lev)
4951 p_ptr->max_plv = p_ptr->lev;
4955 /* Track maximum dungeon level (if not in quest -KMW-) */
4956 if ((max_dlv[p_ptr->dungeon_idx] < p_ptr->current_floor_ptr->dun_level) && !p_ptr->current_floor_ptr->inside_quest)
4958 max_dlv[p_ptr->dungeon_idx] = p_ptr->current_floor_ptr->dun_level;
4959 if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_MAXDEAPTH, p_ptr->current_floor_ptr->dun_level, NULL);
4962 (void)calculate_upkeep(p_ptr);
4964 /* Validate the panel */
4965 panel_bounds_center();
4967 /* Verify the panel */
4973 /* Enter "xtra" mode */
4974 current_world_ptr->character_xtra = TRUE;
4976 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
4977 p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
4978 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
4982 /* Leave "xtra" mode */
4983 current_world_ptr->character_xtra = FALSE;
4985 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
4986 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4990 if (quest_num && (is_fixed_quest_idx(quest_num) &&
4991 !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
4992 !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling(p_ptr);
4994 if (p_ptr->phase_out)
4998 p_ptr->energy_need = 0;
4999 update_gambling_monsters();
5003 msg_print(_("試合開始!", "Ready..Fight!"));
5008 if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT))
5009 SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT;
5011 /* Hack -- notice death or departure */
5012 if (!p_ptr->playing || p_ptr->is_dead) return;
5014 /* Print quest message if appropriate */
5015 if (!p_ptr->current_floor_ptr->inside_quest && (p_ptr->dungeon_idx == DUNGEON_ANGBAND))
5017 quest_discovery(random_quest_number(p_ptr->current_floor_ptr->dun_level));
5018 p_ptr->current_floor_ptr->inside_quest = random_quest_number(p_ptr->current_floor_ptr->dun_level);
5020 if ((p_ptr->current_floor_ptr->dun_level == d_info[p_ptr->dungeon_idx].maxdepth) && d_info[p_ptr->dungeon_idx].final_guardian)
5022 if (r_info[d_info[p_ptr->dungeon_idx].final_guardian].max_num)
5024 msg_format("この階には%sの主である%sが棲んでいる。",
5025 d_name+d_info[p_ptr->dungeon_idx].name,
5026 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name);
5028 msg_format("%^s lives in this level as the keeper of %s.",
5029 r_name+r_info[d_info[p_ptr->dungeon_idx].final_guardian].name,
5030 d_name+d_info[p_ptr->dungeon_idx].name);
5034 if (!load_game && (p_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(p_ptr, FALSE);
5036 /*** Process this dungeon level ***/
5038 /* Reset the monster generation level */
5039 p_ptr->current_floor_ptr->monster_level = p_ptr->current_floor_ptr->base_level;
5041 /* Reset the object generation level */
5042 p_ptr->current_floor_ptr->object_level = p_ptr->current_floor_ptr->base_level;
5044 current_world_ptr->is_loading_now = TRUE;
5046 if (p_ptr->energy_need > 0 && !p_ptr->phase_out &&
5047 (p_ptr->current_floor_ptr->dun_level || p_ptr->leaving_dungeon || p_ptr->current_floor_ptr->inside_arena))
5048 p_ptr->energy_need = 0;
5050 /* Not leaving dungeon */
5051 p_ptr->leaving_dungeon = FALSE;
5053 /* Initialize monster process */
5059 /* Hack -- Compact the monster list occasionally */
5060 if ((p_ptr->current_floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !p_ptr->phase_out) compact_monsters(64);
5062 /* Hack -- Compress the monster list occasionally */
5063 if ((p_ptr->current_floor_ptr->m_cnt + 32 < p_ptr->current_floor_ptr->m_max) && !p_ptr->phase_out) compact_monsters(0);
5066 /* Hack -- Compact the object list occasionally */
5067 if (p_ptr->current_floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(64);
5069 /* Hack -- Compress the object list occasionally */
5070 if (p_ptr->current_floor_ptr->o_cnt + 32 < p_ptr->current_floor_ptr->o_max) compact_objects(0);
5072 /* Process the player */
5073 process_player(p_ptr);
5074 process_upkeep_with_speed();
5078 /* Hack -- Hilite the player */
5079 move_cursor_relative(p_ptr->y, p_ptr->x);
5081 /* Optional fresh */
5082 if (fresh_after) Term_fresh();
5084 /* Hack -- Notice death or departure */
5085 if (!p_ptr->playing || p_ptr->is_dead) break;
5087 /* Process all of the monsters */
5092 /* Hack -- Hilite the player */
5093 move_cursor_relative(p_ptr->y, p_ptr->x);
5095 /* Optional fresh */
5096 if (fresh_after) Term_fresh();
5098 /* Hack -- Notice death or departure */
5099 if (!p_ptr->playing || p_ptr->is_dead) break;
5101 /* Process the world */
5106 /* Hack -- Hilite the player */
5107 move_cursor_relative(p_ptr->y, p_ptr->x);
5109 /* Optional fresh */
5110 if (fresh_after) Term_fresh();
5112 /* Hack -- Notice death or departure */
5113 if (!p_ptr->playing || p_ptr->is_dead) break;
5115 /* Count game turns */
5116 current_world_ptr->game_turn++;
5118 if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
5120 if (!p_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
5121 else if (p_ptr->wild_mode && !(current_world_ptr->game_turn % ((MAX_HGT + MAX_WID) / 2))) current_world_ptr->dungeon_turn++;
5124 prevent_turn_overflow();
5126 /* Handle "leaving" */
5127 if (p_ptr->leaving) break;
5129 if (wild_regen) wild_regen--;
5132 /* Inside a quest and non-unique questor? */
5133 if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
5135 /* Un-mark the quest monster */
5136 r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
5139 /* Not save-and-quit and not dead? */
5140 if (p_ptr->playing && !p_ptr->is_dead)
5143 * Maintain Unique monsters and artifact, save current
5144 * floor, then prepare next floor
5148 /* Forget the flag */
5149 reinit_wilderness = FALSE;
5152 /* Write about current level on the play record once per level */
5158 * @brief 全ユーザプロファイルをロードする / Load some "user pref files"
5161 * Modified by Arcum Dagsson to support
5162 * separate macro files for different realms.
5164 static void load_all_pref_files(void)
5168 /* Access the "user" pref file */
5169 sprintf(buf, "user.prf");
5171 /* Process that file */
5172 process_pref_file(buf);
5174 /* Access the "user" system pref file */
5175 sprintf(buf, "user-%s.prf", ANGBAND_SYS);
5177 /* Process that file */
5178 process_pref_file(buf);
5180 /* Access the "race" pref file */
5181 sprintf(buf, "%s.prf", rp_ptr->title);
5183 /* Process that file */
5184 process_pref_file(buf);
5186 /* Access the "class" pref file */
5187 sprintf(buf, "%s.prf", cp_ptr->title);
5189 /* Process that file */
5190 process_pref_file(buf);
5192 /* Access the "character" pref file */
5193 sprintf(buf, "%s.prf", p_ptr->base_name);
5195 /* Process that file */
5196 process_pref_file(buf);
5198 /* Access the "realm 1" pref file */
5199 if (p_ptr->realm1 != REALM_NONE)
5201 sprintf(buf, "%s.prf", realm_names[p_ptr->realm1]);
5203 /* Process that file */
5204 process_pref_file(buf);
5207 /* Access the "realm 2" pref file */
5208 if (p_ptr->realm2 != REALM_NONE)
5210 sprintf(buf, "%s.prf", realm_names[p_ptr->realm2]);
5212 /* Process that file */
5213 process_pref_file(buf);
5217 /* Load an autopick preference file */
5218 autopick_load_pref(FALSE);
5222 * @brief 1ゲームプレイの主要ルーチン / Actually play a game
5225 * If the "new_game" parameter is true, then, after loading the
5226 * savefile, we will commit suicide, if necessary, to allow the
5227 * player to start a new game.
5229 void play_game(bool new_game)
5232 bool load_game = TRUE;
5233 bool init_random_seed = FALSE;
5243 else if (chuukei_server)
5245 prepare_chuukei_hooks();
5256 p_ptr->hack_mutation = FALSE;
5258 /* Hack -- Character is "icky" */
5259 current_world_ptr->character_icky = TRUE;
5261 /* Make sure main term is active */
5262 Term_activate(angband_term[0]);
5264 /* Initialise the resize hooks */
5265 angband_term[0]->resize_hook = resize_map;
5267 for (i = 1; i < 8; i++)
5269 /* Does the term exist? */
5270 if (angband_term[i])
5272 /* Add the redraw on resize hook */
5273 angband_term[i]->resize_hook = redraw_window;
5277 /* Hack -- turn off the cursor */
5278 (void)Term_set_cursor(0);
5281 /* Attempt to load */
5284 quit(_("セーブファイルが壊れています", "broken savefile"));
5287 /* Extract the options */
5288 extract_option_vars();
5290 /* Report waited score */
5291 if (p_ptr->wait_report_score)
5296 if (!get_check_strict(_("待機していたスコア登録を今行ないますか?", "Do you register score now? "), CHECK_NO_HISTORY))
5299 p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
5300 update_creature(p_ptr);
5302 p_ptr->is_dead = TRUE;
5304 current_world_ptr->start_time = (u32b)time(NULL);
5306 /* No suspending now */
5307 signals_ignore_tstp();
5309 /* Hack -- Character is now "icky" */
5310 current_world_ptr->character_icky = TRUE;
5311 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5313 /* Open the high score file, for reading/writing */
5314 highscore_fd = fd_open(buf, O_RDWR);
5316 /* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
5317 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5319 /* Handle score, show Top scores */
5320 success = send_world_score(TRUE);
5322 if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
5324 prt(_("引き続き待機します。", "standing by for future registration..."), 0, 0);
5329 p_ptr->wait_report_score = FALSE;
5331 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5333 /* Shut the high score file */
5334 (void)fd_close(highscore_fd);
5336 /* Forget the high score fd */
5339 /* Allow suspending now */
5340 signals_handle_tstp();
5345 current_world_ptr->creating_savefile = new_game;
5347 /* Nothing loaded */
5348 if (!current_world_ptr->character_loaded)
5350 /* Make new player */
5353 /* The dungeon is not ready */
5354 current_world_ptr->character_dungeon = FALSE;
5356 /* Prepare to init the RNG */
5357 init_random_seed = TRUE;
5359 /* Initialize the saved floors data */
5360 init_saved_floors(FALSE);
5363 /* Old game is loaded. But new game is requested. */
5366 /* Initialize the saved floors data */
5367 init_saved_floors(TRUE);
5370 /* Process old character */
5373 /* Process the player name */
5374 process_player_name(FALSE);
5378 if (init_random_seed)
5383 /* Roll new character */
5386 /* The dungeon is not ready */
5387 current_world_ptr->character_dungeon = FALSE;
5390 p_ptr->current_floor_ptr->dun_level = 0;
5391 p_ptr->current_floor_ptr->inside_quest = 0;
5392 p_ptr->current_floor_ptr->inside_arena = FALSE;
5393 p_ptr->phase_out = FALSE;
5397 /* Hack -- seed for flavors */
5398 current_world_ptr->seed_flavor = randint0(0x10000000);
5400 /* Hack -- seed for town layout */
5401 current_world_ptr->seed_town = randint0(0x10000000);
5403 /* Roll up a new character */
5404 player_birth(p_ptr);
5411 determine_bounty_uniques();
5412 determine_today_mon(FALSE);
5414 /* Initialize object array */
5415 wipe_o_list(p_ptr->current_floor_ptr);
5419 write_level = FALSE;
5421 exe_write_diary(p_ptr, NIKKI_GAMESTART, 1,
5423 " ---- Restart Game ----"));
5426 * 1.0.9 以前はセーブ前に p_ptr->riding = -1 としていたので、再設定が必要だった。
5427 * もう不要だが、以前のセーブファイルとの互換のために残しておく。
5429 if (p_ptr->riding == -1)
5432 for (i = p_ptr->current_floor_ptr->m_max; i > 0; i--)
5434 if (player_bold(p_ptr, p_ptr->current_floor_ptr->m_list[i].fy, p_ptr->current_floor_ptr->m_list[i].fx))
5443 current_world_ptr->creating_savefile = FALSE;
5445 p_ptr->teleport_town = FALSE;
5446 p_ptr->sutemi = FALSE;
5447 current_world_ptr->timewalk_m_idx = 0;
5448 p_ptr->now_damaged = FALSE;
5450 current_world_ptr->start_time = time(NULL) - 1;
5451 record_o_name[0] = '\0';
5453 /* Reset map panel */
5454 panel_row_min = p_ptr->current_floor_ptr->height;
5455 panel_col_min = p_ptr->current_floor_ptr->width;
5457 /* Sexy gal gets bonus to maximum weapon skill of whip */
5458 if (p_ptr->pseikaku == SEIKAKU_SEXY)
5459 s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
5461 /* Fill the arrays of floors and walls in the good proportions */
5462 set_floor_and_wall(p_ptr->dungeon_idx);
5464 /* Flavor the objects */
5467 /* Flash a message */
5468 prt(_("お待ち下さい...", "Please wait..."), 0, 0);
5470 /* Flush the message */
5474 /* Hack -- Enter wizard mode */
5477 if (enter_wizard_mode())
5479 current_world_ptr->wizard = TRUE;
5481 if (p_ptr->is_dead || !p_ptr->y || !p_ptr->x)
5483 /* Initialize the saved floors data */
5484 init_saved_floors(TRUE);
5487 p_ptr->current_floor_ptr->inside_quest = 0;
5489 /* Avoid crash in update_view() */
5490 p_ptr->y = p_ptr->x = 10;
5493 else if (p_ptr->is_dead)
5495 quit("Already dead.");
5499 /* Initialize the town-buildings if necessary */
5500 if (!p_ptr->current_floor_ptr->dun_level && !p_ptr->current_floor_ptr->inside_quest)
5502 process_dungeon_file("w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
5503 init_flags = INIT_ONLY_BUILDINGS;
5504 process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
5505 select_floor_music(p_ptr);
5508 /* Generate a dungeon level if needed */
5509 if (!current_world_ptr->character_dungeon)
5511 change_floor(p_ptr);
5515 /* HACK -- Restore from panic-save */
5516 if (p_ptr->panic_save)
5518 /* No player? -- Try to regenerate floor */
5519 if (!p_ptr->y || !p_ptr->x)
5521 msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location. Regenerate the dungeon floor."));
5522 change_floor(p_ptr);
5525 /* Still no player? -- Try to locate random place */
5526 if (!p_ptr->y || !p_ptr->x) p_ptr->y = p_ptr->x = 10;
5528 /* No longer in panic */
5529 p_ptr->panic_save = 0;
5533 /* Character is now "complete" */
5534 current_world_ptr->character_generated = TRUE;
5537 /* Hack -- Character is no longer "icky" */
5538 current_world_ptr->character_icky = FALSE;
5544 sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name());
5545 exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, buf);
5550 p_ptr->playing = TRUE;
5552 /* Reset the visual mappings */
5555 /* Load the "pref" files */
5556 load_all_pref_files();
5558 /* Give startup outfit (after loading pref files) */
5561 player_outfit(p_ptr);
5564 /* React to changes */
5565 Term_xtra(TERM_XTRA_REACT, 0);
5567 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
5568 p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
5571 /* Set or clear "rogue_like_commands" if requested */
5572 if (arg_force_original) rogue_like_commands = FALSE;
5573 if (arg_force_roguelike) rogue_like_commands = TRUE;
5575 /* Hack -- Enforce "delayed death" */
5576 if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
5578 if (p_ptr->prace == RACE_ANDROID) calc_android_exp(p_ptr);
5580 if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER)))
5582 monster_type *m_ptr;
5583 MONRACE_IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
5584 monster_race *r_ptr = &r_info[pet_r_idx];
5585 place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx,
5586 (PM_FORCE_PET | PM_NO_KAGE));
5587 m_ptr = &p_ptr->current_floor_ptr->m_list[hack_m_idx_ii];
5588 m_ptr->mspeed = r_ptr->speed;
5589 m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
5590 m_ptr->max_maxhp = m_ptr->maxhp;
5591 m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
5592 m_ptr->dealt_damage = 0;
5593 m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
5596 (void)combine_and_reorder_home(STORE_HOME);
5597 (void)combine_and_reorder_home(STORE_MUSEUM);
5599 select_floor_music(p_ptr);
5604 /* Process the level */
5607 /* Hack -- prevent "icky" message */
5608 current_world_ptr->character_xtra = TRUE;
5612 current_world_ptr->character_xtra = FALSE;
5614 /* Cancel the target */
5617 /* Cancel the health bar */
5620 forget_lite(p_ptr->current_floor_ptr);
5621 forget_view(p_ptr->current_floor_ptr);
5622 clear_mon_lite(p_ptr->current_floor_ptr);
5624 /* Handle "quit and save" */
5625 if (!p_ptr->playing && !p_ptr->is_dead) break;
5627 /* Erase the old p_ptr->current_floor_ptr->grid_array */
5628 wipe_o_list(p_ptr->current_floor_ptr);
5629 if (!p_ptr->is_dead) wipe_m_list();
5636 /* Accidental Death */
5637 if (p_ptr->playing && p_ptr->is_dead)
5639 if (p_ptr->current_floor_ptr->inside_arena)
5641 p_ptr->current_floor_ptr->inside_arena = FALSE;
5642 if (p_ptr->arena_number > MAX_ARENA_MONS)
5643 p_ptr->arena_number++;
5645 p_ptr->arena_number = -1 - p_ptr->arena_number;
5646 p_ptr->is_dead = FALSE;
5648 p_ptr->chp_frac = 0;
5649 p_ptr->exit_bldg = TRUE;
5650 reset_tim_flags(p_ptr);
5652 /* Leave through the exit */
5653 prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
5655 /* prepare next floor */
5660 /* Mega-Hack -- Allow player to cheat death */
5661 if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
5668 /* Handle "death" */
5669 if (p_ptr->is_dead) break;
5671 /* Make a new level */
5672 change_floor(p_ptr);
5683 * @brief ゲームターンからの実時間換算を行うための補正をかける
5684 * @param hoge ゲームターン
5685 * @details アンデッド種族は18:00からゲームを開始するので、この修正を予め行う。
5686 * @return 修正をかけた後のゲームターン
5688 s32b turn_real(s32b hoge)
5690 switch (p_ptr->start_race)
5696 return hoge - (TURNS_PER_TICK * TOWN_DAWN * 3 / 4);
5703 * @brief ターンのオーバーフローに対する対処
5704 * @details ターン及びターンを記録する変数をターンの限界の1日前まで巻き戻す.
5705 * @return 修正をかけた後のゲームターン
5707 void prevent_turn_overflow(void)
5709 int rollback_days, i, j;
5710 s32b rollback_turns;
5712 if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
5714 rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
5715 rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
5717 if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
5718 else current_world_ptr->game_turn = 1;
5719 if (p_ptr->current_floor_ptr->generated_turn > rollback_turns) p_ptr->current_floor_ptr->generated_turn -= rollback_turns;
5720 else p_ptr->current_floor_ptr->generated_turn = 1;
5721 if (current_world_ptr->arena_start_turn > rollback_turns) current_world_ptr->arena_start_turn -= rollback_turns;
5722 else current_world_ptr->arena_start_turn = 1;
5723 if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
5724 else p_ptr->feeling_turn = 1;
5726 for (i = 1; i < max_towns; i++)
5728 for (j = 0; j < MAX_STORES; j++)
5730 store_type *st_ptr = &town_info[i].store[j];
5732 if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
5734 st_ptr->last_visit -= rollback_turns;
5735 if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
5738 if (st_ptr->store_open)
5740 st_ptr->store_open -= rollback_turns;
5741 if (st_ptr->store_open < 1) st_ptr->store_open = 1;
5749 * Close up the current game (player may or may not be dead)
5753 * This function is called only from "main.c" and "signals.c".
5756 void close_game(void)
5759 bool do_send = TRUE;
5761 /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
5764 /* Flush the messages */
5767 /* Flush the input */
5771 /* No suspending now */
5772 signals_ignore_tstp();
5775 /* Hack -- Character is now "icky" */
5776 current_world_ptr->character_icky = TRUE;
5778 path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
5780 /* Grab permissions */
5783 /* Open the high score file, for reading/writing */
5784 highscore_fd = fd_open(buf, O_RDWR);
5786 /* Drop permissions */
5792 /* Handle retirement */
5793 if (p_ptr->total_winner) kingly(p_ptr);
5796 if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
5798 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5800 else do_send = FALSE;
5807 /* Show more info */
5813 if ((!send_world_score(do_send)))
5815 if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
5816 (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
5818 p_ptr->wait_report_score = TRUE;
5819 p_ptr->is_dead = FALSE;
5820 if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
5823 if (!p_ptr->wait_report_score)
5824 (void)top_twenty(p_ptr);
5826 else if (highscore_fd >= 0)
5828 display_scores_aux(0, 10, -1, NULL);
5831 /* Dump bones file */
5840 do_cmd_save_game(FALSE);
5842 /* Prompt for scores */
5843 prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
5844 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
5846 /* Predict score (or ESCAPE) */
5847 if (inkey() != ESCAPE) predict_score(p_ptr);
5851 /* Shut the high score file */
5852 (void)fd_close(highscore_fd);
5854 /* Forget the high score fd */
5857 /* Kill all temporal files */
5858 clear_saved_floor_files();
5860 /* Allow suspending now */
5861 signals_handle_tstp();
5866 * @brief 全更新処理をチェックして処理していく
5867 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
5870 void handle_stuff(void)
5872 if (p_ptr->update) update_creature(p_ptr);
5873 if (p_ptr->redraw) redraw_stuff();
5874 if (p_ptr->window) window_stuff();
5877 void update_output(void)
5879 if (p_ptr->redraw) redraw_stuff();
5880 if (p_ptr->window) window_stuff();