fix(combat): single roll to escape grapple
This commit is contained in:
@@ -8,6 +8,8 @@ it (effectively disarmed). See the plan task-12.
|
||||
from __future__ import annotations
|
||||
|
||||
from pf1e_simulator.combat import CombatantState, CombatEngine
|
||||
from pf1e_simulator.conditions import CONDITIONS_BY_NAME
|
||||
from pf1e_simulator.effects import ActiveCondition
|
||||
from pf1e_simulator.grid import Grid
|
||||
from pf1e_simulator.map import MapSpec, TerrainType
|
||||
from pf1e_simulator.models import (
|
||||
@@ -17,6 +19,7 @@ from pf1e_simulator.models import (
|
||||
Combatant,
|
||||
DamageComponent,
|
||||
Saves,
|
||||
SkillRank,
|
||||
)
|
||||
from pf1e_simulator.rng import ScriptedRng
|
||||
|
||||
@@ -91,3 +94,25 @@ def test_sunder_destroys_weapon_and_disarms() -> None:
|
||||
assert "b-w" in b.weapon_broken
|
||||
assert engine.weapon_for(b, a) is None
|
||||
assert any(c.condition.name == "disarmed" for c in b.active_conditions)
|
||||
|
||||
|
||||
def test_escape_from_grapple_consumes_single_d20() -> None:
|
||||
a_spec = make_combatant("a", attack_bonus=2).model_copy(
|
||||
update={"skills": {"escape_artist": SkillRank(rank=10)}}
|
||||
)
|
||||
b_spec = make_combatant("b")
|
||||
a = make_state(a_spec, "players", (1, 1))
|
||||
b = make_state(b_spec, "monsters", (1, 2))
|
||||
a.active_conditions.append(
|
||||
ActiveCondition(
|
||||
condition=CONDITIONS_BY_NAME["grappled"],
|
||||
rounds_left=1,
|
||||
source="test",
|
||||
)
|
||||
)
|
||||
a.grappled_with = b_spec.id
|
||||
engine = make_engine([20], [a, b])
|
||||
engine._maneuver_escape(a, b)
|
||||
assert not engine._rng._queue
|
||||
assert a.grappled_with is None
|
||||
assert not any(c.condition.name == "grappled" for c in a.active_conditions)
|
||||
|
||||
Reference in New Issue
Block a user