]> granicus.if.org Git - nethack/commitdiff
Unify ad_pest
authorPasi Kallinen <paxed@alt.org>
Mon, 30 Nov 2020 21:09:05 +0000 (23:09 +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 81fbef7a551687b2dd21ce2f75ae5bec403c9a0f..44f3f2523334a216b2472123d80bf90b72d1804f 100644 (file)
@@ -1290,6 +1290,7 @@ E void FDECL(expels, (struct monst *, struct permonst *, BOOLEAN_P));
 E struct attack *FDECL(getmattk, (struct monst *, struct monst *,
                                   int, int *, struct attack *));
 E int FDECL(mattacku, (struct monst *));
+boolean FDECL(diseasemu, (struct permonst *));
 boolean FDECL(u_slip_free, (struct monst *, struct attack *));
 E int FDECL(magic_negation, (struct monst *));
 E boolean NDECL(gulp_blnd_check);
@@ -2781,6 +2782,7 @@ E void FDECL(mhitm_ad_slow, (struct monst *, struct attack *, struct monst *, st
 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 void FDECL(mhitm_ad_pest, (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 7791176b8a165e07c1ce87bade4bfb90cf9ea546..d38c76b0a32f3cf005360f446e9f79b75a43f257 100644 (file)
@@ -12,7 +12,6 @@ static void FDECL(missmu, (struct monst *, BOOLEAN_P, struct attack *));
 static void FDECL(mswings, (struct monst *, struct obj *));
 static void FDECL(wildmiss, (struct monst *, struct attack *));
 static void FDECL(summonmu, (struct monst *, BOOLEAN_P));
-static boolean FDECL(diseasemu, (struct permonst *));
 static int FDECL(hitmu, (struct monst *, struct attack *));
 static int FDECL(gulpmu, (struct monst *, struct attack *));
 static int FDECL(explmu, (struct monst *, struct attack *, BOOLEAN_P));
@@ -853,7 +852,7 @@ boolean youseeit;
     } /* were creature */
 }
 
-static boolean
+boolean
 diseasemu(mdat)
 struct permonst *mdat;
 {
@@ -1459,8 +1458,9 @@ register struct attack *mattk;
         }
         break;
     case AD_PEST:
-        pline("%s reaches out, and you feel fever and chills.", Monnam(mtmp));
-        (void) diseasemu(mdat); /* plus the normal damage */
+        mhitm_ad_pest(mtmp, mattk, &g.youmonst, &mhm);
+        if (mhm.done)
+            return mhm.hitflags;
         break;
     case AD_FAMN:
         mhitm_ad_famn(mtmp, mattk, &g.youmonst, &mhm);
index 9167326c8e254e1541236547256da32933666a8b..e71050b677b48ec9060abd31e66251cf91ceb542 100644 (file)
@@ -3241,6 +3241,30 @@ struct mhitm_data *mhm;
     }
 }
 
+void
+mhitm_ad_pest(magr, mattk, mdef, mhm)
+struct monst *magr;
+struct attack *mattk;
+struct monst *mdef;
+struct mhitm_data *mhm;
+{
+    struct permonst *pa = magr->data;
+
+    if (magr == &g.youmonst) {
+        /* uhitm */
+        mhm->damage = 0;
+    } else if (mdef == &g.youmonst) {
+        /* mhitu */
+        pline("%s reaches out, and you feel fever and chills.", Monnam(magr));
+        (void) diseasemu(pa);
+        /* 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