# Drawstep engine · Statics & layers · `cantAttack` > Cant attack — Cannot attack (alone when specified) unless the condition holds (CR 508.1c); with onlyAlone, can only attack alone; with unlessPays, can't attack without paying that cost (CR 508.1d). 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/statics#cantAttack ## Where it goes The `effect` of a static ability (or one of its `effects`): `{ "kind": "static", "effect": { "type": "cantAttack", … } }`. Applied continuously through the layer system. Printed words that point here (search aliases): can't attack pacifism can only attack alone creatures can't attack you unless their controller pays {2} for each creature they control that's attacking you ghostly prison propaganda windborn muse sphere of safety attack tax. ## Fields | Field | Type | Required | Description | |---|---|---|---| | `to` | `TargetDef` | yes | What it applies to (TargetDef) | | `unless` | `ConditionDef` | no | The effect doesn't apply while this condition holds | | `alone` | `boolean` | no | Can't attack alone (it may attack together with others) | | `defending` | `"you" \| "controller" \| "abilityController" \| "sourceController" \| "owner" \| "eachOpponent" \| "eachPlayer" \| "target" \| "triggeringPlayer" \| "defendingPlayer" \| "attackingPlayer" \| "activePlayer" \| "re …` | no | CR 508.1c: only attacks against these players are forbidden; itsOwner is each affected creature's own owner ("can't attack its owner"), fixed per creature | | `planeswalkers` | `boolean` | no | Also forbid attacking planeswalkers those players control | | `onlyAlone` | `boolean` | no | CR 508.1c: "can only attack alone" — can't attack while any other creature attacks; combine with no other field | | `alreadyAttacked` | `boolean` | no | CR 508.1c: "can't attack a player it has already attacked this turn" (Bloodthirster) — each affected creature can't attack a player it was declared attacking earlier this turn; planeswalker and battle attacks don't count. Combine with no other field | | `perCreatureText` | `"those"` | no | CR 508.1g-h: render the per-attacker payment as for each of those creatures; identical rules to the expanded wording | | `unlessPays` | `CostDef` | no | CR 508.1d, 508.1g-i: a cost to attack instead of a ban — "Creatures can't attack you unless their controller pays {2} for each creature they control that's attacking you" (Ghostly Prison, Propaganda; Sphere of Safety with planeswalkers and genericAmount "{X} …, where X is the number of enchantments you control"): this cost (mana, genericAmount evaluated for this ability's controller, payLife) for each affected creature attacking one of `defending` (and, with planeswalkers, a planeswalker they control; any defender without `defending`). The attacking player pays the total while declaring attackers, or redoes the declaration; requirements don't oblige paying. Combine with defending / planeswalkers only | ## Minimal form ```json {"type":"cantAttack","to":{"of":"object","mode":"self"},"perCreatureText":"those"} ``` The engine reads that minimal form as: “~ can't attack”. ## Stock examples - **Enchantment Condition Study** — “” ```json {"type":"cantAttack","to":{"of":"object","mode":"self"}} ``` - **Graveyard Condition Study** — “” ```json {"type":"cantAttack","to":{"of":"object","mode":"self"},"unless":{"kind":"anyOpponent","condition":{"kind":"compare","a":{"kind":"count","zone":"graveyard","player":"you"},"op":">=","b":8}}} ``` - **Defender Ban Study** — “” ```json {"type":"cantAttack","to":{"of":"object","mode":"all","filter":{"types":["Creature"]}},"defending":"you","planeswalkers":true} ``` ## Related - [Statics & layers](https://drawstep.xyz/wiki/mtg/statics.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