# Analyzing a homebrew casting mechanism

Background

I'm a DM and setting builder working on creating a new homebrew set of classes/subclasses for my world.

The basic in-universe mechanic is that the caster is channeling their energy through runes that he or she has carved into a focus (usually a staff). These runes are unstable (for various setting reasons), and so have a tendency to "burn out" and need to be reworked.

Runecasting is mostly elemental and/or buffing.

Casting Mechanic: Runecasting As a runecaster you have only one spell slot of each level of spells you can cast, but can attempt to cast without spending a slot by making a special check. If the check fails, no more spells of that level can be cast until you finish a long rest (fictionally the runes have failed and need to be reworked). Only spells learned via the Runecasting feature can be cast this way.

The first time you attempt to cast a spell without using a slot, roll a d20. If the result is higher than twice the spell level, you succeed and the spell takes effect as normal. If you fail, the spell does not take effect and you cannot attempt the check again for a spell of that level until you finish a long rest. For each additional attempt after the first for that same level of spells, the die rolled decreases by one size (d20 → d12 → d10 → d8 → d6 → d4), to a minimum of a d4. The die resets to a d20 after you finish a long rest.

Question What is the expected value for the number of times a hypothetical full-casting (spell levels 1-9, so level 17+) rune caster can cast each level of spells? Is there a simple formula for this?

• Just to confirm, do you really mean "higher than the twice the spell level" or "at least twice the spell level"? And does a successful d4 roll mean the caster will keep rolling more d4's? (That can only happen for 1st level spells, or for 2nd level if you mean "at least".) And are you looking for the expected number of successful castings, or the expected number of possible attempts (which, of course, is one higher)? Aug 29 at 20:19
• As written, higher than 2*L (strictly). And yes, 1st level spells could (in principle) end up with an infinite number of castings. And number of successes (effectively the number of "spell slots" such a character would have). But the answers below seem to get a satisfactory answer, and even better happen to agree despite slightly different approaches. Aug 29 at 20:38
• Note that as written, the average number of spell slots you have of a given level is always fixed, which is a departure from the standard rules in which you gain additional slots of a given level as you gain character levels. Aug 30 at 13:00
• An important concern for balancing: what happens if the check fails? Does the caster waste their action trying to cast the spell, or can they try casting another one instead? (Not relevant to this question specifically, but something you should consider.) Aug 30 at 13:04
• I'm actually planning to scrap this mechanism entirely based on the math provided in the answers. Too much effort to balance properly (and fun-ly) for too little gain. Aug 31 at 16:15

## There isn't a simple formula which covers all the cases, but they can be calculated

Expected number of successes before failure for spell levels 1-9:

1. $$\4.3 =\frac{43}{10} = 1 + \frac{18}{20} + \left(\frac{18}{20} \times \frac{10}{12}\right) + \left(\frac{18}{20} \times \frac{10}{12} \times \frac{8}{10} \right)+ \left(\frac{18}{20} \times \frac{10}{12} \times \frac{8}{10} \times \frac{6}{8}\right) +\left( \frac{18}{20} \times \frac{10}{12} \times \frac{8}{10} \times \frac{6}{8} \times \frac{4}{6}\right) + \left(\frac{18}{20} \times \frac{10}{12} \times \frac{8}{10} \times \frac{6}{8} \times \frac{4}{6} \times \frac{2}{4}\right) + ...\$$
2. $$\2.8667 \approx \frac{43}{15} = 1 + \frac{16}{20} + \left(\frac{16}{20} \times \frac{8}{12}\right) + \left(\frac{16}{20} \times \frac{8}{12} \times \frac{6}{10}\right) + \left(\frac{16}{20} \times \frac{8}{12} \times \frac{6}{10} \times \frac{4}{8}\right) + \left(\frac{16}{20} \times \frac{8}{12} \times \frac{6}{10} \times \frac{4}{8} \times \frac{2}{6}\right)\$$
3. $$\2.225 = \frac{89}{40} = 1 + \frac{14}{20} +\left( \frac{14}{20} \times \frac{6}{12} \right)+\left( \frac{14}{20} \times \frac{6}{12} \times \frac{4}{10}\right) +\left( \frac{14}{20} \times \frac{6}{12} \times \frac{4}{10} \times \frac{2}{8}\right)\$$
4. $$\1.84 = \frac{46}{25} = 1 + \frac{12}{20} + \left(\frac{12}{20} \times \frac{4}{12}\right) + \left(\frac{12}{20} \times \frac{4}{12} \times \frac{2}{10}\right)\$$
5. $$\1.5833 \approx \frac{19}{12} = 1 + \frac{10}{20} + \left(\frac{10}{20} \times \frac{2}{12}\right)\$$
6. $$\1.4 = \frac{7}{5} = 1 + \frac{8}{20}\$$
7. $$\1.3 = \frac{13}{10} = 1 + \frac{6}{20}\$$
8. $$\1.2 = \frac{6}{5} = 1 + \frac{4}{20}\$$
9. $$\1.1 =\frac{11}{10} = 1 + \frac{2}{20}\$$

1st level spells is the only case which could potentially go infinite (but the expected total number of successes converges to 4.3), but everything else automatically fails on the d4 because you can't roll higher than twice the spell level.

6th level spells and higher are easy to calculate because they will never succeed on anything other than the d20 throw.

The nth summand in each calculation is the probability of succeeding n times; since each success contributes 1 more to the total, we can sum all these probabilities to obtain the expected number of total successes. (Noting that for level 1 spells this is an infinite sum).

• This matches my intuition (roughly), but a question about methodology: Is the contribution to the overall for a given die size (other than 1st level) (n)*(1-2*L/D), where n is the attempt number (1 for d20, 2 for d12, etc), L is the spell level, and D is the number of sides on the die)? Aug 29 at 18:49
• on the back of an envelope... e.g. 4th level; there is a 12/20 chance it works the first time; then a 12/20 * 4/12 chance it works twice; then a 12/20 * 4/12 * 2/10 chance it works 3 times... and after that you are multiplying by 0. The expected number of successes is the sum of these probabilities. Aug 29 at 18:52
• Btw, we have MathJax support (guide if needed) which would probably help the parsability of the maths here a fair bit. Aug 29 at 19:49
• @Someone_Evil - that's useful advice! Updated Aug 29 at 20:17
• So, in short, this form of casting is bad at low levels, and good at high levels, because you get fewer low-level spells and more high-level spells? Aug 31 at 6:27

## The expected rate is low. Very low.

For spells of level 6 or higher, the caster will have at most two successful casting. The DC is 12 to 18 and success requires rolling above the DC, so a die of d12 or lower will automatically fail.
For spell level 5, the caster will have at most three successful castings (d20 and d12).
Level 4 has at most four successful castings (d20, d12, d10).
Level 3 has at most five successful castings.
Level 2 has at most six successful castings.
And level 1 could, hypothetically have an infinite number of successful castings; though that requires a ridiculous number of consecutive 3+ on a d4.

## There is no simple formula.

This problem has multiple variables across iterative calculations. Those formulae are never simple. So the basic structure is: $$1 + Chance[n] + (Chance[n]*Chance[n_1]) + (Chance[n]*Chance[n_1]*Chance[n_2]) + ...$$

• Level 9 has a 2/20 chance of one success (10%) and no chance of further success. 1.1 uses per day.
• Level 8 has a 4/20 chance of one success (20%) and no chance of further success. 1.2 uses per day.
• Level 7 has a 6/20 chance of one success (30%) and no chance of further success. 1.3 uses per day.
• Level 6 has a 8/20 chance of one success (40%) and no chance of further success. 1.4 uses per day.
• Level 5 has a 10/20 chance of one success (50%), a 2/12 chance of a second success (16.667%), and no chance of further success. That works out to 1.5833 level 5 spells per day (0.5 + (0.5*).166666).
• Level 4 has a 12/20 chance of one success (60%), a 4/12 chance of a second success (33.33%), a 2/10 chance of a third success (20%), and no chance of further success. That works out to 1.84 level 4 spells per day.
• Level 3 has 70%, 50%, 40%, 25%, 0%. That works out to 2.225 level 3 spells per day.
• Level 2 has 80%, 66.667%, 60%, 50%, 33.333%, 0%. That works out to 2.8667 level 2 spells per day.
• Level 1 has 90%, 83.333%, 80%, 75%, 66.667%, 50%, 50%, 50%, etc. That works out to about 4.333 level 1 spells per day.

## Conclusion

This systems is an overall drop in power after second class level. A pretty big one, since spells of level 4 or higher are not able to be reliably cast more than once each day.
The complete lack of scaling with class or character level is also going to be an issue for a lot of players (using the players I know as a sample).
The complete lack of scaling with level is also going to make this too powerful for the first few levels. No first level character can expect to have 3 or 4 first level spell slots per day, but this 'runecaster' can expect just that.

• Nice answer; and I'm relieved to see that our calculations agree for almost everything; for the Level 1 spells I made it 0.9 + 0.75 + 0.6 + 0.45 + 0.3(1+1/2+1/4+1/8+1/16+...) - where the bit in the brackets sums to 2 and the whole thing sums to 3.3. Aug 29 at 19:33

Let $$\p_i\$$ be the probability of the $$\i\$$-th check succeeding, and let $$\N\$$ be a random variable describing the number of successful casting attempts. Then the probability of successfully casting the spell at least $$\k\$$ times is: $$\mathrm P(N ≥ k) = p_1 \times p_2 \times \cdots \times p_k = \prod_{i=1}^k p_i,$$ where the $$\\Pi\$$ symbol denotes multiplying together $$\p_i\$$ for values of all $$\i\$$ from $$\1\$$ to $$\k\$$.

Knowing these probabilities for all $$\k\$$ is enough to fully characterize the distribution of $$\N\$$. In particular, it lets us calculate the probability of successfully casting the spell exactly $$\k\$$ times: $$\mathrm P(N = k) = \mathrm P(N ≥ k) - \mathrm P(N ≥ k+1) = (1-p_{k+1}) \prod_{i=1}^k p_i.$$ (This should make sense when you think about it: it's just the probability of succeeding on the first $$\k\$$ checks and the failing the next one.)

In particular, we can also calculate the expected number of successful casts using either of the following formulas: \begin{aligned} \mathbb E(N) &= \sum_{k=1}^\infty k \times \mathrm P(N = k) \\ \mathbb E(N) &= \sum_{k=1}^\infty P(N ≥ k) \end{aligned}

These formulas can be fairly easily applied by hand: first calculate a table of the single-roll success probabilities $$\p_i\$$, keeping in mind the changing die size. Then compile another table of the cumulative probabilities $$\\mathrm P(N ≥ k)\$$ of succeeding on the first $$\k\$$ rolls (i.e. the product of the first $$\k\$$ items in the first table), and finally sum the numbers in the second table to obtain the expectation value $$\\mathbb E(N)\$$.

Or you can just make a spreadsheet to do it for you.

(Note: the linked spreadsheet is read only. To test it for different spell levels, make a copy first.)

Alternatively, we can calculate the probabilities "backwards" using the following recurrence: \begin{aligned} N_{k-1} &= \begin{cases} 1 + N_k & \text{with probability }p_k \\ 0 & \text{with probability }1-p_k \end{cases} \\ &= \mathbf 1_{p_k} (1 + N_k),\end{aligned} where $$\N_k\$$ is a random variable denoting the number of successful casting attempts after $$\k\$$ successes, and $$\\mathbf 1_{p_k}\$$ is a random variable that equals $$\1\$$ with probability $$\p_k\$$ and $$\0\$$ otherwise.

Using this formula, it's quite easy to calculate the distribution of $$\N\$$ iteratively using AnyDice and plot the results:

DICE: {20, 12, 10, 8, 6, 4:15}

loop LEVEL over {1..9} {
SPELLS: 0
loop X over [reverse DICE] {
SPELLS: (dX > 2*LEVEL) * (1 + SPELLS)
}
output SPELLS named "spell level [LEVEL]"
}


Of course, to apply this "backwards" formula, we have to start with an approximation of $$\N_k\$$ for some sufficiently large value of $$\k\$$. The code above effectively assumes that the player will never succeed on more than fifteen d4 rolls (i.e. no more than 20 rolls total), and thus starts with $$\N_{20} = 0\$$. (You can change this limit by changing the length of the DICE array.)

For spell level 2 and above this assumption is exact (and in fact overkill), since a d4 roll is guaranteed to fail; for level 1 spells it's not, but in practice the probability of succeeding on 15 successive checks with a 50% success rate each is negligible ($$\2^{-15} ≈ 0.00003\$$), so it's a very good approximation.