# Drawstep engine wiki — Relationships & references > How one part of a card refers to another — it, that creature, that player, the exiled card, the chosen color, that much — with a validated card for each pattern, and every mode, player selector, relation, duration, action and counter explained. Engine: Magic: The Gathering (`mtg`). Page: https://drawstep.xyz/wiki/mtg/references · Raw Markdown: https://drawstep.xyz/wiki/mtg/references.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. ## Relationships & references A card's parts talk about each other: "exile target creature. **Its controller** creates a token", "when **that creature** dies this turn", "cards exiled with **~**", "creatures of **the chosen type**", "deals **that much** damage". In Drawstep JSON every such reference is explicit — a `mode` on a selection, a player selector, a filter field or a value kind — and the engine resolves it exactly, including last known information (an object that has left the battlefield is read as it last existed there, CR 608.2h). Nothing refers to anything by position in the text; there is no free-text "it". **The reference words, by printed phrase.** | Printed | JSON | Refers to | |---|---|---| | "~", "this creature" | `{ "of": "object", "mode": "self" }` | the source card itself | | "target creature" | `{ "of": "object", "mode": "chosen", "filter": { "types": ["Creature"] } }` | a target declared on cast / activation / trigger | | "it", "them", "that creature" right after an action of the same ability | `{ "of": "object", "mode": "affected" }` | what the previous step acted on (`span` for several steps) | | "it", "that creature" — the thing the trigger is about | `{ "of": "object", "mode": "triggering" }` | the object of the triggering event (last known information) | | "that creature" — the *other* creature of a block / damage / targeting event | `{ "of": "object", "mode": "triggeringOther" }` | the event's other object (`trigger.other` narrows it) | | "enchanted / equipped creature" | `{ "of": "object", "mode": "host" }` | what the source is attached to | | "the token", "it" after "create …" | `{ "of": "object", "mode": "created" }` | tokens created earlier in this resolution | | "each creature destroyed this way" | `{ "of": "object", "mode": "thisWay", "action": "destroyed" }` | objects an earlier step actually acted on | | "that creature" inside "when that creature dies this turn, …" / "at the beginning of the next end step, return it" | `{ "of": "object", "mode": "about" }` | what a delayed / reflexive trigger was set up about | | "the exiled card", "cards exiled with ~" | `{ "of": "object", "mode": "linked", "zone": "exile" }` or filter `{ "linkedToSource": true }` | cards linked to the source (moved with `link: true`) | | "its paired creature" | `{ "of": "object", "mode": "paired" }` | the soulbond partner | | "the player or planeswalker it's attacking" | `{ "of": "any", "mode": "attacked", "attacker": "self" }` | the attacked player / permanent | | "that player" (the one who did the triggering thing) | `"triggeringPlayer"` | the player of the triggering event | | "target player … that player" | `"target"` (with the player target in `target` / `playerTarget`, a shared `slot` across effects) | the declared player target | | "its controller", "its owner" (of what was just acted on) | `"affectedController"`, `"affectedOwner"` | the previous step's object's (last known) controller / owner | | "its controller" (of the triggering object) | `"triggeringController"`, `"triggeringOwner"` | the triggering object's controller / owner | | "that player", "they" inside "for each player …" / "each opponent may …" | `"current"` | the player being processed | | "choose an opponent. That player …" | `"previousPlayer"` | the player picked by the preceding `choose` | | "the chosen player / color / creature type / name" | `"chosenPlayer"`; filter `chosenColor` / `chosenSubtype` / `chosenName` | a choice made as the source entered (`chooseAsEnters`) or remembered by `choose` | | "that much", "that many" | `{ "kind": "triggerAmount" }` | the triggering event's amount (damage, life, counters, cards) | | "the number of …" fixed earlier ("X is …", "that many" after a count) | `noteValue` then `{ "kind": "noted", "key": … }` | a number snapshotted earlier in the resolution | | "the sacrificed creature's power" | `{ "kind": "sacrificed", "property": "power" }` / `{ "kind": "costPaid", … }` | what was paid as a cost, as it last existed | | "its power" (of the triggering object) | `{ "kind": "triggering", "property": "power" }` | the triggering object's characteristic (last known information) | | "for each card discarded this way" | `{ "kind": "doneThisWay", "of": "discarded" }` | the count of an earlier action | Three rules decide which one to use: 1. **Same ability, earlier step → `affected`** (or `created` / `thisWay` when the text says "the token" / "… this way"). **The event that triggered the ability → `triggering` / `triggeringOther` / `triggeringPlayer`.** **A later, separate trigger set up by this one → `about`** (`delayedTrigger.about` / `reflexiveTrigger.about` fixes the objects; the delayed effects read `mode: "about"`). 2. **A target is declared once.** Two clauses that mean the same target ("target player draws two cards, then discards a card" — the same player twice) share a `slot` name; the engine asks once per slot. Without a slot, two `chosen` selections are two different targets. 3. **Zone changes make new objects** (CR 400.7). "Exile it, then return it" works because `thisWay` / `affected` / `about` follow the card across the move the ability itself made; a card that left by some other route is no longer "it". Values read from an object that has left (`triggering`, `sacrificed`, `affectedController`) use last known information. ### Back-references inside one resolution: affected, created, thisWay Each effect step records what it acted on. The next step's `{ "mode": "affected" }` is "it" / "them"; a player selector `affectedController` / `affectedOwner` is "its controller" / "its owner". `created` is the tokens made earlier in the resolution; `thisWay` with an `action` is what an earlier step *actually* did (a creature that regenerated was not "destroyed this way"). #### "Exile target creature. Its controller creates a token." **Fair Exchange** — printed text: > Exile target creature. Its controller creates a 1/1 white Spirit creature token with flying. ```json { "id": "fair-exchange", "name": "Fair Exchange", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{W}", "types": [ "Instant" ], "text": "Exile target creature. Its controller creates a 1/1 white Spirit creature token with flying.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "exile", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ] } } }, { "effect": "createToken", "who": "affectedController", "token": { "name": "Spirit", "types": [ "Creature" ], "subtypes": [ "Spirit" ], "colors": [ "W" ], "power": 1, "toughness": 1, "keywords": [ "Flying" ] } } ] } ] } ``` The engine reads it back as: “Exile target creature, then its controller creates a 1/1 white Spirit creature token with flying.” `createToken.who` is `affectedController`: the controller of the creature the previous step exiled, read as it last existed on the battlefield. #### "Destroy all creatures. Exile each creature card destroyed this way." **Final Ashes** — printed text: > Destroy all creatures. Exile each creature card destroyed this way. ```json { "id": "final-ashes", "name": "Final Ashes", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{B}{B}", "types": [ "Sorcery" ], "text": "Destroy all creatures. Exile each creature card destroyed this way.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "destroy", "target": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ] } } }, { "effect": "exile", "target": { "of": "object", "mode": "thisWay", "action": "destroyed", "zone": "graveyard", "filter": { "types": [ "Creature" ] } } } ] } ] } ``` The engine reads it back as: “Destroy all creatures, then exile those cards.” `thisWay` + `action: "destroyed"` follows each destroyed creature to its graveyard (add `zone: "graveyard"`); an indestructible or regenerated creature is not included. #### "Create a token. It gains haste." **Sudden Recruit** — printed text: > Create a 2/1 red Goblin creature token. It gains haste until end of turn. ```json { "id": "sudden-recruit", "name": "Sudden Recruit", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{R}", "types": [ "Sorcery" ], "text": "Create a 2/1 red Goblin creature token. It gains haste until end of turn.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "createToken", "token": { "name": "Goblin", "types": [ "Creature" ], "subtypes": [ "Goblin" ], "colors": [ "R" ], "power": 2, "toughness": 1 } }, { "effect": "grantKeyword", "target": { "of": "object", "mode": "created" }, "keyword": "Haste", "duration": "endOfTurn" } ] } ] } ``` The engine reads it back as: “Create a 2/1 red Goblin creature token, then that token gains haste until end of turn.” `created` is exactly the tokens this resolution made — not every token you control. ### The triggering object, the other object, the triggering player A triggered ability reads its event: `triggering` is the object the event happened to (the creature that died, the card that entered, the spell cast), `triggeringOther` the event's other object (the creature blocked or blocking, the permanent dealt damage, the damage source, the spell that targeted), `triggeringPlayer` the player who acted. Their characteristics are read with **last known information**: "its power" of a creature that died is its power on the battlefield. #### "Whenever a creature an opponent controls dies, its controller loses 1 life and you gain life equal to its power." **Grave Accountant** — printed text: > Whenever a creature an opponent controls dies, its controller loses 1 life and you gain life equal to its power. ```json { "id": "grave-accountant", "name": "Grave Accountant", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Vampire" ], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{B}", "types": [ "Creature" ], "power": 2, "toughness": 3, "text": "Whenever a creature an opponent controls dies, its controller loses 1 life and you gain life equal to its power.", "abilities": [ { "kind": "triggered", "trigger": { "event": "dies", "filter": { "types": [ "Creature" ], "controller": "opponent" } }, "effects": [ { "effect": "loseLife", "who": "triggeringController", "amount": 1 }, { "effect": "gainLife", "who": "you", "amount": { "kind": "triggering", "property": "power" } } ] } ] } ``` The engine reads it back as: “Whenever a creature an opponent controls dies, that creature's controller loses 1 life, then you gain life equal to that creature's power.” `triggeringController` and `{ "kind": "triggering", "property": "power" }` both read the dead creature as it last existed on the battlefield. #### "Whenever this creature blocks a creature, that creature gets -2/-0." **Shield Warden** — printed text: > Whenever this creature blocks a creature, that creature gets -2/-0 until end of turn. ```json { "id": "shield-warden", "name": "Shield Warden", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Human", "Soldier" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{W}", "types": [ "Creature" ], "power": 1, "toughness": 4, "text": "Whenever this creature blocks a creature, that creature gets -2/-0 until end of turn.", "abilities": [ { "kind": "triggered", "trigger": { "event": "blocks", "filter": { "self": true } }, "effects": [ { "effect": "modifyPT", "target": { "of": "object", "mode": "triggeringOther" }, "power": -2, "toughness": 0, "duration": "endOfTurn" } ] } ] } ``` The engine reads it back as: “Whenever Shield Warden blocks, that creature gets -2/-0 until end of turn.” For `blocks`, the triggering object is the blocker (`filter: { self: true }`) and `triggeringOther` is the creature it blocked; `trigger.other` would narrow which attackers count. #### "Whenever an opponent draws a card, that player loses 1 life." **Whispering Quill** — printed text: > Whenever an opponent draws a card, that player loses 1 life. ```json { "id": "whispering-quill", "name": "Whispering Quill", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{B}", "types": [ "Enchantment" ], "text": "Whenever an opponent draws a card, that player loses 1 life.", "abilities": [ { "kind": "triggered", "trigger": { "event": "drawsCard", "by": "opponent" }, "effects": [ { "effect": "loseLife", "who": "triggeringPlayer", "amount": 1 } ] } ] } ``` The engine reads it back as: “Whenever an opponent draws a card, that player loses 1 life.” `by: "opponent"` scopes the player event; `triggeringPlayer` is whoever drew. ### Later, separate triggers: delayed and reflexive triggers (about) "At the beginning of the next end step, return **it**", "when **that creature** dies this turn", "when you do, …" are separate triggered abilities created by the resolving one. `delayedTrigger` / `reflexiveTrigger` take `about` — a selection fixed when they are created (usually `{ "mode": "affected" }`, the thing just acted on) — and their effects say `{ "mode": "about" }`. A delayed trigger's `trigger` is an ordinary TriggerDef; for "when that creature dies" leave out the filter (the `about` objects are the subject). `once: true` makes it fire once; `duration` bounds how long it waits. #### "Exile another target creature you control. Return it at the beginning of the next end step." **Blink Warden** — printed text: > When this creature enters, exile another target creature you control. Return that card to the battlefield under its owner's control at the beginning of the next end step. ```json { "id": "blink-warden", "name": "Blink Warden", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Spirit" ], "colors": [ "W" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{W}", "types": [ "Creature" ], "power": 2, "toughness": 2, "text": "When this creature enters, exile another target creature you control. Return that card to the battlefield under its owner's control at the beginning of the next end step.", "abilities": [ { "kind": "triggered", "trigger": { "event": "enters", "filter": { "self": true } }, "effects": [ { "effect": "exile", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ], "controller": "you", "other": true } } }, { "effect": "delayedTrigger", "trigger": { "event": "endStep", "by": "any" }, "about": { "of": "object", "mode": "affected" }, "effects": [ { "effect": "moveTo", "target": { "of": "object", "mode": "about", "zone": "exile" }, "destination": "battlefield", "controller": "owner" } ] } ] } ] } ``` The engine reads it back as: “When Blink Warden enters, exile another target creature you control, then return it to the battlefield under its owner's control at the beginning of the next end step.” The exile's object is fixed as the delayed trigger's `about`; the return reads `{ "mode": "about", "zone": "exile" }` and puts it back under its owner's control (`controller: "owner"`). #### "Target creature gets +2/+0. When that creature dies this turn, draw a card." **Last Rites Rally** — printed text: > Target creature gets +2/+0 until end of turn. When that creature dies this turn, draw a card. ```json { "id": "last-rites-rally", "name": "Last Rites Rally", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{B}", "types": [ "Instant" ], "text": "Target creature gets +2/+0 until end of turn. When that creature dies this turn, draw a card.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "modifyPT", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ] } }, "power": 2, "toughness": 0, "duration": "endOfTurn" }, { "effect": "delayedTrigger", "trigger": { "event": "dies" }, "about": { "of": "object", "mode": "affected" }, "duration": "endOfTurn", "once": true, "effects": [ { "effect": "drawCards", "who": "you", "amount": 1 } ] } ] } ] } ``` The engine reads it back as: “Target creature gets +2/+0 until end of turn, then When that creature is put into a graveyard from the battlefield this turn, draw a card.” No filter on the delayed `dies` trigger: its subject is the `about` creature. `once` + `duration: "endOfTurn"` = "this turn", one time. #### "Create a token. When you do, it deals damage equal to its power to any target." **Catapult Crew** — printed text: > Create a 3/3 red Giant creature token. When you do, it deals damage equal to its power to any target. ```json { "id": "catapult-crew", "name": "Catapult Crew", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{R}", "types": [ "Sorcery" ], "text": "Create a 3/3 red Giant creature token. When you do, it deals damage equal to its power to any target.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "createToken", "token": { "name": "Giant", "types": [ "Creature" ], "subtypes": [ "Giant" ], "colors": [ "R" ], "power": 3, "toughness": 3 } }, { "effect": "reflexiveTrigger", "about": { "of": "object", "mode": "created" }, "effects": [ { "effect": "dealDamage", "target": { "of": "any", "mode": "chosen" }, "amount": { "kind": "sourcePower" }, "from": { "of": "object", "mode": "about" } } ] } ] } ] } ``` The engine reads it back as: “Create a 3/3 red Giant creature token, then when you do, it deals damage equal to its power to any target.” A reflexive trigger (CR 603.12) chooses its own targets when it goes on the stack; `about: { mode: "created" }` makes the token the damage's `from` (the actor of `dealDamage` is its `from`). ### Linked abilities: "exiled with ~" Abilities of one card refer to the same cards through a **link** (CR 607): a move with `link: true` (`exile`, `moveTo`, a replacement's `link`), `exileUntilSourceLeaves` or the `link` effect ties the cards to *this incarnation* of the source. Other abilities of the source read them with `{ "mode": "linked" }` or filter `{ "linkedToSource": true }`, may cast or play them (`playerRule` `castLinkedExile` / `playLinkedExile`) or pay with them (cost `linkedToGraveyard`). The link ends when the source leaves the battlefield. #### "Exile the top card of each opponent's library. You may play cards exiled with this creature." **Larcenous Imp** — printed text: > When this creature enters, exile the top card of each opponent's library. > You may play lands and cast spells from among cards exiled with this creature. > {2}, Sacrifice this creature: Put each card exiled with this creature into its owner's hand. ```json { "id": "larcenous-imp", "name": "Larcenous Imp", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Imp" ], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{B}", "types": [ "Creature" ], "power": 2, "toughness": 2, "text": "When this creature enters, exile the top card of each opponent's library.\nYou may play lands and cast spells from among cards exiled with this creature.\n{2}, Sacrifice this creature: Put each card exiled with this creature into its owner's hand.", "abilities": [ { "kind": "triggered", "trigger": { "event": "enters", "filter": { "self": true } }, "effects": [ { "effect": "exile", "target": { "of": "object", "mode": "top", "zone": "library", "player": "eachOpponent" }, "link": true } ] }, { "kind": "static", "effect": { "type": "playerRule", "who": "you", "rule": "playLinkedExile" } }, { "kind": "activated", "cost": { "mana": "{2}", "sacrificeSelf": true }, "effects": [ { "effect": "moveTo", "target": { "of": "object", "mode": "linked", "zone": "exile" }, "destination": "hand" } ] } ] } ``` The engine reads it back as: “When Larcenous Imp enters, exile the top card of each opponent's library.” · “You may play lands and cast spells from among cards exiled with Larcenous Imp.” · “{2}, Sacrifice Larcenous Imp: Return the card exiled with Larcenous Imp to its owner's hand.” The enters trigger exiles with `link: true`; the static `playLinkedExile` lets you play exactly those cards, and the activated ability returns them with `mode: "linked"`. ### Selection references inside filters: shares, compares, attached, in combat with A filter can relate each candidate to *another selection* — any TargetDef, written in place: `sharesWith: { property, with, negate? }` ("shares a creature type with it"), `comparedTo: { property, op, with, offset? }` ("with power less than that creature's"), `attachedToSelection: ` ("Equipment attached to that creature"), `combatWith: { relation, of }` ("each creature blocking it"), `inSelection: ` (is one of those objects — with `anyOf` it unions a declared target with the objects related to it). `with` / `of` default to `{ "mode": "affected" }` ("it"); `{ "mode": "self" }` is the source, `{ "mode": "host" }` the enchanted permanent, a `slot` a declared target. Older fixed forms remain: `sharesWithSource`, `sharesWithHost`, `sharesWithTarget`, `sharesWithSacrificed`, `comparedToSource`, `comparedToTrigger`, `attachedToSource`, `attachedToReference`, `attachedTo` (a host filter). #### "Destroy target creature and each other creature that shares a creature type with it." **Kinship Purge** — printed text: > Destroy target creature and each other creature that shares a creature type with it. ```json { "id": "kinship-purge", "name": "Kinship Purge", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{B}{B}", "types": [ "Sorcery" ], "text": "Destroy target creature and each other creature that shares a creature type with it.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "destroy", "target": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "anyOf": [ { "inSelection": { "of": "object", "mode": "chosen", "slot": "kin", "filter": { "types": [ "Creature" ] } } }, { "sharesWith": { "property": "creatureType", "with": { "of": "object", "mode": "chosen", "slot": "kin", "filter": { "types": [ "Creature" ] } } } } ] } } } ] } ] } ``` The engine reads it back as: “Destroy target creature and each creature that shares a creature type with it.” One destroy event: `anyOf` unions the declared target (`inSelection` of the slot) with every creature that `sharesWith` it; the shared `slot` makes both references the same single target. #### "Whenever this creature attacks, tap target creature with power less than this creature's power." **Bullying Ogre** — printed text: > Whenever this creature attacks, tap target creature with power less than this creature's power. ```json { "id": "bullying-ogre", "name": "Bullying Ogre", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Ogre" ], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{R}", "types": [ "Creature" ], "power": 4, "toughness": 3, "text": "Whenever this creature attacks, tap target creature with power less than this creature's power.", "abilities": [ { "kind": "triggered", "trigger": { "event": "attacks", "filter": { "self": true } }, "effects": [ { "effect": "tap", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ], "comparedTo": { "property": "power", "op": "<", "with": { "of": "object", "mode": "self" } } } } } ] } ] } ``` The engine reads it back as: “Whenever Bullying Ogre attacks, tap target creature with power less than Bullying Ogre's.” `comparedTo.with` is the source (`mode: "self"`); the comparison is made with current values when the target is chosen and again on resolution. #### "Destroy all Equipment attached to target creature, then destroy that creature." **Disarming Strike** — printed text: > Destroy all Equipment attached to target creature, then destroy that creature. ```json { "id": "disarming-strike", "name": "Disarming Strike", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "R" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{R}{R}", "types": [ "Instant" ], "text": "Destroy all Equipment attached to target creature, then destroy that creature.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "destroy", "target": { "of": "object", "mode": "all", "filter": { "subtypes": [ "Equipment" ], "attachedToSelection": { "of": "object", "mode": "chosen", "slot": "victim", "filter": { "types": [ "Creature" ] } } } } }, { "effect": "destroy", "target": { "of": "object", "mode": "chosen", "slot": "victim", "filter": { "types": [ "Creature" ] } } } ] } ] } ``` The engine reads it back as: “Destroy all Equipment attached to target creature, then destroy target creature.” `attachedToSelection: { mode: "affected" }` would mean "attached to what the previous step acted on"; here the Equipment are found *before* the creature is destroyed, so the reference is the declared target's slot. #### "Whenever this creature becomes blocked, each creature blocking it gets -1/-1." **Thornhide Charger** — printed text: > Whenever this creature becomes blocked, each creature blocking it gets -1/-1 until end of turn. ```json { "id": "thornhide-charger", "name": "Thornhide Charger", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Beast" ], "colors": [ "G" ], "keywords": [], "keywordAbilities": [], "manaCost": "{2}{G}", "types": [ "Creature" ], "power": 3, "toughness": 3, "text": "Whenever this creature becomes blocked, each creature blocking it gets -1/-1 until end of turn.", "abilities": [ { "kind": "triggered", "trigger": { "event": "becomesBlocked", "filter": { "self": true } }, "effects": [ { "effect": "modifyPT", "target": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "combatWith": { "relation": "blocking", "of": { "of": "object", "mode": "self" } } } }, "power": -1, "toughness": -1, "duration": "endOfTurn" } ] } ] } ``` The engine reads it back as: “Whenever Thornhide Charger becomes blocked, creatures blocking Thornhide Charger get -1/-1 until end of turn.” `combatWith: { relation: "blocking", of: { mode: "self" } }` selects the creatures in that combat relation to the source. ### One target across several clauses: slots Every `chosen` selection is a target declared when the spell or ability is put on the stack. When the text names the **same** target twice ("target player draws two cards, then discards a card"; "choose target creature you control and target creature you don't control … those creatures fight"), give the selections the same `slot` — the engine asks once per slot and every clause with that slot reads the same choice, even across intervening choices. Different slot names (or none) are different targets. A value can read a slot too: `{ "kind": "aggregate", "target": … }`. #### "Target player draws two cards, then discards a card." **Forced Study** — printed text: > Target player draws two cards, then discards a card. ```json { "id": "forced-study", "name": "Forced Study", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "U" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{U}", "types": [ "Sorcery" ], "text": "Target player draws two cards, then discards a card.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "drawCards", "who": "target", "target": { "of": "player", "mode": "chosen", "slot": "student" }, "amount": 2 }, { "effect": "discard", "who": "target", "target": { "of": "player", "mode": "chosen", "slot": "student" }, "amount": 1 } ] } ] } ``` The engine reads it back as: “Target player draws two cards, then discards a card.” Both effects carry the player target in `target` with the same `slot`, so one player is targeted once. #### "Put a +1/+1 counter on target creature you control. Then that creature fights target creature you don't control." **Measured Brawl** — printed text: > Put a +1/+1 counter on target creature you control. Then that creature fights target creature you don't control. ```json { "id": "measured-brawl", "name": "Measured Brawl", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "G" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{G}", "types": [ "Instant" ], "text": "Put a +1/+1 counter on target creature you control. Then that creature fights target creature you don't control.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "addCounters", "target": { "of": "object", "mode": "chosen", "slot": "mine", "filter": { "types": [ "Creature" ], "controller": "you" } }, "counter": "+1/+1", "amount": 1 }, { "effect": "fight", "what": { "of": "object", "mode": "chosen", "slot": "mine", "filter": { "types": [ "Creature" ], "controller": "you" } }, "target": { "of": "object", "mode": "chosen", "slot": "theirs", "filter": { "types": [ "Creature" ], "controller": "notYou" } } } ] } ] } ``` The engine reads it back as: “Put a +1/+1 counter on target creature you control, then that creature fights target creature you don't control.” Two slots, two targets. The `fight` names its fighter in `what` and its opponent in `target`, each by slot. ### Choices that later parts read: chosen color, type, player, noted numbers "As ~ enters, choose a color" is `chooseAsEnters: [{ "kind": "color" }]` on the card; its abilities read the choice with the filter fields `chosenColor` / `chosenSubtype` / `chosenName` / `chosenType` (true = the default key), keyword-ability specs such as `protection: { from: { chosenColor: true } }`, and the selector `chosenPlayer`. Inside one resolution, `{ "effect": "choose", … }` announces a choice every later step can read (`remember: true` keeps it on the source for linked abilities); a player picked that way is `previousPlayer`. `noteValue` snapshots a number under a key, read back with `{ "kind": "noted", "key": … }` — use it when the text fixes a number before later steps change the board ("X is the number of …; then …"). #### "As this creature enters, choose a creature type. Other creatures you control of the chosen type get +1/+1." **Banner of the Clan** — printed text: > As this creature enters, choose a creature type. > Other creatures you control of the chosen type get +1/+1. ```json { "id": "banner-of-the-clan", "name": "Banner of the Clan", "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 creature type.\nOther creatures you control of the chosen type get +1/+1.", "chooseAsEnters": [ { "kind": "creatureType" } ], "abilities": [ { "kind": "static", "effect": { "type": "modifyPT", "to": { "of": "object", "mode": "all", "filter": { "types": [ "Creature" ], "controller": "you", "other": true, "chosenSubtype": true } }, "power": 1, "toughness": 1 } } ] } ``` The engine reads it back as: “As Banner of the Clan enters, choose a creature type.” · “Other creatures you control of the chosen type get +1/+1.” The choice lives on the permanent; the static filter reads it with `chosenSubtype: true`. #### "Choose an opponent. That player sacrifices a creature." **Pointed Demand** — printed text: > Choose an opponent. That player sacrifices a creature. ```json { "id": "pointed-demand", "name": "Pointed Demand", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{B}", "types": [ "Sorcery" ], "text": "Choose an opponent. That player sacrifices a creature.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "choose", "kind": "object", "target": { "of": "player", "mode": "choose", "player": "eachOpponent" } }, { "effect": "sacrifice", "who": "previousPlayer", "target": { "of": "object", "mode": "choose", "filter": { "types": [ "Creature" ] } } } ] } ] } ``` The engine reads it back as: “Choose an opponent. That player sacrifices a creature of their choice.” `choose` with a player selection records the player; `previousPlayer` is "that player". Choosing is not targeting. ### Each player in turn: current "For each opponent, …", "each player may …", "each player sacrifices …" process players one at a time. Inside `forEachPlayer` (and `unlessPays`, `optional` / `villainousChoice` with several players, a `choose` with `who`) the selector `current` and the filter relation `controller: "current"` mean *that* player; "you" still means the controller. A target inside the loop is declared once per player when the spell is cast. #### "For each opponent, destroy up to one target creature that player controls." **Measured Reprisal** — printed text: > For each opponent, destroy up to one target creature that player controls. ```json { "id": "measured-reprisal", "name": "Measured Reprisal", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{B}", "types": [ "Sorcery" ], "text": "For each opponent, destroy up to one target creature that player controls.", "abilities": [ { "kind": "spell", "effects": [ { "effect": "forEachPlayer", "players": "eachOpponent", "effects": [ { "effect": "destroy", "target": { "of": "object", "mode": "chosen", "filter": { "types": [ "Creature" ] }, "player": "current", "min": 0, "max": 1 } } ] } ] } ] } ``` The engine reads it back as: “For each opponent, destroy up to one target creature that player controls.” `player: "current"` restricts each declared target to the processed opponent's creatures. ### Numbers that point back: that much, the sacrificed creature's power Value kinds carry references too: `triggerAmount` ("that much damage", "that many counters"), `triggeringCount` (how many were in a `oneOrMore` group), `triggering` with `property` (the triggering object's power / toughness / mana value, last known), `sacrificed` / `costPaid` (what was paid as a cost), `doneThisWay` (how many an earlier step acted on), `replaced` (inside a replacement: the event's amount), `noted` (a snapshot), `var` X. #### "Whenever this creature is dealt damage, put that many +1/+1 counters on it." **Spiteful Hydra** — printed text: > Whenever this creature is dealt damage, put that many +1/+1 counters on it. ```json { "id": "spiteful-hydra", "name": "Spiteful Hydra", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Hydra" ], "colors": [ "G" ], "keywords": [], "keywordAbilities": [], "manaCost": "{3}{G}", "types": [ "Creature" ], "power": 3, "toughness": 4, "text": "Whenever this creature is dealt damage, put that many +1/+1 counters on it.", "abilities": [ { "kind": "triggered", "trigger": { "event": "isDealtDamage", "filter": { "self": true } }, "effects": [ { "effect": "addCounters", "target": { "of": "object", "mode": "self" }, "counter": "+1/+1", "amount": { "kind": "triggerAmount" } } ] } ] } ``` The engine reads it back as: “Whenever Spiteful Hydra is dealt damage, put that many +1/+1 counters on Spiteful Hydra.” `triggerAmount` is the damage actually dealt in the triggering event. #### "Sacrifice another creature: You gain life equal to the sacrificed creature's toughness." **Bone Harvester** — printed text: > Sacrifice another creature: You gain life equal to the sacrificed creature's toughness. ```json { "id": "bone-harvester", "name": "Bone Harvester", "source": "custom", "layout": "normal", "supertypes": [], "subtypes": [ "Zombie", "Cleric" ], "colors": [ "B" ], "keywords": [], "keywordAbilities": [], "manaCost": "{1}{B}", "types": [ "Creature" ], "power": 1, "toughness": 2, "text": "Sacrifice another creature: You gain life equal to the sacrificed creature's toughness.", "abilities": [ { "kind": "activated", "cost": { "sacrifice": { "of": "object", "mode": "choose", "filter": { "types": [ "Creature" ], "other": true } } }, "effects": [ { "effect": "gainLife", "who": "you", "amount": { "kind": "sacrificed", "property": "toughness" } } ] } ] } ``` The engine reads it back as: “Sacrifice another creature: You gain life equal to the sacrificed creature's toughness.” The cost's `sacrifice` is a selection (not a target); `{ "kind": "sacrificed", "property": "toughness" }` reads it as it last existed. ### Every reference value, one line each Generated from the schema: a value that is not in these tables does not exist. #### `of` — what a selection picks | of | Meaning | |---|---| | `object` | Cards and permanents in any zone (battlefield by default; `zone` / `zones` / `allZones` say where). | | `player` | Players. `player` narrows the candidates (`eachOpponent` = "target opponent"), `exceptPlayer` removes some. | | `spell` | A spell on the stack ("counter target spell"); `spell: { controller, filter }` narrows it. | | `ability` | An activated or triggered ability on the stack; `ability: { controller, kind, source }` narrows it. | | `spellOrAbility` | A spell or an ability on the stack ("counter target spell or ability", "change the target of …"). | | `any` | "Any target": a creature, player, planeswalker or battle (CR 115.4). `playerFilter: "opponent"` restricts only the player half; `permanents: true` makes the object half any permanent. | #### `mode` — how a selection is made (TargetDef) | mode | Meaning | |---|---| | `chosen` | A **target** (the default): picked as the spell or ability is put on the stack, checked again on resolution; an illegal target is not acted on and a spell whose targets are all illegal does nothing (CR 608.2b). Printed word: "target". Hexproof, shroud, ward and protection apply. | | `choose` | Picked **as the effect resolves** — not a target, so hexproof / shroud / ward don't apply and nothing fizzles. Printed: "choose a …", "a creature card from your graveyard", "of their choice". `chooser` says who picks when it isn't the controller. | | `all` | Every object matching `zone` × `player` × `filter` at resolution. Printed: "each", "all". | | `self` | The source itself — the card whose ability this is ("~", "this creature"). | | `random` | Sampled at random on resolution (`max` = how many distinct objects). Printed: "at random". With `of: "any"` a legal random target is declared while casting (CR 115.6). | | `host` | The object the source is attached to: "enchanted creature", "equipped creature", "fortified land". | | `triggering` | The object whose event triggered this ability — the creature that died, the card that entered, the spell that was cast; read with last known information once it has left its zone (CR 603.10, 608.2h). With `oneOrMore` it is the whole simultaneous group. Printed: "it", "that creature", "that spell". | | `created` | The tokens (objects) created earlier in this same resolution: "create a 1/1 … It gains haste". | | `convoked` | The creatures that convoked this spell (CR 702.51), as they were then — "each creature that convoked this spell connives". | | `linked` | The cards linked to the source — exiled with it by an `exile` / `moveTo` with `link: true`, by `exileUntilSourceLeaves`, by a `link` effect or by a replacement with `link: true` (CR 607.2a): "the exiled card", "cards exiled with ~". | | `paired` | The creature the source is paired with (soulbond). | | `top` | The top card(s) of a library, or the topmost matching card(s) of a graveyard: `zone` picks the pile, `player` whose, `max` how many; `position: "bottom"` reads the other end. | | `affected` | What the **previous effect step** of this ability acted on ("it", "them", "that creature", "those cards" right after an action); `span: N` unions the last N steps. The everyday back-reference inside one resolution. | | `replaced` | Inside a replacement's `instead` / `then`: the object the replaced event would have affected (its player form is the selector `replacedPlayer`). | | `replacedSource` | Inside a damage replacement: the source of the replaced damage (its controller is the selector `damageSourceController`). | | `triggeringOther` | The **other** object of the triggering event: for `blocks` the creature blocked, for `becomesBlocked` the blocker, for `dealsDamage` the permanent dealt damage, for `isDealtDamage` the damage's source, for `becomesTarget` (with `of` spell / ability / spellOrAbility) the spell or ability that targeted. Narrow it with `trigger.other`. Printed: "that creature" (the other one). | | `about` | Inside a delayed (or reflexive) trigger's effects: the object(s) it was set up about, fixed when it was created by `delayedTrigger.about` / `reflexiveTrigger.about` ("when that creature dies this turn", "return it at the beginning of the next end step"). After a zone change the new object no longer counts (CR 400.7), except the one whose zone change triggered it. | | `thisWay` | The objects actually acted on by earlier effects of this resolution, by `action` (sacrificed, milled, destroyed, exiled, discarded, returned, …), followed across their own zone change; `filter` reads their characteristics at the time of the action. Printed: "the cards milled this way", "each creature destroyed this way". | | `costPaid` | With `action: "sacrificed"`: the objects sacrificed to pay the cost of this spell or ability, as they last existed (CR 601.2h, 608.2h): "the sacrificed creature" of "As an additional cost to cast this spell, sacrifice a creature". | | `attacked` | The player, planeswalker or battle being attacked by the creature `attacker` names (`self` or `triggering`): "the player or planeswalker it's attacking". | | `grantor` | The permanent that granted this triggered ability, for as long as that same permanent remains on the battlefield. Grothama, All-Devouring uses this to identify which Grothama the attacker may fight. | #### `mode` of a player target (PlayerTargetDef) | mode | Meaning | |---|---| | `chosen` | A **target** player, declared as the spell or ability is put on the stack ("target player", "target opponent" with `player: "eachOpponent"`). The default. | | `choose` | A player picked on resolution, not targeted ("an opponent", "choose a player"). | | `all` | Every candidate player ("each opponent"). | | `random` | A candidate picked at random on resolution ("an opponent chosen at random"). | | `triggering` | The player whose action or step triggered the ability ("that player" of "whenever an opponent draws a card"). | | `about` | Inside a delayed trigger: the player it was set up about ("that player"). | | `affected` | The player(s) of the previous selection (`span` unions several). | #### Player selectors (`who`, `player`, `chooser`, `exceptPlayer`, a value's `who` …) | selector | Meaning | |---|---| | `you` | The ability's controller ("you"). The default nearly everywhere. | | `controller` | Also the ability's controller — the same player as `you`. | | `abilityController` | Inside a condition tested for each candidate player (`where`): the controller of the ability itself, not the candidate (CR 113.8, 608.2h). | | `sourceController` | The controller of the source object — not the player activating it when any player may activate the ability ("its controller", CR 109.5, 602.2). | | `owner` | The owner of the source card ("its owner" when the source is the subject). | | `eachOpponent` | Every opponent of the controller (in team games, the other team). As a candidate set: "target opponent", "an opponent". | | `eachPlayer` | Every player, in turn order from the active player. | | `target` | The player declared by this effect's player target (`target` / `playerTarget` with `of: "player"`) — "target player draws two cards". | | `triggeringPlayer` | The player whose action or step triggered the ability: the caster, the drawer, the player whose upkeep it is, the attacking player. | | `defendingPlayer` | The player the source is attacking (fixed when the attack trigger fired); in a `cantAttack` `unless` condition, the defender being considered. | | `attackingPlayer` | In a `cantBlock` `unless` condition, the controller of the attacking creature being considered ("can't block unless defending player controls more creatures than attacking player"). | | `activePlayer` | The player whose turn it is (CR 102.1, 500.1); printed as "that player" after "during an opponent's turn". | | `replacedPlayer` | Inside a replacement: the player the replaced event would have affected (damaged, drawing, gaining life …). | | `damageSourceController` | Inside a damage replacement: the controller of the replaced damage's source. | | `causeController` | In a trigger with `causedBy`: the controller of the spell or ability that caused the triggering event ("that opponent" of "a spell or ability an opponent controls destroys …"). | | `affectedController` | The controller of what the previous step acted on (its last known controller if it has left the battlefield; a countered spell's controller). Structured form `{ kind, span }` unions the last N selections. | | `affectedOwner` | The owner of what the previous step acted on ("its owner" after "exile target creature"). | | `triggeringController` | The (last known) controller of the object that triggered the ability ("its controller" of "whenever a creature dies"). | | `triggeringOwner` | The owner of the object that triggered the ability. | | `triggeringOtherController` | The controller of the event's other object (the creature blocked, the permanent dealt damage), by last known information. | | `triggeringOtherOwner` | The owner of the event's other object. | | `current` | The player being processed by an enclosing per-player step — `forEachPlayer`, `unlessPays`, `optional` / `villainousChoice` with several players, a `choose` with `who` (CR 608.2h). Printed: "that player", "they". | | `previousPlayer` | The player(s) of the preceding non-target player selection — after `{ effect: "choose", kind: "object", target: { of: "player", mode: "choose", … } }`, "that player". | | `mostLife` | Each player with the most life (ties included). | | `leastLife` | Each player with the least life (ties included). | | `mostCardsInHand` | Each player with the most cards in hand (ties included). | | `fewestCardsInHand` | Each player with the fewest cards in hand (ties included). | | `enchantedPlayer` | The player the source Aura (a Curse) is attached to (CR 303.4). | | `yourTeam` | You and your teammates (CR 810.2); outside team games, just you. | | `chosenPlayer` | The player chosen for the source — by `chooseAsEnters` (`kind: "player"`) or a remembered `choose` (CR 607.2d): "the chosen player". | | `playerToYourLeft` | The nearest player still in the game to your left — the next player in turn order (CR 101.4: turn order passes to the left); with two players, your opponent. | | `playerToYourRight` | The nearest player still in the game to your right — the previous player in turn order (CR 101.4); with two players, your opponent. | | `attackedPlayers` | In an attack trigger, the players the triggering creature(s) attack directly — for a `oneOrMore` group, every player one of them attacks ("you and those players"); never a player whose planeswalker or battle is attacked. | | `attackingOpponents` | In an attack trigger: your opponents who control the attacking creatures ("each opponent attacking that player does the same"). | | `attackedBySourceThisTurn` | Each player this same permanent was declared as attacking directly this turn. Angel of Destiny uses this history at your end step, including attacks from additional combat phases. | | `attackedBySourceLastCombat` | The player this same permanent was declared as attacking directly in your previous combat phase. If it last attacked a planeswalker or battle, or sat out that combat, the selection is empty. | Any selector may also be written as an object that narrows it — `{ "kind": , … }`: | Field | Type | Required | Description | |---|---|---|---| | `kind` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat"` | yes | Which kind of choice is made | | `span` | `number` | no | affectedController / affectedOwner: union the previous N selections | | `where` | `ConditionDef` | no | CR 608.2h: keep the candidates for whom this condition holds, with "you" rebound to each candidate ("each opponent who controls a creature", "each player who cast a spell this turn") | | `except` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat" \| object` | no | Remove this selection ("each player other than that player") | | `most` | `ValueDef` | no | Keep the candidates whose value (evaluated as that player) is the greatest, ties included ("the player who controls the most creatures") | | `fewest` | `ValueDef` | no | Keep the candidates whose value is the least, ties included | "Each opponent who controls a creature" = `{ "kind": "eachOpponent", "where": { "kind": "controls", "filter": { "types": ["Creature"] } } }`; "each player other than that player" = `{ "kind": "eachPlayer", "except": "triggeringPlayer" }`; "the player who controls the most creatures" = `{ "kind": "eachPlayer", "most": { "kind": "count", "filter": { "types": ["Creature"], "controller": "you" } } }` (`where` and the value are read *as each candidate*, so "you" there is the candidate). #### Filter relations: `ObjectFilter.controller` and `owner` | controller | Meaning | |---|---| | `you` | Controlled (owned) by you, the ability's controller. | | `opponent` | Controlled (owned) by an opponent of yours. | | `any` | Anyone — the same as leaving the field out. | | `notYou` | Not you: the printed "you don't control" / "you don't own" (every other player; the same as `opponent` outside team games). | | `affectedController` | Controlled by the controller of what the previous step acted on ("creatures that player controls" after "destroy target creature"). | | `triggeringController` | Controlled by the controller of the object that triggered the ability. | | `current` | Controlled (owned) by the player an enclosing per-player step is processing (`forEachPlayer`, …): "each creature that player controls". | | `notCurrent` | Not controlled by that processed player. | | `yourTeam` | Controlled by you or a teammate (CR 810.2). | | `previousPlayer` | Controlled by the player(s) of the preceding non-target player selection ("choose an opponent … creatures that player controls"). | | `chosenPlayer` | Controlled by the player chosen for the source ("creatures the chosen player controls"). | | `enchantedPlayer` | Controlled by the player the source Aura is attached to ("creatures enchanted player controls", CR 303.4). | `owner` takes `you`, `opponent`, `any`, `notYou`, `current` with the same meanings. #### Filter fields that relate an object to something else | Field | Type | Required | Description | |---|---|---|---| | `tappedForSourceThisTurn` | `"crew" \| "saddle"` | no | CR 702.122, 702.171, 400.7: this incarnation tapped to crew or saddle this source incarnation this turn | | `attackingPlayer` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat" \| { kind: "you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat"; span?: number; where?: ConditionDef; except?: any; most?: ValueDef; fewest?: ValueDef }` | no | Attacking this player directly, excluding attacks on their planeswalkers or battles (CR 508.1b, 508.6) | | `attackingPlaneswalkerControlledBy` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat" \| object` | no | Attacking a planeswalker controlled by this player; excludes attacks on players or battles (CR 508.1b) | | `bandedWithSource` | `boolean` | no | CR 702.22c-f: a different attacking creature in the source's current band; leaving combat removes membership | | `self` | `boolean` | no | Only the source itself | | `other` | `boolean` | no | Anything except the source ("another") | | `otherThanTrigger` | `boolean` | no | Exclude the object that caused the trigger, rather than the ability's source (CR 603.10a, 608.2h) | | `nameOf` | `"self" \| "affected"` | no | Shares the source's name ("self"), or the name of the preceding single object selection ("affected": "a creature card with the same name as that creature", CR 201.2) | | `host` | `boolean` | no | The object the source is attached to | | `attachedToSource` | `boolean` | no | Attached to the source ("Auras attached to ~") | | `attachedToReference` | `"affected" \| "triggering" \| "triggeringOther"` | no | Attached to the preceding selected object or the triggering event's object/other object: Equipment/Auras attached to that creature (CR 301.5, 303.4, 608.2c) | | `attachedTo` | `ObjectFilter` | no | CR 301.5, 303.4, 701.3: attached to a battlefield permanent matching this host filter; does not select or target the host | | `sharesWithHost` | `"creatureType" \| "color" \| "cardType"` | no | Shares this characteristic with the source's attachment host (CR 303.4, 301.5) | | `attachedToHost` | `boolean` | no | Is (or is not) attached to the source's host | | `notAffected` | `boolean` | no | Exclude objects in the latest affected selection: the rest (CR 608.2c-d) | | `notChosenSubtype` | `boolean \| string` | no | Does not have the chosen creature type; changeling has every creature type (CR 205.3m, 702.73) | | `chosenSubtype` | `boolean \| string` | no | Choice in the resolving ability, falling back to the source; true uses the default kind key, a string selects a named key (CR 608.2d) | | `chosenColor` | `boolean \| string` | no | Choice in the resolving ability, falling back to the source; true uses the default kind key, a string selects a named key (CR 608.2d) | | `chosenParity` | `boolean \| string` | no | Mana value has the chosen odd/even quality; zero is even (CR 107.1) | | `chosenPowerParity` | `boolean \| string` | no | Power has the chosen odd/even quality ("each creature with power of the chosen quality"); zero is even (CR 107.1, 208.1) | | `chosenKind` | `boolean \| string` | no | CR 608.2d: matches the chosen land or nonland kind | | `chosenType` | `boolean \| string` | no | Matches the chosen card type (CR 205.2, 608.2d) | | `chosenName` | `boolean \| string` | no | Choice in the resolving ability, falling back to the source; true uses the default kind key, a string selects a named key (CR 608.2d) | | `chosenBy` | `"controller" \| "owner"` | no | CR 101.4, 608.2d: with several choosers (choose with collect), chosenColor / chosenName / chosenType / chosenSubtype / notChosenSubtype read the answer of this object's controller (a card's owner off the battlefield) or owner — "only the color its controller chose" | | `comparedToSource` | `{ property: "power" \| "toughness" \| "manaValue"; op: "<" \| "<=" \| ">" \| ">=" \| "==" }` | no | Compare a property with the source's ("creature with lesser power", "greater mana value than ~") | | `comparedToTrigger` | `{ property: "power" \| "toughness" \| "manaValue"; op: "<" \| "<=" \| ">" \| ">=" \| "==" }` | no | Compare a property with the object that caused the trigger; death/leaves events use its battlefield snapshot (CR 603.10a, 608.2h) | | `attachedToSameHost` | `boolean` | no | Attached to the same object the source is attached to | | `linkedToSource` | `boolean` | no | Cards exiled with / linked to the source (imprint, "the exiled card") | | `sharesWithSource` | `"creatureType" \| "cardType" \| "color" \| "name"` | no | Shares a creature type / card type / color / name with the source | | `sharesWithSacrificed` | `"creatureType" \| "cardType" \| "color" \| "name"` | no | CR 601.2h, 602.2b, 608.2h: shares the characteristic with the object sacrificed to pay this spell's or ability's cost, as it last existed on the battlefield (Pyre of Heroes: "a creature card that shares a creature type with the sacrificed creature"); with any of them when several were sacrificed, never when none was | | `sharesWithTarget` | `"creatureType" \| "cardType" \| "color" \| "name"` | no | Shares a creature type / card type / color / name with the ability's first chosen target (radiance) | | `sharesWith` | `{ property: "creatureType" \| "cardType" \| "permanentType" \| "color" \| "name" \| "manaValue" \| "controller"; with?: TargetDef; negate?: boolean }` | no | CR 608.2h: shares the property with an object of the selection reference — { mode: "self" } the source, { mode: "affected" } / { mode: "triggering" } "that creature" / "it", { mode: "host" } the enchanted permanent, a declared target slot. Generalises sharesWithSource / sharesWithHost / sharesWithTarget; negate = "doesn't share". Never matches the referenced object itself | | `comparedTo` | `{ property: "power" \| "toughness" \| "manaValue" \| "powerPlusToughness"; op: "<" \| "<=" \| ">" \| ">=" \| "=="; with?: TargetDef; offset?: number }` | no | CR 608.2h: compare a characteristic with every object of the selection reference ("creatures with power less than that creature's power"); `offset` is added to theirs ("at least 2 greater"). Generalises comparedToSource / comparedToTrigger | | `attachedToSelection` | `TargetDef` | no | CR 301.5, 303.4: attached to an object of the selection reference ("all Equipment attached to that creature" = { mode: "affected" }). Generalises attachedToSource / attachedToReference | | `inSelection` | `TargetDef` | no | Is one of the objects of the selection reference (the same incarnation, CR 400.7) — with anyOf it unions a declared target with the objects related to it: "target creature and each other creature that shares a creature type with it" destroyed as one event | | `combatWith` | `{ relation: "blocking" \| "blockedBy" \| "attacking" \| "attackedBy"; of?: TargetDef }` | no | CR 506.4, 509.1: in this combat relation to an object of the selection reference — blocking it, blocked by it, attacking it (a planeswalker or battle), attacked by it | | `enteredThisTurnUnder` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat" \| object` | no | CR 603.6a, 400.7: entered this turn under this player's control, independent of current control | | `dealtDamageThisTurn` | `boolean` | no | CR 120.4, 608.2b: this incarnation dealt positive damage this turn | | `dealtDamageToThisTurn` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat" \| object` | no | CR 120.4, 400.7, 608.2b: this incarnation dealt positive damage to this player earlier this turn | | `dealtCombatDamageToThisTurn` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "replacedPlayer" \| "damageSourceController" \| "causeController" \| "affectedController" \| "affectedOwner" \| "triggeringController" \| "triggeringOwner" \| "triggeringOtherController" \| "triggeringOtherOwner" \| "current" \| "previousPlayer" \| "mostLife" \| "leastLife" \| "mostCardsInHand" \| "fewestCardsInHand" \| "enchantedPlayer" \| "yourTeam" \| "chosenPlayer" \| "playerToYourLeft" \| "playerToYourRight" \| "attackedPlayers" \| "attackingOpponents" \| "attackedBySourceThisTurn" \| "attackedBySourceLastCombat" \| object` | no | CR 510.2, 400.7, 608.2b: this incarnation dealt positive combat damage to this player earlier this turn ("a creature … that dealt combat damage to you this turn") | | `counterPlacedThisTurnBy` | `"you"` | no | You put a counter on this incarnation this turn; remains true after removal (CR 122.6, 608.2b) | | `damagedBySource` | `boolean` | no | Was dealt damage by this incarnation of the source this turn (CR 400.7, 603.10a; "a creature dealt damage this way") | | `damagedThisTurnBy` | `ObjectFilter` | no | CR 120.1, 400.7, 608.2h: this incarnation was dealt damage this turn by a source matching this filter as the source was when it dealt the damage — "another creature dealt damage this turn by a Spider you controlled" is { subtypes: ["Spider"], controller: "you" } (Shelob, Child of Ungoliant) | #### `action` — what an earlier step actually did (`mode: "thisWay"`, `doneThisWay.of`) | action | Meaning | |---|---| | `sacrificed` | Permanents sacrificed by earlier steps ("the sacrificed creature", "for each creature sacrificed this way"). | | `milled` | Cards milled (and cards a surveil put into the graveyard). | | `destroyed` | Permanents destroyed (now in the graveyard: add `zone: "graveyard"` to act on the cards). | | `exiled` | Objects exiled ("the exiled card", "return the exiled cards"). | | `discarded` | Cards discarded. | | `returned` | Cards returned to hand. | | `putIntoLibrary` | Cards a `moveTo` put into a library, and cards a surveil kept on top. | | `tapped` | Permanents tapped. | | `untapped` | Permanents untapped. | | `damaged` | Objects and players dealt damage ("each creature dealt damage this way"). | | `drawn` | Cards drawn. | | `revealed` | Cards revealed. | | `countersPlaced` | Counters put on objects — counted per counter, not per object. | | `countersRemoved` | Counters removed — counted per counter. | | `amassed` | The Army an amass put counters on (or created): "the amassed Army", "the Army you amassed" (CR 701.47a), read as it is now while it stays on the battlefield. | | `countered` | Spells countered, with their characteristics on the stack. | | `phasedOut` | Permanents that phased out directly this way ("for each creature that phased out this way", CR 702.26). | | `searched` | A player action, not objects: each player who actually searched a library, once per search (CR 701.19 — "each player who searched their library this way shuffles"). Read it with `doneThisWay.by`; it selects no objects. | | `created` | Tokens created ("if you created fewer than two tokens this way"). | #### Durations (`duration`) | duration | Meaning | |---|---| | `instant` | No lasting duration of its own: read as the effect's default (end of turn for continuous changes). Prefer omitting `duration` or writing `endOfTurn`. | | `endOfTurn` | Until end of turn (expires in the cleanup step). The default for one-shot layer effects. | | `endOfCombat` | Until end of combat (ends as the end-of-combat step ends). | | `endOfAdditionalCombat` | Through the additional combat phase created earlier in the same resolution, ending as that combat's end-of-combat step ends ("that combat", CR 500.8, 506.1; Illusionist's Gambit). | | `untilYourNextTurn` | Until your next turn begins. | | `untilEndOfYourNextTurn` | Through your next turn; expires in that turn's cleanup step (an extra turn counts). | | `untilEndOfNextTurn` | Until the end of the next turn, whoever's it is. | | `untilStackEmpty` | Until the stack is empty (the next time a player would get priority with an empty stack). | | `untilYourNextEndStep` | Until your next end step begins. | | `untilYourNextUpkeep` | Until your next upkeep begins. | | `permanent` | For the rest of the game while the object stays where it is (a zone change makes a new object and ends it, CR 400.7). Printed changes with no stated duration. | | `untilSourceLeaves` | Until the source leaves the battlefield ("until ~ leaves the battlefield"). | | `whileYouControlSource` | For as long as you control the source; ends for good the moment you don't (CR 611.2b). | | `whileYourTurn` | For as long as it is your turn; does nothing if it isn't your turn when the effect resolves. | | `perpetual` | Perpetually (Alchemy): survives zone changes, in every zone, for the rest of the game. | | `controllersNextTurnEnd` | (restrict only) Applies only during the affected object's controller's next turn, fixed on resolution. | | `whileSource` | `{ "whileSource": }` — for as long as the original source stays on the battlefield and matches the filter ("for as long as ~ remains tapped": `{ "tapped": true }`). Ends permanently when it stops matching. | | `whileTarget` | `{ "whileTarget": }` — for as long as the selected object stays and matches the filter ("for as long as that creature has a +1/+1 counter on it"). With `whileSource` both must hold. | | `untilEvent` | `{ "untilEvent": }` — until the described event happens, matched as a trigger of the source with its controller fixed on resolution ("until an opponent becomes the monarch": `{ "event": "becameMonarch", "by": "opponent" }`). | The filter of `whileSource` / `whileTarget` (a live subset of ObjectFilter): | Field | Type | Required | Description | |---|---|---|---| | `controller` | `"you" \| "opponent" \| "any" \| "notYou"` | no | Controller relative to the fixed player who created the effect | | `tapped` | `boolean` | no | The tracked permanent remains tapped or untapped | | `hasCounter` | `string` | no | At least one counter of this kind remains on the tracked permanent | | `enchanted` | `boolean` | no | Whether at least one Aura is attached to the tracked permanent | | `comparedToSource` | `{ property: "power" \| "toughness" \| "manaValue"; op: "<" \| "<=" \| ">" \| ">=" \| "==" }` | no | A live characteristic comparison to the original source | #### Counters A counter kind is any string: `addCounters` / `removeCounters` / `moveCounters` / `entersWithCounters` / cost `removeCounters` / filter `hasCounter` all take the kind's name, and `any` means any kind in filters and removal. Kinds the engine gives rules meaning: - `+1/+1` and `-1/-1` change power and toughness (layer 7c) and annihilate in pairs (CR 704.5q); `addCounters` defaults to `+1/+1`. - `loyalty` (planeswalkers, `loyalty` costs), `defense` (battles), `lore` (Sagas — chapter abilities trigger as lore counters are added), `time` (suspend, vanishing, time travel), `fade` (fading), `age` (cumulative upkeep), `level` (level up), `charge` and the like are counted by the abilities that read them (`countersOnSource`, `hasCounter` + `minCounters`). - `stun`: the permanent stays tapped and a stun counter is removed instead of untapping (CR 122.1d). `shield`: if the permanent would be dealt damage or destroyed, remove a shield counter instead (CR 122.1c). - Keyword counters (CR 122.1b) grant their keyword while on the permanent: `flying`, `first strike`, `double strike`, `deathtouch`, `haste`, `hexproof`, `indestructible`, `lifelink`, `menace`, `reach`, `shadow`, `trample`, `vigilance`, `decayed`, `exalted`. - Player counters (poison, energy, experience, rad, …) are not object counters: `poisonCounters` / `playerCounters` effects, the `playerCounters` value and cost `payCounters`. Counter events are replaceable and triggerable: the replacement `{ "replaces": "event", "event": "putCounters", … }` (with `counter`, `by`, `from`, `add`, `multiply`, `prevent`) and the trigger `countersPlaced` (with `counter`, `placedBy`, `eachCounter`). #### Zones - `battlefield` — Permanents. The default zone for filters and targets. - `hand` — Hidden; owner-visible. "discard", "return to hand", "from your hand". - `graveyard` — Public, ordered. "dies" = battlefield → graveyard; reanimation reads from here. - `library` — Hidden, ordered. Top / bottom positions via `position`; `mode: "top"` targets the top card(s). - `exile` — Public. Linked exile (`link`, `linkedToSource`) remembers what a card exiled. - `stack` — Spells and abilities waiting to resolve; `of: "spell"` targets live here. - `command` — Emblems, commanders, dungeons; `eminence` abilities work from here.