fix github issue #272 - meat rings, +0 protection

Meat rings were causing increased hunger even though they don't do
anything.  Not mentioned in the report, but cheap plastic imitation
amulets increased hunger too and they don't do anything either.
Trickier to fix, +0 rings of protection were excluded from hunger
on the grounds that +0 rings don't do anything, but since 3.6.0
+0 protection provides +1 to magic cancellation if protection isn't
coming from anywhere else.  Two +0 rings of protection are trickier
still since only one of them provides the MC bonus.

Fixes #272
This commit is contained in:
PatR
2019-12-24 04:31:41 -08:00
parent 6aabc78c83
commit 7ea7058c01
2 changed files with 38 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.34 $ $NHDT-Date: 1577186790 2019/12/24 11:26:30 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ $NHDT-Date: 1577190687 2019/12/24 12:31:27 $
General Fixes and Modified Features
-----------------------------------
@@ -20,6 +20,9 @@ weight for giant spider was too low for creature of size 'large';
leave some menu items out of "invert all" via '@' when their inclusion would
degrade the usefulness of that interface feature
change crysknife from mineral to bone and worm tooth from unspecified to bone
worn meat ring shouldn't cause increased hunger; neither should fake Amulet
worn +0 ring of protection should cause increased hunger if it is the only
source of extrinsic Protection
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1574900825 2019/11/28 00:27:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.206 $ */
/* NetHack 3.6 eat.c $NHDT-Date: 1577190688 2019/12/24 12:31:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2810,19 +2810,47 @@ gethungry()
/* Conflict uses up food too */
if (HConflict || (EConflict & (~W_ARTI)))
u.uhunger--;
/* +0 charged rings don't do anything, so don't affect hunger.
Slow digestion cancels move hunger but still causes ring hunger. */
/*
* +0 charged rings don't do anything, so don't affect hunger.
* Slow digestion cancels movement and melee hunger but still
* causes ring hunger.
* Possessing the real Amulet imposes a separate hunger penalty
* from wearing an amulet (so gets a double penalty when worn).
*
* 3.7.0: Worn meat rings don't affect hunger.
* Same with worn cheap plastic imitation of the Amulet.
* +0 ring of protection might do something (enhanced "magical
* cancellation") if hero doesn't have protection from some
* other source (cloak or second ring).
*/
switch ((int) (g.moves % 20)) { /* note: use even cases only */
case 4:
if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged))
if (uleft && uleft->otyp != MEAT_RING
/* more hungry if +/- is nonzero or +/- doesn't apply or
+0 ring of protection is only source of protection;
need to check whether both rings are +0 protection or
they'd both slip by the "is there another source?" test,
but don't do that for both rings or they will both be
treated as supplying "MC" when only one matters */
&& (uleft->spe
|| !objects[uleft->otyp].oc_charged
|| (uleft->otyp == RIN_PROTECTION
&& ((EProtection & ~W_RINGL) == 0L
|| ((EProtection & ~W_RINGL) == W_RINGR
&& uright && uright->otyp == RIN_PROTECTION
&& !uright->spe)))))
u.uhunger--;
break;
case 8:
if (uamul)
if (uamul && uamul->otyp != FAKE_AMULET_OF_YENDOR)
u.uhunger--;
break;
case 12:
if (uright && (uright->spe || !objects[uright->otyp].oc_charged))
if (uright && uright->otyp != MEAT_RING
&& (uright->spe
|| !objects[uright->otyp].oc_charged
|| (uright->otyp == RIN_PROTECTION
&& (EProtection & ~W_RINGR) == 0L)))
u.uhunger--;
break;
case 16: