DnD4 Attacks

hitting and dealing damage

Thu, 17 Jun 2010 15:00:00 +0000

How can you use AnyDice to figure out the damage per round of a D&D 4e character? Let's keep it simple and only consider a melee basic attack.

Our test character is a 1st level Fighter with a Strength of 18, wielding a bastard sword in one hand. He has a +8 attack bonus and deals 1d10 + 4 damage on a hit.

Hitting

What are the odds of our Fighter landing a blow, let's say against AC 15? If we use 0 to represent a miss and 1 to represent a hit, we could use a simple comparison.
output d20 + 8 >= 15
However, this is a bit too simplistic, because it ignores automatic hits and misses, as well as critical hits. So we need to both look at the raw d20 roll and compare the modified roll to the AC. We can do this by creating a function. Also, let's use 2 to represent a critical hit.
function: ROLL:n with ATTACKBONUS:n vs DEFENSE:n {
 if ROLL = 1 { result: 0 }
 if ROLL = 20 {
  if ROLL + ATTACKBONUS >= DEFENSE { result: 2 }
  result: 1
 }
 result: ROLL + ATTACKBONUS >= DEFENSE
}

output [d20 with +8 vs 15]
To see how our Fighter fares against various different ACs, we can simply output the calculation multiple times for different ACs. The transposed graph is a useful display for this specific comparison.
loop AC over {5..30} {
 output [d20 with +8 vs AC] named "[AC]"
}

Alternatively, you can compute the average hit chance for a range of ACs in one go. Effectively, you're rolling a die to determine the AC for each attack.

output [d20 with +8 vs d{5..30}] named "average chances"
This demonstrates that if our Fighter were to encounter lots of enemies with an AC uniformly spread between 5 and 30, he would hit 55.19% of the time, of which 4.62% would be critical hits. Of course this is a rather ridiculous AC range, but it serves to illustrate that automatic hits and misses are taken into consideration.

Dealing damage

Now that we know the chances to hit, it's time to add the damage. We do this by altering our function to produce damage values instead of just success indicators.
function: ROLL:n with ATTACKBONUS:n for DAMAGE vs DEFENSE:n {
 if ROLL = 1 { result: 0 }
 if ROLL = 20 {
  if ROLL + ATTACKBONUS >= DEFENSE { result: [maximum of DAMAGE] }
  result: DAMAGE
 }
 result: (ROLL + ATTACKBONUS >= DEFENSE) * DAMAGE
}

loop AC over {10, 20, 30} {
 output [d20 with +8 for d10 + 4 vs AC] named "[AC]"
}

Once again, we can compute the average damage for a range of ACs in one go.

output [d20 with +8 for d10 + 4 vs d{10..30}] named "average damage"
This tells us that our Fighter deals 4.55 damage per attack on average, given an AC range of 10–30.

Further work

Using the function we have created, it is possible to compare the damage output of various configurations. However, it does not yet include support for extra critical damage or miss damage. I'll write about that in a future post.
comments are closed