OSDN Git Service

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

index e2943d3..5c3a9ce 100644 (file)
@@ -1948,7 +1948,6 @@ void set_mutation_flags(player_type *creature_ptr)
         }
 
         if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
-            creature_ptr->stat_add[A_DEX] -= 1;
             creature_ptr->to_a += 25;
             creature_ptr->dis_to_a += 25;
         }
@@ -1969,14 +1968,6 @@ void set_mutation_flags(player_type *creature_ptr)
             creature_ptr->telepathy = TRUE;
         }
 
-        if (creature_ptr->muta3 & MUT3_LIMBER) {
-            creature_ptr->stat_add[A_DEX] += 3;
-        }
-
-        if (creature_ptr->muta3 & MUT3_ARTHRITIS) {
-            creature_ptr->stat_add[A_DEX] -= 3;
-        }
-
         if (creature_ptr->muta3 & MUT3_MOTION) {
             creature_ptr->free_act = TRUE;
         }
index 64c79c4..1df24c9 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_DEX))
-            creature_ptr->stat_add[A_DEX] += o_ptr->pval;
         if (have_flag(flgs, TR_CON))
             creature_ptr->stat_add[A_CON] += o_ptr->pval;
         if (have_flag(flgs, TR_CHR))
index 5ac751b..2516957 100644 (file)
@@ -349,13 +349,6 @@ void calc_race_status(player_type *creature_ptr)
                 creature_ptr->skill_dig += creature_ptr->lev * 10;
 
             if (creature_ptr->lev > 25)
-                creature_ptr->stat_add[A_DEX]--;
-            if (creature_ptr->lev > 40)
-                creature_ptr->stat_add[A_DEX]--;
-            if (creature_ptr->lev > 45)
-                creature_ptr->stat_add[A_DEX]--;
-
-            if (creature_ptr->lev > 25)
                 creature_ptr->stat_add[A_CON]++;
             if (creature_ptr->lev > 40)
                 creature_ptr->stat_add[A_CON]++;
index 372a610..dd9fbb5 100644 (file)
@@ -96,6 +96,7 @@ 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);
+static void calc_dexterity_addition(player_type *creature_ptr);
 
 /*!
  * @brief 能力値テーブル / Abbreviations of healthy stats
@@ -1605,6 +1606,7 @@ void calc_bonuses(player_type *creature_ptr)
        calc_strength_addition(creature_ptr);
     calc_intelligence_addition(creature_ptr);
     calc_wisdom_addition(creature_ptr);
+    calc_dexterity_addition(creature_ptr);
 
        int count = 0;
        for (int i = 0; i < A_MAX; i++)
@@ -3772,6 +3774,44 @@ static void calc_wisdom_addition(player_type *creature_ptr)
     }
 }
 
+static void calc_dexterity_addition(player_type* creature_ptr) {
+
+       if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT) {
+        if (creature_ptr->lev > 25)
+            creature_ptr->stat_add[A_DEX]--;
+        if (creature_ptr->lev > 40)
+            creature_ptr->stat_add[A_DEX]--;
+        if (creature_ptr->lev > 45)
+            creature_ptr->stat_add[A_DEX]--;
+    }
+
+       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_DEX)) {
+            creature_ptr->stat_add[A_DEX] += o_ptr->pval;
+        }
+    }
+
+       if (creature_ptr->muta3 & MUT3_IRON_SKIN) {
+        creature_ptr->stat_add[A_DEX] -= 1;
+    }
+
+    if (creature_ptr->muta3 & MUT3_LIMBER) {
+        creature_ptr->stat_add[A_DEX] += 3;
+    }
+
+    if (creature_ptr->muta3 & MUT3_ARTHRITIS) {
+        creature_ptr->stat_add[A_DEX] -= 3;
+    }
+}
+
+
+
 /*!
  * @brief プレイヤーの所持重量制限を計算する /
  * Computes current weight limit.