... and fix the potion dipping case.
E void NDECL(unturn_you);
E void FDECL(cancel_item, (struct obj *));
E boolean FDECL(drain_item, (struct obj *, BOOLEAN_P));
+E boolean FDECL(obj_unpolyable, (struct obj *));
E struct obj *FDECL(poly_obj, (struct obj *, int));
E boolean FDECL(obj_resists, (struct obj *, int, int));
E boolean FDECL(obj_shudders, (struct obj *));
goto poof;
} else if (obj->otyp == POT_POLYMORPH || potion->otyp == POT_POLYMORPH) {
/* some objects can't be polymorphed */
- if (obj->otyp == potion->otyp /* both POT_POLY */
- || unpolyable(obj)
- || obj == uball || obj == uskin
- || obj_resists(obj->otyp == POT_POLYMORPH ? potion : obj,
- 5, 95)) {
+ if (obj_unpolyable(obj->otyp == POT_POLYMORPH ? potion : obj)) {
pline1(nothing_happens);
} else {
short save_otyp = obj->otyp;
delobj(obj);
}
+/* Returns TRUE if obj resists polymorphing */
+boolean
+obj_unpolyable(obj)
+struct obj *obj;
+{
+ return (unpolyable(obj)
+ || obj == uball || obj == uskin
+ || obj_resists(obj, 5, 95));
+}
+
/* classes of items whose current charge count carries over across polymorph
*/
static const char charged_objs[] = { WAND_CLASS, WEAPON_CLASS, ARMOR_CLASS,
switch (otmp->otyp) {
case WAN_POLYMORPH:
case SPE_POLYMORPH:
- if (unpolyable(obj) || obj_resists(obj, 5, 95)) {
+ if (obj_unpolyable(obj)) {
res = 0;
break;
}