mimicking slime molds

Mimic-as-slime_mold needs to keep track of the fruit index the same
way that mimic-as-corpse keeps track of corpse's monster type.  The
mimic description was changing (for '/' and ';' feedback) whenever
the player assiged a new fruit name.

That wasn't noticeable when applying a stethoscope because
mimic-as-slime_mold always yielded "that fruit is really a mimic".
Change it to report the fruit's type instead of generic "fruit".
This commit is contained in:
PatR
2019-10-19 17:38:27 -07:00
parent c099e0a1ff
commit bf7e955645
6 changed files with 49 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1570569787 2019/10/08 21:23:07 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.140 $ */
/* NetHack 3.6 makemon.c $NHDT-Date: 1571531888 2019/10/20 00:38:08 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.141 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2245,6 +2245,18 @@ register struct monst *mtmp;
newmcorpsenm(mtmp);
MCORPSENM(mtmp) = mndx;
} else if (ap_type == M_AP_OBJECT && appear == SLIME_MOLD) {
newmcorpsenm(mtmp);
MCORPSENM(mtmp) = context.current_fruit;
/* if no objects of this fruit type have been created yet,
context.current_fruit is available for re-use when the player
assigns a new fruit name; override that--having a mimic as the
current_fruit is equivalent to creating an instance of that
fruit (no-op if a fruit of this type has actually been made) */
flags.made_fruit = TRUE;
} else if (has_mcorpsenm(mtmp)) {
/* don't retain stale value from a previously mimicked shape */
MCORPSENM(mtmp) = NON_PM;
}
if (does_block(mx, my, &levl[mx][my]))