# Drawstep engine · Effects · `costModifier` > Cost modifier — A resolving spell or ability changes what matching spells cost for a duration (CR 601.2f, 611.2a). 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#costModifier ## Where it goes One step of an ability's `effects[]` (a spell's, a trigger's, an activated ability's, a mode's): `{ "effect": "costModifier", … }`. 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`) | | `target` | `TargetDef` | no | What it acts on (TargetDef) | | `filter` | `ObjectFilter` | no | Which objects (ObjectFilter; set fields AND together) | | `amount` | `number \| { kind: "var"; name: string } \| { kind: "count"; digSubset?: "looked" \| "picked" \| "rest"; of?: "object" \| "player"; zone?: "battlefield" \| "hand" \| "graveyard" \| "library" \| "exile" \| "stack …` | yes | Signed generic change, fixed on resolution (negative = less) | | `next` | `boolean` | no | Only the next matching spell each affected player casts | | `duration` | `"endOfTurn" \| "untilYourNextTurn" \| "permanent"` | no | Default endOfTurn. permanent (with next): no time limit — lasts until a matching spell is cast ("The next planeswalker spell you cast costs {1} less to cast") | ## Minimal form ```json {"effect":"costModifier","amount":1} ``` The engine reads that minimal form as: “spells you cast this turn cost {1} more to cast”. ## Stock examples - **Stalwart Realmwarden** — “When Stalwart Realmwarden enters, the next noncreature spell target opponent casts costs {2} more to cast.” ```json {"effect":"costModifier","who":"target","target":{"of":"player","mode":"chosen","player":"eachOpponent"},"filter":{"notTypes":["Creature"]},"amount":2,"next":true,"duration":"permanent"} ``` - **Sparks Ablaze** — “Sparks Ablaze deals 2 damage to target creature or planeswalker. If that creature or planeswalker would die this turn, exile it instead.” ```json {"effect":"costModifier","who":"you","filter":{"types":["Planeswalker"]},"amount":-1,"next":true,"duration":"permanent"} ``` - **Kaza, Roil Chaser** — “{T}: The next instant or sorcery spell you cast this turn costs {X} less to cast, where X is the number of Wizards you control as this ability resolves.” ```json {"effect":"costModifier","who":"you","filter":{"anyTypes":["Instant","Sorcery"]},"amount":{"kind":"math","op":"*","a":-1,"b":{"kind":"math","op":"max","a":0,"b":{"kind":"count","filter":{"subtypes":["Wizard"],"controller":"you"}}}},"next":true,"duration":"endOfTurn"} ``` ## 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 - [Start here](https://drawstep.xyz/wiki/mtg/start.md) — the rules, the output contract and the index of every primitive