A monster's difficulty is a number from 1 to 57 which represents the game's idea of how tough a monster is. It loosely correlates with a monster's base level, but is often higher for monsters with special properties that might make them tougher.
Difficulty is primarily used in the normal mechanism of monster generation to decide whether a candidate monster is appropriately difficult for the player to encounter. A monster is "too strong" to be randomly generated when its difficulty is greater than the average of your experience level and your dungeon level. It is "too weak" to be randomly generated when its difficulty is less than your dungeon level divided by 6, rounded down. (For this purpose, once you have the Amulet of Yendor your dungeon level is considered to be that of the Sanctum, and in the endgame to be the depth of the Sanctum plus half your experience level.) Most of the less common mechanisms of monster generation do not have similar limits.
Other effects of difficulty include:
- How much your god appreciates a sacrificed corpse (the dead monster's experience level doesn't matter).
- Whether your god will be mollified, if they are angry. You must sacrifice a monster corpse of difficulty 7 or greater (11 or greater if you are chaotic) in order to mollify the god.
- The type of offensive, defensive, or miscellaneous item a monster may receive.
- Whether a monster considers itself weak enough to try polymorphing itself.
This table was generated with the use of a modified version of makedefs to calculate experience values as well, and is believed by the author to be accurate. If there are discrepancies between these and those listed in the articles, please correct the article.
Difficulty algorithm (3.6.1 and earlier)
In versions of NetHack prior to 3.6.2 (and derived variants), the monster's difficulty was calculated during compilation using the below algorithm, and stored in monstr.c. As of NetHack 3.6.2, difficulty is now stored in the monst.c as part of the mons array. All monsters have the same difficulty in 3.6.1 and 3.6.2.
If the monster's base level is greater than 49 (meaning that it's either a mail daemon or a demon lord), instead set the initial difficulty to (base level - 6) / 2.
Next, compute a bonus based on properties of this monster:
- Start at 0.
- Add 1 if the monster generates in small groups.
- Add 2 if the monster generates in large groups.
- Add 1 if the monster is capable of ranged attacks: whether it has any weapon, spellcasting, gaze, spit, or breath attacks.
- Add 1 if the monster's base AC is between 0 and 3, inclusive.
- Otherwise add 2 if the monster's base AC is -1 or lower.
- Add 1 if the monster's speed is 18 or higher.
- For each attack the monster has, add together all the following bonuses:
- Add 1 if the attack is non-passive.
- Add 1 if the attack is arcane spellcasting (AT_MAGC).
- Add 1 if the monster is strong and the attack is a weapon attack (AT_WEAP).
- Add 2 if the attack has a damage type of AD_DRLI (drain life), AD_STON (stoning), AD_DRST (strength poison), AD_DRDX (dexterity poison), AD_DRCO (consitution poison), or AD_WERE (lycanthropy).
- Add 1 if the damage type is none of the above six types and is also not AD_PHYS (physical damage), and the monster is not a grid bug.
- Add 1 if the maximum attack damage for this attack is 24 or higher.
- Subtract 2 if the monster is a leprechaun.
Then, modify difficulty based on what the bonus worked out to be:
- If the total bonus equals 0, subtract 1 from difficulty.
- If the total bonus is 6 or higher, add half of the bonus, rounded down, to difficulty.
- Otherwise, if the total bonus is between 1 and 5, add 1 + one-third of the bonus, rounded down, to difficulty.
Finally, if difficulty is negative (only possible with very weak monsters like lichens), set it to 0.
- util/makedefs.c in NetHack 3.6.0, line 2117
- util/makedefs.c in NetHack 3.6.0, line 2156: This is evidently to compensate for leprechauns' base level being artificially inflated, and to cancel out the 2 points they get from their gold-stealing attack. It is unclear why the bonus is not simply set to 0 here.
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:
- The original contributors to any spoiler must continue to be credited.
- Any modifications to the spoiler must be acknowledged and credited.