Skip to main content

✅ Insanity grants bonus action

CategoryInteraction
StatusPassing
Testtests/test_abilities_complex.py::TestOseInsanity::test_insanity_grants_bonus_action

Ose uses Insanity on an enemy demon that has a registered

Preconditions

  • P1 Main Phase, P1 has 6 AP, P2 has 6 AP

  • Lane 0: P1's Ose (#089) — READIED

  • Lane 0: P2's Sabnock (#003) — READIED (has Pink Haze, idx=0)

  • Lane 0: P1's Flauros (#013) — READIED (potential target for bonus action)

Action

  • P1 activates Ose's Insanity (idx=0, 0 AP, ready, 1x) targeting Sabnock

  • Sabnock gets -2 AP, ignore_exhaust, ignore_ready statuses

  • Bonus action: Sabnock performs an action (random — Pink Haze)

from engine.abilities import execute_ability
from engine.rng import DeterministicRNG

import engine.abilities_actions
importlib.reload(engine.abilities_actions)

ose = make_demon("089", lane=0, owner=Side.PLAYER_1)
sabnock = make_demon("003", lane=0, owner=Side.PLAYER_2)
flauros = make_demon("013", lane=0, owner=Side.PLAYER_1)
state, placed = _make_state_with_demons(ose, sabnock, flauros, ap=6)
ose_p, sabnock_p, flauros_p = placed

rng = DeterministicRNG(42)
result = execute_ability(
state, ose_p, ability_idx=0,
targets=[sabnock_p],
rng=rng,
)

# Bonus action should have executed — Sabnock used Pink Haze or similar
# Check that ignore_exhaust was consumed (bonus action used it)
from engine.status_effects import get_stat_modifier
sabnock_after = next(
(d for d in result.demons if d.unit_id == "003"), None
)

# Sabnock should still be on the board

Expected Postconditions

  • Something changed on the board (bonus action executed)

  • Sabnock's ignore_exhaust/ignore_ready consumed (step 7b)

  • P2 AP reduced (Pink Haze costs 1 AP - 2 discount = 0 AP, but still consumed)

Assertions

assert sabnock_after is not None, "Sabnock should still be on field"

# The bonus action consumed ignore_exhaust (step 7b of the inner execute_ability)
ie = get_stat_modifier(result, sabnock_after, "ignore_exhaust")
assert ie == 0, (
f"ignore_exhaust should be consumed after bonus action. Got {ie}"
)