fix(rules): restricted charge - a creature limited to a standard action (staggered/disabled, surprise round) can still charge at 1x speed
This commit is contained in:
@@ -205,6 +205,31 @@ def test_charge_result_no_charge_path_too_far() -> None:
|
||||
assert result.distance_ft == 0
|
||||
|
||||
|
||||
def test_restricted_charge_halves_the_budget() -> None:
|
||||
"""SRD "Charge": a creature able to take only a standard action (here a
|
||||
disabled one at 0 hp) can still charge, but only up to its speed (1x,
|
||||
6 cells at 30 ft) instead of double speed — a target 6 cells away stays
|
||||
chargeable, one 10 cells away is not."""
|
||||
a = make_state(make_combatant("a"), "players", (0, 0))
|
||||
near = make_state(make_combatant("near"), "monsters", (0, 6))
|
||||
engine = make_engine([a, near], make_grid(12))
|
||||
a.hp = 0 # disabled -> staggered -> restricted charge
|
||||
result = engine.can_charge(a, near)
|
||||
assert isinstance(result, ChargeResult)
|
||||
assert result.weapon is not None # end cell 5 steps away <= 1x budget
|
||||
a2 = make_state(make_combatant("a2"), "players", (0, 0))
|
||||
far = make_state(make_combatant("far"), "monsters", (0, 10))
|
||||
engine2 = make_engine([a2, far], make_grid(12))
|
||||
a2.hp = 0
|
||||
res2 = engine2.can_charge(a2, far)
|
||||
assert isinstance(res2, ChargeResult)
|
||||
assert res2.weapon is None # 9 steps to the closest attack cell needs 2x
|
||||
a2.hp = 20 # standing again: full 2x charge is legal
|
||||
res3 = engine2.can_charge(a2, far)
|
||||
assert isinstance(res3, ChargeResult)
|
||||
assert res3.weapon is not None
|
||||
|
||||
|
||||
# --- Test 5: no melee weapon -------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user