OSDN Git Service

[Refactor] #40514 player_type の resist_water 変数を廃止. / Abolished resist_water variable...
[hengband/hengband.git] / src / player / race-resistances.c
index b543ca1..5053a73 100644 (file)
@@ -1,7 +1,12 @@
 #include "race-resistances.h"
-#include "player/player-races-table.h"
-#include "object/object1.h"
+#include "inventory/inventory-slot-types.h"
+#include "mutation/mutation-flag-types.h"
+#include "player/player-race-types.h"
+#include "object/object-flags.h"
 #include "object-enchant/tr-types.h"
+#include "player/player-race.h"
+#include "player/special-defense-types.h"
+#include "util/bit-flags-calculator.h"
 
 /*!
  * @brief プレイヤーの種族による免疫フラグを返す
@@ -16,13 +21,13 @@ void player_immunity(player_type *creature_ptr, BIT_FLAGS *flags)
        for (int i = 0; i < TR_FLAG_SIZE; i++)
                flags[i] = 0L;
 
-       if (PRACE_IS_(creature_ptr, RACE_SPECTRE))
+       if (is_specific_player_race(creature_ptr, RACE_SPECTRE))
                add_flag(flags, TR_RES_NETHER);
-       if (creature_ptr->mimic_form == MIMIC_VAMPIRE || PRACE_IS_(creature_ptr, RACE_VAMPIRE))
+       if (creature_ptr->mimic_form == MIMIC_VAMPIRE || is_specific_player_race(creature_ptr, RACE_VAMPIRE))
                add_flag(flags, TR_RES_DARK);
        if (creature_ptr->mimic_form == MIMIC_DEMON_LORD)
                add_flag(flags, TR_RES_FIRE);
-       else if (PRACE_IS_(creature_ptr, RACE_YEEK) && creature_ptr->lev > 19)
+       else if (is_specific_player_race(creature_ptr, RACE_YEEK) && creature_ptr->lev > 19)
                add_flag(flags, TR_RES_ACID);
 }
 
@@ -66,18 +71,18 @@ void known_obj_immunity(player_type *creature_ptr, BIT_FLAGS *flags)
        for (int i = 0; i < TR_FLAG_SIZE; i++)
                flags[i] = 0L;
 
-       for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
+       for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
                u32b o_flags[TR_FLAG_SIZE];
                object_type *o_ptr;
                o_ptr = &creature_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
-               object_flags_known(o_ptr, o_flags);
-               if (have_flag(o_flags, TR_IM_ACID)) add_flag(flags, TR_RES_ACID);
-               if (have_flag(o_flags, TR_IM_ELEC)) add_flag(flags, TR_RES_ELEC);
-               if (have_flag(o_flags, TR_IM_FIRE)) add_flag(flags, TR_RES_FIRE);
-               if (have_flag(o_flags, TR_IM_COLD)) add_flag(flags, TR_RES_COLD);
+               object_flags_known(creature_ptr, o_ptr, o_flags);
+               if (has_flag(o_flags, TR_IM_ACID)) add_flag(flags, TR_RES_ACID);
+               if (has_flag(o_flags, TR_IM_ELEC)) add_flag(flags, TR_RES_ELEC);
+               if (has_flag(o_flags, TR_IM_FIRE)) add_flag(flags, TR_RES_FIRE);
+               if (has_flag(o_flags, TR_IM_COLD)) add_flag(flags, TR_RES_COLD);
        }
 }
 
@@ -103,11 +108,11 @@ void player_vulnerability_flags(player_type *creature_ptr, BIT_FLAGS *flags)
                add_flag(flags, TR_RES_COLD);
        }
 
-       if (PRACE_IS_(creature_ptr, RACE_ANDROID))
+       if (is_specific_player_race(creature_ptr, RACE_ANDROID))
                add_flag(flags, TR_RES_ELEC);
-       if (PRACE_IS_(creature_ptr, RACE_ENT))
+       if (is_specific_player_race(creature_ptr, RACE_ENT))
                add_flag(flags, TR_RES_FIRE);
-       if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || PRACE_IS_(creature_ptr, RACE_S_FAIRY) ||
+       if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || is_specific_player_race(creature_ptr, RACE_S_FAIRY) ||
                (creature_ptr->mimic_form == MIMIC_VAMPIRE))
                add_flag(flags, TR_RES_LITE);
 }