fix(rules): aid another bonuses expire at the beginning of the aider's next turn, not the beneficiary's (SRD Aid Another)
This commit is contained in:
@@ -293,6 +293,32 @@ def test_failed_aid_grants_nothing() -> None:
|
||||
assert hero.hp == 97
|
||||
|
||||
|
||||
# ── (c2) the aid bonus expires at the AIDER's next turn, not the beneficiary's ─
|
||||
|
||||
def test_aid_bonus_survives_beneficiary_turn_and_expires_at_aider_turn() -> None:
|
||||
# SRD "Aid Another": the +2 lasts "as long as that attack comes before the
|
||||
# beginning of your next turn" — your = the AIDER's. The ally aids the
|
||||
# hero (ac) in round 1; the hero's own round-2 turn start must NOT clear
|
||||
# the bonus, the ally's round-2 turn start must.
|
||||
seen: dict[str, int] = {}
|
||||
|
||||
def policy(engine: CombatEngine, state: CombatantState) -> tuple[Action, ...]:
|
||||
cid = state.combatant.id
|
||||
if cid == "hero" and engine._current_round == 2:
|
||||
seen["hero_turn"] = state.aid_ac_bonus
|
||||
if cid == "foe" and engine._current_round == 2:
|
||||
seen["foe_turn"] = engine._states[0].aid_ac_bonus
|
||||
if cid == "ally" and engine._current_round == 1:
|
||||
return (Action(kind="aid_another", target_id="hero", aid_mode="ac"),)
|
||||
return _WAIT
|
||||
|
||||
# Rolls: 3 initiatives (10,10,10); aid d20=10+5=15 >= 10 success.
|
||||
eng = _trio(policy, [10, 10, 10, 10], round_cap=2)
|
||||
eng.run()
|
||||
assert seen["hero_turn"] == 2 # survived the beneficiary's turn start
|
||||
assert seen["foe_turn"] == 0 # expired at the aider's turn start
|
||||
|
||||
|
||||
# ── (d) run moves up to 4x speed (destination and target), sets running ──────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user