fix(rules): stop auto-directed movement cutting corners
PF1e (CRB, Measuring Distance): "You can't move diagonally past a corner (even by taking a 5-foot step)". _best_move_step (the greedy descent behind the auto-directed move/run/5-foot-step) now enforces the same diagonal_allowed corner check _step5_to and _best_flee_step already apply. tests/test_combat.py::test_ranged_no_line_of_effect_moves_around_wall pinned the old corner-cutting step (0,1)->(1,2) past the wall at (0,2); re-scripted for the legal (0,1)->(1,1) path (wall cover now applies). Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -558,19 +558,22 @@ def test_ranged_no_line_of_effect_moves_around_wall() -> None:
|
||||
archer = make_combatant("archer", attack_bonus=4, kind="ranged", range_increment_ft=60)
|
||||
target = make_combatant("target", speed=0)
|
||||
states = [make_state(archer, "players", (0, 1)), make_state(target, "monsters", (0, 4))]
|
||||
rng = ScriptedRng([10, 9, 5, 15, 3, 10, 4, 12, 2, 8, 2, 14, 1])
|
||||
rng = ScriptedRng([10, 9, 5, 13, 6, 15, 4])
|
||||
engine = CombatEngine(rng, grid, states, round_cap=4)
|
||||
result = engine.run()
|
||||
assert result.winner == "players"
|
||||
# SRD Measuring Distance corner rule: the (0,1)->(1,2) diagonal is flank-
|
||||
# blocked by the wall at (0,2), so the auto step goes to (1,1) instead —
|
||||
# and the wall keeps granting cover (+4 AC) from that square.
|
||||
assert result.transcript == (
|
||||
"initiative: archer d20=10+0=10",
|
||||
"initiative: target d20=9+0=9",
|
||||
"round 1 archer: 5ft step (0,1)->(1,2)",
|
||||
"round 1 archer: short bow vs target d20=5+4=9 AC 13 -> MISS",
|
||||
"round 1 archer: 5ft step (0,1)->(1,1)",
|
||||
"round 1 archer: short bow vs target d20=5+4=9 AC 17 -> MISS",
|
||||
"round 1 target: wait",
|
||||
"round 2 archer: short bow vs target d20=15+4=19 AC 13 -> HIT 3 damage (6->3)",
|
||||
"round 2 archer: short bow vs target d20=13+4=17 AC 17 -> HIT 6 damage (6->0)",
|
||||
"round 2 target: wait",
|
||||
"round 3 archer: short bow vs target d20=10+4=14 AC 13 -> HIT 4 damage (3->-1)",
|
||||
"round 3 archer: short bow vs target d20=15+4=19 AC 17 -> HIT 4 damage (0->-4)",
|
||||
"round 3 archer: target down",
|
||||
"battle over: players win in 3 rounds",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user