# Drawstep engine · Effects · `rollDie` > Roll die — Roll a die (d20 default); the matching result's effects run. 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#rollDie ## Where it goes One step of an ability's `effects[]` (a spell's, a trigger's, an activated ability's, a mode's): `{ "effect": "rollDie", … }`. Steps resolve in order. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `who` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "re …` | no | Which player(s) — a player selector (default `you`) | | `sides` | `number` | no | Number of sides of the die (default 20) | | `reroll` | `{ condition: ConditionDef; optional?: boolean }` | no | CR 706.6: ignore a matching initial roll and reroll once before roll events | | `perResult` | `EffectDef[]` | no | After all dice are rolled, do this for each result | | `chooseResult` | `boolean` | no | CR 706.3, 608.2d: the roller chooses one result; dieResult.of chosen/other read it | | `then` | `EffectDef[]` | no | Instructions after the rolls; dieResult.of can read total/highest/lowest | | `amount` | `ValueDef` | no | How many / how much (integer or ValueDef) | | `add` | `ValueDef` | no | CR 706.2: "roll a d20 and add X" — X is added to the (single) die's result before the results table is read; dieResult is the modified result | | `results` | `({ min: number; max?: number; orMore?: boolean; effects: EffectDef[] })[]` | yes | Result ranges of the die roll: each `{ min, max?, effects }` | ## Minimal form ```json {"effect":"rollDie","results":[]} ``` The engine reads that minimal form as: “roll a d20”. ## Stock examples - **Event Probe dice** — “” ```json {"effect":"rollDie","sides":6,"then":[{"effect":"gainLife","who":"you","amount":{"kind":"dieResult","of":"total"}}],"amount":2,"results":[]} ``` - **Event Probe one-die** — “” ```json {"effect":"rollDie","sides":6,"results":[]} ``` - **D20** — “1–9 | You gain 1 life.” ```json {"effect":"rollDie","who":"you","sides":20,"results":[{"min":1,"max":9,"effects":[{"effect":"gainLife","who":"you","amount":1}]},{"min":10,"max":19,"effects":[{"effect":"gainLife","who":"you","amount":2}]},{"min":20,"effects":[{"effect":"gainLife","who":"you","amount":4}]}]} ``` ## Related - [Effects](https://drawstep.xyz/wiki/mtg/effects.md) — the whole topic - [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