OSDN Git Service

[Refactor] #40514 have_resist_neth() を calc_bonuses() から分離. / Separated have_resist_n...
authordeskull <deskull@users.sourceforge.jp>
Sun, 9 Aug 2020 17:05:36 +0000 (02:05 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 9 Aug 2020 17:05:36 +0000 (02:05 +0900)
src/player/player-race.c
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c

index e1d0885..7aa6ac1 100644 (file)
@@ -131,16 +131,13 @@ void calc_race_status(player_type *creature_ptr)
     if (creature_ptr->mimic_form) {
         switch (creature_ptr->mimic_form) {
         case MIMIC_DEMON:
-            creature_ptr->resist_neth = TRUE;
             creature_ptr->oppose_fire = 1;
             creature_ptr->redraw |= PR_STATUS;
             break;
         case MIMIC_DEMON_LORD:
-            creature_ptr->resist_neth = TRUE;
             creature_ptr->resist_fear = TRUE;
             break;
         case MIMIC_VAMPIRE:
-            creature_ptr->resist_neth = TRUE;
             if (creature_ptr->pclass != CLASS_NINJA)
                 creature_ptr->lite = TRUE;
             break;
@@ -155,21 +152,17 @@ void calc_race_status(player_type *creature_ptr)
                 creature_ptr->immune_acid = TRUE;
             break;
         case RACE_ZOMBIE:
-            creature_ptr->resist_neth = TRUE;
             creature_ptr->slow_digest = TRUE;
             break;
         case RACE_VAMPIRE:
-            creature_ptr->resist_neth = TRUE;
             if (creature_ptr->pclass != CLASS_NINJA)
                 creature_ptr->lite = TRUE;
             break;
         case RACE_SPECTRE:
-            creature_ptr->resist_neth = TRUE;
             creature_ptr->pass_wall = TRUE;
             break;
 
         case RACE_BALROG:
-            creature_ptr->resist_neth = TRUE;
             if (creature_ptr->lev > 44) {
                 creature_ptr->oppose_fire = 1;
                 creature_ptr->redraw |= PR_STATUS;
index 1068364..fd24b98 100644 (file)
@@ -1841,3 +1841,36 @@ void have_resist_blind(player_type *creature_ptr)
     }
 }
 
+void have_resist_neth(player_type *creature_ptr)
+{
+    object_type *o_ptr;
+    BIT_FLAGS flgs[TR_FLAG_SIZE];
+
+    if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || creature_ptr->mimic_form == MIMIC_DEMON || creature_ptr->mimic_form == MIMIC_VAMPIRE) {
+        creature_ptr->resist_neth = TRUE;
+    }
+
+    if (!creature_ptr->mimic_form
+        && (creature_ptr->prace == RACE_ZOMBIE || creature_ptr->prace == RACE_VAMPIRE || creature_ptr->prace == RACE_SPECTRE
+            || creature_ptr->prace == RACE_BALROG))
+        creature_ptr->resist_neth = TRUE;
+
+    if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
+        creature_ptr->resist_neth = TRUE;
+    }
+
+    if (creature_ptr->tim_res_nether) {
+        creature_ptr->resist_neth = TRUE;
+    }
+
+    for (int 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 (have_flag(flgs, TR_RES_NETHER))
+            creature_ptr->resist_neth = TRUE;
+    }
+}
index 75b28dc..f73d172 100644 (file)
@@ -63,5 +63,6 @@ void have_resist_disen(player_type *creature_ptr);
 void have_resist_shard(player_type *creature_ptr);
 void have_resist_nexus(player_type *creature_ptr);
 void have_resist_blind(player_type *creature_ptr);
+void have_resist_neth(player_type *creature_ptr);
 
 
index 9d9d1fd..f372a9b 100644 (file)
@@ -731,6 +731,7 @@ void calc_bonuses(player_type *creature_ptr)
     have_resist_shard(creature_ptr);
     have_resist_nexus(creature_ptr);
     have_resist_blind(creature_ptr);
+    have_resist_neth(creature_ptr);
 
     calc_race_status(creature_ptr);
 
@@ -4438,14 +4439,9 @@ void calc_timelimit_status(player_type *creature_ptr)
 {
     if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
         creature_ptr->lite = TRUE;
-        creature_ptr->resist_neth = TRUE;
         creature_ptr->resist_fear = TRUE;
     }
 
-    if (creature_ptr->tim_res_nether) {
-        creature_ptr->resist_neth = TRUE;
-    }
-
     if (creature_ptr->tim_res_time) {
         creature_ptr->resist_time = TRUE;
     }
@@ -4499,8 +4495,6 @@ void calc_equipment_status(player_type *creature_ptr)
 
         if (have_flag(flgs, TR_RES_FEAR))
             creature_ptr->resist_fear = TRUE;
-        if (have_flag(flgs, TR_RES_NETHER))
-            creature_ptr->resist_neth = TRUE;
 
         if (o_ptr->name2 == EGO_RING_RES_TIME)
             creature_ptr->resist_time = TRUE;