feat(api): implement combat loot integration with hybrid static/procedural system
Add CombatLootService that orchestrates loot generation from combat, supporting both static item drops (consumables, materials) and procedural equipment generation (weapons, armor with affixes). Key changes: - Extend LootEntry model with LootType enum (STATIC/PROCEDURAL) - Create StaticItemLoader service for consumables/materials from YAML - Create CombatLootService with full rarity formula incorporating: - Party average level - Enemy difficulty tier (EASY: +0%, MEDIUM: +5%, HARD: +15%, BOSS: +30%) - Character luck stat - Per-entry rarity bonus - Integrate with CombatService._calculate_rewards() for automatic loot gen - Add boss guaranteed drops via generate_boss_loot() New enemy variants (goblin family proof-of-concept): - goblin_scout (Easy) - static drops only - goblin_warrior (Medium) - static + procedural weapon drops - goblin_chieftain (Hard) - static + procedural weapon/armor drops Static items added: - consumables.yaml: health/mana potions, elixirs, food - materials.yaml: trophy items, crafting materials Tests: 59 new tests across 3 test files (all passing)
This commit is contained in:
70
api/app/data/enemies/goblin_warrior.yaml
Normal file
70
api/app/data/enemies/goblin_warrior.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
# Goblin Warrior - Medium variant, trained fighter
|
||||
# A battle-hardened goblin wielding crude but effective weapons.
|
||||
# More dangerous than scouts, fights in organized groups.
|
||||
|
||||
enemy_id: goblin_warrior
|
||||
name: Goblin Warrior
|
||||
description: >
|
||||
A muscular goblin clad in scavenged armor and wielding a crude
|
||||
but deadly weapon. Goblin warriors are the backbone of any goblin
|
||||
warband, trained to fight rather than flee. They attack with
|
||||
surprising ferocity and coordination.
|
||||
|
||||
base_stats:
|
||||
strength: 12
|
||||
dexterity: 10
|
||||
constitution: 10
|
||||
intelligence: 6
|
||||
wisdom: 6
|
||||
charisma: 4
|
||||
luck: 8
|
||||
|
||||
abilities:
|
||||
- basic_attack
|
||||
- shield_bash
|
||||
|
||||
loot_table:
|
||||
# Static drops - materials and consumables
|
||||
- loot_type: static
|
||||
item_id: goblin_ear
|
||||
drop_chance: 0.80
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
- loot_type: static
|
||||
item_id: goblin_war_paint
|
||||
drop_chance: 0.15
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
- loot_type: static
|
||||
item_id: health_potion_small
|
||||
drop_chance: 0.15
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
- loot_type: static
|
||||
item_id: iron_ore
|
||||
drop_chance: 0.10
|
||||
quantity_min: 1
|
||||
quantity_max: 2
|
||||
|
||||
# Procedural equipment drops
|
||||
- loot_type: procedural
|
||||
item_type: weapon
|
||||
drop_chance: 0.08
|
||||
rarity_bonus: 0.0
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
|
||||
experience_reward: 25
|
||||
gold_reward_min: 5
|
||||
gold_reward_max: 15
|
||||
difficulty: medium
|
||||
|
||||
tags:
|
||||
- humanoid
|
||||
- goblinoid
|
||||
- warrior
|
||||
- armed
|
||||
|
||||
base_damage: 8
|
||||
crit_chance: 0.10
|
||||
flee_chance: 0.45
|
||||
Reference in New Issue
Block a user