Commit Graph

9 Commits

Author SHA1 Message Date
ctan 3cebf43642 refactor(combat): single source active_buffs/active_conditions 2026-08-31 14:24:57 +02:00
ctan d50d5809c6 fix(combat): correct hex and AoE DCs, DR bypassed by spells 2026-08-31 14:02:08 +02:00
ctan 3f65e769cf feat(data): per-level spell slots for 8 PCs 2026-08-31 11:15:37 +02:00
ctan 721812f718 chore(lint): restore green gate 2026-08-31 10:57:11 +02:00
ctan eb666993e7 feat(combat): summoning 2026-08-30 09:04:21 +02:00
ctan 2615c9ccb2 feat(combat): area-of-effect spells 2026-08-30 00:36:16 +02:00
ctan de399b74b8 feat(combat): AoO and concentration on casting 2026-08-29 22:47:22 +02:00
ctan 5c393ec66c fix(combat): correct spell DC formula 2026-08-29 20:26:00 +02:00
ctan 828afc15c0 feat(spells): add spell system with 10 combat spells, cast_spell action
Spells are SpellSpec dataclasses with typed effects: DamageEffect
(dice + types, half-on-save), ConditionEffect (condition lookup +
save negates), HealEffect (capped at hp_max), BuffEffect (transient
StatModifiers). Range categories (personal/touch/close/medium/long)
scale with caster level via spell_range_ft. JSON loader
(load_spell/load_spell_registry) reads data/spells/*.json.

The engine integrates spells via Action(kind='cast_spell') and
_cast_spell: range check, line-of-effect gate, save resolution
(resolve_save), effect application (_apply_spell_effects with DR
via _apply_dr_for_types), transcript logging. The spell_registry
is passed to CombatEngine; Combatant.spells holds known spell names.

- spells.py: SpellSpec, 4 effect types, SpellRange/SaveType literals,
  spell_range_ft, JSON loader (uses Json type from foundry.py)
- conditions.py: CONDITIONS_BY_NAME registry for condition lookup
- combat.py: cast_spell Action kind, _execute_cast_spell dispatch,
  _cast_spell (range/LoE/save/effects/log), _apply_spell_effects,
  _apply_dr_for_types, _save_label helper, SpellSpec/BuffEffect/etc
  imports, spell_registry parameter on CombatEngine
- models.py: spells field on Combatant
- data/spells/: 10 spells (Magic Missile, Burning Hands, Fireball,
  Lightning Bolt, Acid Arrow, Cure Light/Moderate Wounds, Hold Person,
  Fear, Bull's Strength)
- tests/test_spells.py: 29 tests (loading, range, damage/save/condition/
  heal/buff/DR, out-of-range, unknown spell, dispatch, DC scaling)
- pyproject.toml: PLR0913 ignore for combat.py (CombatEngine.__init__)
- README.md: spells.py architecture section, Sorts removed from
  non-modeled list, 336 tests
2026-08-17 22:49:50 +02:00