Guard jerkins: leather-only city kit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-27 17:40:41 +00:00
parent 4abf165857
commit 54f703341e
3 changed files with 56 additions and 12 deletions

View file

@ -1427,6 +1427,18 @@ class TierTest(unittest.TestCase):
self.assertEqual(parts["weapons"], round(0.35 * (2 * 35 + (armed - 2) * 4), 1))
self.assertEqual(parts["shields"], 0.5 * 3 * 4)
def test_guards_wear_the_best_jerkins(self):
world = world_with()
world["city"]["stockpile"] = {"leather_guard_jerkin": 50, "elk_leather_guard_jerkin": 3}
world["city"]["wages"] = 10_000
parts = game.defence(world)["parts"]
armed = int(world["city"]["population"] // 2) # 10
self.assertEqual(parts["jerkins"], round(game.JERKIN_DEFENCE * (3 * 10 + (armed - 3) * 2), 1))
self.assertEqual(game.city_uses("elk_leather_guard_jerkin"), ["the armoury"])
self.assertNotIn("slot", game.ITEMS["elk_leather_guard_jerkin"]) # city kit, not player gear
recipe = game.ACTION_BY_ID["lw_elk_leather_guard_jerkin"]
self.assertEqual(recipe["inputs"], {"elk_leather": 12})
def test_higher_building_levels_need_higher_tiers(self):
self.assertNotIn("steel_bar", game.build_cost("walls", 2))
self.assertEqual(game.build_cost("walls", 3)["steel_bar"], 60)
@ -1947,6 +1959,16 @@ class WearTest(unittest.TestCase):
self.assertEqual(broken, {"copper_sword": 8})
self.assertEqual(self.city["stockpile"], {"iron_sword": 10, "copper_sword": 22})
def test_issued_jerkins_break_too(self):
self.city["stockpile"] = {"bear_leather_guard_jerkin": 30}
self.city["buildings"]["barracks"]["level"] = 1
self.city["wages"] = 10_000
rng = random.Random()
rng.random = lambda: 0.0
# 20 defenders wear 20 jerkins; 8 break, the 10 spares are untouched.
self.assertEqual(game.wear_kit(self.world, 0.4, rng), {"bear_leather_guard_jerkin": 8})
self.assertEqual(self.city["stockpile"], {"bear_leather_guard_jerkin": 22})
def test_a_won_raid_breaks_some_kit_and_reports_it(self):
self.city["stockpile"] = {"copper_sword": 20, "arrows": 100}
self.city["wages"] = 10_000