From d09a5beab35612c39259984ccebca3175dc9db67 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Wed, 20 Dec 2023 11:55:58 -0500 Subject: [PATCH 1/2] Rename polyfodder() to polyfood() 'Polyfodder' is already a term frequently used by players to describe items which are useful to hang on to specifically to zap polymorph at (for example, extra unicorn horns, which can be turned into magic markers). Using it as the name of a macro which tests whether a food item will polymorph the creature consuming it is somewhat confusing, and I think 'polyfood' is a lot clearer. --- include/obj.h | 2 +- src/do.c | 2 +- src/eat.c | 2 +- src/mon.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/obj.h b/include/obj.h index 7053772d6..f138f4eae 100644 --- a/include/obj.h +++ b/include/obj.h @@ -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))) diff --git a/src/do.c b/src/do.c index 41aaadc6d..08b00a9c1 100644 --- a/src/do.c +++ b/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) { diff --git a/src/eat.c b/src/eat.c index dd52fd0b0..707449772 100644 --- a/src/eat.c +++ b/src/eat.c @@ -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: diff --git a/src/mon.c b/src/mon.c index 1fb32fd86..a59a8a93f 100644 --- a/src/mon.c +++ b/src/mon.c @@ -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); From b363b702d755a3c84e003d2dd66d0be9c9598d91 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Wed, 20 Dec 2023 12:00:13 -0500 Subject: [PATCH 2/2] Make pets unwilling to eat all polyfood() corpses The previous is_shapeshifter() test meant that pets were still perfectly willing to eat genetic engineer corpses and be polymorphed. Use polyfood() instead. Fixes #1183. --- src/dog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dog.c b/src/dog.c index cf9adc4f2..1aab95644 100644 --- a/src/dog.c +++ b/src/dog.c @@ -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;