From: PatR Date: Sat, 21 Nov 2020 02:56:35 +0000 (-0800) Subject: create monster creating concealed mimic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03d7d64d1556919cbeb830befb2db7d4be4899db;p=nethack create monster creating concealed mimic From an old bug report (sent directly to devteam, June of 2017): wand or scroll of create monster becomes discovered if it makes a mimic that is concealed as an object or as furniture within the hero's view. Fixing this in the general case [when does seeing a mimic as something other than a monster mean that the mimic is being seen?] is a massive can of worms, but fixing this specific case is trivial. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index caaf3fa64..83aa7625f 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.356 $ $NHDT-Date: 1605726848 2020/11/18 19:14:08 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.357 $ $NHDT-Date: 1605927391 2020/11/21 02:56:31 $ General Fixes and Modified Features ----------------------------------- @@ -300,6 +300,9 @@ since ki-rin look quite a bit like unicorns, make them be more like one: allow them to use their own horn to cure themselves; remove M1_ANIMAL, change MS_NEIGH to MS_SPELL, add MR_POISON; they're still 'A' rather than 'u' and don't care about gems +wand or scroll of create monster that makes a new monster which can be seen + or sensed becomes discovered but was doing so even for a concealed + mimic seen as furniture or an object Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/include/display.h b/include/display.h index 721b7f10b..28c02becd 100644 --- a/include/display.h +++ b/include/display.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 display.h $NHDT-Date: 1597700875 2020/08/17 21:47:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */ +/* NetHack 3.7 display.h $NHDT-Date: 1605927391 2020/11/21 02:56:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.48 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -69,6 +69,15 @@ enum explosion_types { * hero can physically see the location of the monster. The function * vobj_at() returns a pointer to an object that the hero can see there. * Infravision is not taken into account. + * + * Note: not reliable for concealed mimics. They don't have + * 'mon->mundetected' set even when mimicking objects or furniture. + * [Fixing this with a pair of mon->m_ap_type checks here (via either + * 'typ!=object && typ!=furniture' or 'typ==nothing || typ==monster') + * will require reviewing every instance of mon_visible(), canseemon(), + * canspotmon(), is_safemon() and perhaps others. Fixing it by setting + * mon->mundetected when concealed would be better but also require + * reviewing all those instances and also existing mundetected instances.] */ #if 0 #define mon_visible(mon) \ diff --git a/src/makemon.c b/src/makemon.c index abf074fd5..67cc83452 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 makemon.c $NHDT-Date: 1596498176 2020/08/03 23:42:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.177 $ */ +/* NetHack 3.7 makemon.c $NHDT-Date: 1605927392 2020/11/21 02:56:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.179 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1503,7 +1503,8 @@ boolean neverask; x = c.x, y = c.y; mon = makemon(mptr, x, y, NO_MM_FLAGS); - if (mon && canspotmon(mon)) + if (mon && canspotmon(mon) && (M_AP_TYPE(mon) == M_AP_NOTHING + || M_AP_TYPE(mon) == M_AP_MONSTER)) known = TRUE; } return known;