# Drawstep engine · Effects · `ifDone` > If done — CR 608.2c, 609.3: perform the mandatory action as far as possible, then branch on full completion. 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#ifDone ## Where it goes One step of an ability's `effects[]` (a spell's, a trigger's, an activated ability's, a mode's): `{ "effect": "ifDone", … }`. Steps resolve in order. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `action` | `{ effect: "discard"; amount: ValueDef } \| { effect: "tap"; target: TargetDef } \| { effect: "removeCounters"; target: TargetDef; counter?: string; amount: any } \| { effect: "moveTo"; target: TargetDef; …` | yes | The mandatory action; `then` runs only if it was done in full (CR 609.3) | | `then` | `EffectDef[]` | yes | Effects that follow ("then …", "if you do …") | | `else` | `EffectDef[]` | no | Effects run when the condition / choice / payment fails ("otherwise …", "if you don't …") | | `failure` | `"cant"` | no | Render the failure branch as if you cannot perform the action | ## Minimal form ```json {"effect":"ifDone","action":{"effect":"discard","amount":1},"then":[],"failure":"cant"} ``` The engine reads that minimal form as: “discard a card”. ## Stock examples - **Test of Completion** — “Discard a card. If you do, draw two cards.” ```json {"effect":"ifDone","action":{"effect":"discard","amount":1},"then":[{"effect":"drawCards","who":"you","amount":2}]} ``` - **Empty Hand Reward** — “Discard a card. If you don't, draw a card.” ```json {"effect":"ifDone","action":{"effect":"discard","amount":1},"then":[],"else":[{"effect":"drawCards","who":"you","amount":1}]} ``` - **Double Completion** — “Discard two cards. If you do, draw three cards.” ```json {"effect":"ifDone","action":{"effect":"discard","amount":2},"then":[{"effect":"drawCards","who":"you","amount":3}]} ``` ## 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) - [Values](https://drawstep.xyz/wiki/mtg/values.md) — every number kind an `amount` accepts - [Effects](https://drawstep.xyz/wiki/mtg/effects.md) — the steps a nested `effects` / `then` list may contain - [Start here](https://drawstep.xyz/wiki/mtg/start.md) — the rules, the output contract and the index of every primitive