fix(rules): confused creatures make no attacks of opportunity (simplification documented)

This commit is contained in:
2026-09-16 19:30:08 +02:00
parent def8533197
commit 68a03a34f6
3 changed files with 28 additions and 2 deletions
+5 -1
View File
@@ -317,9 +317,13 @@ BLEEDING = Condition(
# Confused: at the beginning of each turn the subject rolls d% to act randomly # Confused: at the beginning of each turn the subject rolls d% to act randomly
# (CRB). The d% behavior is engine logic in ``_take_turn``; simplification: # (CRB). The d% behavior is engine logic in ``_take_turn``; simplification:
# the "if attacked, attack the attacker" clause is reduced to "nearest # the "if attacked, attack the attacker" clause is reduced to "nearest
# creature". No stat modifiers or behavioral flags. # creature". SRD "Conditions—Confused": a confused creature "will not make
# attacks of opportunity against anything that it is not already devoted to
# attacking" — simplified to NO AoOs at all (cant_aoo), since the engine has
# no "already devoted" concept. No stat modifiers.
CONFUSED = Condition( CONFUSED = Condition(
name="confused", name="confused",
cant_aoo=True,
) )
# ── Registry ───────────────────────────────────────────────────────────────── # ── Registry ─────────────────────────────────────────────────────────────────
+22
View File
@@ -154,3 +154,25 @@ def test_nauseated_guard_makes_no_aoo() -> None:
assert engine._aoo_used.get("guard", 0) == 0 assert engine._aoo_used.get("guard", 0) == 0
assert len(engine._rng._queue) == 2 assert len(engine._rng._queue) == 2
assert runner_s.hp == 20 assert runner_s.hp == 20
def test_confused_guard_makes_no_aoo() -> None:
"""Given: the guard is confused (SRD: "will not make attacks of
opportunity against anything that it is not already devoted to
attacking" — simplified to no AoOs at all, the engine has no
"already devoted" concept)
When: the runner provokes an AoO
Then: no opportunity is taken — no die rolled, no budget spent."""
runner = make_combatant("runner", hp=20, ac=12)
guard = make_combatant("guard", hp=20, ac=15, attack_bonus=5)
states = [
make_state(runner, "players", (2, 1)),
make_state(guard, "monsters", (2, 0)),
]
engine = CombatEngine(ScriptedRng([15, 3]), _grid(("....", "....")), states)
runner_s, guard_s = engine._states
_add_condition(guard_s, "confused")
assert engine._resolve_aoo(guard_s, runner_s) is False
assert engine._aoo_used.get("guard", 0) == 0
assert len(engine._rng._queue) == 2
assert runner_s.hp == 20
+1 -1
View File
@@ -320,4 +320,4 @@ def test_snapshot_exposes_bleed_damage() -> None:
defs = dict(snap["condition_definitions"]) defs = dict(snap["condition_definitions"])
assert len(defs) == len(CONDITIONS_BY_NAME) assert len(defs) == len(CONDITIONS_BY_NAME)
assert defs["bleeding"]["flags"] == [] assert defs["bleeding"]["flags"] == []
assert defs["confused"]["flags"] == [] assert defs["confused"]["flags"] == ["cant_aoo"]