fix(combat): deed range gating

This commit is contained in:
ctan
2026-09-04 21:27:08 +02:00
parent 412ecb6c86
commit 930061e55a
2 changed files with 57 additions and 17 deletions
+31
View File
@@ -192,6 +192,37 @@ def test_tammara_silent_when_grit_exhausted() -> None:
assert not any(a.kind == "deed" for a in actions)
def test_tammara_silent_when_target_out_of_deed_range() -> None:
tammara = _combatant("tammara", resources={"grit": 3})
goblin = _combatant("goblin", hp_max=6)
engine, me, _ = _engine(tammara, [])
far_goblin = _state(goblin, "monsters", (11, 11), hp=6)
engine.states.append(far_goblin)
actions = default_policy(engine, me)
assert not any(a.kind == "deed" for a in actions)
def test_tammara_deed_out_of_range_spends_no_grit() -> None:
tammara = _combatant("tammara", resources={"grit": 3})
goblin = _combatant("goblin", hp_max=6)
engine, me, _ = _engine(tammara, [])
far_goblin = _state(goblin, "monsters", (11, 11), hp=6)
engine.states.append(far_goblin)
engine._execute(
me,
Action(
kind="deed",
target_id=far_goblin.combatant.id,
deed_name="up_close_and_deadly",
),
)
assert me.resources_left["grit"] == 3
# --- misty: spell_combat + inspire_courage ---