Forum:Protection from eating rings

From NetHackWiki
Jump to navigation Jump to search


For some reason I can only get 1 point of protection per ring of protection I eat, no matter the enchantment. Anyone have guesses why? TK (talk) 04:40, 22 November 2017 (UTC)

The protection increase uses function bounded_increase ( https://nethackwiki.com/wiki/Source:NetHack_3.6.0/src/eat.c#bounded_increase ). A quick look at the code suggests the following:
  • Eating jewelry to get up to 10 protection is guaranteed and adds the enchantment
  • Eating jewelry with between 10 and 20 current protection will add a random number between 1 and enchantment
  • For getting up to 40, you have a 1-in-enchantment chance of getting nothing (i.e. +1 will never work, +2 is 50% chance here, +3 is 66% chance)
  • You can't gain more than +40 intrinsic protection

This is just a quick reading with no testing; I might be missing stuff. And I'm sure I'm not describing the edge cases properly (i.e. 7 current protection, eat a +5 ring. You're guaranteed to hit 10, and have a chance of getting higher). This function is also used by increase accuracy and damage. -- Qazmlpok (talk) 16:33, 23 November 2017 (UTC)