From: copperwater Date: Fri, 19 Oct 2018 14:21:25 +0000 (-0400) Subject: Pets will not eat shapeshifter corpses except in extreme circumstances X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f54485b9131fa945ac363e6531edabaa72ddb097;p=nethack Pets will not eat shapeshifter corpses except in extreme circumstances 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 0952a3d27..075f721d5 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/dog.c b/src/dog.c index cce4b1348..45293544f 100644 --- 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;