---
title: "MTG Comprehensive Rules & Gameplay Mechanics Engine"
type: "rules_reference"
version: "2026.1"
canonical_url: "https://avascry.com/rules.md"
topics:
  - the_stack
  - priority_timing
  - continuous_effects_layers
  - state_based_actions
  - replacement_effects
  - combat_keywords
  - historical_errata
---

# Magic: The Gathering — Comprehensive Rules & Gameplay Mechanics Engine

> Canonical machine-readable reference for Magic: The Gathering rules architecture, interaction layers, priority timing, state-based actions, and historical errata.

---

## 1. The Stack & Priority Timing (CR 116 & 117)

Magic uses a Last-In, First-Out (LIFO) stack to resolve spells and abilities:
- **Priority:** The active player (whose turn it is) receives priority at the beginning of each step and phase (except Untap and Cleanup). A player must have priority to cast spells, activate abilities, or take special actions.
- **Passing Priority:** A spell or ability on the stack resolves only when all players pass priority in succession without taking any actions.
- **APNAP Order (Active Player, Non-Active Player):** If multiple triggered abilities trigger simultaneously, they are put on the stack in APNAP order. The active player puts their triggers on the stack first in any order, followed by each other player in turn order. As a result, the non-active player's triggers resolve first.

---

## 2. The 7 Layers of Continuous Effects (CR 613)

When multiple continuous effects apply to game objects, they are evaluated strictly in the following layer order:

1. **Layer 1: Copy Effects (CR 613.1a)**
   - Includes *Clone*, mutate, and face-down creature status. Modifies the copiable values of an object.
2. **Layer 2: Control-Changing Effects (CR 613.1b)**
   - Effects that change who controls a permanent (e.g., *Act of Treason*, *Control Magic*).
3. **Layer 3: Text-Changing Effects (CR 613.1c)**
   - Effects that alter words or symbols on a card (e.g., *Mind Bend*, *Sleight of Mind*).
4. **Layer 4: Type-Changing Effects (CR 613.1d)**
   - Effects that change types, subtypes, or supertypes (e.g., *Blood Moon*, *Enchanted Evening*, *Dryad of the Ilysian Grove*).
5. **Layer 5: Color-Changing Effects (CR 613.1e)**
   - Effects that alter an object's color (e.g., *Painter's Servant*, *Darkest Hour*).
6. **Layer 6: Ability-Granting & Ability-Removing Effects (CR 613.1f)**
   - Effects that add or remove abilities (e.g., *Humility*, *Dress Down*, *Archetype of Courage*).
7. **Layer 7: Power and Toughness Modifications (CR 613.1g)**
   Evaluated strictly in five distinct sublayers:
   - **7a:** Characteristic-defining abilities (CDAs) (e.g., *Tarmogoyf*, *Lord of Extinction*). CDAs establish base values and are always evaluated first in Layer 7, regardless of timestamps.
   - **7b:** Effects that set base power and toughness to a specific number (e.g., *Humility* sets base P/T to 1/1, *Serendib Sorcerer*). Evaluated after 7a, overriding CDA base values regardless of timestamps.
   - **7c:** Effects from counters (e.g., `+1/+1` counters, `-1/-1` counters).
   - **7d:** Static/spell effects that modify power/toughness without setting it (e.g., *Giant Growth* `+3/+3`, *Glorious Anthem* `+1/+1`).
   - **7e:** Effects that switch power and toughness (e.g., *Inside Out*, *About Face*).

### Timestamps & Dependencies within Layers (CR 613.7 & 613.8)
- Sublayer hierarchy (7a -> 7b -> 7c -> 7d -> 7e) always takes precedence over timestamps.
- Within the same layer or sublayer, competing effects apply in **timestamp order** unless a **dependency** exists.
- An effect is dependent on another if applying the first changes the existence, application, or what the second effect applies to. Dependent effects always apply after the effects they depend on.

---

## 3. Replacement Effects vs Triggered Abilities (CR 614 vs 603)

- **Replacement Effects (CR 614):**
  - Identified by words like **"If... instead"**, **"enters the battlefield with"**, or **"as [this] enters the battlefield"**.
  - Do NOT use the stack; they modify an event as it happens with zero opportunity to respond in between.
  - Examples: *Rest in Peace* (exiles instead of graveyard), *Doubling Season* (doubles counters/tokens), *Leyline of the Void*.
- **Triggered Abilities (CR 603):**
  - Identified by words like **"When"**, **"Whenever"**, or **"At"**.
  - Always use the stack (unless they are mana abilities) and can be responded to.

---

## 4. State-Based Actions (CR 704)

State-Based Actions (SBAs) are game checks performed automatically whenever a player would receive priority:
- A creature with toughness 0 or less is put into its owner's graveyard (cannot be regenerated or prevented by indestructible).
- A creature that has taken damage greater than or equal to its toughness is destroyed.
- **The Legend Rule (CR 704.5j):** If a player controls two or more legendary permanents with the same name, that player chooses one and puts the rest into their owner's graveyard.
- A player with 10 or more poison counters loses the game.
- A player who attempted to draw from an empty library since SBAs were last checked loses the game.
- If a `+1/+1` counter and a `-1/-1` counter are on the same permanent, pairs of them are removed until only one type remains.

---

## 5. Nuanced Combat & Keyword Interactions

- **Deathtouch + Trample (CR 702.2 & 702.19):** An attacking creature with deathtouch and trample only needs to assign 1 point of combat damage to each blocking creature to constitute lethal damage. All remaining damage tramples over to the defending player or planeswalker.
- **Double Strike + Trample (CR 702.4 & 702.19):** If all blockers are destroyed during the first-strike combat damage step, the attacker assigns all of its regular combat damage directly to the defending player.
- **Ward (CR 702.21):** Ward is a triggered ability that triggers when the permanent becomes the target of an opponent's spell or ability. If the ward cost is not paid upon resolution of the trigger, the spell/ability is countered.
- **Hexproof vs Shroud vs Protection:**
  - *Hexproof:* Cannot be the target of spells or abilities controlled by opponents.
  - *Shroud:* Cannot be the target of spells or abilities controlled by any player (including its controller).
  - *Protection (DEBT):* Cannot be **D**amaged, **E**nchanted/Equipped, **B**locked, or **T**argeted by sources of the stated quality.

---

## 6. Major Historical Errata & Rule Shifts

- **Companion Rule (June 2020 Errata):** A player may pay `{3}` at sorcery speed to put their companion from outside the game into their hand before casting it.
- **Planeswalker Redirection Rule (Dominaria 2018):** Noncombat damage to opponents no longer redirects to planeswalkers. Spells now explicitly specify "any target", "target player or planeswalker", etc.
- **"Dies" Definition:** "Dies" means "is put into a graveyard from the battlefield." Tokens do die and trigger death abilities before ceasing to exist in the graveyard as an SBA.
- **Phasing (CR 702.26):** Phasing out does NOT cause a permanent to leave the battlefield (no LTB triggers). Phased-out permanents are treated as though they do not exist until their controller's next untap step, where they phase in with all attached Auras and Equipment intact.
- **Mana Burn Removal (M10 Rules Update):** Unused mana at the end of phases empties without causing damage.
