]> granicus.if.org Git - nethack/commitdiff
intrinsics of dead monsters
authornethack.rankin <nethack.rankin>
Mon, 9 Sep 2002 09:02:21 +0000 (09:02 +0000)
committernethack.rankin <nethack.rankin>
Mon, 9 Sep 2002 09:02:21 +0000 (09:02 +0000)
     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.

doc/fixes34.1
src/mon.c
src/steal.c

index 1be5488b2493c6437d7dfa2d04bde2ce30512f9d..e8ed3f6e436703ecff0705dd44e4d5e067e175a9 100644 (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
index f01cf85ab90aa3b49b620b55e89e2e8cdb1b2bcd..34627fde10b2d38c27fee2c6c9c4f6bda33edd06 100644 (file)
--- 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;
index 922ca609424984c7d0a52f7520b96a36a018ab31..a65a54549552be612f94f9b6b6011c3fca5cf66e 100644 (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;