The Monkey House

< Gaming : Dungeons and Dragons : Math : How >

The javascript calculator code is fairly simple. It contains a function, AvgDamWithAC, which calculates the expected result of rolling A B-sided dice plus C, assuming you need to roll a D on a d20 (with 1 being auto-miss and 20 being auto-hit) to do damage. Feel free to use it for your own purposes. You could even give those arguments sensible names!

The powerattack function, stripped of the input and output code, simply loops through all possible amounts by which you could power attack (0 through PA_max, in steps of size PAcostdiv). At each loop iteration, it computes the expected average over all attacks defined in the group, and keeps track of which loop iteration produced the best result. There's really no finesse there. Given how small the loop variables will be, there's no need for elegance.

Version unknown    |    Content date: unknown    |    Page last generated: 2008-06-30 21:19 CDT