Fix knockbacked monster migrating or killed
Fix a case where a monster knocked back another monster into a trap, and the trap either killed or migrated the monster, then the actual damage dealing later could try to detach the already detached monster. If the monster migrated, the monster is gone before the damage from the hit is dealt to the monster.
This commit is contained in:
@@ -947,7 +947,11 @@ mdamagem(struct monst *magr, struct monst *mdef,
|
||||
|
||||
mhitm_adtyping(magr, mattk, mdef, &mhm);
|
||||
|
||||
(void) mhitm_knockback(magr, mdef, mattk, &mhm.hitflags, (MON_WEP(magr) != 0));
|
||||
if (mhitm_knockback(magr, mdef, mattk, &mhm.hitflags,
|
||||
(MON_WEP(magr) != 0))
|
||||
&& ((mhm.hitflags & MM_DEF_DIED) != 0
|
||||
|| (mdef->mstate & (MON_DETACH|MON_MIGRATING|MON_LIMBO)) != 0))
|
||||
return mhm.hitflags;
|
||||
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
|
||||
Reference in New Issue
Block a user