OSDN Git Service

[Refactor] #40514 calc_search_freq() を帰り値持ちに仕様変更、コメント追加. /
authordeskull <deskull@users.sourceforge.jp>
Thu, 13 Aug 2020 09:31:07 +0000 (18:31 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 13 Aug 2020 09:31:07 +0000 (18:31 +0900)
calc_search_freq() was changed specifications to return value, added comments.

src/player/player-status.c

index a70cd11..fa82da0 100644 (file)
@@ -106,7 +106,7 @@ static void calc_disarming(player_type *creature_ptr);
 static void calc_device_ability(player_type *creature_ptr);
 static void calc_saving_throw(player_type *creature_ptr);
 static void calc_search(player_type *creature_ptr);
-static void calc_search_freq(player_type *creature_ptr);
+static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr);
 static ACTION_SKILL_POWER calc_to_hit_melee(player_type *creature_ptr);
 static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr);
 static ACTION_SKILL_POWER calc_to_hit_throw(player_type *creature_ptr);
@@ -790,7 +790,7 @@ void calc_bonuses(player_type *creature_ptr)
     calc_device_ability(creature_ptr);
     calc_saving_throw(creature_ptr);
     calc_search(creature_ptr);
-    calc_search_freq(creature_ptr);
+    creature_ptr->skill_fos = calc_search_freq(creature_ptr);
     creature_ptr->skill_thn = calc_to_hit_melee(creature_ptr);
     creature_ptr->skill_thb = calc_to_hit_shoot(creature_ptr);
     creature_ptr->skill_tht = calc_to_hit_throw(creature_ptr);
@@ -1750,8 +1750,19 @@ static void calc_search(player_type *creature_ptr)
     }
 }
 
-static void calc_search_freq(player_type *creature_ptr)
+/*!
+ * @brief 探索頻度計算
+ * @param creature_ptr 計算するクリーチャーの参照ポインタ
+ * @return 探索頻度
+ * @details
+ * * 種族/職業/性格による加算
+ * * 職業とレベルによる追加加算
+ * * 狂戦士化による減算(-15)
+ * * 変異(MUT3_XTRA_EYES)による加算(+15)
+ */
+static ACTION_SKILL_POWER calc_search_freq(player_type *creature_ptr)
 {
+    ACTION_SKILL_POWER pow;
     const player_race *tmp_rp_ptr;
 
     if (creature_ptr->mimic_form)
@@ -1761,7 +1772,8 @@ static void calc_search_freq(player_type *creature_ptr)
     const player_class *c_ptr = &class_info[creature_ptr->pclass];
     const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
 
-    creature_ptr->skill_fos = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos;
+    pow = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos;
+    pow += (c_ptr->x_fos * creature_ptr->lev / 10);
 
     for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
         object_type *o_ptr;
@@ -1771,18 +1783,18 @@ static void calc_search_freq(player_type *creature_ptr)
             continue;
         object_flags(creature_ptr, o_ptr, flgs);
         if (have_flag(flgs, TR_SEARCH))
-            creature_ptr->skill_fos += (o_ptr->pval * 5);
+            pow += (o_ptr->pval * 5);
     }
 
     if (creature_ptr->shero) {
-        creature_ptr->skill_fos -= 15;
+        pow -= 15;
     }
 
     if (creature_ptr->muta3 & MUT3_XTRA_EYES) {
-        creature_ptr->skill_fos += 15;
+        pow += 15;
     }
 
-    creature_ptr->skill_fos += (cp_ptr->x_fos * creature_ptr->lev / 10);
+       return pow;
 }
 
 /*!