Work orders: relics, reagents and trophies under Materials

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-03 15:55:11 +00:00
parent fa43661a33
commit b3d0645d55
2 changed files with 35 additions and 0 deletions

11
game.py
View file

@ -4017,6 +4017,14 @@ def _order_sources() -> tuple[dict, dict]:
elif action["skill"] in GATHERING:
for output in [*action["outputs"], *(item for item, _qty, _odds in action.get("finds", []))]:
gather.setdefault(output, action["id"])
# What only fights get you: reagents, trophies and relics, from the first fight or dungeon with them.
for action in sorted(ACTIONS, key=lambda a: a["level"]):
if "enemy" not in action or action.get("special"):
continue
relic = [action["loot"]["relic"]] if "loot" in action else []
for item in [*relic, *(drop[0] for drop in action.get("drops", []))]:
if item in REAGENTS or item in TROPHIES or ITEMS[item].get("relic"):
gather.setdefault(item, action["id"])
return craft, gather
@ -6844,6 +6852,9 @@ ORDER_RECIPES, ORDER_RAW = _order_sources()
# What changed, shown on the Patch notes page. Newest first; every shipped change adds a
# line here (new / balance / fix), and a new release a new entry on top.
PATCH_NOTES = [
{"date": "2026-11-03", "title": "Combat materials on order", "notes": [
("new", "Work orders: relics, reagents and trophies under Materials ⚔️, by area."),
]},
{"date": "2026-11-02", "title": "Militia drilling", "notes": [
("fix", "Drilling the militia is no longer wiped before a raid is calculated. Last raid losses recalculated."),
]},

View file

@ -2675,6 +2675,30 @@ class WorkOrderTest(unittest.TestCase):
self.assertEqual(self.mike["bank"]["oak_logs"], 200)
self.assertEqual(order["status"], "done")
def test_combat_materials_can_be_asked_for(self):
relics = [spec["relic"] for spec in (game.ACTION_BY_ID[key]["loot"] for key in game.DUNGEON_LOOT)]
for item in [*relics, *game.REAGENTS, *game.TROPHIES]:
self.assertEqual(game.ACTION_BY_ID[game.ORDER_RAW[item]]["skill"], "combat", item)
self.assertEqual(game.ORDER_RAW["watchtower_relic"], "dungeon_watchtower")
self.assertEqual(game.ORDER_RAW["watchtower_plating"], "fight_clay_golems")
self.assertEqual(game.ORDER_RAW["grave_dust"], "fight_restless_dead")
self.assertNotIn("pattern_ogre_forged_sword", game.ORDER_RAW)
self.assertNotIn("ogres_knuckle", game.ORDER_RAW)
self.assertNotIn("bones", game.ORDER_RAW)
def test_a_relic_order_is_delivered_like_any_material(self):
self.mike["gold"] = 500
self.assertIsNone(game.post_order(self.world, self.mike, "gather", "watchtower_relic", 3, None, 80, T0))
order = self.world["orders"][0]
self.assertEqual((order["skill"], order["level"]), ("combat", 20))
self.fred["bank"] = {"watchtower_relic": 2}
self.assertIsNone(game.deliver_order(self.world, self.fred, order["id"], T0))
self.assertEqual(self.fred["gold"], 160)
self.assertEqual(self.mike["bank"]["watchtower_relic"], 2)
self.assertEqual(order["status"], "open")
self.assertEqual(game.post_order(self.world, self.mike, "gather", "watchtower_relic", 1, None, 0, T0, city=True),
"The city has no use for that")
def test_orders_expire_and_refund(self):
self.post_hammer()
game.expire_orders(self.world, T0 + 4 * game.DAY)