E void FDECL(mhitm_ad_ston, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_were, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_heal, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
+E void FDECL(mhitm_ad_stun, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E boolean FDECL(do_stone_u, (struct monst *));
E void FDECL(do_stone_mon, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E int FDECL(damageum, (struct monst *, struct attack *, int));
}
break;
case AD_STUN:
- if (magr->mcan)
- break;
- if (canseemon(mdef))
- pline("%s %s for a moment.", Monnam(mdef),
- makeplural(stagger(pd, "stagger")));
- mdef->mstun = 1;
- goto physical;
+ mhitm_ad_stun(magr, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
+ break;
case AD_LEGS:
if (magr->mcan) {
mhm.damage = 0;
return mhm.hitflags;
break;
case AD_STUN:
- hitmsg(mtmp, mattk);
- if (!mtmp->mcan && !rn2(4)) {
- make_stunned((HStun & TIMEOUT) + (long) mhm.damage, TRUE);
- mhm.damage /= 2;
- }
+ mhitm_ad_stun(mtmp, mattk, &g.youmonst, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_ACID:
mhitm_ad_acid(mtmp, mattk, &g.youmonst, &mhm);
}
}
+void
+mhitm_ad_stun(magr, mattk, mdef, mhm)
+struct monst *magr;
+struct attack *mattk;
+struct monst *mdef;
+struct mhitm_data *mhm;
+{
+ struct permonst *pd = mdef->data;
+
+ if (magr == &g.youmonst) {
+ /* uhitm */
+ if (!Blind)
+ pline("%s %s for a moment.", Monnam(mdef),
+ makeplural(stagger(pd, "stagger")));
+ mdef->mstun = 1;
+ mhitm_ad_phys(magr, mattk, mdef, mhm);
+ if (mhm->done)
+ return;
+ } else if (mdef == &g.youmonst) {
+ /* mhitu */
+ hitmsg(magr, mattk);
+ if (!magr->mcan && !rn2(4)) {
+ make_stunned((HStun & TIMEOUT) + (long) mhm->damage, TRUE);
+ mhm->damage /= 2;
+ }
+ } else {
+ /* mhitm */
+ if (magr->mcan)
+ return;
+ if (canseemon(mdef))
+ pline("%s %s for a moment.", Monnam(mdef),
+ makeplural(stagger(pd, "stagger")));
+ mdef->mstun = 1;
+ mhitm_ad_phys(magr, mattk, mdef, mhm);
+ if (mhm->done)
+ return;
+ }
+}
+
/* Template for monster hits monster for AD_FOO.
- replace "break" with return
- replace "return" with mhm->done = TRUE
}
switch (mattk->adtyp) {
case AD_STUN:
- if (!Blind)
- pline("%s %s for a moment.", Monnam(mdef),
- makeplural(stagger(pd, "stagger")));
- mdef->mstun = 1;
- goto physical;
+ mhitm_ad_stun(&g.youmonst, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
+ break;
case AD_LEGS:
#if 0
if (u.ucancelled) {