fix(rules): apply maneuver AoO damage as a penalty to the maneuver

PF1e (CRB Combat Maneuvers): "If you are hit by the target, you take the
damage normally and apply that amount as a penalty to the attack roll to
perform the maneuver." Capture the provoked AoO's damage in
_execute_maneuver and subtract it from the check total (floored at 0;
natural 20 still succeeds, natural 1 still fails; dropping below 0 hp
still forfeits). Escape and the Improved-feat exemption are untouched.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-09-11 23:11:57 +02:00
parent 74bfeb5414
commit 1862c22b7b
3 changed files with 47 additions and 5 deletions
+24
View File
@@ -441,6 +441,30 @@ def test_maneuver_aoo_can_drop_attacker_and_forfeit_trip() -> None:
)
def test_maneuver_aoo_damage_penalizes_the_check() -> None:
"""A provoked AoO that deals N damage turns a would-be hit into a miss.
PF1e (CRB Combat Maneuvers): "If you are hit by the target, you take the
damage normally and apply that amount as a penalty to the attack roll to
perform the maneuver." b's AoO deals 6; the trip roll 15 + CMB 1 = 16
would beat CMD 11 by 5 — under the -6 penalty the total is 10 and the
trip fails.
"""
a = _combatant("a", bab=1)
b = _combatant("b", bab=1, attacks=(_sword("b", bonus=5),))
# b's AoO: d20 15 + 5 = 20 vs AC 10 -> HIT 6 damage (a survives at 94).
eng = _engine([a, b], [(1, 1), (1, 2)], ["players", "monsters"], [15, 6, 15])
eng._execute_maneuver(eng._states[0], eng._states[1], "trip")
assert eng._states[0].hp == 94
assert eng._states[0].active is True
assert not any(
ac.condition.name == "prone" for ac in eng._states[1].active_conditions
)
assert any("maneuver AoO dealt 6 damage" in line for line in eng._transcript)
trip_line = next(line for line in eng._transcript if "trip vs b" in line)
assert "d20=15+1=10 CMD 11 -> FAIL" in trip_line
def test_improved_trip_skips_the_provoking_aoo() -> None:
a = _combatant("a", features=("Improved Trip",))
b = _combatant("b")