From: nethack.rankin Date: Tue, 14 Feb 2006 05:27:16 +0000 (+0000) Subject: ghoul fodder (trunk only) X-Git-Tag: MOVE2GIT~1120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a892dbf0c7d101288e47bce8f27592d537038e9;p=nethack ghoul fodder (trunk only) I doubt if many players in nethack ever have pet ghouls (in slash'em they're the necromancer's starting pet), but if so, provide them with a portable food source by letting ghouls eat dead eggs in addition to tainted corpses. Also, let them eat fresher varieties of either when they're about to starve to death. Treat lizard & lichen corpses as always fresh since they never become tainted (probably ruining slash'em necromancers' present pet food of choice, though they'll still be able to eat lizard corspes if starving). I set the omnivore flag in their monster definition. Previously they had been left as non-eaters despite the fact that they need to eat. When the flag wasn't set, a hero who poly'd into one and then put on an amulet of unchanging could go a very long time (thousands of turns) before the hunger imposed by wearing an amulet finally made him/her become hungry. (Same as with any other truely non-eating monster, so not really a big deal.) Also, avoid the expression &mons[obj->corpsenm] for objects where the corpsenm field isn't applicable, in case the default value ever changes from 0 (PM_GIANT_ANT) to NON_PM (-1). --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 3668be89f..75d5a4875 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -177,6 +177,7 @@ keep track of which monsters were cloned from other monsters number_pad:3 run-time option to use inverted phone keypad layout for movement number_pad:-1 to swap function of y and z keys; z to move NW, y to zap wands display spell retention information in the spell menu +tame ghouls can eat old eggs Platform- and/or Interface-Specific New Features diff --git a/src/dog.c b/src/dog.c index 03e4324cb..d463ed0c6 100644 --- a/src/dog.c +++ b/src/dog.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)dog.c 3.5 2006/01/03 */ +/* SCCS Id: @(#)dog.c 3.5 2006/02/13 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -687,7 +687,7 @@ dogfood(mon,obj) struct monst *mon; register struct obj *obj; { - struct permonst *mptr = mon->data, *fptr = &mons[obj->corpsenm]; + struct permonst *mptr = mon->data, *fptr = 0; boolean carni = carnivorous(mptr), herbi = herbivorous(mptr), starving; @@ -696,24 +696,34 @@ register struct obj *obj; switch(obj->oclass) { case FOOD_CLASS: - if (obj->otyp == CORPSE && - ((touch_petrifies(fptr) && !resists_ston(mon)) - || is_rider(fptr))) - return TABU; + if (obj->otyp == CORPSE || obj->otyp == TIN || obj->otyp == EGG) + fptr = &mons[obj->corpsenm]; - /* Ghouls only eat old corpses... yum! */ - if (mptr == &mons[PM_GHOUL]) - return (obj->otyp == CORPSE && - peek_at_iced_corpse_age(obj) + 50L <= monstermoves) ? - DOGFOOD : TABU; - - if (!carni && !herbi) - return (obj->cursed ? UNDEF : APPORT); + if (obj->otyp == CORPSE && is_rider(fptr)) return TABU; + if ((obj->otyp == CORPSE || obj->otyp == EGG) && + touch_petrifies(fptr) && !resists_ston(mon)) return POISON; + if (!carni && !herbi) return obj->cursed ? UNDEF : APPORT; /* a starving pet will eat almost anything */ starving = (mon->mtame && !mon->isminion && EDOG(mon)->mhpmax_penalty); + /* ghouls prefer old corpses and unhatchable eggs, yum! + they'll eat fresh non-veggy corpses and hatchable eggs + when starving; they never eat stone-to-flesh'd meat */ + if (mptr == &mons[PM_GHOUL]) { + if (obj->otyp == CORPSE) + return + (peek_at_iced_corpse_age(obj) + 50L <= monstermoves && + fptr != &mons[PM_LIZARD] && + fptr != &mons[PM_LICHEN]) ? DOGFOOD : + (starving && !vegan(fptr)) ? ACCFOOD : POISON; + if (obj->otyp == EGG) + return stale_egg(obj) ? CADAVER : + starving ? ACCFOOD : POISON; + return TABU; + } + switch (obj->otyp) { case TRIPE_RATION: case MEATBALL: @@ -722,8 +732,6 @@ register struct obj *obj; case HUGE_CHUNK_OF_MEAT: return (carni ? DOGFOOD : MANFOOD); case EGG: - if (touch_petrifies(fptr) && !resists_ston(mon)) - return POISON; return (carni ? CADAVER : MANFOOD); case CORPSE: if ((peek_at_iced_corpse_age(obj) + 50L <= monstermoves diff --git a/src/monst.c b/src/monst.c index 20da9edc5..71d7db135 100644 --- a/src/monst.c +++ b/src/monst.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)monst.c 3.5 2006/01/04 */ +/* SCCS Id: @(#)monst.c 3.5 2006/02/13 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2169,7 +2169,7 @@ struct permonst _mons2[] = { NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(400, 50, MS_SILENT, MZ_SMALL), MR_COLD|MR_SLEEP|MR_POISON, 0, - M1_BREATHLESS|M1_MINDLESS|M1_HUMANOID|M1_POIS, + M1_BREATHLESS|M1_MINDLESS|M1_HUMANOID|M1_POIS|M1_OMNIVORE, M2_UNDEAD|M2_WANDER|M2_HOSTILE, M3_INFRAVISION, CLR_BLACK), MON("giant zombie", S_ZOMBIE, LVL(8, 8, 6, 0, -4), (G_GENO|G_NOCORPSE|1),