NH4: Replace database's flavor text with item info

Each item description (unidentified) and item name (identified) gets a
basic description, at least those in vanilla NetHack.  It does not yet
include anything on artifacts or monsters.

For this dev branch specifically, it's also missing:

 * the many new appearances of potions, scrolls, spellbooks and more
 * new items e.g. tinfoil hat, iron safe, new gain foo rings
 * Cthulhu
 * ability to invoke the Amulet of Yendor
 * "irrational pi" for cream pies on Pi Day
 * splitting Tiamat from chromatic dragons
 * randomized dragon names in general

UnNetHack also subtly changes the way many items work, so some of the
entries may even be outright incorrect.

Compared to NetHack4, text has been wrapped to 72 characters (excluding
the omitted leading tab) in order to fit in an 80x24 terminal.  The
British English has been search-and-replaced with American English, and
periods are followed by two spaces for readability.

Replace the database of dubious flavour text with a database of item
spoilers
Alex Smith <ais523@bham.ac.uk>
b9afc36cc58c32317e868694ca1e1414e1b1ea84
NH4: Mark cursed light sources when they fail to light

Credit to Ryan Karl.

Compared to NetHack4, the Candelabrum only has its BUC state known if
it's actually cursed, and not when the player tries to light it while
engulfed.

Mark cursed light sources as cursed when they fail to light
Alex Smith <ais523@bham.ac.uk>
573618049f749d965b8a45e86f566a6f019e5437
Show spell memory in bar form

The remaining memory for each spell in spell menus is shown as an ASCII
bar.  Variants like NetHack4 and even UnNetHack instead show it as a
percentage, making it easy to confuse with the fail percent at a glance.

I also considered fuzzy words like 'good', 'fair' and 'poor' instead,
but I couldn't find a good balance between granularity and keeping the
words unambiguous, e.g. 'poor' versus 'bad'.
NH4: Stack items regardless of BUC knowledge

It was always dumb that dropping food rations on an altar caused them to
not merge with other food rations found randomly afterwards until those
were dropped on an altar too; now they'll merge even if some are known
to be blessed/uncursed/cursed and others aren't.

Allow stack-IDing of BCU even if the items are BCUed
Alex Smith <ais523@bham.ac.uk>
9156017985adc9ecc490c89bfa5055e7e7b0ac78
Stack items regardless of enchant/fixed knowledge

Average daggers a rogue finds will now stack with their starting
daggers, even if knowledge of their enchantment and rustproofing differ.
This also applies to darts, arrows, spears and the like.

Specifically, all objects with oc_merge and oc_uses_known bits set are
affected, and scanning through objects.c shows that this is exclusive to
fired projectile weapons and the stacked throwing weapons.

dknown is the last knowledge bit that prevents objects from stacking,
but I left that alone, since a blind hero probably shouldn't be able to
stack newly-found unseen potions/scrolls with seen ones.
NH4: Disallow changing to explore mode during a game

Disallow changing to explore mode during a game
Alex Smith <ais523@bham.ac.uk>
74dea97f1a7e2bca91a78b1ba37928ca6f423d6e
NH4: Formally ID wands if engraving gives a unique message

Credit to Christian Stegen.

Formally ID wants on engrave-ID, if it's obvious
Alex Smith <ais523@bham.ac.uk>
1e341842b09f3a8714f64ee6a97a5bfd85e91070
NH4: Don't merge unnamed items with named items

The only valid reason for unnamed items to ever merge with named items
was to cater to zen conduct players keeping informally BUC-ID'd stacks
of items like potions and scrolls, which has been addressed by
BUC-stacking in an earlier commit.  This conflicted with the far more
common use of item naming: to prevent items from stacking with each
other.

This is extracted from a commit in NetHack4.

AceHack-style item stacking
Alex Smith <ais523@bham.ac.uk>
0df7237f3af5a40d594bbac4fbb6e701b85dd18c
Don't put background colors behind monsters

Make sure hostile monsters are clearly visible even if they're on object
piles or stairs, which is the same behavior as on NAO.
Don't echo bogus coordinates when cancelling a position prompt

Pressing escape when choosing a location/position now shows "<position:
cancelled>" instead of "<position: (xx, yy)>" where xx and yy didn't
correspond to anything meaningful.

This bug also exists in NetHack4.
Allow hitting with polearms and lances in melee

Their weight and mediocre damage are enough incentive to consider other
weapons; not allowing them in melee made them useless in any dark place,
which describes 80% of the game.
Allow spellcasting if hands are stuck to a quarterstaff

This gives spellcasters slightly more incentive to use staffs.

Stuck hands is a really dumb mechanic in general, considering it blocks
spellcasting and container use (where you always keep holy water and
scrolls of remove curse), and prayer never works in Gehennom.  The
NetHack DevTeam's response to this is a new #tip command, but they
haven't released anything for a decade.  However, GruntHack has a
working implementation of exactly this command, which I'll probably end
up porting here at some point.
Fix C343-415: Mail daemons can be created when populating special levels with demons

Special level generation in NetHack and UnNetHack mask out G_NOGEN when
randomly creating monsters from a class, leading to mail daemons on
special levels that ask for '&' and chromatic dragons when they ask for
'D'.

This is inspired by a fix in GruntHack (also ported to NetHack4), but
replaces the hard-coding of Kops and eels with logic that checks that
all monsters of a class are flagged G_NOGEN before making an exception.

This replaces commit 0b268abae3 (respect G_NOGEN when making mon by
class on splevs).
CS1542: Remove gen freq from chromatic dragons

Generation frequency is pointless on a monster that is never randomly
generated.  In UnNetHack, this fixes randomly appearing chromatic
dragons, but this dev branch already fixes C343-415, so it isn't an
issue here.
CS1290: Re-add scrolls of earth to Sokoban

They give players more options to recover from mistakes or creatively
solve Sokoban, so I never agreed with their removal, and I'm glad
they're back.
Always give Cthulhu the Amulet of Yendor and a potion of full healing

For some reason I un-hardcoded these when I ported UnNetHack r644, even
though UnNetHack itself didn't.  For the sake of unity I'm making them
the same again.

This change will only be noticed if Cthulhu isn't generated in the
Sanctum, which should never happen in a normal game.
Don't inverse detected monsters, remove use_inverse option

Using inverse/reverse video for detected monsters was ugly, and the only
reason for the use_inverse option.  I'd used that option previously for
some bar drawing stuff because I thought I needed to, but just now I
realized that A_REVERSE is used freely in other places, so there's no
need for it anymore.
Add new #tip command to empty container contents onto the floor

A container in your inventory or on the floor beneath you can now have
its contents emptied to floor beneath you by tipping it.  This can be
done even with stuck hands (two-handers are no longer verboten in
Gehennom!), or if you have no limbs.

The code is loosely based on code from GruntHack, but it uses
UnNetHack's dump_container, extending it for cursed bags of holding.
This code handles locked containers, bags of tricks, burden, levitation,
sinks, altars and engulfing.

Known bug in related code: Exploding bags of holding in UnNetHack will
bypass engulfing monsters, and won't damage them.
Cross-training for related weapon skills

High-level weapon skills will accelerate the training of lesser skills
in the same skill groups by x2/x3/x4 (shown in the #enhance menu),
depending on the skill level difference.

The weapon skill groups are:

 * Short Blades: dagger, knife, short sword
 * Chopping Blades: axe, pick-axe, broadsword
 * Swords: short sword, broadsword, long sword, two-handed sword,
   scimitar, saber
 * Bludgeons: club, mace, morning star, flail, hammer, quarterstaff
 * Flails: morning star, flail, whip
 * Polearms: quarterstaff, polearm, spear, javelin, trident, lance,
   unicorn horn
 * Launchers: bow, sling, crossbow
 * Thrown: javelin, sling, dart, shuriken, boomerang

The skills that belong to more than one skill group are:

 * short sword: Short Blades, Swords
 * broadsword: Chopping Blades, Swords
 * morning star: Bludgeons, Flails
 * flail: Bludgeons, Flails
 * quarterstaff: Bludgeons, Polearms
 * javelin: Polearms, Thrown
 * sling: Launchers, Thrown

This counteracts the large training point increase of UnNetHack, and
means that advancing weapon skills that don't have the highest damage
output for the late-game is no longer a complete waste of time.

This commit also removes skill menu code that is unused in NitroHack.

See also Karadoc's K-Mod NetHack variant for a different take on skill
cross-training.
Make split room levels less boring

The room creation function was double-counting split room halves when
limiting the number of rooms made per level, sometimes leading to boring
levels with just four rooms horizontally aligned.

This also makes split room creation respect MAXNROFROOMS.