github PR #879 - pets eating shapeshifter corpses

Pull request from entrez:  the check for whether a pet in desperate
straits will eat a corpse that will cause it to polymorph used bad
logic.  The suspect code was added post-3.6.

Fixes #879
This commit is contained in:
PatR
2022-09-21 12:07:05 -07:00
+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 */