From ace5a30ab575213a3cf9fdd0c9885f14b32b351a Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 26 Apr 2007 02:19:25 +0000 Subject: [PATCH] fix #285 - feeling cockatrice corpse while blind (trunk only) 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 | 2 ++ src/invent.c | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index fc9fe04fd..73e810599 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/src/invent.c b/src/invent.c index e2eb553b6..d79cc37b1 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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 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); } } -- 2.40.0