]> granicus.if.org Git - nethack/commitdiff
Unify ad_dise
authorPasi Kallinen <paxed@alt.org>
Tue, 1 Dec 2020 09:41:35 +0000 (11:41 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 4 Dec 2020 07:30:21 +0000 (09:30 +0200)
include/extern.h
src/mhitu.c
src/uhitm.c

index 914265912d1ce0be5d8e7165fdc87c00c9f7ac71..95cf72f08ec3d97b77d7cc484dbc31a17c1566d2 100644 (file)
@@ -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));
index d061dd9b1435d343a717140f4b4efedc1b9aa109..fee3a3230414ae169112501ae343f1f8608b6b34 100644 (file)
@@ -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);
index 59362b6bb18a36dc3b5df161ac73ade0cb3e5c56..41c97e7c46be0c8510b3360ddc5ac4c33d88375f 100644 (file)
@@ -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