OSDN Git Service

[Refactor] #40514 calc_speed() を calc_bonuses() から分離. / Separated calc_speed() from...
authordeskull <deskull@users.sourceforge.jp>
Sat, 4 Jul 2020 05:25:05 +0000 (14:25 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 4 Jul 2020 05:25:05 +0000 (14:25 +0900)
src/mutation/mutation.c
src/player/player-effects.c
src/player/player-personality.c
src/player/player-race.c
src/player/player-status.c

index 9b10a0b..e62ecf3 100644 (file)
@@ -1891,22 +1891,11 @@ void set_mutation_flags(player_type *creature_ptr)
 {
     if (creature_ptr->muta3) {
 
-        if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
-            creature_ptr->pspeed -= 2;
-        }
 
         if (creature_ptr->muta3 & MUT3_FLESH_ROT) {
             creature_ptr->regenerate = FALSE;
         }
 
-        if (creature_ptr->muta3 & MUT3_XTRA_LEGS) {
-            creature_ptr->pspeed += 3;
-        }
-
-        if (creature_ptr->muta3 & MUT3_SHORT_LEG) {
-            creature_ptr->pspeed -= 3;
-        }
-
         if (creature_ptr->muta3 & MUT3_ELEC_TOUC) {
             creature_ptr->sh_elec = TRUE;
         }
index 498e0ce..0754d53 100644 (file)
@@ -4000,14 +4000,6 @@ void calc_timelimit_status(player_type *creature_ptr)
         creature_ptr->skill_dig += 30;
     }
 
-    if (IS_FAST(creature_ptr)) {
-        creature_ptr->pspeed += 10;
-    }
-
-    if (creature_ptr->slow) {
-        creature_ptr->pspeed -= 10;
-    }
-
     if (is_time_limit_esp(creature_ptr)) {
         creature_ptr->telepathy = TRUE;
     }
index 0e20cf1..4dfa597 100644 (file)
@@ -157,8 +157,5 @@ void set_personality_flags(player_type *creature_ptr)
         creature_ptr->hold_exp = TRUE;
         if (creature_ptr->pclass != CLASS_NINJA)
             creature_ptr->lite = TRUE;
-
-        if ((creature_ptr->prace != RACE_KLACKON) && (creature_ptr->prace != RACE_SPRITE))
-            creature_ptr->pspeed += (creature_ptr->lev) / 10 + 5;
     }
 }
index ccca681..142ab9b 100644 (file)
@@ -121,7 +121,7 @@ bool is_specific_player_race(player_type *creature_ptr, player_race_type prace)
 void calc_race_status(player_type *creature_ptr)
 {
     const player_race *tmp_rp_ptr;
-               if (creature_ptr->mimic_form)
+       if (creature_ptr->mimic_form)
         tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
     else
         tmp_rp_ptr = &race_info[creature_ptr->prace];
@@ -135,7 +135,6 @@ void calc_race_status(player_type *creature_ptr)
             creature_ptr->resist_fire = TRUE;
             creature_ptr->oppose_fire = 1;
             creature_ptr->see_inv = TRUE;
-            creature_ptr->pspeed += 3;
             creature_ptr->redraw |= PR_STATUS;
             creature_ptr->to_a += 10;
             creature_ptr->dis_to_a += 10;
@@ -159,7 +158,6 @@ void calc_race_status(player_type *creature_ptr)
             creature_ptr->telepathy = TRUE;
             creature_ptr->levitation = TRUE;
             creature_ptr->kill_wall = TRUE;
-            creature_ptr->pspeed += 5;
             creature_ptr->to_a += 20;
             creature_ptr->dis_to_a += 20;
             break;
@@ -170,7 +168,6 @@ void calc_race_status(player_type *creature_ptr)
             creature_ptr->resist_cold = TRUE;
             creature_ptr->resist_pois = TRUE;
             creature_ptr->see_inv = TRUE;
-            creature_ptr->pspeed += 3;
             creature_ptr->to_a += 10;
             creature_ptr->dis_to_a += 10;
             if (creature_ptr->pclass != CLASS_NINJA)
index 682be5a..e3fc22e 100644 (file)
@@ -102,6 +102,8 @@ static void calc_constitution_addition(player_type *creature_ptr);
 static void calc_charisma_addition(player_type *creature_ptr);
 static void calc_to_magic_chance(player_type *creature_ptr);
 static void calc_base_ac(player_type *creature_ptr);
+static void calc_base_ac_display(player_type *creature_ptr);
+static void calc_speed(player_type *creature_ptr);
 
 /*!
  * @brief 能力値テーブル / Abbreviations of healthy stats
@@ -1319,7 +1321,6 @@ static void clear_creature_bonuses(player_type *creature_ptr)
     creature_ptr->migite = FALSE;
     creature_ptr->hidarite = FALSE;
     creature_ptr->no_flowed = FALSE;
-    creature_ptr->pspeed = 110;
     creature_ptr->yoiyami = FALSE;
     creature_ptr->easy_2weapon = FALSE;
     creature_ptr->down_saving = FALSE;
@@ -2063,15 +2064,7 @@ void calc_bonuses(player_type *creature_ptr)
                if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
        }
 
-       /* Maximum speed is (+99). (internally it's 110 + 99) */
-       /* Temporary lightspeed forces to be maximum speed */
-       if ((creature_ptr->lightspeed && !creature_ptr->riding) || (creature_ptr->pspeed > 209))
-       {
-               creature_ptr->pspeed = 209;
-       }
-
-       /* Minimum speed is (-99). (internally it's 110 - 99) */
-       if (creature_ptr->pspeed < 11) creature_ptr->pspeed = 11;
+       calc_speed(creature_ptr);
 
        if (creature_ptr->pspeed != old_speed)
        {
@@ -4011,6 +4004,69 @@ static void calc_base_ac_display(player_type *creature_ptr)
     }
 }
 
+static void calc_speed(player_type *creature_ptr)
+{
+    creature_ptr->pspeed = 110;
+
+    const player_race *tmp_rp_ptr;
+    if (creature_ptr->mimic_form)
+        tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
+    else
+        tmp_rp_ptr = &race_info[creature_ptr->prace];
+
+    if (creature_ptr->mimic_form) {
+        switch (creature_ptr->mimic_form) {
+        case MIMIC_DEMON:
+            creature_ptr->pspeed += 3;
+            break;
+        case MIMIC_DEMON_LORD:
+            creature_ptr->pspeed += 5;
+            break;
+        case MIMIC_VAMPIRE:
+            creature_ptr->pspeed += 3;
+            break;
+        }
+    }
+
+    if (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN && creature_ptr->prace != RACE_KLACKON && creature_ptr->prace != RACE_SPRITE) 
+       {
+        creature_ptr->pspeed += (creature_ptr->lev) / 10 + 5;
+    }
+
+    if (IS_FAST(creature_ptr)) {
+        creature_ptr->pspeed += 10;
+    }
+
+    if (creature_ptr->slow) {
+        creature_ptr->pspeed -= 10;
+    }
+
+    if (creature_ptr->muta3) {
+
+        if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
+            creature_ptr->pspeed -= 2;
+        }
+
+        if (creature_ptr->muta3 & MUT3_XTRA_LEGS) {
+            creature_ptr->pspeed += 3;
+        }
+
+        if (creature_ptr->muta3 & MUT3_SHORT_LEG) {
+            creature_ptr->pspeed -= 3;
+        }
+    }
+
+       /* Maximum speed is (+99). (internally it's 110 + 99) */
+    /* Temporary lightspeed forces to be maximum speed */
+    if ((creature_ptr->lightspeed && !creature_ptr->riding) || (creature_ptr->pspeed > 209)) {
+        creature_ptr->pspeed = 209;
+    }
+
+    /* Minimum speed is (-99). (internally it's 110 - 99) */
+    if (creature_ptr->pspeed < 11)
+        creature_ptr->pspeed = 11;
+}
+
 
 /*!
  * @brief プレイヤーの所持重量制限を計算する /