fix(rules): apply AC penalties to CMD
PF1e (SRD Combat Maneuvers): "Any penalties to a creature's AC also apply to its CMD." _maneuver_cmd now folds negative AC modifiers into the sum regardless of bonus type (grappled -2, other untyped penalties), and — a maneuver being a melee attack roll — the prone -4 melee AC penalty. Positive modifiers keep the eight SRD-listed types. The test that pinned the old ignore-penalties convention is updated; README documents the rule. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -4192,11 +4192,20 @@ class CombatEngine:
|
||||
dex_mod = target.combatant.abilities.dex_mod
|
||||
if self.has_condition_flag(target, "denies_dex_to_ac"):
|
||||
dex_mod = min(0, dex_mod)
|
||||
ac_bonuses = resolve_modifiers(
|
||||
# PF1e (SRD Combat Maneuvers): "Any penalties to a creature's AC also
|
||||
# apply to its CMD." — negative AC modifiers ride the CMD whatever
|
||||
# their bonus type; only positive ones are restricted to the eight
|
||||
# SRD-listed types.
|
||||
ac_mods = [
|
||||
m
|
||||
for m in self._stat_modifiers(target, "ac")
|
||||
if m.bonus_type in _CMD_AC_BONUS_TYPES
|
||||
)
|
||||
if m.bonus_type in _CMD_AC_BONUS_TYPES or m.value < 0
|
||||
]
|
||||
# A combat maneuver is a melee attack roll (SRD: "Combat maneuvers are
|
||||
# attack rolls"), so the prone defender's -4 melee AC penalty applies.
|
||||
if self._has_condition_named(target, "prone"):
|
||||
ac_mods.append(StatModifier(target="ac", value=-4))
|
||||
ac_bonuses = resolve_modifiers(ac_mods)
|
||||
# defensive_ac_bonus (total defense / fight defensively) is a dodge
|
||||
# bonus and aid_ac_bonus a circumstance bonus to AC — both types the
|
||||
# SRD lets a creature add to its CMD.
|
||||
|
||||
Reference in New Issue
Block a user