Difference between revisions of "Spell Success"

From CrawlWiki
Jump to: navigation, search
(Huge revamp on this page.)
Line 36: Line 36:
 
=== Spell skills ===
 
=== Spell skills ===
  
Now they use very familiar equation with spellcasting equation. The main difference is, spellskill boost effect of potion of brilliance is not counted here!
+
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]
 
   S_0 = [Spellcasting / 2] + [Average(SpellSkills) * 2]
Line 48: Line 48:
  
 
   spellDifficulty =  3 (level 1)
 
   spellDifficulty =  3 (level 1)
                     15 (level 2)
+
                     15 (level 2)  (+12)
                     35 (level 3)
+
                     35 (level 3)  (+20)
                     70 (level 4)
+
                     70 (level 4)  (+35)
                     100 (level 5)
+
                     100 (level 5)  (+30)
                     150 (level 6)
+
                     150 (level 6)  (+50)
                     200 (level 7)
+
                     200 (level 7)  (+50)
                     260 (level 8)
+
                     260 (level 8)  (+60)
                     330 (level 9)
+
                     330 (level 9)  (+70)
  
 
=== Armour and shield penalties (Under Construction) ===
 
=== Armour and shield penalties (Under Construction) ===
  
{{version010}}
+
  Armour/Shield Penalty = 19 * (armour penalty) + 19 * (shield penalty)
  
The spellcasting penalties from armour and shields are linked together. The gist of it, for body armour, is as follows:
+
  armour penalty = 0.4 * (Encumbrance Rating)^2
 +
                  * (45 - Armour skill Lv) / 45
 +
                  / (Str + 3)
  
* The more a piece of body armour impedes [[Evasion]], the more it will impede spellcasting.
+
  shield penalty = (EV Penalty) - (Shield Skill Lv) / (Player species factor)
* If your character's Strength is not at least three times your body armour's EV penalty, you receive an ''additional'' penalty to spellcasting.
 
* The Armour skill reduces your body armour's penalty, but non-elven armours with -3EV penalty or higher cannot have their penalty fully removed.
 
  
And for shields:
+
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.
 
 
* The larger the shield, the larger the penalty. Bucklers are your friends.
 
* The Shields skill offsets the spellcasting penalty.
 
* For medium size characters every 5 points of Shield eliminates the penalty associated with a single point of EV penalty.  Larger characters require less Shield skill, while smaller characters require more.
 
* If you are using a 0 EVP body armour, you need less Shield skill to remove the penalty. See [[Shields#Shield_Penalties|shield penalties]].
 
 
 
Racial armour also has an effect. Elven armour impedes spellcasting less than normal armour, while dwarven armour impedes it more. Wearing racial armour that matches the character's species reduces the penalty - which, for dwarves in dwarven armour, actually cancels out the racial penalty. Note that only body armour and shields affect spellcasting; bardings inflict no spellcasting penalty.
 
 
 
For the non-math inclined:
 
 
 
* Elven leather has no spell casting penalty.
 
* Elves can wear elven ring mail (-2 EV) with no spell casting penalty (assuming no additional shield penalty).
 
* Orcs can wear orcish leather with no spell casting penalty (assuming no additional shield penalty).
 
* Dwarven armor should be avoided for non-Dwarf characters.
 
* 9 points in Armor skill removes the spell casting penalty for leather (assuming no additional shield penalty).
 
* 27 points in Armor skill removes the spell casting penalty for all -2 EV armors (assuming no additional shield penalty).
 
 
 
  armourShieldPenalty = max(0,
 
                            max(0,
 
                                25 * adjustedArmourEVPenalty
 
                              - racialArmourSpellcastingBonus)
 
                          + 25 * adjustedShieldEVPenalty
 
                          - 2000)
 
                      / 100
 
 
 
  adjustedArmourEVPenalty = 0 if armour EV penalty is 0, otherwise
 
                            (EV penalty + max(3 * EV penalty - Strength, 0))
 
                          * (45 - Armour skill)
 
                          * 100
 
                          / 45
 
 
 
  adjustedShieldEVPenlaty = 0 if no shield, otherwise
 
                            max(0,
 
                                EV penalty * 100
 
                              - (Shield skill * 100 / max(1, 5 + sizeEvasionFactor)))
 
 
 
  racialArmourSpellcastingBonus = 0
 
                                + 2500 if elven armour
 
                                - 1500 if dwarven armour
 
                                + 1500 if in correct racial armour (eg, orc in orcish armour)
 
  
 
=== Step down ===
 
=== Step down ===

Revision as of 18:07, 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)


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 95% −140
Perfect 100% −180

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.

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