Fix: starving herbivore pet vs polymorphing corpse

The special handling of polymorphing corpses included an "is acceptable
food if starving" rule which ignored the pet's other food preferences,
so a starving herbivorous pet would become willing to eat a
non-vegetarian corpse iff the corpse would polymorph it when eaten.
Along the same lines but latent: if there were a vegan polymorphing
corpse, a carnivorous pet would eat it not only if starving, but also if
maltreated and on the verge of becoming feral.

Instead of trying to fix this by reimplementing all the herbi vs carni
rules specifically for polymorphing corpses, just have a "don't eat
polymorphing corpses if neither starving nor almost untame" rule, and
fall back to the normal palatable corpses tests once it's been
determined that the pet is willing to eat even a polymorphing corpse.

I rephrased the comment just to make it negative (about avoiding
polymorph, rather than polymorph being OK under certain circumstances)
to match the new form of the rule.
This commit is contained in:
Michael Meyer
2022-09-20 17:25:18 -07:00
committed by PatR
parent 169258d608
commit 951a99f5e6
+5 -11
View File
@@ -965,17 +965,11 @@ dogfood(struct monst *mon, struct obj *obj)
|| (acidic(fptr) && !resists_acid(mon)) || (acidic(fptr) && !resists_acid(mon))
|| (poisonous(fptr) && !resists_poison(mon))) || (poisonous(fptr) && !resists_poison(mon)))
return POISON; return POISON;
/* polymorphing is preferable to starvation, and pet might also /* avoid polymorph unless starving or abused (in which case the
want to take its chances on that if they've been mistreated */ pet will consider it for a chance to become more powerful) */
else if (is_shapeshifter(fptr)) { else if (is_shapeshifter(fptr) && mon->mtame > 1 && !starving)
if (mon->mtame == 1) { return MANFOOD;
/* A herbivore still won't eat a nonvegan corpse, but else if (vegan(fptr))
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; return herbi ? CADAVER : MANFOOD;
/* most humanoids will avoid cannibalism unless starving; /* most humanoids will avoid cannibalism unless starving;
arbitrary: elves won't eat other elves even then */ arbitrary: elves won't eat other elves even then */