static void break_armor(void) { struct obj *otmp; if (breakarm(youmonst.data)) { if ((otmp = uarm) != 0) { if (donning(otmp)) cancel_don(); pline("You break out of your armor!"); exercise(A_STR, FALSE); Armor_gone(); useup(otmp); } if ((otmp = uarmc) != 0) { if (otmp->oartifact) { pline("Your %s falls off!", cloak_simple_name(otmp)); Cloak_off(); dropx(otmp); } else { pline("Your %s tears apart!", cloak_simple_name(otmp)); Cloak_off(); useup(otmp); } } if (uarmu) { pline("Your shirt rips to shreds!"); useup(uarmu); } } else if (sliparm(youmonst.data)) { if (((otmp = uarm) != 0) && (racial_exception(&youmonst, otmp) < 1)) { if (donning(otmp)) cancel_don(); pline("Your armor falls around you!"); Armor_gone(); dropx(otmp); } if ((otmp = uarmc) != 0) { if (is_whirly(youmonst.data)) pline("Your %s falls, unsupported!", cloak_simple_name(otmp)); else pline("You shrink out of your %s!", cloak_simple_name(otmp)); Cloak_off(); dropx(otmp); } if ((otmp = uarmu) != 0) { if (is_whirly(youmonst.data)) pline("You seep right through your shirt!"); else pline("You become much too small for your shirt!"); setworn(NULL, otmp->owornmask & W_ARMU); dropx(otmp); } } if (has_horns(youmonst.data)) { if ((otmp = uarmh) != 0) { if (is_flimsy(otmp) && !donning(otmp)) { char hornbuf[BUFSZ], yourbuf[BUFSZ]; /* Future possiblities: This could damage/destroy helmet */ sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data))); pline("Your %s %s through %s %s.", hornbuf, vtense(hornbuf, "pierce"), shk_your(yourbuf, otmp), xname(otmp)); } else { if (donning(otmp)) cancel_don(); pline("Your helmet falls to the %s!", surface(u.ux, u.uy)); Helmet_off(); dropx(otmp); } } } if (nohands(youmonst.data) || verysmall(youmonst.data)) { if ((otmp = uarmg) != 0) { if (donning(otmp)) cancel_don(); /* Drop weapon along with gloves */ pline("You drop your gloves%s!", uwep ? " and weapon" : ""); drop_weapon(0); Gloves_off(); dropx(otmp); } if ((otmp = uarms) != 0) { pline("You can no longer hold your shield!"); Shield_off(); dropx(otmp); } if ((otmp = uarmh) != 0) { if (donning(otmp)) cancel_don(); pline("Your helmet falls to the %s!", surface(u.ux, u.uy)); Helmet_off(); dropx(otmp); } } if (nohands(youmonst.data) || verysmall(youmonst.data) || slithy(youmonst.data) || youmonst.data->mlet == S_CENTAUR) { if ((otmp = uarmf) != 0) { if (donning(otmp)) cancel_don(); if (is_whirly(youmonst.data)) pline("Your boots fall away!"); else pline("Your boots %s off your feet!", verysmall(youmonst.data) ? "slide" : "are pushed"); Boots_off(); dropx(otmp); } } }
/* * See if this armor is better than what we're wearing. */ static boolean is_better_armor(struct monst *mtmp, struct obj *otmp) { struct obj *obj; struct obj *best = (struct obj *)0; if (otmp->oclass != ARMOR_CLASS) return FALSE; if (mtmp->data == &mons[PM_KI_RIN] || mtmp->data == &mons[PM_COUATL]) return FALSE; if (cantweararm(mtmp->data) && !(is_cloak(otmp) && mtmp->data->msize == MZ_SMALL)) return FALSE; if (is_shirt(otmp) && (mtmp->misc_worn_check & W_ARM)) return FALSE; if (is_shield(otmp) && (mtmp == &youmonst) ? (uwep && bimanual(uwep)) : (MON_WEP(mtmp) && bimanual(MON_WEP(mtmp)))) return FALSE; if (is_gloves(otmp) && nohands(mtmp->data)) return FALSE; if (is_boots(otmp) && (slithy(mtmp->data) || mtmp->data->mlet == S_CENTAUR)) return FALSE; if (is_helmet(otmp) && !is_flimsy(otmp) && num_horns(mtmp->data) > 0) return FALSE; obj = (mtmp == &youmonst) ? invent : mtmp->minvent; for (; obj; obj = obj->nobj) { if (is_cloak(otmp) && !is_cloak(obj)) continue; if (is_suit(otmp) && !is_suit(obj)) continue; if (is_shirt(otmp) && !is_shirt(obj)) continue; if (is_boots(otmp) && !is_boots(obj)) continue; if (is_shield(otmp) && !is_shield(obj)) continue; if (is_helmet(otmp) && !is_helmet(obj)) continue; if (is_gloves(otmp) && !is_gloves(obj)) continue; if (!obj->owornmask) continue; if (best && (ARM_BONUS(obj) + extra_pref(mtmp, obj) >= ARM_BONUS(best) + extra_pref(mtmp, best))) best = obj; } return ((best == (struct obj *)0) || (ARM_BONUS(otmp) + extra_pref(mtmp, otmp) > ARM_BONUS(best) + extra_pref(mtmp, best))); }