fix(combat): correct spell DC formula

This commit is contained in:
2026-09-04 22:55:37 +02:00
parent 8b5ba12f46
commit 6e27a2bba1
11 changed files with 40 additions and 10 deletions
+5 -2
View File
@@ -834,8 +834,11 @@ class CombatEngine:
f"round {self._current_round} {caster.combatant.id}: "
f"cast {spell_name} -> NO LINE OF EFFECT"
)
return
dc = spell.base_dc + caster.combatant.level
# DC = 10 + spell level + caster's casting ability modifier
ability_name = caster.combatant.casting_ability.lower()
ability_score = getattr(caster.combatant.abilities, f"{ability_name}_score")
ability_mod = (ability_score - 10) // 2
dc = 10 + spell.level + ability_mod
save_result = (
self.resolve_save(target, spell.save, dc) if spell.save != "none" else None
)
+2
View File
@@ -113,3 +113,5 @@ class Combatant(_FrozenModel):
notes: str = ""
features: list[AbilitySpec] = []
spells: list[str] = []
casting_ability: str = "wis" # ability used for spell DCs: str/dex/con/int/wis/cha
resources: dict[str, int] = Field(default_factory=dict) # resource pools per combat