]> granicus.if.org Git - nethack/commitdiff
fix #H239 - doppleganger/mimic bug
authornethack.rankin <nethack.rankin>
Fri, 9 Feb 2007 00:25:47 +0000 (00:25 +0000)
committernethack.rankin <nethack.rankin>
Fri, 9 Feb 2007 00:25:47 +0000 (00:25 +0000)
     From a bug report:  a shapechanger
which becomes a mimic would always stay as 'm' rather than take on object
or furniture shape.  Same applied to monsters which hide in other ways.
The code did that deliberately, but I don't think that it's actually
necessary so this lets them mimic/hide when they're in the right shape.
If they change form to non-mimic/hider while concealed, concealment ends.

     It would be fun to have shapechangers-as-mimics actually change their
mimicked shapes periodically, but this doesn't do that.  They'd probably
change to non-mimic quicker than they'd mimic something else so it's not
worth the effort.

doc/fixes34.4
src/mon.c

index 88e7ce4a2c50f0eb0f043892783fcdc0cfe88eb0..97a7376c63a9e08b07ee43513511541d25b79f46 100644 (file)
@@ -311,6 +311,7 @@ fireproof, non-rustable weapon would be revealed as fireproof by hitting a
        rust-causing target; ditto for fixed crysknife
 surviving choking while eating various foods (cockatrice egg, fortune cookie,
        wolfsbane, others) didn't carry through to those foods' side-effects
+shapechangers who take on mimic or hider form will mimic or hide when feasible
 
 
 Platform- and/or Interface-Specific Fixes
index d5103a16215928f407dbf5291d35c1ca3700494b..ff02a58fa15ae6ed1daa8644517c49f63f97bcea 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mon.c      3.5     2007/01/12      */
+/*     SCCS Id: @(#)mon.c      3.5     2007/02/08      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2395,7 +2395,7 @@ register struct monst *mtmp;
 {
        struct trap *t;
 
-       if((mtmp->cham >= LOW_PM) || mtmp->mcan || mtmp->m_ap_type ||
+       if (mtmp->mcan || mtmp->m_ap_type ||
           cansee(mtmp->mx, mtmp->my) || rn2(3) || (mtmp == u.ustuck) ||
           /* can't hide while trapped except in pits */
           (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0 &&
@@ -2646,6 +2646,8 @@ boolean msg;              /* "The oldmon turns into a newmon!" */
                wormgone(mtmp);
                place_monster(mtmp, mtmp->mx, mtmp->my);
        }
+       if (mtmp->m_ap_type && mdat->mlet != S_MIMIC)
+           seemimic(mtmp);     /* revert to normal monster */
 
        /* (this code used to try to adjust the monster's health based on
           a normal one of its type but there are too many special cases