OSDN Git Service

[Refactor] #40514 has_sh_fire() を BIT_FLAGS 返り値持ちに仕様変更. / has_sh_fire() was changed...
authordeskull <deskull@users.sourceforge.jp>
Wed, 26 Aug 2020 15:48:32 +0000 (00:48 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 26 Aug 2020 15:48:32 +0000 (00:48 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index 479cbcc..930c875 100644 (file)
@@ -356,47 +356,28 @@ BIT_FLAGS has_anti_tele(player_type *creature_ptr)
     return result;
 }
 
-void has_sh_fire(player_type *creature_ptr)
+BIT_FLAGS has_sh_fire(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-    creature_ptr->sh_fire = FALSE;
+    BIT_FLAGS result = 0L;
 
     if (creature_ptr->muta3 & MUT3_FIRE_BODY) {
-        creature_ptr->sh_fire = TRUE;
+        result |= FLAG_CAUSE_MUTATION;
     }
 
     if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
-        creature_ptr->sh_fire = TRUE;
-    }
-
-    if (creature_ptr->realm1 == REALM_HEX) {
-        if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
-            creature_ptr->sh_fire = TRUE;
-        }
-    }
-
-    if (creature_ptr->special_defense & KAMAE_SEIRYU) {
-        creature_ptr->sh_fire = TRUE;
+        result |= FLAG_CAUSE_RACE;
     }
 
-    if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
-        creature_ptr->sh_fire = TRUE;
+    if (creature_ptr->special_defense & KAMAE_SEIRYU || creature_ptr->special_defense & KATA_MUSOU) {
+        result |= FLAG_CAUSE_BATTLE_FORM;
     }
 
-    if (creature_ptr->tim_sh_fire) {
-        creature_ptr->sh_fire = TRUE;
+    if (hex_spelling(creature_ptr, HEX_DEMON_AURA) || creature_ptr->ult_res || creature_ptr->tim_sh_fire) {
+        result |= FLAG_CAUSE_MAGIC_TIME_EFFECT;
     }
 
-    for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
-        o_ptr = &creature_ptr->inventory_list[i];
-        if (!o_ptr->k_idx)
-            continue;
-
-        object_flags(creature_ptr, o_ptr, flgs);
-        if (has_flag(flgs, TR_SH_FIRE))
-            creature_ptr->sh_fire = TRUE;
-    }
+    result |= check_equipment_flags(creature_ptr, TR_SH_FIRE);
+    return result;
 }
 
 BIT_FLAGS has_sh_elec(player_type *creature_ptr)
index 0a1a948..89b524b 100644 (file)
@@ -49,7 +49,7 @@ void has_see_nocto(player_type *creature_ptr);
 void has_warning(player_type *creature_ptr);
 BIT_FLAGS has_anti_magic(player_type *creature_ptr);
 BIT_FLAGS has_anti_tele(player_type *creature_ptr);
-void has_sh_fire(player_type *creature_ptr);
+BIT_FLAGS has_sh_fire(player_type *creature_ptr);
 BIT_FLAGS has_sh_elec(player_type *creature_ptr);
 void has_sh_cold(player_type *creature_ptr);
 BIT_FLAGS has_easy_spell(player_type *creature_ptr);
index 2dc35aa..ed32640 100644 (file)
@@ -346,7 +346,7 @@ void calc_bonuses(player_type *creature_ptr)
     has_warning(creature_ptr);
     creature_ptr->anti_magic = has_anti_magic(creature_ptr);
     creature_ptr->anti_tele = has_anti_tele(creature_ptr);
-    has_sh_fire(creature_ptr);
+    creature_ptr->sh_fire = has_sh_fire(creature_ptr);
     creature_ptr->sh_elec = has_sh_elec(creature_ptr);
     has_sh_cold(creature_ptr);
     creature_ptr->easy_spell = has_easy_spell(creature_ptr);
index 92d3d22..802807e 100644 (file)
@@ -392,7 +392,7 @@ typedef struct player_type {
     bool resist_water; /* Resist water */
 
     BIT_FLAGS reflect; /* Reflect 'bolt' attacks */
-    bool sh_fire; /* Fiery 'immolation' effect */
+    BIT_FLAGS sh_fire; /* Fiery 'immolation' effect */
     BIT_FLAGS sh_elec; /* Electric 'immolation' effect */
     bool sh_cold; /* Cold 'immolation' effect */