From: nethack.rankin Date: Mon, 9 Sep 2002 09:02:21 +0000 (+0000) Subject: intrinsics of dead monsters X-Git-Tag: MOVE2GIT~2431 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=786ed937512370366a478feb9fe7c3f66cd8e5bc;p=nethack intrinsics of dead monsters Monster traits that are used to revive some corpses or statues with their old attributes were retaining intrinsics conferred by worn items. To prevent that, strip such attributes at time of a monster's death before the traits are recorded. Statue handling needs to some more work; now that extra speed is lost, there's an out of place message if/when a revived statue gets to put on its old speed boots. --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 1be5488b2..e8ed3f6e4 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -238,6 +238,8 @@ fix enlightenment feedback for bonus or penalty on damage and chance to hit effects of purple worms consuming special monsters is now more consistent across eating, digesting and dropped corpses while engulfed avoid "you finish disrobing" when disarming via the 'A' command +make sure corpses and statues which remember monster attributes don't keep + ones that were conferred by no longer worn items (mainly speed boots) Platform- and/or Interface-Specific Fixes diff --git a/src/mon.c b/src/mon.c index f01cf85ab..34627fde1 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1540,7 +1540,7 @@ void monstone(mdef) register struct monst *mdef; { - struct obj *otmp, *obj; + struct obj *otmp, *obj, *oldminvent; xchar x = mdef->mx, y = mdef->my; boolean wasinside = FALSE; @@ -1555,12 +1555,17 @@ register struct monst *mdef; if ((int)mdef->data->msize > MZ_TINY || !rn2(2 + ((int) (mdef->data->geno & G_FREQ) > 2))) { - otmp = mkcorpstat(STATUE, KEEPTRAITS(mdef) ? mdef : 0, - mdef->data, x, y, FALSE); - if (mdef->mnamelth) otmp = oname(otmp, NAME(mdef)); + oldminvent = 0; /* some objects may end up outside the statue */ while ((obj = mdef->minvent) != 0) { obj_extract_self(obj); + if (obj->owornmask) { + /* don't want map updates if invisibility + toggles or messages if speed changes */ + in_mklev = TRUE; + update_mon_intrinsics(mdef, obj, FALSE); + in_mklev = FALSE; + } obj_no_longer_held(obj); if (obj->owornmask & W_WEP) setmnotwielded(mdef,obj); @@ -1574,9 +1579,20 @@ register struct monst *mdef; place_object(obj, x, y); } else { if (obj->lamplit) end_burn(obj, TRUE); - (void) add_to_container(otmp, obj); + obj->nobj = oldminvent; + oldminvent = obj; } } + /* defer statue creation until after inventory removal + so that saved monster traits won't retain any stale + item-conferred attributes */ + otmp = mkcorpstat(STATUE, KEEPTRAITS(mdef) ? mdef : 0, + mdef->data, x, y, FALSE); + if (mdef->mnamelth) otmp = oname(otmp, NAME(mdef)); + while ((obj = oldminvent) != 0) { + oldminvent = obj->nobj; + (void) add_to_container(otmp, obj); + } #ifndef GOLDOBJ if (mdef->mgold) { struct obj *au; diff --git a/src/steal.c b/src/steal.c index 922ca6094..a65a54549 100644 --- a/src/steal.c +++ b/src/steal.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)steal.c 3.4 2002/03/29 */ +/* SCCS Id: @(#)steal.c 3.4 2002/09/07 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -554,6 +554,14 @@ boolean is_pet; /* If true, pet should keep wielded/worn items */ costly_spot(mtmp->mx, mtmp->my)) otmp->no_charge = 1; #endif + if (otmp->owornmask) { + /* don't want map updates if invisibility + toggles or messages if speed changes */ + in_mklev = TRUE; + update_mon_intrinsics(mtmp, otmp, FALSE); + in_mklev = FALSE; + } + /* obj_no_longer_held(otmp); -- done by place_object */ if (otmp->owornmask & W_WEP) setmnotwielded(mtmp, otmp); otmp->owornmask = 0L;