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-indice-types.h"
37 #include "monster/monster-describer.h"
38 #include "monster/monster-description-types.h"
39 #include "monster/monster-flag-types.h"
40 #include "monster/monster-info.h"
41 #include "monster/monster-list.h"
42 #include "monster/monster-processor-util.h"
43 #include "monster/monster-status-setter.h"
44 #include "monster/monster-status.h"
45 #include "monster/monster-update.h"
46 #include "monster/monster-util.h"
47 #include "mspell/mspell-attack.h"
48 #include "mspell/mspell-judgement.h"
49 #include "object-enchant/trc-types.h"
50 #include "pet/pet-fall-off.h"
51 #include "player-base/player-class.h"
52 #include "player-info/ninja-data-type.h"
53 #include "player/player-move.h"
54 #include "player/player-skill.h"
55 #include "player/player-status-flags.h"
56 #include "player/special-defense-types.h"
57 #include "spell-realm/spells-hex.h"
58 #include "spell/summon-types.h"
59 #include "system/angband-system.h"
60 #include "system/floor-type-definition.h"
61 #include "system/grid-type-definition.h"
62 #include "system/monster-entity.h"
63 #include "system/monster-race-info.h"
64 #include "system/player-type-definition.h"
65 #include "system/redrawing-flags-updater.h"
66 #include "target/projection-path-calculator.h"
67 #include "view/display-messages.h"
69 void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon);
70 bool process_stealth(PlayerType *player_ptr, MONSTER_IDX m_idx);
71 bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m);
72 bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx);
73 void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m);
74 bool explode_grenade(PlayerType *player_ptr, MONSTER_IDX m_idx);
75 bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox);
76 void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx);
77 bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware);
79 bool process_monster_fear(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx);
81 void sweep_monster_process(PlayerType *player_ptr);
82 bool decide_process_continue(PlayerType *player_ptr, MonsterEntity *m_ptr);
85 * @brief モンスター単体の1ターン行動処理メインルーチン /
87 * @param player_ptr プレイヤーへの参照ポインタ
88 * @param m_idx 行動モンスターの参照ID
90 * The monster is known to be within 100 grids of the player\n
92 * In several cases, we directly update the monster lore\n
94 * Note that a monster is only allowed to "reproduce" if there\n
95 * are a limited number of "reproducing" monsters on the current\n
96 * level. This should prevent the level from being "swamped" by\n
97 * reproducing monsters. It also allows a large mass of mice to\n
98 * prevent a louse from multiplying, but this is a small price to\n
99 * pay for a simple ENERGY_MULTIPLICATION method.\n
101 * XXX Monster fear is slightly odd, in particular, monsters will\n
102 * fixate on opening a door even if they cannot open it. Actually,\n
103 * the same thing happens to normal monsters when they hit a door\n
105 * In addition, monsters which *cannot* open or bash\n
106 * down a door will still stand there trying to open it...\n
108 * XXX Technically, need to check for monster in the way\n
109 * combined with that monster being in a wall (or door?)\n
111 * A "direction" of "5" means "pick a random direction".\n
113 void process_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
115 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
116 auto *r_ptr = &m_ptr->get_monrace();
117 turn_flags tmp_flags;
118 turn_flags *turn_flags_ptr = init_turn_flags(player_ptr->riding, m_idx, &tmp_flags);
119 turn_flags_ptr->see_m = is_seen(player_ptr, m_ptr);
121 decide_drop_from_monster(player_ptr, m_idx, turn_flags_ptr->is_riding_mon);
122 if (m_ptr->mflag2.has(MonsterConstantFlagType::CHAMELEON) && one_in_(13) && !m_ptr->is_asleep()) {
123 choose_new_monster(player_ptr, m_idx, false, MonsterRace::empty_id());
124 r_ptr = &m_ptr->get_monrace();
127 turn_flags_ptr->aware = process_stealth(player_ptr, m_idx);
128 if (vanish_summoned_children(player_ptr, m_idx, turn_flags_ptr->see_m)) {
132 if (process_quantum_effect(player_ptr, m_idx, turn_flags_ptr->see_m)) {
136 if (explode_grenade(player_ptr, m_idx)) {
140 if (runaway_monster(player_ptr, turn_flags_ptr, m_idx)) {
144 if (!awake_monster(player_ptr, m_idx)) {
148 if (m_ptr->is_stunned() && one_in_(2)) {
152 if (turn_flags_ptr->is_riding_mon) {
153 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
156 process_angar(player_ptr, m_idx, turn_flags_ptr->see_m);
158 POSITION oy = m_ptr->fy;
159 POSITION ox = m_ptr->fx;
160 if (decide_monster_multiplication(player_ptr, m_idx, oy, ox)) {
164 process_special(player_ptr, m_idx);
165 process_speak_sound(player_ptr, m_idx, oy, ox, turn_flags_ptr->aware);
166 if (cast_spell(player_ptr, m_idx, turn_flags_ptr->aware)) {
171 mm[0] = mm[1] = mm[2] = mm[3] = 0;
172 mm[4] = mm[5] = mm[6] = mm[7] = 0;
174 if (!decide_monster_movement_direction(player_ptr, mm, m_idx, turn_flags_ptr->aware)) {
179 if (!process_monster_movement(player_ptr, turn_flags_ptr, m_idx, mm, { oy, ox }, &count)) {
184 * Forward movements failed, but now received LOS attack!
185 * Try to flow by smell.
187 if (player_ptr->no_flowed && count > 2 && m_ptr->target_y) {
188 m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
191 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) {
192 if (r_ptr->freq_spell && randint1(100) <= r_ptr->freq_spell) {
193 if (make_attack_spell(player_ptr, m_idx)) {
199 update_map_flags(turn_flags_ptr);
200 update_lite_flags(turn_flags_ptr, r_ptr);
201 update_monster_race_flags(player_ptr, turn_flags_ptr, m_ptr);
203 if (!process_monster_fear(player_ptr, turn_flags_ptr, m_idx)) {
208 chg_virtue(player_ptr, Virtue::COMPASSION, -1);
214 * @param player_ptr プレイヤーへの参照ポインタ
215 * @param m_idx モンスターID
216 * @return モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
218 bool process_stealth(PlayerType *player_ptr, MONSTER_IDX m_idx)
220 auto ninja_data = PlayerClass(player_ptr).get_specific_data<ninja_data_type>();
221 if (!ninja_data || !ninja_data->s_stealth) {
225 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
226 auto *r_ptr = &m_ptr->get_monrace();
227 int tmp = player_ptr->lev * 6 + (player_ptr->skill_stl + 10) * 4;
228 if (player_ptr->monlite) {
232 if (has_aggravate(player_ptr)) {
236 if (r_ptr->level > (player_ptr->lev * player_ptr->lev / 20 + 10)) {
240 return randint0(tmp) <= (r_ptr->level + 20);
244 * @brief 死亡したモンスターが乗馬中のモンスターだった場合に落馬処理を行う
245 * @param player_ptr プレイヤーへの参照ポインタ
246 * @param m_idx モンスターID
247 * @param is_riding_mon 騎乗中であればTRUE
249 void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon)
251 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
252 auto *r_ptr = &m_ptr->get_monrace();
253 if (!is_riding_mon || r_ptr->misc_flags.has(MonsterMiscType::RIDING)) {
257 if (process_fall_off_horse(player_ptr, 0, true)) {
259 msg_print("地面に落とされた。");
261 const auto m_name = monster_desc(player_ptr, &player_ptr->current_floor_ptr->m_list[player_ptr->riding], 0);
262 msg_format("You have fallen from %s.", m_name.data());
268 * @brief 召喚の親元が消滅した時、子供も消滅させる
269 * @param player_ptr プレイヤーへの参照ポインタ
270 * @param m_idx モンスターID
271 * @param see_m モンスターが視界内にいたらTRUE
272 * @return 召喚モンスターが消滅したらTRUE
274 bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
276 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
278 if (m_ptr->parent_m_idx == 0) {
282 // parent_m_idxが自分自身を指している場合は召喚主は消滅している
283 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()) {
288 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
289 msg_format(_("%sは消え去った!", "%s^ disappears!"), m_name.data());
292 if (record_named_pet && m_ptr->is_named_pet()) {
293 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
294 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
297 delete_monster_idx(player_ptr, m_idx);
302 * @brief 寝ているモンスターの起床を判定する
303 * @param player_ptr プレイヤーへの参照ポインタ
304 * @param m_idx モンスターID
305 * @return 寝たままならFALSE、起きているor起きたらTRUE
307 bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
309 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
310 auto *r_ptr = &m_ptr->get_monrace();
311 if (!m_ptr->is_asleep()) {
315 if (!has_aggravate(player_ptr)) {
319 (void)set_monster_csleep(player_ptr, m_idx, 0);
321 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
322 msg_format(_("%s^が目を覚ました。", "%s^ wakes up."), m_name.data());
325 if (is_original_ap_and_seen(player_ptr, m_ptr) && (r_ptr->r_wake < MAX_UCHAR)) {
333 * @brief モンスターの怒り状態を判定する (怒っていたら敵に回す)
334 * @param player_ptr プレイヤーへの参照ポインタ
335 * @param m_idx モンスターID
336 * @param see_m モンスターが視界内にいたらTRUE
338 void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
340 auto &monster = player_ptr->current_floor_ptr->m_list[m_idx];
341 const auto &monrace = monster.get_monrace();
342 auto gets_angry = monster.is_friendly() && has_aggravate(player_ptr);
343 const auto should_aggravate = monster.is_pet();
344 auto has_hostile = monrace.kind_flags.has(MonsterKindType::UNIQUE) || (monrace.population_flags.has(MonsterPopulationType::NAZGUL));
345 has_hostile &= monster_has_hostile_align(player_ptr, nullptr, 10, -10, &monrace);
346 const auto has_resist_all = monrace.resistance_flags.has(MonsterResistanceType::RESIST_ALL);
347 if (should_aggravate && (has_hostile || has_resist_all)) {
351 if (AngbandSystem::get_instance().is_phase_out() || !gets_angry) {
355 const auto m_name = monster_desc(player_ptr, &monster, monster.is_pet() ? MD_ASSUME_VISIBLE : 0);
357 /* When riding a hostile alignment pet */
358 if (player_ptr->riding == m_idx) {
359 if (abs(player_ptr->alignment / 10) < randint0(player_ptr->skill_exp[PlayerSkillKindType::RIDING])) {
363 msg_format(_("%s^が突然暴れだした!", "%s^ suddenly begins unruly!"), m_name.data());
364 if (!process_fall_off_horse(player_ptr, 1, true)) {
368 msg_format(_("あなたは振り落とされた。", "You have fallen."));
371 if (monster.is_pet() || see_m) {
372 msg_format(_("%s^は突然敵にまわった!", "%s^ suddenly becomes hostile!"), m_name.data());
375 monster.set_hostile();
380 * @param player_ptr プレイヤーへの参照ポインタ
381 * @param m_idx モンスターID
384 bool explode_grenade(PlayerType *player_ptr, MONSTER_IDX m_idx)
386 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
387 if (m_ptr->r_idx != MonsterRaceId::GRENADE) {
392 mon_take_hit_mon(player_ptr, m_idx, 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
397 * @brief モンスター依存の特別な行動を取らせる
398 * @param player_ptr プレイヤーへの参照ポインタ
399 * @param m_idx モンスターID
401 void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx)
403 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
404 auto *r_ptr = &m_ptr->get_monrace();
405 auto can_do_special = r_ptr->ability_flags.has(MonsterAbilityType::SPECIAL);
406 can_do_special &= m_ptr->r_idx == MonsterRaceId::OHMU;
407 can_do_special &= !player_ptr->current_floor_ptr->inside_arena;
408 can_do_special &= !AngbandSystem::get_instance().is_phase_out();
409 can_do_special &= r_ptr->freq_spell != 0;
410 can_do_special &= randint1(100) <= r_ptr->freq_spell;
411 if (!can_do_special) {
416 DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
417 BIT_FLAGS p_mode = m_ptr->is_pet() ? PM_FORCE_PET : PM_NONE;
419 for (int k = 0; k < A_MAX; k++) {
420 if (summon_specific(player_ptr, m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode))) {
421 if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml) {
427 if (count && is_original_ap_and_seen(player_ptr, m_ptr)) {
428 r_ptr->r_ability_flags.set(MonsterAbilityType::SPECIAL);
433 * @brief モンスターを分裂させるかどうかを決定する (分裂もさせる)
434 * @param player_ptr プレイヤーへの参照ポインタ
435 * @param m_idx モンスターID
436 * @param oy 分裂元モンスターのY座標
437 * @param ox 分裂元モンスターのX座標
438 * @return 実際に分裂したらTRUEを返す
440 bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox)
442 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
443 auto *r_ptr = &m_ptr->get_monrace();
444 if (r_ptr->misc_flags.has_not(MonsterMiscType::MULTIPLY) || (player_ptr->current_floor_ptr->num_repro >= MAX_REPRODUCTION)) {
449 for (POSITION y = oy - 1; y <= oy + 1; y++) {
450 for (POSITION x = ox - 1; x <= ox + 1; x++) {
451 if (!in_bounds2(player_ptr->current_floor_ptr, y, x)) {
455 if (player_ptr->current_floor_ptr->grid_array[y][x].has_monster()) {
461 if (SpellHex(player_ptr).check_hex_barrier(m_idx, HEX_ANTI_MULTI)) {
465 constexpr auto chance_reproduction = 8;
466 if ((k < 4) && (!k || !randint0(k * chance_reproduction))) {
467 if (multiply_monster(player_ptr, m_idx, false, (m_ptr->is_pet() ? PM_FORCE_PET : 0))) {
468 if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(player_ptr, m_ptr)) {
469 r_ptr->r_misc_flags.set(MonsterMiscType::MULTIPLY);
480 * @brief モンスターに魔法を試行させる
481 * @param player_ptr プレイヤーへの参照ポインタ
482 * @param m_idx モンスターID
483 * @param aware モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
484 * @return 魔法を唱えられなければ強制的にFALSE、その後モンスターが実際に魔法を唱えればTRUE
486 bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware)
488 auto &floor = *player_ptr->current_floor_ptr;
489 const auto &monster_from = floor.m_list[m_idx];
490 const auto &monrace = monster_from.get_monrace();
491 if ((monrace.freq_spell == 0) || (randint1(100) > monrace.freq_spell)) {
495 bool counterattack = false;
496 if (monster_from.target_y) {
497 Pos2D pos(monster_from.target_y, monster_from.target_x);
498 const auto t_m_idx = floor.get_grid(pos).m_idx;
499 const auto &monster_to = floor.m_list[t_m_idx];
500 const auto is_projectable = projectable(player_ptr, monster_from.fy, monster_from.fx, monster_from.target_y, monster_from.target_x);
501 if (t_m_idx && monster_from.is_hostile_to_melee(monster_to) && is_projectable) {
502 counterattack = true;
507 if (monst_spell_monst(player_ptr, m_idx) || (aware && make_attack_spell(player_ptr, m_idx))) {
511 if ((aware && make_attack_spell(player_ptr, m_idx)) || monst_spell_monst(player_ptr, m_idx)) {
520 * @brief モンスターの恐怖状態を処理する
521 * @param player_ptr プレイヤーへの参照ポインタ
522 * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ
523 * @param m_idx モンスターID
524 * @param aware モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
525 * @return モンスターが戦いを決意したらTRUE
527 bool process_monster_fear(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx)
529 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
530 bool is_battle_determined = !turn_flags_ptr->do_turn && !turn_flags_ptr->do_move && m_ptr->is_fearful() && turn_flags_ptr->aware;
531 if (!is_battle_determined) {
535 (void)set_monster_monfear(player_ptr, m_idx, 0);
536 if (!turn_flags_ptr->see_m) {
540 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
541 msg_format(_("%s^は戦いを決意した!", "%s^ turns to fight!"), m_name.data());
546 * @brief 全モンスターのターン管理メインルーチン /
547 * Process all the "live" monsters, once per game turn.
549 * During each game current game turn, we scan through the list of all the "live" monsters,\n
550 * (backwards, so we can excise any "freshly dead" monsters), energizing each\n
551 * monster, and allowing fully energized monsters to move, attack, pass, etc.\n
553 * Note that monsters can never move in the monster array (except when the\n
554 * "compact_monsters()" function is called by "dungeon()" or "save_player()").\n
556 * This function is responsible for at least half of the processor time\n
557 * on a normal system with a "normal" amount of monsters and a player doing\n
560 * When the player is resting, virtually 90% of the processor time is spent\n
561 * in this function, and its children, "process_monster()" and "make_move()".\n
563 * Most of the rest of the time is spent in "update_view()" and "lite_spot()",\n
564 * especially when the player is running.\n
566 * Note the special "MFLAG_BORN" flag, which allows us to ignore "fresh"\n
567 * monsters while they are still being "born". A monster is "fresh" only\n
568 * during the game turn in which it is created, and we use the "hack_m_idx" to\n
569 * determine if the monster is yet to be processed during the game turn.\n
571 * Note the special "MFLAG_PREVENT_MAGIC" flag, which allows the player to get one\n
572 * move before any "nasty" monsters get to use their spell attacks.\n
574 * Note that when the "knowledge" about the currently tracked monster\n
575 * changes (flags, attacks, spells), we induce a redraw of the monster\n
578 void process_monsters(PlayerType *player_ptr)
580 const auto old_monrace_id = player_ptr->monster_race_idx;
581 old_race_flags tmp_flags(old_monrace_id);
582 old_race_flags *old_race_flags_ptr = &tmp_flags;
583 player_ptr->current_floor_ptr->monster_noise = false;
584 sweep_monster_process(player_ptr);
586 if (!MonsterRace(player_ptr->monster_race_idx).is_valid() || (player_ptr->monster_race_idx != old_monrace_id)) {
590 update_player_window(player_ptr, old_race_flags_ptr);
594 * @brief フロア内のモンスターについてターン終了時の処理を繰り返す
595 * @param player_ptr プレイヤーへの参照ポインタ
597 void sweep_monster_process(PlayerType *player_ptr)
599 auto *floor_ptr = player_ptr->current_floor_ptr;
600 for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--) {
601 MonsterEntity *m_ptr;
602 m_ptr = &floor_ptr->m_list[i];
604 if (player_ptr->leaving) {
608 if (!m_ptr->is_valid() || player_ptr->wild_mode) {
612 if (m_ptr->mflag.has(MonsterTemporaryFlagType::BORN)) {
613 m_ptr->mflag.reset(MonsterTemporaryFlagType::BORN);
617 if ((m_ptr->cdis >= MAX_MONSTER_SENSING) || !decide_process_continue(player_ptr, m_ptr)) {
621 byte speed = (player_ptr->riding == i) ? player_ptr->pspeed : m_ptr->get_temporary_speed();
622 m_ptr->energy_need -= speed_to_energy(speed);
623 if (m_ptr->energy_need > 0) {
627 m_ptr->energy_need += ENERGY_NEED();
629 process_monster(player_ptr, i);
631 if (player_ptr->no_flowed && one_in_(3)) {
632 m_ptr->mflag2.set(MonsterConstantFlagType::NOFLOW);
635 if (!player_ptr->playing || player_ptr->is_dead || player_ptr->leaving) {
642 * @brief 後続のモンスター処理が必要かどうか判定する (要調査)
643 * @param player_ptr プレイヤーへの参照ポインタ
644 * @param m_ptr モンスターへの参照ポインタ
645 * @return 後続処理が必要ならTRUE
647 bool decide_process_continue(PlayerType *player_ptr, MonsterEntity *m_ptr)
649 const auto &monrace = m_ptr->get_monrace();
650 if (!player_ptr->no_flowed) {
651 m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
654 if (m_ptr->cdis <= (m_ptr->is_pet() ? (monrace.aaf > MAX_PLAYER_SIGHT ? MAX_PLAYER_SIGHT : monrace.aaf) : monrace.aaf)) {
658 auto should_continue = (m_ptr->cdis <= MAX_PLAYER_SIGHT) || AngbandSystem::get_instance().is_phase_out();
659 should_continue &= player_ptr->current_floor_ptr->has_los({ m_ptr->fy, m_ptr->fx }) || has_aggravate(player_ptr);
660 if (should_continue) {
664 if (m_ptr->target_y) {