diff --git a/src/eat.c b/src/eat.c index a73cf2080..b15f36ade 100644 --- a/src/eat.c +++ b/src/eat.c @@ -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.", diff --git a/src/mhitu.c b/src/mhitu.c index 904321a51..32cb68a14 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -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