Crafting queue menu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
77fa8ad3e6
commit
4abf165857
5 changed files with 115 additions and 2 deletions
|
|
@ -152,6 +152,25 @@ class ActionTest(unittest.TestCase):
|
|||
game.drop_out(world, p, T0)
|
||||
self.assertEqual(p["queue"], [])
|
||||
|
||||
def test_managing_the_queue(self):
|
||||
world, p = self._smith(20)
|
||||
game.start_action(world, p, "smith_copper_helmet", T0, once=2)
|
||||
for item in ("smith_copper_legs", "smith_copper_sword", "smith_copper_rivets"):
|
||||
game.queue_add(world, p, item, 1, T0)
|
||||
self.assertIsNone(game.queue_move(p, 2, 0))
|
||||
self.assertEqual([q["id"] for q in p["queue"]], ["smith_copper_rivets", "smith_copper_legs", "smith_copper_sword"])
|
||||
self.assertEqual(game.queue_move(p, 0, 3), "Not in the queue")
|
||||
self.assertIsNone(game.queue_set(p, 1, 3))
|
||||
self.assertEqual(p["queue"][1]["n"], 3)
|
||||
self.assertEqual(game.queue_set(p, 1, 0), f"1 to {game.MAKE_MAX:,}")
|
||||
self.assertIsNone(game.skip_make(world, p, T0 + 5)) # the helmets: on to the rivets
|
||||
self.assertEqual((p["action"]["id"], p["action"]["left"], p["action"]["resume"]), ("smith_copper_rivets", 1, "mine_stone"))
|
||||
self.assertEqual(len(p["queue"]), 2)
|
||||
p["queue"] = []
|
||||
game.skip_make(world, p, T0 + 6) # nothing left: back to work
|
||||
self.assertEqual(p["action"]["id"], "mine_stone")
|
||||
self.assertEqual(game.skip_make(world, p, T0 + 7), "Not making anything")
|
||||
|
||||
def test_offline_cap(self):
|
||||
world = world_with(("fred", "commoner"))
|
||||
p = world["players"]["fred"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue