OSDN Git Service

[Refactor] #40514 calc_device_ability() を calc_bonuses() から分離. / Separated calc_devic...
authordeskull <deskull@users.sourceforge.jp>
Sun, 28 Jun 2020 15:37:04 +0000 (00:37 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 28 Jun 2020 15:37:04 +0000 (00:37 +0900)
src/object/object-kind.c
src/player/player-effects.c
src/player/player-race.c
src/player/player-status.c

index e3cf6bc..239424c 100644 (file)
@@ -58,8 +58,6 @@ void calc_equipment_status(player_type* creature_ptr) {
             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_MAGIC_MASTERY))
-            creature_ptr->skill_dev += 8 * o_ptr->pval;
         if (have_flag(flgs, TR_STEALTH))
             creature_ptr->skill_stl += o_ptr->pval;
         if (have_flag(flgs, TR_SEARCH))
index 3e88d0f..1269d66 100644 (file)
@@ -3997,8 +3997,6 @@ void calc_timelimit_status(player_type *creature_ptr)
         creature_ptr->dis_to_d[1] += 3 + (creature_ptr->lev / 5);
         creature_ptr->to_a -= 10;
         creature_ptr->dis_to_a -= 10;
-        creature_ptr->skill_stl -= 7;
-        creature_ptr->skill_dev -= 20;
         creature_ptr->skill_sav -= 30;
         creature_ptr->skill_srh -= 15;
         creature_ptr->skill_fos -= 15;
index 3ba752d..d6a4fb6 100644 (file)
@@ -128,7 +128,6 @@ void calc_race_status(player_type *creature_ptr)
         tmp_rp_ptr = &race_info[creature_ptr->prace];
 
     creature_ptr->see_infra += tmp_rp_ptr->infra;
-    creature_ptr->skill_dev += tmp_rp_ptr->r_dev;
     creature_ptr->skill_sav += tmp_rp_ptr->r_sav;
     creature_ptr->skill_srh += tmp_rp_ptr->r_srh;
     creature_ptr->skill_fos += tmp_rp_ptr->r_fos;
index 572f303..99f2b8f 100644 (file)
@@ -83,6 +83,7 @@
 
 static void calc_stealth(player_type *creature_ptr);
 static void calc_disarming(player_type *creature_ptr);
+static void calc_device_ability(player_type *creature_ptr);
 
 
 /*!
@@ -1218,7 +1219,6 @@ static void clear_creature_bonuses(player_type *creature_ptr)
         creature_ptr->stat_add[i] = 0;
 
        creature_ptr->see_infra = 0;
-    creature_ptr->skill_dev = 0;
     creature_ptr->skill_sav = 0;
     creature_ptr->skill_srh = 0;
     creature_ptr->skill_fos = 0;
@@ -1388,7 +1388,6 @@ void calc_bonuses(player_type *creature_ptr)
        clear_creature_bonuses(creature_ptr);
     calc_race_status(creature_ptr);
 
-       creature_ptr->skill_dev = cp_ptr->c_dev + ap_ptr->a_dev;
        creature_ptr->skill_sav = cp_ptr->c_sav + ap_ptr->a_sav;
        creature_ptr->skill_srh = cp_ptr->c_srh + ap_ptr->a_srh;
        creature_ptr->skill_fos = cp_ptr->c_fos + ap_ptr->a_fos;
@@ -2468,10 +2467,8 @@ void calc_bonuses(player_type *creature_ptr)
        if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
                creature_ptr->ryoute = FALSE;
 
-       creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
        creature_ptr->skill_sav += adj_wis_sav[creature_ptr->stat_ind[A_WIS]];
        creature_ptr->skill_dig += adj_str_dig[creature_ptr->stat_ind[A_STR]];
-       creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
        creature_ptr->skill_sav += ((cp_ptr->x_sav * creature_ptr->lev / 10) + (ap_ptr->a_sav * creature_ptr->lev / 50));
        creature_ptr->skill_srh += (cp_ptr->x_srh * creature_ptr->lev / 10);
        creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
@@ -2495,6 +2492,7 @@ void calc_bonuses(player_type *creature_ptr)
 
        calc_stealth(creature_ptr);
     calc_disarming(creature_ptr);
+    calc_device_ability(creature_ptr);
 
        if (current_world_ptr->character_xtra) return;
 
@@ -3525,6 +3523,41 @@ static void calc_disarming(player_type *creature_ptr)
 }
 
 /*!
+ * @brief プレイヤーの魔道具使用能力値を計算する
+ * @return なし
+ * @details
+ * This function induces status messages.
+ */
+static void calc_device_ability(player_type *creature_ptr)
+{
+    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];
+
+       creature_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
+       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_MAGIC_MASTERY))
+                       creature_ptr->skill_dev += 8 * o_ptr->pval;
+    }
+
+       creature_ptr->skill_dev += adj_int_dev[creature_ptr->stat_ind[A_INT]];
+    creature_ptr->skill_dev += ((cp_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
+    if (creature_ptr->shero) {
+        creature_ptr->skill_stl -= 7;
+    }
+}
+
+/*!
  * @brief プレイヤーの所持重量制限を計算する /
  * Computes current weight limit.
  * @return 制限重量(ポンド)