fix 'crash when reviving shopkeeper'
[aNetHack.git] / include / skills.h
blob1c174d5c3adcaa90848471bd2808c3e6447e4767
1 /* NetHack 3.6 skills.h $NHDT-Date: 1432512778 2015/05/25 00:12:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #ifndef SKILLS_H
6 #define SKILLS_H
8 /* Much of this code was taken from you.h. It is now
9 * in a separate file so it can be included in objects.c.
12 /* Code to denote that no skill is applicable */
13 #define P_NONE 0
15 /* Weapon Skills -- Stephen White
16 * Order matters and are used in macros.
17 * Positive values denote hand-to-hand weapons or launchers.
18 * Negative values denote ammunition or missiles.
19 * Update weapon.c if you amend any skills.
20 * Also used for oc_subtyp.
22 #define P_DAGGER 1
23 #define P_KNIFE 2
24 #define P_AXE 3
25 #define P_PICK_AXE 4
26 #define P_SHORT_SWORD 5
27 #define P_BROAD_SWORD 6
28 #define P_LONG_SWORD 7
29 #define P_TWO_HANDED_SWORD 8
30 #define P_SCIMITAR 9
31 #define P_SABER 10
32 #define P_CLUB 11 /* Heavy-shafted bludgeon */
33 #define P_MACE 12
34 #define P_MORNING_STAR 13 /* Spiked bludgeon */
35 #define P_FLAIL 14 /* Two pieces hinged or chained together */
36 #define P_HAMMER 15 /* Heavy head on the end */
37 #define P_QUARTERSTAFF 16 /* Long-shafted bludgeon */
38 #define P_POLEARMS 17
39 #define P_SPEAR 18 /* includes javelin */
40 #define P_TRIDENT 19
41 #define P_LANCE 20
42 #define P_BOW 21
43 #define P_SLING 22
44 #define P_CROSSBOW 23
45 #define P_DART 24
46 #define P_SHURIKEN 25
47 #define P_BOOMERANG 26
48 #define P_WHIP 27
49 #define P_UNICORN_HORN 28 /* last weapon */
50 #define P_FIRST_WEAPON P_DAGGER
51 #define P_LAST_WEAPON P_UNICORN_HORN
53 /* Spell Skills added by Larry Stewart-Zerba */
54 #define P_ATTACK_SPELL 29
55 #define P_HEALING_SPELL 30
56 #define P_DIVINATION_SPELL 31
57 #define P_ENCHANTMENT_SPELL 32
58 #define P_CLERIC_SPELL 33
59 #define P_ESCAPE_SPELL 34
60 #define P_MATTER_SPELL 35
61 #define P_FIRST_SPELL P_ATTACK_SPELL
62 #define P_LAST_SPELL P_MATTER_SPELL
64 /* Other types of combat */
65 #define P_BARE_HANDED_COMBAT 36 /* actually weaponless; gloves are ok */
66 #define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */
67 #define P_TWO_WEAPON_COMBAT 37 /* Finally implemented */
68 #define P_RIDING 38 /* How well you control your steed */
69 #define P_LAST_H_TO_H P_RIDING
70 #define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT
72 #define P_NUM_SKILLS (P_LAST_H_TO_H + 1)
74 /* These roles qualify for a martial arts bonus */
75 #define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK))
78 * These are the standard weapon skill levels. It is important that
79 * the lowest "valid" skill be be 1. The code calculates the
80 * previous amount to practice by calling practice_needed_to_advance()
81 * with the current skill-1. To work out for the UNSKILLED case,
82 * a value of 0 needed.
84 #define P_ISRESTRICTED 0
85 #define P_UNSKILLED 1
86 #define P_BASIC 2
87 #define P_SKILLED 3
88 #define P_EXPERT 4
89 #define P_MASTER 5 /* Unarmed combat/martial arts only */
90 #define P_GRAND_MASTER 6 /* Unarmed combat/martial arts only */
92 #define practice_needed_to_advance(level) ((level) * (level) *20)
94 /* The hero's skill in various weapons. */
95 struct skills {
96 xchar skill;
97 xchar max_skill;
98 unsigned short advance;
101 #define P_SKILL(type) (u.weapon_skills[type].skill)
102 #define P_MAX_SKILL(type) (u.weapon_skills[type].max_skill)
103 #define P_ADVANCE(type) (u.weapon_skills[type].advance)
104 #define P_RESTRICTED(type) (u.weapon_skills[type].skill == P_ISRESTRICTED)
106 #define P_SKILL_LIMIT 60 /* Max number of skill advancements */
108 /* Initial skill matrix structure; used in u_init.c and weapon.c */
109 struct def_skill {
110 xchar skill;
111 xchar skmax;
114 #endif /* SKILLS_H */