purple worms affected by corpses

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.
This commit is contained in:
cohrs
2002-09-01 14:57:28 +00:00
parent c33417fc05
commit 15240f55cd
3 changed files with 50 additions and 7 deletions

View File

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

View 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);