DnD4 Attacks 4
twin strike revisited
A few months ago I posted DnD4 Attacks 3, twin strike. Yesterday I had a chat with someone who pointed out that the AnyDice code I demonstrated didn't maximize the Hunter's Quarry damage on a critical hit. So let's make a program to do just that!
We're going to use a slightly different approach this time. We'll first figure out whether and how we hit, and only later factor in the damage.
Attack
Let's start by making things descriptive and introduce variable names for the three results of an attack roll.MISS: 0 HIT: 1 CRITICALHIT: 2Now let's write a new attack function that only tells us what kind of attack result you get.
function: attack ROLL:n vs DEFENSE:n {
if ROLL = 1 { result: MISS }
if ROLL = 20 {
if ROLL + ATTACK >= DEFENSE { result: CRITICALHIT }
result: HIT
}
if ROLL + ATTACK >= DEFENSE { result: HIT }
result: MISS
}
Damage
Now let's create a function that calculates damage based on a sequence of attack results. We do this by simply adding up the appropriate damage for each individual attack. As a bonus, once we have the regular damage figured out, we introduce the opportunity to add some extra damage on top of it with another function. If there isn't any extra damage, we simply set the result of this function to zero.function: damage for ATTACKS:s {
D: 0
loop A over {1..#ATTACKS} {
if A@ATTACKS = CRITICALHIT { D: D + CRITICAL }
else if A@ATTACKS = HIT { D: D + DAMAGE }
}
result: D + [extra damage for ATTACKS]
}
function: extra damage for ATTACKS:s { result: 0 }
Hunter's Quarry
We can now replace the extra damage function with one that takes Hunter's Quarry into consideration. All we need to do is check whether there's a critical or normal hit and then supply the correct damage.function: extra damage for ATTACKS:s {
if [ATTACKS contains CRITICALHIT] {
result: [maximum of QUARRY]
}
if [ATTACKS contains HIT] { result: QUARRY }
result: 0
}
Revisited results
Now we can again check the performance of Twin Strike using various options, now correctly maximizing the Hunter's Quarry damage on a critical hit.function: twin strike {
result: [damage for 2d[attack d20 vs DEFENSE]]
}
DEFENSE: d{12..22}
QUARRY: d6
ATTACK : 4 + 2
DAMAGE : d8
CRITICAL: 8 + d8
output [twin strike] named "two Scimitars"
ATTACK : 4 + 3
DAMAGE : d8
CRITICAL: 8
output [twin strike] named "two Longswords"
ATTACK : 4 + 2
DAMAGE : d10
CRITICAL: 10
output [twin strike] named "two Battleaxes / Longbow"
Here are the normal and the at-least graphs. Compared to the previous blog post, you can see that spikes appeared.
This is because the quarry damage no longer gets spread out on a critical hit.
And here are the three feat options again, when using a longbow. This includes a fix for the critical damage of the Weapon Focus option, which I previously forgot to increase to 11.
ATTACK : 4 + 2 + 1 DAMAGE : d10 CRITICAL: 10 output [twin strike] named "Weapon Expertise" ATTACK : 4 + 2 DAMAGE : d10 + 1 CRITICAL: 11 output [twin strike] named "Weapon Focus" ATTACK : 4 + 2 DAMAGE : d10 CRITICAL: 10 QUARRY : d8 output [twin strike] named "Lethal Hunter"
Confounding Arrows
As a bonus, let's consider Confounding Arrows, with all three attacks aimed at a single target. Disregarding the daze and stun effects, the special thing of this power is that if all three attacks connect, it deals an extra +2[W]. Without this bit, the attack would be a simple adjustment of Twin Strike.ATTACK : 4 + 2 DAMAGE : d10 CRITICAL: 10 output [damage for 3d[attack d20 vs DEFENSE]] named "triple attack"(Ok, this would be a level 1 character wielding a level 15 attack, but let's not get distracted by that.)
How does the extra damage on a triple hit work in D&D, anyway? It's extra damage added to the last attack, which means it gets maximized if that attack is a critical hit. At least, that's the interpretation we'll use for this program.
So we replace the extra damage function with one that also takes Confounding Arrows into consideration. We add a check to see if there aren't any misses and whether the third attack is a critical hit, adding damage as needed.
function: extra damage for ATTACKS:s{
if [ATTACKS contains CRITICALHIT] { D: [maximum of QUARRY] }
else if [ATTACKS contains HIT] { D: QUARRY }
else { D: 0 }
if ![ATTACKS contains MISS] {
if 3@ATTACKS = CRITICALHIT { result: D + 20 }
result: D + 2d10
}
result: D
}
output [damage for 3d[attack d20 vs DEFENSE]]
named "Confounding Arrows"