OSDN Git Service

[Refactor] #40514 have_resist_acid() を calc_bonuses() から分離. / Separated have_resist_a...
authordeskull <deskull@users.sourceforge.jp>
Sun, 9 Aug 2020 12:11:12 +0000 (21:11 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 9 Aug 2020 12:11:12 +0000 (21:11 +0900)
src/player/player-race.c
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c

index 2583b6e..39f2586 100644 (file)
@@ -141,7 +141,6 @@ void calc_race_status(player_type *creature_ptr)
             creature_ptr->resist_chaos = TRUE;
             creature_ptr->resist_neth = TRUE;
             creature_ptr->immune_fire = TRUE;
-            creature_ptr->resist_acid = TRUE;
             creature_ptr->resist_fire = TRUE;
             creature_ptr->resist_cold = TRUE;
             creature_ptr->resist_elec = TRUE;
@@ -190,13 +189,11 @@ void calc_race_status(player_type *creature_ptr)
             creature_ptr->resist_sound = TRUE;
             break;
         case RACE_YEEK:
-            creature_ptr->resist_acid = TRUE;
             if (creature_ptr->lev > 19)
                 creature_ptr->immune_acid = TRUE;
             break;
         case RACE_KLACKON:
             creature_ptr->resist_conf = TRUE;
-            creature_ptr->resist_acid = TRUE;
             break;
         case RACE_KOBOLD:
             creature_ptr->resist_pois = TRUE;
@@ -213,8 +210,6 @@ void calc_race_status(player_type *creature_ptr)
                 creature_ptr->resist_fire = TRUE;
             if (creature_ptr->lev > 9)
                 creature_ptr->resist_cold = TRUE;
-            if (creature_ptr->lev > 14)
-                creature_ptr->resist_acid = TRUE;
             if (creature_ptr->lev > 19)
                 creature_ptr->resist_elec = TRUE;
             if (creature_ptr->lev > 34)
index 7a0204f..7098478 100644 (file)
@@ -1359,3 +1359,43 @@ void have_extra_blow(player_type *creature_ptr)
         }
     }
 }
+
+void have_resist_acid(player_type *creature_ptr)
+{
+    object_type *o_ptr;
+    BIT_FLAGS flgs[TR_FLAG_SIZE];
+    creature_ptr->resist_acid = FALSE;
+
+    if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
+        creature_ptr->resist_acid = TRUE;
+    }
+
+    if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_YEEK || creature_ptr->prace == RACE_KLACKON)) {
+        creature_ptr->resist_acid = TRUE;
+    }
+
+       if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_DRACONIAN && creature_ptr->lev > 14) {
+        creature_ptr->resist_acid = TRUE;
+       }
+
+       if (creature_ptr->special_defense & KAMAE_SEIRYU) {
+        creature_ptr->resist_acid = TRUE;
+       }
+
+    if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
+        creature_ptr->resist_acid = 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_ACID))
+            creature_ptr->resist_acid = TRUE;
+    }
+
+       if (creature_ptr->immune_acid)
+        creature_ptr->resist_acid = TRUE;
+}
index 31b5603..bf2393c 100644 (file)
@@ -49,5 +49,6 @@ void have_regenerate(player_type *creature_ptr);
 void have_curses(player_type *creature_ptr);
 void have_impact(player_type *creature_ptr);
 void have_extra_blow(player_type *creature_ptr);
+void have_resist_acid(player_type *creature_ptr);
 
 
index e7f81ed..88b83ee 100644 (file)
@@ -560,7 +560,6 @@ static void delayed_visual_update(player_type *player_ptr)
  */
 static void clear_creature_bonuses(player_type *creature_ptr)
 {
-    creature_ptr->resist_acid = FALSE;
     creature_ptr->resist_elec = FALSE;
     creature_ptr->resist_fire = FALSE;
     creature_ptr->resist_cold = FALSE;
@@ -732,6 +731,7 @@ void calc_bonuses(player_type *creature_ptr)
     have_curses(creature_ptr);
     have_impact(creature_ptr);
     have_extra_blow(creature_ptr);
+    have_resist_acid(creature_ptr);
 
     calc_race_status(creature_ptr);
 
@@ -869,8 +869,6 @@ void calc_bonuses(player_type *creature_ptr)
     if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
         creature_ptr->two_handed_weapon = FALSE;
 
-    if (creature_ptr->immune_acid)
-        creature_ptr->resist_acid = TRUE;
     if (creature_ptr->immune_elec)
         creature_ptr->resist_elec = TRUE;
     if (creature_ptr->immune_fire)
@@ -2081,7 +2079,6 @@ static void calc_num_blow(player_type *creature_ptr, int i)
         }
 
         if (creature_ptr->special_defense & KAMAE_SEIRYU) {
-            creature_ptr->resist_acid = TRUE;
             creature_ptr->resist_fire = TRUE;
             creature_ptr->resist_elec = TRUE;
             creature_ptr->resist_cold = TRUE;
@@ -4454,7 +4451,6 @@ 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_acid = TRUE;
         creature_ptr->resist_elec = TRUE;
         creature_ptr->resist_fire = TRUE;
         creature_ptr->resist_cold = TRUE;
@@ -4532,8 +4528,6 @@ void calc_equipment_status(player_type *creature_ptr)
         if (have_flag(flgs, TR_IM_ELEC))
             creature_ptr->immune_elec = TRUE;
 
-        if (have_flag(flgs, TR_RES_ACID))
-            creature_ptr->resist_acid = TRUE;
         if (have_flag(flgs, TR_RES_ELEC))
             creature_ptr->resist_elec = TRUE;
         if (have_flag(flgs, TR_RES_FIRE))