fix issue #1378 - brain eaten after flayer's death

Issue reported by Umbire:  if a mind flayer got turned to stone by
hitting a hero who is polymorphed into a cockatrice and the first
tentacle drain missed but a subsequent one hit, any remaining ones
would keep being applied even though the mind flayer was dead.

This works but doesn't feel right to me.  A more substantial change
to mhitm_ad_drin() didn't work as expected so I've settled for this.

Fixes #1378
This commit is contained in:
PatR
2025-02-25 09:54:14 -08:00
parent 76b5bbe693
commit 1fd3bb661f
2 changed files with 14 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 eat.c $NHDT-Date: 1715177703 2024/05/08 14:15:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.334 $ */
/* NetHack 3.7 eat.c $NHDT-Date: 1740534854 2025/02/25 17:54:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.344 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -610,6 +610,12 @@ eat_brains(
boolean give_nutrit = FALSE;
int result = M_ATTK_HIT, xtra_dmg = rnd(10);
/* previous tentacle attack might have triggered fatal passive
counterattack [callers ought to be updated to avoid this situation] */
if (magr != &gy.youmonst && DEADMONSTER(magr)) {
return M_ATTK_AGR_DIED;
}
if (noncorporeal(pd)) {
if (visflag)
pline("%s brain is unharmed.",

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mhitu.c $NHDT-Date: 1721844072 2024/07/24 18:01:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.318 $ */
/* NetHack 3.7 mhitu.c $NHDT-Date: 1740534854 2025/02/25 17:54:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.327 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -486,7 +486,9 @@ mattacku(struct monst *mtmp)
if (!ranged)
nomul(0);
if (DEADMONSTER(mtmp) || (Underwater && !is_swimmer(mtmp->data)))
if (DEADMONSTER(mtmp))
return 1;
if (Underwater && !is_swimmer(mtmp->data))
return 0;
/* If swallowed, can only be affected by u.ustuck */
@@ -741,6 +743,9 @@ mattacku(struct monst *mtmp)
for (i = 0; i < NATTK; i++) {
sum[i] = M_ATTK_MISS;
/* counterattack against attack [i-1] might have been fatal */
if (DEADMONSTER(mtmp))
return 1;
if (i > 0) {
/* recalc in case prior attack moved hero; mtmp doesn't make
another attempt to guess your location but might have