Intrinsic protection is an intrinsic property which grants a bonus to AC independent of any armor or other equipment you may be wearing. It is commonly known as divine protection, as it is typically gained and lost via divine intervention.
Gaining intrinsic protection Edit
You can gain one or more points of intrinsic protection by doing any of the following:
- Donating to a peaceful aligned priest of any alignment in a temple.
- Donate at least 400 but less than 600 times your XL; guaranteed up to 9 points of intrinsic protection, unlikely after that.
- As a favor from prayer.
- Luck must be at least 6.
- Eating a ring of protection.
- Gain intrinsic protection equal to the ring's bonus if successful.
Losing intrinsic protection Edit
All of your intrinsic protection is lost if you do any of the following:
- Incite any god to smite you. This includes:
- Praying when it is unsafe to pray.
- Sacrificing a former pet.
- Sacrificing a coaligned unicorn.
- Sacrificing any unicorn on an altar of the same alignment as the unicorn.
- (If not chaotic) Sacrificing a member of your own race.
- Offering an identified cheap plastic imitation of the Amulet of Yendor on your own high altar in the Astral plane.
- Kill a coaligned priest.
- Put on or remove a helm of opposite alignment.
- Attempting to put on a helm of opposite alignment in the quest.
- Convert yourself to another alignment through sacrifice.
- Have your protection stolen by a gremlin.
Technically, protection is split up into two properties: the protection intrinsic (HProtection  as FROMOUTSIDE) and how much AC you get (u.ublessed).
The intrinsic determines whether u.ublessed affects your armor class. It is set by every type of action that can gain you protection, and can only be unset by a gremlin's special attack. On the other hand, u.ublessed is modified only by sacrifice, prayer, removing or attempting to wear a helm of opposite alignment, or by eating the ring.
If you donate at leat 400*XL but less than 600*XL gold to a priest, you can execute the code that gives you protection. This happens always if u.ublessed<9, and with a one in u.ublessed chance if u.ublessed < 20 . The prayer favor case is largely analogous, but it does not have this limit. In either case, if you already have the protection intrinsic, u.ublessed is incremented by one. If not, you get it, and you gain 2-4 points of protection only if u.ublessed was zero (otherwise u.ublessed is left unchanged).
If you eat a ring of protection and "magic spreads through your body" (1/3 chance), the protection intrinsic is set unconditionally and the ring's enchantment is added to u.ublessed.
For example, if you bought 15 points of protection and a gremlin then steals it, each time you try to buy protection from a priest you will have a 1 in 15 chance to reactivate your 15 points of protection.
The ability to purchase protection from priests makes donations one of the most common uses for gold, especially gold in very large quantities.
As unholy water prayer is one of the means of losing intrinsic protection, if you intend to pray to make unholy water, it is a good idea to do so before purchasing protection.