Source:NetHack 5.0.0/include/skills.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to skills.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/skills.h#line12]], for example.

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. /* NetHack 5.0	skills.h	$NHDT-Date: 1596498559 2020/08/03 23:49:19 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.16 $ */
2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
3. /*-Copyright (c) Pasi Kallinen, 2017. */
4. /* NetHack may be freely redistributed.  See license for details. */
5. 
6. #ifndef SKILLS_H
7. #define SKILLS_H
8. 
9. /* Much of this code was taken from you.h.  It is now
10.  * in a separate file so it can be included in objects.c.
11.  */
12. 
13. enum p_skills {
14.     /* Code to denote that no skill is applicable */
15.     P_NONE = 0,
16. 
17. /* Weapon Skills -- Stephen White
18.  * Order matters and are used in macros.
19.  * Positive values denote hand-to-hand weapons or launchers.
20.  * Negative values denote ammunition or missiles.
21.  * Update weapon.c if you amend any skills.
22.  * Also used for oc_subtyp.
23.  */
24.     P_DAGGER             =  1,
25.     P_KNIFE              =  2,
26.     P_AXE                =  3,
27.     P_PICK_AXE           =  4,
28.     P_SHORT_SWORD        =  5,
29.     P_BROAD_SWORD        =  6,
30.     P_LONG_SWORD         =  7,
31.     P_TWO_HANDED_SWORD   =  8,
32.     P_SABER              =  9, /* Curved sword, includes scimitar */
33.     P_CLUB               = 10, /* Heavy-shafted bludgeon */
34.     P_MACE               = 11,
35.     P_MORNING_STAR       = 12, /* Spiked bludgeon */
36.     P_FLAIL              = 13, /* Two pieces hinged or chained together */
37.     P_HAMMER             = 14, /* Heavy head on the end */
38.     P_QUARTERSTAFF       = 15, /* Long-shafted bludgeon */
39.     P_POLEARMS           = 16, /* attack two or three steps away */
40.     P_SPEAR              = 17, /* includes javelin */
41.     P_TRIDENT            = 18,
42.     P_LANCE              = 19,
43.     P_BOW                = 20, /* launchers */
44.     P_SLING              = 21,
45.     P_CROSSBOW           = 22,
46.     P_DART               = 23, /* hand-thrown missiles */
47.     P_SHURIKEN           = 24,
48.     P_BOOMERANG          = 25,
49.     P_WHIP               = 26, /* flexible, one-handed */
50.     P_UNICORN_HORN       = 27, /* last weapon, two-handed */
51. 
52.     /* Spell Skills added by Larry Stewart-Zerba */
53.     P_ATTACK_SPELL       = 28,
54.     P_HEALING_SPELL      = 29,
55.     P_DIVINATION_SPELL   = 30,
56.     P_ENCHANTMENT_SPELL  = 31,
57.     P_CLERIC_SPELL       = 32,
58.     P_ESCAPE_SPELL       = 33,
59.     P_MATTER_SPELL       = 34,
60. 
61.     /* Other types of combat */
62.     P_BARE_HANDED_COMBAT = 35, /* actually weaponless; gloves are ok */
63.     P_TWO_WEAPON_COMBAT  = 36, /* pair of weapons, one in each hand */
64.     P_RIDING             = 37, /* How well you control your steed */
65. 
66.     P_NUM_SKILLS         = 38
67. };
68. 
69. #define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */
70. 
71. #define P_FIRST_WEAPON P_DAGGER
72. #define P_LAST_WEAPON P_UNICORN_HORN
73. 
74. #define P_FIRST_SPELL P_ATTACK_SPELL
75. #define P_LAST_SPELL P_MATTER_SPELL
76. 
77. #define P_LAST_H_TO_H P_RIDING
78. #define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT
79. 
80. /* These roles qualify for a martial arts bonus */
81. #define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK))
82. 
83. /*
84.  * These are the standard weapon skill levels.  It is important that
85.  * the lowest "valid" skill be 1.  The code calculates the
86.  * previous amount to practice by calling  practice_needed_to_advance()
87.  * with the current skill-1.  To work out for the UNSKILLED case,
88.  * a value of 0 needed.
89.  */
90. enum skill_levels {
91.     P_ISRESTRICTED = 0, /* unskilled and can't be advanced */
92.     P_UNSKILLED    = 1, /* unskilled so far but can be advanced */
93.     /* Skill levels Basic/Advanced/Expert had long been used by
94.        Heroes of Might and Magic (tm) and its sequels... */
95.     P_BASIC        = 2,
96.     P_SKILLED      = 3,
97.     P_EXPERT       = 4,
98.     /* when the skill system was adopted into nethack, levels beyond expert
99.        were unnamed and just used numbers.  Devteam coined them Master and
100.        Grand Master.  Sometime after that, Heroes of Might and Magic IV (tm)
101.        was released and had two more levels which use these same names. */
102.     P_MASTER       = 5, /* Unarmed combat/martial arts only */
103.     P_GRAND_MASTER = 6  /* ditto */
104. };
105. 
106. #define practice_needed_to_advance(level) ((level) * (level) *20)
107. 
108. /* The hero's skill in various weapons. */
109. struct skills {
110.     xint16 skill;
111.     xint16 max_skill;
112.     unsigned short advance;
113. };
114. 
115. #define P_SKILL(type) (u.weapon_skills[type].skill)
116. #define P_MAX_SKILL(type) (u.weapon_skills[type].max_skill)
117. #define P_ADVANCE(type) (u.weapon_skills[type].advance)
118. #define P_RESTRICTED(type) (u.weapon_skills[type].skill == P_ISRESTRICTED)
119. 
120. #define P_SKILL_LIMIT 60 /* Max number of skill advancements */
121. 
122. /* Initial skill matrix structure; used in u_init.c and weapon.c */
123. struct def_skill {
124.     xint16 skill;
125.     xint16 skmax;
126. };
127. 
128. #endif /* SKILLS_H */