From 2b62b81fe4f33522fb287f5f2bb54dd474f93488 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 3 Feb 2005 04:12:28 +0000 Subject: [PATCH] medusa meat Someone in the newsgroup mentioned that there is no warning from blessed food detection if you attempt to eat a tin of Medusa meat. touch_petrifies() isn't enough to catch that. A warning was given about Medusa's corpse, but only if you lacked poison resistance. Eating a tainted Medusa corpse had a similar problem; the check to override food poisoning so that petrification takes effect missed it. This makes the petrification checks be consistent, including hypothetical case of Medusa egg. --- doc/fixes34.4 | 2 ++ src/eat.c | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 5d6733ba3..df686a417 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -83,6 +83,8 @@ give correct message when a spellcasting monster summons other monsters correct experience calculation for monsters that cause nonphysical damage monsters evading a kick on noteleport levels would cause a "teleports" message interrupt current activity during certain stages of petrification or vomiting +warning about bad food didn't recognize tin of Medusa meat +eating tainted Medusa corpse caused food poisioning instead of petrification Platform- and/or Interface-Specific Fixes diff --git a/src/eat.c b/src/eat.c index a4a6c583b..784ba9efd 100644 --- a/src/eat.c +++ b/src/eat.c @@ -58,6 +58,9 @@ char msgbuf[BUFSZ]; /* also used to see if you're allowed to eat cats and dogs */ #define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC)) +/* monster types that cause hero to be turned into stone if eaten */ +#define flesh_petrifies(pm) (touch_petrifies(pm) || (pm) == &mons[PM_MEDUSA]) + STATIC_OVL NEARDATA const char comestibles[] = { FOOD_CLASS, 0 }; /* Gold must come first for getobj(). */ @@ -447,7 +450,7 @@ cprefx(pm) register int pm; { (void) maybe_cannibal(pm,TRUE); - if (touch_petrifies(&mons[pm]) || pm == PM_MEDUSA) { + if (flesh_petrifies(&mons[pm])) { if (!Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { Sprintf(killer.name, "tasting %s meat", mons[pm].mname); @@ -1304,7 +1307,8 @@ eatcorpse(otmp) /* called when a corpse is selected as food */ long rotted = 0L; boolean uniq = !!(mons[mnum].geno & G_UNIQ); int retcode = 0; - boolean stoneable = (touch_petrifies(&mons[mnum]) && !Stone_resistance && + boolean stoneable = (flesh_petrifies(&mons[mnum]) && + !Stone_resistance && !poly_when_stoned(youmonst.data)); /* KMH, conduct */ @@ -1782,9 +1786,10 @@ register struct obj *otmp; if(!otmp->cursed) heal_legs(); break; case EGG: - if (touch_petrifies(&mons[otmp->corpsenm])) { + if (flesh_petrifies(&mons[otmp->corpsenm])) { if (!Stone_resistance && - !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { + !(poly_when_stoned(youmonst.data) && + polymon(PM_STONE_GOLEM))) { if (!Stoned) { Stoned = 5; Sprintf(killer.name, @@ -1833,7 +1838,7 @@ struct obj *otmp; if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) { /* These checks must match those in eatcorpse() */ - stoneorslime = (touch_petrifies(&mons[mnum]) && + stoneorslime = (flesh_petrifies(&mons[mnum]) && !Stone_resistance && !poly_when_stoned(youmonst.data));