From: PatR Date: Thu, 12 May 2016 00:55:33 +0000 (-0700) Subject: nutritution consumption/starvation tweaks X-Git-Tag: NetHack-3.6.1_RC01~780 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43df8c01303ab06e6f462d581376bb914575e497;p=nethack nutritution consumption/starvation tweaks Being polymorphed into a creature capable of eating metal objects was treated as if the hero didn't/couldn't eat. Treat it the same as being able to eat ordinary food instead. Being fainted or unconscious from other than sleep both ran metabolism at full rate, unlike being asleep which skips per-turn consumption 9 times out of 10 (but retains periodic ring/amulet and hunger/regeneration/conflict consumption). Switch to 'Unaware' to handle sleep, unconsciousness other than sleep, and fainted from lack of food as one metabolic condition. Being paralyzed isn't included but maybe should be. Changing how metabolism operates when fainted changes the amount of time until starvation occurs, so I adjusted that by an arbitrary amount. It will probably need tuning. As things stand, you'll still faint umpteen times before starving, bringing about lots of frustration since the player can't do much during that time. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index f48c7c5a0..595878036 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -234,6 +234,10 @@ effects of cursed potion of levitation were skipped if already levitating when engulfed, having swallower be killed by angry deity trying to zap hero no longer violates pacifist conduct (other penalties--reduced luck or alignment--still apply if target is something you shouldn't kill) +metabolism adjustments: hero poly'd into metallivore form still needs to eat; + being fainted or unconscious from other than sleep now consumes + nutrition at lower rate, like being asleep already did; + starvation threshold shortened due to slower food use while fainting Fixes to Post-3.6.0 Problems that Were Exposed Via git Respository diff --git a/src/eat.c b/src/eat.c index 4c69cf147..c66f4c91d 100644 --- a/src/eat.c +++ b/src/eat.c @@ -2657,15 +2657,21 @@ bite() return 0; } -/* as time goes by - called by moveloop() and domove() */ +/* as time goes by - called by moveloop(every move) & domove(melee attack) */ void gethungry() { if (u.uinvulnerable) return; /* you don't feel hungrier */ - if ((!u.usleep || !rn2(10)) /* slow metabolic rate while asleep */ - && (carnivorous(youmonst.data) || herbivorous(youmonst.data)) + /* being polymorphed into a creature which doesn't eat prevents + this first uhunger decrement, but to stay in such form the hero + will need to wear an Amulet of Unchanging so still burn a small + amount of nutrition in the 'moves % 20' ring/amulet check below */ + if ((!Unaware || !rn2(10)) /* slow metabolic rate while asleep */ + && (carnivorous(youmonst.data) + || herbivorous(youmonst.data) + || metallivorous(youmonst.data)) && !Slow_digestion) u.uhunger--; /* ordinary food consumption */ @@ -2682,8 +2688,8 @@ 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 still uses ring hunger */ + /* +0 charged rings don't do anything, so don't affect hunger. + Slow digestion cancels move hunger but still causes ring hunger. */ switch ((int) (moves % 20)) { /* note: use even cases only */ case 4: if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged)) @@ -2844,11 +2850,14 @@ boolean incr; } if (newhs == FAINTING) { + /* u,uhunger is likely to be negative at this point */ + int uhunger_div_by_10 = sgn(u.uhunger) * ((abs(u.uhunger) + 5) / 10); + if (is_fainted()) newhs = FAINTED; - if (u.uhs <= WEAK || rn2(20 - u.uhunger / 10) >= 19) { + if (u.uhs <= WEAK || rn2(20 - uhunger_div_by_10) >= 19) { if (!is_fainted() && multi >= 0 /* %% */) { - int duration = 10 - (u.uhunger / 10); + int duration = 10 - uhunger_div_by_10; /* stop what you're doing, then faint */ stop_occupation(); @@ -2863,7 +2872,11 @@ boolean incr; if (!Levitation) selftouch("Falling, you"); } - } else if (u.uhunger < -(int) (200 + 20 * ACURR(A_CON))) { + + /* this used to be -(200 + 20 * Con) but that was when being asleep + suppressed per-turn uhunger decrement but being fainted didn't; + now uhunger becomes more negative at a slower rate */ + } else if (u.uhunger < -(100 + 10 * (int) ACURR(A_CON))) { u.uhs = STARVED; context.botl = 1; bot();