OSDN Git Service

[Refactor] #40514 calc_wisdom_addition() を calc_bonuses() から分離. / Separated calc_wisd...
authordeskull <deskull@users.sourceforge.jp>
Wed, 1 Jul 2020 15:47:51 +0000 (00:47 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 1 Jul 2020 15:47:51 +0000 (00:47 +0900)
src/mutation/mutation.c
src/object/object-kind.c
src/player/player-status.c

index 82b37fb..e2943d3 100644 (file)
@@ -1891,14 +1891,6 @@ void set_mutation_flags(player_type *creature_ptr)
 {
     if (creature_ptr->muta3) {
 
-        if (creature_ptr->muta3 & MUT3_HYPER_INT) {
-            creature_ptr->stat_add[A_WIS] += 4;
-        }
-
-        if (creature_ptr->muta3 & MUT3_MORONIC) {
-            creature_ptr->stat_add[A_WIS] -= 4;
-        }
-
         if (creature_ptr->muta3 & MUT3_RESILIENT) {
             creature_ptr->stat_add[A_CON] += 4;
         }
index 967cc06..64c79c4 100644 (file)
@@ -46,8 +46,6 @@ void calc_equipment_status(player_type* creature_ptr) {
         if (o_ptr->name1 == ART_CHAINSWORD)
             creature_ptr->cursed |= TRC_CHAINSWORD;
 
-        if (have_flag(flgs, TR_WIS))
-            creature_ptr->stat_add[A_WIS] += o_ptr->pval;
         if (have_flag(flgs, TR_DEX))
             creature_ptr->stat_add[A_DEX] += o_ptr->pval;
         if (have_flag(flgs, TR_CON))
index 696d44a..372a610 100644 (file)
@@ -95,6 +95,7 @@ static void calc_dig(player_type *creature_ptr);
 static void calc_num_blow(player_type *creature_ptr, int i);
 static void calc_strength_addition(player_type *creature_ptr);
 static void calc_intelligence_addition(player_type *creature_ptr);
+static void calc_wisdom_addition(player_type *creature_ptr);
 
 /*!
  * @brief 能力値テーブル / Abbreviations of healthy stats
@@ -1532,13 +1533,11 @@ void calc_bonuses(player_type *creature_ptr)
                }
                else if (creature_ptr->special_defense & KAMAE_GENBU)
                {
-                       creature_ptr->stat_add[A_WIS] -= 1;
                        creature_ptr->stat_add[A_DEX] -= 2;
                        creature_ptr->stat_add[A_CON] += 3;
                }
                else if (creature_ptr->special_defense & KAMAE_SUZAKU)
                {
-                       creature_ptr->stat_add[A_WIS] += 1;
                        creature_ptr->stat_add[A_DEX] += 2;
                        creature_ptr->stat_add[A_CON] -= 2;
                }
@@ -1605,6 +1604,7 @@ void calc_bonuses(player_type *creature_ptr)
 
        calc_strength_addition(creature_ptr);
     calc_intelligence_addition(creature_ptr);
+    calc_wisdom_addition(creature_ptr);
 
        int count = 0;
        for (int i = 0; i < A_MAX; i++)
@@ -3740,6 +3740,38 @@ void calc_intelligence_addition(player_type *creature_ptr)
     }
 }
 
+static void calc_wisdom_addition(player_type *creature_ptr)
+{
+    for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+        object_type *o_ptr;
+        BIT_FLAGS flgs[TR_FLAG_SIZE];
+        o_ptr = &creature_ptr->inventory_list[i];
+        if (!o_ptr->k_idx)
+            continue;
+        object_flags(o_ptr, flgs);
+        if (have_flag(flgs, TR_WIS)) {
+            creature_ptr->stat_add[A_WIS] += o_ptr->pval;
+        }
+    }
+       
+       if (creature_ptr->muta3) {
+
+        if (creature_ptr->muta3 & MUT3_HYPER_INT) {
+            creature_ptr->stat_add[A_WIS] += 4;
+        }
+
+        if (creature_ptr->muta3 & MUT3_MORONIC) {
+            creature_ptr->stat_add[A_WIS] -= 4;
+        }
+    }
+
+       if (creature_ptr->special_defense & KAMAE_GENBU) {
+        creature_ptr->stat_add[A_WIS] -= 1;
+    } else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
+        creature_ptr->stat_add[A_WIS] += 1;
+    }
+}
+
 /*!
  * @brief プレイヤーの所持重量制限を計算する /
  * Computes current weight limit.