Difference between revisions of "Spell Success"

From CrawlWiki
Jump to: navigation, search
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.
  
 
=== Spell difficulty ===
 
=== Spell difficulty ===
Line 85: Line 86:
 
|Great||90%||−80
 
|Great||90%||−80
 
|-
 
|-
|Excellent||95%||−140
+
|Excellent||96%||−140
 
|-
 
|-
 
|Perfect||100%||−180
 
|Perfect||100%||−180
Line 91: Line 92:
 
|}
 
|}
  
For Excellent, −140 actually gives a 96% chance of success here. It's not possible to hit 95% directly.
 
  
 
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.
 
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.
Line 124: Line 124:
  
 
===The final step===
 
===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.
 
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
 
  (1d101 + 1d101 + 1d100 - 3)/3 < fail chance

Revision as of 19:05, 26 March 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!

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 is naturally capped at 370, assuming 27 lv on 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 Success rate Needed fail chance
Fair 45% 45
Good 70% 10
Very Good 80% −24
Great 90% −80
Excellent 96% −140
Perfect 100% −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.

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.

See also