OSDN Git Service

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

src/player/player-status.c

index 6c72f4e..a1d2750 100644 (file)
@@ -108,7 +108,7 @@ 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 void calc_to_hit_melee(player_type *creature_ptr);
-static void calc_to_hit_shoot(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);
 static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr);
 static void calc_num_blow(player_type *creature_ptr, int i);
@@ -792,7 +792,7 @@ void calc_bonuses(player_type *creature_ptr)
     calc_search(creature_ptr);
     calc_search_freq(creature_ptr);
     calc_to_hit_melee(creature_ptr);
-    calc_to_hit_shoot(creature_ptr);
+    creature_ptr->skill_thb = calc_to_hit_shoot(creature_ptr);
     creature_ptr->skill_tht = calc_to_hit_throw(creature_ptr);
     calc_to_damage(creature_ptr, INVEN_RARM);
     calc_to_damage(creature_ptr, INVEN_LARM);
@@ -1800,8 +1800,16 @@ static void calc_to_hit_melee(player_type *creature_ptr)
     creature_ptr->skill_thn += ((c_ptr->x_thn * creature_ptr->lev / 10) + (a_ptr->a_thn * creature_ptr->lev / 50));
 }
 
-static void calc_to_hit_shoot(player_type *creature_ptr)
+/*!
+ * @brief 射撃命中能力計算
+ * @param creature_ptr 計算するクリーチャーの参照ポインタ
+ * @return 射撃命中能力
+ * @details
+ * * 種族/職業/性格による加算とレベルによる追加加算
+ */
+static ACTION_SKILL_POWER calc_to_hit_shoot(player_type *creature_ptr)
 {
+    ACTION_SKILL_POWER pow;
     const player_race *tmp_rp_ptr;
     const player_class *c_ptr = &class_info[creature_ptr->pclass];
     const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
@@ -1811,8 +1819,9 @@ static void calc_to_hit_shoot(player_type *creature_ptr)
     else
         tmp_rp_ptr = &race_info[creature_ptr->prace];
 
-    creature_ptr->skill_thb = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
-    creature_ptr->skill_thb += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
+    pow = tmp_rp_ptr->r_thb + c_ptr->c_thb + a_ptr->a_thb;
+    pow += ((c_ptr->x_thb * creature_ptr->lev / 10) + (a_ptr->a_thb * creature_ptr->lev / 50));
+    return pow;
 }
 
 /*!