Spellcasting

From NetHackWiki
Revision as of 12:07, 15 March 2018 by Julesd (talk | contribs) (Calculating spell success rate)
Jump to navigation Jump to search
Keyboard commands
~ ! @ # $ % ^ & * ( ) _ = +
Q W E R T Y U I O P { } |
q w e r t y u i o p [ ] \
A S D F G H J K L : "
a s d f g h j k l ; '
Z X C V B N M < > ?
z x c v b n m , . /
q w e r t u i o p Alt
a s d f j l Alt
c v n m ? Alt
A C R T O Alt
a c d o p r t [ Ctrl
For monsters' spellcasting mechanics, see monster spells.

Spellcasting is using the Z command to wield innate magical abilities during gameplay. More rarely a player can use the #monster, ctrl + t and #turn commands to unleash quasi-magics.

The first prerequisite for spellcasting is knowing at least one spell. Healers, monks, priests and wizards are roles which begin the game with knowledge of one or more spells; other classes must find at least one spellbook and read it first. Pressing Z without knowing any spells will produce a message to this effect.[1]

The second requirement is not being stunned [2]. Next, your strength must be at least four or greater unless you chose to cast Restore ability[3]. Finally, you need to have at least one hand you could free. However, not having any hands in the first place due to polymorph is somehow also okay.[4]

Otherwise a menu will appear of the spells you know, accompanied by their chance of failure. The + key reorders it.

This chance of failure is affected by intelligence (or wisdom), experience level, skill level, innate magical ability of the role, armor: especially metal but also shields and robes, whether it is an emergency spell or your special spell.

Unless you cancel, the game will first check if you have enough power (magical energy) for the spell selected. If you have enough power then the game will roll for success or failure. If you succeed your spell will take effect - see spellbook for an index. If you fail you will receive the message "You fail to cast the spell correctly."

Spellcasting (except detect food) will burn nutrition, which can be reduced or eliminated by hungerless casting. Each spell casting will produce skill points equal to its level, regardless if you affect anything, hit a monster etc.

Forgotten spells

Spell knowledge only lasts for 20,000 turns after reading a spellbook. Once this time is up the spell is forgotten, and is marked with an asterisk * in the casting menu. Spellbooks may be re-read once the timeout is at or below 1,000 turns. This will reset the timeout to 20,000 turns.[5] Attempting to read a spellbook before the timeout is low enough will produce the message "You know <spell> quite well already". This will not use up a reading of the spellbook, and if read while owned by a shopkeeper, will not result in a use fee[6].

Attempting to cast a forgotten spell will not check any of the usual casting prerequisites except stunning, and will consume neither nutrition nor power. It will instead make you confused, stunned, or both. The duration of confusion and stunning is dependent on the level of the forgotten spell, but the choice of effects is not.

The exact effect of casting a forgotten spell is as follows:[7]

Probability Effect
40%
  • confused for (spell-level + 1) * 3 turns
30%
  • confused for (spell-level + 1) * 2 turns
  • stunned for (spell-level + 1) turns
20%
  • confused for (spell-level + 1) turns
  • stunned for (spell-level + 1) * 2 turns
10%
  • stunned for (spell-level + 1) * 3 turns

Forgotten spells are a common way to deliberately become confused, to invoke the alternative effects of certain scrolls.

Spellcasting cost

Casting a spell costs energy points, equal to 5 times the spell's level [8]. If you are carrying the Amulet of Yendor, there is an additional random penalty of between 1 point and 2 times the usual cost (“You feel the amulet draining your energy away.”) [9]. If you do not have the required energy (“You don't have enough energy to cast that spell.”), nothing happens; the turn count does not advance, either [10]. If the attempt fails (“You fail to cast the spell correctly.”), only half of that energy is used up, rounded down [11].

Casting any spell other than detect food[12] uses nutrition equal to two times the energy cost (including the Amulet penalty), which means that it is usually 10 times the spell's level. If you are a wizard with sufficiently high intelligence, you might be able to take advantage of hungerless or reduced-hunger casting. A failed cast costs just as much nutrition as a successful one. If you are fainting, you cannot cast any spells other than detect food, whether or not you have hungerless casting.

As an example, casting a level 3 spell normally requires 15 energy and 30 nutrition. If you fail to cast it, only 7 energy is used, but you still lose 30 nutrition. When carrying the Amulet of Yendor, there is an energy penalty of 1 to 30 points, so the total energy cost varies from 16 to 45, and the nutrition cost varies from 32 to 90.

Note that the Amulet penalty does not prevent emergency uses of a spell. In the example above, if you had only 16 energy left, you could still try again and again, without using any time, until the random penalty is rolled as 1.

Calculating spell success rate

When spellcasting the Fail column appears in the menu which occurs when using the Z command.

To calculate spell failure you can use the tool referenced below in the External Links section.

The algorithm is as follows; you first need to sum together the penalties listed below. An increasing total penalty is worse for spellcasting, and is limited to a maximum of 20.

  • The "Base" value from the table below, depending on the character's class.
  • If an "emergency" spell, the "Emergency" field. Spells considered emergency spells are all healing spells except for stone to flesh, as well as remove curse. [13]
  • If wearing any shield, the amount in the "Shield" field.
  • If wearing metallic body armor, the amount in the "Suit" field.
  • If also wearing a robe, only add half the amount (rounded down). [14]
  • If wearing a robe without metallic armor, subtract the amount in the "Suit" field. [15]
  • If wearing a metallic helmet other than the helm of brilliance, add 4. (Metal helmets interfere with the mind.) [16] [17]
  • Metallic gloves add 6 (casting channels through the hands). [18]
  • Metallic boots add 2 (all metal interferes to some degree). [19]
  • If casting the corresponding special spell (see table), subtract 4.
Class Base Emergency Shield Suit Stat Special spell
Archeologist 5 0 2 10 Int Magic mapping
Barbarian 14 0 0 8 Int Haste self
Caveman 12 0 1 8 Int Dig
Healer 3 -3 2 10 Wis Cure sickness
Knight 8 -2 0 9 Wis Turn undead
Monk 8 -2 2 20 Wis Restore ability
Priest 3 -2 2 10 Wis Remove curse
Ranger 9 2 1 10 Int Invisibility
Rogue 8 0 1 9 Int Detect treasure
Samurai 10 0 0 8 Int Clairvoyance
Tourist 5 1 2 10 Int Charm monster
Valkyrie 10 -2 0 9 Wis Cone of cold
Wizard 1 0 3 10 Int Magic missile


Next, calculate a base chance of success, which is 5.5 times either your intelligence or wisdom, depending on your class (see the "Stat" field). The maximum natural human Int/Wis of 18 gives a 99% base success rate. This chance is modified by the following factors:

  • SKILL level (Unskilled = 0, Basic = 1, Skilled = 2, Expert = 3)
  • spell level (LVL)
  • experience level (XL)

according to this formula:[20]

difficulty = (LVL * 4) - (SKILL * 6) - (XL/3) - 5

If difficulty is positive, the spell is considered difficult. Your chance is reduced according to the following formula. A difficulty of 1 therefore gives a 53% penalty, and a difficulty of 9 gives a 100% penalty.

\text{chance} = \text{base chance} - \sqrt{(900 * \text{difficulty}) + 2000}

If it is negative, it will be increased with diminishing returns: the absolute value is multiplied by (15/LVL), capped at 20, and added to the base chance. A level 1 spell therefore achieves the full 20% bonus with a difficulty of -2. A level 7 spell cannot achieve a better difficulty than -5, which gives a bonus of 10%.

The resulting chance is clipped to the range of 0% to 120% success. If you are wearing a shield larger than a small shield, the chance is then reduced to 1/4 its amount (except if it is the special spell for your class -- then it is only halved).[21]

Finally, the chance of success is adjusted by your total penalty using the following formula:

\text{actual chance} = \frac{\text{chance} * (20-\text{penalty})}{15} - \text{penalty}

The result is clipped to the range of 0% to 100% success.

Effects

Most spells act similarly to the corresponding wand [22], scroll[23], or potion[24].

Range

Beam spells: 6-13[25]

Ray spells: 7-13[26]

Dig: 8-25[27]

To Hit

The chance of hitting versus an armor class (ac) is based on a d20 equivalent (a random number 0-19 is generated).[28]

Also a spell bonus is calculated as the sum of the skill penalty/bonus and the dexterity penalty/bonus.[29] These are the same as used in physical combat.

If the chance is 0, success is d10 < ac + spell bonus

Otherwise, negative ac is weakened to a random number between -1 and the actual ac[30]; success is 3 - chance < ac + spell bonus

Damage

A spell damage bonus based on intelligence (INT) and experience level (XL) is used in most attack spell damage calculations.[31]

Criteria Bonus
INT <= 9 -3
INT <= 13 OR XL < 5 0
INT <= 18 +1
INT <= 24 OR XL < 14 +2
INT = 25 +3

Force Bolt: 2d12 + spell damage bonus[32]

Drain Life: usually d8 (except monsters > level 49: 5-8, dragons: 4-8, level 0 monsters: d4) + spell damage bonus[33][34]

Magic Missile, Cone of Cold (below skilled), and Fireball (below skilled)[35]

  • If monster resists: no damage!
  • base = XL / 2 + 1
  • base d 6
  • Cone of Cold and monster has fire resistance: + base d 3
  • Fireball and monster has cold resistance: +7
  • + spell damage bonus

Cone of Cold (skilled or expert), and Fireball (skilled or expert)[36]

  • 2 to 9 explosions covering a 3 x 3 space, the first centered on a starting point up to 10 steps away, remaining centered randomly 9 spaces centered on starting point
  • base + spell damage on each monster in affected space for each explosion
  • Cone of Cold and monster has fire resistance or Fireball and monster has cold resistance: double damage[37]
  • Monster resists: 1/2 damage

Strategy

There are three main ways to improve your spellcasting chances: increase your spellcasting stat, gain more skill and experience levels, and wear armor appropriate to your role's spellcasting abilities.

An Intelligence or Wisdom score of 19 or more is needed to reach 100% base success rate, but human characters cannot reach these levels without a helm of brilliance.

Skill and experience strategy

Spells are much easier to cast when their difficulty is zero or less. The following table lists the most difficult spell level that is still considered easy (no penalty for spell level) given particular experience and skill levels.

Highest easy spell level
Xlvl Unskilled Basic Skilled Expert
1–2 1 2 4 5
3–8 1 3 4 6
9–14 2 3 5 6
15–20 2 4 5 7
21–26 3 4 6 7
27–30 3 5 6 7

If your Intelligence or Wisdom is high, spells of this level or below are likely to have a near-100% base success rate. It is still possible to cast non-easy spells, but they tend to have much lower success rates.

Equipment and role strategy

If you have raised your experience level, skill, and spellcasting stat high enough to reach a 100% or higher base success rate, your role and equipment will be the limiting factor in achieving low failure rates.

With a base success rate of 120%, your spellcasting penalty must be 6 or less to achieve an overall 100% success rate. Roles that can achieve this without a robe are archeologist, healer, priest, tourist, and wizard. Roles that can achieve this when casting emergency spells or their special spell are knight and monk. Roles that can achieve this with their special spell only are ranger, samurai, rogue, and valkyrie. The remaining two roles, barbarian and caveman, cannot achieve 100% success without a robe.

SLASH'EM

SLASH'EM makes several changes to NetHack's spellcasting system. New spells have been added, and several existing ones have been reshuffled. SLASH'EM roles tend to be more proficient in spell skills than their vanilla counterparts.

External links

References

  1. src/spell.c in NetHack 3.6.0, line 657: Trying to cast a spell without knowing any.
  2. src/spell.c in NetHack 3.6.0, line 629: Being stunned prevents spellcasting.
  3. src/spell.c in NetHack 3.6.0, line 913: Minimum strength requirement for spells.
  4. src/spell.c in NetHack 3.6.0, line 632: Spellcasting requires not having both hands occuppied by cursed item(s).
  5. src/spell.c in NetHack 3.6.0, line 379: Refreshing or learning a spell.
  6. src/spell.c in NetHack 3.6.0, line 376: Reading book of keenly known spell.
  7. spell_backfire in src/spell.c in NetHack 3.6.0: Casting a forgotten spell.
  8. src/spell.c in NetHack 3.6.0, line 908: Spell cost.
  9. src/spell.c in NetHack 3.6.0, line 923: Amulet of Yendor's penalty on spell cost.
  10. src/spell.c in NetHack 3.6.0, line 929: Attempting to cast a remembered spell without enough energy does not take time.
  11. src/spell.c in NetHack 3.6.0, line 982: Failing to correctly cast a spell wastes only half of casting cost.
  12. src/spell.c in NetHack 3.6.0, line 929: Detect food has no casting hunger cost.
  13. src/spell.c in NetHack 3.6.0, line 1618: List of emergency spells.
  14. src/spell.c in NetHack 3.6.0, line 1601: Robe worn over metallic armor halves spellcasting penalty of the latter.
  15. src/spell.c in NetHack 3.6.0, line 1603: Robe worn without metallic body armor increases spellcasting chance.
  16. src/spell.c in NetHack 3.6.0, line 95: Metal helmets interfere with the mind.
  17. src/spell.c in NetHack 3.6.0, line 1608: Helm of brilliance imposes no spellcasting penalty.
  18. src/spell.c in NetHack 3.6.0, line 96: Casting channels through the hands.
  19. src/spell.c in NetHack 3.6.0, line 97: All metal interferes to some degree.
  20. src/spell.c in NetHack 3.6.0, line 1643: Spellcasting chance formula.
  21. src/spell.c in NetHack 3.6.0, line 1673: Big shields significantly impair spellcasting.
  22. src/spell.c in NetHack 3.6.0, line 1044: wand similar
  23. src/spell.c in NetHack 3.6.0, line 1096: scroll similar
  24. src/spell.c in NetHack 3.6.0, line 1112: potion similar
  25. src/zap.c in NetHack 3.6.0, line 2849: beam spell range
  26. src/zap.c in NetHack 3.6.0, line 3846: ray spell range
  27. src/dig.c in NetHack 3.6.0, line 1442: dig spell range
  28. src/zap.c in NetHack 3.6.0, line 3733: spell to hit calculation
  29. src/zap.c in NetHack 3.6.0, line 2906: spell hit bonus
  30. src/hack.c in NetHack 3.6.0, line 294: negative ac weakened
  31. spell_damage_bonus in src/zap.c in NetHack 3.6.0: spell damage bonus
  32. src/zap.c in NetHack 3.6.0, line 160: force bolt damage
  33. src/zap.c in NetHack 3.6.0, line 371: drain life damage
  34. monhp_per_lvl in src/makemon.c in NetHack 3.6.0: drain life damage routine
  35. zhitm in src/zap.c in NetHack 3.6.0: routine containing mm, cold, and fire damage
  36. src/spell.c in NetHack 3.6.0, line 1010: skilled cold and fireball
  37. src/explode.c in NetHack 3.6.0, line 400: skilled cold and fireball resistance adjustments

This page is based on a spoiler by Dylan O'Donnell. The original license is:

Redistribution, copying, and editing of these spoilers, with or without modification, are permitted provided that the following conditions are met:

  1. The original contributors to any spoiler must continue to be credited.
  2. Any modifications to the spoiler must be acknowledged and credited.

This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.0. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-360}} tag to the current version's tag or {{noversion}} as appropriate.