Difference between revisions of "Spell Success"

From CrawlWiki
Jump to: navigation, search
m (clarified one part of the math)
Line 42: Line 42:
 
   spell skills = 50 * log_2 (1 + S_0 / 50)
 
   spell skills = 50 * log_2 (1 + S_0 / 50)
  
This value is naturally capped at 370, assuming 27 lv on spell skills and spellcasting.
+
This value (6 * spell skills) is naturally capped at 370, assuming level 27 on relevant spell skills and spellcasting.
  
 
=== Spell difficulty ===
 
=== Spell difficulty ===

Revision as of 12:27, 25 July 2015

Version 0.16: This article may not be up to date for the latest stable release of Crawl.


Spell success is the rate at which casting a spell can be expected to succeed. As of 0.16.0 spell success rate is determined by a complex combination of:

Spell success calculations

It is debatable whether the following formulae are of real use during a game. However, inflection points such when the extra armour EV penalty disappears are fairly easy to discern. Calculating this stuff on the fly is only for savants! However, one can refer example section of this page for Lv 9 magics, which requires tremendous amount of experience to be stabilized.

Base chance

The source code talks in terms of chance of failure, not success. Therefore, we want the spellFailure chance to be as low as possible - in fact, to reach a Perfect success rate, your chance to fail has to be negative. More on that below.

To begin with, there's a 60% chance of failure. From this, two things are subtracted - twice the caster's Intelligence, and a value calculated from the user's relevant skills. This value is similar to (but simpler than) the spell power. Note that these two factors are the only ones that directly improve spell success, while other factors described below only serve to mitigate spellcasting penalties. Therefore, focus on these areas if you want to maximize your spellcasting chances, particularly spell skills.

Here's an overview of the basic formula, before stepdown and miscellaneous penalties and enhancers.

 spellFailure = 60
              - [6 * spell skills]
              - [2 * Intelligence]
              + Spell difficulty
              + Armour/shield penalty

Spell skills

Now they use very familiar equation with spellcasting equation. The main difference is, spell skill boost effect of potion of brilliance is not counted here.

 S_0 = [Spellcasting / 2] + [Average(SpellSkills) * 2]
 spell skills = 50 * log_2 (1 + S_0 / 50)

This value (6 * spell skills) is naturally capped at 370, assuming level 27 on relevant spell skills and spellcasting.

Spell difficulty

A number is added, making spellcasting more difficult, dependent on the spell's level.

 spellDifficulty =   3 (level 1)
                    15 (level 2)   (+12)
                    35 (level 3)   (+20)
                    70 (level 4)   (+35)
                   100 (level 5)   (+30)
                   150 (level 6)   (+50)
                   200 (level 7)   (+50)
                   260 (level 8)   (+60)
                   330 (level 9)   (+70)

Armour and shield penalties (Under Construction)

 Armour/Shield Penalty = 19 * (armour penalty) + 19 * (shield penalty)
 armour penalty = 0.4 * (Encumbrance Rating)^2
                  * (45 - Armour skill Lv) / 45
                  / (Str + 3)
 shield penalty = (EV Penalty) - (Shield Skill Lv) / (Player species factor)

Player species factor is 5 for normal species, 3 for large species, and 7 for small species, respectively. Spriggans have 9, though they only can use bucklers.

Step down

At this point, the spell failure is put through a step down curve. If it's over 45 (just into the 'Fair' range), it's unaffected, otherwise it needs to be progressively lower to improve the overall result. This is a stepwise curve, and complex to describe. In the table is the listed native chance to reach certain points (i.e., spell success bands), although note that there are a couple of further steps performed after this.

Description Failure rate Needed fail chance
Fair 45% 45
Good 30% 10
Very Good 20% −24
Great 10% −80
Excellent 4% −140
Perfect 0% −180


From −60 to −180 it's linear, with each difference of 20 giving 2% in the final spell success chance. So penalties affect bad wizards more than good ones. Penalty mitigation (for armour) applies before this, so the stepping function doesn't change that.

Mutations

From now on, we work with STEPPED DOWN failure rates.

  Placid magic: Failure Rate - 7 %
  Wild magic:   Failure Rate + 7 %
  Anti-Wizadry: Failure Rate + 4 %

The unrandart Hat of the High Council offers +7 %, not +4 %. It is noted as separate line in source spl-cast.cc file.

Sap status

  Failure Rate + Sap duration(in terms of turns) / 10 (%)

Wizardry, Vehumet, and other factors

Finally (phew!) spellcasting success boosts from items and other sources are applied. Note that these are actually calculated as a reduction in the fail chance, so in the table below, a low number is better.

  • Vehumet knocks 1/3 off the fail chance for Conjurations for disciples in good standing (piety over 70).
  • Rings of wizardry and staves of wizardry give some assistance, given by their "Wizardry" bonus in that column, but they suffer from decreasing cumulative effects. Other spell enhancers, such as rings of fire/ice or staves of various kinds, do not affect spell success chances, only their power. Wizardry effect is determined using this formula:
 Reduced Failure rate = Failure rate * 6 / (7 + # of Wizardry Items)
  • Potion of brilliance: Failure rate / 2 (Directly to max level of reduction)

Note that there is an hard cap of 50% for the effect of all enhancers. For Vehumet worshippers, one wizardry bonus brings a character to the 50% limit, eliminating the need for multiple Wizardry effects..

The final step

The number we have obtained isn't the final chance of failure. The game doesn't compare that number with a random number between 0 and 99, but with the sum of three numbers divided by three.

(1d101 + 1d101 + 1d100 - 3)/3 < fail chance

This is equivalent to applying this transformation to the chance of failure:

Spell success transformation.png

This sigmoid function makes it more difficult to decrease your failure rate when it is high or low, but it will go down very quickly when it is in the middle. Up to raw failure rate of 33%, one can use this formula:

 N                 = (raw_failure_rate) * 3
 Real Failure Rate = N * (N+1) * (N+2) / 6 / 101 / 101 (in unit of %)

This can be tabulated for usefulness.

Raw Fail chance Actual fail chance
32% 14.9%
30% 12.3%
28% 10.0%
26% 8.1%
24% 6.4%
22% 4.9%
20% 3.7%
18% 2.7%
16% 1.9%
14% 1.3%
12% 0.8%

Example: Stabilizing Fire Storm within 90% success rate

For pure-magic build, stabilizing Fire Storm before the Vault is strictly required. In this example, required skill level for reaching is calculated. For the failure rate of 10%, raw failure rate of 28% is required. Let's set Int=32, a decent value for spellcasters but not sufficient for end-game annihilator. Assuming no armour/shield penalty. This argument can be applied with any of Lv 9 spells, if one exclude Vehumet effect.

  • Without any aid: Raw rate of 2% is stepped down to 28%, so 2% is the point that should be achieved. This is equivalent to 54.0 point of spell skills, requiring (school skill*2 + spellcasting*0.5) = 55.7. Even if the spellcasting is maxed out to 27, the average school skill value of 21.1 is required to cast Fire storm within 10% failure.
  • With an aid of a wizardry ring: A wizardry option knocks 1/4 of failure rate before sigmoid function, so the required raw fail rate is 38%. Raw rate of 32% is stepped down to 38%, and (school skill*2 + spellcasting*0.5) = 48.6. This value is quite easy to be achieved now, and average of 19.4 Lv including spellcasting is sufficient for 10% failure rate.
  • Vehumet worshipper, or two wizardry rings: These enhancements knock off 1/3 of failure rate before sigmoid. Now the raw fail rate required before stepdown is 38%, and (school skill*2 + spellcasting*0.5) = 47.3. Required average skill Lvs, including spellcasting, is 18.9. Worshipping Vehumet really offers tremendous benefits for high-level spells.
  • Vehumet with a wizardry ring: Maxed out enhancer effect. Raw fail rate of 56% can be used without stepdown, and (school skill*2 + spellcasting*0.5) = 43.3. Required average skill Lvs, including spellcasting, is 17.3. If one regulates spellcasting up to 15, then 17.9 Lv of each school level is sufficient!
  • Potion of brilliance: Maxed out enhancer effect with increased intelligence. Raw fail rate of 66% can be used without stepdown. (school skill*2 + spellcasting*0.5) = 41.1 is required, and this reduction is huge if the caster is not aided by any of enhancers!

See also