OSDN Git Service

[Refactor] #40514 calc_constitution_addition() を calc_bonuses() から分離. / Separated...
authordeskull <deskull@users.sourceforge.jp>
Thu, 2 Jul 2020 12:18:16 +0000 (21:18 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 2 Jul 2020 12:18:16 +0000 (21:18 +0900)
src/mutation/mutation.c
src/object/object-kind.c
src/player/player-race.c
src/player/player-status.c

index 5c3a9ce..cec470d 100644 (file)
@@ -1891,21 +1891,11 @@ void set_mutation_flags(player_type *creature_ptr)
 {
     if (creature_ptr->muta3) {
 
-        if (creature_ptr->muta3 & MUT3_RESILIENT) {
-            creature_ptr->stat_add[A_CON] += 4;
-        }
-
         if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
-            creature_ptr->stat_add[A_CON] += 2;
             creature_ptr->pspeed -= 2;
         }
 
-        if (creature_ptr->muta3 & MUT3_ALBINO) {
-            creature_ptr->stat_add[A_CON] -= 4;
-        }
-
         if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
-            creature_ptr->stat_add[A_CON] -= 2;
             creature_ptr->stat_add[A_CHR] -= 1;
             creature_ptr->regenerate = FALSE;
         }
index 1df24c9..7901e3d 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_CON))
-            creature_ptr->stat_add[A_CON] += o_ptr->pval;
         if (have_flag(flgs, TR_CHR))
             creature_ptr->stat_add[A_CHR] += o_ptr->pval;
         if (have_flag(flgs, TR_INFRA))
index 2516957..072ee3c 100644 (file)
@@ -347,13 +347,6 @@ void calc_race_status(player_type *creature_ptr)
         case RACE_ENT:
             if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
                 creature_ptr->skill_dig += creature_ptr->lev * 10;
-
-            if (creature_ptr->lev > 25)
-                creature_ptr->stat_add[A_CON]++;
-            if (creature_ptr->lev > 40)
-                creature_ptr->stat_add[A_CON]++;
-            if (creature_ptr->lev > 45)
-                creature_ptr->stat_add[A_CON]++;
             break;
         case RACE_ARCHON:
             creature_ptr->levitation = TRUE;
index dd9fbb5..4ef1481 100644 (file)
@@ -97,6 +97,7 @@ 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);
+static void calc_constitution_addition(player_type *creature_ptr);
 
 /*!
  * @brief 能力値テーブル / Abbreviations of healthy stats
@@ -1607,6 +1608,7 @@ void calc_bonuses(player_type *creature_ptr)
     calc_intelligence_addition(creature_ptr);
     calc_wisdom_addition(creature_ptr);
     calc_dexterity_addition(creature_ptr);
+    calc_constitution_addition(creature_ptr);
 
        int count = 0;
        for (int i = 0; i < A_MAX; i++)
@@ -3810,7 +3812,48 @@ static void calc_dexterity_addition(player_type* creature_ptr) {
     }
 }
 
+static void calc_constitution_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_CON]++;
+        if (creature_ptr->lev > 40)
+            creature_ptr->stat_add[A_CON]++;
+        if (creature_ptr->lev > 45)
+            creature_ptr->stat_add[A_CON]++;
+    }
 
+       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_CON))
+            creature_ptr->stat_add[A_CON] += o_ptr->pval;
+       }
+       
+       if (creature_ptr->muta3) {
+        if (creature_ptr->muta3 & MUT3_RESILIENT) {
+            creature_ptr->stat_add[A_CON] += 4;
+        }
+
+        if (creature_ptr->muta3 & MUT3_ALBINO) {
+            creature_ptr->stat_add[A_CON] -= 4;
+        }
+
+        if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
+            creature_ptr->stat_add[A_CON] += 2;
+        }
+
+        if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
+            creature_ptr->stat_add[A_CON] -= 2;
+        }
+
+       }
+}
 
 /*!
  * @brief プレイヤーの所持重量制限を計算する /