From e18548c821570fba3b3714c362f328521a528440 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 7 May 2023 12:57:06 +0300 Subject: [PATCH] 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. --- src/mhitm.c | 2 +- src/uhitm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mhitm.c b/src/mhitm.c index 6c5c52f93..53de130ca 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -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; diff --git a/src/uhitm.c b/src/uhitm.c index 97c3eac58..7fafe6e8c 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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;