From: Pasi Kallinen Date: Tue, 1 Dec 2020 09:41:35 +0000 (+0200) Subject: Unify ad_dise X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=376593dad5eddf7aa25217e19238ce7a71d09497;p=nethack Unify ad_dise --- diff --git a/include/extern.h b/include/extern.h index 914265912..95cf72f08 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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)); diff --git a/src/mhitu.c b/src/mhitu.c index d061dd9b1..fee3a3230 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -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); diff --git a/src/uhitm.c b/src/uhitm.c index 59362b6bb..41c97e7c4 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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