[comp.sources.games] v03i003: NetHack2.2 - display oriented dungeons and dragons, Part03/20

games-request@tekred.TEK.COM (12/02/87)

Submitted by: mike@genat.UUCP (Mike Stephenson)
Comp.sources.games: Volume 3, Issue 3
Archive-name: nethack2.2/Part03



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 20)."
# Contents:  Guidebook.mn gold.h trap.c
# Wrapped by billr@tekred on Tue Dec  1 16:24:48 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f Guidebook.mn -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"Guidebook.mn\"
else
echo shar: Extracting \"Guidebook.mn\" \(31587 characters\)
sed "s/^X//" >Guidebook.mn <<'END_OF_Guidebook.mn'
X.ds h0 "A Guide to the Mazes of Menace
X.ds h1
X.ds h2 %
X.ds vr "Nethack Version 2.0
X.ds f0 "\*(vr
X.ds f1
X.ds f2 "September 25, 1987
X.mt
XA Guide to the Mazes of Menace
X.au
XEric S. Raymond
X.ai
XThyrsus Enterprises
XMalvern, PA 19355
X.hn 1
XIntroduction
X.pg
XYou have just finished your years as a student at the
Xlocal adventurer's guild.   After much practice and sweat you
Xhave finally completed your training and are ready to embark
Xupon a  perilous adventure.  As a test of your skills, the
Xlocal guildmasters have sent you into the Dungeons of Doom.
XYour task is to return with the Amulet of Yendor.  Your
Xreward for the completion of this task will be a  full
Xmembership in the local guild.  In addition, you are allowed
Xto keep all the loot you bring back from the dungeons.
X.pg
XYou have abilities and strengths for dealing with the
Xhazards of adventure that will vary depending on your background
Xand training. Here is a summary of the character classes:
X.pg
X\fICavemen\fR and \fICavewomen\fR start with exceptional strength and
Xneolithic weapons.
X.pg
X\fITourists\fR start out with lots of gold (suitable for shopping with)
Xand an expensive camera. Most monsters don't like being photographed.
X.pg
X\fIWizards\fR start out with a fair selection of magical goodies and
Xa particular affinity for things thaumaturgical.
X.pg
X\fIArcheologists\fR understand dungeons pretty well. This makes them
Xable to move quickly and sneak up on dungeon nasties. They start equipped
Xwith proper tools for a scientific expedition.
X.pg
X\fIElves\fR are agile and quick and have keen senses; very little of
Xwhat goes on around an Elf will escape him or her. The quality of Elven
Xcraftsmanship often gives them an advantage in weapons and armor.
X.pg
X\fIValkyries\fR are hardy warrior women. Their upbringing in the harsh
XNorthlands makes them strong and inures them to extremes of cold, and instills
Xstealth and cunning in them.
X.pg
X\fIHealers\fR are wise in the apothecary and medical arts. They know the
Xherbs and simples that can restore vitality and ease pain and neutralize
Xpoisons, and they can divine a being's state of health or sickness.
X.pg
X\fIKnights\fR are distinguished from the common run of fighter by their
Xdevotion to the ideal of chivalry and the surpassing excellence of their
Xarmor.
X.pg
X\fIBarbarians\fR are warriors out of the hinterland, hardened to battle.
XThey begin their quests with naught but uncommon strength, a trusty hauberk,
Xand a great two-handed sword.
X.pg
X\fISamurai\fR are the elite warriors of feudal Nippon. They are lightly
Xarmored and quick, and wear the \fIdai-sho\fR, two swords of the deadliest
Xsharpness.
X.pg
X\fINinja\fR are the spy-assassins of Japan. They are quick and stealthy,
Xthough not as strong as fighters. Their characteristic weapon is the deadly
X\fIshuriken\fR or throwing-star.
X.pg
X\fIPriests\fR and \fIPriestesses\fR are clerics militant, armed and
Xarmored to advance the cause of righteousness but also equipped with some
Xskills in arts thaumaturgic. Their ability to commune with deities via prayer
Xoccasionally extricates them from peril -- but can also put them in it.
X.pg
XYou set out on your way to the dungeons and after
Xseveral days of uneventful travel, you see the ancient ruins
Xthat mark the entrance to the Mazes of Menace.  It is late
Xat night,  so you make camp at the entrance and spend the
Xnight sleeping under the open skies.   In the morning you
Xgather your weapons and devices, eat what is almost
Xyour last food, and enter the dungeons.
X.hn 1
XWhat is going on here?
X.pg
XYou have just begun a game of nethack.  Your goal is to
Xgrab as much treasure as you can, find the Amulet of Yendor,
Xand get out of the Mazes of Menace alive.  On the screen, a
Xmap of where you have been and what you have seen on the
Xcurrent dungeon level is kept.  As you explore more of the
Xlevel, it appears on the screen in front of you.
X.pg
XNethack differs from most computer fantasy games (other
Xthan its ancestors hack and rogue and its cousin larn) in that
Xit is screen oriented.  Commands are all one or two keystrokes
X(as opposed to sentences in some losing parser's notion
Xof English) and the results of your commands are displayed
Xgraphically on the screen rather than being explained in
Xwords (a minimum screen size of 24 lines by  80  columns is
Xrequired; if the screen is larger, only a 24x80 section
Xwill be used for the map).
X.pg
XAnother major difference between nethack and other computer
Xfantasy games is that once you have solved all the
Xpuzzles in a standard fantasy game, it has lost most of its
Xexcitement and it ceases to be fun.  Nethack, on the other
Xhand, generates a new dungeon every time you play it and
Xeven the authors still find it an entertaining and exciting game.
X.hn 1
XWhat do all those things on the screen mean?
X.pg
XIn order to understand what is going on in nethack you
Xhave to first get some grasp of what nethack is doing with the
Xscreen.  The nethack screen is intended to replace the  "You
Xcan see ..." descriptions of text fantasy games.  Figure
X1 is a sample of what a nethack screen might look like.
X.hn 2
XThe bottom line
X.pg
XAt the bottom line of the screen are a  few pieces of
Xcryptic information describing your current status.  Here is
Xan explanation of what these things mean:
X.lp Level
XThis number indicates how deep you have gone in the
Xdungeon.   It starts at one and goes up as you go
Xdeeper into the dungeon.
X.lp Gold
XThe number of gold pieces you have managed to find
Xand keep with you so far.
X.lp Hp
XYour current and maximum health points.   Health
Xpoints indicate how much damage you can take before
Xyou die.  The more you get hit in a fight, the lower
Xthey get.   You can regain health points by resting.
XThe number in parentheses is the maximum number your
Xhealth points can reach.
X.sd
X____________________________________________________________
X
X    ------------
X    |..........+
X    |..@....]..|
X    |....B.....|
X    |..........|
X    -----+------
X
X
X
XLev 1  Gp 0  Hp 12(12) Ep 3(3)  Ac 8  Str 16(16)  Exp: 1/0
X____________________________________________________________
X.ed
X.ce 1
XFigure 1
X
X.lp Ep
XEnergy points. This tells you the level of mystic energy
Xyou have available for spell casting. When you type `x' to
Xlist your spells, each will have a spell point cost beside
Xit in parentheses. You will not see this if your site's version
Xof the game has been configured to omit spells.
X.lp Ac
XYour current armor protection.  This number indicates
Xhow effective your armor is in stopping blows from
Xunfriendly creatures.  The lower this number is, the
Xmore effective the armor.
X.lp Str
XYour current strength and maximum ever strength.
XThis can be any integer less than or equal to 18, or
Xgreater than or equal to three (occasionally you
Xmay get super-strengths of the form 18/xx). The higher the
Xnumber,  the stronger you are. The number in the
Xparentheses is the maximum strength you have attained
Xso far this game.
X.lp Exp
XThese two numbers give your current experience level
Xand experience points.   As you do things, you gain
Xexperience points.   At certain experience point
Xtotals,  you gain an experience level.   The more
Xexperienced you are, the better you are able to fight
Xand to withstand magical attacks.
X.hn 2
XThe top line
X.pg
XThe top line of the screen is reserved for printing
Xmessages that describe things that are impossible to
Xrepresent visually.  If you see a  "--More--"  on the top
Xline,  this means that nethack wants to print another message
Xon the screen, but it wants to make certain that you have
Xread the one that is there first.  To read the next message,
Xjust type a space.
X.hn 2
XThe rest of the screen
X.pg
XThe rest of the screen is the map of the level as you
Xhave explored it so far.   Each symbol on the screen
Xrepresents something.  Here is a list of what the various
Xsymbols mean:
X.lp "- and |
XThese form the walls of a room (or maze).
X.lp .
Xthis is the floor of a room.
X.lp #
Xthis is a corridor.
X.lp >
Xthis is the staircase to the next level.
X.lp <
Xthe staircase to the previous level.
X.lp `
XA large boulder.
X.lp @
XYou (usually) or another human.
X.lp ^
XA trap.
X.lp )
XA weapon of some sort.
X.lp (
XSome other useful object (key, rope, dynamite, camera...)
X.lp [
XA suit of armor.
X.lp %
XA piece of food (not necessarily healthy...).
X.lp /
XA wand.
X.lp =
XA ring.
X.lp ?
XA scroll.
X.lp !
XA magic potion.
X.lp +
XA spellbook containing a spell you can learn; (but usually a doorway).
X.lp }
XA pool of water
X.lp {
XA fountain (your dungeon may not have these).
X.lp "\\\\
XAn opulent throne (You may not have this either).
X.lp $
XA pile or pot of gold.
X.lp a-zA-Z
XThe uppercase letters represent the various inhabitants
Xof the Mazes of Menace.  Watch out, they can be nasty
Xand vicious.  Sometimes, however, they can be helpful.
X.hn 1
XCommands
X.pg
XCommands are given to nethack by typing one or two characters.
XMost commands can be preceded by a count to repeat
Xthem (e.g. typing "10s" will do ten searches).  Commands for
Xwhich counts make no sense have the count ignored.  To cancel
Xa count or a prefix, type <ESCAPE>.  The list of commands is rather long,
Xbut it can be read at any time during
Xthe game with the "?" command.  Here it is for reference,
Xwith a short explanation of each command.
X.lp ?
Xhelp: print a help list.
X.lp Q
XQuit the game.
X.lp S
XSave the game.
X.lp !
XEscape to a shell.
X.lp ^Z
XSuspend the game (UNIX versions with job control only).
X.lp <
Xup: go up the staircase (if you are standing on it).
X.lp >
Xdown: go down (just like up).
X.lp [kjhlyubn]
Xgo one step in the direction indicated.
X.sd
X    k: north (i.e., to the top of the screen),
X    j: south, h: west, l: east, y: ne, u: nw, b: se, n: sw.
X.ed
X.lp KJHLYUBN
XGo in that direction until you hit a wall or run into something.
X.lp m[kjhlyubn]
Xprefix: move without picking up any objects.
X.lp M[kjhlyubn]
Xprefix: move far, no pickup.
X.lp g[kjhlyubn]
Xprefix: move until something interesting is found.
X.lp G[kjhlyubn]
Xas previous, but forking of corridors is not considered interesting.
X.lp i
Xprint your inventory.
X.lp I
Xprint selected parts of your inventory, like in
X.sd
X    I* - all gems in inventory;
X    IU - all unpaid items;
X    IX - all used up items that are on your shopping bill;
X    I$ - count your money.
X.ed
X.lp s
Xsearch for secret doors and traps around you.
X.lp ^
Xask for the type of a trap you found earlier.
X.lp )
Xask for current wielded weapon.
X.lp [
Xask for current armor.
X.lp =
Xask for current rings.
X.lp $
Xcount how many gold pieces you are carrying.
X.lp .
Xrest, do nothing.
X.lp ,
Xpick up some things.
X.lp :
Xlook at what is here.
X.lp ^T
Xteleport.
X.lp ^R
Xredraw the screen.
X.lp ^P
Xrepeat last message (subsequent ^P's repeat earlier messages).
X.lp /
X(followed by any symbol) tell what this symbol
Xrepresents.If you see fancy graphics on your screen
Xit may ask you to specify a location rather than
Xtaking a symbol argument.
X.lp "\\\\
Xtell what has been discovered.
X.lp e
Xeat food.
X.lp w
Xwield weapon. w- means: wield nothing, use bare hands.
X.lp q
Xdrink (quaff) a potion.
X.lp r
Xread a scroll.
X.lp T
XTakeoff armor.
X.Lp R
XRemove Ring.
X.lp W
XWear armor.
X.lp P
XPut on a ring.
X.lp X
Xtranscribe (learn) a spell.
X.lp x
Xprint a list of know spells.
X.lp z
Xzap a wand.
X.lp Z
Xzap a spell; same as the `# cast' extended command
X.lp t
Xthrow an object or shoot an arrow.
X.lp p
Xpay your shopping bill.
X.lp d
Xdrop something. d7a: drop seven items of object a.
X.lp D
XDrop several things.
XIn answer to the question "What kinds of things do you
Xwant to drop? [!%= au]" you should give zero or more
Xobject symbols possibly followed by 'a' and/or 'u'.
X'a' means: drop all such objects, without asking for confirmation.
X'u' means: drop only unpaid objects (when in a shop).
X.lp a
Xapply - Generic command for using a key to lock
Xor unlock a door, using a camera, using a rope, etc.
X.lp c
Xcall: name a certain object or class of objects.
X.lp C
XCall: Name an individual monster.
X.lp E
XEngrave: Write a message in the dust on the floor.
XE- means: use fingers for writing.
X.lp O
XSet options. You will be asked to enter an option line.
XIf this is empty, the current options are reported.
XOtherwise it should be a list of options separated
Xby commas. Possible boolean options are: oneline, time,
Xnews, tombstone, rest_on_space, fixinvlet, beginner,
Xmale, female. They can be negated by prefixing them with
X'!' or "no". A string option is name; it supplies the
Xanswer to the question"Who are you?"; it may have a
Xsuffix. A compound option is endgame; it is followed by a
Xdescription of what parts of the list of topscorers
Xshould be printed when the game is finished. There is
Xalso a graphics option that sets the characters used for
Xscreen displays. Usually one will not want to use the 'O'
Xcommand, but instead put a HACKOPTIONS="...." line in
Xone's environment.
X.lp v
Xprint version number.
X.lp V
Xdisplay the game history (about one page).
X.pg
XYou can put a number before most commands to repeat them that many times,
Xas in "20s" or "40.".
X.hn 1
XRooms
X.pg
XRooms in the dungeons are either lit or dark.   If you
Xwalk into a lit room, the entire room will be drawn on the
Xscreen as soon as you enter.  If you walk into a dark room,
Xit will only be displayed as you explore it.  Upon leaving a
Xroom, all monsters inside the room are erased from the
Xscreen.   In the darkness you can only see one space in all
Xdirections around you.  A corridor is always dark.
X.hn 1
XFighting
X.pg
XIf you see a monster and you wish to fight it,  just
Xattempt to run into it.  Many times a monster you find will
Xmind its own business unless you attack it.  It is often the
Xcase that discretion is the better part of valor.
X.hn 1
XObjects you can find
X.pg
XWhen you find something in the dungeon, it is common to
Xwant to pick the object up.  This is accomplished in nethack
Xby walking over the object (unless you use the  "m"  prefix,
Xsee above).   If you are carrying too many things, the program
Xwill tell you and it won't pick up the object,  otherwise
Xit will add it to your pack and tell you what you just picked up.
X.pg
XMany of the commands that operate on objects must
Xprompt you to find out which object you want to use.  If you
Xchange your mind and don't want to do that command after
Xall, just type an <ESCAPE> and the command will be aborted.
X.pg
XSome objects, like armor and weapons, are easily differentiated.
XOthers,  like scrolls and potions, are given
Xlabels which vary according to type.  During a game, any two
Xof the same kind of object with the same label are the same
Xtype.  However, the labels will vary from game to game.
X.pg
XWhen you use one of these labeled objects,  if its
Xeffect is obvious, nethack will remember what it is for you.
XIf its effect isn't extremely obvious you will be asked
Xwhat you want to scribble on it so you will recognize it
Xlater, or you can use the "call" command (see above).
X.hn 2
XWeapons
X.pg
XSome weapons, like arrows, come in bunches,  but most
Xcome one at a  time.   In order to use a weapon, you must
Xwield it.  To fire an arrow out of a  bow,  you must first
Xwield the bow, then throw the arrow.  You can only wield one
Xweapon at a time, but you can't change weapons if the one
Xyou are currently wielding is cursed.  The commands to use
Xweapons are "w" (wield) and "t" (throw).
X.hn 2
XArmor
X.pg
XThere are various sorts of armor lying around in the
Xdungeon.   Some of it is enchanted, some is cursed, and some
Xis just normal.  Different armor types have different armor
Xprotection.   The higher the armor protection, the more protection
Xthe armor affords against the blows of monsters.
XHere is a partial list of the various armor types and the level of
Xarmor protection each will give.
X.sd
X	plate mail               3
X	splint mail              4
X	banded mail		 4
X	chain mail		 5
X	scale mail		 6
X	ring mail		 7
X	studded leather armor    7
X	leather armor	         8
X	elven cloak		 9
X.ed
X.pg
XIf a piece of armor is enchanted, its armor protection will
Xbe higher than normal.  If a suit of armor is cursed, its
Xarmor protection will be lower, and you will not be able to
Xremove it.  However, not all armor with a protection that is
Xlower than normal is cursed and some enchanted armor is also
X"cursed" preventing removal.
X.pg
XThe commands to use weapons are  "W"  (wear)  and  "T"
X(take off).
X.hn 2
XScrolls
X.pg
XScrolls come with titles in an unknown tongue.
XAfter you read a scroll, it disappears from your pack.  The
Xcommand to use a scroll is "r" (read).
X.hn 2
XPotions
X.pg
XPotions are labeled by the color of the liquid inside
Xthe flask.  They disappear after being quaffed.  The command
Xto use a scroll is "q" (quaff).
X.hn 2
XStaves and Wands
X.pg
XStaves and wands do the same kinds of things.   Staves
Xare identified by a type of wood; wands by a type of metal
Xor bone.  They are generally things you want to do to something
Xover a long distance, so you must point them at what
Xyou wish to affect to use them.   Some staves are not
Xaffected by the direction they are pointed, though.   Staves
Xcome with multiple magic charges, the number being random,
Xand when they are used up, the staff is just a piece of wood
Xor metal.
X.pg
XThe command to use a wand or staff is "z" (zap)
X.hn 2
XRings
X.pg
XRings are very useful items, since they are relatively
Xpermanent magic,  unlike the usually fleeting effects of
Xpotions, scrolls, and staves.  Of course, both good and bad rings are
Xmore powerful.   Most rings also cause you to use up
Xfood more rapidly, the rate varying with the type of ring.
XRings are differentiated by their stone settings.  Some rings are
Xcursed, preventing removal.  This can happen to helpful and
Xharmful rings alike.
X.pg
XThe commands to use rings are "P" (put on) and "R" (remove).
X.hn 2
XSpellbooks
X.pg
XSpellbooks are tomes of mighty magic. When read with the `transcribe' command
XX, they plant the knowledge of a spell in your head and disappear \- unless
Xthe attempt backfires. Reading a spellbook can be harmful to your health if
Xit is cursed or the mystic runes are at too high a level for your thaumaturgic
Xskills!
X.pg
XCasting spells can also backfire.  If you attempt to cast a spell well above
Xyour level, or cast it at a time when your luck is particularly bad, you can
Xend up wasting both the energy and the time required in casting.
X.pg
XThe `x' command lists your current spells, each preceded by the spell points
Xthey require. to cast a spell, type `Z' and answer the questions.
X.hn 2
XFood
X.pg
XFood is necessary to keep you going.   If you go too
Xlong without eating you will faint, and eventually die of
Xstarvation.  The command to use food is "e" (eat).
X.hn 2
XOptions
X.pg
XDue to variations in personal tastes and conceptions of
Xthe way nethack should do things, there are a set of options
Xyou can set that cause nethack to behave in various different
Xways.
X.hn 2
XSetting the options
X.pg
XThere are two ways to set the options.   The first is
Xwith the  "O"  command of nethack;  the second is with the
X"HACKOPTIONS" environment variable.
X.hn 2
XUsing the `O' command
X.pg
XWhen you type "O" in nethack, it queries you for an option string which
Xis parsed as though it were a HACKOPTIONS value.
X.hn 2
XUsing the HACKOPTIONS variable
X.pg
XThe HACKOPTIONS variable is a string containing a  comma-separated list of
Xinitial values for the various options. Boolean variables can be turned on by
Xlisting their name or turned off by putting a `!' or "no" in front of the name.
XYou can set string variables by following the variable name with a colon
X(this character was chosen over = to avoid conflict with the ring symbol)
Xand the value of the string. The value is terminated by the next comma or
Xthe end of string.
X.pg
XThus to set up an environment variable so that `female' is on, `pickup' is
Xoff, and the name is set to "Blue Meanie", you would enter
Xthe command
X.sd
X% setenv HACKOPTIONS "female,!pickup,name:Blue Meanie"
X.ed
Xin csh, or
X.sd
X$ HACKOPTIONS="female,!pickup,name:Blue Meanie"
X$ export HACKOPTIONS
X.ed
Xin sh or ksh.
X.hn 2
XCustomization options
X.pg
XHere is a list of the options and an explanation of
Xwhat each one is for.   The default value for each is
Xenclosed in square brackets.  For character string options,
Xinput over fifty characters will be ignored.
X.pg
XNote: some of the options listed may be inactive if the game has been
Xsubsetted.
X.lp standout
X(default on) use standout where appropriate in display lists.
X.lp null\ \ \ \ 
X(default off) don't send padding nulls to the tty.
X.lp tombstone
X(default on) display tombstone graphic on death.
X.lp news\ \ \ \ 
X(default on) read hack news if present.
X.lp conf\ \ \ \ 
X(default on) have user confirm attacks on dogs and shopkeepers.
X.lp silent
X(default on) suppress terminal beeps.
X.lp pick\ \ \ \ 
X(default on) pick up things you move onto by default.
X.lp IBMB\ \ \ \ 
X(default off, PC-HACK only) for machines with an IBM-PC compatible BIOS ROM.
X.lp DECR\ \ \ \ 
X(default off, PC-HACK only) for machines with DEC Rainbow compatible BIOS ROMs.
X.lp rawi\ \ \ \ 
X(default off) force raw (not cbreak mode) input.
X.lp sort\ \ \ \ 
X(default on) sort the pack contents by type when displaying inventory.
X.lp packorder
X(default `)[%?+/=!(*0  )') specify order to list object types in. The value of
Xthis option should be a string containing the symbols for the various object
Xtypes.
X.lp dogname
Xgive your (first) dog a name (eg. dogname:Fang).
X.lp time\ \ \ \ 
X(default off) show game time in turns on bottom line.
X.lp restonspace
X(default off) make spacebar a synonym for `.'.
X.lp fixinv
X(default on) an object's inventory letter sticks to it until it's dropped.
XIf this is off, everything after a dropped object shifts letters.
X.lp male\ \ \ \ 
X(default on, most hackers are male) sets the player-character's sex.
X.lp female
X(default off) sets the player-character's sex (equal-opportunity feature :-)).
X.lp name\ \ \ \ 
X(defaults to player's username) Set the player-character's name.
X.lp graphics
X(default ` |-++++.:<>^{}\\"') set the graphics symbols for screen displays.
XThe graphics option (if used) should be last, followed by a string of up to ",
X17 chars to be used instead of the default map-drawing chars. Replacing for
Xany of these chars causes it to be replaced in the dungeon level displays,
Xexcept that the five instances of + are used for top left, top right, bottom
Xleft, bottom right and door squares respectively. The last four characters
Xare required only if the corresponding options are configured in.
X.lp endgame
XEndgame is followed by a description of what parts of the scorelist
Xyou want to see. You might for example say:
X.sd
X`endgame:own scores/5 top scores/4 around my score'.
X.ed
XIn the PC-HACK version, options may be set in a configuration file on disk
Xas well as from the hack options.
X.hn 2
XScoring
X.pg
XNethack usually maintains a list of the top scoring people
Xor scores on your machine.  Depending on how it is set
Xup, it can post either the top scores or the top players.
XIn the latter case,  each account on the machine can post
Xonly one non-winning score on this list.   If you score
Xhigher than someone else on this list, or better your previous
Xscore on the list, you will be inserted in the proper
Xplace under your current name.  How many scores are kept can
Xalso be set up by whoever installs it on your machine.
X.pg
XIf you quit the game, you get out with all of your gold
Xintact.   If,  however,  you get killed in the Dungeons of
XDoom, your body is forwarded to your next-of-kin, along with
X90%  of your gold; ten percent of your gold is kept by the
XDungeons' wizard as a fee.  This should make you consider
Xwhether you want to take one last hit at that monster and
Xpossibly live, or quit and thus stop with whatever you have.
XIf you quit, you do get all your gold, but if you swing and
Xlive, you might find more.
X.pg
XIf you just want to see what the current top players/
Xgames list is, you can type
X.sd
X% nethack -s
X.ed
X
X.hn
XCredits
X.pg
XThe original hack game was modeled on the Berkeley UNIX `rogue' game.
XLarge portions of this paper were shamelessly cribbed from \fUA Guide to the
XDungeons of Doom\fR, by Michael C. Toy and Kenneth C. R. C. Arnold.
X.pg
XNetHack is the product of literally dozens of people's work. A list of
X\fIsome\fR of those who made major additions to the game appears below:
X.lp "Jay Fenlason
Xwrote the original release of "Hack", with help	from Kenny Woodland, Mike
XThome and Jon Payne.
X.lp "Andries Brouwer
Xdid a major re-write on the program and	publshed (at least) two versions to
Xthe Usenet.
X.lp "Don G. Kneller
Xported the 1.0.3 version of Hack to the PC, creating PC-Hack.
X.pg
XThe following folks didn't actually re-write the game, or port it to
Xa new machine, but have made significant contributions to the playability of
Xthe game:
X.lp "ins_akaa@jhunix.UUCP (Ken Arromdee)
XNew character classes. New weapons code. Armor weights implemented. New tools
Xcode. Polymorph Self code. Bug fixes.
X.lp "srt@ucla-cs (Scott R. Turner)
XRockmole & Keystone Kops code. Squeaky Board & Magic traps. Fountain code.
XMore bug fixes.
X.lp "gil@cornell.UUCP (Gil Neiger)
XMagic Marker code. Fountain code enhancements. Enhancements to dozens of
Xroutines. More bug fixes (esp. in hack.zap.c).
X.lp "ericb@hplsla.UUCP (Eric Backus)
XThe #dip mods to fountain code. Yet more bug fixes.
X.lp "mike@genat.UUCP (Mike Stephenson)
XNew character classes and traps. Throne Rooms. Spellbooks and spellcasting.
XPraying. Endgame enhancements. Nethack release and coordination.
X.lp "eric@snark (Eric S. Raymond)
XThe GRAPHICS option. Changes to make character classes more individual and
Xmythohistorically authentic. Better random-number generation. The blindfold
Xtool. The 'Z' spellcasting command synonym. General cleanup of much grotty
Xcode, removal of magic numbers. More bug fixes. This Guide you're reading.
X.pg
XYou too can enhance this game and join the hallowed ranks of the
Xnet.benefactors. Happy hacking!
X.hu
XAppendix A: Weapon Types in Hack
X.pg
XThis material is adapted from a digest of email replies to Carole Chang
X(carole@uhcc.uhccux.ha). Major sources were:
X.sd
X	Paul Anderson		pha@net1.ucsd.edu
X	Vernon Lee		scorpion@rice.edu
X	Bryan Ewbank		ihlph!bdewbank
X.ed
XSome terminological corrections (notably the correct set of distinctions for
Xthe great mace/morningstar/flail controversy) were made by your editor
X(eric@snark), and a good bit of historical context added.
X
X.hn 2
XPolearms
X.pg
XThe following weapons are all "pole arms", meaning that they are
Xwooden shafts (5-9' long) capped with a particular weapon-head. We
Xlist these first as they are most likely to mystify a novice hacker.
X.lp glaive
Xa short polearm with a straight blade at the end of the shaft. Rare in Europe;
Xmore popular in non-Western cultures under other names, as in the Zulu war
Xassegai and Japanese ashigaru's pike.
X.lp halberd
Xa long (typically 6' or more) polearm ending with a single axe-head, backed by a
Xspike and tipped by a spear-head. An extremely popular weapon in Europe from
Xthe Dark Ages to as late as 1650. You can see them in pictures of royal or elite
XSpanish, English, and French troops or the Vatican's Swiss Guards.
X.lp bill-guisarme
Xa polearm, ends in a spear-head with a spike on one side and a hook on the
Xother.
X.lp fauchard
Xa polearm topped by a curved sickle-blade.
X.lp bec-de-corbin
X(literally "crow's-beak") a polearm ending in a stout spear-point, with a
Xsmall axe-head on one side and a beak-shaped spike on the other. This weapon
Xwas designed to act like a can-opener for infantry fighting plate-armored
Xknights.
X.lp guisarme
Xa polearm, ends with a sharpened pruning hook.
X.lp spetum
Xa polearm, ends with a spear-blade that has a smaller blade jutting
Xat an angle from either side; the idea was to catch an opponent's
Xweapon between two blades and disarm him with a twist of the shaft.
XCompare the japanese \fIsai\fR.
X.lp partisan
Xa polearm, has a spear-head with a small axe-head to either side. Peasant
Xlevies often carried these; hence our modern usage of `partisans' to
Xdescribe guerilla or irregular troops.
X.lp lucern hammer
Xa polearm, ends in a forward-pointing and one or more curved, downward-pointing
X(i.e.perpendicular) spikes. Named after the Swiss city and canton of Lucerne.
X.lp voulge
Xa polearm, with a straight single-edged blade depending from one side of the
Xshaft's end.  
X.lp ranseur
Xa polearm, ends with a broad spear-head with a flat base, and a broader
X"hilt" (often a straight piece with sharpened ends) behind it. As with the
Xspetum, the idea was to catch weapons between the blade and "hilt".
X
X
X.hn 2
XBlade weapons
X.pg
XBlades were, in most pre-gunpowder martial cultures, the preferred weapon for
Xone-on-one combat. Nethack includes several kinds:
X.lp dagger
Xbroadly speaking, could describe any blade less than about two feet long. But
X`dagger' tends to suggest a hilted, double-edged weapon.
X.lp short swords
Xare 2-3' long and used for stabbing. The Roman legionary's \fIgladius\fR and
Xthe American frontiersman's Bowie knife were both short swords.
X.lp broad swords
Xare 3-4' long; they have sharpened edged for chopping and cleaving.
X.lp long swords
Xare also 3-4' long; they are narrower with sharpened tips for stabbing and
Xslashing.
X.lp two-handed swords
Xare 5-6' long, with long handles because they require both hands to use.
X.lp bastard sword
Xa cleaving weapon 4-5' long, which can be wielded with one or (more 
Xeffectively) two hands.
X.lp scimitar
Xa type of curved, single-edged blade popular since ancient times in the
XNear East, designed for slashing and drawing strokes. Recent European weapons
Xmodeled on it include the sabre and cutlass.
X.lp katana
Xthe long, slender, sabre-like swords of the Japanese samurai, often considered
Xthe finest blade weapons ever made. Japanese forging techniques produced
Xwhat was in effect a micro-layered composite of high and low carbon steels,
Xgiving the blade its unique razor-sharpness and flexibility.
X
X.hn 2
XMissile weapons
X.pg
XThese are all weapons meant to transfer kinetic energy to a target via a rigid
Xthrown projectile.
X.lp bow
Xin nethack, probably represents the 'self bow', a smaller single-piece or
Xcomposite bow firing short feather-quilled arrows (rather than the classic
XRobin Hood longbow with its yard-long shafts).
X.lp crossbow
Xa mechanically-cranked bow firing stubby conical-profile bolts, sometimes
Xfinned. Had a lower rate of fire than the self- or long-bow but fearsome
Xpenetrating power.
X.lp javelin
Xa lightweight, flexible throwing spear.
X.lp dart
Xnot the three-inch, needle-pointed pub dart associated with ale and tweed
Xcaps; rather, its progenitor, a shorter javelin-like projectile that was
Xmostly soft-iron head. Barrages of these were thrown as first volleys in
Xinfantry skirmishes to foul the opponents' shields.
X.lp shuriken
Xa flat, spiked wheel designed to be thrown with a wrist-flick so the blades
Xspin like a buzz-saw in flight. Also called a `throwing star' or (in India)
Xthe `chakram'.
X
X.hn 2
XMiscellaneous strange weapons
X.lp bardiche
X(literally, "bearded axe") a short shaft (5') with an enormous long axe-head,
Xconnected at at least two places. Basically a huge axe (or a short voulge).
X.lp morning-star
Xusually a spiked ball attached by a chain to a truncheon-like handle. The
Xterm is sometimes used to describe maces with spiked heads.
X.lp flail
Xseveral chains, possibly spiked and possibly with small balls on the ends,
Xstapled to a truncheon. 
X.lp crysknife
Xa fantasy weapon adapted from Frank Herbert's "Dune" books. On Herbert's
XArrakis, the fierce Fremen made their personal weapons from the scimitar
Xteeth of the \fIshai hulud\fR, the great sandworms of the Dune deserts.
X.lp aklys
Xa long thong with a weight at the end. Holding the
Xother end of the thong, you throw the weight; the thong entangles
Xthe target, and the weight whaps it.
END_OF_Guidebook.mn
if test 31587 -ne `wc -c <Guidebook.mn`; then
    echo shar: \"Guidebook.mn\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f gold.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"gold.h\"
else
echo shar: Extracting \"gold.h\" \(311 characters\)
sed "s/^X//" >gold.h <<'END_OF_gold.h'
X/*	SCCS Id: @(#)gold.h	1.4	87/08/08
X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
X/* gold.h - version 1.0.2 */
X
Xstruct gold {
X	struct gold *ngold;
X	xchar gx,gy;
X	long amount;
X};
X
Xextern struct gold *fgold;
Xstruct gold *g_at();
X#define newgold()	(struct gold *) alloc(sizeof(struct gold))
END_OF_gold.h
if test 311 -ne `wc -c <gold.h`; then
    echo shar: \"gold.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f trap.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"trap.c\"
else
echo shar: Extracting \"trap.c\" \(20311 characters\)
sed "s/^X//" >trap.c <<'END_OF_trap.c'
X/*	SCCS Id: @(#)trap.c	2.1	87/10/18
X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
X
X#include	<stdio.h>
X#include	"hack.h"
X
Xextern struct monst *makemon();
X#ifdef KAA
Xextern char *Xmonnam();
Xextern char *nomovemsg;
X#endif
X
Xchar vowels[] = "aeiou";
X
Xchar *traps[] = {
X	"",
X	" bear trap",
X	"n arrow trap",
X	" dart trap",
X	" trapdoor",
X	" teleportation trap",
X	" pit",
X	" sleeping gas trap",
X	" piercer",
X	" mimic"
X#ifdef NEWTRAPS
X	," magic trap"
X	," squeaky board"
X#endif
X#ifdef SPIDERS
X	," web"
X#endif
X#ifdef NEWCLASS
X	," spiked pit"
X	," level teleporter"
X#endif
X#ifdef SPELLS
X	," anti-magic field" 
X#endif
X#ifdef KAA
X	," rust trap"
X# ifdef RPH
X	,"polymorph trap"
X# endif
X#endif
X};
X
Xstruct trap *
Xmaketrap(x,y,typ)
Xregister x,y,typ;
X{
X	register struct trap *ttmp;
X
X	ttmp = newtrap();
X	ttmp->ttyp = typ;
X	ttmp->tseen = 0;
X	ttmp->once = 0;
X	ttmp->tx = x;
X	ttmp->ty = y;
X	ttmp->ntrap = ftrap;
X	ftrap = ttmp;
X	return(ttmp);
X}
X
Xdotrap(trap) register struct trap *trap; {
X	register int ttype = trap->ttyp;
X	register struct monst *mtmp;
X
X	nomul(0);
X	if(trap->tseen && !rn2(5) && !(ttype == PIT
X#ifdef NEWCLASS
X	   || ttype == SPIKED_PIT
X#endif
X#ifdef SPELLS
X	   || ttype == ANTI_MAGIC
X#endif
X		))
X		pline("You escape a%s.", traps[ttype]);
X	else {
X		trap->tseen = 1;
X		switch(ttype) {
X		case SLP_GAS_TRAP:
X			pline("A cloud of gas puts you to sleep!");
X			nomul(-rnd(25));
X			break;
X		case BEAR_TRAP:
X			if(Levitation) {
X				pline("You float over a bear trap.");
X				break;
X			}
X			u.utrap = 4 + rn2(4);
X			u.utraptype = TT_BEARTRAP;
X			pline("A bear trap closes on your foot!");
X			if(u.usym=='o') pline("You howl in anger!");
X			break;
X		case PIERC:
X			deltrap(trap);
X			if(mtmp=makemon(PM_PIERCER,u.ux,u.uy)) {
X			  pline("%s suddenly drops from the ceiling!", Xmonnam(mtmp));
X			  if(uarmh)
X				pline("Its blow glances off your helmet.");
X			  else
X				(void) thitu(3,d(4,6),"falling piercer");
X			}
X			break;
X		case ARROW_TRAP:
X			pline("An arrow shoots out at you!");
X			if(!thitu(8,rnd(6),"arrow")){
X				mksobj_at(ARROW, u.ux, u.uy);
X				fobj->quan = 1;
X			}
X			break;
X		case TRAPDOOR:
X			if(!xdnstair) {
Xpline("A trap door in the ceiling opens and a rock falls on your head!");
Xif(uarmh) pline("Fortunately, you are wearing a helmet!");
X			    losehp(uarmh ? 2 : d(2,10),"falling rock");
X			    mksobj_at(ROCK, u.ux, u.uy);
X			    fobj->quan = 1;
X			    stackobj(fobj);
X			    if(Invisible) newsym(u.ux, u.uy);
X			} else {
X			    register int newlevel = dlevel + 1;
X				while(!rn2(4) && newlevel < 29)
X					newlevel++;
X				pline("A trap door opens up under you!");
X				if(Levitation || u.ustuck) {
X				pline("For some reason you don't fall in.");
X					break;
X				}
X				fflush(stdout);
X				goto_level(newlevel, FALSE);
X			}
X			break;
X		case DART_TRAP:
X			pline("A little dart shoots out at you!");
X			if(thitu(7,rnd(3),"little dart")) {
X			    if(!rn2(6))
X				poisoned("dart","poison dart");
X			} else {
X				mksobj_at(DART, u.ux, u.uy);
X				fobj->quan = 1;
X			}
X			break;
X		case TELEP_TRAP:
X			if(trap->once) {
X				deltrap(trap);
X				newsym(u.ux,u.uy);
X				vtele();
X			} else {
X				newsym(u.ux,u.uy);
X				tele();
X			}
X			break;
X#ifdef KAA
X		case RUST_TRAP:
X			switch (rn2(5)) {
X			case 0:
X				pline("A gush of water hits you on the head!");
X				if (uarmh) {
X				    if (uarmh->rustfree)
X					pline("Your helmet is not affected!");
X				    else if (uarmh->spe > -6) {
X					pline("Your helmet rusts!");
X					uarmh->spe--;
X				    } else
X					pline("Your helmet looks quite rusted now.");
X				}
X				break;
X			case 1:
X				pline("A gush of water hits your left arm!");
X				if (uarms) {
X					pline("Your shield is not affected!");
X					break;
X				}
X				if (uwep && uwep->otyp == TWO_HANDED_SWORD) goto two_hand;
X				/* Two goto statements in a row--aaarrrgggh! */
X		glovecheck: if(uarmg) pline("Your gloves are not affected!");
X				break;
X			case 2:
X				pline("A gush of water hits your right arm!");
X		two_hand: corrode_weapon();
X				goto glovecheck;
X			default:
X				pline("A gush of water hits you!");
X				if (uarm) {
X				    if (uarm->rustfree ||
X					uarm->otyp >= STUDDED_LEATHER_ARMOR) 
X					    pline("Your %s not affected!",
X						  aobjnam(uarm,"are"));
X				    else if(uarm->spe > -6) {
X					    pline("Your %s!",
X						  aobjnam(uarm,"corrode"));
X					    uarm->spe--;
X				    } else
X					    pline("Your %s quite rusted now.",
X						  aobjnam(uarm, "look"));
X				}
X			}
X			break;
X#endif
X		case PIT:
X			if (Levitation || index("EyBfk'&",u.usym)) {
X				pline("A pit opens up under you!");
X				pline("You don't fall in!");
X				break;
X			}
X			pline("You fall into a pit!");
X			u.utrap = rn1(6,2);
X			u.utraptype = TT_PIT;
X			losehp(rnd(6),"fall into a pit");
X			selftouch("Falling, you");
X			break;
X#ifdef NEWCLASS
X		case SPIKED_PIT:
X			if (Levitation || index("EyBfk'&",u.usym)) {
X				pline("A pit opens up under you!");
X				pline("You don't fall in!");
X				pline("There are spikes in that pit!!!");
X				break;
X			}
X			pline("You fall into a pit!");
X			pline("You land on a set of sharp iron spikes!");
X			u.utrap = rn1(6,2);
X			u.utraptype = TT_PIT;
X			losehp(rnd(10),"fall onto iron spikes");
X			if(!rn2(6)) poisoned("spikes","poison spikes");
X			selftouch("Falling, you");
X			break;
X		case LEVEL_TELEP:
X			if (!Blind)	pline("You are momentarily blinded by a flash of light");
X			else		pline("You are momentarily disoriented.");
X			deltrap(trap);
X			newsym(u.ux,u.uy);
X			level_tele();
X			break;
X#endif
X#ifdef SPELLS
X		case ANTI_MAGIC:
X			pline("You feel your magical energy drain away!");
X			u.uen -= (rnd(u.ulevel) + 1);
X			if(u.uen < 0)  {
X				u.uenmax += u.uen;
X				if(u.uenmax < 0) u.uenmax = 0;
X				u.uen = 0;
X			}
X			flags.botl = 1;
X			break;
X#endif
X#if defined(RPH) && defined(KAA)
X		case POLY_TRAP:
X			    pline("You feel a change coming over you.");
X			    polyself();
X			    deltrap(trap);
X			    break;
X#endif
X#ifdef NEWTRAPS
X		case MGTRP:
X			/* A magic trap. */
X			domagictrap();
X			break;
X		case SQBRD: {
X#include      "edog.h"
X			register struct monst *mtmp = fmon;
X			/* Stepped on a squeaky board. */
X			pline("A board underfoot gives off a loud squeak!");
X			/* Wake up nearby monsters. */
X		       while(mtmp) {
X			 if(dist(mtmp->mx,mtmp->my) < u.ulevel*20) {
X			       if(mtmp->msleep)
X				       mtmp->msleep = 0;
X			       if(mtmp->mtame)
X				       EDOG(mtmp)->whistletime = moves;
X			 }
X			 mtmp = mtmp->nmon;
X		       }
X		}
X			break;
X#endif
X#ifdef SPIDERS
X	       case WEB:
X
X		       /* Our luckless adventurer has stepped into a web. */
X
X		       pline("You've stumbled into a spider web!");
X		       u.utraptype = TT_WEB;
X
X		       /* Time stuck in the web depends on your strength. */
X
X		       if (u.ustr == 3) u.utrap = rn1(6,6);
X		       else if (u.ustr < 6) u.utrap = rn1(6,4);
X		       else if (u.ustr < 9) u.utrap = rn1(4,4);
X		       else if (u.ustr < 12) u.utrap = rn1(4,2);
X		       else if (u.ustr < 15) u.utrap = rn1(2,2);
X		       else if (u.ustr < 18) u.utrap = rnd(2);
X		       else if (u.ustr < 69) u.utrap = 1;
X		       else {
X			       u.utrap = 0;
X			       pline("You tear through the web!");
X			       deltrap(trap);
X			    }
X		       break;
X#endif
X		default:
X			impossible("You hit a trap of type %u", trap->ttyp);
X		}
X	}
X}
X
Xmintrap(mtmp) register struct monst *mtmp; {
X	register struct trap *trap = t_at(mtmp->mx, mtmp->my);
X	register int wasintrap = mtmp->mtrapped;
X
X	if(!trap) {
X		mtmp->mtrapped = 0;	/* perhaps teleported? */
X	} else if(wasintrap) {
X		if(!rn2(40)) mtmp->mtrapped = 0;
X	} else {
X	    register int tt = trap->ttyp;
X#ifdef DGK
X	/* A bug fix for dumb messages by ab@unido.
X	 */
X	    int in_sight = cansee(mtmp->mx,mtmp->my)
X			   && (!mtmp->minvis || See_invisible);
X#else
X	    int in_sight = cansee(mtmp->mx,mtmp->my);
X#endif
X	    extern char mlarge[];
X
X	    if(mtmp->mtrapseen & (1 << tt)) {
X		/* he has been in such a trap - perhaps he escapes */
X		if(rn2(4)) return(0);
X	    }
X	    mtmp->mtrapseen |= (1 << tt);
X	    switch (tt) {
X		case BEAR_TRAP:
X			if(index(mlarge, mtmp->data->mlet)) {
X				if(in_sight)
X				  pline("%s is caught in a bear trap!",
X					Monnam(mtmp));
X				else
X				  if(mtmp->data->mlet == 'o')
X			    pline("You hear the roaring of an angry bear!");
X				mtmp->mtrapped = 1;
X			}
X			break;
X#ifdef KAA
X# ifdef RPH
X  		case POLY_TRAP:
X		    if(!resist(mtmp, '/', 0, NOTELL))
X			newcham(mtmp,&mons[rn2(CMNUM)]);
X		    break;
X# endif
X		case RUST_TRAP:
X			if(in_sight)
X				pline("A gush of water hits %s!",monnam(mtmp));
X			break;
X#endif
X		case PIT:
X#ifdef NEWCLASS
X		case SPIKED_PIT:
X#endif
X			/* there should be a mtmp/data -> floating */
X			if(!index("EywBIfk'& ", mtmp->data->mlet)) { /* ab */
X				mtmp->mtrapped = 1;
X				if(in_sight)
X				  pline("%s falls into a pit!", Monnam(mtmp));
X			}
X			break;
X		case SLP_GAS_TRAP:
X			if(!mtmp->msleep && !mtmp->mfroz) {
X				mtmp->msleep = 1;
X				if(in_sight)
X				  pline("%s suddenly falls asleep!",
X					Monnam(mtmp));
X			}
X			break;
X		case TELEP_TRAP:
X#ifdef NEWCLASS
X		case LEVEL_TELEP:
X#endif
X			rloc(mtmp);
X			if(in_sight && !cansee(mtmp->mx,mtmp->my))
X				pline("%s suddenly disappears!",
X					Monnam(mtmp));
X			break;
X		case ARROW_TRAP:
X			if(in_sight)
X				pline("%s is hit by an arrow!",	Monnam(mtmp));
X			mtmp->mhp -= 3;
X			break;
X		case DART_TRAP:
X			if(in_sight)
X				pline("%s is hit by a dart!", Monnam(mtmp));
X			mtmp->mhp -= 2;
X			/* not mondied here !! */
X			break;
X		case TRAPDOOR:
X			if(!xdnstair) {
X				mtmp->mhp -= 10;
X				if(in_sight)
Xpline("A trap door in the ceiling opens and a rock hits %s!", monnam(mtmp));
X				break;
X			}
X			if(!index("EywBIfk", mtmp->data->mlet)){
X				fall_down(mtmp);
X				if(in_sight)
X		pline("Suddenly, %s disappears out of sight.", monnam(mtmp));
X				return(2);	/* no longer on this level */
X			}
X			break;
X		case PIERC:
X			break;
X#ifdef NEWTRAPS
X		case MGTRP:
X			/* A magic trap.  Monsters immune. */
X			break;
X		case SQBRD: {
X			register struct monst *ztmp = fmon;
X			
X			if(index("EyBIfk", mtmp->data->mlet)) break;
X			/* Stepped on a squeaky board. */
X			if (in_sight)
X			   pline("%s steps on a squeaky board.", Monnam(mtmp));
X			else
X			   pline("You hear a distant squeak.");
X			/* Wake up nearby monsters. */
X		       while(ztmp) {
X			 if(dist2(mtmp->mx,mtmp->my,ztmp->mx,ztmp->my) < 40)
X			       if(ztmp->msleep) ztmp->msleep = 0;
X			 ztmp = ztmp->nmon;
X		       }
X			break;
X		}
X#endif
X#ifdef SPIDERS
X	       case WEB:
X		       /* Monster in a web. */
X			/* in_sight check and confused bear by Eric Backus */
X		       if(mtmp->data->mlet != 's') {
X			 if(in_sight)
X				pline("%s is caught in a web!", Monnam(mtmp));
X			  else
X			    if(mtmp->data->mlet == 'o')
X			      pline("You hear the roaring of a confused bear!");
X			 mtmp->mtrapped = 1;
X		       }
X		      break;
X#endif
X#ifdef SPELLS
X		case ANTI_MAGIC:	break;
X#endif
X		default:
X			impossible("Some monster encountered a strange trap of type %d.",tt);
X	    }
X	}
X	return(mtmp->mtrapped);
X}
X
Xselftouch(arg) char *arg; {
X	if(uwep && uwep->otyp == DEAD_COCKATRICE){
X		pline("%s touch the dead cockatrice.", arg);
X		pline("You turn to stone.");
X		pline("You die...");
X		killer = objects[uwep->otyp].oc_name;
X		done("died");
X	}
X}
X
Xfloat_up(){
X	if(u.utrap) {
X		if(u.utraptype == TT_PIT) {
X			u.utrap = 0;
X			pline("You float up, out of the pit!");
X		} else {
X			pline("You float up, only your leg is still stuck.");
X		}
X	} else
X		if (Hallucination)
X			pline("Oh wow!  You're floating in the air!");
X		else
X			pline("You start to float in the air!");
X}
X
Xfloat_down(){
X	register struct trap *trap;
X	
X	/* check for falling into pool - added by GAN 10/20/86 */
X	if(IS_POOL(levl[u.ux][u.uy].typ) && !Levitation)
X		drown();
X
X	pline("You float gently to the ground.");
X	if(trap = t_at(u.ux,u.uy))
X		switch(trap->ttyp) {
X		case PIERC:
X			break;
X		case TRAPDOOR:
X			if(!xdnstair || u.ustuck) break;
X			/* fall into next case */
X		default:
X			dotrap(trap);
X	}
X	pickup(1);
X}
X
X#include "mkroom.h"
X
Xvtele() {
X	register struct mkroom *croom;
X
X	for(croom = &rooms[0]; croom->hx >= 0; croom++)
X	    if(croom->rtype == VAULT) {
X		register x,y;
X
X		x = rn2(2) ? croom->lx : croom->hx;
X		y = rn2(2) ? croom->ly : croom->hy;
X		if(teleok(x,y)) {
X		    teleds(x,y);
X		    return;
X		}
X	    }
X	tele();
X}
X
X#ifdef BVH
Xint has_amulet() {
X    register struct  obj *otmp;
X
X    for(otmp = invent; otmp; otmp = otmp->nobj)
X	if(otmp->olet == AMULET_SYM && otmp->spe >= 0)
X	    return(1);
X    return(0);
X}
X#endif
X
Xtele() {
X	coord cc;
X	register int nux,nuy;
X
X#ifdef BVH
X	if(has_amulet() && rn2(3)) {
X	    pline("You feel disoriented for a moment.");
X	    return;
X	}
X#endif
X	if(Teleport_control) {
X#ifdef KAA
X	    if (multi < 0 && (!nomovemsg ||
X			      !strncmp(nomovemsg,"You awake", 9) ||
X			      !strncmp(nomovemsg,"You regain con", 15) ||
X			      !strncmp(nomovemsg,"You are consci", 15)))
X 
X		pline("Being unconscious, you cannot control your teleport.");
X	    else {
X#endif
X	
X		    pline("To what position do you want to be teleported?");
X		    getpos(&cc, 1, "the desired position"); /* 1: force valid */
X		    /* possible extensions: introduce a small error if
X		       magic power is low; allow transfer to solid rock */
X		    if(teleok(cc.x, cc.y)){
X			teleds(cc.x, cc.y);
X			return;
X		    }
X		    pline("Sorry ...");
X#ifdef KAA
X		}
X#endif
X	}
X	do {
X		nux = rnd(COLNO-1);
X		nuy = rn2(ROWNO);
X	} while(!teleok(nux, nuy));
X	teleds(nux, nuy);
X}
X
Xteleds(nux, nuy)
Xregister int nux,nuy;
X{
X	if(Punished) unplacebc();
X	unsee();
X	u.utrap = 0;
X	u.ustuck = 0;
X	u.ux = nux;
X	u.uy = nuy;
X	setsee();
X	if(Punished) placebc(1);
X	if(u.uswallow){
X		u.uswldtim = u.uswallow = 0;
X		docrt();
X	}
X	nomul(0);
X	if(IS_POOL(levl[nux][nuy].typ) && !Levitation)
X		drown();
X	(void) inshop();
X	pickup(1);
X	read_engr_at(u.ux,u.uy);
X}
X
Xteleok(x,y) register int x,y; {	/* might throw him into a POOL
X				 * removed by GAN 10/20/86
X				 */
X#ifdef STUPID
X	boolean	tmp1, tmp2, tmp3;
X	tmp1 = isok(x,y) && !IS_ROCK(levl[x][y].typ) && !m_at(x,y);
X	tmp2 = !sobj_at(ENORMOUS_ROCK,x,y) && !t_at(x,y);
X	tmp3 = !(IS_POOL(levl[x][y].typ) && !Levitation);
X	return(tmp1 && tmp2 && tmp3);
X#else
X	return( isok(x,y) && !IS_ROCK(levl[x][y].typ) && !m_at(x,y) &&
X		!sobj_at(ENORMOUS_ROCK,x,y) && !t_at(x,y) &&
X		!(IS_POOL(levl[x][y].typ) && !Levitation)
X	);
X#endif
X	/* Note: gold is permitted (because of vaults) */
X}
X
Xdotele() {
X	extern char pl_character[];
X
X	if((!index("LNt",u.usym)) &&
X#ifdef WIZARD
X	   !wizard &&
X#endif
X		      (!Teleportation || u.ulevel < 6 ||
X			(pl_character[0] != 'W' && u.ulevel < 10))) {
X		pline("You are not able to teleport at will.");
X		return(0);
X	}
X	if(u.uhunger <= 100 || u.ustr < 6) {
X		pline("You miss the strength for a teleport spell.");
X#ifdef WIZARD
X		if(!wizard)
X#endif
X		return(1);
X	}
X	tele();
X	morehungry(100);
X	return(1);
X}
X
Xplacebc(attach) int attach; {
X	if(!uchain || !uball){
X		impossible("Where are your chain and ball??");
X		return;
X	}
X	uball->ox = uchain->ox = u.ux;
X	uball->oy = uchain->oy = u.uy;
X	if(attach){
X		uchain->nobj = fobj;
X		fobj = uchain;
X		if(!carried(uball)){
X			uball->nobj = fobj;
X			fobj = uball;
X		}
X	}
X}
X
Xunplacebc(){
X	if(!carried(uball)){
X		freeobj(uball);
X		unpobj(uball);
X	}
X	freeobj(uchain);
X	unpobj(uchain);
X}
X
Xlevel_tele() {
Xregister int newlevel;
X
X#ifdef BVH
X	if(has_amulet() && rn2(5)) {
X	    pline("You feel very disoriented for a moment.");
X	    return;
X	}
X#endif
X	if(Teleport_control) {
X	    char buf[BUFSZ];
X
X	    do {
X	      pline("To what level do you want to teleport? [type a number] ");
X	      getlin(buf);
X	    } while(!digit(buf[0]) && (buf[0] != '-' || !digit(buf[1])));
X	    newlevel = atoi(buf);
X	} else {
X#ifdef DGKMOD
X	    newlevel = rn2(5) | !Fire_resistance ? rnz(dlevel + 3) : 30;
X#else
X	    newlevel = rnz(dlevel + 3);			/* 5 - 24 */
X#endif
X	    if(dlevel == newlevel)
X		if(!xdnstair) newlevel--; else newlevel++;
X	}
X	if(newlevel >= 30) {
X	    if(newlevel > MAXLEVEL) newlevel = MAXLEVEL;
X	    pline("You arrive at the center of the earth ...");
X	    pline("Unfortunately it is here that hell is located.");
X#ifdef DGK
X	    fflush(stdout);
X#endif
X	    if(Fire_resistance) {
X		pline("But the fire doesn't seem to harm you.");
X	    } else {
X		pline("You burn to a crisp.");
X		pline("You die...");
X		dlevel = maxdlevel = newlevel;
X		killer = "visit to hell";
X		done("burned");
X	    }
X	}
X	if(newlevel < 0) {
X		if(newlevel <= -10) {
X			pline("You arrive in heaven.");
X			pline("\"You are here a bit early, but we'll let you in.\"");
X			killer = "visit to heaven";
X			done("died");
X		} else	if (newlevel == -9) {
X			pline("You feel deliriously happy. ");
X			pline("(In fact, you're on Cloud 9!) ");
X			more();
X		} else	newlevel = 0;
X	    pline("You are now high above the clouds ...");
X	    if(Levitation) {
X		pline("You float gently down to earth.");
X		done("escaped");
X	    }
X	    pline("Unfortunately, you don't know how to fly.");
X	    pline("You plummet a few thousand feet to your death.");
X	    dlevel = 0;
X	    killer = "long fall";
X	    done("died");
X	}
X
X	goto_level(newlevel, FALSE); /* calls done("escaped") if newlevel==0 */
X}
X
X#ifdef NEWTRAPS
X
Xdomagictrap()
X{
X	register int fate = rnd(20);
X
X	/* What happened to the poor sucker? */
X
X	if (fate < 10) {
X
X	  /* Most of the time, it creates some monsters. */
X	  register int cnt = rnd(4);
X
X	  /* below checks for blindness added by GAN 10/30/86 */
X	  if (!Blind)  {
X		pline("You are momentarily blinded by a flash of light!");
X		Blinded += rn1(5,10);
X		seeoff(0);
X	  }  else
X		pline("You hear a deafening roar!");
X	  while(cnt--)
X	   (void) makemon((struct permonst *) 0, u.ux, u.uy);
X	}
X	else
X	  switch (fate) {
X
X	     case 10:
X	     case 11:
X		      /* sometimes nothing happens */
X			break;
X	     case 12:
X		      /* a flash of fire */
X		      {
X			register int num;
X			
X			/* changed to be in conformance with
X			 * SCR_FIRE by GAN 11/02/86
X			 */
X			
X			pline("A tower of flame bursts from the floor!");
X			if(Fire_resistance)
X				pline("You are uninjured.");
X			else {
X				num = rnd(6);
X				u.uhpmax -= num;
X				losehp(num,"a burst of flame");
X				break;
X			}
X		      }
X
X	     /* odd feelings */
X	     case 13:   pline("A shiver runs up and down your spine!");
X			break;
X	     case 14:   pline("You hear distant howling.");
X			break;
X	     case 15:   pline("You suddenly yearn for your distant homeland.");
X			break;
X	     case 16:   pline("Your pack shakes violently!");
X			break;
X
X	     /* very occasionally something nice happens. */
X
X	     case 19:
X		    /* tame nearby monsters */
X		   {   register int i,j;
X		       register boolean confused = (Confusion != 0);
X		       register int bd = confused ? 5 : 1;
X		       register struct monst *mtmp;
X
X		       /* below pline added by GAN 10/30/86 */
X		       pline("You feel charismatic.");
X		       for(i = -bd; i <= bd; i++) for(j = -bd; j <= bd; j++)
X		       if(mtmp = m_at(u.ux+i, u.uy+j))
X			       (void) tamedog(mtmp, (struct obj *) 0);
X		       break;
X		   }
X
X	     case 20:
X		    /* uncurse stuff */
X		   {  register struct obj *obj;
X		      register boolean confused = (Confusion != 0);
X
X			/* below plines added by GAN 10/30/86 */
X			if (confused)
X			    if (Hallucination)
X				pline("You feel the power of the Force against you!");
X			    else
X				pline("You feel like you need some help.");
X			else
X			    if (Hallucination)
X				pline("You feel in touch with the Universal Oneness.");
X			    else
X				pline("You feel like someone is helping you.");
X		       for(obj = invent; obj ; obj = obj->nobj)
X			       if(obj->owornmask)
X				       obj->cursed = confused;
X		       if(Punished && !confused) {
X			       Punished = 0;
X			       freeobj(uchain);
X			       unpobj(uchain);
X			       free((char *) uchain);
X			       uball->spe = 0;
X			       uball->owornmask &= ~W_BALL;
X			       uchain = uball = (struct obj *) 0;
X		       }
X		       break;
X		   }
X	     default: break;
X	  }
X}
X#endif /* NEWTRAPS /**/
X
Xdrown()
X{
X	pline("You fall into a pool!");
X	pline("You can't swim!");
X	if(
X#ifdef WIZARD
X	wizard ||
X#endif
X	rn2(3) < u.uluck+2) {
X		/* most scrolls become unreadable */
X		register struct obj *obj;
X
X		for(obj = invent; obj; obj = obj->nobj)
X			if(obj->olet == SCROLL_SYM && rn2(12) > u.uluck)
X				obj->otyp = SCR_BLANK_PAPER;
X		/* we should perhaps merge these scrolls ? */
X
X		pline("You attempt a teleport spell.");	/* utcsri!carroll */
X		(void) dotele();
X		if(!IS_POOL(levl[u.ux][u.uy].typ)) return;
X	}
X	pline("You drown.");
X	pline("You die...");
X	killer = "pool of water";
X	done("drowned");
X}
END_OF_trap.c
if test 20311 -ne `wc -c <trap.c`; then
    echo shar: \"trap.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 3 \(of 20\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 20 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0