]> granicus.if.org Git - nethack/commitdiff
fix github issue #304 - #offer old corpses
authorPatR <rankin@nethack.org>
Sun, 22 Mar 2020 10:19:28 +0000 (03:19 -0700)
committerPatR <rankin@nethack.org>
Sun, 22 Mar 2020 10:19:28 +0000 (03:19 -0700)
Same race corpses, deceased pet corpses, wraith corpses, and unicorn
corpses could be sacrificed even when otherwise too old.  This
prevents that for wraith and unicorn corpses but leaves the same
race and dead pet cases as is.  I'm not sure that this is the right
way to resolve things but at least has the virute of being simple.

This also lets chaotics get the trivial bonus for sacrificing a
wraith corpse even though alignment matches.  Alignment doesn't
matter for anything else (except unicorns) and giving up a wraith
corpse that isn't too old to eat is a tangible sacrifice.  Unless
the hero is vegetarian (or the supersets vegan and foodless) since
giving up a corpse that won't be eaten isn't worthy of a bonus.
(It will still retain regular sacrifice value in that situation.)

Fixes #304

doc/fixes37.0
src/pray.c

index 5a82bcabbb53b737341e5da48c42aca3cb2edc83..73fc8c66b73452d778c586dbebc82b1ac512e690 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ $NHDT-Date: 1584869896 2020/03/22 09:38:16 $
+$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.142 $ $NHDT-Date: 1584872363 2020/03/22 10:19:23 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -90,6 +90,7 @@ correctly account for fuel remaining when lit candles are attached
 praying on an unaligned altar outside of Gehennom behaved like an ordinary
        prayer; make that always fail
 Discworld typo: Moving Pictures passage 12 "or" -> "of"
+unicorn corpses and wraith corpses could be sacrificed even if "too old"
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index d69db0db481f48bc8f8a9b7867bf6826a83b3c7b..7718bc247776aac5580a6c2a0a1e68f0c6670af1 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 pray.c  $NHDT-Date: 1584756090 2020/03/21 02:01:30 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ */
+/* NetHack 3.6 pray.c  $NHDT-Date: 1584872363 2020/03/22 10:19:23 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.142 $ */
 /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1371,6 +1371,8 @@ dosacrifice()
                 value = eaten_stat(value, otmp);
         }
 
+        /* same race or former pet results apply even if the corpse is
+           too old (value==0) */
         if (your_race(ptr)) {
             if (is_demon(g.youmonst.data)) {
                 You("find the idea very satisfying.");
@@ -1454,8 +1456,16 @@ dosacrifice()
             adjalign(-3);
             value = -1;
             HAggravate_monster |= FROMOUTSIDE;
+        } else if (!value) {
+            ; /* too old; don't give undead or unicorn bonus or penalty */
         } else if (is_undead(ptr)) { /* Not demons--no demon corpses */
-            if (u.ualign.type != A_CHAOTIC)
+            /* most undead that leave a corpse yield 'human' (or other race)
+               corpse so won't get here; the exception is wraith; give the
+               bonus for wraith to chaotics too because they are sacrificing
+               something valuable (unless hero refuses to eat such things) */
+            if (u.ualign.type != A_CHAOTIC
+                /* reaching this side of the 'or' means hero is chaotic */
+                || (ptr == &mons[PM_WRAITH] && u.uconduct.unvegetarian))
                 value += 1;
         } else if (is_unicorn(ptr)) {
             int unicalign = sgn(ptr->maligntyp);