OSDN Git Service

[Refactor] #2647 is_hostile() をmonster_type のオブジェクトメソッドとして再定義した
[hengbandforosx/hengbandosx.git] / src / monster-attack / monster-attack-player.cpp
index f094e09..671f13a 100644 (file)
@@ -54,7 +54,9 @@
 #include "system/object-type-definition.h"
 #include "system/player-type-definition.h"
 #include "timed-effect/player-cut.h"
+#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
+#include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
 
@@ -68,7 +70,7 @@ MonsterAttackPlayer::MonsterAttackPlayer(PlayerType *player_ptr, short m_idx)
     , m_ptr(&player_ptr->current_floor_ptr->m_list[m_idx])
     , method(RaceBlowMethodType::NONE)
     , effect(RaceBlowEffectType::NONE)
-    , do_silly_attack(one_in_(2) && player_ptr->hallucinated)
+    , do_silly_attack(one_in_(2) && player_ptr->effects()->hallucination()->is_hallucinated())
     , player_ptr(player_ptr)
 {
 }
@@ -132,7 +134,7 @@ bool MonsterAttackPlayer::check_no_blow()
         return false;
     }
 
-    return is_hostile(this->m_ptr);
+    return this->m_ptr->is_hostile();
 }
 
 /*!
@@ -217,7 +219,7 @@ bool MonsterAttackPlayer::check_monster_continuous_attack()
     }
 
     auto *r_ptr = &r_info[this->m_ptr->r_idx];
-    if (is_pet(this->m_ptr) && r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (this->method == RaceBlowMethodType::EXPLODE)) {
+    if (this->m_ptr->is_pet() && r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (this->method == RaceBlowMethodType::EXPLODE)) {
         this->method = RaceBlowMethodType::HIT;
         this->d_dice /= 10;
     }