Difference between revisions of "Spell Success"

From CrawlWiki
Jump to: navigation, search
m
 
m (1 revision: uploading category:magic)
(No difference)

Revision as of 05:30, 21 December 2012

Version 0.10: 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.10.3 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 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

Very similar to the first part of the spell power calculation - in fact, it's the same bit of code that does it. Half of Spellcasting is added to twice the average of all the spell schools used in the spell.

 spellSkills = [Spellcasting / 2]
              + [Average(SpellSkills) * 2]

Spell difficulty

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

 spellDifficulty =   3 (level 1)
                    15 (level 2)
                    35 (level 3)
                    70 (level 4)
                   100 (level 5)
                   150 (level 6)
                   200 (level 7)
                   260 (level 8)
                   330 (level 9)

Armour and shield penalties

The spellcasting penalties from armour and shields are linked together. The gist of it, for body armour, is as follows:

  • The more a piece of body armour impedes Evasion, the more it will impede spellcasting.
  • 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:

  • 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 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

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 50% 50
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.

Transformations penalties and Mutations

Blade Hands gives a penalty of 20, and Bat and Spider Form each gives a penalty of 10. The Wild Magic mutation gives a penalty of 7 for each level. Note that as this happens after the stepping, these can be taken as a direct on the spell success chances (modulo any enhancers - that suggests that for Transmuters, they are of greater value).

It's instructive to note the transformations that don't penalize spell success: Ice Form, Statue Form and Dragon Form. The last one even helps spell sucess, but only for Draconians. See below.

 transformationPenalty = 20 (for Blade Hands)
                         10 (for Bat or Spider Form)

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 and Summonings for disciples in good standing (piety over 50).
  • Brilliance decreases the fail chance by one third (in addition to a wizardry bonus).
  • 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. Look up the combination of Rings and Staves you have in the table below. Other spell enhancers, such as rings of fire/ice or staves of various kinds, do not affect spell success chances, only their power. Wizardry is determined using this formula:
 Wizardry = +3 (for every ring of wizardry)
            +4 (if wielding a staff of wizardry)
            +6 (under the effect of a potion of brilliance)

Note that there is an absolute limit of 50% for the effect of all enhancers.

The value in the "Fail chance" or "Vehumet" columns is the percentage of calculated fail chance used. Note that this happens after step down, meaning that enhancers have more effect for difficult spells than easy spells; don't load up on them if all your spells are Excellent, put on a ring of magical power instead! Looking at the table, it seems that after equipping two enhancers, you're not going to get much more benefit.

Equipment Wizardry Fail chance Vehumet
None 0 100 67
- 1 87 58
- 2 79 52
R 3 74 50
S 4 71 50
- 5 68 50
RR 6 66 50
RS 7 64 50
- 8 62 50
RRR 9 60 50
RRS 10 58 50
- 11 56 50
RRRR 12 54 50

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

See also