more hunger checks
I don't know what I was thinking before. 'moves + rn2(20)' can be simplified to just rn2(20) and ignore moves altogether.
This commit is contained in:
10
src/eat.c
10
src/eat.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 eat.c $NHDT-Date: 1599255099 2020/09/04 21:31:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.232 $ */
|
/* NetHack 3.7 eat.c $NHDT-Date: 1599258557 2020/09/04 22:29:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.233 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -2811,7 +2811,7 @@ bite()
|
|||||||
void
|
void
|
||||||
gethungry()
|
gethungry()
|
||||||
{
|
{
|
||||||
long accessorytime;
|
int accessorytime;
|
||||||
|
|
||||||
if (u.uinvulnerable)
|
if (u.uinvulnerable)
|
||||||
return; /* you don't feel hungrier */
|
return; /* you don't feel hungrier */
|
||||||
@@ -2837,8 +2837,8 @@ gethungry()
|
|||||||
* Also causes melee-induced hunger to vary from turn-based hunger
|
* Also causes melee-induced hunger to vary from turn-based hunger
|
||||||
* instead of just replicating that.
|
* instead of just replicating that.
|
||||||
*/
|
*/
|
||||||
accessorytime = g.moves + (long) rn2(20);
|
accessorytime = rn2(20); /* rn2(20) replaces (int) (g.moves % 20L) */
|
||||||
if (accessorytime % 2L) { /* odd */
|
if (accessorytime % 2) { /* odd */
|
||||||
/* Regeneration uses up food, unless due to an artifact */
|
/* Regeneration uses up food, unless due to an artifact */
|
||||||
if ((HRegeneration & ~FROMFORM)
|
if ((HRegeneration & ~FROMFORM)
|
||||||
|| (ERegeneration & ~(W_ARTI | W_WEP)))
|
|| (ERegeneration & ~(W_ARTI | W_WEP)))
|
||||||
@@ -2864,7 +2864,7 @@ gethungry()
|
|||||||
* cancellation") if hero doesn't have protection from some
|
* cancellation") if hero doesn't have protection from some
|
||||||
* other source (cloak or second ring).
|
* other source (cloak or second ring).
|
||||||
*/
|
*/
|
||||||
switch ((int) (accessorytime % 20L)) { /* note: use even cases only */
|
switch (accessorytime) { /* note: use even cases among 0..19 only */
|
||||||
case 4:
|
case 4:
|
||||||
if (uleft && uleft->otyp != MEAT_RING
|
if (uleft && uleft->otyp != MEAT_RING
|
||||||
/* more hungry if +/- is nonzero or +/- doesn't apply or
|
/* more hungry if +/- is nonzero or +/- doesn't apply or
|
||||||
|
|||||||
Reference in New Issue
Block a user