hunger checks
Eliminate the feasibility of micro-managing ring hunger by swapping back and forth between a pair of rings of slow digestion. Wearing one at a time causes normal ring hunger (wearing both at once just increases such hunger), but being able to put on the second ring and take off the first just before the 1 out of 20 turns where it affects hunger, then vice versa a few turns later, is an insanely tedious way to avoid any hunger at all, made possible by the 'time' option. Make the turns where extra hunger get imposed be randomized so that that can't be done reliably. Also closes githib issue #336: hunger caused by melee attacking adds ring and amulet hunger a second time for that turn. That has always been intentional behavior; now the amount varies for any given attack due to the randomization, but on average is the same as before. Closes #336
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.296 $ $NHDT-Date: 1599184888 2020/09/04 02:01:28 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.297 $ $NHDT-Date: 1599255099 2020/09/04 21:31:39 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -249,6 +249,7 @@ end of game inventory disclosure passed an inappropriate argument to the
|
||||
noticeable but not harmful for X11, and slightly harmful for Qt
|
||||
turning into slime rendered hero as slime one turn too soon
|
||||
avoid potential infinite loop if hangup occurs at ring "right or left?" prompt
|
||||
randomize the turns where accessories and extrinsics affect nutrition
|
||||
|
||||
|
||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||
|
||||
21
src/eat.c
21
src/eat.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 eat.c $NHDT-Date: 1596498165 2020/08/03 23:42:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.231 $ */
|
||||
/* NetHack 3.7 eat.c $NHDT-Date: 1599255099 2020/09/04 21:31:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.232 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2811,6 +2811,8 @@ bite()
|
||||
void
|
||||
gethungry()
|
||||
{
|
||||
long accessorytime;
|
||||
|
||||
if (u.uinvulnerable)
|
||||
return; /* you don't feel hungrier */
|
||||
|
||||
@@ -2825,14 +2827,25 @@ gethungry()
|
||||
&& !Slow_digestion)
|
||||
u.uhunger--; /* ordinary food consumption */
|
||||
|
||||
if (g.moves % 2) { /* odd turns */
|
||||
/*
|
||||
* 3.7: trigger is randomized instead of (moves % N). Makes
|
||||
* ring juggling (using the 'time' option to see the turn counter
|
||||
* in order to time swapping of a pair of rings of slow digestion,
|
||||
* wearing one on one hand, then putting on the other and taking
|
||||
* off the first, then vice versa, over and over and over and ...
|
||||
* to avoid any hunger from wearing a ring) become ineffective.
|
||||
* Also causes melee-induced hunger to vary from turn-based hunger
|
||||
* instead of just replicating that.
|
||||
*/
|
||||
accessorytime = g.moves + (long) rn2(20);
|
||||
if (accessorytime % 2L) { /* odd */
|
||||
/* Regeneration uses up food, unless due to an artifact */
|
||||
if ((HRegeneration & ~FROMFORM)
|
||||
|| (ERegeneration & ~(W_ARTI | W_WEP)))
|
||||
u.uhunger--;
|
||||
if (near_capacity() > SLT_ENCUMBER)
|
||||
u.uhunger--;
|
||||
} else { /* even turns */
|
||||
} else { /* even */
|
||||
if (Hunger)
|
||||
u.uhunger--;
|
||||
/* Conflict uses up food too */
|
||||
@@ -2851,7 +2864,7 @@ gethungry()
|
||||
* 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 */
|
||||
switch ((int) (accessorytime % 20L)) { /* note: use even cases only */
|
||||
case 4:
|
||||
if (uleft && uleft->otyp != MEAT_RING
|
||||
/* more hungry if +/- is nonzero or +/- doesn't apply or
|
||||
|
||||
Reference in New Issue
Block a user