Comments

From NetHackWiki
Jump to navigation Jump to search

The NetHack source code has some illuminating and embarrassing comments. Here is a selection, just to get you the feeling.

Illuminating

From pray.c for the function god_zaps_you, about what happens if your god decides to destroy you with a wide-angle disintegration beam but you are disintegration resistant.

/* "I am sometimes shocked by...  the nuns who never take a bath without
* wearing a bathrobe all the time.  When asked why, since no man can see them,
* they reply 'Oh, but you forget the good God'.  Apparently they conceive of
* the Deity as a Peeping Tom, whose omnipotence enables Him to see through
* bathroom walls, but who is foiled by bathrobes." --Bertrand Russell, 1943
* Divine wrath, dungeon walls, and armor follow the same principle.
*/

From the beginning of spell.c explaining how spellcasting penalties work. It's worthwhile to check out the full comment there.

 *	Tou are aware of magic from all the great films they have seen

From trap.c in the mintrap function, on what happens if a monster falls into a trap made by you, or triggers a bear trap or land mine set by you.

	    /* Monster is aggravated by being trapped by you.
	       Recognizing who made the trap isn't completely
	       unreasonable; everybody has their own style. */

From the beginning of weapon.c,

/* Historical note: The original versions of Hack used a range of damage
* which was similar to, but not identical to the damage used in Advanced
* Dungeons and Dragons.  I figured that since it was so close, I may as well
* make it exactly the same as AD&D, adding some more weapons in the process.
* This has the advantage that it is at least possible that the player would
* already know the damage of at least some of the weapons.  This was circa
* 1987 and I used the table from Unearthed Arcana until I got tired of typing
* them in (leading to something of an imbalance towards weapons early in
* alphabetical order).  The data structure still doesn't include fields that
* fully allow the appropriate damage to be described (there's no way to say
* 3d6 or 1d6+1) so we add on the extra damage in dmgval() if the weapon
* doesn't do an exact die of damage.
*
* Of course new weapons were added later in the development of Nethack.  No
* AD&D consistency was kept, but most of these don't exist in AD&D anyway.
*
* Second edition AD&D came out a few years later; luckily it used the same
* table.  As of this writing (1999), third edition is in progress but not
* released.  Let's see if the weapon table stays the same.  --KAA
* October 2000: It didn't.  Oh, well.
*/

Funny

In objects.c

/* "If tin whistles are made out of tin, what do they make foghorns out of?" */

Announcing the highly confusing rnz function in rnd.c:

/* rnz: everyone's favorite! */

Embarrassing

In spell.c function spelleffects, where it creates a stack of 20 spellbooks as a pseudo-objects that it passes to functions that normally expect a scroll or potion.

	pseudo->quan = 20L;			/* do not let useup get it */

In weapon.c function dmgval, when computing bonuses for blessed or silver weapons

	    /* if the weapon is going to get a double damage bonus, adjust
	       this bonus so that effectively it's added after the doubling */
	    if (bonus > 1 && otmp->oartifact && spec_dbon(otmp, mon, 25) >= 25)
		bonus = (bonus + 1) / 2;

Mysterious

From context.h:

       unsigned run;           /* 0: h (etc), 1: H (etc), 2: fh (etc) */
                               /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
                               /* 8: travel */

This comment apparently has not changed since the days of Hack, apart from the addition of travel. By the time NetHack 3.4.3 was released, many of the possible values for flags.run had an unclear purpose, and the comment really didn't help, at all. FIQ believes some of the values may not have been used even in Hack itself, but in another game originally distributed with hack, apparently called Quest, which used some of the same source files, did not require others, and had some extra source files of its own; this game, if it ever existed in complete form, has since been lost.

This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.6.2. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-362}} tag to the current version's tag or {{noversion}} as appropriate.