E void FDECL(mhitm_ad_slim, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_ench, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_slow, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
+E void FDECL(mhitm_ad_conf, (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,
return mhm.hitflags;
break;
case AD_CONF:
- /* Since confusing another monster doesn't have a real time
- * limit, setting spec_used would not really be right (though
- * we still should check for it).
- */
- if (!magr->mcan && !mdef->mconf && !magr->mspec_used) {
- if (g.vis && canseemon(mdef))
- pline("%s looks confused.", Monnam(mdef));
- mdef->mconf = 1;
- mdef->mstrategy &= ~STRAT_WAITFORU;
- }
+ mhitm_ad_conf(magr, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_BLND:
mhitm_ad_blnd(magr, mattk, mdef, &mhm);
return mhm.hitflags;
break;
case AD_CONF:
- hitmsg(mtmp, mattk);
- if (!mtmp->mcan && !rn2(4) && !mtmp->mspec_used) {
- mtmp->mspec_used = mtmp->mspec_used + (mhm.damage + rn2(6));
- if (Confusion)
- You("are getting even more confused.");
- else
- You("are getting confused.");
- make_confused(HConfusion + mhm.damage, FALSE);
- }
- mhm.damage = 0;
+ mhitm_ad_conf(mtmp, mattk, &g.youmonst, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_DETH:
pline("%s reaches out with its deadly touch.", Monnam(mtmp));
}
}
+void
+mhitm_ad_conf(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 (!mdef->mconf) {
+ if (canseemon(mdef))
+ pline("%s looks confused.", Monnam(mdef));
+ mdef->mconf = 1;
+ }
+ } else if (mdef == &g.youmonst) {
+ /* mhitu */
+ hitmsg(magr, mattk);
+ if (!magr->mcan && !rn2(4) && !magr->mspec_used) {
+ magr->mspec_used = magr->mspec_used + (mhm->damage + rn2(6));
+ if (Confusion)
+ You("are getting even more confused.");
+ else
+ You("are getting confused.");
+ make_confused(HConfusion + mhm->damage, FALSE);
+ }
+ mhm->damage = 0;
+ } else {
+ /* mhitm */
+ /* Since confusing another monster doesn't have a real time
+ * limit, setting spec_used would not really be right (though
+ * we still should check for it).
+ */
+ if (!magr->mcan && !mdef->mconf && !magr->mspec_used) {
+ if (g.vis && canseemon(mdef))
+ pline("%s looks confused.", Monnam(mdef));
+ mdef->mconf = 1;
+ mdef->mstrategy &= ~STRAT_WAITFORU;
+ }
+ }
+}
/* Template for monster hits monster for AD_FOO.
- replace "break" with return
return mhm.hitflags;
break;
case AD_CONF:
- if (!mdef->mconf) {
- if (canseemon(mdef))
- pline("%s looks confused.", Monnam(mdef));
- mdef->mconf = 1;
- }
+ mhitm_ad_conf(&g.youmonst, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_POLY:
if (!negated && mhm.damage < mdef->mhp)