The advantage of advantage
Last time we developed a tool to determine the exact damage distribution of attacks in games like Dungeons & Dragons and Pathfinder. And while a lot could be modeled with it, many mechanics were missed as well. Today, we're going to look at one specifically: Dungeons & Dragons 5th Edition's advantage system.
Having advantage on a roll with a twenty-sided die (called a ) means you roll it twice, and take the highest result (also called drop lowest), increasing your chances of success. Conversely, having disadvantages means you roll twice, and take the lowest result (also called drop highest). While most players praised the system's simplicity, some still advocated for a system where they would be replaced by a flat bonus or penalty. But can we even find a bonus and penalty that are sensible replacements?
Well that's easy, right? We just look at the expected value of rolling a with and without advantage, and add a bonus equal to the difference. The expected values turn out to be as follows (where denotes rolling with advantage):
This yields a difference of , and since fractional modifiers don't exist in Dungeons & Dragons, we simply say that advantage amounts to an effective bonus of or and we're done.
Not quite. By just looking at the expected value, we're losing something that's fundamentally different about rolling with advantage; it skews the distribution towards higher results. It turns out that depending on which target number you need to beat with your roll, having advantage is equivalent to a different bonus:
So having advantage is equivalent to up to a bonus depending on which number you are trying to beat!
But for damage rolls, even this still isn't the full picture. Advantage doesn't just make you less likely to miss, but also makes it much more likely to deal critical damage. Recall that last time we used probability generating functions to model damage distributions:
Using the same model, we can exactly account for advantage by simply appropriately changing the miss, hit, and crit probabilities , and . Afterward, we can directly compare the resulting distribution with a distribution where advantage is replaced by a flat bonus, and find the specific bonus that causes the distributions to be the most similar!
Adjusted probabilities
To determine these new probabilities, we need to consider all 400 combination of two rolls, and determine the outcome of each pair. Below are two tables where the rows and columns represent the roll outcomes of both dice, and the corresponding cell shows the final outcome. Hovering over (or, on mobile, clicking on) a cell highlights all cells with the same outcome. Can you spot how (dis)advantage affects your odds?
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
2 | 2 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
3 | 3 | 3 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
4 | 4 | 4 | 4 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
5 | 5 | 5 | 5 | 5 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
6 | 6 | 6 | 6 | 6 | 6 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 16 | 17 | 18 | 19 | 20 |
16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 17 | 18 | 19 | 20 |
17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 18 | 19 | 20 |
18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 19 | 20 |
19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 20 |
20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
2 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
3 | 1 | 2 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 |
4 | 1 | 2 | 3 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4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 | 16 | 16 | 16 |
17 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 17 | 17 | 17 |
18 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 18 | 18 |
19 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 19 |
20 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
There are multiple equivalent ways to arrive at the right formulae. One way would be to simply count the number of combinations leading to a specific outcome, and noting that it is linearly increasing for advantage, and linearly decreasing for disadvantage (with slope and respectively), and that for advantage there should be only probability of landing a , while for disadvantage this is the case for a .
Another way would be to consider that the different rolls that leads to a specific outcome can be grouped into three categories. For advantage this would be: one where the first die lands on and the second is strictly lower (there are such pairs of rolls), one where the second die lands on and the first is strictly lower (again, there are such pairs of rolls), and on where both are exactly equal to (there is only pair of rolls that leads to this). These correspond to the highlighted row, column and corner piece when hovering over a specific outcome.
Finally, you could consider that, for advantage, the number of outcomes corresponding to getting or less form a square, so there are outcomes out of to get exactly .
Each of these lines of reasoning would lead you to the following equations for the probability distributions of advantage and disadvantage on a roll:
For regular rolls, we can use d20Outcomes
to determine the miss, hit and crit probabilities. It works by simply checking each outcome, and counting them uniformly (each outcome just counts as "one"):
/**
* Determines miss, hit and crit probabilities for a regular d20 roll
*/
function d20Outcomes(totalAttackBonus, critRange, armorClass) {
let hitOutcomes = 0
let critOutcomes = 0
for(let d20Roll = 1; d20Roll <= 20; d20Roll++) {
if (d20Roll == 1) {
// Critical failure
continue
} else if (d20Roll >= critRange) {
// Critical hit
critOutcomes++
} else if (d20Roll + totalAttackBonus >= armorClass) {
// Regular hit
hitOutcomes++
}
}
return [(20-hitOutcomes-critOutcomes)/20, hitOutcomes/20, critOutcomes/20]
}
Implementing advantage and disadvantage is very straightforward: rather than counting each outcome just once, we add a bias to each outcome. Each outcome counts as many times as they occurred according to the formulae from above:
/**
* Determines miss, hit and crit probabilities for a d20 roll with advantage
*/
function d20OutcomesWithAdvantage(totalAttackBonus, critRange, armorClass) {
let hitOutcomes = 0
let critOutcomes = 0
for(let d20Roll = 1; d20Roll <= 20; d20Roll++) {
if (d20Roll == 1) {
// Critical failure
continue
} else if (d20Roll >= critRange) {
// Critical hit
critOutcomes += 2*d20Roll - 1
else if (d20Roll + totalAttackBonus >= armorClass) {
// Regular hit
hitOutcomes += 2*d20Roll - 1
}
}
return [(400-hitOutcomes-critOutcomes)/400, hitOutcomes/400, critOutcomes/400]
}
/**
* Determines miss, hit and crit probabilities for a d20 roll with disadvantage
*/
function d20OutcomesWithDisadvantage(totalAttackBonus, critRange, armorClass) {
let hitOutcomes = 0
let critOutcomes = 0
for(let d20Roll = 1; d20Roll <= 20; d20Roll++) {
if (d20Roll == 1) {
// Critical failure
continue
} else if (d20Roll >= critRange) {
// Critical hit
critOutcomes += -2*d20Roll + 41
} else if (d20Roll + totalAttackBonus >= armorClass) {
// Regular hit
hitOutcomes += -2*d20Roll + 41
}
}
return [(400-hitOutcomes-critOutcomes)/400, hitOutcomes/400, critOutcomes/400]
}
Comparing distributions
So we can now determine the damage probability of making an attack with advantage, but when can we consider another distribution to be approximately equal to it? We will consider two simple methods:
- comparison by expected value, and;
- comparison by probability.
/**
* Calculates the expected value of the given distribution
*/
function expectedValue(distribution) {
return distribution.reduce((accumulator, outcome, index) =>
accumulator + outcome*index, 0)
}
/**
* Calculates the difference in expected value between two distributions
*/
function expectationDifference(distribution1, distribution2) {
const expectedValue1 = expectedValue(distribution1)
const expectedValue2 = expectedValue(distribution2)
return expectedValue1 - expectedValue2
}
For the second comparison method, we want to find the bonus such that difference in probability of either variable being greater than the other is minimized. This can be evaluated in a single pass over the state space using probabilityDifference
, by considering each outcome of distribution1
and checking the portion of distribution2
lying above and below :
/**
* Calculates where distribution1 is more likely to be greater than distribution2 or vice versa
*/
function probabilityDifference(distribution1, distribution2) {
let difference = 0
let distribution2LessThanN = 0
let distribution2GreaterThanN = 1
zipWithDefault(distribution1, distribution2, 0).forEach(pair => {
const [p1, p2] = pair
distribution2GreaterThanN -= p2
difference += p1 * (distribution2LessThanN - distribution2GreaterThanN)
distribution2LessThanN += p2
})
return difference
}
Equivalent flat bonus calculator
Now we are finally equipped to give a conclusive answer! So, what is the bonus equivalent to advantage? As we noted before, it depends. The tool below plots the equivalent flat bonus as a function of the Armor Class of the enemy you are facing.
Interestingly, the equivalent bonus increases linearly for Armor Classes larger than . Since in those cases, you would only deal damage with a critical hit, which is a lot more likely when having advantage. Additionally, getting a higher attack bonus does not increase your chance of landing a critical hit, so the equivalent attack bonus needs to increase proportionally with the Armor Class to achieve the same effect as having advantage.
The damage distribution calculator now also supports advantage and disadvantage. 😊