Repository navigation
Fix the player getting a free turn when automatically eating food when starving - #798
Conversation
brturn
left a comment
There was a problem hiding this comment.
Minor comments. Looks good.
| rogue.flareCount = 0; | ||
| } | ||
|
|
||
| if (player.status[STATUS_NUTRITION] <= 1) { |
There was a problem hiding this comment.
I like this location better for the forced turn. Slightly concerned that the separation between food decrement and forced-eating could allow a non-local exit condition to skip the forced turn. Haven’t traced it but might be worth another look.
There was a problem hiding this comment.
I will defer to nstoddard on this - just let me know when you want to merge
There was a problem hiding this comment.
From reading the code, it looks like the only times this function returns early are when the player dies, and when the player falls down a chasm. Skipping this check in the first case is obviously fine, and in the second case, I think it's fine for the forced turn to be delayed by a turn (it'll be really rare anyway, and I don't see how it could be exploited).
There was a problem hiding this comment.
Agreed, and the check will land the next turn anyway. (I can see the rogue getting a little preoccupied by falling through a chasm and not wanting to eat food at the same time)
…n starving Previously, automatically eating food when starving would not only eat the food without using a turn, it would give the player a free turn afterwards. In addition, becoming hungry/weak/etc no longer consumes an extra turn of food. This simplifies the code and should have minimal effect on gameplay.
60ada82 to
43c4997
Compare
Previously, automatically eating food when starving would not only eat the food without using a turn, it would give the player a free turn afterwards.
In addition, becoming hungry/weak/etc no longer consumes an extra turn of food. This simplifies the code and should have minimal effect on gameplay.