Difference between revisions of "Comments"

From NetHackWiki
Jump to navigation Jump to search
(Illuminating)
Line 22: Line 22:
 
        Recognizing who made the trap isn't completely
 
        Recognizing who made the trap isn't completely
 
        unreasonable; everybody has their own style. */
 
        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 ==
 
== Funny ==

Revision as of 11:16, 17 September 2014

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 worth 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?" */


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;