fix(rules): CMD never adds Dex on top of a Tiny Dex-substituted pre-baked CMB

This commit is contained in:
2026-09-16 20:25:34 +02:00
parent 0cccea2fa1
commit 3a5948c35c
2 changed files with 38 additions and 5 deletions
+21
View File
@@ -622,6 +622,27 @@ def test_tiny_or_smaller_cmd_uses_strength_and_dexterity() -> None:
assert engine._maneuver_cmd(tiny) == expected
def test_cmd_never_double_counts_tiny_dex_substituted_cmb() -> None:
# Latent bug guard: a Tiny creature with a PRE-BAKED cmb (already
# Dex-substituted per SRD CMB) must not get the Dexterity modifier added
# on top of it. Tiny: str -1, dex +4, bab 2, size -2, cmb pre-baked to
# 2 + 4 - 2 = 4. Correct CMD = 10 + 2 - 1 + 4 - 2 = 13; the buggy path
# (10 + cmb + dex) would give 10 + 4 + 4 = 18.
engine = make_engine([], [])
tiny = make_state(
_resized(make_combatant("t"), "Tiny", 8, 18).model_copy(update={"cmb": 4}),
"p",
(0, 0),
)
assert engine._maneuver_cmd(tiny) == 13
# A Medium creature's pre-baked cmb (Str-based) keeps the old behavior:
# CMD = 10 + cmb + dex = 10 + 8 + 0 = 18 (thrune_agent-like shape).
medium = make_state(
make_combatant("m").model_copy(update={"cmb": 8}), "p", (0, 1)
)
assert engine._maneuver_cmd(medium) == 18
def _buffed(spec: Combatant, mods: tuple[StatModifier, ...]) -> CombatantState:
state = make_state(spec, "p", (0, 0))
state.active_buffs.append(