E struct obj *FDECL(select_rwep, (struct monst *));
E struct obj *FDECL(select_hwep, (struct monst *));
E void FDECL(possibly_unwield, (struct monst *,BOOLEAN_P));
+E void FDECL(mwepgone, (struct monst *));
E int FDECL(mon_wield_item, (struct monst *));
E int NDECL(abon);
E int NDECL(dbon);
obj_extract_self(otmp);
if (otmp->owornmask) {
mdef->misc_worn_check &= ~otmp->owornmask;
- if (otmp->owornmask & W_WEP)
- setmnotwielded(mdef,otmp);
+ if (otmp->owornmask & W_WEP) mwepgone(mdef);
otmp->owornmask = 0L;
update_mon_intrinsics(mdef, otmp, FALSE, FALSE);
}
mons[uwep->corpsenm].mname);
Sprintf(kbuf, "%s corpse", an(mons[uwep->corpsenm].mname));
instapetrify(kbuf);
+ /* life-saved; unwield the corpse if we can't handle it */
+ if (!uarmg && !Stone_resistance) uwepgone();
}
- /* Or your secondary weapon, if wielded */
+ /* Or your secondary weapon, if wielded [hypothetical; we don't
+ allow two-weapon combat when either weapon is a corpse] */
if(u.twoweap && uswapwep && uswapwep->otyp == CORPSE &&
touch_petrifies(&mons[uswapwep->corpsenm]) && !Stone_resistance){
pline("%s touch the %s corpse.", arg,
mons[uswapwep->corpsenm].mname);
Sprintf(kbuf, "%s corpse", an(mons[uswapwep->corpsenm].mname));
instapetrify(kbuf);
+ /* life-saved; unwield the corpse */
+ if (!uarmg && !Stone_resistance) uswapwepgone();
}
}
{
struct obj *mwep = MON_WEP(mon);
- if (mwep && mwep->otyp == CORPSE && touch_petrifies(&mons[mwep->corpsenm])) {
+ if (mwep && mwep->otyp == CORPSE &&
+ touch_petrifies(&mons[mwep->corpsenm]) &&
+ !resists_ston(mon)) {
if (cansee(mon->mx, mon->my)) {
- pline("%s%s touches the %s corpse.",
+ pline("%s%s touches %s.",
arg ? arg : "", arg ? mon_nam(mon) : Monnam(mon),
- mons[mwep->corpsenm].mname);
+ corpse_xname(mwep, (const char *)0, CXN_PFX_THE));
}
minstapetrify(mon, byplayer);
+ /* if life-saved, might not be able to continue wielding */
+ if (mon->mhp > 0 && !which_armor(mon, W_ARMG) &&
+ !resists_ston(mon))
+ mwepgone(mon);
}
}
return 0;
}
+/* force monster to stop wielding current weapon, if any */
+void
+mwepgone(mon)
+struct monst *mon;
+{
+ struct obj *mwep = MON_WEP(mon);
+
+ if (mwep) {
+ setmnotwielded(mon, mwep);
+ MON_NOWEP(mon);
+ mon->weapon_check = NEED_WEAPON;
+ }
+}
+
int
abon() /* attack bonus for strength & dexterity */
{