# Drawstep engine wiki — Abilities > The six ability kinds — spell, triggered, activated, loyalty, static, replacement — and their fields. Engine: Magic: The Gathering (`mtg`). Page: https://drawstep.xyz/wiki/mtg/abilities · Raw Markdown: https://drawstep.xyz/wiki/mtg/abilities.md · Complete AI pack (every topic in one document, with the output contract and worked examples): https://drawstep.xyz/wiki/drawstep-mtg-ai-pack.md. This page is generated from Drawstep's card schema; field names and discriminators are exact. A card definition is one JSON object; anything the vocabulary cannot express goes verbatim into `unparsed` instead of being approximated. ## Abilities (`AbilityDef`, discriminator `kind`) Every entry of `abilities[]` is one of these. - `spell` — e.g. “(no effects)”. Fields: `name?`: string — Printed ability word / name of this ability ("Hellfire Retribution", "Totality"): the English rendering, the stack and the game log use it (": Hellfire Retribution"); `xManaColor?`: "W" | "U" | "B" | "R" | "G" — CR 107.3: "Spend only black mana on X" — each {X} in the spell's mana cost is paid with this colour; `onlyIf?`: ConditionDef — CR 601.3, 601.2e: cast this spell only when this condition holds, including free casts and zone permissions; `stackRules?`: ({ condition?: ConditionDef; rules: ("cantCounter" | "cantPreventDamage" | "cantCopy" | "splitSecond")[] })[] — CR 112.1, 615.12, 702.61, 707.10: the spell itself has these rules while on the stack. Each copy uses its own controller, X and additional costs. Conditions are checked when the rule would apply; `effects?`: EffectDef[] — The effects, resolved in order (EffectDef[]); `modes?`: object[] — Modal choices: each `{ label, effects, weight?, cost? }` (spree modes carry their `cost`); `chooseMin?`: number — Minimum number of modes chosen (default 1; 0 for "choose any number"); `chooseMax?`: ValueDef — CR 700.2a, 107.3: maximum modes, including X announced for the spell; `chooseAtRandom?`: boolean — CR 700.2a: choose the announced modes using the seeded RNG before targets; `repeatModes?`: boolean — CR 700.2d: allow repeated modes, each with independent targets announced before resolution; `modeBudget?`: { amount: number; exact?: boolean; symbol?: "pawprint" } — CR 700.2i: maximum (or exact) total weight of the modes announced before targets; `chooseIf?`: { condition: ConditionDef; min: number; max?: number } — "Choose one. If , (you may) choose both / any number instead": mode bounds that apply when the condition holds as the modes are chosen (CR 601.4); `distinctModeTargets?`: "player" — CR 601.2c, 700.2: "Each mode must target a different player." — no two chosen modes may target the same player; each mode's player target is announced from the players no earlier mode targets (checked as the targets are chosen, CR 601.2c). - `tableRuling` — CR 100.7 / Un-set release notes: pause and let the table adjudicate this text. Enforced play without a table decision handler leaves it inert and flagged; the engine never invents a result. Fields: `name?`: string — Ability word / name shown for this table ruling; `text`: string — Exact printed rules text, retained verbatim for the table; `ruling`: "ante" | "subgame" | "physical" | "artReference" | "outsideGame" | "flavorReference" | "formatReference" | "other" — Which kind of table ruling this is (ante, subgame, physical, outsideGame, flavorReference, formatReference …); `onDemand?`: boolean — The text is not a game action (a deck-construction or format rule such as "you may have creatures of these types of any color in a deck with ~ as commander"): never pauses casting, entry or resolution; the table records it on demand only; `prompts?`: string[] — Additional questions whose answers the table records. - `openingHand` — CR 103.6: offered to each player in turn order once every hand is kept, for each such card in their hand: the Leylines, Gemstone Caverns, the Chancellors. Fields: `name?`: string — Ability word / name of this opening-hand action; `action?`: "battlefield" | "reveal" | "exile" — battlefield (default): "you may begin the game with it on the battlefield"; reveal: "you may reveal this card from your opening hand" (then usually a delayedTrigger); exile: "If this card is in your opening hand, you may exile it"; `condition?`: ConditionDef — Read when the choice is offered ("if you're not the starting player" = { kind: "not", condition: { kind: "startingPlayer" } }); `counters?`: { counter: string; amount: ValueDef } — It begins the game on the battlefield with these counters (Gemstone Caverns' luck counter); `then?`: EffectDef[] — Effects that follow right away ("If you do, exile a card from your hand"); this card is their source. - `triggered` — e.g. “When ~ enters, (no effects)”. Fields: `whenChosen?`: string — CR 614.12c, 607.2m: anchor word; this ability exists only if that option was chosen as this source entered; `name?`: string — Printed name. On an ability: its ability word ("Hellfire Retribution"), shown in the English rendering, on the stack and in the log; `trigger`: TriggerDef — The TriggerDef: which event, whose, which object; `optional?`: boolean — "You may": the player chooses whether to do it; `effects`: EffectDef[] — The effects, resolved in order (EffectDef[]); `modes?`: object[] — Modal choices: each `{ label, effects, cost? }`; `chooseMin` / `chooseMax` bound how many are picked; `modeHistory?`: "game" | "turn" — CR 700.2a, 400.7: "choose one that hasn't been chosen (this turn)" — only modes not chosen earlier for this ability of this object; recorded as the ability is put onto the stack (CR 603.3c); `chooseMin?`: number — Minimum number of modes chosen (default 1; 0 for "choose any number"); `chooseMax?`: ValueDef — CR 700.2a, 107.3: maximum modes, including X announced for the spell; `chooseAtRandom?`: boolean — CR 700.2a: choose the announced modes using the seeded RNG before targets; `repeatModes?`: boolean — CR 700.2d: allow repeated modes, each with independent targets announced before resolution; `modeBudget?`: { amount: number; exact?: boolean; symbol?: "pawprint" } — CR 700.2i: maximum (or exact) total weight of the modes announced before targets; `chooseIf?`: { condition: ConditionDef; min: number; max?: number } — "Choose one. If , (you may) choose both / any number instead": mode bounds that apply when the condition holds as the modes are chosen (CR 601.4); `distinctModeTargets?`: "player" — CR 601.2c, 700.2: "Each mode must target a different player." — no two chosen modes may target the same player; each mode's player target is announced from the players no earlier mode targets (checked as the targets are chosen, CR 601.2c); `banner?`: boolean — Host banner: an augment replaces this ability's trigger; `eminence?`: boolean — Also functions while the card is in the command zone; `triggersFrom?`: "graveyard" | "exile" | "hand" | "library" | ("battlefield" | "graveyard" | "exile" | "hand" | "library")[] — CR 113.6b, 113.6k: the ability functions only while its source is in this zone — its effect moves the source out of it ("Whenever a land you control enters, you may return this card from your graveyard to the battlefield"). It never triggers on the battlefield, and a card that entered the zone in the same simultaneous event does not see that event (CR 603.10). - `activated` — e.g. “Channel — {1}: (no effects)”. Fields: `name?`: string — Printed name. On an ability: its ability word ("Hellfire Retribution"), shown in the English rendering, on the stack and in the log; `cost`: CostDef — The cost (CostDef); `costModifiers?`: object[] — CR 602.2b, 601.2f: this ability's own "costs {N} less/more to activate …"; summed with other cost changes, floored once; `abilityWord?`: "channel" — Printed Channel ability word (CR 207.2c); use discardSelf and activateFrom hand for its payment; `anyPlayer?`: boolean — CR 602.2: any player with priority may activate and controls the resulting ability; `opponentsOnly?`: boolean — Only opponents of the source controller may activate (CR 602.2); `timing?`: "instant" | "sorcery" — Activation timing, combinable with limits and onlyIf. Explicit instant requires priority even for a mana ability (CR 602.5d-e); `effects?`: EffectDef[] — The effects, resolved in order (EffectDef[]); `modes?`: object[] — Modal choices: each `{ label, effects, cost? }`; `chooseMin` / `chooseMax` bound how many are picked; `modeHistory?`: "game" | "turn" — CR 700.2a, 400.7: choose only modes not chosen earlier for this ability of this object, over its lifetime or this turn. Recorded on successful activation, even if countered; `chooseMin?`: number — Minimum number of modes chosen (default 1; 0 for "choose any number"); `chooseMax?`: ValueDef — CR 700.2a, 107.3: maximum modes, including X announced for the spell; `chooseAtRandom?`: boolean — CR 700.2a: choose the announced modes using the seeded RNG before targets; `repeatModes?`: boolean — CR 700.2d: allow repeated modes, each with independent targets announced before resolution; `modeBudget?`: { amount: number; exact?: boolean; symbol?: "pawprint" } — CR 700.2i: maximum (or exact) total weight of the modes announced before targets; `chooseIf?`: { condition: ConditionDef; min: number; max?: number } — "Choose one. If , (you may) choose both / any number instead": mode bounds that apply when the condition holds as the modes are chosen (CR 601.4); `distinctModeTargets?`: "player" — CR 601.2c, 700.2: "Each mode must target a different player." — no two chosen modes may target the same player; each mode's player target is announced from the players no earlier mode targets (checked as the targets are chosen, CR 601.2c); `onceEver?`: boolean — CR 602.5b, 400.7: activate only once for this object, across turns and controllers; a zone change resets the limit; `oncePerTurn?`: boolean — Activate only once each turn, independently of other timing restrictions (CR 602.5b); `maxActivationsPerTurn?`: number — Maximum activations per turn for this object (CR 602.5b, 400.7); `exhaust?`: boolean — Exhaust: activate only once per game; `boast?`: boolean — Boast: only if the source attacked this turn, once each turn; `powerUp?`: boolean — Power-up: once only; cost reduced by the source's mana cost if it entered this turn; `outlast?`: boolean — Outlast (CR 702.107a): the activation is an outlast ability (activatesAbility abilityKind outlast); `embalm?`: boolean — Embalm (CR 702.128a): the activation is an embalm ability (activatesAbility abilityKind embalm); `eternalize?`: boolean — Eternalize (CR 702.129a): the activation is an eternalize ability (activatesAbility abilityKind eternalize); `onlyIf?`: ConditionDef — Activation condition; combine phase, turn and battlefield predicates with all (CR 602.1b); `activateFrom?`: "battlefield" | "graveyard" | "hand" | "exile" | "command" — Zone the ability is activated from (default battlefield). - `loyalty` — e.g. “+1: (no effects)”. Fields: `name?`: string — Printed name. On an ability: its ability word ("Hellfire Retribution"), shown in the English rendering, on the stack and in the log; `loyaltyCost`: number | "-X" — +N / −N / 0, or "-X" (X chosen on activation); `effects`: EffectDef[] — The effects, resolved in order (EffectDef[]); `modes?`: object[] — Modal choices: each `{ label, effects, cost? }`; `chooseMin` / `chooseMax` bound how many are picked; `chooseMin?`: number — Minimum number of modes chosen (default 1; 0 for "choose any number"); `chooseMax?`: ValueDef — CR 700.2a, 107.3: maximum modes, including X announced for the spell; `chooseAtRandom?`: boolean — CR 700.2a: choose the announced modes using the seeded RNG before targets; `repeatModes?`: boolean — CR 700.2d: allow repeated modes, each with independent targets announced before resolution; `modeBudget?`: { amount: number; exact?: boolean; symbol?: "pawprint" } — CR 700.2i: maximum (or exact) total weight of the modes announced before targets; `chooseIf?`: { condition: ConditionDef; min: number; max?: number } — "Choose one. If , (you may) choose both / any number instead": mode bounds that apply when the condition holds as the modes are chosen (CR 601.4); `distinctModeTargets?`: "player" — CR 601.2c, 700.2: "Each mode must target a different player." — no two chosen modes may target the same player; each mode's player target is announced from the players no earlier mode targets (checked as the targets are chosen, CR 601.2c). - `static` — e.g. “(empty static ability).”. Fields: `whenChosen?`: string — CR 614.12c, 607.2m: anchor word; this ability exists only if that option was chosen as this source entered; `name?`: string — Printed name. On an ability: its ability word ("Hellfire Retribution"), shown in the English rendering, on the stack and in the log; `effect?`: StaticEffectDef — The continuous effect (single part); `effects?`: StaticEffectDef[] — Parts of one continuous effect applying in different layers (e.g. lose all abilities + base P/T 1/1). Once the first part applies the rest keep applying even if the ability is removed later (CR 613.6); `condition?`: ConditionDef — CR 611.3a-b: this continuous effect applies only while the condition is true; `eminence?`: boolean — Also functions while the card is in the command zone; `functionsExceptIn?`: ("battlefield" | "hand" | "graveyard" | "library" | "exile" | "stack" | "command")[] — CR 113.6c: the ability functions everywhere except these zones instead of only on the battlefield — "As long as Grist isn't on the battlefield, it's a 1/1 Insect creature in addition to its other types" is ["battlefield"] (library, hand, graveyard, exile, command zone and stack). Listing every zone but one makes it function only there: "As long as this card is in your graveyard and you control an Island, creatures you control have flying" (Wonder) lists all zones except graveyard, with the Island as `condition`; there its controller is its owner. - `replacement` — e.g. “As long as this card is in your graveyard, ~ enters tapped.”. Fields: `name?`: string — Printed name. On an ability: its ability word ("Hellfire Retribution"), shown in the English rendering, on the stack and in the log; `replacement`: ReplacementDef — The replacement effect (a ReplacementDef); `functionsFrom?`: "graveyard" — CR 113.6: the replacement ability states it functions only while its card is in this zone ("As long as this creature is in your graveyard, …", Dearly Departed); it applies from there and never from the battlefield. **Modes.** Modal abilities carry `modes: [{ label, effects, cost? }]` with `chooseMin` / `chooseMax` (default 1 / 1; "choose one or both" = 1 / 2; "choose any number" = 0 / modes.length) and optionally `chooseIf: { condition, min, max? }` ("if …, you may choose both instead"). Spree modes each carry their own `cost`. ### Stock examples - `spell` — Iteration 71 Adventurer: “” → `{"kind":"spell","effects":[{"effect":"gainLife","amount":1}]}` - `tableRuling` — Susan Foreman Replacement: “” → `{"kind":"tableRuling","text":"If you would planeswalk, instead look at the top two cards of your planar deck, put one on the bottom of your planar deck and the other on top, then planeswalk.","ruling":"other"}` - `openingHand` — Leyline of Resonance: “If this card is in your opening hand, you may begin the game with it on the battlefield.” → `{"kind":"openingHand"}` - `triggered` — Cast Entry Watcher Study: “” → `{"kind":"triggered","trigger":{"event":"enters","filter":{"types":["Creature"],"controller":"you"},"condition":{"kind":"wasCast","by":"you"}},"effects":[{"effect":"gainLife","amount":1}]}` - `activated` — Shift Witness: “” → `{"kind":"activated","cost":{"mana":"{0}"},"effects":[{"effect":"transform","convert":true}]}` - `loyalty` — Loyal Walker Witness: “+1: You gain 1 life.” → `{"kind":"loyalty","loyaltyCost":1,"effects":[{"effect":"gainLife","who":"you","amount":1}]}` - `static` — Multiple Blocker Study: “” → `{"kind":"static","effect":{"type":"blockCapacity","to":{"of":"object","mode":"self"},"additional":1}}` - `replacement` — Iter99 Draw Doubler: “” → `{"kind":"replacement","replacement":{"replaces":"event","event":"draw","toPlayer":"you","multiply":2}}`