From: PatR Date: Sun, 22 Mar 2020 10:19:28 +0000 (-0700) Subject: fix github issue #304 - #offer old corpses X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=549f6fba52dfe076a9da710040bf7e928117bf88;p=nethack fix github issue #304 - #offer old corpses 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 --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 5a82bcabb..73fc8c66b 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/pray.c b/src/pray.c index d69db0db4..7718bc247 100644 --- a/src/pray.c +++ b/src/pray.c @@ -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);