OSDN Git Service

[Refactor] #40514 player_type の resist_lite 変数を廃止. / Abolished the resist_lite variab...
[hengband/hengband.git] / src / monster / monster-update.c
index b31386b..fb31030 100644 (file)
@@ -327,14 +327,14 @@ static void update_specific_race_telepathy(player_type *subject_ptr, um_type *um
     }
 }
 
-static bool check_cold_blood(player_type *subject_ptr, um_type *um_ptr)
+static bool check_cold_blood(player_type *subject_ptr, um_type *um_ptr, const POSITION distance)
 {
     if (distance > subject_ptr->see_infra)
         return FALSE;
 
     monster_race *r_ptr = &r_info[um_ptr->m_ptr->r_idx];
-    if ((r_ptr->flags2 & (RF2_COLD_BLOOD | RF2_AURA_FIRE)) != RF2_COLD_BLOOD)
-        return TRUE;
+    if ((r_ptr->flags2 & (RF2_COLD_BLOOD | RF2_AURA_FIRE)) == RF2_COLD_BLOOD)
+        return FALSE;
 
     um_ptr->easy = TRUE;
     um_ptr->flag = TRUE;
@@ -386,7 +386,7 @@ static void decide_sight_invisible_monster(player_type *subject_ptr, um_type *um
         um_ptr->flag = TRUE;
     }
 
-    bool do_cold_blood = check_cold_blood(subject_ptr, um_ptr);
+    bool do_cold_blood = check_cold_blood(subject_ptr, um_ptr, distance);
     bool do_invisible = check_invisible(subject_ptr, um_ptr);
     if (!um_ptr->flag || !is_original_ap(um_ptr->m_ptr) || subject_ptr->image)
         return;
@@ -539,7 +539,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
     switch (what) {
     case DRS_ACID:
-        if (player_ptr->resist_acid)
+        if (has_resist_acid(player_ptr))
             m_ptr->smart |= SM_RES_ACID;
 
         if (is_oppose_acid(player_ptr))
@@ -550,7 +550,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_ELEC:
-        if (player_ptr->resist_elec)
+        if (has_resist_elec(player_ptr))
             m_ptr->smart |= SM_RES_ELEC;
 
         if (is_oppose_elec(player_ptr))
@@ -561,7 +561,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_FIRE:
-        if (player_ptr->resist_fire)
+        if (has_resist_fire(player_ptr))
             m_ptr->smart |= SM_RES_FIRE;
 
         if (is_oppose_fire(player_ptr))
@@ -572,7 +572,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_COLD:
-        if (player_ptr->resist_cold)
+        if (has_resist_cold(player_ptr))
             m_ptr->smart |= SM_RES_COLD;
 
         if (is_oppose_cold(player_ptr))
@@ -583,7 +583,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_POIS:
-        if (player_ptr->resist_pois)
+        if (has_resist_pois(player_ptr))
             m_ptr->smart |= SM_RES_POIS;
 
         if (is_oppose_pois(player_ptr))
@@ -596,7 +596,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_LITE:
-        if (player_ptr->resist_lite)
+        if (has_resist_lite(player_ptr))
             m_ptr->smart |= SM_RES_LITE;
 
         break;
@@ -611,7 +611,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_CONF:
-        if (player_ptr->resist_conf)
+        if (has_resist_conf(player_ptr))
             m_ptr->smart |= SM_RES_CONF;
 
         break;
@@ -636,7 +636,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_SOUND:
-        if (player_ptr->resist_sound)
+        if (has_resist_sound(player_ptr))
             m_ptr->smart |= SM_RES_SOUND;
 
         break;