OSDN Git Service

[Refactor] #40514 has_sh_elec() を BIT_FLAGS 返り値持ちに仕様変更. / has_sh_elec() was changed...
authordeskull <deskull@users.sourceforge.jp>
Tue, 25 Aug 2020 16:25:37 +0000 (01:25 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 25 Aug 2020 16:26:23 +0000 (01:26 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index febcb2a..479cbcc 100644 (file)
@@ -399,38 +399,23 @@ void has_sh_fire(player_type *creature_ptr)
     }
 }
 
-void has_sh_elec(player_type *creature_ptr)
+BIT_FLAGS has_sh_elec(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-    creature_ptr->sh_elec = FALSE;
+    BIT_FLAGS result = 0L;
 
     if (creature_ptr->muta3 & MUT3_ELEC_TOUC)
-        creature_ptr->sh_elec = TRUE;
-
-    if (creature_ptr->realm1 == REALM_HEX) {
-        if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK)) {
-            creature_ptr->sh_elec = TRUE;
-        }
-    }
+        result |= FLAG_CAUSE_MUTATION;
 
-    if (creature_ptr->special_defense & KAMAE_SEIRYU) {
-        creature_ptr->sh_elec = TRUE;
+    if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK) || creature_ptr->ult_res) {
+        result |= FLAG_CAUSE_MAGIC_TIME_EFFECT;
     }
 
-    if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
-        creature_ptr->sh_elec = TRUE;
+    if (creature_ptr->special_defense & KAMAE_SEIRYU || (creature_ptr->special_defense & KATA_MUSOU)) {
+        result |= FLAG_CAUSE_BATTLE_FORM;
     }
 
-    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_ELEC))
-            creature_ptr->sh_elec = TRUE;
-    }
+    result |= check_equipment_flags(creature_ptr, TR_SH_ELEC);
+    return result;
 }
 
 void has_sh_cold(player_type *creature_ptr)
index 2f8f366..0a1a948 100644 (file)
@@ -50,7 +50,7 @@ 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);
-void has_sh_elec(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);
 BIT_FLAGS has_heavy_spell(player_type *creature_ptr);
index 641a9b8..2dc35aa 100644 (file)
@@ -347,7 +347,7 @@ void calc_bonuses(player_type *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);
-    has_sh_elec(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);
     creature_ptr->heavy_spell = has_heavy_spell(creature_ptr);
index 14fde8d..92d3d22 100644 (file)
@@ -393,7 +393,7 @@ typedef struct player_type {
 
     BIT_FLAGS reflect; /* Reflect 'bolt' attacks */
     bool sh_fire; /* Fiery 'immolation' effect */
-    bool sh_elec; /* Electric 'immolation' effect */
+    BIT_FLAGS sh_elec; /* Electric 'immolation' effect */
     bool sh_cold; /* Cold 'immolation' effect */
 
     BIT_FLAGS anti_magic; /* Anti-magic */