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 void FDECL(mhitm_ad_wrap, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
+E void FDECL(mhitm_ad_plys, (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_PLYS:
- if (!cancelled && mdef->mcanmove) {
- if (g.vis && canspotmon(mdef)) {
- Strcpy(buf, Monnam(mdef));
- pline("%s is frozen by %s.", buf, mon_nam(magr));
- }
- paralyze_monst(mdef, rnd(10));
- }
+ mhitm_ad_plys(magr, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_SLOW:
if (!cancelled && mdef->mspeed != MSLOW) {
return mhm.hitflags;
break;
case AD_PLYS:
- hitmsg(mtmp, mattk);
- if (uncancelled && g.multi >= 0 && !rn2(3)) {
- if (Free_action) {
- You("momentarily stiffen.");
- } else {
- if (Blind)
- You("are frozen!");
- else
- You("are frozen by %s!", mon_nam(mtmp));
- g.nomovemsg = You_can_move_again;
- nomul(-rnd(10));
- g.multi_reason = "paralyzed by a monster";
- exercise(A_DEX, FALSE);
- }
- }
+ mhitm_ad_plys(mtmp, mattk, &g.youmonst, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_DRLI: /* drain life */
mhitm_ad_drli(mtmp, mattk, &g.youmonst, &mhm);
}
}
+void
+mhitm_ad_plys(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 && mdef->mcanmove && !rn2(3) && mhm->damage < mdef->mhp) {
+ if (!Blind)
+ pline("%s is frozen by you!", Monnam(mdef));
+ paralyze_monst(mdef, rnd(10));
+ }
+ } else if (mdef == &g.youmonst) {
+ /* mhitu */
+ int armpro = magic_negation(mdef);
+ boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
+
+ hitmsg(magr, mattk);
+ if (uncancelled && g.multi >= 0 && !rn2(3)) {
+ if (Free_action) {
+ You("momentarily stiffen.");
+ } else {
+ if (Blind)
+ You("are frozen!");
+ else
+ You("are frozen by %s!", mon_nam(magr));
+ g.nomovemsg = You_can_move_again;
+ nomul(-rnd(10));
+ g.multi_reason = "paralyzed by a monster";
+ exercise(A_DEX, FALSE);
+ }
+ }
+ } else {
+ /* mhitm */
+ int armpro = magic_negation(mdef);
+ boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
+
+ if (!cancelled && mdef->mcanmove) {
+ if (g.vis && canspotmon(mdef)) {
+ char buf[BUFSZ];
+ Strcpy(buf, Monnam(mdef));
+ pline("%s is frozen by %s.", buf, mon_nam(magr));
+ }
+ paralyze_monst(mdef, rnd(10));
+ }
+ }
+}
+
+
/* Template for monster hits monster for AD_FOO.
- replace "break" with return
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);
+
/* TODO */
} else if (mdef == &g.youmonst) {
/* mhitu */
+ int armpro = magic_negation(mdef);
+ boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
+
/* TODO */
} else {
/* mhitm */
+ int armpro = magic_negation(mdef);
+ boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
+
/* TODO */
}
}
return mhm.hitflags;
break;
case AD_PLYS:
- if (!negated && mdef->mcanmove && !rn2(3) && mhm.damage < mdef->mhp) {
- if (!Blind)
- pline("%s is frozen by you!", Monnam(mdef));
- paralyze_monst(mdef, rnd(10));
- }
+ mhitm_ad_plys(&g.youmonst, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_SLEE:
if (!negated && !mdef->msleeping && sleep_monst(mdef, rnd(10), -1)) {