Unify ad_dise

This commit is contained in:
Pasi Kallinen
2020-12-01 11:41:35 +02:00
parent 4118a7ea44
commit 376593dad5
3 changed files with 28 additions and 3 deletions

View File

@@ -2793,6 +2793,7 @@ E void FDECL(mhitm_ad_stun, (struct monst *, struct attack *, struct monst *, st
E void FDECL(mhitm_ad_legs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_dgst, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_samu, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_dise, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E boolean FDECL(do_stone_u, (struct monst *));
E void FDECL(do_stone_mon, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E int FDECL(damageum, (struct monst *, struct attack *, int));

View File

@@ -1022,9 +1022,9 @@ register struct attack *mattk;
return mhm.hitflags;
break;
case AD_DISE:
hitmsg(mtmp, mattk);
if (!diseasemu(mdat))
mhm.damage = 0;
mhitm_ad_dise(mtmp, mattk, &g.youmonst, &mhm);
if (mhm.done)
return mhm.hitflags;
break;
case AD_FIRE:
mhitm_ad_fire(mtmp, mattk, &g.youmonst, &mhm);

View File

@@ -3985,6 +3985,30 @@ struct mhitm_data *mhm;
}
}
void
mhitm_ad_dise(magr, mattk, mdef, mhm)
struct monst *magr;
struct attack *mattk;
struct monst *mdef;
struct mhitm_data *mhm;
{
struct permonst *pa = magr->data;
struct permonst *pd = mdef->data;
if (magr == &g.youmonst) {
/* uhitm */
mhm->damage = 0;
} else if (mdef == &g.youmonst) {
/* mhitu */
hitmsg(magr, mattk);
if (!diseasemu(pa))
mhm->damage = 0;
} else {
/* mhitm */
mhm->damage = 0;
}
}
/* Template for monster hits monster for AD_FOO.
- replace "break" with return