Home

Intro

If you spot any corrections or have an idea for improving this calculator, please feel free to submit an issue or pull request to the GitHub repo for this site, https://github.com/dguenther/spyke.

About the math

This calculator operates under a few assumptions:

Bearing this in mind, we have a few different probabilities to find, depending on how many slots we want. We will define n as the number of subabilities we're looking for.

We also need to define r as the number of possibilities in a particular slot. For gear with even odds, there are 13 subabilities weighted evenly, so r = 13. For gear with uneven odds, we have 11 evenly weighted subabilities, 1 5x weighted subability, and 1 half-weighted subability: 11 + 5 + 1/2 = 16.5. However, since we're going to be using r as a denominator later on, we don't want to deal with any fractions, so we'll multiply it by 2: r = 16.5 * 2 = 33

Let's also define a, b, c as the numerators for our probabilities. They'll represent the chance of rolling a particular subability in a slot. For even gear, a, b, c = 1. When divided by r, we can see that we have a 1 / 13 chance of rolling a particular ability in a slot. For gear with uneven odds, favored abilities a, b, c = 10, unfavored abilities a, b, c = 1, and neutral abilities a, b, c = 2.

n = 1

If we want at least one of an ability and don't care about the other two slots, it's easier to calculate the probability of not rolling that ability in any slot. Once we have that probability, we can take the complement (subtract it from 1).

p = 1 - ((r - a) / r)3

n = 2 and a and b are different

There are 6 possible rolls that could get us what we want: AB_, A_B, _AB, BA_, B_A, _BA. We know the denominator of the fraction we're solving for is r3, so let's just worry about the numerator for now. We'll make equations for each of the six possible rolls and then sum them.

So now let's sum these and simplify them down a bit:

2(a * b * r) + a * (r - b) * b + b * (r - a) * a + 2((r - a - b) * a * b)

2abr + ab(r - b) + ab(r - a) + 2ab(r - a - b)

2abr + abr - ab2 + abr - a2b + 2abr - 2a2b - 2ab2

6abr - 3ab2 - 3a2b

3ab(2r - a - b)

Nice, so the probability is p = 3ab(2r - a - b) / r3.

n = 2 and a and b are same

Unlike when a and b are different, there are only 3 possible cases: AA_, A_A, _AA. Once again, we'll find equations for the 3 possible cases:

Let's sum these and simplify them:

a2r + 2a2(r - a)

a2(r + 2(r - a)

a2(3r - 2a)

Now that we've got a simpler numerator, we can solve for the probability: p = a2(3r - 2a) / r3

n = 3

Let's define x as the number of ways we can roll a, b, c. If a, b, c, and are all different, there are 6 cases: ABC, ACB, BAC, BCA, CAB, CBA. If a and b are the same, we have 3 cases: AAC, ACA, CAA. And finally, if a, b, and c are the same, there is just one case: AAA. Notice a pattern here? x is the factorial of the number of unique subabilities.

Once we've got x, it's pretty simple: p = x * a * b * c / r3.

Expected Rolls

Expected rolls refers to the number of rolls it should take to obtain the subabilities that you want. It's pretty simple to calculate. Take a die, for example. You have a 1/6 chance of rolling each number, so you should expect to roll the die 6 times if you're looking for a particular number. You might have to roll more or less sometimes, but 6 is the average number of rolls that you'd need.

Based on that, we can say that the expected rolls are the inverse of the probability. Additionally, we'll raise the number to the next integer, since we can't have fractional rolls. expected rolls = ceil(1 / p)