Damage in Magic is more complicated than it may seem at first glance. In this article, I'm going to break it down into 6 simple steps to follow.
Disclaimer: This is a more advanced article intended for people who are already familiar with the basics of Magic. It assumes that you know things like the steps of the combat phase and how to handle replacement effects.
The first two steps are a little different, as they only apply to combat damage. They're technically turn-based actions of the combat phase and aren't a part of processing damage itself at all, but I want to cover them too because they're often overlooked or misunderstood.
This happens right after blockers have been declared in combat. If any attackers are being blocked by multiple creatures, the attacking player chooses an order for those creatures. Then the defending player does the same for any creatures that are blocking multiple creatures. This order is specific to the creature it's for, and doesn't affect other creatures.
For example, if Bear Cub and Glory Seeker are attacking and they're both blocked by a Hundred-Handed One and Coastline Chimera, the attacking player chooses an order for Bear Cub and an order for Glory Seeker. The order need not be the same for both creatures. You can think of it as each attacking creature looking at what's blocking it and writing down a list of them in a certain order.
Once the combat damage step is entered, damage must be assigned. This is a distinct process from damage being dealt, which only happens later. Damage assignation is simply a way to say "ok, this amount of damage is going to be dealt to this creature, this amount to that creature, etc". Damage is assigned simultaniously for all attacking creatures first, and then for all blocking creatures. (In turn order if there are multiple blocking players.)
When announcing where a creature's damage is being dealt, it must obey that creature's damage assignment order. If a creature earlier in the order hasn't been assigned lethal damage, then the attacker's damage can't be assigned to a later creature. So if a 3/3 attacks and is blocked by a 4/4 and a 2/2, and the 3/3's damage assignment order was "the 4/4 first, then the 2/2", when it comes time to assign damage, all 3 damage must be assigned to the 4/4.
Deathtouch on a creature means that any amount of damage it's assigning is considered to be lethal. Trample on an attacking creature simply means that the player or planeswalker it's attacking is considered to be last in the damage assignment order.
Other damage being assigned at the same time is taken into account for this process. If a 1/1 with deathtouch and a 3/3 with trample are attacking and were both blocked by a 4/4, the 1/1 can assign its damage to the 4/4, and since that's lethal, the 3/3 can assign all of its damage to the defending player.
Now we get into handling the damage itself. These next four steps apply to any damage being dealt, regardless of whether it's combat damage or not. An attacking creature dealing damage functions the same way here as a Lightning Bolt. These steps are squential in terms of how they're handled by the game, but they're simultanious in time as the game progresses. Everything that happens as a result of one of these steps happens at the same time.
Some effects that deal damage say that "excess" damage is dealt to another object or player. This is basically "spell trample". In order to calculate excess damage, we look at the toughness of the creature in question, minus any damage that's marked on it and any other damage being dealt to it at the same time. If there is any excess damage, the damage event changes to deal that damage to a different object or player. This step is very similar to step 0.2, but it applies only to noncombat damage. Just like with trample, replacement effects that change the amount of damage being dealt are not taken into account here.
Once we know what the original damage event is, we need to handle any replacement and prevention effects that apply to it. Only effects that directly apply to "damage" are considered here. Other effects that apply to what the damage is doing to what it's being dealt to are considered in step 3. Replacement and prevention effects are handled in the normal method, where the controller of the affected object chooses in what order to apply them. Anything that triggers due to damage being dealt triggers at this point, once the amounts of damage being dealt have been "locked in".
Once we know how much damage is being dealt and to what, it's time to figure out what result that damage is going to have. Damage can have one or more different results, depending on what is being dealt damage and what abilities or effects are applying to the damage. The full list of default results is as follows:
Other cards can modify these results. In order to figure out what the final outcome is going to be, we first consider what the default results would be. Then we apply any effects that say damage is dealt "as though" a condition is true. Then we look at effects that say something can't happen. Lastly we apply any appropriate replacement effects that apply to the result of the damage. (Again, in the order of the affected player's choice.) Note that just like with all replacement effects, choosing an order for them is simply determining what the future event is going to be, it hasn't actually happened yet.
Now that we've figured out exactly what's going to happen, it's time to actually do it. All results of the damage, along with any events that replaced them, happen simultaniously.
Well that's great and all, but what does all that text actually mean? Let's look at some examples and walk through them step by step.
Andy controls Furnace of Rath and attacks with a 3/3 with trample. Nancy blocks with a 2/2 that has protection from creatures. How much damage is dealt to Nancy?
In step 0.2, Andy chooses how to assign damage. There are 3 points of damage to be assigned, and at least 2 of them have to be assigned to the blocking creature in order to be lethal damage. The last point can eiher be assigned to the 2/2 blocker or to Nancy. Let's assume that Andy chooses to assign 2 to the blocker and 1 to Nancy.
At this point the original damage event has been determined as "2 damage is being dealt to the 2/2, 1 damage is being dealt to Nancy". In step 2, replacement and prevention effects are applied. Since Nancy's creature is being dealt the damage, she can choose which one to apply to it first. If she applies Furnace of Rath's effect first, the event becomes "4 damage is being dealt to the 2/2". Then protection's prevention effect would apply and prevent the 4 damage that's being dealt to the blocker. If on the other hand Nancy chooses to apply protection first, the event becomes "2 damage is prevented to the blocker". Since no damage is being dealt to it anymore, Furnace of Rath's effect doesn't apply. There's only one replacement effect applying to Nancy, so that's applied and the event becomes "2 damage is dealt to Nancy".
Now it's time for step 3. The 2 damage that's being dealt to Nancy turns into Nancy losing 2 life. The blocker isn't being dealt any damage, so nothing happens to it.
Finally, this all actually happens. The attacking creature deals 2 damage to Nancy and Nancy loses 2 life, simultaniously.
Norman controls Phyrexian Unlife and has 0 life. Alex casts Lightning Bolt targeting Norman. In response, Norman casts Angel's Grace. What happens?
In step 2, there are no replacement effects to be applied.
In step 3, the damage would by default make Norman lose 3 life. However Phyrexian Unlife says that the damage is dealt as though its souce had infect, which means that Norman would be getting 3 poison counters. Since this damage would not reduce Norman's life total to less than 1 (it wouldn't be reducing it at all), Angel's Grace's replacement effect doesn't apply.
Amanda attacks with a 5/5 with trample and a 3/3 with no abilities. Nemo blocks the 3/3 with Dralnu, Lich Lord and blocks the 5/5 with Darien, King of Kjeldor. Nemo currently has 2 life and also controls Worship and Vilis, Broker of Blood. (And controls nothing else.) Assuming Amanda has as much damage as possible trample over to Nemo and that Nemo only wants to sacrifice creatures to Dralnu, what is Nemo's resulting life total, how many tokens does he create, and how many cards does he draw?
In step 0.2, Amanda assigns 3 damage to Dralnu, 3 damage to Darien, and 2 damage to Nemo. The damage event starting out is "3 damage to Dralnu, 3 damage to Darien, and 2 damage to Nemo".
In step 2, there is one replacement effect to be applied- Dralnu's. Nemo chooses to sacrifice Dralnu, Darien, and Vilis to it. The event becomes "Nemo sacrifices Dralnu, Darien, and Vilis, 3 damage is dealt to Darien, and 2 damage is dealt to Nemo". Since the amount and recipients of damage have now been determined, Darien triggers at this time.
In step 3, we begin to process the damage into its results. 3 damage is being dealt to Darien and 2 to Nemo, so the default results are that Darien has 3 damage marked on it and Nemo loses 2 life. However Worship has a replacement effect that replaces Nemo losing 2 life with Nemo losing 1 life.
Finally, the event occurs. Nemo simultaniously loses 1 life and sacrifices Dralnu, Darien, and Vilis. (And marks 3 damage on Darien, but who cares- it's dead anyway.) Vilis's trigger is checked immediatetly afterwords, but Vilis is in the graveyard by then, so it doesn't trigger. Darien's trigger to creature two tokens will be put onto the stack once the players get priority.
And that's about it! Figuring out what happens as damage is dealt can be complicated sometimes, but if you walk though it step by step, you'll get to the right answer. If you want to test your skills with some more practice questions on damage, click here!