fix(combat): Block run action when cant_charge flag is set
SRD Conditions Fatigued: A fatigued character can neither run nor charge. _execute_charge already checked cant_charge; _execute_run did not -- a fatigued/exhausted/entangled combatant could still run. Added cant_charge guard to _execute_run (mirrors _execute_charge), logging wait (cannot run) and returning ok. Two engine-level tests: fatigued cannot run, exhausted cannot run.
This commit is contained in:
@@ -4097,6 +4097,11 @@ class CombatEngine:
|
||||
if self.has_condition_flag(state, "cant_move"):
|
||||
self._log(f"round {self._current_round} {state.combatant.id}: wait (cannot move)")
|
||||
return ActionResult(kind=kind, ok=True, reason=_REASON_OK)
|
||||
# SRD "Conditions — Fatigued": "A fatigued character can neither run
|
||||
# nor charge" (same for exhausted/entangled via cant_charge).
|
||||
if self.has_condition_flag(state, "cant_charge"):
|
||||
self._log(f"round {self._current_round} {state.combatant.id}: wait (cannot run)")
|
||||
return ActionResult(kind=kind, ok=True, reason=_REASON_OK)
|
||||
if action.destination is not None:
|
||||
if action.destination == state.pos:
|
||||
path: list[Pos] = [] # already there: a valid zero-length run
|
||||
|
||||
Reference in New Issue
Block a user