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/player-update-types.h"
19 #include "core/speed-table.h"
20 #include "floor/cave.h"
21 #include "floor/geometry.h"
22 #include "game-option/play-record-options.h"
23 #include "grid/feature.h"
24 #include "io/write-diary.h"
25 #include "melee/melee-postprocess.h"
26 #include "melee/melee-spell.h"
27 #include "monster-floor/monster-direction.h"
28 #include "monster-floor/monster-generator.h"
29 #include "monster-floor/monster-move.h"
30 #include "monster-floor/monster-remover.h"
31 #include "monster-floor/monster-runaway.h"
32 #include "monster-floor/monster-summon.h"
33 #include "monster-floor/place-monster-types.h"
34 #include "monster-floor/quantum-effect.h"
35 #include "monster-race/monster-race.h"
36 #include "monster-race/race-flags-resistance.h"
37 #include "monster-race/race-flags1.h"
38 #include "monster-race/race-flags2.h"
39 #include "monster-race/race-flags7.h"
40 #include "monster-race/race-indice-types.h"
41 #include "monster/monster-describer.h"
42 #include "monster/monster-description-types.h"
43 #include "monster/monster-flag-types.h"
44 #include "monster/monster-info.h"
45 #include "monster/monster-list.h"
46 #include "monster/monster-processor-util.h"
47 #include "monster/monster-status-setter.h"
48 #include "monster/monster-status.h"
49 #include "monster/monster-update.h"
50 #include "monster/monster-util.h"
51 #include "mspell/mspell-attack.h"
52 #include "mspell/mspell-judgement.h"
53 #include "object-enchant/trc-types.h"
54 #include "pet/pet-fall-off.h"
55 #include "player-base/player-class.h"
56 #include "player-info/ninja-data-type.h"
57 #include "player/player-move.h"
58 #include "player/player-skill.h"
59 #include "player/player-status-flags.h"
60 #include "player/special-defense-types.h"
61 #include "spell-realm/spells-hex.h"
62 #include "spell/summon-types.h"
63 #include "system/floor-type-definition.h"
64 #include "system/grid-type-definition.h"
65 #include "system/monster-race-definition.h"
66 #include "system/monster-type-definition.h"
67 #include "system/player-type-definition.h"
68 #include "target/projection-path-calculator.h"
69 #include "view/display-messages.h"
71 void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon);
72 bool process_stealth(PlayerType *player_ptr, MONSTER_IDX m_idx);
73 bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m);
74 bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx);
75 void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m);
76 bool explode_grenade(PlayerType *player_ptr, MONSTER_IDX m_idx);
77 bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox);
78 void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx);
79 bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware);
81 bool process_monster_fear(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx);
83 void sweep_monster_process(PlayerType *player_ptr);
84 bool decide_process_continue(PlayerType *player_ptr, monster_type *m_ptr);
87 * @brief モンスター単体の1ターン行動処理メインルーチン /
89 * @param player_ptr プレイヤーへの参照ポインタ
90 * @param m_idx 行動モンスターの参照ID
92 * The monster is known to be within 100 grids of the player\n
94 * In several cases, we directly update the monster lore\n
96 * Note that a monster is only allowed to "reproduce" if there\n
97 * are a limited number of "reproducing" monsters on the current\n
98 * level. This should prevent the level from being "swamped" by\n
99 * reproducing monsters. It also allows a large mass of mice to\n
100 * prevent a louse from multiplying, but this is a small price to\n
101 * pay for a simple ENERGY_MULTIPLICATION method.\n
103 * XXX Monster fear is slightly odd, in particular, monsters will\n
104 * fixate on opening a door even if they cannot open it. Actually,\n
105 * the same thing happens to normal monsters when they hit a door\n
107 * In addition, monsters which *cannot* open or bash\n
108 * down a door will still stand there trying to open it...\n
110 * XXX Technically, need to check for monster in the way\n
111 * combined with that monster being in a wall (or door?)\n
113 * A "direction" of "5" means "pick a random direction".\n
115 void process_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
117 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
118 auto *r_ptr = &monraces_info[m_ptr->r_idx];
119 turn_flags tmp_flags;
120 turn_flags *turn_flags_ptr = init_turn_flags(player_ptr->riding, m_idx, &tmp_flags);
121 turn_flags_ptr->see_m = is_seen(player_ptr, m_ptr);
123 decide_drop_from_monster(player_ptr, m_idx, turn_flags_ptr->is_riding_mon);
124 if (m_ptr->mflag2.has(MonsterConstantFlagType::CHAMELEON) && one_in_(13) && !m_ptr->is_asleep()) {
125 choose_new_monster(player_ptr, m_idx, false, MonsterRace::empty_id());
126 r_ptr = &monraces_info[m_ptr->r_idx];
129 turn_flags_ptr->aware = process_stealth(player_ptr, m_idx);
130 if (vanish_summoned_children(player_ptr, m_idx, turn_flags_ptr->see_m) || process_quantum_effect(player_ptr, m_idx, turn_flags_ptr->see_m) || explode_grenade(player_ptr, m_idx) || runaway_monster(player_ptr, turn_flags_ptr, m_idx) || !awake_monster(player_ptr, m_idx)) {
134 if (m_ptr->is_stunned() && one_in_(2)) {
138 if (turn_flags_ptr->is_riding_mon) {
139 player_ptr->update |= PU_BONUS;
142 process_angar(player_ptr, m_idx, turn_flags_ptr->see_m);
144 POSITION oy = m_ptr->fy;
145 POSITION ox = m_ptr->fx;
146 if (decide_monster_multiplication(player_ptr, m_idx, oy, ox)) {
150 process_special(player_ptr, m_idx);
151 process_speak_sound(player_ptr, m_idx, oy, ox, turn_flags_ptr->aware);
152 if (cast_spell(player_ptr, m_idx, turn_flags_ptr->aware)) {
157 mm[0] = mm[1] = mm[2] = mm[3] = 0;
158 mm[4] = mm[5] = mm[6] = mm[7] = 0;
160 if (!decide_monster_movement_direction(player_ptr, mm, m_idx, turn_flags_ptr->aware)) {
165 if (!process_monster_movement(player_ptr, turn_flags_ptr, m_idx, mm, oy, ox, &count)) {
170 * Forward movements failed, but now received LOS attack!
171 * Try to flow by smell.
173 if (player_ptr->no_flowed && count > 2 && m_ptr->target_y) {
174 m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
177 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) {
178 if (r_ptr->freq_spell && randint1(100) <= r_ptr->freq_spell) {
179 if (make_attack_spell(player_ptr, m_idx)) {
185 update_player_type(player_ptr, turn_flags_ptr, r_ptr);
186 update_monster_race_flags(player_ptr, turn_flags_ptr, m_ptr);
188 if (!process_monster_fear(player_ptr, turn_flags_ptr, m_idx)) {
193 chg_virtue(player_ptr, V_COMPASSION, -1);
199 * @param player_ptr プレイヤーへの参照ポインタ
200 * @param m_idx モンスターID
201 * @return モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
203 bool process_stealth(PlayerType *player_ptr, MONSTER_IDX m_idx)
205 auto ninja_data = PlayerClass(player_ptr).get_specific_data<ninja_data_type>();
206 if (!ninja_data || !ninja_data->s_stealth) {
210 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
211 auto *r_ptr = &monraces_info[m_ptr->r_idx];
212 int tmp = player_ptr->lev * 6 + (player_ptr->skill_stl + 10) * 4;
213 if (player_ptr->monlite) {
217 if (has_aggravate(player_ptr)) {
221 if (r_ptr->level > (player_ptr->lev * player_ptr->lev / 20 + 10)) {
225 return randint0(tmp) <= (r_ptr->level + 20);
229 * @brief 死亡したモンスターが乗馬中のモンスターだった場合に落馬処理を行う
230 * @param player_ptr プレイヤーへの参照ポインタ
231 * @param m_idx モンスターID
232 * @param is_riding_mon 騎乗中であればTRUE
234 void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon)
236 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
237 auto *r_ptr = &monraces_info[m_ptr->r_idx];
238 if (!is_riding_mon || ((r_ptr->flags7 & RF7_RIDING) != 0)) {
242 if (process_fall_off_horse(player_ptr, 0, true)) {
244 msg_print("地面に落とされた。");
246 GAME_TEXT m_name[MAX_NLEN];
247 monster_desc(player_ptr, m_name, &player_ptr->current_floor_ptr->m_list[player_ptr->riding], 0);
248 msg_format("You have fallen from %s.", m_name);
254 * @brief 召喚の親元が消滅した時、子供も消滅させる
255 * @param player_ptr プレイヤーへの参照ポインタ
256 * @param m_idx モンスターID
257 * @param see_m モンスターが視界内にいたらTRUE
258 * @return 召喚モンスターが消滅したらTRUE
260 bool vanish_summoned_children(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
262 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
264 if (m_ptr->parent_m_idx == 0) {
268 // parent_m_idxが自分自身を指している場合は召喚主は消滅している
269 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()) {
274 GAME_TEXT m_name[MAX_NLEN];
275 monster_desc(player_ptr, m_name, m_ptr, 0);
276 msg_format(_("%sは消え去った!", "%^s disappears!"), m_name);
279 if (record_named_pet && m_ptr->is_pet() && m_ptr->nickname) {
280 GAME_TEXT m_name[MAX_NLEN];
281 monster_desc(player_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
282 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_LOSE_PARENT, m_name);
285 delete_monster_idx(player_ptr, m_idx);
290 * @brief 寝ているモンスターの起床を判定する
291 * @param player_ptr プレイヤーへの参照ポインタ
292 * @param m_idx モンスターID
293 * @return 寝たままならFALSE、起きているor起きたらTRUE
295 bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
297 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
298 auto *r_ptr = &monraces_info[m_ptr->r_idx];
299 if (!m_ptr->is_asleep()) {
303 if (!has_aggravate(player_ptr)) {
307 (void)set_monster_csleep(player_ptr, m_idx, 0);
309 GAME_TEXT m_name[MAX_NLEN];
310 monster_desc(player_ptr, m_name, m_ptr, 0);
311 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
314 if (is_original_ap_and_seen(player_ptr, m_ptr) && (r_ptr->r_wake < MAX_UCHAR)) {
322 * @brief モンスターの怒り状態を判定する (怒っていたら敵に回す)
323 * @param player_ptr プレイヤーへの参照ポインタ
324 * @param m_idx モンスターID
325 * @param see_m モンスターが視界内にいたらTRUE
327 void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
329 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
330 auto *r_ptr = &monraces_info[m_ptr->r_idx];
331 bool gets_angry = false;
332 if (m_ptr->is_friendly() && has_aggravate(player_ptr)) {
336 if (m_ptr->is_pet() && (((r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || (r_ptr->population_flags.has(MonsterPopulationType::NAZGUL))) && monster_has_hostile_align(player_ptr, nullptr, 10, -10, r_ptr)) || r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL))) {
340 if (player_ptr->phase_out || !gets_angry) {
344 GAME_TEXT m_name[MAX_NLEN];
345 monster_desc(player_ptr, m_name, m_ptr, m_ptr->is_pet() ? MD_ASSUME_VISIBLE : 0);
347 /* When riding a hostile alignment pet */
348 if (player_ptr->riding == m_idx) {
349 if (abs(player_ptr->alignment / 10) < randint0(player_ptr->skill_exp[PlayerSkillKindType::RIDING])) {
353 msg_format(_("%^sが突然暴れだした!", "%^s suddenly begins unruly!"), m_name);
354 if (!process_fall_off_horse(player_ptr, 1, true)) {
358 msg_format(_("あなたは振り落とされた。", "You have fallen."));
361 if (m_ptr->is_pet() || see_m) {
362 msg_format(_("%^sは突然敵にまわった!", "%^s suddenly becomes hostile!"), m_name);
365 set_hostile(player_ptr, m_ptr);
370 * @param player_ptr プレイヤーへの参照ポインタ
371 * @param m_idx モンスターID
374 bool explode_grenade(PlayerType *player_ptr, MONSTER_IDX m_idx)
376 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
377 if (m_ptr->r_idx != MonsterRaceId::GRENADE) {
382 mon_take_hit_mon(player_ptr, m_idx, 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
387 * @brief モンスター依存の特別な行動を取らせる
388 * @param player_ptr プレイヤーへの参照ポインタ
389 * @param m_idx モンスターID
391 void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx)
393 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
394 auto *r_ptr = &monraces_info[m_ptr->r_idx];
395 if (r_ptr->ability_flags.has_not(MonsterAbilityType::SPECIAL) || (m_ptr->r_idx != MonsterRaceId::OHMU) || player_ptr->current_floor_ptr->inside_arena || player_ptr->phase_out || (r_ptr->freq_spell == 0) || (randint1(100) > r_ptr->freq_spell)) {
400 DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
401 BIT_FLAGS p_mode = m_ptr->is_pet() ? PM_FORCE_PET : PM_NONE;
403 for (int k = 0; k < A_MAX; k++) {
404 if (summon_specific(player_ptr, m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_MOLD, (PM_ALLOW_GROUP | p_mode))) {
405 if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml) {
411 if (count && is_original_ap_and_seen(player_ptr, m_ptr)) {
412 r_ptr->r_ability_flags.set(MonsterAbilityType::SPECIAL);
417 * @brief モンスターを分裂させるかどうかを決定する (分裂もさせる)
418 * @param player_ptr プレイヤーへの参照ポインタ
419 * @param m_idx モンスターID
420 * @param oy 分裂元モンスターのY座標
421 * @param ox 分裂元モンスターのX座標
422 * @return 実際に分裂したらTRUEを返す
424 bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox)
426 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
427 auto *r_ptr = &monraces_info[m_ptr->r_idx];
428 if (((r_ptr->flags2 & RF2_MULTIPLY) == 0) || (player_ptr->current_floor_ptr->num_repro >= MAX_REPRODUCTION)) {
433 for (POSITION y = oy - 1; y <= oy + 1; y++) {
434 for (POSITION x = ox - 1; x <= ox + 1; x++) {
435 if (!in_bounds2(player_ptr->current_floor_ptr, y, x)) {
439 if (player_ptr->current_floor_ptr->grid_array[y][x].m_idx) {
445 if (SpellHex(player_ptr).check_hex_barrier(m_idx, HEX_ANTI_MULTI)) {
449 constexpr auto chance_reproduction = 8;
450 if ((k < 4) && (!k || !randint0(k * chance_reproduction))) {
451 if (multiply_monster(player_ptr, m_idx, false, (m_ptr->is_pet() ? PM_FORCE_PET : 0))) {
452 if (player_ptr->current_floor_ptr->m_list[hack_m_idx_ii].ml && is_original_ap_and_seen(player_ptr, m_ptr)) {
453 r_ptr->r_flags2 |= RF2_MULTIPLY;
464 * @brief モンスターに魔法を試行させる
465 * @param player_ptr プレイヤーへの参照ポインタ
466 * @param m_idx モンスターID
467 * @param aware モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
468 * @return 魔法を唱えられなければ強制的にFALSE、その後モンスターが実際に魔法を唱えればTRUE
470 bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware)
472 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
473 auto *r_ptr = &monraces_info[m_ptr->r_idx];
474 if ((r_ptr->freq_spell == 0) || (randint1(100) > r_ptr->freq_spell)) {
478 bool counterattack = false;
479 if (m_ptr->target_y) {
480 MONSTER_IDX t_m_idx = player_ptr->current_floor_ptr->grid_array[m_ptr->target_y][m_ptr->target_x].m_idx;
481 const auto &target_ref = player_ptr->current_floor_ptr->m_list[t_m_idx];
482 const auto is_projectable = projectable(player_ptr, m_ptr->fy, m_ptr->fx, m_ptr->target_y, m_ptr->target_x);
483 if (t_m_idx && are_enemies(player_ptr, *m_ptr, target_ref) && is_projectable) {
484 counterattack = true;
489 if (monst_spell_monst(player_ptr, m_idx) || (aware && make_attack_spell(player_ptr, m_idx))) {
493 if ((aware && make_attack_spell(player_ptr, m_idx)) || monst_spell_monst(player_ptr, m_idx)) {
502 * @brief モンスターの恐怖状態を処理する
503 * @param player_ptr プレイヤーへの参照ポインタ
504 * @param turn_flags_ptr ターン経過処理フラグへの参照ポインタ
505 * @param m_idx モンスターID
506 * @param aware モンスターがプレイヤーに気付いているならばTRUE、超隠密状態ならばFALSE
507 * @return モンスターが戦いを決意したらTRUE
509 bool process_monster_fear(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx)
511 auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
512 bool is_battle_determined = !turn_flags_ptr->do_turn && !turn_flags_ptr->do_move && m_ptr->is_fearful() && turn_flags_ptr->aware;
513 if (!is_battle_determined) {
517 (void)set_monster_monfear(player_ptr, m_idx, 0);
518 if (!turn_flags_ptr->see_m) {
522 GAME_TEXT m_name[MAX_NLEN];
523 monster_desc(player_ptr, m_name, m_ptr, 0);
524 msg_format(_("%^sは戦いを決意した!", "%^s turns to fight!"), m_name);
529 * @brief 全モンスターのターン管理メインルーチン /
530 * Process all the "live" monsters, once per game turn.
532 * During each game current game turn, we scan through the list of all the "live" monsters,\n
533 * (backwards, so we can excise any "freshly dead" monsters), energizing each\n
534 * monster, and allowing fully energized monsters to move, attack, pass, etc.\n
536 * Note that monsters can never move in the monster array (except when the\n
537 * "compact_monsters()" function is called by "dungeon()" or "save_player()").\n
539 * This function is responsible for at least half of the processor time\n
540 * on a normal system with a "normal" amount of monsters and a player doing\n
543 * When the player is resting, virtually 90% of the processor time is spent\n
544 * in this function, and its children, "process_monster()" and "make_move()".\n
546 * Most of the rest of the time is spent in "update_view()" and "lite_spot()",\n
547 * especially when the player is running.\n
549 * Note the special "MFLAG_BORN" flag, which allows us to ignore "fresh"\n
550 * monsters while they are still being "born". A monster is "fresh" only\n
551 * during the game turn in which it is created, and we use the "hack_m_idx" to\n
552 * determine if the monster is yet to be processed during the game turn.\n
554 * Note the special "MFLAG_PREVENT_MAGIC" flag, which allows the player to get one\n
555 * move before any "nasty" monsters get to use their spell attacks.\n
557 * Note that when the "knowledge" about the currently tracked monster\n
558 * changes (flags, attacks, spells), we induce a redraw of the monster\n
561 void process_monsters(PlayerType *player_ptr)
563 old_race_flags tmp_flags;
564 old_race_flags *old_race_flags_ptr = init_old_race_flags(&tmp_flags);
565 player_ptr->current_floor_ptr->monster_noise = false;
566 MonsterRaceId old_monster_race_idx = player_ptr->monster_race_idx;
567 save_old_race_flags(player_ptr->monster_race_idx, old_race_flags_ptr);
568 sweep_monster_process(player_ptr);
570 if (!MonsterRace(player_ptr->monster_race_idx).is_valid() || (player_ptr->monster_race_idx != old_monster_race_idx)) {
574 update_player_window(player_ptr, old_race_flags_ptr);
578 * @brief フロア内のモンスターについてターン終了時の処理を繰り返す
579 * @param player_ptr プレイヤーへの参照ポインタ
581 void sweep_monster_process(PlayerType *player_ptr)
583 auto *floor_ptr = player_ptr->current_floor_ptr;
584 for (MONSTER_IDX i = floor_ptr->m_max - 1; i >= 1; i--) {
586 m_ptr = &floor_ptr->m_list[i];
588 if (player_ptr->leaving) {
592 if (!m_ptr->is_valid() || player_ptr->wild_mode) {
596 if (m_ptr->mflag.has(MonsterTemporaryFlagType::BORN)) {
597 m_ptr->mflag.reset(MonsterTemporaryFlagType::BORN);
601 if ((m_ptr->cdis >= MAX_MONSTER_SENSING) || !decide_process_continue(player_ptr, m_ptr)) {
605 byte speed = (player_ptr->riding == i) ? player_ptr->pspeed : m_ptr->get_temporary_speed();
606 m_ptr->energy_need -= speed_to_energy(speed);
607 if (m_ptr->energy_need > 0) {
611 m_ptr->energy_need += ENERGY_NEED();
613 process_monster(player_ptr, i);
615 if (player_ptr->no_flowed && one_in_(3)) {
616 m_ptr->mflag2.set(MonsterConstantFlagType::NOFLOW);
619 if (!player_ptr->playing || player_ptr->is_dead || player_ptr->leaving) {
626 * @brief 後続のモンスター処理が必要かどうか判定する (要調査)
627 * @param player_ptr プレイヤーへの参照ポインタ
628 * @param m_ptr モンスターへの参照ポインタ
629 * @return 後続処理が必要ならTRUE
631 bool decide_process_continue(PlayerType *player_ptr, monster_type *m_ptr)
634 r_ptr = &monraces_info[m_ptr->r_idx];
635 if (!player_ptr->no_flowed) {
636 m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
639 if (m_ptr->cdis <= (m_ptr->is_pet() ? (r_ptr->aaf > MAX_PLAYER_SIGHT ? MAX_PLAYER_SIGHT : r_ptr->aaf) : r_ptr->aaf)) {
643 if ((m_ptr->cdis <= MAX_PLAYER_SIGHT || player_ptr->phase_out) && (player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx) || has_aggravate(player_ptr))) {
647 if (m_ptr->target_y) {