Source:SLASH'EM 0.0.7E7F2/skills.h

From NetHackWiki
Revision as of 18:23, 7 March 2008 by Kernigh bot (talk | contribs) (SLASH'EM 0.0.7E7F2/skills.h moved to Source:SLASH'EM 0.0.7E7F2/skills.h: Robot: moved page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to skills.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[SLASH'EM 0.0.7E7F2/skills.h#line123]], for example.

The latest source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)skills.h	3.4	1999/10/27	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef SKILLS_H
6.    #define SKILLS_H
7.    
8.    /* KMH, balance patch -- Much of this code was taken from you.h */
9.    
10.   /* Code to denote that no skill is being used */
11.   #define P_NONE				0
12.   
13.   /* Weapon Skills -- Stephen White
14.    * Order matters and are used in macros.
15.    * Positive values denote a wielded weapon or launcher.
16.    * Negative values denote ammunition or missiles.
17.    * Update weapon.c if you ammend any skills.
18.    * Also used for oc_subtyp.
19.    */
20.   #define P_DAGGER			1
21.   #define P_KNIFE				2
22.   #define P_AXE				3
23.   #define P_PICK_AXE			4
24.   #define P_SHORT_SWORD			5
25.   #define P_BROAD_SWORD			6
26.   #define P_LONG_SWORD			7
27.   #define P_TWO_HANDED_SWORD		8
28.   #define P_SCIMITAR			9
29.   #define P_SABER				10
30.   #define P_CLUB				11	/* Bludgeon with a heavy shaft */
31.   #define P_PADDLE			12	/* Bludgeon with a flattened shaft */
32.   #define P_MACE				13	/* Bludgeon with a spiked shaft? */
33.   #define P_MORNING_STAR			14	/* Spiked ball chained to stick */
34.   #define P_FLAIL				15	/* Two pieces hinged or chained together */
35.   #define P_HAMMER			16	/* Bludgeon with a heavy head on the end */
36.   #define P_QUARTERSTAFF			17	/* Bludgeon with a long shaft */
37.   #define P_POLEARMS			18
38.   #define P_SPEAR				19
39.   #define P_JAVELIN			20
40.   #define P_TRIDENT			21
41.   #define P_LANCE				22
42.   #define P_BOW				23
43.   #define P_SLING				24
44.   #ifdef FIREARMS
45.   #define P_FIREARM			25	/* KMH */
46.   #endif
47.   #define P_CROSSBOW			26
48.   #define P_DART				27
49.   #define P_SHURIKEN			28
50.   #define P_BOOMERANG			29
51.   #define P_WHIP				30
52.   #define P_UNICORN_HORN			31	
53.   #ifdef LIGHTSABERS
54.   #define P_LIGHTSABER			32	/* last weapon */
55.   #endif
56.   #define P_FIRST_WEAPON			P_DAGGER
57.   #ifdef LIGHTSABERS
58.   #define P_LAST_WEAPON			P_LIGHTSABER
59.   #else
60.   #define P_LAST_WEAPON			P_UNICORN_HORN
61.   #endif
62.   
63.   /* Spell skills -- Wizard Patch by Larry Stewart-Zerba */
64.   #define P_ATTACK_SPELL		(P_LAST_WEAPON + 1)
65.   #define P_HEALING_SPELL		(P_LAST_WEAPON + 2)
66.   #define P_DIVINATION_SPELL	(P_LAST_WEAPON + 3)
67.   #define P_ENCHANTMENT_SPELL	(P_LAST_WEAPON + 4)
68.   #define P_PROTECTION_SPELL  	(P_LAST_WEAPON + 5)
69.   #define P_BODY_SPELL		(P_LAST_WEAPON + 6)
70.   #define P_MATTER_SPELL		(P_LAST_WEAPON + 7)
71.   #define P_FIRST_SPELL		P_ATTACK_SPELL
72.   #define P_LAST_SPELL		P_MATTER_SPELL
73.   
74.   /* Other types of combat */
75.   #define P_BARE_HANDED_COMBAT 	(P_LAST_SPELL + 1)
76.   #define P_MARTIAL_ARTS		(P_LAST_SPELL + 2) /* WAC used to be role distinguishes */
77.   #define P_TWO_WEAPON_COMBAT	(P_LAST_SPELL + 3) /* Finally implemented */
78.   #ifdef STEED
79.   #define P_RIDING		(P_LAST_SPELL + 4) /* How well you control your steed */
80.   #define P_LAST_H_TO_H		P_RIDING
81.   #else
82.   #define P_LAST_H_TO_H		P_TWO_WEAPON_COMBAT
83.   #endif
84.   #define P_FIRST_H_TO_H		P_BARE_HANDED_COMBAT
85.   
86.   #define P_NUM_SKILLS		(P_LAST_H_TO_H+1)
87.   
88.   
89.   /*
90.    * These are the standard weapon skill levels.  It is important that
91.    * the lowest "valid" skill be be 1.  The code calculates the
92.    * previous amount to practice by calling  practice_needed_to_advance()
93.    * with the current skill-1.  To work out for the UNSKILLED case,
94.    * a value of 0 needed.
95.    */
96.   #define P_ISRESTRICTED		-1
97.   #define P_UNSKILLED		1
98.   #define P_BASIC			2
99.   #define P_SKILLED		3
100.  #define P_EXPERT		4
101.  #define P_MASTER		5
102.  #define P_GRAND_MASTER		6
103.  #define P_LIMIT P_GRAND_MASTER
104.  
105.  #define practice_needed_to_advance(level,skill) \
106.     (P_SKILL(skill) == P_ISRESTRICTED ? 500 : \
107.      P_SKILL(skill) >= P_MAX_SKILL(skill) ? (level)*(level)*200 : \
108.      (level)*(level)*20)
109.  
110.  /* The hero's skill in various weapons. */
111.  struct skills {
112.  	xchar skill;
113.  	xchar max_skill;
114.  	unsigned short advance;
115.  };
116.  
117.  #define P_SKILL(type)		(u.weapon_skills[type].skill)
118.  #define P_MAX_SKILL(type)	(u.weapon_skills[type].max_skill)
119.  #define P_ADVANCE(type)		(u.weapon_skills[type].advance)
120.  #define P_RESTRICTED(type)	(u.weapon_skills[type].skill == P_ISRESTRICTED)
121.  
122.  #define P_SKILL_LIMIT 60	/* max number of skill advancements */
123.  
124.  /* initial skill matrix structure; used in u_init.c and weapon.c */
125.  struct def_skill {
126.  	xchar skill;
127.  	xchar skmax;
128.  };
129.  
130.  /* these roles qualify for a martial arts bonus */
131.  /* WAC - made this dependant on weapon skills if defined */
132.  
133.  # define martial_bonus() (P_SKILL(P_MARTIAL_ARTS) >= P_BASIC)
134.  /*
135.  #else
136.  # define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_PRIEST) || Role_if(PM_MONK))
137.  */
138.  
139.  #endif  /* SKILLS_H */