Difference between revisions of "Spell Success"

From CrawlWiki
Jump to: navigation, search
m (Armour and shield penalties)
m
Line 22: Line 22:
 
               - [2 * Intelligence]
 
               - [2 * Intelligence]
 
               + Spell difficulty
 
               + Spell difficulty
               + Armour/shield penalty
+
               + Encumbrance penalties
  
 
* 60 is an arbitrary base chance of failure.
 
* 60 is an arbitrary base chance of failure.
Line 63: Line 63:
 
'''Armour'''
 
'''Armour'''
  
   ev penalty = 2 * [[encumbrance rating|encumbrance]]^2 * (450 - 10[[Armour (skill)|armour_skill]]) / 5([[strength|str]] +3)
+
   ev penalty = 2 * [[encumbrance rating|encumbrance]]^2 * (450 - 10 * [[Armour (skill)|armour_skill]]) / 5 ([[strength|str]] +3)
 
   spell penalty = 19 * ev penalty
 
   spell penalty = 19 * ev penalty
  
Line 76: Line 76:
 
! Size !! Races !! Size factor !! Size factor +5
 
! Size !! Races !! Size factor !! Size factor +5
 
|-
 
|-
|Little || [[Spriggan]] || +4 || +9
+
|Little || [[Spriggan]] || +4 || 9
 
|-
 
|-
|Small || [[Kobold]] || +2 || +7
+
|Small || [[Kobold]] || +2 || 7
 
|-
 
|-
|Normal || most species || 0 || +5
+
|Normal || most species || 0 || 5
 
|-
 
|-
|Normal<br>(strong arms)||[[Formicid]] || -2 || +3
+
|Normal<br>(strong arms)||[[Formicid]] || -2 || 3
 
|-
 
|-
|Large<br>(normal torso)|| [[Armataur]], [[Naga]]|| -2 || +3
+
|Large<br>(normal torso)|| [[Armataur]], [[Naga]]|| -2 || 3
 
|-
 
|-
|Large || [[Ogre]], [[Troll]] || -2 || +3
+
|Large || [[Ogre]], [[Troll]] || -2 || 3
 
|}
 
|}
  
Line 127: Line 127:
  
 
* [[Subdued Magic]]: -2% per level
 
* [[Subdued Magic]]: -2% per level
* [[Wizardry]]: x75% for 1 source, x66.6% for 2, x50% for 3 (applied after all other multipliers)
+
* [[Wizardry]]: x75% for 1 source, x66.6% for 2, x50% for 3 (applied after all other factors)
  
 
[[Vehumet]] gives 2 levels of wizardry for destructive spells.
 
[[Vehumet]] gives 2 levels of wizardry for destructive spells.
Line 141: Line 141:
 
[[Image:Spell_success_transformation.png]]
 
[[Image: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:
+
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. For raw failures below 33%, one can use this formula:
  
 
   N                = (raw_failure_rate) * 3
 
   N                = (raw_failure_rate) * 3

Revision as of 05:56, 16 May 2023

Version 0.30: 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. Spell success rate is determined by a complex combination of:

  1. Spell level
  2. Spell-related skills, Intelligence
  3. Penalties from body armour and shields (mitigated by Armour skill / Shields skill)
  4. Modifiers like Wizardry and Wild Magic

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 0% success rate, your chance to fail has to be negative. More on that below.

The base failure before any modifiers is as follows:[1]

 spellFailure = 60
              - [6 * spell_skills]
              - [2 * Intelligence]
              + Spell difficulty
              + Encumbrance penalties
  • 60 is an arbitrary base chance of failure.
  • Increasing intelligence and spell skills (skills respective to the spelland Spellcasting) will decrease failure.
  • Higher level spells are more difficult, wearing armour/shields make it more difficult.

spellFailure, at this stage, is capped at 1400.

Skill

"Spell_skills" is the combination of Spellcasting and an average of a spells schools (e.g. a Conjurations / Fire spell will take the average of the Conjurations skill and Fire Magic skill). This is calculated with the following two equations:[2] [3]

 Z = [Spellcasting / 2] + [Average(SpellSkills) * 2]
 spell_skills = 50 * log_2 (1 + Z / 50)

With 27 in Spellcasting and 27 in relevant skills, the total value of (6 * spell_skills) is capped at 370.

For Djinn, the Spellcasting skill is counted as both Average Spell Schools and Spellcasting itself, resulting in the following formula:[4]

 Z = Spellcasting * 2.5

Spell level

Higher level spells are more difficult. Each level of spell adds a number to your spell failure rate:[5]

 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)

Both Armour and Shield penalties for spells are derived from their EV penalties.

Armour

 ev penalty = 2 * encumbrance^2 * (450 - 10 * armour_skill) / 5 (str +3)
 spell penalty = 19 * ev penalty

Shield

 ev penalty = 2/5 * encumbrance^2 / (5 + strength) * (27 - shield_skill) / 27
 spell penalty = 19 * (ev penalty - (shield_skill) / (size factor + 5))

Size factor is determined by species:

Size Races Size factor Size factor +5
Little Spriggan +4 9
Small Kobold +2 7
Normal most species 0 5
Normal
(strong arms)
Formicid -2 3
Large
(normal torso)
Armataur, Naga -2 3
Large Ogre, Troll -2 3

Step down

At this point, the spell failure is put through a stepdown curve. If it's over 45, it's unmodified. 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). This is not the final spell rate; there are more modifiers.[6]

Description spellFailure Raw Failure Rate
Fair 45 45%
Good 10 30%
Very Good -24 20%
Great -80 10%
Excellent -140 4%
Perfect -180 0%

From −60 to −180, this equation is linear; each difference of 20 gives 2% to the final spell success chance. Penalties are more meaningful the higher your spell failure chance is.

Modifiers

The following modifiers are added after the STEPPED DOWN failure rates. However, they are still raw spell failure chance, and are adjusted by a sigmoid function later. [7]

Positive (+spell failure):

Negative (-spell failure):

  • Subdued Magic: -2% per level
  • Wizardry: x75% for 1 source, x66.6% for 2, x50% for 3 (applied after all other factors)

Vehumet gives 2 levels of wizardry for destructive spells.

After all modifiers have applied, you will get a cumulative raw spell failure chance. This is converted into the final success via the function below.

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.[8]

(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. For raw failures below 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%

Strategy

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.

Example: Fire Storm

For an actual failure rate of 10%, a raw failure rate of 28% is required. Assume Int=32, a good value for a dedicated caster (if a bit low). Also assume no armour/shield penalty.

  • Without any aid: With a raw spell failure of 28%, you'll need a spellFailure value of 2. This is equivalent to 54.0 points of spell skills, requiring (school skill*2 + spellcasting*0.5) = 55.7. With a Spellcasting skill of 27, you'll need an average spell schools of 21.1.
  • Wizardry x1: A wizardry ring knocks 1/4 of failure rate before sigmoid function, so the required raw fail rate is 38%. A spellFailure of 32% is stepped down to 38%. 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 / Wizardry x2: 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 + Wizardry / Wizardry x3: 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!

See also

References