fix github issue #1186 - eating Medusa's corpse

and having temporary stoning resistance timeout before finishing.

Issue reported by Umbire:  hero was able to finish eating Medusa's
corpse safely after getting the message about no longer being
protected against stoning that is given when temporary resistance
times out.

The eating code was extending temporary resistance--when eating
something protected by such--to avoid just that.  I thought this
was probably a message sequencing situation but it turns out that
the code was using touch_petrifies() to test the meal.  It should
use flesh_petrifies() instead; Medusa doesn't pass touch_petrifies().

I didn't figure that out until after rewriting how the duration is
extended.  The old way probably would have worked as desired with
the revised petrify test but I'm checking in the new version anyway.

Fixes #1186
This commit is contained in:
PatR
2023-12-23 17:38:05 -08:00
parent 35eb289cc3
commit 05cf948007
4 changed files with 58 additions and 25 deletions

View File

@@ -775,15 +775,33 @@ nh_timeout(void)
}
break;
case ACID_RES:
if (!Acid_resistance && !Unaware)
You("no longer feel safe from acid.");
if (!Acid_resistance) {
if (eating_dangerous_corpse(ACID_RES)) {
/* extend temporary acid resistance if in midst
of eating an acidic corpse; this will repeat
until eating is finished or interrupted */
set_itimeout(&u.uprops[ACID_RES].intrinsic, 1L);
break;
}
if (!Unaware)
You("no longer feel safe from acid.");
}
break;
case STONE_RES:
if (!Stone_resistance) {
if (eating_dangerous_corpse(STONE_RES)) {
/* extend temporary stoning resistance if in midst
of eating a stoning corpse; this will repeat
until eating is finished or interrupted */
set_itimeout(&u.uprops[STONE_RES].intrinsic, 1L);
break;
}
if (!Unaware)
You("no longer feel secure from petrification.");
/* no-op if not wielding a cockatrice corpse;
uswapwep case is always a no-op (see Gloves_off()) */
uswapwep case is always a no-op because two-weapon
combat is only possible with two one-handed weapons
or weapon tools, not corpses */
wielding_corpse(uwep, (struct obj *) 0, FALSE);
wielding_corpse(uswapwep, (struct obj *) 0, FALSE);
}