Mind flayers and master mind flayers are especially perilous monsters, capable of eating your brain, resulting in feeling stupid, becoming forgetful ("This place looks familiar..."), or perishing as your last thoughts fade away. Wearing a helmet, preferably greased, can sometimes protect you against the brain-eating attack. If you die from intelligence drain while polymorphed, you will permanently die instead of reverting to your normal form.
A worn amulet of life saving won't save you from brainlessness ("Unfortunately your brain is still gone."), though you can still choose not to die in wizard or explore mode. Polymorphing into a headless monster will protect you from the special attacks; you will still suffer the normal weapon damage. Being polymorphed into a normally mindless form won't protect you; a comment says this is because players aren't mindless.
You can sense their presence remotely, and if you have telepathy they can sense yours. Occasionally they will concentrate and release a blast of psychic energy. If they are peaceful and you are not creating conflict, it will "feel quite soothing" and no harm will be done. Otherwise, if they can sense your presence either via telepathy or sight, it will "lock on" to your telepathy or mind, and you will sustain d15 damage (halved with half spell damage). This is the only attack in the game that you need to deal with if you are protected by a boulder/jelly combination fort.
They have a humanoid body, with an octopus-like head, and four tentacles around a lamprey-like mouth.
Be careful not to run up to a mind flayer in melee thinking that it is a dwarf king; for some players, dwarves are easy kills while mind flayers are very dangerous. If you have felt the mind flayer's presence, that is your cue to check whether that h is a dwarf. The message "You sense a faint wave of psychic energy" is your clue that there is a (master) mind flayer somewhere on the level, but you won't see it every turn. Also note that dwarves will not be generated in Gehennom (but mind flayers may be generated in the Dungeons of Doom).
Mind flayers as pets
Mind flayers make excellent pets, as they make quick work of shopkeepers, and their telepathic outreach just prints a useless message rather than harming you, or locks onto hostile monsters. However be careful if your tame mind flayer becomes confused - he will easily do the same with you.
However, in the late game, pet (master) mind flayers may wake up the Wizard of Yendor with their psychic blasts before you meant to fight him, causing you a host of problems. It is best to be very careful with such a pet in the later parts of Gehennom where the Wizard's Tower might be.
Tame mind flayers may emit a "faint wave of psychic energy", which is indistinguishable from that of a hostile mind flayer. If "a wave of psychic energy pours over you", and it does not feel "quite soothing", there is a hostile mind flayer on the level.
Mind flayers can use all weapons and armor that the player can. If you want to protect your mind flayer against ochre jellies, which are frequently summoned in the later game, you might consider giving it any yellow dragon scales you come across, as these will give it acid resistance.
Fighting a mind flayer
Be cautious when fighting against a mind flayer. Here are some tips.
Avoid melee. Try to attack the mind flayer with ranged attacks. Those annoying master mind flayers can resist some magic attacks like force bolt, but you can still throw daggers or other weapons, or use more powerful spells like finger of death (if you can cast them).
Wear a greased helmet. A non-greased helmet has a 7/8 chance of preventing each of the mind flayer's tentacle attacks from reaching your brain. A greased helmet always protects from the brain-eating, but each attack has a 1/2 chance of causing the grease to wear off. However, mind flayers get multiple attacks per turn, so you should not rely on this, especially if you are unable to kill the mind flayer quickly.
You may alternately want to wear a dunce cap or ring of sustain ability. Either will fix your intelligence, preventing its loss and thus brainlessness. The dunce cap, being a helmet, also has a chance of blocking the flay altogether. However, neither will protect against amnesia from a successful brainsuck, and you're likely to come out of the fight very forgetful.
Scare them by some other method, for example, an expensive camera. This is not as secure as Elbereth, as a fleeing mind flayer may still attack you, but it is much less likely to. Note the mind flayers' high magic resistance, which makes any resistable attack unlikely to succeed, and a blind mind flayer will not respect Elbereth.
Do not try to use cancellation against mind flayers; even if it gets through their magic resistance, their brainsucking attack will be unaffected.
Obtain a unicorn horn. There are many other good reasons to have a unicorn horn, but you can apply one to recover your lost intelligence after the battle. This is of limited use during combat, however, as it has a chance of not restoring your intelligence when you use it, possibly resulting in death from brainlessness the next round. A unicorn horn will not cure amnesia. Some people will collect a #named specimen of each identified object in their main stash to mitigate the effects of amnesia.
It is possible to stone a mind flayer or master mind flayer. If you have a source of cockatrice corpses or eggs, or you find a cockatrice located conveniently near a mind flayer, wear gloves, wield the corpse (or egg), and strike the mind flayer in melee. It only takes one hit (unless the mind flayer eats a lizard corpse or ingests acid).
Many players find the amnesia attack so crippling that genocide becomes the best option. A blessed scroll of genocide on h will wipe out both standard and master mind flayers. However, do not do this if you are a dwarf – dwarves are also h, and this self-genocide has resulted in a lot of annoying deaths. Instead, only use an unblessed scroll and genocide "mind flayer" and/or "master mind flayer".
If you can only genocide a single monster (e.g. from a throne), it is generally best to genocide the master mind flayer, as the summon nasties monster spell can conjure one right next to you. The standard mind flayer cannot be generated by this spell unless it randomly replaces a genocided or extinct nasty, so you will usually have a chance to deal with it before it gets in melee range.
If using the scroll of genocide, do check that it is not cursed! If you send in a group of master mind flayers, they may kill you quickly, either by causing brainlessness in a few short turns, or (if you scare them away) by locking on to your telepathy until you die. This may also leave an annoying bones level.
Warning to Monks: NetHack (pre-3.6.0) does not recognize the alternate spelling "master mindflayer". A Monk that attempts to genocide "master mindflayer" will instead genocide "master", thus wiping out all Monks and ending the game. This is because "master" is one of the rank titles for Monks, and NetHack ignores the extra word "mindflayer". (rgrn thread)
Both NetHack 3.6.0 and SLASH'EM recognize the "mindflayer" spelling, so it is okay to genocide "master mindflayer" in those games. But a typo like "master mindfalyer" can still wipe out all Monks and end the game.
Polymorphing into a master mind flayer is very useful, as its brain eating attack is deadly to nearly anything. Monsters do not suffer brainlessness in the manner that players do, as they lack INT scores. When a player eats a monster's brain, it instead deals an additional d10 points of damage to simulate the brain loss. Additionally, you will gain d30 nutrition per suck message without risk of choking, and if your INT score is below the maximum (i.e. your own brain was sucked) it will be increased by d4. Note that the INT increase is subject to the normal polymorphed attributes rules, and will be reset when you revert to your normal form. Beware, as sucking a green slime will cause delayed sliming, and eating a cockatrice's brain will cause immediate stoning AND delayed stoning (if the immediate stoning was life-saved). Sucking the brains of your race or other mind flayers will count as cannibalism as well. Eating brains is also not considered vegetarian, but this is only of interest to conduct players and monks.
Becoming a master mind flayer also gives you a +10 base AC boost and still allows you to wear all the same equipment you were wearing before (including weapons obviously), which is unique among the better fighter forms. On top of that, master mind flayers can fly and attack many times per turn which causes extreme damage to non-mindless enemies. Keep in mind, though, that your HP will most likely drop significantly (from say 250hp down to like 50) especially if you polymorph yourself at a high level. You can carry exactly as much as in your natural form.
Mind flayers are slightly different in SLASH'EM. First of all, for some reason, the master mind flayer has three brain-eating attacks, while the normal mind flayer has five, the reverse of the situation in vanilla nethack. More importantly, though, the ring of free action provides luck-based protection against their (and all grab-based) attacks, starting at a 50% of blocking each individual flay and increasing to a 90% chance at maxed-out luck. This, in combination with a greased helmet, renders them much less of a threat.
Also, in SLASH'EM, monsters can throw potions of amnesia, making a preventative genocide of mind flayers much less of a surefire protection against amnesia attacks. Additionally, another source of amnesia attacks is the intelligence drain sting attack from a migo queen.
Lastly, if you polymorph into an intelligent monster in SLASH'EM, generally you need not worry about petrifying monsters. This is true of mind flayers - instead of eating the cockatrice's brain and being stoned, you will instead simply not use your tentacle attack against it at all. Your weapon attack will still go forward, though. You will do normal damage to the monster, and if you attack it bare-handed (or do any of the myriad other things that will get you stoned), you will still turn to stone.
Mind flayers appear in Dungeons & Dragons as Illithids. D&D's creator, Gary Gygax, was reportedly inspired to create the monster after seeing cover art for a book by Brian Lumley.
This creature has a humanoid body, tentacles around its
covered mouth, and three long fingers on each hand. Mind
flayers are telepathic, and love to devour intelligent beings,
especially humans. If they hit their victim with a tentacle,
the mind flayer will slowly drain it of all intelligence,
eventually killing its victim.