Thursday, September 22, 2016

Wounding

So, I've implemented the new WOUNDING feature for slashem and included a new chaotic artifact long sword named Nightblood (taken from some book).  The patch is for SlashTHEM.

The gist is that if you "wound" a monster, it will continue to take damage until you kill it or until it bleeds out.  Just apply this patch and add #define WOUNDING to includ/config.h and you should be good to go.

greg@viper:~/src/SlashTHEM$ git diff 
diff --git a/include/artilist.h b/include/artilist.h
index 172a20f..522a74b 100644
--- a/include/artilist.h
+++ b/include/artilist.h
@@ -28,6 +28,9 @@ static const char *artifact_names[] = {
 #define     ELEC(a,b)    {0,AD_ELEC,a,b}        /* electrical shock */
 #define     STUN(a,b)    {0,AD_STUN,a,b}        /* magical attack */
 #define     ACID(a,b)    {0,AD_ACID,a,b}
+#ifdef WOUNDING
+#define     WOUN(a,b)   {0,AD_WOUN,a,b}
+#endif

 STATIC_OVL NEARDATA struct artifact artilist[] = {
 #endif    /* MAKEDEFS_C */
@@ -355,7 +358,11 @@ A("Cat's Claw",        DAGGER,
     (SPFX_RESTR|SPFX_DCLAS), 0, S_RODENT,
     PHYS(5,7),    NO_DFNS,    NO_CARY,    0, A_NEUTRAL, NON_PM, NON_PM, 1000L ),
 #endif /* NEWHON_ARTIFACTS */
-
+#ifdef WOUNDING
+A("Nightblood", LONG_SWORD,
+  (SPFX_NOGEN | SPFX_RESTR | SPFX_INTEL), 0, 0,
+  WOUN(5, 10), NO_DFNS, NO_CARY, 0, A_CHAOTIC, NON_PM, NON_PM, 4000L),
+#endif
 #ifdef TOURIST
 A("Whisperfeet",               SPEED_BOOTS,
     (SPFX_RESTR|SPFX_STLTH|SPFX_LUCK), 0, 0,
@@ -898,6 +905,9 @@ A(0, 0, 0, 0, 0, NO_ATTK, NO_DFNS, NO_CARY, 0, A_NONE, NON_PM, NON_PM, 0L )
 #undef    FIRE
 #undef    ELEC
 #undef    STUN
+#ifdef WOUNDING
+#undef  WOUN
+#endif /* WOUNDING */
 #endif

 /*artilist.h*/
diff --git a/include/attk.h b/include/attk.h
index a52a9ce..9f11570 100644
--- a/include/attk.h
+++ b/include/attk.h
@@ -141,7 +141,12 @@ extern char *attk_dname(Attk);
 #define AD_POLY        43    /* RJ -- polymorphs (genetic engineer) */
 #define AD_CORR        44    /* corrode armor (black pudding) */
 #define AD_TCKL        45    /* Tickle (Nightgaunts) */
-#define AD_ENDS        46    /* placeholder */
+#ifdef WOUNDING
+  #define AD_WOUN   46  /* Wounding attack */
+  #define AD_ENDS   47    /* placeholder */
+#else
+  #define AD_ENDS   46  /* placeholder */
+#endif

 #define AD_CLRC        240        /* random clerical spell */
 #define AD_SPEL        241        /* random magic spell */
diff --git a/include/config.h b/include/config.h
index 1655897..1febcf7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -435,6 +435,10 @@ typedef unsigned char    uchar;
 #define WALLET_O_P      /* Perseus' Wallet, and all related code (tsanth@iname.com)*/
 #define LIGHTSABERS
 #define JEDI
+
+/* Wounding and Nightblood features */
+#define WOUNDING
+
 #define NWAR
 #define CONVICT        /* Convict player with heavy iron ball */
 #ifdef LIGHTSABERS
diff --git a/include/monattk.h b/include/monattk.h
index fd440cd..5ca8414 100644
--- a/include/monattk.h
+++ b/include/monattk.h
@@ -90,7 +90,12 @@
 #define AD_DARK        48    /* acts similar to cursed scroll of light, making an area unlit */
 #define AD_WTHR        49    /* withers items */
 #define AD_LUCK        50    /* reduces luck */
-#define AD_ENDS        51    /* placeholder */
+#ifdef WOUNDING
+  #define AD_WOUN     51
+  #define AD_ENDS     52
+#else
+  #define AD_ENDS        51    /* placeholder */
+#endif

 #define AD_CLRC        240    /* random clerical spell */
 #define AD_SPEL        241    /* random magic spell */
diff --git a/include/monst.h b/include/monst.h
index 86ac201..68fb06c 100644
--- a/include/monst.h
+++ b/include/monst.h
@@ -139,6 +139,9 @@ struct monst {
     long mlstmv;        /* for catching up with lost time */
 #ifndef GOLDOBJ
     long mgold;
+#endif
+#ifdef WOUNDING
+    long wounding;
 #endif
     struct obj *minvent;

diff --git a/src/artifact.c b/src/artifact.c
index 69b0add..d37b396 100644
--- a/src/artifact.c
+++ b/src/artifact.c
@@ -1281,6 +1281,18 @@ int dieroll; /* needed for Magicbane and vorpal blades */
         return Mb_hit(magr, mdef, otmp, dmgptr, dieroll, vis, hittee);
     }

+#ifdef WOUNDING
+    if (attacks(AD_WOUN, otmp)) {
+        if (realizes_damage) {
+            if (rnd(5)==1) {
+                mdef->wounding += rnd(10);
+                pline_The("sharp blade wounds %s.", hittee);
+            }
+        }
+        return realizes_damage;
+    }
+#endif
+
     if (!spec_dbon_applies && !spec_ability(otmp, SPFX_BEHEAD) ||
         !special_applies) {
         /* since damage bonus didn't apply, nothing more to do;
diff --git a/src/mon.c b/src/mon.c
index 1bb6a87..36c2fa2 100644
--- a/src/mon.c
+++ b/src/mon.c
@@ -808,6 +808,18 @@ mcalcdistress()
     struct monst *mtmp;

     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
+
+#ifdef WOUNDING
+    if (mtmp->wounding) {
+        mtmp->mhp -= rnd(mtmp->wounding);
+        if (mtmp->mhp < 1) {
+            pline_The("%s dies from its wounds.", Monnam(mtmp));
+            mon_xkilled(mtmp, NULL, AD_WOUN);
+        } else {
+            pline_The("%s suffers from its wounds.", Monnam(mtmp));
+        }
+    }
+#endif
     if (DEADMONSTER(mtmp)) continue;

     /* must check non-moving monsters once/turn in case
diff --git a/src/monmove.c b/src/monmove.c
index a6d1d32..ec22bf8 100644
--- a/src/monmove.c
+++ b/src/monmove.c
@@ -858,6 +858,19 @@ register int after;
         if(i == 1) return(0);    /* still in trap, so didn't move */
     }

+#ifdef WOUNDING
+    if (mtmp->wounding) {
+        mtmp->mhp -= rnd(mtmp->wounding);
+        if (mtmp->mhp < 1) {
+            pline_The("%s dies from its wounds.", Monnam(mtmp));
+            return 2;
+        } else {
+            pline_The("%s suffers from its wounds.", Monnam(mtmp));
+            return 1;
+        }
+    }
+#endif
+
     ptr = mtmp->data; /* mintrap() can change mtmp->data -dlc */

     if (mtmp->meating) {

2 comments:

  1. Hi there, nice to see you're still writing NetHack patches. But I think the chances of actually seeing them implemented would be higher if you wrote them for Slash'EM Extended, since SLASHTHEM development has stopped about a year ago already and no one knows if/when it will resume. Keep up the good work!

    ReplyDelete
  2. Thanks for the tip. I'll check out the Slashem Extended code now. Sorry for slow updates to my blog. I may have some extra time on my hands starting around now due to some unfortunately circumstances, but I'll try to write a few patches here and there in the meantime.

    ReplyDelete