Use enums for skills

This commit is contained in:
Pasi Kallinen
2017-10-07 17:10:46 +03:00
parent 9b82b72c6e
commit a4706b0928

View File

@@ -9,8 +9,9 @@
* in a separate file so it can be included in objects.c.
*/
/* Code to denote that no skill is applicable */
#define P_NONE 0
enum p_skills {
/* Code to denote that no skill is applicable */
P_NONE = 0,
/* Weapon Skills -- Stephen White
* Order matters and are used in macros.
@@ -19,58 +20,63 @@
* Update weapon.c if you amend any skills.
* Also used for oc_subtyp.
*/
#define P_DAGGER 1
#define P_KNIFE 2
#define P_AXE 3
#define P_PICK_AXE 4
#define P_SHORT_SWORD 5
#define P_BROAD_SWORD 6
#define P_LONG_SWORD 7
#define P_TWO_HANDED_SWORD 8
#define P_SCIMITAR 9
#define P_SABER 10
#define P_CLUB 11 /* Heavy-shafted bludgeon */
#define P_MACE 12
#define P_MORNING_STAR 13 /* Spiked bludgeon */
#define P_FLAIL 14 /* Two pieces hinged or chained together */
#define P_HAMMER 15 /* Heavy head on the end */
#define P_QUARTERSTAFF 16 /* Long-shafted bludgeon */
#define P_POLEARMS 17
#define P_SPEAR 18 /* includes javelin */
#define P_TRIDENT 19
#define P_LANCE 20
#define P_BOW 21
#define P_SLING 22
#define P_CROSSBOW 23
#define P_DART 24
#define P_SHURIKEN 25
#define P_BOOMERANG 26
#define P_WHIP 27
#define P_UNICORN_HORN 28 /* last weapon */
P_DAGGER,
P_KNIFE,
P_AXE,
P_PICK_AXE,
P_SHORT_SWORD,
P_BROAD_SWORD,
P_LONG_SWORD,
P_TWO_HANDED_SWORD,
P_SCIMITAR,
P_SABER,
P_CLUB, /* Heavy-shafted bludgeon */
P_MACE,
P_MORNING_STAR, /* Spiked bludgeon */
P_FLAIL, /* Two pieces hinged or chained together */
P_HAMMER, /* Heavy head on the end */
P_QUARTERSTAFF, /* Long-shafted bludgeon */
P_POLEARMS,
P_SPEAR, /* includes javelin */
P_TRIDENT,
P_LANCE,
P_BOW,
P_SLING,
P_CROSSBOW,
P_DART,
P_SHURIKEN,
P_BOOMERANG,
P_WHIP,
P_UNICORN_HORN, /* last weapon */
/* Spell Skills added by Larry Stewart-Zerba */
P_ATTACK_SPELL,
P_HEALING_SPELL,
P_DIVINATION_SPELL,
P_ENCHANTMENT_SPELL,
P_CLERIC_SPELL,
P_ESCAPE_SPELL,
P_MATTER_SPELL,
/* Other types of combat */
P_BARE_HANDED_COMBAT, /* actually weaponless; gloves are ok */
P_TWO_WEAPON_COMBAT,
P_RIDING, /* How well you control your steed */
P_NUM_SKILLS
};
#define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */
#define P_FIRST_WEAPON P_DAGGER
#define P_LAST_WEAPON P_UNICORN_HORN
/* Spell Skills added by Larry Stewart-Zerba */
#define P_ATTACK_SPELL 29
#define P_HEALING_SPELL 30
#define P_DIVINATION_SPELL 31
#define P_ENCHANTMENT_SPELL 32
#define P_CLERIC_SPELL 33
#define P_ESCAPE_SPELL 34
#define P_MATTER_SPELL 35
#define P_FIRST_SPELL P_ATTACK_SPELL
#define P_LAST_SPELL P_MATTER_SPELL
/* Other types of combat */
#define P_BARE_HANDED_COMBAT 36 /* actually weaponless; gloves are ok */
#define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */
#define P_TWO_WEAPON_COMBAT 37 /* Finally implemented */
#define P_RIDING 38 /* How well you control your steed */
#define P_LAST_H_TO_H P_RIDING
#define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT
#define P_NUM_SKILLS (P_LAST_H_TO_H + 1)
/* These roles qualify for a martial arts bonus */
#define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK))
@@ -81,13 +87,15 @@
* with the current skill-1. To work out for the UNSKILLED case,
* a value of 0 needed.
*/
#define P_ISRESTRICTED 0
#define P_UNSKILLED 1
#define P_BASIC 2
#define P_SKILLED 3
#define P_EXPERT 4
#define P_MASTER 5 /* Unarmed combat/martial arts only */
#define P_GRAND_MASTER 6 /* Unarmed combat/martial arts only */
enum skill_levels {
P_ISRESTRICTED = 0,
P_UNSKILLED,
P_BASIC,
P_SKILLED,
P_EXPERT,
P_MASTER, /* Unarmed combat/martial arts only */
P_GRAND_MASTER /* Unarmed combat/martial arts only */
};
#define practice_needed_to_advance(level) ((level) * (level) *20)