Guard kit: halberds, pavises, gambesons, salves; Raid readiness
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3d93fabbfd
commit
002e990dc4
4 changed files with 175 additions and 46 deletions
|
|
@ -1533,6 +1533,42 @@ class TierTest(unittest.TestCase):
|
|||
recipe = game.ACTION_BY_ID["lw_elk_leather_guard_jerkin"]
|
||||
self.assertEqual(recipe["inputs"], {"elk_leather": 12})
|
||||
|
||||
def test_guard_kit_shares_slots_below_trophy_gear(self):
|
||||
world = world_with()
|
||||
world["city"]["stockpile"] = {"rune_sword": 2, "mithril_halberd": 50, "maple_pavise": 4,
|
||||
"moonweave_gambeson": 5, "tarromin_salve": 50}
|
||||
world["city"]["wages"] = 10_000
|
||||
parts = game.defence(world)["parts"]
|
||||
armed = int(world["city"]["population"] // 2) # 10
|
||||
self.assertEqual(parts["weapons"], round(0.35 * (2 * 35 + (armed - 2) * 15), 1))
|
||||
self.assertEqual(parts["shields"], 0.5 * 4 * 7)
|
||||
self.assertEqual(parts["jerkins"], round(game.JERKIN_DEFENCE * 5 * 8, 1))
|
||||
self.assertEqual(parts["salves"], round(game.SALVE_DEFENCE * armed * 3, 1))
|
||||
self.assertLess(game.ITEMS["mithril_halberd"]["power"], game.ITEMS["mithril_sword"]["power"])
|
||||
for item in ("mithril_halberd", "maple_pavise", "moonweave_gambeson", "tarromin_salve"):
|
||||
self.assertNotIn("slot", game.ITEMS[item]) # city kit, not player gear
|
||||
self.assertEqual(game.ACTION_BY_ID["smith_mithril_halberd"]["inputs"], {"mithril_bar": 6})
|
||||
self.assertEqual(game.ACTION_BY_ID["make_maple_pavise"]["inputs"], {"maple_plank": 9})
|
||||
self.assertEqual(game.ACTION_BY_ID["brew_tarromin_salve"]["inputs"], {"tarromin": 6})
|
||||
|
||||
def test_salves_are_capped(self):
|
||||
world = world_with()
|
||||
world["city"]["stockpile"] = {"snapdragon_salve": 500}
|
||||
world["city"]["buildings"]["barracks"]["level"] = 5
|
||||
world["city"]["population"] = 400.0
|
||||
world["city"]["wages"] = 1_000_000
|
||||
self.assertEqual(game.defence(world)["parts"]["salves"], game.SALVE_CAP)
|
||||
|
||||
def test_readiness_counts_guard_kit(self):
|
||||
world = world_with()
|
||||
world["city"]["stockpile"] = {"steel_halberd": 3, "oak_pavise": 2, "linen_gambeson": 4, "guam_leaf_salve": 1}
|
||||
world["city"]["buildings"]["smithy"]["level"] = 1
|
||||
have = {r["label"]: r["have"] for r in game.raid_readiness(world, {"strength": 200})}
|
||||
self.assertEqual(have["Weapons (any)"], 3)
|
||||
self.assertEqual(have["Shields (any)"], 2)
|
||||
self.assertEqual(have["Body armour (any)"], 4)
|
||||
self.assertEqual(have["Salves (any)"], 1)
|
||||
|
||||
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)
|
||||
|
|
@ -2075,6 +2111,16 @@ class WearTest(unittest.TestCase):
|
|||
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_issued_salves_are_used_up(self):
|
||||
self.city["stockpile"] = {"guam_leaf_salve": 30, "arrows": 100}
|
||||
self.city["buildings"]["barracks"]["level"] = 1
|
||||
self.city["wages"] = 10_000
|
||||
event = {"strength": 1, "sabotage": 0, "group": "the Red Hand"}
|
||||
game._resolve_raid(self.world, event, T0, random.Random(1))
|
||||
# 20 guards each use one; the 10 spares are kept.
|
||||
self.assertEqual(self.city["stockpile"]["guam_leaf_salve"], 10)
|
||||
self.assertIn("The wounded used 20 guam salves.", event["report"]["lines"])
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue