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:
85
api/app/data/enemies/goblin_chieftain.yaml
Normal file
85
api/app/data/enemies/goblin_chieftain.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
# Goblin Chieftain - Hard variant, elite tribe leader
|
||||
# A cunning and powerful goblin leader, adorned with trophies.
|
||||
# Commands respect through fear and violence, drops quality loot.
|
||||
|
||||
enemy_id: goblin_chieftain
|
||||
name: Goblin Chieftain
|
||||
description: >
|
||||
A large, scarred goblin wearing a crown of teeth and bones.
|
||||
The chieftain has clawed its way to leadership through countless
|
||||
battles and betrayals. It wields a well-maintained weapon stolen
|
||||
from a fallen adventurer and commands its tribe with an iron fist.
|
||||
|
||||
base_stats:
|
||||
strength: 16
|
||||
dexterity: 12
|
||||
constitution: 14
|
||||
intelligence: 10
|
||||
wisdom: 10
|
||||
charisma: 12
|
||||
luck: 12
|
||||
|
||||
abilities:
|
||||
- basic_attack
|
||||
- shield_bash
|
||||
- intimidating_shout
|
||||
|
||||
loot_table:
|
||||
# Static drops - guaranteed materials
|
||||
- loot_type: static
|
||||
item_id: goblin_ear
|
||||
drop_chance: 1.0
|
||||
quantity_min: 2
|
||||
quantity_max: 3
|
||||
- loot_type: static
|
||||
item_id: goblin_chieftain_token
|
||||
drop_chance: 0.80
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
- loot_type: static
|
||||
item_id: goblin_war_paint
|
||||
drop_chance: 0.50
|
||||
quantity_min: 1
|
||||
quantity_max: 2
|
||||
|
||||
# Consumable drops
|
||||
- loot_type: static
|
||||
item_id: health_potion_medium
|
||||
drop_chance: 0.40
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
- loot_type: static
|
||||
item_id: elixir_of_strength
|
||||
drop_chance: 0.10
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
|
||||
# Procedural equipment drops - higher chance and rarity bonus
|
||||
- loot_type: procedural
|
||||
item_type: weapon
|
||||
drop_chance: 0.25
|
||||
rarity_bonus: 0.10
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
- loot_type: procedural
|
||||
item_type: armor
|
||||
drop_chance: 0.15
|
||||
rarity_bonus: 0.05
|
||||
quantity_min: 1
|
||||
quantity_max: 1
|
||||
|
||||
experience_reward: 75
|
||||
gold_reward_min: 20
|
||||
gold_reward_max: 50
|
||||
difficulty: hard
|
||||
|
||||
tags:
|
||||
- humanoid
|
||||
- goblinoid
|
||||
- leader
|
||||
- elite
|
||||
- armed
|
||||
|
||||
base_damage: 14
|
||||
crit_chance: 0.15
|
||||
flee_chance: 0.25
|
||||
Reference in New Issue
Block a user