npm.io
4.0.0 • Published 2 years ago

chromatic-orb

Licence
MIT
Version
4.0.0
Deps
2
Size
33 kB
Vulns
0
Weekly
16
Stars
3

chromatic-orb

Calculate odds of rolling desired socket colors with a chromatic orb. Formula is based on Siveran's calculator, which is based on Lawphill's calculator. Results are not guaranteed to be completely accurate.

Example

For example, let's say you want to find out the chances of rolling 5 red sockets and 1 green socket on a piece of armor that requires 180 strength to wield:

var chromatic = require('chromatic-orb');

var chance = chromatic({
  sockets: 6,
  red: 5,
  green: 1,
  strength: 180
}));
// => 0.23161598136624462

That's a 23% chance of success! From here, we can also find out the average number of chromatic orbs one would have to spend:

1 / chance;
// => 4.3

So on average it will take you 4-5 chromatic orbs to roll such sockets. Note that you can also calculate standard deviation yourself:

Math.sqrt((1 - chance) / Math.pow(chance, 2));
// => 3.78

Installation

$ npm install chromatic-orb

API

var chromatic = require('chromatic-orb');
chromatic(opts)

Same API as socket-colors-chance.