First off, no matter the corpse, never eat unless you just made that corpse or you have a method of preservation (tinning, icebox). Rotten corpses cause food poisoning (unless you're a fungus or a ghoul), and it doesn't take very long for a corpse to rot. And there isn't a visual indication of rotting, either, so the safe bet is to never eat something you didn't just kill. Most undead corpses are automatically rotten, as well. (See below for a more technical explanation.)
If the monster has poison or acid attacks, or is made of poison or acid, then there's a very high chance that you'll be poisoned or take acid damage. Both of these can be fatal, the former even instantly so, but poison and acid resistance will protect against this. Note that most poisonous corpses will chance to give you poison resistance, so this can be something to risk if you have enough health. Other elemental effects like fire, cold, and electricity are traditionally safe.
If the monster causes you to be stunned, hallucinating, or confused by natural attacks (as opposed to casting a spell), then it is highly likely you will be tripping after you eat its corpse. Some of these are very obvious. Actually, most creatures with negative effects like petrification will also carry over that effect with their corpse.
While it won't directly kill you, the corpses of teleporting creatures like imps, nymphs, tengu, and leprechauns will often give you teleportitis. Note that tengu do have a chance of giving you teleport control, so it's a good idea to start eating those when you do get stuck with teleportitis.
Unless you are of the Caveman profession or the Orc race, you are not a cannibal. This means that eating a member of your own race will give you a penalty in the form of the "Aggravate Monster" intrinsic (which is as bad as it sounds) and a penalty to your Luck. This penalty will also show up for non-Caveman, non-Orcs when eating any domestic dogs and cats (the line of creatures you can get as a starting pet, generally). Horses are fine to eat.
For specific exceptions, off the top of my head: k
obolds are always poisonous but never grant resistant. B
ats cause stunning. W
raiths are safe to eat despite being undead. All adult D
ragons are safe to eat, as well as most babies, but baby green dragons are poisonous unlike their adult counterpart. Lichen and Lizards do not rot over time and carry no negative effects that some other members of the same creature class might, so they make excellent backup food.
The rotting process is a little bit complicated and based on luck more than anything. Every 10 to 29 turns, a corpse gains a degree of rottenness. For a blessed corpse, 2 degrees are subtracted, while for a cursed one 2 degrees are added.
When it reaches a rottenness of 4, it is considered old. When you eat an old corpse, there's a 20% chance you will lose 1-8 hp, and a 1/7 chance of it being rotten (as in rotten food, not deadly.) When it reaches a rottenness of 6, it will give you fatal food poisoning, killing you in 11-19 turns.
So, put more simply, a corpse is definitely safe to eat in all cases for 32 turns, and it can cause food poisoning after a minimum of 48. Everything beyond that is just random chance.
Undead corpses start out with an age of 100 turns, which is why they are almost always already rotten.
Attributions for information provided within comments to:
- WillfulWizard for reminding about teleporting monsters.
- ire_and_curses for corrections on non-rotting lizards and poisonous baby green dragons.
- Kaestur Hakarl, who investigated and discovered the safe measures for cannibalism.
One thing that is very important in hell is fire resistance. The fire traps in Gehennom are particularly nasty because, unlike normal fire traps, they decrease your maximum HP unless you're resistant. You should also fireproof your armor (by reading a scroll of enchant armor while confused for example) and put all items that could burn or boil into a bag, so they won't be damaged or destroyed.
As to the level drainers: The best defense against level drain attacks is magic cancellation. If you have an item which offers level 3 magic cancellation, this will cause drain attacks to fail in most cases, making level drainers much more harmless.
For fighters it's also a good idea to have a silver saber as those are especially effective against demons and the undead (well, most undead - zombies don't care, but zombies aren't really dangerous at this stage anyway).
Also note that you can eat wraith corpses to gain levels.
General things you should do before you enter the end game:
Get your naked AC down to 2 or lower with divine protection (you can get it down to 0 quite easily via donations).
Have magic resistance and reflection.
Be fast (or preferably very fast)
Make sure all of your stats (except charisma) are close to or at their maximum
Enchant most of your armor to +4 or +5.
If you're a fighter, enchant your weapon to +6 or +7.
If you're a caster make sure that all your important spells are recent in your memory or you have the spellbook in your bag of holding. You do not want to forget magic missile while battling The Wizard or Death.
Make sure you have a means to detect portals (not important in Hell, but once you leave the dungeons, that's gonna come in handy and you do not want to have to go searching for gold detection scrolls after you have woken The Wizard).
You should also have a reliable way to cure sickness (blessed unicorn horn or cure sickness spell) as there will be a couple of enemies who can make you terminally ill.
Best Answer
Cursed non-corpse food items, with the exception of the fortune cookie, are always rotten when you eat them. So the first course of action tends to be testing to see if it is cursed or not. See the top of Kaestur's answer to this question for details on that, but the simplest method is to drop it on the ground and see if your pet will walk on it.
Past that, it's primarily a game of luck. As with corpses, there is no visual indication of whether food is rotten. But unlike the deadly corpses, there is actually a check made when you eat the food. It is only made after it has been a certain number of turns since the generation of the item. So two rations of equal age can have different results when eaten.
Certain foods are more likely to rot than others. Eggs rot the fastest, to my knowledge. Fruit tends to rot earlier and more often than rations, although they are quite unfilling. The corpses of Lizards and Lichens never rot. To memory, lembas wafers don't rot over time, but if they do then they have a significantly lower chance of being rotten when eaten (and not cursed).