Difference between revisions of "Comments"

From NetHackWiki
Jump to navigation Jump to search
Line 13: Line 13:
 
  */
 
  */
  
From the beginning of [[spell.c]] explaining how spellcasting penalties work.  It's worth to check out the [[spell.c#line_37|full comment]] there.
+
From the beginning of [[spell.c]] explaining how spellcasting penalties work.  It's worth to check out the [[spell.c#line37|full comment]] there.
  
 
   * Tou are aware of magic from all the great films they have seen
 
   * Tou are aware of magic from all the great films they have seen

Revision as of 10:10, 12 November 2013

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


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;