]> granicus.if.org Git - nethack/commitdiff
Unify ad_famn
authorPasi Kallinen <paxed@alt.org>
Mon, 30 Nov 2020 21:05:01 +0000 (23:05 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 4 Dec 2020 07:30:18 +0000 (09:30 +0200)
include/extern.h
src/mhitu.c
src/uhitm.c

index 856cfd0cf84673ba68fae28000f831b2d3214daf..81fbef7a551687b2dd21ce2f75ae5bec403c9a0f 100644 (file)
@@ -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,
index 9957e0d3e93608fff3e1951dfce1dcfc8e0d84f1..7791176b8a165e07c1ce87bade4bfb90cf9ea546 100644 (file)
@@ -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);
index 83bdaa7e16c140205ab342a05a38efd49fe60f1b..9167326c8e254e1541236547256da32933666a8b 100644 (file)
@@ -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