# Drawstep engine wiki — Cookbook: complex custom cards > Complete, engine-validated cards for the patterns custom cards need: leave-the-battlefield replacements by destination, returns under another player's control, counters, forced attacks and blocks, transform with carried state, phasing, protection choices and every kind of "until …". Engine: Magic: The Gathering (`mtg`). Page: https://drawstep.xyz/wiki/mtg/cookbook · Raw Markdown: https://drawstep.xyz/wiki/mtg/cookbook.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. ## Cookbook: complex custom cards Patterns for the custom cards that stretch the rules — each a complete card that the engine's gate accepts and its renderer reads back (shown under the JSON), so you can copy the shape and change the details. When a pattern here does not cover a clause, compose it from the axes on **Filters & targets** (`https://drawstep.xyz/wiki/mtg/targets.md`) and **Relationships & references** (`https://drawstep.xyz/wiki/mtg/references.md`), and only then climb the honesty ladder on **Custom mechanics** (`https://drawstep.xyz/wiki/mtg/custom-mechanics.md`: a `tableRuling` step for a clause no primitive expresses — never an approximation). ### Replacing how a permanent leaves the battlefield, by destination Zone-change replacements (CR 614.1a, 614.6) are `{ "replaces": "event", "event": …, "to": , "zone": }`. `event` picks the move: `leavesBattlefield` (any exit — narrow it by destination with `toZone`: "if ~ would be **exiled**" = `toZone: "exile"`), `dies` (battlefield → graveyard), `toGraveyard` (from anywhere — `fromZone` narrows the origin, `discarded` only discards), `enters`. `zone` (+ `position` / `shuffle` for a library) is where it goes instead; `instead: [effects]` with no `zone` replaces the move with other effects (`mode: "replaced"` is the permanent that would have moved — a `moveTo` of it back to the battlefield returns it as a new object); `orEvents` lets one replacement watch several events ("would be destroyed **or exiled**"); `link: true` makes a card moved to exile "exiled with" the source. Shorthands: `diesToExile`, `toGraveyard` with `instead`. #### "If this creature would be exiled, return it to its owner's hand instead." **Slippery Familiar** — printed text: > If this creature would be exiled, return it to its owner's hand instead. ```json { "id": "slippery-familiar", "name": "Slippery Familiar", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Spirit" ], "colors": [ "U" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{U}", "types": [ "Creature" ], "power": 2, "toughness": 1, "text": "If this creature would be exiled, return it to its owner's hand instead.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "event", "event": "leavesBattlefield", "to": { "of": "object", "mode": "self" }, "toZone": "exile", "zone": "hand" } } ] } ``` The engine reads it back as: “If Slippery Familiar would be exiled, return it to its owner's hand instead.” `event: "leavesBattlefield"` + `toZone: "exile"` matches only an exile; dying, bouncing or being put into a library are not replaced. #### "If a nontoken creature an opponent controls would die, exile it instead." **Warden of the Pale Gate** — printed text: > If a nontoken creature an opponent controls would die, exile it instead. ```json { "id": "warden-of-the-pale-gate", "name": "Warden of the Pale Gate", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Spirit", "Cleric" ], "colors": [ "W", "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{W}{B}", "types": [ "Creature" ], "power": 3, "toughness": 4, "text": "If a nontoken creature an opponent controls would die, exile it instead.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "event", "event": "dies", "to": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "controller": "opponent", "isToken": false } }, "zone": "exile" } } ] } ``` The engine reads it back as: “If a nontoken creature an opponent controls would die, exile it instead.” `to` is a group (`mode: "all"` + filter); the replacement applies to each matching creature as it would die. #### "If this card would be put into a graveyard from anywhere, shuffle it into its owner's library instead." **Endless Tide** — printed text: > If this card would be put into a graveyard from anywhere, shuffle it into its owner's library instead. ```json { "id": "endless-tide", "name": "Endless Tide", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Elemental" ], "colors": [ "U" ], "keywords": [], "keywordAbilities": [], "manaCost": "{4}{U}{U}", "types": [ "Creature" ], "power": 5, "toughness": 5, "text": "If this card would be put into a graveyard from anywhere, shuffle it into its owner's library instead.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "toGraveyard", "instead": "shuffleIntoLibrary" } } ] } ``` The engine reads it back as: “If Endless Tide would be put into a graveyard from anywhere, shuffle it into its owner's library instead.” The `toGraveyard` shorthand covers every origin (hand, library, stack, battlefield). #### "If enchanted creature would be destroyed or exiled, instead it phases out." **Veil of Second Chances** — printed text: > Enchant creature > If enchanted creature would be destroyed or exiled, instead it phases out. ```json { "id": "veil-of-second-chances", "name": "Veil of Second Chances", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Aura" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [ { "keyword": "enchant", "target": { "of": "object", "filter": { "types": [ "Creature" ] } } } ], "manaCost": "{1}{W}", "types": [ "Enchantment" ], "text": "Enchant creature\nIf enchanted creature would be destroyed or exiled, instead it phases out.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "event", "event": "destroy", "orEvents": [ { "event": "leavesBattlefield", "toZone": "exile" } ], "to": { "of": "object", "mode": "host" }, "instead": [ { "effect": "phaseOut", "target": { "of": "object", "mode": "replaced" } } ] } } ] } ``` The engine reads it back as: “Enchant creature” · “If enchanted creature would be destroyed or exiled, instead that creature phases out.” One replacement, two events: `event: "destroy"` plus `orEvents: [{ "event": "leavesBattlefield", "toZone": "exile" }]` (every other match and result field is shared; it still applies once per event). `instead` with no `zone` replaces the event with effects; `mode: "replaced"` is the creature that would have been destroyed or exiled. #### "If this creature would leave the battlefield, return it to the battlefield under an opponent's control instead." **Wandering Revenant** — printed text: > If this creature would leave the battlefield, return it to the battlefield under an opponent's control instead. ```json { "id": "wandering-revenant", "name": "Wandering Revenant", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Spirit" ], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{B}", "types": [ "Creature" ], "power": 4, "toughness": 4, "text": "If this creature would leave the battlefield, return it to the battlefield under an opponent's control instead.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "event", "event": "leavesBattlefield", "to": { "of": "object", "mode": "self" }, "instead": [ { "effect": "moveTo", "target": { "of": "object", "mode": "replaced" }, "destination": "battlefield", "controller": "opponent" } ] } } ] } ``` The engine reads it back as: “If Wandering Revenant would leave the battlefield, return it to the battlefield under an opponent's control instead.” `instead` with a `moveTo` of the replaced permanent back to the battlefield: it returns as a new object (CR 400.7 — counters, damage and attachments are gone) under the control of an opponent its controller chooses. ### Returning cards under someone else's control `moveTo` with `destination: "battlefield"` takes `controller`: `you` (default), `owner`, or `opponent` (an opponent the controller chooses as the effect resolves); `tapped`, `attacking`, `withCounters`, `transformed` and `as` (continuous effects applied as it enters) shape the entry. `gainControl` changes control of a permanent already on the battlefield (`controller` = a player target; a `duration` bounds it); `exchangeControl` swaps two. #### "When this creature dies, return it to the battlefield under the control of an opponent of your choice." **Restless Gift** — printed text: > When this creature dies, return it to the battlefield under the control of an opponent of your choice. ```json { "id": "restless-gift", "name": "Restless Gift", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Spirit" ], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{B}", "types": [ "Creature" ], "power": 3, "toughness": 2, "text": "When this creature dies, return it to the battlefield under the control of an opponent of your choice.", "abilities": [ { "kind": "triggered", "trigger": { "event": "dies", "filter": { "self": true } }, "effects": [ { "effect": "moveTo", "target": { "of": "object", "mode": "triggering", "zone": "graveyard" }, "destination": "battlefield", "controller": "opponent" } ] } ] } ``` The engine reads it back as: “When Restless Gift dies, return that card to the battlefield under an opponent's control.” The dying card is the triggering object, now in the graveyard (`mode: "triggering"`, `zone: "graveyard"`); `controller: "opponent"` asks for the opponent on resolution. #### "Gain control of target creature for as long as you control this creature." **Puppeteer of Rust** — printed text: > When this creature enters, gain control of target creature an opponent controls for as long as you control this creature. ```json { "id": "puppeteer-of-rust", "name": "Puppeteer of Rust", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Wizard" ], "colors": [ "U" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{U}{U}", "types": [ "Creature" ], "power": 2, "toughness": 3, "text": "When this creature enters, gain control of target creature an opponent controls for as long as you control this creature.", "abilities": [ { "kind": "triggered", "trigger": { "event": "enters", "filter": { "self": true } }, "effects": [ { "effect": "gainControl", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ], "controller": "opponent" } }, "duration": "whileYouControlSource" } ] } ] } ``` The engine reads it back as: “When Puppeteer of Rust enters, gain control of target creature an opponent controls for as long as you control Puppeteer of Rust.” The `whileYouControlSource` duration ends the control change for good the moment you stop controlling the source. ### Counters: extra counters, more counters, counters as conditions Counter placement is an event you can replace (`event: "putCounters"` with `counter`, `by`, `from`, `add` / `multiply` / `prevent`), and entering with counters is `entersWithCounters` (on the card itself) or `event: "enters"` with `enterCounters` (for a group). Counters read back through `hasCounter` + `minCounters` (filters and `objectMatches` conditions), `countersOnSource` (a value) and the `countersPlaced` trigger. The full list of counter kinds with rules meaning is on **Relationships & references**. #### "Each other creature you control enters with an additional +1/+1 counter on it." **Training Grounds Matron** — printed text: > Each other creature you control enters with an additional +1/+1 counter on it. ```json { "id": "training-grounds-matron", "name": "Training Grounds Matron", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Druid" ], "colors": [ "G", "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{G}{W}", "types": [ "Creature" ], "power": 2, "toughness": 3, "text": "Each other creature you control enters with an additional +1/+1 counter on it.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "event", "event": "enters", "to": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "controller": "you", "other": true } }, "enterCounters": [ { "counter": "+1/+1", "amount": 1 } ] } } ] } ``` The engine reads it back as: “Each other creature you control enters with an additional +1/+1 counter on it.” An `enters` replacement over a group with `enterCounters`; it applies before enters triggers see the creature. #### "If one or more +1/+1 counters would be put on a creature you control, that many plus one are put on it instead." **Thickening Bark** — printed text: > If one or more +1/+1 counters would be put on a creature you control, that many plus one +1/+1 counters are put on it instead. ```json { "id": "thickening-bark", "name": "Thickening Bark", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "G" ], "keywords": [], "keywordAbilities": [], "manaCost": "{G}", "types": [ "Enchantment" ], "text": "If one or more +1/+1 counters would be put on a creature you control, that many plus one +1/+1 counters are put on it instead.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "event", "event": "putCounters", "to": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "controller": "you" } }, "counter": "+1/+1", "add": 1 } } ] } ``` The engine reads it back as: “If one or more +1/+1 counters would be put on a creature you control, that many plus one +1/+1 counters are put on it instead.” `putCounters` with `counter` narrows the kind; `add: 1` is "that many plus one". #### "Oath counters can't be put on this creature except by its own abilities." **Oathbound Sentinel** — printed text: > At the beginning of your upkeep, put an oath counter on this creature. > Oath counters can't be put on this creature except by its own abilities. > This creature gets +1/+1 for each oath counter on it. ```json { "id": "oathbound-sentinel", "name": "Oathbound Sentinel", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Knight" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{W}", "types": [ "Creature" ], "power": 2, "toughness": 3, "text": "At the beginning of your upkeep, put an oath counter on this creature.\nOath counters can't be put on this creature except by its own abilities.\nThis creature gets +1/+1 for each oath counter on it.", "abilities": [ { "kind": "triggered", "trigger": { "event": "upkeep", "by": "you" }, "effects": [ { "effect": "addCounters", "target": { "of": "object", "mode": "self" }, "counter": "oath", "amount": 1 } ] }, { "kind": "replacement", "replacement": { "replaces": "event", "event": "putCounters", "to": { "of": "object", "mode": "self" }, "counter": "oath", "from": { "of": "object", "mode": "all", "filter": { "other": true } }, "prevent": true } }, { "kind": "static", "effect": { "type": "modifyPT", "to": { "of": "object", "mode": "self" }, "power": { "kind": "countersOnSource", "counter": "oath" }, "toughness": { "kind": "countersOnSource", "counter": "oath" } } } ] } ``` The engine reads it back as: “At the beginning of your upkeep, put an oath counter on Oathbound Sentinel.” · “Oath counters can't be put on Oathbound Sentinel except by its own abilities.” · “Oathbound Sentinel gets +1/+1 for each oath counter on it.” A `putCounters` replacement on the source (`to: self`) for one `counter` kind with `prevent: true`, restricted by `from` to sources other than this one: proliferate and every other spell or ability are stopped, its own upkeep trigger still adds them. ### Damage by recipient: "if ~ would deal combat damage to its owner" Damage is replaceable per event (`event: "damage"`) with `from` (whose damage — `{ "mode": "self" }` for the source's own), `to` / `toPlayer` (who would be dealt it — any player selector: `owner` is the source's owner, `you` its controller), `damageKind` (combat / noncombat) and the result: `set` (the amount becomes this), `prevent` / `preventAmount` / `preventAllBut`, `multiply`, `add`, `half`, `redirectTo`. A card that may change hands names its owner, not "you", when the owner is meant. #### "If this creature would deal combat damage to its owner, it deals 0 damage to that player instead." **Turncoat Ogre** — printed text: > This creature attacks each combat if able. > If this creature would deal combat damage to its owner, it deals 0 damage to that player instead. ```json { "id": "turncoat-ogre", "name": "Turncoat Ogre", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Ogre", "Mercenary" ], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{R}", "types": [ "Creature" ], "power": 4, "toughness": 3, "text": "This creature attacks each combat if able.\nIf this creature would deal combat damage to its owner, it deals 0 damage to that player instead.", "abilities": [ { "kind": "static", "effect": { "type": "mustAttack", "to": { "of": "object", "mode": "self" } } }, { "kind": "replacement", "replacement": { "replaces": "event", "event": "damage", "from": { "of": "object", "mode": "self" }, "toPlayer": "owner", "damageKind": "combat", "set": 0 } } ] } ``` The engine reads it back as: “Turncoat Ogre attacks each combat if able.” · “If Turncoat Ogre would deal combat damage to its owner, it deals 0 damage to that player instead.” `from` self, `toPlayer: "owner"`, `damageKind: "combat"`, `set: 0` — the owner is fixed by the card, whoever controls it now. ### Forcing attacks and blocks Statics: `mustAttack` ("attacks each combat if able"), `mustBlock`, `lure` ("all creatures able to block ~ do so", `blockers` narrows who must), `goaded`, `cantAttack` / `cantBlock` (with `unless`), `evasion`, `mustBeBlocked`. One-shots: `restrict` (`mustAttack` — with `defending` for "attacks that player" — `mustBlock`, `mustBeBlocked`, `cantAttack`, `cantBlock`, … for a `duration`), `mustBlock` with `attacker` ("blocks ~ this turn if able"), `goad`. The engine maximises requirements without breaking restrictions (CR 508.1d, 509.1c). #### "Whenever this creature attacks, target creature an opponent controls blocks it this turn if able." **Taunting Duelist** — printed text: > Whenever this creature attacks, target creature an opponent controls blocks it this turn if able. ```json { "id": "taunting-duelist", "name": "Taunting Duelist", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Warrior" ], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{R}", "types": [ "Creature" ], "power": 3, "toughness": 2, "text": "Whenever this creature attacks, target creature an opponent controls blocks it this turn if able.", "abilities": [ { "kind": "triggered", "trigger": { "event": "attacks", "filter": { "self": true } }, "effects": [ { "effect": "mustBlock", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ], "controller": "opponent" } }, "attacker": { "of": "object", "mode": "self" }, "duration": "endOfTurn" } ] } ] } ``` The engine reads it back as: “Whenever Taunting Duelist attacks, target creature an opponent controls blocks Taunting Duelist this turn if able.” `mustBlock.attacker` names which attacker the target must block (the source); filter `controller: "opponent"` keeps the target on the defending side. #### "Creatures your opponents control attack each combat if able. All creatures able to block this creature do so." **Beacon of Provocation** — printed text: > Creatures your opponents control attack each combat if able. > All creatures able to block this creature do so. ```json { "id": "beacon-of-provocation", "name": "Beacon of Provocation", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Elemental" ], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{R}", "types": [ "Creature" ], "power": 2, "toughness": 5, "text": "Creatures your opponents control attack each combat if able.\nAll creatures able to block this creature do so.", "abilities": [ { "kind": "static", "effect": { "type": "mustAttack", "to": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "controller": "opponent" } } } }, { "kind": "static", "effect": { "type": "lure", "to": { "of": "object", "mode": "self" } } } ] } ``` The engine reads it back as: “Creatures your opponents control attack each combat if able.” · “All creatures able to block Beacon of Provocation do so.” Two statics: `mustAttack` over a group and `lure` on the source. #### "This creature attacks each combat if able and must be blocked if able." **Rampaging Juggernaut** — printed text: > This creature attacks each combat if able. > This creature must be blocked if able. ```json { "id": "rampaging-juggernaut", "name": "Rampaging Juggernaut", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Juggernaut" ], "colors": [], "keywords": [], "keywordAbilities": [], "manaCost": "{4}", "types": [ "Artifact", "Creature" ], "power": 5, "toughness": 3, "text": "This creature attacks each combat if able.\nThis creature must be blocked if able.", "abilities": [ { "kind": "static", "effect": { "type": "mustAttack", "to": { "of": "object", "mode": "self" } } }, { "kind": "static", "effect": { "type": "mustBeBlocked", "to": { "of": "object", "mode": "self" } } } ] } ``` The engine reads it back as: “Rampaging Juggernaut attacks each combat if able.” · “Rampaging Juggernaut must be blocked if able.” `mustAttack` binds its controller (whoever that is now); `mustBeBlocked` puts the requirement on the defending player — at least one of their creatures blocks it if any can (CR 509.1c). ### Transforming, and what carries over A transforming card is `layout: "transform"` with `faces[0]` (front) and `faces[1]` (back), each with its own characteristics and `abilities`; the card's top-level fields mirror the front. `{ "effect": "transform" }` turns it over (`target` defaults to the source). It stays **the same object** (CR 712.18): counters, damage, attachments, "until end of turn" effects and its controller carry over — so the back face reads state the front face built up (counters via `countersOnSource`, a noted choice via `remember`). `moveTo` with `transformed: true` puts it onto the battlefield back face up; the `transformed` trigger fires when it turns. #### A front face that grows, and a back face that spends what it grew **Moonlit Cub** — printed text: > At the beginning of your end step, put a +1/+1 counter on this creature. Then if it has three or more +1/+1 counters on it, transform it. ```json { "id": "moonlit-cub", "name": "Moonlit Cub", "source": "custom", "layout": "transform", "supertypes": [], "subtypes": [ "Wolf" ], "colors": [ "G" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{G}", "types": [ "Creature" ], "power": 2, "toughness": 2, "text": "At the beginning of your end step, put a +1/+1 counter on this creature. Then if it has three or more +1/+1 counters on it, transform it.", "abilities": [ { "kind": "triggered", "trigger": { "event": "endStep", "by": "you" }, "effects": [ { "effect": "addCounters", "target": { "of": "object", "mode": "self" }, "counter": "+1/+1", "amount": 1 }, { "effect": "if", "condition": { "kind": "objectMatches", "object": "source", "filter": { "hasCounter": "+1/+1", "minCounters": 3 } }, "then": [ { "effect": "transform" } ] } ] } ], "faces": [ { "name": "Moonlit Cub", "manaCost": "{1}{G}", "colors": [ "G" ], "types": [ "Creature" ], "subtypes": [ "Wolf" ], "power": 2, "toughness": 2, "text": "At the beginning of your end step, put a +1/+1 counter on this creature. Then if it has three or more +1/+1 counters on it, transform it.", "abilities": [ { "kind": "triggered", "trigger": { "event": "endStep", "by": "you" }, "effects": [ { "effect": "addCounters", "target": { "of": "object", "mode": "self" }, "counter": "+1/+1", "amount": 1 }, { "effect": "if", "condition": { "kind": "objectMatches", "object": "source", "filter": { "hasCounter": "+1/+1", "minCounters": 3 } }, "then": [ { "effect": "transform" } ] } ] } ] }, { "name": "Moonlit Alpha", "colors": [ "G" ], "types": [ "Creature" ], "subtypes": [ "Wolf" ], "power": 4, "toughness": 4, "text": "Whenever this creature attacks, it deals damage equal to the number of +1/+1 counters on it to defending player.", "abilities": [ { "kind": "triggered", "trigger": { "event": "attacks", "filter": { "self": true } }, "effects": [ { "effect": "dealDamage", "target": { "of": "player", "mode": "all", "player": "defendingPlayer" }, "amount": { "kind": "countersOnSource", "counter": "+1/+1" } } ] } ] } ] } ``` The engine reads it back as: “At the beginning of your end step, put a +1/+1 counter on Moonlit Cub. If Moonlit Cub has three or more +1/+1 counters on it, transform Moonlit Cub.” · “— Moonlit Alpha —” · “Whenever Moonlit Alpha attacks, it deals damage equal to the number of +1/+1 counters on it to defending player.” The front's end-step trigger checks the source's own counters (`objectMatches` + `hasCounter` / `minCounters`) and transforms; the back face reads the same counters with `countersOnSource`. ### Phasing `{ "effect": "phaseOut", "target": … }` phases permanents out (with their attachments); they phase in during their controller's next untap step and are treated as though they don't exist meanwhile (CR 702.26). The keyword ability `{ "keyword": "phasing" }` phases the card in or out each untap step. Filters can find them with `phasedOut`; triggers `phasedOut` / `phasedIn` fire on the change; `duration` values never restart when a permanent phases in (CR 702.26f). #### "{1}{W}: Another target creature you control phases out." **Veil Keeper** — printed text: > {1}{W}: Another target creature you control phases out. ```json { "id": "veil-keeper", "name": "Veil Keeper", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Wizard" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{W}", "types": [ "Creature" ], "power": 1, "toughness": 3, "text": "{1}{W}: Another target creature you control phases out.", "abilities": [ { "kind": "activated", "cost": { "mana": "{1}{W}" }, "effects": [ { "effect": "phaseOut", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ], "controller": "you", "other": true } } } ] } ] } ``` The engine reads it back as: “{1}{W}: Another target creature you control phases out.” A plain `phaseOut` on a declared target. ### Protection and hexproof from a choice Protection is the keyword ability `{ "keyword": "protection", "from": { … } }` (colors, types, `filter`, `everything`, or a choice: `chosenColor: true`); `hexproofFrom` takes the same spec. Granted for a while: the effect `grantKeywordAbility`; granted continuously: the static `grantKeywordAbility`. The choice comes from `chooseAsEnters` on the card, or from a `choose` step (`kind: "color"`, `inline: true` for "of your choice") earlier in the same resolution. #### "As this creature enters, choose a color. This creature has protection from the chosen color." **Prismatic Sentinel** — printed text: > As this creature enters, choose a color. > This creature has protection from the chosen color. ```json { "id": "prismatic-sentinel", "name": "Prismatic Sentinel", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Knight" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{W}", "types": [ "Creature" ], "power": 2, "toughness": 2, "text": "As this creature enters, choose a color.\nThis creature has protection from the chosen color.", "chooseAsEnters": [ { "kind": "color" } ], "abilities": [ { "kind": "static", "effect": { "type": "grantKeywordAbility", "to": { "of": "object", "mode": "self" }, "keywordAbility": { "keyword": "protection", "from": { "chosenColor": true } } } } ] } ``` The engine reads it back as: “As Prismatic Sentinel enters, choose a color.” · “Prismatic Sentinel has protection from the chosen color.” The color is chosen once, as it enters; the static reads it with `chosenColor: true`. #### "{W}: Target creature you control gains protection from the color of your choice until end of turn." **Shrine Acolyte** — printed text: > {W}: Target creature you control gains protection from the color of your choice until end of turn. ```json { "id": "shrine-acolyte", "name": "Shrine Acolyte", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Cleric" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{W}", "types": [ "Creature" ], "power": 1, "toughness": 1, "text": "{W}: Target creature you control gains protection from the color of your choice until end of turn.", "abilities": [ { "kind": "activated", "cost": { "mana": "{W}" }, "effects": [ { "effect": "choose", "kind": "color", "inline": true }, { "effect": "grantKeywordAbility", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ], "controller": "you" } }, "keywordAbility": { "keyword": "protection", "from": { "chosenColor": true } }, "duration": "endOfTurn" } ] } ] } ``` The engine reads it back as: “{W}: Target creature you control gains protection from the color of your choice until end of turn.” `choose` with `inline: true` (printed "of your choice") resolves first; the grant reads it. #### "Remove a +1/+1 counter: This creature gains protection from your choice of artifacts, creatures or enchantments until end of turn." **Adaptive Bulwark** — printed text: > This creature enters with two +1/+1 counters on it. > Remove a +1/+1 counter from this creature: It gains protection from your choice of artifacts, creatures, or enchantments until end of turn. Activate only once each turn. ```json { "id": "adaptive-bulwark", "name": "Adaptive Bulwark", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Elemental" ], "colors": [ "G" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{G}", "types": [ "Creature" ], "power": 3, "toughness": 3, "text": "This creature enters with two +1/+1 counters on it.\nRemove a +1/+1 counter from this creature: It gains protection from your choice of artifacts, creatures, or enchantments until end of turn. Activate only once each turn.", "abilities": [ { "kind": "replacement", "replacement": { "replaces": "entersWithCounters", "counter": "+1/+1", "amount": 2 } }, { "kind": "activated", "cost": { "removeCounters": { "counter": "+1/+1", "amount": 1 } }, "oncePerTurn": true, "effects": [ { "effect": "choose", "kind": "cardType", "options": [ "Artifact", "Creature", "Enchantment" ], "inline": true }, { "effect": "grantKeywordAbility", "target": { "of": "object", "mode": "self" }, "keywordAbility": { "keyword": "protection", "from": { "chosenType": true } }, "duration": "endOfTurn" } ] } ] } ``` The engine reads it back as: “Adaptive Bulwark enters with two +1/+1 counters on it.” · “Remove a +1/+1 counter from Adaptive Bulwark: it gains protection from your choice of artifacts, creatures, or enchantments until end of turn. Activate only once each turn.” A card-type choice limited by `options`, read by `protection.from.chosenType`; `oncePerTurn` is "activate only once each turn". ### "Until …" and "for as long as …" durations Every continuous one-shot takes `duration`: the named ones (`endOfTurn`, `untilYourNextTurn`, `untilEndOfYourNextTurn`, `untilSourceLeaves`, `whileYouControlSource`, `perpetual`, …) and three conditional forms — `{ "whileSource": }` ("for as long as ~ remains tapped"), `{ "whileTarget": }` ("for as long as that creature has a +1/+1 counter on it") and `{ "untilEvent": }` ("until an opponent becomes the monarch"). A conditional duration that stops holding ends for good (CR 611.2b). Every value is listed on **Relationships & references**. #### "{T}: Target creature can't block for as long as this artifact remains tapped." **Rusted Manacles** — printed text: > You may choose not to untap this artifact during your untap step. > {T}: Target creature can't block for as long as this artifact remains tapped. ```json { "id": "rusted-manacles", "name": "Rusted Manacles", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [], "keywords": [], "keywordAbilities": [], "manaCost": "{2}", "types": [ "Artifact" ], "text": "You may choose not to untap this artifact during your untap step.\n{T}: Target creature can't block for as long as this artifact remains tapped.", "abilities": [ { "kind": "static", "effect": { "type": "optionalUntap", "to": { "of": "object", "mode": "self" } } }, { "kind": "activated", "cost": { "tapSelf": true }, "effects": [ { "effect": "restrict", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ] } }, "restriction": "cantBlock", "duration": { "whileSource": { "tapped": true } } } ] } ] } ``` The engine reads it back as: “You may choose not to untap Rusted Manacles during your untap step.” · “{T}: Target creature can't block for as long as Rusted Manacles remains tapped.” `{ "whileSource": { "tapped": true } }` checks the source continuously; you may choose not to untap it. #### "Creatures you control get +1/+0 until an opponent becomes the monarch." **Usurper's Rally** — printed text: > You become the monarch. Creatures you control get +1/+0 until an opponent becomes the monarch. ```json { "id": "usurper-s-rally", "name": "Usurper's Rally", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{R}", "types": [ "Sorcery" ], "text": "You become the monarch. Creatures you control get +1/+0 until an opponent becomes the monarch.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "becomeMonarch", "who": "you" }, { "effect": "modifyPT", "target": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "controller": "you" } }, "power": 1, "toughness": 0, "duration": { "untilEvent": { "event": "becameMonarch", "by": "opponent" } } } ] } ] } ``` The engine reads it back as: “You become the monarch, then creatures you control get +1/+0 until an opponent becomes the monarch.” `untilEvent` is an ordinary TriggerDef matched as a trigger of the source. #### "Target creature can't attack or block until your next turn." **Binding Glare** — printed text: > Target creature can't attack or block until your next turn. ```json { "id": "binding-glare", "name": "Binding Glare", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{W}", "types": [ "Instant" ], "text": "Target creature can't attack or block until your next turn.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "restrict", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ] } }, "restriction": "cantAttackOrBlock", "duration": "untilYourNextTurn" } ] } ] } ``` The engine reads it back as: “Target creature can't attack or block until your next turn.” `restrict` with `cantAttackOrBlock` and `untilYourNextTurn`.