From 0def692d5f99cf344e19f616da4c2097fbaff02b Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 30 Jan 2009 01:44:53 +0000 Subject: [PATCH] probing shapechangers and mimics (trunk only) Mentioned in the newsgroup recently: stethoscope didn't reveal when a monster was actually a chameleon, even though that's the sort of inside information you might expect. This adds "shapechanger" to the other miscellaneous attributes shown. I initially had "(a chameleon)" or "(a vampire lord)" but decided that that was too specific, particularly for the latter where you might expect/hope that the vampire bat next to you is just an ordinary vampire rather than a lord. I had a pet eat a mimic corpse and take on the shape of a pyramidal amulet. Probing described it as "mimicing a pyramidal". Many of the names and descriptions in objects[] are only partial, so aren't suitable for supplying feedback like this (and "mimicking" was misspelled...). Switch to simple_typename(), although in the case of undiscovered amulet it yields just "an amulet" rather than "a pyramidal amulet". This also extends probing feedback for mimicry to include all monsters mimicking something, not just those who are in the midst of eating. [That's post-3.4.3 code and is only applicable for wands of probing. Using a stethoscope or hitting with Magicbane will unhide a mimic before giving extra info about it.] --- src/pline.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/pline.c b/src/pline.c index a4e3e0b6b..a4fe7eb12 100644 --- a/src/pline.c +++ b/src/pline.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)pline.c 3.5 2007/02/09 */ +/* SCCS Id: @(#)pline.c 3.5 2009/01/29 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -351,22 +351,24 @@ register struct monst *mtmp; #endif } else if (mtmp->mpeaceful) Strcat(info, ", peaceful"); + if (mtmp->cham >= LOW_PM && mtmp->data != &mons[mtmp->cham]) + /* don't reveal the innate form (chameleon, vampire, &c), + just expose the fact that this current form isn't it */ + Strcat(info, ", shapechanger"); + /* pets eating mimic corpses mimic while eating, so this comes first */ if (mtmp->meating) Strcat(info, ", eating"); - if (mtmp->meating && (mtmp->cham == NON_PM) && - mtmp->mappearance && mtmp->m_ap_type) { - Sprintf(eos(info), ", mimicing %s", + /* a stethoscope exposes mimic before getting here so this + won't be relevant for it, but wand of probing doesn't */ + if (mtmp->m_ap_type) + Sprintf(eos(info), ", mimicking %s", (mtmp->m_ap_type == M_AP_FURNITURE) ? an(defsyms[mtmp->mappearance].explanation) : - (mtmp->m_ap_type == M_AP_OBJECT && - OBJ_DESCR(objects[mtmp->mappearance])) ? - an(OBJ_DESCR(objects[mtmp->mappearance])) : - (mtmp->m_ap_type == M_AP_OBJECT && - OBJ_NAME(objects[mtmp->mappearance])) ? - an(OBJ_NAME(objects[mtmp->mappearance])) : + (mtmp->m_ap_type == M_AP_OBJECT) ? + ((mtmp->mappearance == GOLD_PIECE) ? "gold" : + an(simple_typename(mtmp->mappearance))) : (mtmp->m_ap_type == M_AP_MONSTER) ? an(mons[mtmp->mappearance].mname) : - something); - } + something); /* impossible... */ if (mtmp->mcan) Strcat(info, ", cancelled"); if (mtmp->mconf) Strcat(info, ", confused"); if (mtmp->mblinded || !mtmp->mcansee)