Crafting stations, strongboxes and bags
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
636123e454
commit
722cf0b382
6 changed files with 182 additions and 14 deletions
|
|
@ -1729,3 +1729,48 @@ class JewelcraftingTest(unittest.TestCase):
|
|||
self.assertEqual(self.ann["bank"], {"garnet_haste": 2, "garnet": 1})
|
||||
self.assertEqual(self.ann["equip"]["ring"], "quartz_haste")
|
||||
self.assertEqual(self.ann["action"]["id"], "jc_garnet_haste")
|
||||
|
||||
|
||||
class StationAndStorageTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.world = world_with(("bob", "commoner"))
|
||||
self.bob = self.world["players"]["bob"]
|
||||
|
||||
def test_recipes_pull_in_other_trades(self):
|
||||
self.assertEqual(game.ACTION_BY_ID["make_oak_loom"]["inputs"],
|
||||
{"oak_plank": 3, "iron_nails": 5, "hard_leather": 2})
|
||||
self.assertEqual(game.ACTION_BY_ID["make_wooden_hearth"]["inputs"],
|
||||
{"plank": 3, "copper_rivets": 5, "copper_bar": 2})
|
||||
self.assertEqual(game.ACTION_BY_ID["make_oak_strongbox"]["inputs"],
|
||||
{"oak_plank": 4, "iron_nails": 10, "hard_leather": 2})
|
||||
self.assertEqual(game.ACTION_BY_ID["sew_cotton_bag"]["inputs"], {"cotton_cloth": 4, "hard_leather": 1})
|
||||
self.assertEqual(game.ACTION_BY_ID["sew_cotton_bag"]["skill"], "tailoring")
|
||||
|
||||
def test_a_station_speeds_its_craft(self):
|
||||
smelt = game.ACTION_BY_ID["smith_copper_bar"]
|
||||
bare = game.action_time(self.world, self.bob, smelt)
|
||||
self.bob["equip"]["tool_smithing"] = "oak_anvil_stand"
|
||||
self.assertAlmostEqual(game.action_time(self.world, self.bob, smelt), bare * 0.7)
|
||||
|
||||
def test_strongbox_adds_slots_and_bag_a_bigger_stack(self):
|
||||
slots, stack = game.bank_slots(self.world, self.bob), game.stack_size(self.world, self.bob)
|
||||
self.bob["bank"] = {"stone": 1200}
|
||||
self.assertEqual(game.slots_used(self.world, self.bob), 2)
|
||||
self.bob["equip"].update(storage="oak_strongbox", bag="linen_bag")
|
||||
self.assertEqual(game.bank_slots(self.world, self.bob), slots + 4)
|
||||
self.assertEqual(game.stack_size(self.world, self.bob), stack + 250)
|
||||
self.assertEqual(game.slots_used(self.world, self.bob), 1)
|
||||
|
||||
def test_no_smaller_strongbox_while_the_bank_is_full(self):
|
||||
import types
|
||||
import app
|
||||
handler = types.SimpleNamespace(store=types.SimpleNamespace(world=self.world))
|
||||
handler._equip = lambda *args: app.Handler._equip(handler, *args)
|
||||
self.bob["equip"]["storage"] = "oak_strongbox"
|
||||
self.bob["bank"] = {f"{wood}_plank" if wood != "wooden" else "plank": 1 for wood in game.WOODS}
|
||||
self.bob["bank"].update({item: 1 for item in ("stone", "logs", "coal", "bones", "wheat", "flax", "rope",
|
||||
"bricks", "thatch", "wooden_strongbox")})
|
||||
self.assertEqual(game.overfull(self.world, self.bob), 0) # 16 items in 12 + 4 slots: room for the swap, not after
|
||||
self.assertEqual(app.Handler.equip(handler, self.bob, "wooden_strongbox", None), "Bank too full for that")
|
||||
self.assertEqual(self.bob["equip"]["storage"], "oak_strongbox")
|
||||
self.assertEqual(self.bob["bank"]["wooden_strongbox"], 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue