From 9f0db0ffb131c6d1d26eafdccb10379b5ed6d1e7 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 14 Feb 2026 10:05:26 -0500 Subject: [PATCH] Wire loot tables into corpse creation Combat engine looks up mob template loot table and passes to create_corpse. Goblin template now drops crude club (80%) and 1-3 gold coins (50%). --- content/mobs/goblin.toml | 11 +++++++++++ src/mudlib/combat/engine.py | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/content/mobs/goblin.toml b/content/mobs/goblin.toml index 19b43fc..1036acc 100644 --- a/content/mobs/goblin.toml +++ b/content/mobs/goblin.toml @@ -4,3 +4,14 @@ pl = 50.0 stamina = 40.0 max_stamina = 40.0 moves = ["punch left", "punch right", "sweep"] + +[[loot]] +name = "crude club" +chance = 0.8 +description = "a crude wooden club" + +[[loot]] +name = "gold coin" +chance = 0.5 +min_count = 1 +max_count = 3 diff --git a/src/mudlib/combat/engine.py b/src/mudlib/combat/engine.py index 39d2c9e..18507df 100644 --- a/src/mudlib/combat/engine.py +++ b/src/mudlib/combat/engine.py @@ -171,11 +171,15 @@ async def process_combat() -> None: # Despawn mob losers, send victory/defeat messages if isinstance(loser, Mob): from mudlib.corpse import create_corpse + from mudlib.mobs import mob_templates from mudlib.zone import Zone zone = loser.location if isinstance(zone, Zone): - create_corpse(loser, zone) + # Look up loot table from mob template + template = mob_templates.get(loser.name) + loot_table = template.loot if template else None + create_corpse(loser, zone, loot_table=loot_table) else: from mudlib.mobs import despawn_mob