#include "hack.h"
#include "artifact.h"
-STATIC_VAR NEARDATA struct obj *otmp;
+STATIC_VAR NEARDATA struct obj *mon_currwep = (struct obj *) 0;
STATIC_DCL boolean FDECL(u_slip_free, (struct monst *, struct attack *));
STATIC_DCL int FDECL(passiveum, (struct permonst *, struct monst *,
for (i = 0; i < NATTK; i++) {
sum[i] = 0;
+ mon_currwep = (struct obj *)0;
mattk = getmattk(mtmp, &youmonst, i, sum, &alt_attk);
if ((u.uswallow && mattk->aatyp != AT_ENGL)
|| (skipnonmagc && mattk->aatyp != AT_MAGC))
break;
}
if (foundyou) {
- otmp = MON_WEP(mtmp);
- if (otmp) {
- hittmp = hitval(otmp, &youmonst);
+ mon_currwep = MON_WEP(mtmp);
+ if (mon_currwep) {
+ hittmp = hitval(mon_currwep, &youmonst);
tmp += hittmp;
- mswings(mtmp, otmp);
+ mswings(mtmp, mon_currwep);
}
if (tmp > (j = dieroll = rnd(20 + i)))
sum[i] = hitmu(mtmp, mattk);
else
missmu(mtmp, (tmp == j), mattk);
/* KMH -- Don't accumulate to-hit bonuses */
- if (otmp)
+ if (mon_currwep)
tmp -= hittmp;
} else {
wildmiss(mtmp, mattk);
: "crushed");
}
} else { /* hand to hand weapon */
+ struct obj *otmp = mon_currwep;
if (mattk->aatyp == AT_WEAP && otmp) {
int tmp;
return 1;
}
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
- if (otmp) {
+ if (mon_currwep) {
/* by_you==True: passive counterattack to hero's action
is hero's fault */
- (void) drain_item(otmp, TRUE);
+ (void) drain_item(mon_currwep, TRUE);
/* No message */
}
return 1;