Difference between revisions of "Comments"

From NetHackWiki
Jump to navigation Jump to search
(Created page with "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 fu...")
 
Line 13: Line 13:
 
  */
 
  */
  
From the beginning of [[spell.c]] explaining how spellcasting penalties work.
+
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.
 +
 
 +
  * Tou are aware of magic from all the great films they have seen
  
/* The roles[] table lists the role-specific values for tuning
 
* percent_success().
 
*
 
* Reasoning:
 
*  spelbase, spelheal:
 
* Arc are aware of magic through historical research
 
* Bar abhor magic (Conan finds it "interferes with his animal instincts")
 
* Cav are ignorant to magic
 
* Hea are very aware of healing magic through medical research
 
* Kni are moderately aware of healing from Paladin training
 
* Mon use magic to attack and defend in lieu of weapons and armor
 
* Pri are very aware of healing magic through theological research
 
* Ran avoid magic, preferring to fight unseen and unheard
 
* Rog are moderately aware of magic through trickery
 
* Sam have limited magical awareness, prefering meditation to conjuring
 
* Tou are aware of magic from all the great films they have seen
 
* Val have limited magical awareness, prefering fighting
 
* Wiz are trained mages
 
*
 
* The arms penalty is lessened for trained fighters Bar, Kni, Ran,
 
* Sam, Val -
 
* the penalty is its metal interference, not encumbrance.
 
* The `spelspec' is a single spell which is fundamentally easier
 
* for that role to cast.
 
*
 
*  spelspec, spelsbon:
 
* Arc map masters (SPE_MAGIC_MAPPING)
 
* Bar fugue/berserker (SPE_HASTE_SELF)
 
* Cav born to dig (SPE_DIG)
 
* Hea to heal (SPE_CURE_SICKNESS)
 
* Kni to turn back evil (SPE_TURN_UNDEAD)
 
* Mon to preserve their abilities (SPE_RESTORE_ABILITY)
 
* Pri to bless (SPE_REMOVE_CURSE)
 
* Ran to hide (SPE_INVISIBILITY)
 
* Rog to find loot (SPE_DETECT_TREASURE)
 
* Sam to be At One (SPE_CLAIRVOYANCE)
 
* Tou to smile (SPE_CHARM_MONSTER)
 
* Val control the cold (SPE_CONE_OF_COLD)
 
* Wiz all really, but SPE_MAGIC_MISSILE is their party trick
 
*
 
* See percent_success() below for more comments.
 
*
 
*  uarmbon, uarmsbon, uarmhbon, uarmgbon, uarmfbon:
 
* Fighters find body armour & shield a little less limiting.
 
* Headgear, Gauntlets and Footwear are not role-specific (but
 
* still have an effect, except helm of brilliance, which is designed
 
* to permit magic-use).
 
*/
 
 
  
 
== Embarrassing ==
 
== Embarrassing ==

Revision as of 10:09, 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;