# Drawstep engine · Replacements · `toGraveyard` > To graveyard — "If ~ would be put into a graveyard from anywhere, exile it instead". 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/replacements#toGraveyard ## Where it goes A replacement ability: `{ "kind": "replacement", "replacement": { "replaces": "toGraveyard", … } }`. Printed words that point here (search aliases): would be put into a graveyard instead shuffle. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `instead` | `"exile" \| "shuffleIntoLibrary" \| "hand"` | yes | Where it goes instead: exile, shuffled into its owner's library, or its owner's hand | | `applyTo` | `TargetDef` | no | What the replacement watches (default the source itself; `mode: "all"` + filter for a group, a player selector for player events) | | `fromBattlefieldOnly` | `boolean` | no | Only when it would go to the graveyard from the battlefield | ## Minimal form ```json {"replaces":"toGraveyard","instead":"exile"} ``` The engine reads that minimal form as: “if ~ would be put into a graveyard from anywhere, exile it instead”. ## Stock examples - **Self Shuffle** — “If this creature would be put into a graveyard from anywhere, shuffle it into its owner's library instead.” ```json {"replaces":"toGraveyard","instead":"shuffleIntoLibrary"} ``` - **Darksteel Colossus** — “If Darksteel Colossus would be put into a graveyard from anywhere, reveal Darksteel Colossus and shuffle it into its owner's library instead.” ```json {"replaces":"toGraveyard","instead":"shuffleIntoLibrary"} ``` ## Related - [Replacements](https://drawstep.xyz/wiki/mtg/replacements.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