Malthus
Demon of Creation
Unit #061
| HP | PWR | CP | Speed | Range | Tier |
|---|---|---|---|---|---|
| 12 (+6) | 2 | 3 (+2) | Normal | Distant | D |
Abilities
Shift — 0 AP
Shift: 0 AP - b, 1x: Move Target Allied Demon 1 Lane.
Engine Implementation
def _malthus_shift(
state: GameState, demon: DemonInstance, targets, choices, rng
) -> GameState:
"""#061 Malthus — Shift
0 AP, (ready), 1x: Move Target Allied Demon 1 Lane.
(ready) — does NOT exhaust Malthus.
Target must be an allied demon — enforced by targeting logic.
Target lane from choices["lane"] (1 adjacent lane from target's current lane).
Targets: [target_allied_demon]
Choices: {"lane": int}
"""
return _move_to_lane(state, targets[0], choices["lane"])
register_ability("061", 0, _malthus_shift)
Musket Fire — 1 AP
i: Musket Fire: 1 AP - a: When declaring a target for this action, choose a Distant Lane and randomly Target a Demon in that Lane. Deal 4 Fixed Damage to the targeted Demon.
Engine Implementation
def _malthus_musket_fire(
state: GameState, demon: DemonInstance, targets, choices, rng
) -> GameState:
"""#061 Malthus — Musket Fire
Allied, 1 AP, (exhaust): When declaring a target, choose a Distant Lane and
randomly Target a Demon in that Lane. Deal 4 Fixed Damage to the targeted Demon.
Allied: ANY allied demon may perform this action.
Target is selected randomly from the chosen distant lane.
If choices["target_id"] is set (from random selection), use that demon.
4 Fixed Damage bypasses DEF.
"""
from engine.operations import deal_fixed_damage
import random as _rng
# Target is pre-selected by targeting system (random from distant lane)
if targets:
target = targets[0]
t_current = next(
(d for d in state.demons if d.instance_id == target.instance_id), None
)
if t_current is None or t_current.fatally_wounded:
return state
return deal_fixed_damage(state, t_current, 4)
# Fallback: if no target, auto-pick from a distant lane
if choices and "lane" in choices:
target_lane = choices["lane"]
else:
distant_lanes = [i for i in range(3) if i != demon.lane]
if not distant_lanes:
return state
if rng is not None:
target_lane = rng.choice(distant_lanes)
else:
target_lane = _rng.choice(distant_lanes)
opponents_in_lane = [
d for d in state.demons
if d.lane == target_lane and not d.fatally_wounded
]
if not opponents_in_lane:
return state
if rng is not None:
picked = rng.choice(opponents_in_lane)
else:
picked = _rng.choice(opponents_in_lane)
return deal_fixed_damage(state, picked, 4)
register_ability("061", 1, _malthus_musket_fire)