Unify ad_blnd
This commit is contained in:
@@ -2766,6 +2766,7 @@ E void FDECL(mhitm_ad_elec, (struct monst *, struct attack *, struct monst *, st
|
||||
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,
|
||||
|
||||
16
src/mhitm.c
16
src/mhitm.c
@@ -1123,19 +1123,9 @@ int dieroll;
|
||||
}
|
||||
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) {
|
||||
|
||||
11
src/mhitu.c
11
src/mhitu.c
@@ -1125,14 +1125,9 @@ register struct attack *mattk;
|
||||
}
|
||||
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;
|
||||
|
||||
61
src/uhitm.c
61
src/uhitm.c
@@ -2432,6 +2432,54 @@ struct mhitm_data *mhm;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -2573,16 +2621,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user