OSDN Git Service

[Fix] 武器を両手持ちしている時の修正がもらえないことを判定する関数なのに、戻り値がほぼ逆になっていたので修正(武器の重さペナルティはcalc_to_hit...
authoriks <iks@users.sorceforge.jp>
Wed, 11 Nov 2020 18:55:59 +0000 (03:55 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 13 Nov 2020 23:29:16 +0000 (08:29 +0900)
src/player/player-status-flags.c

index 86aa47a..00e9bb9 100644 (file)
@@ -1594,16 +1594,25 @@ BIT_FLAGS has_lite(player_type *creature_ptr)
     return result;
 }
 
+/*
+ * @brief 両手持ちボーナスがもらえないかどうかを判定する。 / Does *not * get two hand wielding bonus.
+ * @detail
+ *  Only can get hit bonuses when wieids an enough light weapon which is lighter than 5 times of weight limit.
+ *  If its weight is 10 times heavier or more than weight limit, gets hit penalty in calc_to_hit().
+ */
 bool has_disable_two_handed_bonus(player_type *creature_ptr, int i)
 {
-    object_type *o_ptr;
-    o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
-    if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
-        if (calc_weapon_weight_limit(creature_ptr) * 2 >= o_ptr->weight / 10 && has_two_handed_weapons(creature_ptr)
-            && (calc_weapon_weight_limit(creature_ptr) * 2 < o_ptr->weight / 5))
-            return TRUE;
+    if (has_melee_weapon(creature_ptr, INVEN_RARM + i) && has_two_handed_weapons(creature_ptr)) {
+        object_type *o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
+        int limit = calc_weapon_weight_limit(creature_ptr) * 2;
+
+        /* Enable when two hand wields an enough light weapon */
+        if (limit >= o_ptr->weight / 5)
+            return FALSE;
     }
-    return FALSE;
+
+    /* Disable when empty hands, one hand wieldings and heavy weapons */
+    return TRUE;
 }
 
 bool has_icky_wield_weapon(player_type *creature_ptr, int i)