Choose when you eat between fights
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8afcba79fc
commit
bc99a1e0c5
5 changed files with 43 additions and 5 deletions
|
|
@ -587,6 +587,7 @@ class CombatTest(unittest.TestCase):
|
|||
|
||||
def test_food_shortens_the_rest_between_fights(self):
|
||||
world, p = self.fighter(level=30)
|
||||
p["eat_below"] = 1.0 # eat whenever a bite is quicker
|
||||
top = game.max_hp(p)
|
||||
p["bank"] = {}
|
||||
resting, eaten = game.rest_plan(world, p, top / 2)
|
||||
|
|
@ -605,6 +606,20 @@ class CombatTest(unittest.TestCase):
|
|||
p["bank"] = {"bread": 100}
|
||||
self.assertEqual(game.rest_plan(world, p, 100)[1], {}) # a bite of bread is no faster than resting
|
||||
|
||||
def test_you_choose_how_hurt_you_eat_at(self):
|
||||
world, p = self.fighter(level=30)
|
||||
top = game.max_hp(p)
|
||||
p["bank"] = {"cooked_salmon": 100}
|
||||
self.assertEqual(p["eat_below"], 0.5)
|
||||
self.assertEqual(game.rest_plan(world, p, top * 0.95)[1], {}) # a scratch: just rest
|
||||
_seconds, eaten = game.rest_plan(world, p, top * 0.2)
|
||||
self.assertEqual(eaten, {"cooked_salmon": 2}) # back over half, then rest
|
||||
self.assertIsNone(game.set_eat_below(p, 0))
|
||||
self.assertEqual(game.rest_plan(world, p, top * 0.2)[1], {}) # never
|
||||
self.assertIsNone(game.set_eat_below(p, 1.0))
|
||||
self.assertEqual(game.rest_plan(world, p, top * 0.2)[1], {"cooked_salmon": 5}) # all the way
|
||||
self.assertEqual(game.set_eat_below(p, 0.3), "Pick one of the choices")
|
||||
|
||||
def test_food_is_eaten_resting_not_fighting(self):
|
||||
world, p = self.fighter(level=15, weapon="iron_sword", helmet="iron_helmet", body="iron_body", legs="iron_legs")
|
||||
p["bank"] = {"cooked_trout": 100}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue