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.
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
/* 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;