Card pseudocode guide
The editor and the compiler use the same two-way format. The
Visual tab is a node canvas: drag sockets to connect an ability to its
effects, and drag green value nodes (players, targets, selectors, costs) into argument
sockets. Selector OR/AND nodes can combine two selector
slots. It writes the same source as the text editor. Use Draft with AI for
a first pass, then review and save.
Shape
One ability per block. The header starts at column 0 and ends with a colon; effects are
indented two spaces, one call per line. A leading # Card [status] line is
optional and ignored. Multi-face cards use ## Face Name [status] sections in
card order. Use (no abilities) for an empty face.
# Soul Warden [supported]
on enters(each other creature):
gain_life(you, 1)
# Llanowar Elves [supported]
activate {T}:
add_mana(you, {G})
Ability blocks
| Header | Example |
on <trigger>: | on dies(this): |
activate <cost>: | activate {2}, {T}: |
static: | static: |
spell: | An instant or sorcery effect line. |
keyword <name> | keyword Flying |
keywords <a>, <b> | keywords Flying, vigilance |
additional cost: <cost> | additional cost: pay 2 life |
if <condition>: | Nested effects, indented below. |
choose <n>: | Numbered modes 1., 2. |
schedule(next_upkeep): | Delayed effects. |
Effect calls
Effects are lowercase calls. Separate several on one line with ;.
damage(target creature, 3)
draw(you, 2)
gain_life(you, 1)
create_token(you, 1, 1/1 red goblin creature)
put_counters(target creature, +1/+1, 2)
destroy(target creature)
exile(target artifact you control)
add_mana(you, {G}{G})
search(you, creature, 1, to hand, shuffle)
scry(you, 2)
pump(each creature you control, 1/1, until end of turn)
Targets, values and costs
| Targets |
this, the triggering object, target creature, each opponent, up to 2 target creatures, any target |
| Selectors |
other tapped creature you control, red instant from a graveyard, creature with power 4 or greater |
| Values |
2, X, count(creature you control), its power, that much |
| Costs |
{2}{U}, {T}, pay 3 life, discard 1 card(s), sacrifice this, remove 1 +1/+1 counter(s) from this |
| Durations |
until end of turn, until your next turn, until the end of your next turn, for as long as this remains on the battlefield |
Triggers, conditions and modes
on attacks(this):
create_token(you, 1, tapped 1/1 red goblin creature)
on upkeep(you):
if you control at least 3 artifacts:
draw(you, 1)
spell:
choose 1:
1. draw(you, 2)
2. gain_life(you, 3)
static:
grant(each creature you control, Flying)
Common triggers: enters, dies, attacks,
upkeep, end_step, cast,
deals_damage. Always check the generated line after saving.
When the syntax cannot express it
Never guess a wrong effect. Use the preserved form and leave the line unsupported:
unsupported (modal bullet outside a choose block): Choose one — ...
The full reference lives in backend/docs/card-effects.md.