]> granicus.if.org Git - nethack/commitdiff
ghoul fodder (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 14 Feb 2006 05:27:16 +0000 (05:27 +0000)
committernethack.rankin <nethack.rankin>
Tue, 14 Feb 2006 05:27:16 +0000 (05:27 +0000)
     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).

doc/fixes35.0
src/dog.c
src/monst.c

index 3668be89fced7a1e2f039b9e9d2490661096703e..75d5a48755421ea8f9091f4065168cad1ed66f97 100644 (file)
@@ -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
index 03e4324cbebf7926ab3a20a2fe490b828962cc1f..d463ed0c6e681caadd5ccf36999f5c474749111c 100644 (file)
--- 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
index 20da9edc55356eb67d3809dafc63e3c3b9e8f28e..71d7db135951ec28f60d6e5061f8e8ec1d4863b6 100644 (file)
@@ -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),