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:
2025-11-27 00:01:17 -06:00
parent a38906b445
commit fdd48034e4
14 changed files with 2257 additions and 26 deletions

View File

@@ -0,0 +1,56 @@
# Goblin Scout - Easy variant, agile but fragile
# A fast, cowardly goblin that serves as a lookout for its tribe.
# Quick to flee, drops minor loot and the occasional small potion.
enemy_id: goblin_scout
name: Goblin Scout
description: >
A small, wiry goblin with oversized ears and beady yellow eyes.
Goblin scouts are the first line of awareness for their tribes,
often found lurking in shadows or perched in trees. They prefer
to run rather than fight, but will attack if cornered.
base_stats:
strength: 6
dexterity: 14
constitution: 5
intelligence: 6
wisdom: 10
charisma: 4
luck: 10
abilities:
- basic_attack
loot_table:
# Static drops - materials and consumables
- loot_type: static
item_id: goblin_ear
drop_chance: 0.60
quantity_min: 1
quantity_max: 1
- loot_type: static
item_id: goblin_trinket
drop_chance: 0.20
quantity_min: 1
quantity_max: 1
- loot_type: static
item_id: health_potion_small
drop_chance: 0.08
quantity_min: 1
quantity_max: 1
experience_reward: 10
gold_reward_min: 1
gold_reward_max: 4
difficulty: easy
tags:
- humanoid
- goblinoid
- small
- scout
base_damage: 3
crit_chance: 0.08
flee_chance: 0.70