fix(rules): dirty trick RAW list extended to shaken and sickened (APG), with runtime validation
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
L6 of the ``llm-policy-contract`` plan: ``Action`` gains a
|
||||
``trick_condition`` field that lets a policy choose which condition a
|
||||
successful dirty trick applies (blinded, dazzled, deafened, entangled)
|
||||
successful dirty trick applies (blinded, dazzled, deafened, entangled,
|
||||
shaken, sickened)
|
||||
instead of always applying ``dazzled``. APG Dirty Trick limits the penalty
|
||||
to those conditions — nauseated is NOT on the RAW list and is not a valid
|
||||
choice. The condition lasts 1 round plus 1 more per 5 by which the attack
|
||||
@@ -14,7 +15,13 @@ kept bit-identical.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pf1e_simulator.combat import Action, CombatantState, CombatEngine
|
||||
from pf1e_simulator.combat import (
|
||||
_DIRTY_TRICK_CONDITIONS,
|
||||
Action,
|
||||
CombatantState,
|
||||
CombatEngine,
|
||||
_ManeuverRoll,
|
||||
)
|
||||
from pf1e_simulator.grid import Grid
|
||||
from pf1e_simulator.map import MapSpec, TerrainType
|
||||
from pf1e_simulator.models import (
|
||||
@@ -122,6 +129,50 @@ def test_dirty_trick_entangled() -> None:
|
||||
assert _condition_names(b) == ["entangled"]
|
||||
|
||||
|
||||
def test_dirty_trick_shaken() -> None:
|
||||
# APG Dirty Trick RAW list: blinded, dazzled, deafened, entangled,
|
||||
# shaken, or sickened.
|
||||
a_spec = make_combatant("a")
|
||||
b_spec = make_combatant("b")
|
||||
a = make_state(a_spec, "players", (1, 1))
|
||||
b = make_state(b_spec, "monsters", (1, 2))
|
||||
engine = make_engine([1, 12], [a, b])
|
||||
engine._execute_maneuver(a, b, "dirty_trick", trick_condition="shaken")
|
||||
assert _condition_names(b) == ["shaken"]
|
||||
|
||||
|
||||
def test_dirty_trick_sickened() -> None:
|
||||
a_spec = make_combatant("a")
|
||||
b_spec = make_combatant("b")
|
||||
a = make_state(a_spec, "players", (1, 1))
|
||||
b = make_state(b_spec, "monsters", (1, 2))
|
||||
engine = make_engine([1, 12], [a, b])
|
||||
engine._execute_maneuver(a, b, "dirty_trick", trick_condition="sickened")
|
||||
assert _condition_names(b) == ["sickened"]
|
||||
|
||||
|
||||
def test_dirty_trick_rejects_condition_off_the_raw_list() -> None:
|
||||
# Runtime validation: a condition off the APG list (e.g. nauseated) is
|
||||
# refused with a logged line and applies nothing.
|
||||
a_spec = make_combatant("a")
|
||||
b_spec = make_combatant("b")
|
||||
a = make_state(a_spec, "players", (1, 1))
|
||||
b = make_state(b_spec, "monsters", (1, 2))
|
||||
engine = make_engine([], [a, b])
|
||||
m = _ManeuverRoll(roll=12, attacker_cmb=2, total=14, target_cmd=12, success=True)
|
||||
engine._maneuver_dirty_trick(a, b, m, trick_condition="nauseated")
|
||||
assert _condition_names(b) == []
|
||||
assert any("unknown condition" in line for line in engine._transcript)
|
||||
|
||||
|
||||
def test_dirty_trick_conditions_set_matches_apg_list() -> None:
|
||||
# The APG list is exactly: blinded, dazzled, deafened, entangled,
|
||||
# shaken, sickened (nauseated excluded).
|
||||
assert frozenset(
|
||||
{"blinded", "dazzled", "deafened", "entangled", "shaken", "sickened"}
|
||||
) == _DIRTY_TRICK_CONDITIONS
|
||||
|
||||
|
||||
def test_dirty_trick_duration_scales_with_margin() -> None:
|
||||
# APG Dirty Trick: "This condition lasts for 1 round. For every 5 by
|
||||
# which your attack exceeds your opponent's CMD, the penalty lasts 1
|
||||
|
||||
Reference in New Issue
Block a user