| 1 | /** |
| 2 | * @file |
| 3 | * Skill-related defines, including subtypes. |
| 4 | */ |
| 5 | |
| 6 | #ifndef SKILLS_H |
| 7 | #define SKILLS_H |
| 8 | |
| 9 | /** |
| 10 | * @enum SK Skill subtypes |
| 11 | * |
| 12 | * This list is just a subtype <-> skill (code wise) in the |
| 13 | * server translation. In theory, the processing of the different |
| 14 | * skills could be done via strncmp |
| 15 | * This list doesn't really try to identify what the skills do. |
| 16 | * The order of this list has no special meaning. 0 is not used |
| 17 | * to denote improperly set objects. |
| 18 | */ |
| 19 | enum SK { |
| 20 | SK_LOCKPICKING = 1, /**< Lockpicking. */ |
| 21 | SK_HIDING = 2, /**< Hiding. */ |
| 22 | SK_SMITHERY = 3, /**< Smithery. */ |
| 23 | SK_BOWYER = 4, /**< Bowyer. */ |
| 24 | SK_JEWELER = 5, /**< Jeweler. */ |
| 25 | SK_ALCHEMY = 6, /**< Alchemy. */ |
| 26 | SK_STEALING = 7, /**< Stealing. */ |
| 27 | SK_LITERACY = 8, /**< Literacy. */ |
| 28 | SK_BARGAINING = 9, /**< Bargaining. */ |
| 29 | SK_JUMPING = 10, /**< Jumping. */ |
| 30 | SK_DET_MAGIC = 11, /**< Detect magic. */ |
| 31 | SK_ORATORY = 12, /**< Oratory. */ |
| 32 | SK_SINGING = 13, /**< Singing. */ |
| 33 | SK_DET_CURSE = 14, /**< Detect curse. */ |
| 34 | SK_FIND_TRAPS = 15, /**< Find traps. */ |
| 35 | SK_MEDITATION = 16, /**< Meditation. */ |
| 36 | SK_PUNCHING = 17, /**< Punching. */ |
| 37 | SK_FLAME_TOUCH = 18, /**< Flame-touch. */ |
| 38 | SK_KARATE = 19, /**< Karate. */ |
| 39 | SK_CLIMBING = 20, /**< Climbing. */ |
| 40 | SK_WOODSMAN = 21, /**< Woodsman. */ |
| 41 | SK_INSCRIPTION = 22, /**< Inscription.*/ |
| 42 | SK_ONE_HANDED_WEAPON = 23, /**< One handed weapon. */ |
| 43 | SK_MISSILE_WEAPON = 24, /**< Missile weapon. */ |
| 44 | SK_THROWING = 25, /**< Throwing. */ |
| 45 | SK_USE_MAGIC_ITEM = 26, /**< Use magic item. */ |
| 46 | SK_DISARM_TRAPS = 27, /**< Disarm traps. */ |
| 47 | SK_SET_TRAP = 28, /**< Set traps, unused. */ |
| 48 | SK_THAUMATURGY = 29, /**< Thaumaturgy. */ |
| 49 | SK_PRAYING = 30, /**< Praying. */ |
| 50 | SK_CLAWING = 31, /**< Clawing. */ |
| 51 | SK_LEVITATION = 32, /**< Levitation. */ |
| 52 | SK_SUMMONING = 33, /**< Summoning. */ |
| 53 | SK_PYROMANCY = 34, /**< Pyromancy. */ |
| 54 | SK_EVOCATION = 35, /**< Evocation. */ |
| 55 | SK_SORCERY = 36, /**< Sorcery. */ |
| 56 | SK_TWO_HANDED_WEAPON = 37, /**< Two handed weapons. */ |
| 57 | SK_WRAITH_FEED = 38, /**< Wraith feed. */ |
| 58 | SK_HARVESTING = 39, /**< Harvesting. */ |
| 59 | SK_AIR_MAGIC = 40, /**< Air magic, unused. */ |
| 60 | SK_EARTH_MAGIC = 41, /**< Earth magic, unused. */ |
| 61 | SK_WATER_MAGIC = 42, /**< Water magic, unused. */ |
| 62 | SK_FIRE_MAGIC = 43, /**< Fire magic, unused. */ |
| 63 | }; |
| 64 | |
| 65 | /** |
| 66 | * This is the maximum number of skills the game may handle. |
| 67 | * There is no direct mapping to the subtype, as multiple skills may share |
| 68 | * the same subtype with a different name. |
| 69 | */ |
| 70 | #define MAX_SKILLS 50 |
| 71 | |
| 72 | /** |
| 73 | * @defgroup SK_EXP_xxx Experience flags |
| 74 | * This is used in the exp functions - basically what to do if |
| 75 | * the player doesn't have the skill he should get exp in. |
| 76 | */ |
| 77 | /*@{*/ |
| 78 | #define SK_EXP_ADD_SKILL 0 /**< Give the player the skill. */ |
| 79 | #define SK_EXP_TOTAL 1 /**< Give player exp to total, no skill. */ |
| 80 | #define SK_EXP_NONE 2 /**< Player gets nothing. */ |
| 81 | #define SK_SUBTRACT_SKILL_EXP 3 /**< Used when removing exp. */ |
| 82 | /*@}*/ |
| 83 | |
| 84 | /** True if op is using skill, false else. */ |
| 85 | #define USING_SKILL(op, skill) ((op)->chosen_skill && (op)->chosen_skill->subtype == skill) |
| 86 | |
| 87 | /** |
| 88 | * This macro is used in fix_object() to define if this is a sill |
| 89 | * that should be used to calculate wc's and the like. |
| 90 | */ |
| 91 | #define IS_COMBAT_SKILL(num) \ |
| 92 | ((num == SK_PUNCHING) \ |
| 93 | || (num == SK_FLAME_TOUCH) \ |
| 94 | || (num == SK_KARATE) \ |
| 95 | || (num == SK_ONE_HANDED_WEAPON) \ |
| 96 | || (num == SK_MISSILE_WEAPON) \ |
| 97 | || (num == SK_THROWING) \ |
| 98 | || (num == SK_CLAWING) \ |
| 99 | || (num == SK_TWO_HANDED_WEAPON) \ |
| 100 | || (num == SK_WRAITH_FEED)) |
| 101 | |
| 102 | /** |
| 103 | * Like IS_COMBAT_SKILL above, but instead this is used to determine |
| 104 | * how many mana points the player has. |
| 105 | */ |
| 106 | #define IS_MANA_SKILL(num) \ |
| 107 | ((num == SK_SORCERY) \ |
| 108 | || (num == SK_EVOCATION) \ |
| 109 | || (num == SK_PYROMANCY) \ |
| 110 | || (num == SK_SUMMONING) \ |
| 111 | || (num==SK_AIR_MAGIC) \ |
| 112 | || (num==SK_EARTH_MAGIC) \ |
| 113 | || (num==SK_FIRE_MAGIC) \ |
| 114 | || (num==SK_WATER_MAGIC)) |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * Currently only one of these, but put the define here to make |
| 119 | * it easier to expand it in the future */ |
| 120 | #define IS_GRACE_SKILL(num) \ |
| 121 | (num == SK_PRAYING) |
| 122 | |
| 123 | extern const char *skill_names[MAX_SKILLS]; |
| 124 | extern const Face *skill_faces[MAX_SKILLS]; |
| 125 | |
| 126 | extern int get_skill_client_code(const char *skill_name); |
| 127 | |
| 128 | #ifdef WANT_UNARMED_SKILLS |
| 129 | /** Table of unarmed attack skills. Terminated by 0. This |
| 130 | * is also the list that we should try to use skills when |
| 131 | * automatically applying one for the player. |
| 132 | * Note it is hardcoded in the skill_util.c that dragons always |
| 133 | * want clawing if possible. |
| 134 | * included in a #ifdef so we don't get bunches of warnings about |
| 135 | * unused values. it is located here instead of a .c file to make |
| 136 | * updates easier and put it in a more central place - it shouldn't |
| 137 | * change very often, but it make sense to have it with the enumerated |
| 138 | * skill numbers above. |
| 139 | * This should probably be removed and made a player preferance instead. |
| 140 | */ |
| 141 | static uint8_t unarmed_skills[] = { |
| 142 | SK_KARATE, |
| 143 | SK_CLAWING, |
| 144 | SK_FLAME_TOUCH, |
| 145 | SK_PUNCHING, |
| 146 | SK_WRAITH_FEED, |
| 147 | 0 |
| 148 | }; |
| 149 | |
| 150 | /* Just in case one file includes this more than once */ |
| 151 | #undef WANT_UNARMED_SKILLS |
| 152 | |
| 153 | #endif |
| 154 | |
| 155 | #endif /* SKILLS_H */ |