# Drawstep engine · Effects · `grantAbility` > Grant ability — CR 113.7a, 611.2, 707.9: grant an ability, or copy the resolving ability with this. Perpetual grants follow the card across zones. Engine: Magic: The Gathering (`mtg`). This is one primitive of the Drawstep card vocabulary; field names and the discriminator are exact. Wiki page: https://drawstep.xyz/wiki/mtg/effects#grantAbility ## Where it goes One step of an ability's `effects[]` (a spell's, a trigger's, an activated ability's, a mode's): `{ "effect": "grantAbility", … }`. Steps resolve in order. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `target` | `TargetDef` | yes | What it acts on (TargetDef) | | `ability` | `AbilityDef \| "this"` | yes | The ability granted (an AbilityDef) | | `duration` | `Duration` | no | CR 611.2a-b, 702.26f: continuous-effect duration. Conditional source/target filters are ANDed, identities and you are fixed on resolution, and failure ends the effect permanently. untilEndOfYourNextTurn lasts through your next turn's end step and expires at cleanup; whileYourTurn ends when another player becomes active and cannot start on an opponent's turn. untilYourNextEndStep / untilYourNextUpkeep end as that step begins; endOfCombat ends as the end-combat step ends (CR 511.2); endOfAdditionalCombat lasts through the additional combat phase created before it resolved, ending as that combat's end-combat step ends (CR 500.8, 506.1 — "that combat"). untilEvent ends when the described event happens. perpetual survives zone changes | ## Minimal form ```json {"effect":"grantAbility","target":{"of":"object","mode":"chosen","filter":{"types":["Creature"]}},"ability":{"kind":"triggered","trigger":{"event":"enters","filter":{"self":true}},"effects":[],"distinctModeTargets":"player"}} ``` The engine reads that minimal form as: “until end of turn, target creature gains "When this creature enters, (no effects)"”. ## Stock examples - **Quoted Unblockability Study** — “” ```json {"effect":"grantAbility","target":{"of":"object","mode":"chosen","filter":{"types":["Creature"]}},"ability":{"kind":"static","effect":{"type":"grantKeyword","to":{"of":"object","mode":"self"},"keyword":"Can't be blocked"}},"duration":"perpetual"} ``` - **Death Grant Witness** — “” ```json {"effect":"grantAbility","target":{"of":"object","mode":"chosen","filter":{"types":["Creature"]}},"ability":{"kind":"replacement","replacement":{"replaces":"event","event":"dies","to":{"of":"object","mode":"self"},"zone":"exile"}},"duration":"permanent"} ``` - **Perpetual Replacement Witness** — “” ```json {"effect":"grantAbility","target":{"of":"object","mode":"choose","zone":"hand","filter":{"anyTypes":["Instant","Sorcery"],"owner":"you"}},"ability":{"kind":"replacement","replacement":{"replaces":"event","event":"damage","to":{"of":"object","mode":"all"},"toPlayer":"eachPlayer","from":{"of":"object","mode":"self"},"damageKind":"noncombat","add":2}},"duration":"perpetual"} ``` ## Related - [Effects](https://drawstep.xyz/wiki/mtg/effects.md) — the whole topic - [Filters & targets](https://drawstep.xyz/wiki/mtg/targets.md) — how `target` / `filter` select objects and players (selection algebra) - [Start here](https://drawstep.xyz/wiki/mtg/start.md) — the rules, the output contract and the index of every primitive