fix part of #S11588 - mons eating poisoned items

Prevent non-poison resistant monsters that eat items from eating
poisoned items.
This commit is contained in:
PatR
2024-10-12 14:39:48 -07:00
parent 3885949c5b
commit 35cf713988
2 changed files with 6 additions and 2 deletions

View File

@@ -943,6 +943,8 @@ dogfood(struct monst *mon, struct obj *obj)
starving, mblind;
int fx;
if (obj->opoisoned && !resists_poison(mon))
return POISON;
if (is_quest_artifact(obj) || obj_resists(obj, 0, 95))
return obj->cursed ? TABU : APPORT;

View File

@@ -1435,8 +1435,9 @@ meatmetal(struct monst *mtmp)
otmp = otmp->nexthere) {
/* Don't eat indigestible/choking/inappropriate objects */
if ((mtmp->data == &mons[PM_RUST_MONSTER] && !is_rustprone(otmp))
|| (otmp->otyp == AMULET_OF_STRANGULATION)
|| (otmp->otyp == RIN_SLOW_DIGESTION))
|| (otmp->otyp == AMULET_OF_STRANGULATION
|| otmp->otyp == RIN_SLOW_DIGESTION)
|| (otmp->opoisoned && !resists_poison(mtmp)))
continue;
if (is_metallic(otmp) && !obj_resists(otmp, 5, 95)
&& touch_artifact(otmp, mtmp)) {
@@ -1548,6 +1549,7 @@ meatobj(struct monst* mtmp) /* for gelatinous cubes */
included for emphasis */
|| (otmp->otyp == AMULET_OF_STRANGULATION
|| otmp->otyp == RIN_SLOW_DIGESTION)
|| (otmp->opoisoned && !resists_poison(mtmp))
/* cockatrice corpses handled above; this
touch_petrifies() check catches eggs */
|| (mstoning(otmp) && !resists_ston(mtmp))