]> granicus.if.org Git - nethack/commitdiff
purple worms affected by corpses
authorcohrs <cohrs>
Sun, 1 Sep 2002 14:57:28 +0000 (14:57 +0000)
committercohrs <cohrs>
Sun, 1 Sep 2002 14:57:28 +0000 (14:57 +0000)
Forwarded from the newsgroup as noting that dropping a chameleon corpse
into a purple worm did not cause polymorph nor will the digestion attack.
Added code to dropy and mdamagem to include special corpse effects like
those in dog_eat and meatobj.

doc/fixes34.1
src/do.c
src/mhitm.c

index a1cacce854381cf830be0c8a2daabb38ee27d26c..1e9ac673f0c8b07bb1206ff991af2d5bd2b16174 100644 (file)
@@ -235,6 +235,8 @@ if you have converted, the quest leader banishes you instead of asking you
 don't state that "you narrowly avoid losing all chance" message if you try
        to put on a helm of opposite alignment in the quest after converting
 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
 
 
 Platform- and/or Interface-Specific Fixes
index 35eef72f37f09f57179eb3ce2a49577dc6ed84af..9c643913dcbab4df0dedec090d93ba15d5f9a7a9 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -517,15 +517,39 @@ register struct obj *obj;
        if (!u.uswallow && flooreffects(obj,u.ux,u.uy,"drop")) return;
        /* uswallow check done by GAN 01/29/87 */
        if(u.uswallow) {
-           boolean could_petrify;
+           boolean could_petrify = FALSE;
+           boolean could_poly = FALSE;
+           boolean could_slime = FALSE;
+           boolean could_grow = FALSE;
+           boolean could_heal = FALSE;
+
            if (obj != uball) {         /* mon doesn't pick up ball */
-               could_petrify = obj->otyp == CORPSE &&
-                   touch_petrifies(&mons[obj->corpsenm]);
+               if (obj->otyp == CORPSE) {
+                   could_petrify = touch_petrifies(&mons[obj->corpsenm]);
+                   could_poly = polyfodder(obj);
+                   could_slime = (obj->corpsenm == PM_GREEN_SLIME);
+                   could_grow = (obj->corpsenm == PM_WRAITH);
+                   could_heal = (obj->corpsenm == PM_NURSE);
+               }
                (void) mpickobj(u.ustuck,obj);
-               if (could_petrify && is_animal(u.ustuck->data)) {
-                   minstapetrify(u.ustuck, TRUE);
-                   /* Don't leave a cockatrice corpse available in a statue */
-                   if (!u.uswallow) delobj(obj);
+               if (is_animal(u.ustuck->data)) {
+                   if (could_poly || could_slime) {
+                       (void) newcham(u.ustuck,
+                                      could_poly ? (struct permonst *)0 :
+                                      &mons[PM_GREEN_SLIME],
+                                      FALSE, could_slime);
+                       delobj(obj);    /* corpse is digested */
+                   } else if (could_petrify) {
+                       minstapetrify(u.ustuck, TRUE);
+                       /* Don't leave a cockatrice corpse in a statue */
+                       if (!u.uswallow) delobj(obj);
+                   } else if (could_grow) {
+                       (void) grow_up(u.ustuck, (struct monst *)0);
+                       delobj(obj);    /* corpse is digested */
+                   } else if (could_heal) {
+                       u.ustuck->mhp = u.ustuck->mhpmax;
+                       delobj(obj);    /* corpse is digested */
+                   }
                }
            }
        } else  {
index 7ba9575c9ee1944e976724d3eff5240e22f8a1f8..1768b45fe238f0d3ad2bed46b0fc2bce42f516fd 100644 (file)
@@ -1095,6 +1095,23 @@ label2:                  if (mdef->mhp > 0) return 0;
            }
            monkilled(mdef, "", (int)mattk->adtyp);
            if (mdef->mhp > 0) return 0; /* mdef lifesaved */
+
+           if (mattk->adtyp == AD_DGST) {
+               /* various checks similar to dog_eat and meatobj.
+                * after monkilled() to provide better message ordering */
+               if (mdef->cham != CHAM_ORDINARY) {
+                   (void) newcham(magr, (struct permonst *)0, FALSE, TRUE);
+               } else if (mdef->data == &mons[PM_GREEN_SLIME]) {
+                   (void) newcham(magr, &mons[PM_GREEN_SLIME], FALSE, TRUE);
+               } else if (mdef->data == &mons[PM_WRAITH]) {
+                   (void) grow_up(magr, (struct monst *)0);
+                   /* don't grow up twice */
+                   return (MM_DEF_DIED | (magr->mhp > 0 ? 0 : MM_AGR_DIED));
+               } else if (mdef->data == &mons[PM_NURSE]) {
+                   magr->mhp = magr->mhpmax;
+               }
+           }
+
            return (MM_DEF_DIED | (grow_up(magr,mdef) ? 0 : MM_AGR_DIED));
        }
        return(MM_HIT);