E void FDECL(mhitm_ad_curs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_drst, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
+E void FDECL(mhitm_ad_stck, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E int FDECL(damageum, (struct monst *, struct attack *, int));
E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P));
E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int,
}
break;
case AD_STCK:
- if (cancelled)
- mhm.damage = 0;
+ mhitm_ad_stck(magr, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_WRAP: /* monsters cannot grab one another, it's too hard */
if (magr->mcan)
}
break;
case AD_STCK:
- hitmsg(mtmp, mattk);
- if (uncancelled && !u.ustuck && !sticks(g.youmonst.data)) {
- set_ustuck(mtmp);
- }
+ mhitm_ad_stck(mtmp, mattk, &g.youmonst, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_WRAP:
if ((!mtmp->mcan || u.ustuck == mtmp) && !sticks(g.youmonst.data)) {
}
}
+void
+mhitm_ad_stck(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 */
+ int armpro = magic_negation(mdef);
+ /* since hero can't be cancelled, only defender's armor applies */
+ boolean negated = !(rn2(10) >= 3 * armpro);
+
+ if (!negated && !sticks(pd) && distu(mdef->mx, mdef->my) <= 2)
+ u.ustuck = mdef; /* it's now stuck to you */
+ } else if (mdef == &g.youmonst) {
+ /* mhitu */
+ int armpro = magic_negation(mdef);
+ boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
+
+ hitmsg(magr, mattk);
+ if (uncancelled && !u.ustuck && !sticks(pd)) {
+ set_ustuck(magr);
+ }
+ } else {
+ /* mhitm */
+ int armpro = magic_negation(mdef);
+ boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
+
+ if (cancelled)
+ mhm->damage = 0;
+ }
+}
+
/* Template for monster hits monster for AD_FOO.
- replace "break" with return
return mhm.hitflags;
break;
case AD_STCK:
- if (!negated && !sticks(pd) && distu(mdef->mx, mdef->my) <= 2)
- u.ustuck = mdef; /* it's now stuck to you */
+ mhitm_ad_stck(&g.youmonst, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_WRAP:
if (!sticks(pd)) {