]> granicus.if.org Git - nethack/commitdiff
Digestion attack can grant hero intrinsics
authorMichael Meyer <me@entrez.cc>
Tue, 27 Sep 2022 01:22:49 +0000 (21:22 -0400)
committerPatR <rankin@nethack.org>
Sat, 8 Oct 2022 23:06:50 +0000 (16:06 -0700)
Monster purple worms can now gain intrinsics from swallowing foes whole,
so maybe the hero should be able to do so too.  Intrinsics aren't
granted immediately upon swallowing (that would probably have been
easier), but only once a corpse is created and then entirely digested.

I'm not sure if this is too powerful and was being avoided deliberately
for that reason, since it includes potential level gain from wraith
corpses in addition to other intrinsics.  That's consistent with monster
purple worms but may be a bit too much in the hands of the hero, though
it is limited by needing the corpse creation roll to succeed.

include/decl.h
include/extern.h
src/decl.c
src/eat.c
src/uhitm.c

index 9989a93dc7830e6ed66291e216e4e097e4abc5ff..0a5e374f78ea338e0098bdf241443bc576c08ec3 100644 (file)
@@ -1257,6 +1257,7 @@ struct instance_globals {
     /* uhitm.c */
     boolean override_confirmation; /* Used to flag attacks caused by
                                     * Stormbringer's maliciousness. */
+    short corpsenm_digested; /* monster type being digested, set by gulpum */
 
     /* vision.c */
     seenV **viz_array; /* used in cansee() and couldsee() macros */
index 2c96fc639feeae9c12745989f6cd057a1ece42c5..68adedd8eddeee0ac9f07b16e9ba9754020a9171 100644 (file)
@@ -775,6 +775,7 @@ extern void set_tin_variety(struct obj *, int);
 extern int tin_variety_txt(char *, int *);
 extern void tin_details(struct obj *, int, char *);
 extern boolean Popeye(int);
+extern int Finish_digestion(void);
 
 /* ### end.c ### */
 
index e2384a0da0cf07a473e64ca1d0f60e627edbb63e..40e04ec2ebf7a731c82a0a14aa5d5bbeafbd4d14 100644 (file)
@@ -674,6 +674,7 @@ const struct instance_globals g_init = {
 
     /* uhitm.c */
     FALSE, /* override_confirmation */
+    NON_PM, /* corpsenm_digested */
 
     /* vision.c */
     UNDEFINED_PTR, /* viz_array */
index c6f3f9a9760c351d14a11350633bb61165cf9add..1ebf4201475ecb0d013e61b216f291bbdc1b4c11 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -3791,4 +3791,16 @@ Popeye(int threat)
     return FALSE;
 }
 
+/* the hero has swallowed a monster whole as a purple worm or similar, and has
+   finished digesting its corpse (called via g.afternmv) */
+int
+Finish_digestion(void)
+{
+    if (g.corpsenm_digested != NON_PM) {
+        cpostfx(g.corpsenm_digested);
+        g.corpsenm_digested = NON_PM;
+    }
+    return 0;
+}
+
 /*eat.c*/
index a267a43c7da428b2e3e317a672a0765ff7121fa0..c2fbd396ddb02bbb26b020b3b08a680630046f68 100644 (file)
@@ -4462,8 +4462,9 @@ gulpum(struct monst *mdef, struct attack *mattk)
                         && !(g.mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
                         /* nutrition only if there can be a corpse */
                         u.uhunger += (pd->cnutrit + 1) / 2;
-                    } else
+                    } else {
                         tmp = 0;
+                    }
                     Sprintf(msgbuf, "You totally digest %s.", mon_nam(mdef));
                     if (tmp != 0) {
                         /* setting afternmv = end_engulf is tempting,
@@ -4477,6 +4478,9 @@ gulpum(struct monst *mdef, struct attack *mattk)
                         nomul(-tmp);
                         g.multi_reason = "digesting something";
                         g.nomovemsg = msgbuf;
+                        /* possible intrinsic once totally digested */
+                        g.corpsenm_digested = monsndx(pd);
+                        g.afternmv = Finish_digestion;
                     } else
                         pline1(msgbuf);
                     if (pd == &mons[PM_GREEN_SLIME]) {