Character sheets; make one then go back to what you were doing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-18 19:35:21 +01:00
parent d2991ebf7a
commit 34dc85284d
5 changed files with 167 additions and 9 deletions

View file

@ -37,6 +37,29 @@ class ActionTest(unittest.TestCase):
self.assertEqual(p["xp"]["mining"], 50)
self.assertEqual(p["action"]["start"], T0 + 200)
def test_make_one_then_back_to_work(self):
world = world_with(("fred", "warrior"))
p = world["players"]["fred"]
p["bank"] = {"copper_bar": 10, "logs": 10}
game.start_action(world, p, "mine_stone", T0)
game.process_player(world, p, T0 + 100, random.Random(1))
p["xp"]["smithing"] = game.XP_TABLE[5]
self.assertIsNone(game.start_action(world, p, "smith_copper_pickaxe", T0 + 100, once=True))
summary = game.process_player(world, p, T0 + 100 + 30 + 40, random.Random(1))
self.assertEqual(p["bank"]["copper_pickaxe"], 1)
self.assertEqual(summary["resumed"], "mine_stone")
self.assertEqual(p["action"]["id"], "mine_stone")
self.assertEqual(p["bank"]["stone"], 5 + 2) # mining carried on from when the pickaxe was done
def test_make_one_while_idle_just_stops(self):
world = world_with(("fred", "warrior"))
p = world["players"]["fred"]
game.start_action(world, p, "cut_logs", T0, once=True)
game.process_player(world, p, T0 + 500, random.Random(1))
self.assertEqual(p["bank"], {"logs": 1})
self.assertIsNone(p["action"])
self.assertIsNone(p["stopped"])
def test_class_speed_and_lucky_yield(self):
world = world_with(("pia", "pioneer"))
p = world["players"]["pia"]