monsters eating green slime corpses (trunk only)

From a bug report, pets able to eat
acidic and poisonous corpses (black naga was the case cited) would eat
green slime corpses without turning into green slime, unlike the hero.
This prevents such monsters from eating green slime unless they're
starving, implements transformation into green slime for the case where
it does get eaten, and prevents non-pet gelatinous cubes from devouring
such corpses.  meatobj() is reorganized to hopefully become clearer, and
it removes the assumption that the object eater is a g.cube in case we
ever adopt slash'em's "tasmanian devil" monster.

     Monsters with digestion attacks who swallow green slime monsters
are turned into green slime, but ones who swallow hero poly'd into green
slime are not.  This doesn't address that.
This commit is contained in:
nethack.rankin
2008-10-25 01:04:04 +00:00
parent 3425a19dff
commit bb5820b493
4 changed files with 78 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dogmove.c 3.5 2007/08/20 */
/* SCCS Id: @(#)dogmove.c 3.5 2008/10/20 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -200,7 +200,7 @@ int x, y; /* dog's starting location, might be different from current */
boolean devour;
{
register struct edog *edog = EDOG(mtmp);
boolean poly = FALSE, grow = FALSE, heal = FALSE, deadmimic;
boolean poly, grow, heal, slimer, deadmimic;
int nutrit;
long oprice;
char objnambuf[BUFSZ];
@@ -214,10 +214,11 @@ boolean devour;
(obj->corpsenm == PM_SMALL_MIMIC ||
obj->corpsenm == PM_LARGE_MIMIC ||
obj->corpsenm == PM_GIANT_MIMIC));
slimer = (obj->otyp == CORPSE && obj->corpsenm == PM_GREEN_SLIME);
poly = polyfodder(obj);
grow = mlevelgain(obj);
heal = mhealup(obj);
if (devour) {
if (mtmp->meating > 1) mtmp->meating /= 2;
if (nutrit > 1) nutrit = (nutrit * 3) / 4;
@@ -300,9 +301,19 @@ boolean devour;
delobj(obj);
}
if (poly) {
(void) newcham(mtmp, (struct permonst *)0, FALSE,
cansee(mtmp->mx, mtmp->my));
#if 0 /* pet is eating, so slime recovery is not feasible... */
/* turning into slime might be cureable */
if (slimer && munslime(mtmp, FALSE)) {
/* but the cure (fire directed at self) might be fatal */
if (mtmp->mhp < 1) return 2;
slimer = FALSE; /* sliming is avoided, skip polymorph */
}
#endif
if (poly || slimer) {
struct permonst *ptr = slimer ? &mons[PM_GREEN_SLIME] : 0;
(void) newcham(mtmp, ptr, FALSE, cansee(mtmp->mx, mtmp->my));
}
/* limit "instant" growth to prevent potential abuse */