]> granicus.if.org Git - nethack/commitdiff
fix github issue #742 - suit of no digestion
authorPatR <rankin@nethack.org>
Fri, 22 Apr 2022 13:11:12 +0000 (06:11 -0700)
committerPatR <rankin@nethack.org>
Fri, 22 Apr 2022 13:11:12 +0000 (06:11 -0700)
Reported by vultur-cadens:  slow digestion from wearing white dragon
scales/mail blocked per-turn hunger and didn't cause any hunger,
unlike ring of slow digestion which blocks per-turn hunger but still
causes some hunger as a worn ring itself.  If no rings or amulet
were worn, wearing the suit prevented the hero from ever burning any
nutrition.

Change to treat wearing the suit to be quite a bit like wearing a
ring, unless hero is also wearing an actual ring of slow digestion
(then the hunger cost of the suit is 'free').

Wearing a ring of slow digestion and another ring consumes two units
of nutrition every 20 turns, no matter what suit.  Wearing white
dragon scales/mail and two non-slow digestion rings now consumes three
units of nutrition every 20 turns.  Using the suit to effectively get
an extra ring finger isn't free.

Fixes #742

doc/fixes3-7-0.txt
src/eat.c

index a4a6859781c8e69658b7f02814177fcbca162717..c8b4afaa3104363b3ad7edeaf295f218761b89e3 100644 (file)
@@ -1163,6 +1163,9 @@ corpses of neuter monsters had random chance to be flagged as female so would
 one-shot food testing ability conferred by blessed scroll of food detection
        didn't warn about globs of green slime because the relevant code was
        only executed for corpses, eggs, and tins, not for globs
+worn ring of slow digestion blocks per-turn hunger but not the hunger caused
+       by wearing it; white dragon scales/mail was blocking per-turn hunger
+       and didn't cause any hunger itself; change to treat it like the ring
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 075a9629933c113cbaf1dfdf31aa386465481278..1f7be157732d38801d626d2a91ba2605fe388892 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -3036,8 +3036,26 @@ gethungry(void)
          * +0 ring of protection might do something (enhanced "magical
          * cancellation") if hero doesn't have protection from some
          * other source (cloak or second ring).
+         *
+         * [If wearing duplicate rings whose effects don't stack,
+         * should they both consume nutrition, or just one of them?
+         * Two +0 rings of protection are treated as if only one,
+         * but this could apply to most rings.]
          */
         switch (accessorytime) { /* note: use even cases among 0..19 only */
+        case 0:
+            /* 3.7: if not wearing a ring of slow digestion, obtaining
+               that property from worn armor (white dragon scales/mail)
+               causes the armor to burn nutrition; since it's not
+               actually a ring, we don't check for it on the ring
+               turns; because of that, wearing two (non-slow digestion)
+               rings plus the armor consumes more nutrition that one
+               non-slow digestion ring plus ring of slow digestion */
+            if (Slow_digestion
+                && (!uright || uright->otyp != RIN_SLOW_DIGESTION)
+                && (!uleft || uleft->otyp != RIN_SLOW_DIGESTION))
+                u.uhunger--;
+            break;
         case 4:
             if (uleft && uleft->otyp != MEAT_RING
                 /* more hungry if +/- is nonzero or +/- doesn't apply or