# Drawstep engine · Effects · `flipCoin` > Flip coin — Flip coin(s): then = you win, else = you lose, perWin = once per flip won. 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#flipCoin ## Where it goes One step of an ability's `effects[]` (a spell's, a trigger's, an activated ability's, a mode's): `{ "effect": "flipCoin", … }`. Steps resolve in order. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `untilLose` | `boolean` | no | CR 705: repeat called flips until a loss | | `who` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "re …` | no | Which player(s) — a player selector (default `you`) | | `amount` | `ValueDef` | no | How many / how much (integer or ValueDef) | | `then` | `EffectDef[]` | no | Effects that follow ("then …", "if you do …") | | `else` | `EffectDef[]` | no | Effects run when the condition / choice / payment fails ("otherwise …", "if you don't …") | | `perWin` | `EffectDef[]` | no | Effects run once per flip won | | `perHeads` | `EffectDef[]` | no | CR 705.2: uncalled flips (no flip is won or lost); runs once for each coin that comes up heads. Excludes then / else / perWin / untilLose | ## Minimal form ```json {"effect":"flipCoin"} ``` The engine reads that minimal form as: “flip a coin”. ## Stock examples - **Iteration 71 flip** — “” ```json {"effect":"flipCoin"} ``` - **Event Probe coin** — “” ```json {"effect":"flipCoin","then":[{"effect":"gainLife","amount":2}],"else":[{"effect":"loseLife","amount":2}]} ``` - **Heads Up** — “Flip five coins. Draw a card for each coin that comes up heads.” ```json {"effect":"flipCoin","who":"you","amount":5,"perHeads":[{"effect":"drawCards","who":"you","amount":1}]} ``` ## 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