Skip to main content

✅ Berith gains pwr and ap cost on enemy action

CategoryAbility
StatusPassing
Testtests/test_abilities_passive.py::test_berith_gains_pwr_and_ap_cost_on_enemy_action

When an enemy demon resolves an action, Berith gains +1 PWR and

Preconditions

  • Lane 0: P1's Berith (#070, base PWR=4) — READIED

  • P2's Duban (#001) resolves an action (ABILITY_USED fires, side=P2)

  • No status effects on Berith

Action

  • Fire ABILITY_USED event with source=Duban, side=PLAYER_2
from engine.events import GameEvent, EventType, fire_event
from engine.operations import get_effective_pwr
from engine.status_effects import get_stat_modifier

state = make_game_state()
berith = make_demon("070", lane=0, owner=Side.PLAYER_1)
duban = make_demon("001", lane=1, owner=Side.PLAYER_2)
state = place_demon(state, berith)
state = place_demon(state, duban)

berith_on_field = next(d for d in state.demons if d.unit_id == "070")
duban_on_field = next(d for d in state.demons if d.unit_id == "001")

event = GameEvent(
event_type=EventType.ABILITY_USED,
source=duban_on_field,
target=None,
value=0,
side=Side.PLAYER_2,
lane=1,
)
new_state = fire_event(state, event)

berith_after = next(d for d in new_state.demons if d.unit_id == "070")
pwr = get_effective_pwr(new_state, berith_after)
ap_mod = get_stat_modifier(new_state, berith_after, "ap_cost")

Expected Postconditions

  • Berith effective PWR = 4 (base) + 1 (status) = 5

  • Berith ap_cost modifier = -1

  • abilities_used_this_turn["0"] == 1 (first stack used)

Assertions

assert pwr == 5, f"Berith PWR = 4 base + 1 status = 5. Got {pwr}"
assert ap_mod == -1, f"Berith ap_cost mod = -1 from status. Got {ap_mod}"
assert berith_after.abilities_used_this_turn.get("0", 0) == 1, (
f"Stack counter should be 1 after one enemy action. "
f"Got {berith_after.abilities_used_this_turn.get('0', 0)}."
)