From: Pasi Kallinen Date: Tue, 1 Dec 2020 14:05:25 +0000 (+0200) Subject: Unify ad_ssex X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88e333a3a880e5f220621ee52e500e03669b67f0;p=nethack Unify ad_ssex --- diff --git a/include/extern.h b/include/extern.h index 13122a575..8b4bd149c 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2795,6 +2795,7 @@ E void FDECL(mhitm_ad_dgst, (struct monst *, struct attack *, struct monst *, st 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 void FDECL(mhitm_ad_sedu, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); +E void FDECL(mhitm_ad_ssex, (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/mhitm.c b/src/mhitm.c index fab8bbba0..0cb813803 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1020,6 +1020,10 @@ int dieroll; return mhm.hitflags; break; case AD_SSEX: + mhitm_ad_ssex(magr, mattk, mdef, &mhm); + if (mhm.done) + return mhm.hitflags; + break; case AD_SITM: /* for now these are the same */ case AD_SEDU: mhitm_ad_sedu(magr, mattk, mdef, &mhm); diff --git a/src/mhitu.c b/src/mhitu.c index 31d903541..3fce4da9e 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1105,13 +1105,10 @@ register struct attack *mattk; break; case AD_SSEX: - if (SYSOPT_SEDUCE) { - if (could_seduce(mtmp, &g.youmonst, mattk) == 1 && !mtmp->mcan) - if (doseduce(mtmp)) - return 3; - break; - } - /*FALLTHRU*/ + mhitm_ad_ssex(mtmp, mattk, &g.youmonst, &mhm); + if (mhm.done) + return mhm.hitflags; + break; case AD_SITM: /* for now these are the same */ case AD_SEDU: mhitm_ad_sedu(mtmp, mattk, &g.youmonst, &mhm); diff --git a/src/uhitm.c b/src/uhitm.c index 211316e54..012f1cfdb 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -4149,6 +4149,40 @@ struct mhitm_data *mhm; } } +void +mhitm_ad_ssex(magr, mattk, mdef, mhm) +struct monst *magr; +struct attack *mattk; +struct monst *mdef; +struct mhitm_data *mhm; +{ + if (magr == &g.youmonst) { + /* uhitm */ + mhitm_ad_sedu(magr, mattk, mdef, mhm); + if (mhm->done) + return; + } else if (mdef == &g.youmonst) { + /* mhitu */ + if (SYSOPT_SEDUCE) { + if (could_seduce(magr, mdef, mattk) == 1 && !magr->mcan) + if (doseduce(magr)) { + mhm->hitflags = MM_HIT | MM_DEF_DIED; /* return 3??? */ + mhm->done = TRUE; + return; + } + return; + } + mhitm_ad_sedu(magr, mattk, mdef, mhm); + if (mhm->done) + return; + } else { + /* mhitm */ + mhitm_ad_sedu(magr, mattk, mdef, mhm); + if (mhm->done) + return; + } +} + /* Template for monster hits monster for AD_FOO. - replace "break" with return @@ -4262,6 +4296,10 @@ int specialdmg; /* blessed and/or silver bonus against various things */ return mhm.hitflags; break; case AD_SSEX: + mhitm_ad_ssex(&g.youmonst, mattk, mdef, &mhm); + if (mhm.done) + return mhm.hitflags; + break; case AD_SITM: case AD_SEDU: mhitm_ad_sedu(&g.youmonst, mattk, mdef, &mhm);