Unpolyed hero can knockback too
Noticed a strange oversight in knockback: Hero hitting a monster did not cause knockback, unless polymorphed into a monster. Add knockback chance if we're using a weapon, not twoweaponing, and dealing some damage.
This commit is contained in:
16
src/uhitm.c
16
src/uhitm.c
@@ -1724,6 +1724,7 @@ hmon_hitmon(
|
|||||||
int dieroll)
|
int dieroll)
|
||||||
{
|
{
|
||||||
struct _hitmon_data hmd;
|
struct _hitmon_data hmd;
|
||||||
|
boolean maybe_knockback = FALSE;
|
||||||
|
|
||||||
hmd.dmg = 0;
|
hmd.dmg = 0;
|
||||||
hmd.thrown = thrown;
|
hmd.thrown = thrown;
|
||||||
@@ -1790,6 +1791,9 @@ hmon_hitmon(
|
|||||||
hmon_hitmon_jousting(&hmd, mon, obj);
|
hmon_hitmon_jousting(&hmd, mon, obj);
|
||||||
} else if (hmd.unarmed && hmd.dmg > 1 && !thrown && !obj && !Upolyd) {
|
} else if (hmd.unarmed && hmd.dmg > 1 && !thrown && !obj && !Upolyd) {
|
||||||
hmon_hitmon_stagger(&hmd, mon, obj);
|
hmon_hitmon_stagger(&hmd, mon, obj);
|
||||||
|
} else if (!hmd.unarmed && hmd.dmg > 1 && !thrown && !Upolyd
|
||||||
|
&& !u.twoweap && uwep) {
|
||||||
|
maybe_knockback = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hmd.already_killed) {
|
if (!hmd.already_killed) {
|
||||||
@@ -1869,9 +1873,17 @@ hmon_hitmon(
|
|||||||
Your("%s %s no longer poisoned.", hmd.saved_oname,
|
Your("%s %s no longer poisoned.", hmd.saved_oname,
|
||||||
vtense(hmd.saved_oname, "are"));
|
vtense(hmd.saved_oname, "are"));
|
||||||
|
|
||||||
if (!hmd.destroyed)
|
if (!hmd.destroyed) {
|
||||||
wakeup(mon, TRUE);
|
int hitflags = M_ATTK_HIT;
|
||||||
|
|
||||||
|
wakeup(mon, TRUE);
|
||||||
|
if (maybe_knockback
|
||||||
|
&& mhitm_knockback(&gy.youmonst, mon, gy.youmonst.data->mattk,
|
||||||
|
&hitflags, TRUE)) {
|
||||||
|
if ((hitflags & M_ATTK_DEF_DIED) != 0)
|
||||||
|
hmd.destroyed = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return hmd.destroyed ? FALSE : TRUE;
|
return hmd.destroyed ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user