From: Pasi Kallinen Date: Mon, 30 Nov 2020 21:05:01 +0000 (+0200) Subject: Unify ad_famn X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb55d7c30fbab91ba47879cda49b371990004c6f;p=nethack Unify ad_famn --- diff --git a/include/extern.h b/include/extern.h index 856cfd0cf..81fbef7a5 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2780,6 +2780,7 @@ E void FDECL(mhitm_ad_ench, (struct monst *, struct attack *, struct monst *, st E void FDECL(mhitm_ad_slow, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); E void FDECL(mhitm_ad_conf, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); E void FDECL(mhitm_ad_poly, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); +E void FDECL(mhitm_ad_famn, (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, diff --git a/src/mhitu.c b/src/mhitu.c index 9957e0d3e..7791176b8 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1463,11 +1463,9 @@ register struct attack *mattk; (void) diseasemu(mdat); /* plus the normal damage */ break; case AD_FAMN: - pline("%s reaches out, and your body shrivels.", Monnam(mtmp)); - exercise(A_CON, FALSE); - if (!is_fainted()) - morehungry(rn1(40, 40)); - /* plus the normal damage */ + mhitm_ad_famn(mtmp, mattk, &g.youmonst, &mhm); + if (mhm.done) + return mhm.hitflags; break; case AD_SLIM: mhitm_ad_slim(mtmp, mattk, &g.youmonst, &mhm); diff --git a/src/uhitm.c b/src/uhitm.c index 83bdaa7e1..9167326c8 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -3216,6 +3216,31 @@ struct mhitm_data *mhm; } } +void +mhitm_ad_famn(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 */ + pline("%s reaches out, and your body shrivels.", Monnam(magr)); + exercise(A_CON, FALSE); + if (!is_fainted()) + morehungry(rn1(40, 40)); + /* plus the normal damage */ + } else { + /* mhitm */ + mhm->damage = 0; + } +} + /* Template for monster hits monster for AD_FOO. - replace "break" with return - replace "return" with mhm->done = TRUE