E void FDECL(mhitm_ad_acid, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_sgld, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_tlpt, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
+E void FDECL(mhitm_ad_blnd, (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_BLND:
- if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
- register unsigned rnd_tmp;
-
- if (g.vis && mdef->mcansee && canspotmon(mdef))
- pline("%s is blinded.", Monnam(mdef));
- rnd_tmp = d((int) mattk->damn, (int) mattk->damd);
- if ((rnd_tmp += mdef->mblinded) > 127)
- rnd_tmp = 127;
- mdef->mblinded = rnd_tmp;
- mdef->mcansee = 0;
- mdef->mstrategy &= ~STRAT_WAITFORU;
- }
- mhm.damage = 0;
+ mhitm_ad_blnd(magr, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_HALU:
if (!magr->mcan && haseyes(pd) && mdef->mcansee) {
}
break;
case AD_BLND:
- if (can_blnd(mtmp, &g.youmonst, mattk->aatyp, (struct obj *) 0)) {
- if (!Blind)
- pline("%s blinds you!", Monnam(mtmp));
- make_blinded(Blinded + (long) mhm.damage, FALSE);
- if (!Blind)
- Your1(vision_clears);
- }
- mhm.damage = 0;
+ mhitm_ad_blnd(mtmp, mattk, &g.youmonst, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_DRST:
ptmp = A_STR;
}
}
+void
+mhitm_ad_blnd(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 (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
+ if (!Blind && mdef->mcansee)
+ pline("%s is blinded.", Monnam(mdef));
+ mdef->mcansee = 0;
+ mhm->damage += mdef->mblinded;
+ if (mhm->damage > 127)
+ mhm->damage = 127;
+ mdef->mblinded = mhm->damage;
+ }
+ mhm->damage = 0;
+ } else if (mdef == &g.youmonst) {
+ /* mhitu */
+ if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
+ if (!Blind)
+ pline("%s blinds you!", Monnam(magr));
+ make_blinded(Blinded + (long) mhm->damage, FALSE);
+ if (!Blind)
+ Your1(vision_clears);
+ }
+ mhm->damage = 0;
+ } else {
+ /* mhitm */
+ if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
+ register unsigned rnd_tmp;
+
+ if (g.vis && mdef->mcansee && canspotmon(mdef))
+ pline("%s is blinded.", Monnam(mdef));
+ rnd_tmp = d((int) mattk->damn, (int) mattk->damd);
+ if ((rnd_tmp += mdef->mblinded) > 127)
+ rnd_tmp = 127;
+ mdef->mblinded = rnd_tmp;
+ mdef->mcansee = 0;
+ mdef->mstrategy &= ~STRAT_WAITFORU;
+ }
+ mhm->damage = 0;
+ }
+}
/* Template for monster hits monster for AD_FOO.
- replace "break" with return
return mhm.hitflags;
break;
case AD_BLND:
- if (can_blnd(&g.youmonst, mdef, mattk->aatyp, (struct obj *) 0)) {
- if (!Blind && mdef->mcansee)
- pline("%s is blinded.", Monnam(mdef));
- mdef->mcansee = 0;
- mhm.damage += mdef->mblinded;
- if (mhm.damage > 127)
- mhm.damage = 127;
- mdef->mblinded = mhm.damage;
- }
- mhm.damage = 0;
+ mhitm_ad_blnd(&g.youmonst, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_CURS:
if (night() && !rn2(10) && !mdef->mcan) {