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.
This commit is contained in:
nethack.rankin
2002-09-09 09:02:21 +00:00
parent b8f368ced4
commit 786ed93751
3 changed files with 32 additions and 6 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;