0

No votes yet

Submitted by:

Submitted by palswim on 2018-04-02 21:03.

Last modified:

2018-04-05 00:05

Hopefully I haven’t been duplicating work of an easily-available resource, but I have been working on a formula/algorithm to calculate the average damage for a particular weapon. Though I developed this initially for Neverwinter Nights, theoretically, this should work for any DND-like dice game (e.g. Knights of the Old Republic).

As I have found, this calculation depends on several factors, and doesn’t follow easy linear trajectories. Obviously, the average value of a 2D6 roll is 7, but that calculation does not consider things like criticals, damage reduction, or hit chance.

In summary, the algorithm follows these steps:

- Calculate the relative probabilities for each roll value. For example, the relative frequency of each result for 2D6:

To calculate this in a generic fashion, you must perform polynomial expansion to the degree of the number of dice to roll.Value 2 3 4 5 6 7 8 9 10 11 12 Probability 1 2 3 4 5 6 5 4 3 2 1 - For each possible value of the dice roll, you must then calculate the eventual damage of both a hit and a critical hit, ensuring that you include the damage bonuses in the critical hit calculation, but not the damage reduction, which should come after the critical hit multiplier. Currently, my algorithm does not handle dice rolls in the Massive Critical calculation since we’d probably have to perform another polynomial expansion. It only handles a static Massive Critical value. For overall values where the damage reduction causes the sum to total a value less than zero, treat the value as zero.
- Also calculate the hit chance for non-critical hits and the hit chance for critical hits, and then multiply those values against the damage values for the hit and critical hit, respectively.
- Under normal rules, a D20 attack roll of 1 always misses, and a roll of 20 always hits and always hits critically.

- Also calculate the hit chance for non-critical hits and the hit chance for critical hits, and then multiply those values against the damage values for the hit and critical hit, respectively.
- Add the expected damage results (non-critical hit chance * non-critical hit damage + critical hit chance * critical hit damage) for each value of the dice roll, then divide by the total number of outcomes for the dice roll (e.g. 2D6 has 36 possible outcomes).

So, in conclusion, the answer to which weapon produces the most damage is obviously “it depends”.

Files:

Attachment | Size |
---|---|

Version 1.0.0 (24) | 13.73 KB |

Version 1.0.1 (7) | 14.28 KB |

Permissions & licensing:

I purposefully didn’t include additional damage of other types (e.g. +1D6 Fire Damage), since those essentially require their own calculation with this algorithm, with different types of damage having potentially different resistance values for each enemy. So, you’d just add the algorithm’s value for normal damage to the algorithm’s value for these other types of damage.

Also, I didn’t include support yet for multiple attacks to calculate damage per round, but to calculate, just add the results of this algorithm for each attack according to the attack bonus for each attack.