2 * @brief モンスターの特殊技能とターン経過処理 (移動等)/ Monster spells and movement for passaging a turn
5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
6 * This software may be copied and distributed for educational, research,\n
7 * and not for profit purposes provided that this copyright and statement\n
8 * are included in all such copies. Other copyrights may also apply.\n
9 * 2014 Deskull rearranged comment for Doxygen.\n
11 * This file has several additions to it by Keldon Jones (keldon@umr.edu)
12 * to improve the general quality of the AI (version 0.1.1).
15 #include "monster/monster-processor.h"
16 #include "avatar/avatar.h"
17 #include "cmd-io/cmd-dump.h"
18 #include "core/speed-table.h"
19 #include "floor/cave.h"
20 #include "floor/geometry.h"
21 #include "game-option/play-record-options.h"
22 #include "grid/feature.h"
23 #include "io/write-diary.h"
24 #include "melee/melee-postprocess.h"
25 #include "melee/melee-spell.h"
26 #include "monster-floor/monster-direction.h"
27 #include "monster-floor/monster-generator.h"
28 #include "monster-floor/monster-move.h"
29 #include "monster-floor/monster-remover.h"
30 #include "monster-floor/monster-runaway.h"
31 #include "monster-floor/monster-summon.h"
32 #include "monster-floor/place-monster-types.h"
33 #include "monster-floor/quantum-effect.h"
34 #include "monster-race/monster-race.h"
35 #include "monster-race/race-flags-resistance.h"
36 #include "monster-race/race-flags1.h"
37 #include "monster-race/race-flags2.h"
38 #include "monster-race/race-flags7.h"
39 #include "monster-race/race-indice-types.h"
40 #include "monster/monster-describer.h"
41 #include "monster/monster-description-types.h"
42 #include "monster/monster-flag-types.h"
43 #include "monster/monster-info.h"
44 #include "monster/monster-list.h"
45 #include "monster/monster-processor-util.h"
46 #include "monster/monster-status-setter.h"
47 #include "monster/monster-status.h"
48 #include "monster/monster-update.h"
49 #include "monster/monster-util.h"
50 #include "mspell/mspell-attack.h"
51 #include "mspell/mspell-judgement.h"
52 #include "object-enchant/trc-types.h"
53 #include "pet/pet-fall-off.h"
54 #include "player-base/player-class.h"
55 #include "player-info/ninja-data-type.h"
56 #include "player/player-move.h"
57 #include "player/player-skill.h"
58 #include "player/player-status-flags.h"
59 #include "player/special-defense-types.h"
60 #include "spell-realm/spells-hex.h"
61 #include "spell/summon-types.h"
62 #include "system/angband-system.h"
63 #include "system/floor-type-definition.h"
64 #include "system/grid-type-definition.h"
65 #include "system/monster-entity.h"
66 #include "system/monster-race-info.h"
67 #include "system/player-type-definition.h"
68 #include "system/redrawing-flags-updater.h"
69 #include "target/projection-path-calculator.h"
70 #include "view/display-messages.h"
72 void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon);
73 bool process_stealth(PlayerType *player_ptr, MONSTER_IDX m_idx);
74 bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m);
75 bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx);
76 void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m);
77 bool explode_grenade(PlayerType *player_ptr, MONSTER_IDX m_idx);
78 bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox);
79 void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx);
80 bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware);
82 bool process_monster_fear(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx);
84 void sweep_monster_process(PlayerType *player_ptr);
85 bool decide_process_continue(PlayerType *player_ptr, MonsterEntity *m_ptr);
88 * @brief モンスター単体の1ターン行動処理メインルーチン /
90 * @param player_ptr プレイヤーへの参照ポインタ
91 * @param m_idx 行動モンスターの参照ID
93 * The monster is known to be within 100 grids of the player\n
95 * In several cases, we directly update the monster lore\n
97 * Note that a monster is only allowed to "reproduce" if there\n
98 * are a limited number of "reproducing" monsters on the current\n
99 * level. This should prevent the level from being "swamped" by\n
100 * reproducing monsters. It also allows a large mass of mice to\n
101 * prevent a louse from multiplying, but this is a small price to\n
102 * pay for a simple ENERGY_MULTIPLICATION method.\n
104 * XXX Monster fear is slightly odd, in particular, monsters will\n
105 * fixate on opening a door even if they cannot open it. Actually,\n
106 * the same thing happens to normal monsters when they hit a door\n
108 * In addition, monsters which *cannot* open or bash\n
109 * down a door will still stand there trying to open it...\n
111 * XXX Technically, need to check for monster in the way\n
112 * combined with that monster being in a wall (or door?)\n
114 * A "direction" of "5" means "pick a random direction".\n
116 void process_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
118 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
119 auto *r_ptr = &m_ptr->get_monrace();
120 turn_flags tmp_flags;
121 turn_flags *turn_flags_ptr = init_turn_flags(player_ptr->riding, m_idx, &tmp_flags);
122 turn_flags_ptr->see_m = is_seen(player_ptr, m_ptr);
124 decide_drop_from_monster(player_ptr, m_idx, turn_flags_ptr->is_riding_mon);
125 if (m_ptr->mflag2.has(MonsterConstantFlagType::CHAMELEON) && one_in_(13) && !m_ptr->is_asleep()) {
126 choose_new_monster(player_ptr, m_idx, false, MonsterRace::empty_id());
127 r_ptr = &m_ptr->get_monrace();
130 turn_flags_ptr->aware = process_stealth(player_ptr, m_idx);
131 if (vanish_summoned_children(player_ptr, m_idx, turn_flags_ptr->see_m)) {
135 if (process_quantum_effect(player_ptr, m_idx, turn_flags_ptr->see_m)) {
139 if (explode_grenade(player_ptr, m_idx)) {
143 if (runaway_monster(player_ptr, turn_flags_ptr, m_idx)) {
147 if (!awake_monster(player_ptr, m_idx)) {
151 if (m_ptr->is_stunned() && one_in_(2)) {
155 if (turn_flags_ptr->is_riding_mon) {
156 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
159 process_angar(player_ptr, m_idx, turn_flags_ptr->see_m);
161 POSITION oy = m_ptr->fy;
162 POSITION ox = m_ptr->fx;
163 if (decide_monster_multiplication(player_ptr, m_idx, oy, ox)) {
167 process_special(player_ptr, m_idx);
168 process_speak_sound(player_ptr, m_idx, oy, ox, turn_flags_ptr->aware);
169 if (cast_spell(player_ptr, m_idx, turn_flags_ptr->aware)) {
174 mm[0] = mm[1] = mm[2] = mm[3] = 0;
175 mm[4] = mm[5] = mm[6] = mm[7] = 0;
177 if (!decide_monster_movement_direction(player_ptr, mm, m_idx, turn_flags_ptr->aware)) {
182 if (!process_monster_movement(player_ptr, turn_flags_ptr, m_idx, mm, { oy, ox }, &count)) {
187 * Forward movements failed, but now received LOS attack!
188 * Try to flow by smell.
190 if (player_ptr->no_flowed && count > 2 && m_ptr->target_y) {
191 m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
194 if (!turn_flags_ptr->do_turn && !turn_flags_ptr->do_move && !m_ptr->is_fearful() && !turn_flags_ptr->is_riding_mon && turn_flags_ptr->aware) {
195 if (r_ptr->freq_spell && randint1(100) <= r_ptr->freq_spell) {
196 if (make_attack_spell(player_ptr, m_idx)) {
202 update_map_flags(turn_flags_ptr);
203 update_lite_flags(turn_flags_ptr, r_ptr);
204 update_monster_race_flags(player_ptr, turn_flags_ptr, m_ptr);
206 if (!process_monster_fear(player_ptr, turn_flags_ptr, m_idx)) {
211 chg_virtue(player_ptr, Virtue::COMPASSION, -1);
217 * @param player_ptr プレイヤーへの参照ポインタ
218 * @param m_idx モンスターID
219 * @return モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
221 bool process_stealth(PlayerType *player_ptr, MONSTER_IDX m_idx)
223 auto ninja_data = PlayerClass(player_ptr).get_specific_data<ninja_data_type>();
224 if (!ninja_data || !ninja_data->s_stealth) {
228 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
229 auto *r_ptr = &m_ptr->get_monrace();
230 int tmp = player_ptr->lev * 6 + (player_ptr->skill_stl + 10) * 4;
231 if (player_ptr->monlite) {
235 if (has_aggravate(player_ptr)) {
239 if (r_ptr->level > (player_ptr->lev * player_ptr->lev / 20 + 10)) {
243 return randint0(tmp) <= (r_ptr->level + 20);
247 * @brief 死亡したモンスターが乗馬中のモンスターだった場合に落馬処理を行う
248 * @param player_ptr プレイヤーへの参照ポインタ
249 * @param m_idx モンスターID
250 * @param is_riding_mon 騎乗中であればTRUE
252 void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon)
254 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
255 auto *r_ptr = &m_ptr->get_monrace();
256 if (!is_riding_mon || r_ptr->misc_flags.has(MonsterMiscType::RIDING)) {
260 if (process_fall_off_horse(player_ptr, 0, true)) {
262 msg_print("地面に落とされた。");
264 const auto m_name = monster_desc(player_ptr, &player_ptr->current_floor_ptr->m_list[player_ptr->riding], 0);
265 msg_format("You have fallen from %s.", m_name.data());
271 * @brief 召喚の親元が消滅した時、子供も消滅させる
272 * @param player_ptr プレイヤーへの参照ポインタ
273 * @param m_idx モンスターID
274 * @param see_m モンスターが視界内にいたらTRUE
275 * @return 召喚モンスターが消滅したらTRUE
277 bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
279 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
281 if (m_ptr->parent_m_idx == 0) {
285 // parent_m_idxが自分自身を指している場合は召喚主は消滅している
286 if (m_ptr->parent_m_idx != m_idx && MonsterRace(player_ptr->current_floor_ptr->m_list[m_ptr->parent_m_idx].r_idx).is_valid()) {
291 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
292 msg_format(_("%sは消え去った!", "%s^ disappears!"), m_name.data());
295 if (record_named_pet && m_ptr->is_named_pet()) {
296 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
297 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
300 delete_monster_idx(player_ptr, m_idx);
305 * @brief 寝ているモンスターの起床を判定する
306 * @param player_ptr プレイヤーへの参照ポインタ
307 * @param m_idx モンスターID
308 * @return 寝たままならFALSE、起きているor起きたらTRUE
310 bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
312 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
313 auto *r_ptr = &m_ptr->get_monrace();
314 if (!m_ptr->is_asleep()) {
318 if (!has_aggravate(player_ptr)) {
322 (void)set_monster_csleep(player_ptr, m_idx, 0);
324 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
325 msg_format(_("%s^が目を覚ました。", "%s^ wakes up."), m_name.data());
328 if (is_original_ap_and_seen(player_ptr, m_ptr) && (r_ptr->r_wake < MAX_UCHAR)) {
336 * @brief モンスターの怒り状態を判定する (怒っていたら敵に回す)
337 * @param player_ptr プレイヤーへの参照ポインタ
338 * @param m_idx モンスターID
339 * @param see_m モンスターが視界内にいたらTRUE
341 void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
343 auto &monster = player_ptr->current_floor_ptr->m_list[m_idx];
344 const auto &monrace = monster.get_monrace();
345 auto gets_angry = monster.is_friendly() && has_aggravate(player_ptr);
346 const auto should_aggravate = monster.is_pet();
347 auto has_hostile = monrace.kind_flags.has(MonsterKindType::UNIQUE) || (monrace.population_flags.has(MonsterPopulationType::NAZGUL));
348 has_hostile &= monster_has_hostile_align(player_ptr, nullptr, 10, -10, &monrace);
349 const auto has_resist_all = monrace.resistance_flags.has(MonsterResistanceType::RESIST_ALL);
350 if (should_aggravate && (has_hostile || has_resist_all)) {
354 if (AngbandSystem::get_instance().is_phase_out() || !gets_angry) {
358 const auto m_name = monster_desc(player_ptr, &monster, monster.is_pet() ? MD_ASSUME_VISIBLE : 0);
360 /* When riding a hostile alignment pet */
361 if (player_ptr->riding == m_idx) {
362 if (abs(player_ptr->alignment / 10) < randint0(player_ptr->skill_exp[PlayerSkillKindType::RIDING])) {
366 msg_format(_("%s^が突然暴れだした!", "%s^ suddenly begins unruly!"), m_name.data());
367 if (!process_fall_off_horse(player_ptr, 1, true)) {
371 msg_format(_("あなたは振り落とされた。", "You have fallen."));
374 if (monster.is_pet() || see_m) {
375 msg_format(_("%s^は突然敵にまわった!", "%s^ suddenly becomes hostile!"), m_name.data());
378 monster.set_hostile();
383 * @param player_ptr プレイヤーへの参照ポインタ
384 * @param m_idx モンスターID
387 bool explode_grenade(PlayerType *player_ptr, MONSTER_IDX m_idx)
389 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
390 if (m_ptr->r_idx != MonsterRaceId::GRENADE) {
395 mon_take_hit_mon(player_ptr, m_idx, 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
400 * @brief モンスター依存の特別な行動を取らせる
401 * @param player_ptr プレイヤーへの参照ポインタ
402 * @param m_idx モンスターID
404 void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx)
406 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
407 auto *r_ptr = &m_ptr->get_monrace();
408 auto can_do_special = r_ptr->ability_flags.has(MonsterAbilityType::SPECIAL);
409 can_do_special &= m_ptr->r_idx == MonsterRaceId::OHMU;
410 can_do_special &= !player_ptr->current_floor_ptr->inside_arena;
411 can_do_special &= !AngbandSystem::get_instance().is_phase_out();
412 can_do_special &= r_ptr->freq_spell != 0;
413 can_do_special &= randint1(100) <= r_ptr->freq_spell;
414 if (!can_do_special) {
419 DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
420 BIT_FLAGS p_mode = m_ptr->is_pet() ? PM_FORCE_PET : PM_NONE;
422 for (int k = 0; k < A_MAX; k++) {
423 if (summon_specific(player_ptr, m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode))) {
424 if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml) {
430 if (count && is_original_ap_and_seen(player_ptr, m_ptr)) {
431 r_ptr->r_ability_flags.set(MonsterAbilityType::SPECIAL);
436 * @brief モンスターを分裂させるかどうかを決定する (分裂もさせる)
437 * @param player_ptr プレイヤーへの参照ポインタ
438 * @param m_idx モンスターID
439 * @param oy 分裂元モンスターのY座標
440 * @param ox 分裂元モンスターのX座標
441 * @return 実際に分裂したらTRUEを返す
443 bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox)
445 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
446 auto *r_ptr = &m_ptr->get_monrace();
447 if (r_ptr->misc_flags.has_not(MonsterMiscType::MULTIPLY) || (player_ptr->current_floor_ptr->num_repro >= MAX_REPRODUCTION)) {
452 for (POSITION y = oy - 1; y <= oy + 1; y++) {
453 for (POSITION x = ox - 1; x <= ox + 1; x++) {
454 if (!in_bounds2(player_ptr->current_floor_ptr, y, x)) {
458 if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
464 if (SpellHex(player_ptr).check_hex_barrier(m_idx, HEX_ANTI_MULTI)) {
468 constexpr auto chance_reproduction = 8;
469 if ((k < 4) && (!k || !randint0(k * chance_reproduction))) {
470 if (multiply_monster(player_ptr, m_idx, false, (m_ptr->is_pet() ? PM_FORCE_PET : 0))) {
471 if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(player_ptr, m_ptr)) {
472 r_ptr->r_misc_flags.set(MonsterMiscType::MULTIPLY);
483 * @brief モンスターに魔法を試行させる
484 * @param player_ptr プレイヤーへの参照ポインタ
485 * @param m_idx モンスターID
486 * @param aware モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
487 * @return 魔法を唱えられなければ強制的にFALSE、その後モンスターが実際に魔法を唱えればTRUE
489 bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware)
491 auto &floor = *player_ptr->current_floor_ptr;
492 const auto &monster_from = floor.m_list[m_idx];
493 const auto &monrace = monster_from.get_monrace();
494 if ((monrace.freq_spell == 0) || (randint1(100) > monrace.freq_spell)) {
498 bool counterattack = false;
499 if (monster_from.target_y) {
500 Pos2D pos(monster_from.target_y, monster_from.target_x);
501 const auto t_m_idx = floor.get_grid(pos).m_idx;
502 const auto &monster_to = floor.m_list[t_m_idx];
503 const auto is_projectable = projectable(player_ptr, monster_from.fy, monster_from.fx, monster_from.target_y, monster_from.target_x);
504 if (t_m_idx && monster_from.is_hostile_to_melee(monster_to) && is_projectable) {
505 counterattack = true;
510 if (monst_spell_monst(player_ptr, m_idx) || (aware && make_attack_spell(player_ptr, m_idx))) {
514 if ((aware && make_attack_spell(player_ptr, m_idx)) || monst_spell_monst(player_ptr, m_idx)) {
523 * @brief モンスターの恐怖状態を処理する
524 * @param player_ptr プレイヤーへの参照ポインタ
525 * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ
526 * @param m_idx モンスターID
527 * @param aware モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
528 * @return モンスターが戦いを決意したらTRUE
530 bool process_monster_fear(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx)
532 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
533 bool is_battle_determined = !turn_flags_ptr->do_turn && !turn_flags_ptr->do_move && m_ptr->is_fearful() && turn_flags_ptr->aware;
534 if (!is_battle_determined) {
538 (void)set_monster_monfear(player_ptr, m_idx, 0);
539 if (!turn_flags_ptr->see_m) {
543 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
544 msg_format(_("%s^は戦いを決意した!", "%s^ turns to fight!"), m_name.data());
549 * @brief 全モンスターのターン管理メインルーチン /
550 * Process all the "live" monsters, once per game turn.
552 * During each game current game turn, we scan through the list of all the "live" monsters,\n
553 * (backwards, so we can excise any "freshly dead" monsters), energizing each\n
554 * monster, and allowing fully energized monsters to move, attack, pass, etc.\n
556 * Note that monsters can never move in the monster array (except when the\n
557 * "compact_monsters()" function is called by "dungeon()" or "save_player()").\n
559 * This function is responsible for at least half of the processor time\n
560 * on a normal system with a "normal" amount of monsters and a player doing\n
563 * When the player is resting, virtually 90% of the processor time is spent\n
564 * in this function, and its children, "process_monster()" and "make_move()".\n
566 * Most of the rest of the time is spent in "update_view()" and "lite_spot()",\n
567 * especially when the player is running.\n
569 * Note the special "MFLAG_BORN" flag, which allows us to ignore "fresh"\n
570 * monsters while they are still being "born". A monster is "fresh" only\n
571 * during the game turn in which it is created, and we use the "hack_m_idx" to\n
572 * determine if the monster is yet to be processed during the game turn.\n
574 * Note the special "MFLAG_PREVENT_MAGIC" flag, which allows the player to get one\n
575 * move before any "nasty" monsters get to use their spell attacks.\n
577 * Note that when the "knowledge" about the currently tracked monster\n
578 * changes (flags, attacks, spells), we induce a redraw of the monster\n
581 void process_monsters(PlayerType *player_ptr)
583 const auto old_monrace_id = player_ptr->monster_race_idx;
584 old_race_flags tmp_flags(old_monrace_id);
585 old_race_flags *old_race_flags_ptr = &tmp_flags;
586 player_ptr->current_floor_ptr->monster_noise = false;
587 sweep_monster_process(player_ptr);
589 if (!MonsterRace(player_ptr->monster_race_idx).is_valid() || (player_ptr->monster_race_idx != old_monrace_id)) {
593 update_player_window(player_ptr, old_race_flags_ptr);
597 * @brief フロア内のモンスターについてターン終了時の処理を繰り返す
598 * @param player_ptr プレイヤーへの参照ポインタ
600 void sweep_monster_process(PlayerType *player_ptr)
602 auto *floor_ptr = player_ptr->current_floor_ptr;
603 for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--) {
604 MonsterEntity *m_ptr;
605 m_ptr = &floor_ptr->m_list[i];
607 if (player_ptr->leaving) {
611 if (!m_ptr->is_valid() || player_ptr->wild_mode) {
615 if (m_ptr->mflag.has(MonsterTemporaryFlagType::BORN)) {
616 m_ptr->mflag.reset(MonsterTemporaryFlagType::BORN);
620 if ((m_ptr->cdis >= MAX_MONSTER_SENSING) || !decide_process_continue(player_ptr, m_ptr)) {
624 byte speed = (player_ptr->riding == i) ? player_ptr->pspeed : m_ptr->get_temporary_speed();
625 m_ptr->energy_need -= speed_to_energy(speed);
626 if (m_ptr->energy_need > 0) {
630 m_ptr->energy_need += ENERGY_NEED();
632 process_monster(player_ptr, i);
634 if (player_ptr->no_flowed && one_in_(3)) {
635 m_ptr->mflag2.set(MonsterConstantFlagType::NOFLOW);
638 if (!player_ptr->playing || player_ptr->is_dead || player_ptr->leaving) {
645 * @brief 後続のモンスター処理が必要かどうか判定する (要調査)
646 * @param player_ptr プレイヤーへの参照ポインタ
647 * @param m_ptr モンスターへの参照ポインタ
648 * @return 後続処理が必要ならTRUE
650 bool decide_process_continue(PlayerType *player_ptr, MonsterEntity *m_ptr)
652 const auto &monrace = m_ptr->get_monrace();
653 if (!player_ptr->no_flowed) {
654 m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
657 if (m_ptr->cdis <= (m_ptr->is_pet() ? (monrace.aaf > MAX_PLAYER_SIGHT ? MAX_PLAYER_SIGHT : monrace.aaf) : monrace.aaf)) {
661 auto should_continue = (m_ptr->cdis <= MAX_PLAYER_SIGHT) || AngbandSystem::get_instance().is_phase_out();
662 should_continue &= player_ptr->current_floor_ptr->has_los({ m_ptr->fy, m_ptr->fx }) || has_aggravate(player_ptr);
663 if (should_continue) {
667 if (m_ptr->target_y) {