fix(rules): shield of faith grants its SRD deflection AC buff (+2, +1 per six caster levels, max +5) via a new BuffEffect flat scaling

This commit is contained in:
2026-09-17 22:36:18 +02:00
parent 27f962920f
commit 47f563e11a
5 changed files with 154 additions and 31 deletions
+29
View File
@@ -636,6 +636,35 @@ class TestBullsStrength:
assert any("buff" in line for line in engine._transcript)
class TestShieldOfFaithScaling:
"""Given: SRD shield-of-faith "+2 deflection bonus to AC, +1 per six
caster levels (maximum +5)"
When: casters of different levels cast it
Then: the AC modifier is 2 + min(3, level // 6) — +2 at 5th, +3 at 6th,
+5 at 18th."""
def _ac_value(self, level: int) -> int:
caster = _make_caster(level=level)
target = _make_target()
engine, c, t = _make_engine(caster, target, [3, 3], target_pos=(1, 0),
target_side="players")
engine._cast_spell(c, t, "Shield of Faith")
ac_mods = [m for b in t.active_buffs for m in b.modifiers if m.target == "ac"]
assert len(ac_mods) == 1
assert ac_mods[0].bonus_type == "deflection"
return ac_mods[0].value
def test_base_bonus_below_sixth_level(self) -> None:
assert self._ac_value(5) == 2
def test_first_step_at_sixth_level(self) -> None:
assert self._ac_value(6) == 3
def test_capped_at_five(self) -> None:
assert self._ac_value(18) == 5
assert self._ac_value(20) == 5
class TestBlessAlliesOnly:
"""Given: a caster casting Bless (SRD: 50-ft burst, "the caster and all
allies")