bonus_to_d = (o_ptr->to_d + 1) / 2;
}
- if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !has_two_handed_weapons(creature_ptr)) {
- damage += (s16b)bonus_to_d;
- } else if (has_right_hand_weapon(creature_ptr) && has_left_hand_weapon(creature_ptr)) {
- if (id == 0)
- damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
- if (id == 1)
- damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
- } else if (id == get_default_hand(creature_ptr)) {
- damage += (s16b)bonus_to_d;
+ switch (player_melee_type(creature_ptr)) {
+ case BAREHAND_TWO: /* fall through */
+ case WEAPON_TWOHAND:
+ if (id == get_default_hand(creature_ptr))
+ damage += (s16b)bonus_to_d;
+ break;
+
+ case BAREHAND_RIGHT: /* fall through */
+ case WEAPON_RIGHT:
+ if ((id == 0) && (i != INVEN_LEFT))
+ damage += (s16b)bonus_to_d;
+ break;
+
+ case BAREHAND_LEFT: /* fall through */
+ case WEAPON_LEFT:
+ if ((id == 1) && (i != INVEN_RIGHT))
+ damage += (s16b)bonus_to_d;
+ break;
+
+ case WEAPON_DOUBLE:
+ if ((id == 0)) {
+ if (i == INVEN_RIGHT) {
+ damage += (s16b)bonus_to_d;
+ }
+ else if (i != INVEN_LEFT) {
+ damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
+ }
+ }
+ if ((id == 1)) {
+ if (i == INVEN_LEFT) {
+ damage += (s16b)bonus_to_d;
+ } else if (i != INVEN_RIGHT) {
+ damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
+ }
+ }
+ break;
+
+ case SHIELD_DOUBLE:
+ break;
+
+ default:
+ break;
}
}
bonus_to_h = (o_ptr->to_h + 1) / 2;
}
- if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !has_two_handed_weapons(creature_ptr)) {
- hit += (s16b)bonus_to_h;
- continue;
- }
+ switch (player_melee_type(creature_ptr)) {
+ case BAREHAND_TWO: /* fall through */
+ case WEAPON_TWOHAND:
+ if (id == get_default_hand(creature_ptr))
+ hit += (s16b)bonus_to_h;
+ break;
- /* When wields two weapons on each hand */
- if (has_right_hand_weapon(creature_ptr) && has_left_hand_weapon(creature_ptr)) {
- if (default_hand == 0)
- hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
- if (default_hand == 1)
- hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
- continue;
- }
+ case BAREHAND_RIGHT: /* fall through */
+ case WEAPON_RIGHT:
+ if ((id == 0) && (i != INVEN_LEFT))
+ hit += (s16b)bonus_to_h;
+ break;
+
+ case BAREHAND_LEFT: /* fall through */
+ case WEAPON_LEFT:
+ if ((id == 1) && (i != INVEN_RIGHT))
+ hit += (s16b)bonus_to_h;
+ break;
+
+ case WEAPON_DOUBLE:
+ if ((id == 0)) {
+ if (i == INVEN_RIGHT) {
+ hit += (s16b)bonus_to_h;
+ } else if (i != INVEN_LEFT) {
+ hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
+ }
+ }
+ if ((id == 1)) {
+ if (i == INVEN_LEFT) {
+ hit += (s16b)bonus_to_h;
+ } else if (i != INVEN_RIGHT) {
+ hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
+ }
+ }
+ break;
+
+ case SHIELD_DOUBLE:
+ break;
- if (default_hand == id)
- hit += (s16b)bonus_to_h;
+ default:
+ break;
+ }
}
/* Martial arts bonus */
static int get_default_hand(player_type *creature_ptr)
{
- int default_hand = 0;
-
- if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
- if (!has_right_hand_weapon(creature_ptr))
- default_hand = 1;
- }
-
- if (can_two_hands_wielding(creature_ptr)) {
- if (has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
- && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
- } else if (has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
- && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
- } else {
- default_hand = 1;
- }
+ switch (player_melee_type(creature_ptr)) {
+ case BAREHAND_TWO: return 0;
+ case BAREHAND_RIGHT: return 0;
+ case BAREHAND_LEFT: return 1;
+ case WEAPON_RIGHT: return 0;
+ case WEAPON_LEFT: return 1;
+ case WEAPON_TWOHAND: return 0;
+ case WEAPON_DOUBLE: return 0;
+ case SHIELD_DOUBLE: return 0;
}
-
- return default_hand;
+ return 0;
}