Skip to main content

✅ Marchosias basic ability redirect

CategoryInteraction
StatusPassing
Testtests/test_abilities_passive.py::test_marchosias_basic_ability_redirect

P1 uses Sabnock's Pink Haze (targeted ability) on P2's Duban

Preconditions

  • P1 Main Phase, P1 has 3 AP

  • Lane 0: P2's Duban (#001) — 6 HP, 0 damage, READIED

  • Lane 0: P2's Marchosias (#087) — 15 HP, 0 damage, READIED

  • Lane 0: P1's Sabnock (#003) — 15 HP, 0 damage, READIED, Range ANY

  • No status effects

Action

  • P1 activates Sabnock's Pink Haze (1 AP, exhaust) targeting P2's Duban

  • Marchosias (P2) intercepts — redirect target to Marchosias

from engine.abilities import execute_ability
from engine.status_effects import get_stat_modifier
# Force re-register ability handlers (cleared by preserve_registry fixture)
if "engine.abilities_actions" in sys.modules:
del sys.modules["engine.abilities_actions"]
import engine.abilities_actions # noqa: F401 — ensure Pink Haze is registered

state = make_game_state(current_side=Side.PLAYER_1)
state.players[Side.PLAYER_1].ap = 3

duban = make_demon("001", lane=0, owner=Side.PLAYER_2)
state = place_demon(state, duban)
duban_id = state.demons[-1].instance_id

marchosias = make_demon("087", lane=0, owner=Side.PLAYER_2)
state = place_demon(state, marchosias)
march_id = state.demons[-1].instance_id

sabnock = make_demon("003", lane=0, owner=Side.PLAYER_1)
state = place_demon(state, sabnock)

sabnock_on_field = state.demons[-1]

result = execute_ability(state, sabnock_on_field, ability_idx=0, targets=[
next(d for d in state.demons if d.instance_id == duban_id)
])

march_after = next(d for d in result.demons if d.instance_id == march_id)
duban_after = next(d for d in result.demons if d.instance_id == duban_id)

# Marchosias got the debuff
pwr_mod = get_stat_modifier(result, march_after, "pwr")
def_mod = get_stat_modifier(result, march_after, "def")

Expected Postconditions

  • Marchosias: has -3 PWR and -2 DEF status (Pink Haze applied to her)

  • Duban: no status effects (untouched)

Assertions

assert pwr_mod == -3, f"Marchosias should have -3 PWR status. Got {pwr_mod}"
assert def_mod == -2, f"Marchosias should have -2 DEF status. Got {def_mod}"

# Duban was untouched
duban_pwr_mod = get_stat_modifier(result, duban_after, "pwr")
duban_def_mod = get_stat_modifier(result, duban_after, "def")
assert duban_pwr_mod == 0, f"Duban should have 0 PWR status. Got {duban_pwr_mod}"
assert duban_def_mod == 0, f"Duban should have 0 DEF status (ignoring passive). Got {duban_def_mod}"