]> granicus.if.org Git - nethack/commitdiff
fix #285 - feeling cockatrice corpse while blind (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 26 Apr 2007 02:19:25 +0000 (02:19 +0000)
committernethack.rankin <nethack.rankin>
Thu, 26 Apr 2007 02:19:25 +0000 (02:19 +0000)
     From a bug report:  moving while blind
and gloveless onto spot containing a cockatrice corpse is fatal if there
are fewer than 5 items there, but harmless when you get the "there are
several/many objects here" result for 5 or more.  I thought that this was
something which had already been changed, but it wasn't.  Run a touch
check on the whole pile of objects even when no object-by-object feedback
is being given.

     Trunk only because it's using the trunk version of corpse_xname().

doc/fixes35.0
src/invent.c

index fc9fe04fd005e45678fcbcb318a68d73c2c5ae98..73e810599e9457ed4760bcf46756f99c6d328c77 100644 (file)
@@ -221,6 +221,8 @@ salamanders can use green slime corpses to cure themselves of petrification
 feedback about summoned monsters may use singular when it should use plural
 rogue's backstab bonus doesn't apply for throwing attacks
 hiding monsters who are unhidden when hero leaves a level can hide upon return
+touching a pile of objects while blind affects hero even when the pile is
+       big enough to give "there are many objects here" and not list them
 
 
 Platform- and/or Interface-Specific Fixes
index e2eb553b648c76c1fbc2b28e411c95b6bc7dc045..d79cc37b1141cb95dd31ae9db8594c2322910cb2 100644 (file)
@@ -2383,14 +2383,16 @@ boolean picked_some;
 
        if (Blind) {
                boolean drift = Is_airlevel(&u.uz) || Is_waterlevel(&u.uz);
+
                if (dfeature && !strncmp(dfeature, "altar ", 6)) {
                    /* don't say "altar" twice, dfeature has more info */
                    You("try to feel what is here.");
                } else {
                    const char *where = (Blind && !can_reach_floor(TRUE)) ?
-                                     "lying beneath you" : "lying here on the ",
-                             *onwhat = (Blind && !can_reach_floor(TRUE)) ?
-                                       "" : surface(u.ux,u.uy);
+                                   "lying beneath you" : "lying here on the ",
+                             *onwhat = (Blind && !can_reach_floor(TRUE)) ?
+                                       "" : surface(u.ux,u.uy);
+
                    You("try to feel what is %s%s.",
                        drift ? "floating here" : where,
                        drift ? ""              : onwhat);
@@ -2421,6 +2423,15 @@ boolean picked_some;
            There("are %s%s objects here.",
                  (obj_cnt <= 10) ? "several" : "many",
                  picked_some ? " more" : "");
+           for ( ; otmp; otmp = otmp->nexthere)
+               if (otmp->otyp == CORPSE && will_feel_cockatrice(otmp, FALSE)) {
+                   pline("Including %s%s.",
+                         corpse_xname(otmp, (const char *)0, CXN_ARTICLE),
+                         poly_when_stoned(youmonst.data) ? "" :
+                           ", unfortunately");
+                   feel_cockatrice(otmp, FALSE);
+                   break;
+               }
        } else if (!otmp->nexthere) {
            /* only one object */
            if (dfeature) pline(fbuf);
@@ -2471,8 +2482,9 @@ struct obj *otmp;
 boolean force_touch;
 {
        if ((Blind || force_touch) && !uarmg && !Stone_resistance &&
-               (otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm])))
-                       return TRUE;
+               (otmp->otyp == CORPSE &&
+                touch_petrifies(&mons[otmp->corpsenm])))
+           return TRUE;
        return FALSE;
 }
 
@@ -2484,14 +2496,18 @@ boolean force_touch;
        char kbuf[BUFSZ];
 
        if (will_feel_cockatrice(otmp, force_touch)) {
-           if(poly_when_stoned(youmonst.data))
-                       You("touched the %s corpse with your bare %s.",
-                               mons[otmp->corpsenm].mname, makeplural(body_part(HAND)));
+           /* "the <cockatrice> corpse" */
+           Strcpy(kbuf, corpse_xname(otmp, (const char *)0, CXN_PFX_THE));
+
+           if (poly_when_stoned(youmonst.data))
+               You("touched %s with your bare %s.",
+                   kbuf, makeplural(body_part(HAND)));
            else
-                       pline("Touching the %s corpse is a fatal mistake...",
-                               mons[otmp->corpsenm].mname);
-               Sprintf(kbuf, "%s corpse", an(mons[otmp->corpsenm].mname));
-               instapetrify(kbuf);
+               pline("Touching %s is a fatal mistake...", kbuf);
+           /* normalize body shape here; hand, not body_part(HAND) */
+           Sprintf(kbuf, "touching %s bare-handed", killer_xname(otmp));
+           /* will call polymon() for the poly_when_stoned() case */
+           instapetrify(kbuf);
        }
 }