OSDN Git Service

[Refactor] #40514 have_resist_conf() を calc_bonuses() から分離. / Separated have_resist_c...
authordeskull <deskull@users.sourceforge.jp>
Sun, 9 Aug 2020 15:06:15 +0000 (00:06 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 9 Aug 2020 15:06:15 +0000 (00:06 +0900)
src/player/player-class.c
src/player/player-personality.c
src/player/player-race.c
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c

index 6394d85..5a527bd 100644 (file)
@@ -1218,8 +1218,6 @@ void calc_class_status(player_type *creature_ptr)
     case CLASS_MINDCRAFTER:
         if (creature_ptr->lev > 9)
             creature_ptr->resist_fear = TRUE;
-        if (creature_ptr->lev > 29)
-            creature_ptr->resist_conf = TRUE;
         break;
     case CLASS_BARD:
         creature_ptr->resist_sound = TRUE;
index 6a725da..8d68371 100644 (file)
@@ -145,15 +145,10 @@ const player_personality *ap_ptr;
 void set_personality_flags(player_type *creature_ptr)
 {
 
-    if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN) {
-        creature_ptr->resist_conf = TRUE;
-    }
-
     if (creature_ptr->pseikaku == PERSONALITY_LUCKY)
         creature_ptr->muta3 |= MUT3_GOOD_LUCK;
     if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
         creature_ptr->resist_blind = TRUE;
-        creature_ptr->resist_conf = TRUE;
         if (creature_ptr->pclass != CLASS_NINJA)
             creature_ptr->lite = TRUE;
     }
index 88d8b05..e69666b 100644 (file)
@@ -139,7 +139,6 @@ void calc_race_status(player_type *creature_ptr)
         case MIMIC_DEMON_LORD:
             creature_ptr->resist_chaos = TRUE;
             creature_ptr->resist_neth = TRUE;
-            creature_ptr->resist_conf = TRUE;
             creature_ptr->resist_disen = TRUE;
             creature_ptr->resist_nexus = TRUE;
             creature_ptr->resist_fear = TRUE;
@@ -184,9 +183,6 @@ void calc_race_status(player_type *creature_ptr)
             if (creature_ptr->lev > 19)
                 creature_ptr->immune_acid = TRUE;
             break;
-        case RACE_KLACKON:
-            creature_ptr->resist_conf = TRUE;
-            break;
         case RACE_KOBOLD:
             creature_ptr->resist_pois = TRUE;
             break;
@@ -219,7 +215,6 @@ void calc_race_status(player_type *creature_ptr)
             creature_ptr->resist_lite = TRUE;
             break;
         case RACE_BEASTMAN:
-            creature_ptr->resist_conf = TRUE;
             creature_ptr->resist_sound = TRUE;
             break;
         case RACE_BALROG:
@@ -228,10 +223,6 @@ void calc_race_status(player_type *creature_ptr)
                 creature_ptr->oppose_fire = 1;
                 creature_ptr->redraw |= PR_STATUS;
             }
-
-            break;
-        case RACE_KUTAR:
-            creature_ptr->resist_conf = TRUE;
             break;
         case RACE_MERFOLK:
             creature_ptr->resist_water = TRUE;
index 0a07d4d..d2d4ea2 100644 (file)
@@ -1567,3 +1567,43 @@ void have_resist_pois(player_type *creature_ptr)
     }
 }
 
+void have_resist_conf(player_type *creature_ptr)
+{
+    object_type *o_ptr;
+    BIT_FLAGS flgs[TR_FLAG_SIZE];
+    creature_ptr->resist_conf = FALSE;
+
+    if (creature_ptr->pclass == CLASS_MINDCRAFTER && creature_ptr->lev > 29)
+        creature_ptr->resist_conf = TRUE;
+
+    if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN || creature_ptr->pseikaku == PERSONALITY_MUNCHKIN) {
+        creature_ptr->resist_conf = TRUE;
+    }
+
+    if (!creature_ptr->mimic_form && (creature_ptr->prace == RACE_KLACKON || creature_ptr->prace == RACE_BEASTMAN || creature_ptr->prace == RACE_KUTAR)) {
+        creature_ptr->resist_conf = TRUE;
+    }
+
+    if (creature_ptr->mimic_form == MIMIC_DEMON_LORD) {
+        creature_ptr->resist_conf = TRUE;
+    }
+
+    if (creature_ptr->ult_res || (creature_ptr->special_defense & KATA_MUSOU)) {
+        creature_ptr->resist_conf = TRUE;
+    }
+
+    if (creature_ptr->magicdef) {
+        creature_ptr->resist_conf = 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_CONF))
+                               creature_ptr->resist_conf = TRUE;
+    }
+}
index fed5656..8748771 100644 (file)
@@ -54,5 +54,6 @@ void have_resist_elec(player_type *creature_ptr);
 void have_resist_fire(player_type *creature_ptr);
 void have_resist_cold(player_type *creature_ptr);
 void have_resist_pois(player_type *creature_ptr);
+void have_resist_conf(player_type *creature_ptr);
 
 
index f2ab73b..864ba64 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_conf = FALSE;
     creature_ptr->resist_sound = FALSE;
     creature_ptr->resist_lite = FALSE;
     creature_ptr->resist_dark = FALSE;
@@ -732,6 +731,7 @@ void calc_bonuses(player_type *creature_ptr)
     have_resist_fire(creature_ptr);
     have_resist_cold(creature_ptr);
     have_resist_pois(creature_ptr);
+    have_resist_conf(creature_ptr);
 
     calc_race_status(creature_ptr);
 
@@ -4439,7 +4439,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_conf = TRUE;
         creature_ptr->resist_sound = TRUE;
         creature_ptr->resist_lite = TRUE;
         creature_ptr->resist_dark = TRUE;
@@ -4462,7 +4461,6 @@ void calc_timelimit_status(player_type *creature_ptr)
 
     if (creature_ptr->magicdef) {
         creature_ptr->resist_blind = TRUE;
-        creature_ptr->resist_conf = TRUE;
     }
 
     if (creature_ptr->ele_immune) {
@@ -4514,8 +4512,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_CONF))
-            creature_ptr->resist_conf = TRUE;
         if (have_flag(flgs, TR_RES_SOUND))
             creature_ptr->resist_sound = TRUE;
         if (have_flag(flgs, TR_RES_LITE))