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
+3 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.143 $ $NHDT-Date: 1571448220 2019/10/19 01:23:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.145 $ $NHDT-Date: 1571531885 2019/10/20 00:38:05 $
This fixes36.3 file is here to capture information about updates in the 3.6.x This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however, lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -202,6 +202,8 @@ in a shop which doesn't care about tools: You drop a <box> containing 1 item.
item in it even though shk was only offering to buy its contents] item in it even though shk was only offering to buy its contents]
grammar correction for "That walking shoes is really a small mimic" when grammar correction for "That walking shoes is really a small mimic" when
applying a stethoscope applying a stethoscope
mimic immitating a slime mold would change fruit type when player assigned new
named fruit
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
+3 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mextra.h $NHDT-Date: 1547428759 2019/01/14 01:19:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.22 $ */ /* NetHack 3.6 mextra.h $NHDT-Date: 1571531885 2019/10/20 00:38:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.23 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -179,7 +179,8 @@ struct mextra {
struct eshk *eshk; struct eshk *eshk;
struct emin *emin; struct emin *emin;
struct edog *edog; struct edog *edog;
int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse */ int mcorpsenm; /* obj->corpsenm for mimic posing as statue or corpse, or
* obj->spe (fruit index) for one posing as a slime mold */
}; };
#define MNAME(mon) ((mon)->mextra->mname) #define MNAME(mon) ((mon)->mextra->mname)
+14 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 apply.c $NHDT-Date: 1568922511 2019/09/19 19:48:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.277 $ */ /* NetHack 3.6 apply.c $NHDT-Date: 1571531886 2019/10/20 00:38:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.279 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -388,8 +388,20 @@ register struct obj *obj;
switch (M_AP_TYPE(mtmp)) { switch (M_AP_TYPE(mtmp)) {
case M_AP_OBJECT: case M_AP_OBJECT:
/* FIXME?
* we should probably be using object_from_map() here
*/
odummy = init_dummyobj(&dummyobj, mtmp->mappearance, 1L); odummy = init_dummyobj(&dummyobj, mtmp->mappearance, 1L);
what = simple_typename(odummy->otyp); /* simple_typename() yields "fruit" for any named fruit;
we want the same thing '//' or ';' shows: "slime mold"
or "grape" or "slice of pizza" */
if (odummy->otyp == SLIME_MOLD
&& has_mcorpsenm(mtmp) && MCORPSENM(mtmp) != NON_PM) {
odummy->spe = MCORPSENM(mtmp);
what = simpleonames(odummy);
} else {
what = simple_typename(odummy->otyp);
}
use_plural = (is_boots(odummy) || is_gloves(odummy) use_plural = (is_boots(odummy) || is_gloves(odummy)
|| odummy->otyp == LENSES); || odummy->otyp == LENSES);
break; break;
+13 -1
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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2245,6 +2245,18 @@ register struct monst *mtmp;
newmcorpsenm(mtmp); newmcorpsenm(mtmp);
MCORPSENM(mtmp) = mndx; 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])) if (does_block(mx, my, &levl[mx][my]))
+4 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1570872702 2019/10/12 09:31:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.155 $ */ /* NetHack 3.6 mkobj.c $NHDT-Date: 1571531889 2019/10/20 00:38:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.157 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2474,7 +2474,6 @@ struct monst *mon;
* Initialize a dummy obj with just enough info * Initialize a dummy obj with just enough info
* to allow some of the tests in obj.h that * to allow some of the tests in obj.h that
* take an obj pointer to work. * take an obj pointer to work.
*
*/ */
struct obj * struct obj *
init_dummyobj(obj, otyp, oquan) init_dummyobj(obj, otyp, oquan)
@@ -2487,17 +2486,16 @@ long oquan;
obj->otyp = otyp; obj->otyp = otyp;
obj->oclass = objects[otyp].oc_class; obj->oclass = objects[otyp].oc_class;
/* obj->dknown = 0; */ /* obj->dknown = 0; */
/* suppress known except for amulets (needed for fakes and real A-of-Y) */ /* suppress known except for amulets (needed for fakes & real AoY) */
obj->known = (obj->oclass == AMULET_CLASS) obj->known = (obj->oclass == AMULET_CLASS)
? obj->known ? obj->known
/* default is "on" for types which don't use it */ /* default is "on" for types which don't use it */
: !objects[otyp].oc_uses_known; : !objects[otyp].oc_uses_known;
obj->quan = oquan ? oquan : 1L; obj->quan = oquan ? oquan : 1L;
obj->corpsenm = NON_PM; /* suppress statue and figurine details */ obj->corpsenm = NON_PM; /* suppress statue and figurine details */
/* but suppressing fruit details leads to "bad fruit #0" /* but suppressing fruit details leads to "bad fruit #0" */
[perhaps we should force "slime mold" rather than use xname?] */
if (obj->otyp == SLIME_MOLD) if (obj->otyp == SLIME_MOLD)
obj->spe = 1; obj->spe = context.current_fruit;
} }
return obj; return obj;
} }
+12 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pager.c $NHDT-Date: 1570142734 2019/10/03 22:45:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.156 $ */ /* NetHack 3.6 pager.c $NHDT-Date: 1571531890 2019/10/20 00:38:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.157 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -190,12 +190,19 @@ struct obj **obj_p;
otmp->quan = 2L; /* to force pluralization */ otmp->quan = 2L; /* to force pluralization */
else if (otmp->otyp == SLIME_MOLD) else if (otmp->otyp == SLIME_MOLD)
otmp->spe = context.current_fruit; /* give it a type */ otmp->spe = context.current_fruit; /* give it a type */
if (mtmp && has_mcorpsenm(mtmp)) /* mimic as corpse/statue */ if (mtmp && has_mcorpsenm(mtmp)) { /* mimic as corpse/statue */
otmp->corpsenm = MCORPSENM(mtmp); if (otmp->otyp == SLIME_MOLD)
else if (otmp->otyp == CORPSE && glyph_is_body(glyph)) /* override context.current_fruit to avoid
look, use 'O' to make new named fruit, look again
giving different results when current_fruit changes */
otmp->spe = MCORPSENM(mtmp);
else
otmp->corpsenm = MCORPSENM(mtmp);
} else if (otmp->otyp == CORPSE && glyph_is_body(glyph)) {
otmp->corpsenm = glyph - GLYPH_BODY_OFF; otmp->corpsenm = glyph - GLYPH_BODY_OFF;
else if (otmp->otyp == STATUE && glyph_is_statue(glyph)) } else if (otmp->otyp == STATUE && glyph_is_statue(glyph)) {
otmp->corpsenm = glyph - GLYPH_STATUE_OFF; otmp->corpsenm = glyph - GLYPH_STATUE_OFF;
}
if (otmp->otyp == LEASH) if (otmp->otyp == LEASH)
otmp->leashmon = 0; otmp->leashmon = 0;
/* extra fields needed for shop price with doname() formatting */ /* extra fields needed for shop price with doname() formatting */