Refactor: unified combat engine for PvE/PvP

- Create api/services/combat_engine.py with all shared combat logic
- Rewrite combat.py from 2820 to ~600 lines (thin orchestration)
- Fix buff consumption: fortify, berserker_rage, evade, foresight, iron_skin now actually work
- Fix stun: PvE skills now write stun to npc_status_effects
- Fix skill damage: now uses stats.attack_power consistently (includes perks)
- Fix PvPCombatActionRequest: add skill_id field for proper PvP skill support
- Remove dead code: PvP skill/item blocks copy-pasted into PvE endpoint
- Update game_logic.npc_attack to check buff modifiers (dodge, damage reduction, etc.)
This commit is contained in:
Joan
2026-02-25 12:10:45 +01:00
parent 540df02ae7
commit d5afd28eb9
4 changed files with 1693 additions and 2161 deletions

View File

@@ -89,12 +89,13 @@ class PvPCombatInitiateRequest(BaseModel):
class PvPAcknowledgeRequest(BaseModel):
pass # No body needed
combat_id: int
class PvPCombatActionRequest(BaseModel):
action: str # 'attack', 'defend', 'flee', 'use_item'
action: str # 'attack', 'skill', 'flee', 'use_item'
item_id: Optional[str] = None # For use_item action
skill_id: Optional[str] = None # For skill action
# ============================================================================