Fix knockback impossible

When monster attacked another monster, and the retaliation attack
knocked back the attacking monster, the variables holding the
attacking monster coordinates were out of sync and caused
"no monster to remove" warning.

Propagate back the knockback hit, so the current monster cannot
do anything further.
This commit is contained in:
Pasi Kallinen
2023-05-07 12:57:06 +03:00
parent 01df119ae6
commit e18548c821
2 changed files with 4 additions and 1 deletions

View File

@@ -1012,7 +1012,7 @@ mdamagem(struct monst *magr, struct monst *mdef,
if (mhitm_knockback(magr, mdef, mattk, &mhm.hitflags,
(MON_WEP(magr) != 0))
&& ((mhm.hitflags & M_ATTK_DEF_DIED) != 0
&& ((mhm.hitflags & (M_ATTK_DEF_DIED|M_ATTK_HIT)) != 0
|| (mdef->mstate & (MON_DETACH|MON_MIGRATING|MON_LIMBO)) != 0))
return mhm.hitflags;

View File

@@ -5027,12 +5027,15 @@ mhitm_knockback(
dismount_steed(DISMOUNT_KNOCKED);
} else {
hurtle(dx, dy, knockdistance, FALSE);
*hitflags |= M_ATTK_HIT;
}
set_apparxy(magr); /* update magr's idea of where you are */
if (!Stunned && !rn2(4))
make_stunned((long) (knockdistance + 1), TRUE); /* 2 or 3 */
} else {
mhurtle(mdef, dx, dy, knockdistance);
if (!u_agr)
*hitflags |= M_ATTK_HIT;
if (DEADMONSTER(mdef)) {
if (!was_u)
*hitflags |= M_ATTK_DEF_DIED;