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%).
This commit is contained in:
parent
189f8ac273
commit
9f0db0ffb1
2 changed files with 16 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue