Unify ad_halu

This commit is contained in:
Pasi Kallinen
2020-11-30 23:28:13 +02:00
parent 36bb52466d
commit ac5822fe69
3 changed files with 34 additions and 8 deletions

View File

@@ -2784,6 +2784,7 @@ E void FDECL(mhitm_ad_poly, (struct monst *, struct attack *, struct monst *, st
E void FDECL(mhitm_ad_famn, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_pest, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_deth, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_halu, (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,

View File

@@ -1107,14 +1107,9 @@ int dieroll;
return mhm.hitflags;
break;
case AD_HALU:
if (!magr->mcan && haseyes(pd) && mdef->mcansee) {
if (g.vis && canseemon(mdef))
pline("%s looks %sconfused.", Monnam(mdef),
mdef->mconf ? "more " : "");
mdef->mconf = 1;
mdef->mstrategy &= ~STRAT_WAITFORU;
}
mhm.damage = 0;
mhitm_ad_halu(magr, mattk, mdef, &mhm);
if (mhm.done)
return mhm.hitflags;
break;
case AD_CURS:
mhitm_ad_curs(magr, mattk, mdef, &mhm);

View File

@@ -3317,6 +3317,36 @@ struct mhitm_data *mhm;
}
}
void
mhitm_ad_halu(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 */
mhm->damage = 0;
} else if (mdef == &g.youmonst) {
/* mhitu */
mhm->damage = 0;
} else {
/* mhitm */
int armpro = magic_negation(mdef);
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
if (!magr->mcan && haseyes(pd) && mdef->mcansee) {
if (g.vis && canseemon(mdef))
pline("%s looks %sconfused.", Monnam(mdef),
mdef->mconf ? "more " : "");
mdef->mconf = 1;
mdef->mstrategy &= ~STRAT_WAITFORU;
}
mhm->damage = 0;
}
}
/* Template for monster hits monster for AD_FOO.
- replace "break" with return