github pull request #1184 - polyfood()
Pull request from entrez: rename polyfodder() to polyfood() and use it instead of is_shapeshifter() when deciding whether a pet will avoid eating a corpse or an egg because of the risk of polymorphing. The PR was in response to issue #1183 by Umbire: pets that avoid eating shapechanger corpses didn't avoid genetic engineer corpses. polyfodder()/polyfood() includes genetic engineer corpses because they have an attack for AD_POLY damage. But pets weren't caring because is_shapeshifter() doesn't include that. There's no particular need to rename polyfodder() to polyfood() but I've used the PR as-is instead of reversing the name change. Closes #1184 Closes #1183
This commit is contained in:
@@ -306,7 +306,7 @@ struct obj {
|
||||
#define ofood(o) ((o)->otyp == CORPSE || (o)->otyp == EGG || (o)->otyp == TIN)
|
||||
/* note: sometimes eggs and tins have special corpsenm values that
|
||||
shouldn't be used as an index into mons[] */
|
||||
#define polyfodder(obj) \
|
||||
#define polyfood(obj) \
|
||||
(ofood(obj) && (obj)->corpsenm >= LOW_PM \
|
||||
&& (pm_to_cham((obj)->corpsenm) != NON_PM \
|
||||
|| dmgtype(&mons[(obj)->corpsenm], AD_POLY)))
|
||||
|
||||
2
src/do.c
2
src/do.c
@@ -850,7 +850,7 @@ engulfer_digests_food(struct obj *obj)
|
||||
|
||||
if (obj->otyp == CORPSE) {
|
||||
could_petrify = touch_petrifies(&mons[obj->corpsenm]);
|
||||
could_poly = polyfodder(obj);
|
||||
could_poly = polyfood(obj);
|
||||
could_grow = (obj->corpsenm == PM_WRAITH);
|
||||
could_heal = (obj->corpsenm == PM_NURSE);
|
||||
} else if (obj->otyp == GLOB_OF_GREEN_SLIME) {
|
||||
|
||||
@@ -1003,7 +1003,7 @@ dogfood(struct monst *mon, struct obj *obj)
|
||||
return POISON;
|
||||
/* avoid polymorph unless starving or abused (in which case the
|
||||
pet will consider it for a chance to become more powerful) */
|
||||
else if (is_shapeshifter(fptr) && mon->mtame > 1 && !starving)
|
||||
else if (polyfood(obj) && mon->mtame > 1 && !starving)
|
||||
return MANFOOD;
|
||||
else if (vegan(fptr))
|
||||
return herbi ? CADAVER : MANFOOD;
|
||||
|
||||
@@ -3865,7 +3865,7 @@ Popeye(int threat)
|
||||
&& (mndx == PM_LIZARD || acidic(&mons[mndx])));
|
||||
/* polymorph into a fiery monster */
|
||||
case SLIMED:
|
||||
return (boolean) polyfodder(otin);
|
||||
return (boolean) polyfood(otin);
|
||||
/* no tins can cure these (yet?) */
|
||||
case SICK:
|
||||
case VOMITING:
|
||||
|
||||
@@ -1374,7 +1374,7 @@ m_consume_obj(struct monst *mtmp, struct obj *otmp)
|
||||
|| corpsenm == PM_LARGE_MIMIC
|
||||
|| corpsenm == PM_GIANT_MIMIC));
|
||||
slimer = (otmp->otyp == GLOB_OF_GREEN_SLIME);
|
||||
poly = polyfodder(otmp);
|
||||
poly = polyfood(otmp);
|
||||
grow = mlevelgain(otmp);
|
||||
heal = mhealup(otmp);
|
||||
eyes = (otmp->otyp == CARROT);
|
||||
|
||||
Reference in New Issue
Block a user