feat(data): per-level spell slots for 8 PCs
This commit is contained in:
+26
-1
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from pf1e_simulator.combat import Action, CombatantState, CombatEngine
|
||||
from pf1e_simulator.combat import Action, CombatantState, CombatEngine, _choose_spell_action
|
||||
from pf1e_simulator.dice import parse_dice
|
||||
from pf1e_simulator.grid import Grid
|
||||
from pf1e_simulator.map import MapSpec, TerrainType
|
||||
@@ -436,3 +436,28 @@ class TestSummonMonster:
|
||||
assert summoned[0].hp == 15
|
||||
# Check transcript mentions summon
|
||||
assert any("summon" in line.lower() for line in engine._transcript)
|
||||
|
||||
|
||||
class TestSpellSlots:
|
||||
"""Given: a caster with per-level spell_slots
|
||||
When: a spell of a level is cast
|
||||
Then: that level's slot count decrements and exhausted levels block further casts."""
|
||||
|
||||
def test_slot_depense(self) -> None:
|
||||
caster = _make_caster().model_copy(update={"spell_slots": {1: 2, 2: 1}})
|
||||
target = _make_target(hp_max=100)
|
||||
engine, c, t = _make_engine(caster, target, [3])
|
||||
engine._cast_spell(c, t, "Magic Missile") # level 1
|
||||
assert c.spell_slots_left[1] == 1
|
||||
assert c.spell_slots_left[2] == 1
|
||||
|
||||
def test_slots_epuises(self) -> None:
|
||||
caster = _make_caster().model_copy(
|
||||
update={"spell_slots": {1: 1}, "spells": ["Magic Missile"]}
|
||||
)
|
||||
target = _make_target(hp_max=100)
|
||||
engine, c, t = _make_engine(caster, target, [3])
|
||||
assert _choose_spell_action(engine, c, t) is not None
|
||||
engine._cast_spell(c, t, "Magic Missile") # spends the only level-1 slot
|
||||
assert c.spell_slots_left[1] == 0
|
||||
assert _choose_spell_action(engine, c, t) is None
|
||||
|
||||
Reference in New Issue
Block a user