feat(api): integrate equipment stats into combat damage system
Equipment-Combat Integration: - Update Stats damage formula from STR//2 to int(STR*0.75) for better scaling - Add spell_power system for magical weapons (staves, wands) - Add spell_power_bonus field to Stats model with spell_power property - Add spell_power field to Item model with is_magical_weapon() method - Update Character.get_effective_stats() to populate spell_power_bonus Combatant Model Updates: - Add weapon property fields (crit_chance, crit_multiplier, damage_type) - Add elemental weapon support (elemental_damage_type, physical_ratio, elemental_ratio) - Update serialization to handle new weapon properties DamageCalculator Refactoring: - Remove weapon_damage parameter from calculate_physical_damage() - Use attacker_stats.damage directly (includes weapon bonus) - Use attacker_stats.spell_power for magical damage calculations Combat Service Updates: - Extract weapon properties in _create_combatant_from_character() - Use stats.damage_bonus for enemy combatants from templates - Remove hardcoded _get_weapon_damage() method - Handle elemental weapons with split damage in _execute_attack() Item Generation Updates: - Add base_spell_power to BaseItemTemplate dataclass - Add ARCANE damage type to DamageType enum - Add magical weapon templates (wizard_staff, arcane_staff, wand, crystal_wand) Test Updates: - Update test_stats.py for new damage formula (0.75 scaling) - Update test_character.py for equipment bonus calculations - Update test_damage_calculator.py for new API signatures - Update test_combat_service.py mock fixture for equipped attribute Tests: 174 passing
This commit is contained in:
@@ -207,6 +207,7 @@ class BaseItemTemplate:
|
||||
|
||||
# Base stats
|
||||
base_damage: int = 0
|
||||
base_spell_power: int = 0 # For magical weapons (staves, wands)
|
||||
base_defense: int = 0
|
||||
base_resistance: int = 0
|
||||
base_value: int = 10
|
||||
@@ -276,6 +277,7 @@ class BaseItemTemplate:
|
||||
item_type=data["item_type"],
|
||||
description=data.get("description", ""),
|
||||
base_damage=data.get("base_damage", 0),
|
||||
base_spell_power=data.get("base_spell_power", 0),
|
||||
base_defense=data.get("base_defense", 0),
|
||||
base_resistance=data.get("base_resistance", 0),
|
||||
base_value=data.get("base_value", 10),
|
||||
|
||||
Reference in New Issue
Block a user