No knockback with flimsy or non-blunt weapon

Weapons that can do knockback are lucern hammer, bec de corbin,
dwarvish mattock, (silver) mace, morning star, war hammer,
club, quarterstaff, aklys, flail, pick-axe, and grappling hook.
This commit is contained in:
Pasi Kallinen
2025-05-11 20:28:20 +03:00
parent af6c53ac7c
commit 6d374f9306
2 changed files with 10 additions and 1 deletions

View File

@@ -246,6 +246,9 @@ struct obj {
((o)->oclass == TOOL_CLASS && objects[(o)->otyp].oc_skill != P_NONE)
/* towel is not a weptool: spe isn't an enchantment, cursed towel
doesn't weld to hand, and twoweapon won't work with one */
#define is_blunt_weapon(o) \
(((o)->oclass == WEAPON_CLASS || is_weptool(o)) \
&& ((objects[(o)->otyp].oc_dir & WHACK) != 0))
#define is_wet_towel(o) ((o)->otyp == TOWEL && (o)->spe > 0)
#define bimanual(otmp) \
((otmp->oclass == WEAPON_CLASS || otmp->oclass == TOOL_CLASS) \

View File

@@ -5189,6 +5189,8 @@ mhitm_knockback(
boolean u_agr = (magr == &gy.youmonst);
boolean u_def = (mdef == &gy.youmonst);
boolean was_u = FALSE, dismount = FALSE;
struct obj *wep = weapon_used ? (u_agr ? uwep : MON_WEP(magr))
: (struct obj *)0;
/* 1/6 chance of attack knocking back a monster */
if (rn2(6))
@@ -5236,12 +5238,16 @@ mhitm_knockback(
if (!(magr->data->msize > (mdef->data->msize + 1)))
return FALSE;
/* no knockback with a flimsy or non-blunt weapon */
if (wep && (is_flimsy(wep) || !is_blunt_weapon(wep)))
return FALSE;
/* only certain attacks qualify for knockback */
if (!((mattk->adtyp == AD_PHYS)
&& (mattk->aatyp == AT_CLAW
|| mattk->aatyp == AT_KICK
|| mattk->aatyp == AT_BUTT
|| (mattk->aatyp == AT_WEAP && !weapon_used))))
|| mattk->aatyp == AT_WEAP)))
return FALSE;
/* needs a solid physical hit */