feat(combat): add trick_condition field to Action for dirty trick
This commit is contained in:
@@ -111,6 +111,8 @@ if TYPE_CHECKING:
|
||||
from pf1e_simulator.rng import Rng
|
||||
from pf1e_simulator.spells import SpellSpec
|
||||
|
||||
TrickCondition = Literal["dazzled", "blinded", "deafened", "entangled", "nauseated"]
|
||||
|
||||
from pf1e_simulator.los import (
|
||||
has_cover_cells,
|
||||
has_line_of_effect_cells,
|
||||
@@ -367,6 +369,7 @@ class Action:
|
||||
class_ability: str | None = None # "deed"|"spell_combat"|"inspire_courage"|"hex"|"channel"
|
||||
channel_mode: Literal["heal", "harm"] | None = None # channel energy polarity for this use
|
||||
direction: tuple[int, int] | None = None # steering for directional maneuvers
|
||||
trick_condition: TrickCondition | None = None # dirty trick condition choice
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -1468,7 +1471,10 @@ class CombatEngine:
|
||||
if kind == "cast_spell":
|
||||
self._execute_cast_spell(state, target, action.spell_name)
|
||||
elif kind == "maneuver":
|
||||
self._execute_maneuver(state, target, action.maneuver, direction=action.direction)
|
||||
self._execute_maneuver(
|
||||
state, target, action.maneuver,
|
||||
direction=action.direction, trick_condition=action.trick_condition,
|
||||
)
|
||||
elif kind in ("channel_energy", "hex", "deed", "spell_combat", "inspire_courage"):
|
||||
self._execute_class_ability(state, target, action)
|
||||
elif kind == "charge":
|
||||
@@ -1572,6 +1578,7 @@ class CombatEngine:
|
||||
maneuver: str | None,
|
||||
*,
|
||||
direction: tuple[int, int] | None = None,
|
||||
trick_condition: TrickCondition | None = None,
|
||||
) -> None:
|
||||
"""Execute a combat maneuver (trip, disarm, bull_rush, sunder, grapple,
|
||||
escape, overrun, dirty_trick, steal, reposition, drag)."""
|
||||
@@ -1605,7 +1612,9 @@ class CombatEngine:
|
||||
"sunder": lambda: self._maneuver_sunder(state, target, m),
|
||||
"grapple": lambda: self._maneuver_grapple(state, target, m),
|
||||
"overrun": lambda: self._maneuver_overrun(state, target, m),
|
||||
"dirty_trick": lambda: self._maneuver_dirty_trick(state, target, m),
|
||||
"dirty_trick": lambda: self._maneuver_dirty_trick(
|
||||
state, target, m, trick_condition=trick_condition
|
||||
),
|
||||
"steal": lambda: self._maneuver_steal(state, target, m),
|
||||
"reposition": lambda: self._maneuver_reposition(state, target, m, direction=direction),
|
||||
"drag": lambda: self._maneuver_drag(state, target, m, direction=direction),
|
||||
@@ -1785,14 +1794,21 @@ class CombatEngine:
|
||||
)
|
||||
|
||||
def _maneuver_dirty_trick(
|
||||
self, state: CombatantState, target: CombatantState, m: _ManeuverRoll
|
||||
self,
|
||||
state: CombatantState,
|
||||
target: CombatantState,
|
||||
m: _ManeuverRoll,
|
||||
*,
|
||||
trick_condition: TrickCondition | None = None,
|
||||
) -> None:
|
||||
if not m.success:
|
||||
self._maneuver_fail(state, target, "dirty_trick", m)
|
||||
return
|
||||
condition_name = trick_condition or "dazzled"
|
||||
condition = CONDITIONS_BY_NAME[condition_name]
|
||||
target.active_conditions.append(
|
||||
ActiveCondition(
|
||||
condition=CONDITIONS_BY_NAME["dazzled"],
|
||||
condition=condition,
|
||||
rounds_left=1,
|
||||
source="maneuver: dirty trick",
|
||||
)
|
||||
@@ -1800,7 +1816,7 @@ class CombatEngine:
|
||||
self._log(
|
||||
f"round {self._current_round} {state.combatant.id}: dirty trick vs "
|
||||
f"{target.combatant.id} d20={m.roll}+{m.attacker_cmb}={m.total} "
|
||||
f"CMD {m.target_cmd} -> SUCCESS (dazzled)"
|
||||
f"CMD {m.target_cmd} -> SUCCESS ({condition_name})"
|
||||
)
|
||||
|
||||
def _maneuver_steal(
|
||||
|
||||
Reference in New Issue
Block a user