The intricacies of the Stack came up yesterday again in our EDH games. To me its natural, but that’s probably because it was actually a big part of my education. However, since not everyone has a master’s degree in software engineering, I think this is something that needs a bit of explanation. It is probably the most difficult part of the rules that you actually need to know.
Stack isn’t something that was invented by people who were reworking the rules of Magic back in the sixth edition. Its actually a mathematical construct that has a wide application in software engineering and other disciplines.
We all know and understand what a queue is. People get in line and the one who was there first, gets out of it first too.
You have two functions: Enqueue (put things to the end of the line) and dequeue (let the first thing in the line out). There is no limit on which order these need to happen, except that dequeueing is unnecessary if the queue is empty.
The stack is pretty much the same thing, with one major difference: Whereas queue is a FIFO construct (First In First Out), stack is LIFO (Last In First Out).
Now instead of enqueue and dequeue, you now have push and pop. Instead of working with different ends of the construct, they now both work with the same end. Again, there is no limitation on the order of these two functions, except that you can’t pop from an empty stack.
So, what does this mean for Magic.
When you activate or trigger an ability, or cast a spell, it goes on the stack. Some actions are special, and don’t use the stack (such playing lands or turning morphs face up), but most of the time you’ll be pushing things on the stack. Most of the time it doesn’t really affect things, but every once in a while (especially in older formats) you need to understand how this works in order to make the correct decisions.
Take this for example:
Your opponent casts a [scryfall]Tarmogoyf[/scryfall] and has two untapped lands. You cast a [scryfall]Mana Leak[/scryfall] to counter it, leaving you with four mana open. Your opponent casts a [scryfall]Spell Snare[/scryfall] targetting your [scryfall]Mana Leak[/scryfall]. You have a [scryfall]Remand[/scryfall] as the last card in your hand. Now, all of the previous cards are still on the stack and you can target any of them. Depending on the situation, you could actually want to [scryfall]Remand[/scryfall] any of them, but in this case, you decide to use it on your own [scryfall]Mana Leak[/scryfall], netting you a card and letting you use it again on the [scryfall]Tarmogoyf[/scryfall].
Here there is a stack. Your usual, immediate reaction would be to counter the last card on the stack, but that would be clearly wrong. Your opponent would get the [scryfall]Spell Snare[/scryfall] back and be able to cast it again. Unless you have a deeper goal in mind, that wouldn’t work out very well for you.
Here’s another, where understanding the stack really helps you.
Sidisi has two abilities and although they are thematically linked, they are not linked ruleswise. So, lets take a look at this:
Your opponent cast Sidisi and it resolves. Once it resolves, the first ability goes on the stack. Now, you have an opportunity to respond. If you kill Sidisi now, the second ability will not have an opportunity to trigger. The first ability will still resolve and the player will put cards from his or her library into his or graveyard, but there won’t be any zombies.
I still see people playing this poorly at very high levels of play. They don’t see that those are actually two separate abilities and they wait before killing the Sidisi.
So, when do you get to play stuff? This is where priority comes in.
You can cast spells and activate abilities when you have the priority. Any time a new step or a phase starts, you first do all the things you do in that step (draw cards, declare attackers, deal damage and so forth) and then the player whose turn it is gets the priority. With the priority, you can put things on the stack. If something happened that put effects into the stack, those are put in the stack first. The order here is APNAP or Active Player, Not Active Player. In a multiplayer game, this moves to the left.
Also, every time something resolves, you go through this again (like with Sidisi above).
After you have stuff on the stack, the active player can put more stuff on it by casting instants or activating abilities. If the active player chooses not to, the priority is passed. After each player has passed priority after the stack last changed, the top spell or effect on the stack resolves. After that, priority goes back to the active player and the same priority passing starts again.
Most of this is convention. If you cast a spell and don’t say you keep priority, you are assumed to have passed it. Especially in multiplayer games, most of the priority stuff is just assumed to happen. People will jump the queue, but its best for everyone to keep it all flowing smoothly.
Sorceries and other spells or effects that work at sorcery speed (most permanents) can only be cast when the stack is empty and you have priority (and its your turn). Lands can only be played when the stack is empty and you have priority, but playing a land doesn’t use a stack and you don’t need to pass priority for it to happen. Morphs can be turned face up any time you have priority, but it doesn’t use the stack either and you don’t pass priority, although if turning a card face up has its own effect (like [scryfall]Pine Walker[/scryfall] for example), that goes onto the stack and you have to pass priority for it to resolve.
All in all, this is a complex game and the stack is one of the more complicated things most players will encounter. In my experience, quite a few will not even dabble and will lose games because of that. Hopefully this explained a few things.