fix(rules): block immediate actions while flat-footed

SRD 'Immediate Actions': 'You also cannot use an immediate action if you are flat-footed.' _check_reactions now skips states carrying the flat_footed condition before consulting the reaction policy. The engine never applies flat_footed itself (latent gate), so the unit test injects the condition via active_conditions, with a control test proving the same setup fires when not flat-footed.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-09-12 14:08:44 +02:00
parent 7810d88488
commit a4487a85f9
3 changed files with 107 additions and 7 deletions
+8 -1
View File
@@ -3914,6 +3914,8 @@ class CombatEngine:
at most one trigger resolves per event (a fired readied action
suppresses the policy loop). One immediate per event: the first active
combatant (in state order) whose policy returns an action gets to act.
PF1e (SRD "Immediate Actions"): "You also cannot use an immediate
action if you are flat-footed" — flat-footed states are skipped.
Reactions never cascade — while a reaction is executing, further
events are ignored.
"""
@@ -3924,7 +3926,12 @@ class CombatEngine:
if self._reaction_policy is None:
return
for state in self._states:
if not state.active or state.immediate_used or state.swift_used_this_turn:
if (
not state.active
or state.immediate_used
or state.swift_used_this_turn
or self._has_condition_named(state, "flat_footed")
):
continue
action = self._reaction_policy(self, state, event)
if action is None: