]> granicus.if.org Git - nethack/commitdiff
medusa meat
authornethack.rankin <nethack.rankin>
Thu, 3 Feb 2005 04:12:28 +0000 (04:12 +0000)
committernethack.rankin <nethack.rankin>
Thu, 3 Feb 2005 04:12:28 +0000 (04:12 +0000)
     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
src/eat.c

index 5d6733ba34de73a144cb1a66ef9e0f919f165b60..df686a4172d34b4d9b2a11efa068699586b48654 100644 (file)
@@ -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
index a4a6c583bc07f4291b38e5546464cd59799325fa..784ba9efdd184444aa131ea81e55efee5de212df 100644 (file)
--- 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));