]> granicus.if.org Git - nethack/commitdiff
Pets will not eat shapeshifter corpses except in extreme circumstances
authorcopperwater <aosdict@gmail.com>
Fri, 19 Oct 2018 14:21:25 +0000 (10:21 -0400)
committerPasi Kallinen <paxed@alt.org>
Sun, 5 Apr 2020 13:01:39 +0000 (16:01 +0300)
Ported from SpliceHack, and generalized to all shapeshifters (Splice
only implemented it for chameleons). It's very aggravating when your
powerful but hungry pet chows down on a shapeshifter before you can stop
them and then turns into something much more useless, so this aims to
prevent that.

The extreme circumstances under which a pet will eat a shapeshifter are:
  1. The pet is starving, and prefers polymorph to starvation
  2. The pet's tameness is 1

The reasoning behind the second condition is that if you mistreat your
pet almost to the point of untaming it, it might want to take a chance
on turning into something that might get some more respect from you.
Practically, whenever this happens, this will result in the player now
owning a newly polymorphed and *still* nearly feral pet.

doc/fixes37.0
src/dog.c

index 0952a3d271084509f321dcf31189a26d37db5bee..075f721d5e01c5044cacfe0aea8df39f2d29161e 100644 (file)
@@ -113,6 +113,7 @@ add a small chance of surviving food poisoning
 deliberate level teleporter activation ignores magic resistance
 auto-id scroll of remove curse when a known buc-state was changed
 demon lords hate Demonbane
+pets avoid eating shapeshifter corpses unless starving or nearly feral
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index cce4b1348e1c12deef384aba079eee44f29ac6b4..45293544f3c153d7114d79b18b36785806db9852 100644 (file)
--- a/src/dog.c
+++ b/src/dog.c
@@ -807,6 +807,17 @@ register struct obj *obj;
             /* turning into slime is preferable to starvation */
             else if (fptr == &mons[PM_GREEN_SLIME] && !slimeproof(mon->data))
                 return starving ? ACCFOOD : POISON;
+            /* polymorphing is preferable to starvation, and the pet might also
+             * want to take their chances on it if they've been mistreated */
+            else if (is_shapeshifter(fptr)) {
+                if (mon->mtame == 1) {
+                    /* A herbivore still won't eat a nonvegan corpse, but in any
+                     * other circumstance a pet with tameness 1 will happily eat
+                     * a shapeshifter. */
+                    return (herbi && !vegan(fptr)) ? MANFOOD : CADAVER;
+                }
+                return starving ? ACCFOOD : MANFOOD;
+            }
             else if (vegan(fptr))
                 return herbi ? CADAVER : MANFOOD;
             /* most humanoids will avoid cannibalism unless starving;