Calculating attack damage in DnD 5e
Calculating damage is a common — perhaps the most common — task in analyzing builds and theorycrafting in Dungeons and Dragons. It is not an easy one, however. Like many other concepts in DnD, damage comes at the whims of dice. For this reason, damage cannot be effective described as a single number, but rather as a distribution of possible values. On top of that, there are a number of rules and spell-specific effects that must be accounted for when determining the range of outcomes.
In this post we’ll lay out the general framework of the damage distribution and calculate it for a basic attack roll.
Describing damage as a probability distribution
When a character attacks or casts a spell there are typically two steps that occur: 1) a roll by either the player or the DM to determine the degree to which the target is affected and 2) a subsequent damage roll that determines how much damage is taken by the target. There is randomness at every step of this process so we can best represent its outcome as a probability distribution , which is the probability that an attack does damage.
Let’s think about how we can compute this for a standard attack roll. We start by recognizing that a target can be affected by an attack in three ways: a miss, a normal hit, or a critical hit. A miss deals no damage, a normal hit will deal damage as written in the ability block, and a critical hit deals damage but with double the number of dice rolled. These three possibilities can be represented by breaking down our damage into conditional components:
Where . The above expression states that the probability that damage is done is the weighted sum of doing that damage under each of our three hit types. By breaking it down like this, we can directly compute by first looking at the hit probabilities, , and conditional damage distributions, .
It’s not too hard to see that this general formula can represent other damage processes. For a spell with a saving throw we could have . From there, it comes down to defining the conditional damage distributions.
The hit probabilities of an attack roll
The first step of computing our attack damage distribution is calculating the hit probabilities . We will only concern ourselves with a standard roll, no advantage or disadvantage. Their effects could be explored with the appropriate substitution of probabilities given by advantage or disadvantage rules, and following the structure of the rest of this post.
We’ll start with a critical hit. The rules state a critical hit occurs when rolling a 20 on an attack roll. For a standard attack roll, this is simply:
Next, we examine the probability of a normal hit, i.e. a roll that meets or exceeds a target’s AC after bonuses but is neither a critical hit or a critical fail (which guarantees a miss). To do this, we must reach back to our previous post on dice rolls probabilities.
We introduce two new parameters: a target roll, , and a bonus to add to the roll, . In an attack roll, is typically the target’s armor class. The parameter is usually a combination of a proficiency bonus and a stat modifier.
As an example, suppose a fighter with a +5 to hit attempts to strike a Goblin with AC 15, then and .
If is the outcome of our attack roll, then we can write:
Using our dice roll probabilities, we can write this as:
The above expression describes the probability that a roll meets or exceeds the target after bonuses, while excluding critical hits and failures.
The last category to look at is the probability of a miss. We could calculate it directly as before, but it’s easier to just derive the result using the complement:
Then we can write:
With this, we fully describe the probability of an attack hitting when accounting for the target’s AC and the attacker’s bonuses. From here, we turn our attention to the conditional damage distributions.
Damage conditional on the attack roll
The damage distributions themselves are determined by the specific attack type or spell being used, but most follow a pattern — the total damage is determined by the sum of rolling one or more dice and adding a bonus. We will write to represent the random variable of a sum of -sided dice and will be the damage bonus added, then:
With the way we’ve written the above, we can see that our damage distribution can be written directly in terms of , which we conveniently defined in a prior post.
For our normal damage distribution, we write it out directly:
Which is the full expression of our dice roll sum distribution equal to as above.
Critical hits are a simple modification of the above, substituting , which represents doubling the number of damage dice that one rolls. This gives:
Our last distribution — damage when the attack roll is missed — is the simplest:
When an attack is missed, damage done is 0 with probability 1. Simple enough.
Complete damage distributions
We now have all the necessary components to compute in its entirety. As a reminder, for an attack roll we have:
It would be too verbose to substitute all of our values directly into this expression, but easy enough to describe the output by looking at graphs of different damage distributions. Let’s consider some examples:
Suppose Ria, a fighter, is facing down a zombie. Her attack bonus with her longsword is +5 and the zombie’s AC is 8. Ria’s longsword deals 1d8 + 3 slashing damage. What is the damage distribution of her strike?
From the prompt, we know that , , , , and . All there is to do now is plug these values into our previously described expressions. The below graph shows the probable outcomes of her strike.
It’s not exactly a bell curve to say the least. The complex behavior is the mixture of our three possible damage conditions — the single bar at 0 is the probability of missing, the mostly uniform damage from 4 to 11 is the damage from a normal hit, and the triangular distribution that lies on top of that is the critical hit damage.
The shapes and relative magnitudes depend on all the parameters present. To see just how different they can be, let’s consider another situation.
An adventuring party is going toe to toe with a large Ogre. Yar, a cleric, calls on the power of his deity to cast Inflict Wounds at 1st level. His spellcasting ability modifier is +5 and the AC of the Ogre is 11. Damage dealt on a hit is 3d10 necrotic damage. What is the damage distribution?
We approach this in a similar way to before, noting that , , , , and .
Now we see an entirely different distribution. The 0 damage possibility has risen to 25% and the bulk of the non-zero damage forms a familiar bell curve from the 3-dice sum with a long tail that represents possible crit damage.
In both of these examples, the mixture of different attack roll outcomes gives rise to non-trivial damage outcomes. Even so, the damage from an attack roll that we explored here is one of the simplest damage mechanics in 5e. Varying spell effects, different damage types, and other features all paint a rich mechanical picture. It suffices to say that we still have much to explore in this realm, but that will be for future posts.