magic resistance

The most coveted of all intrinsics in Nethack, and the hardest to get without wishing. Magic resistance has a whole
host of effects. It makes you immune to death rays, being insta-killed by a touch of death, polymorph traps, antimagic
traps, teleport and level teleport traps, and many attacks of spellcasting monsters, including being paralysed and having
your armour destroyed. It also provides partial protection against some other things such as blasts of power from
touching an artifact of the wrong alignment and having your items cursed by monsters.

You cannot obtain magic resistance by eating something. It is most commonly obtained by wearing gray dragon scale
mail or a cloak of magic resistance, but wielding Magicbane or carrying certain quest artifacts will also work.