Andrealphus
Demon of Bureaucrats
Unit #080
| HP | PWR | CP | Speed | Range | Tier |
|---|---|---|---|---|---|
| 9 (+3) | 2 | 3 (+2) | Fast | Any | A |
Abilities
Passive
d: At the end of your opponent's Main Phases, simultaneously Exhaust All Other Readied Local Demons and Ready All Other Exhausted Local Demons.
Engine Implementation
def _andrealphus_toggle_trigger(
state: GameState, event: GameEvent, demon: DemonInstance, depth: int
):
"""#080 Andrealphus — Passive Time trigger: MAIN_PHASE_END
At the end of your opponent's Main Phases, simultaneously Exhaust All Other
Readied Local Demons and Ready All Other Exhausted Local Demons.
Fires on MAIN_PHASE_END. Only activates when the phase that just ended
belongs to Andrealphus's OPPONENT (event.side != demon.owner).
"All Other" = all demons in Andrealphus's lane excluding Andrealphus itself
(both allied and enemy local demons).
"Simultaneously" — snapshot BEFORE toggling so a READIED→EXHAUSTED demon
does not then get re-READIED in the same pass.
Re-fetches Andrealphus from state to check fatally_wounded before acting.
"""
import copy as _copy
# Only fire at end of OPPONENT's main phase
if event.side == demon.owner:
return None # This was our own main phase ending — Andrealphus does not trigger
# Re-fetch Andrealphus from state
andrealphus_current = next(
(d for d in state.demons if d.instance_id == demon.instance_id), None
)
if andrealphus_current is None or andrealphus_current.fatally_wounded:
return None
# Collect all OTHER local demons (same lane, but NOT Andrealphus)
local_others = [
d for d in state.demons
if d.lane == andrealphus_current.lane
and d.instance_id != andrealphus_current.instance_id
]
if not local_others:
return None # No other local demons to toggle
# Snapshot their current states BEFORE we start toggling
# (simultaneous resolution — snapshot prevents double-toggling)
snapshots = {d.instance_id: d.state for d in local_others}
new_state = _copy.deepcopy(state)
for d in new_state.demons:
if d.instance_id in snapshots:
original_state = snapshots[d.instance_id]
if original_state == DemonState.READIED:
d.state = DemonState.EXHAUSTED
else:
d.state = DemonState.READIED
return new_state
register_trigger("080", 0, _andrealphus_toggle_trigger)
Omnipresence — 0 AP
g: Omnipresence: 0 AP - 1x: Move Andrealphus to Any Lane.
Engine Implementation
def _andrealphus_omnipresence(
state: GameState, demon: DemonInstance, targets, choices, rng
) -> GameState:
"""#080 Andrealphus — Omnipresence
Quick, 0 AP, 1x: Move Andrealphus to Any Lane.
Teleports Andrealphus to any of the 3 lanes (not restricted to adjacent).
Target lane passed via choices["lane"].
"""
import copy as _copy
if not choices or "lane" not in choices:
return state # No lane chosen — no-op
dest_lane = choices["lane"]
new_state = _copy.deepcopy(state)
andrealphus_in_new = next(
(d for d in new_state.demons if d.instance_id == demon.instance_id), None
)
if andrealphus_in_new is None:
return state
andrealphus_in_new.lane = dest_lane
return new_state
register_ability("080", 1, _andrealphus_omnipresence)