OSDN Git Service

[Refactor] #40514 has_resist_nexus() を BIT_FLAGS 返り値持ちに仕様変更. / has_resist_nexus(...
authordeskull <deskull@users.sourceforge.jp>
Sun, 30 Aug 2020 07:09:23 +0000 (16:09 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 30 Aug 2020 07:09:23 +0000 (16:09 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index 6e036aa..e7469ac 100644 (file)
@@ -1235,30 +1235,24 @@ BIT_FLAGS has_resist_shard(player_type *creature_ptr)
     return result;
 }
 
-void has_resist_nexus(player_type *creature_ptr)
+BIT_FLAGS has_resist_nexus(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-    creature_ptr->resist_nexus = FALSE;
+    BIT_FLAGS result = 0L;
 
     if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
-        creature_ptr->resist_nexus = TRUE;
+        result |= FLAG_CAUSE_RACE;
     }
 
-    if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
-        creature_ptr->resist_nexus = TRUE;
+    if (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_RES_NEXUS))
-            creature_ptr->resist_nexus = TRUE;
+    if (creature_ptr->ult_res) {
+        result |= FLAG_CAUSE_MAGIC_TIME_EFFECT;
     }
+
+    result |= check_equipment_flags(creature_ptr, TR_RES_NEXUS);
+    return result;
 }
 
 void has_resist_blind(player_type *creature_ptr)
index b059d2f..437db15 100644 (file)
@@ -82,7 +82,7 @@ BIT_FLAGS has_resist_dark(player_type *creature_ptr);
 BIT_FLAGS has_resist_chaos(player_type *creature_ptr);
 BIT_FLAGS has_resist_disen(player_type *creature_ptr);
 BIT_FLAGS has_resist_shard(player_type *creature_ptr);
-void has_resist_nexus(player_type *creature_ptr);
+BIT_FLAGS has_resist_nexus(player_type *creature_ptr);
 void has_resist_blind(player_type *creature_ptr);
 void has_resist_neth(player_type *creature_ptr);
 void has_resist_time(player_type *creature_ptr);
index d453c10..1ca30f8 100644 (file)
@@ -383,7 +383,7 @@ void calc_bonuses(player_type *creature_ptr)
     creature_ptr->resist_chaos = has_resist_chaos(creature_ptr);
     creature_ptr->resist_disen = has_resist_disen(creature_ptr);
     creature_ptr->resist_shard = has_resist_shard(creature_ptr);
-    has_resist_nexus(creature_ptr);
+    creature_ptr->resist_nexus = has_resist_nexus(creature_ptr);
     has_resist_blind(creature_ptr);
     has_resist_neth(creature_ptr);
     has_resist_time(creature_ptr);
index 0d43e6e..1b2c0cf 100644 (file)
@@ -384,7 +384,7 @@ typedef struct player_type {
     BIT_FLAGS resist_chaos; /* Resist chaos */
     BIT_FLAGS resist_disen; /* Resist disenchant */
     BIT_FLAGS resist_shard; /* Resist shards */
-    bool resist_nexus; /* Resist nexus */
+    BIT_FLAGS resist_nexus; /* Resist nexus */
     bool resist_blind; /* Resist blindness */
     bool resist_neth; /* Resist nether */
     bool resist_fear; /* Resist fear */