dnd-5e-cr-calculator
An npm module that calculates Challenge Rating for Dungeons & Dragons 5th Edition.
How to Use
The main function of the CR Calculator is is calculate()
and it takes five arguments: Hit Points, Armor Class, Damage per Round, Attack Bonus, and Save DC. It uses the arguments to calculate the monster's Challenge Rating as described in the Dungeons & Dragons 5th Edition Dungeon Master's Guide.
// An examplevar cr = ; // Arguments in order: HP, AC, DpR, Atk, Save DCvar value = cr; // value should equal '1'console;
Alternatively, you can use the calculateWithDice()
to enter Damage per Round in the dice string format used in the D&D sourcebooks. When this function is used, the Damage per Round is calculated as an average of the dice formula provided. This is then provided to the calculate()
function to return the CR value.
// An example of calculateWithDice()var cr = ; // Arguments: HP, AC, DpR in dice format, Atk, Save DCvar value = cr // value should equal '1' because '7d6+5' averages to 30console;
How to Run
The D&D 5e CR Calculator is written in Coffeescript, and the package.json
contains scripts for compiling the Coffeescript and running tests locally. To get the project up and running locally is very simple:
git clone
npm install
npm run compile
Also, running the tests is as simple as npm run test
or npm run test:watch
.
Licensing
The dnd-5e-cr-calculator
package is released under the MIT license.
Acknowledgements
Dungeons & Dragons is property of Wizards of the Coast.