feat(combat): summoning

This commit is contained in:
2026-09-04 22:55:44 +02:00
parent 136ddcf7aa
commit 934d443d7d
5 changed files with 255 additions and 23 deletions
+16 -1
View File
@@ -68,8 +68,18 @@ class AreaEffect:
effects: tuple[SpellEffect, ...] = ()
save_for_half: bool = True
@dataclass(frozen=True)
class SummonEffect:
"""Summoning spell effect.
- creature: path to the creature JSON file (e.g., "data/monsters/celestial_wolf.json")
- duration_rounds: how long the summoned creature stays
"""
creature: str
duration_rounds: int
SpellEffect = DamageEffect | ConditionEffect | HealEffect | BuffEffect | AreaEffect
SpellEffect = DamageEffect | ConditionEffect | HealEffect | BuffEffect | AreaEffect | SummonEffect
@dataclass(frozen=True)
@@ -134,6 +144,11 @@ def _parse_effect(data: dict[str, Json]) -> SpellEffect:
effects=tuple(_parse_effect(e) for e in data["effects"]), # type: ignore[index]
save_for_half=bool(data.get("save_for_half", True)),
)
if effect_type == "summon":
return SummonEffect(
creature=str(data["creature"]), # type: ignore[index]
duration_rounds=int(data["duration_rounds"]), # type: ignore[arg-type]
)
raise ValueError(f"Unknown effect type: {effect_type}")