1 /*
2 This file is part of "Avanor, the Land of Mystery" roguelike game
3 Home page: http://www.avanor.com/
4 Copyright (C) 2000-2003 Vadim Gaidukevich
5 
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #ifndef __SKILL_H
22 #define __SKILL_H
23 
24 #include "xobject.h"
25 #include "dice.h"
26 
27 
28 enum SKILL_TYPE {
29 SKT_UNKNOWN 		= -1,
30 SKT_ARCHERY 		= 0,
31 SKT_FINDWEAKNESS	= 1,
32 SKT_HEALING 		= 2, //restore hit points
33 SKT_CONCENTRATION	= 3,
34 SKT_DODGE			= 4,
35 SKT_TRADING			= 5,
36 SKT_STEALING		= 6,
37 SKT_LITERACY		= 7,
38 SKT_DETECTTRAP		= 8,
39 SKT_DISARMTRAP		= 9,
40 SKT_COOKING			= 10,
41 SKT_MINING			= 11,
42 SKT_HERBALISM       = 12,
43 SKT_RELIGION		= 13,
44 SKT_BACKSTABBING	= 14, //attacking creature which haven't wait attack from you
45 SKT_FIRST_AID		= 15, //cure wounds
46 SKT_TACTICS			= 16,
47 SKT_ALCHEMY			= 17,
48 SKT_WOODCRAFT		= 18,
49 SKT_CREATETRAP		= 19,
50 SKT_NECROMANCY		= 20,
51 SKT_ATHLETICS		= 21,
52 };
53 
54 struct SKILL_DB
55 {
56 	char * name;
57 	int use_per_level;
58 };
59 
60 class XCreature;
61 
62 //#define SKILL_MAX_BONUS	11
63 #define SKILL_MAX_LEVEL 15
64 
65 enum SKILL_MASTERY
66 {
67 	SM_NONE			= 0,
68 	SM_BASIC		= 1,
69 	SM_SKILLED		= 2,
70 	SM_EXPERT		= 3,
71 	SM_MASTER		= 4,
72 	SM_GRANDMASTER	= 5,
73 };
74 
75 
76 class XSkill : public XObject
77 {
78 	int UseSteal(XCreature * user);
79 	int UseDisarm(XCreature * user);
80 	int UseCreate(XCreature * user);
81 public:
82 	DECLARE_CREATOR(XSkill, XObject);
83 	XSkill(SKILL_TYPE _skt, int _level = 1);
GetSkill()84 	SKILL_TYPE GetSkill() {return skt;}
85 	char * GetName();
86 	char * GetSkillLevel();
87 	void UseSkill(int n = 1);//called by monster when this skill was used succesfuly
88 	int Use(XCreature * user);
89 	int isUseable();
90 	int IncLevel();
GetLevel()91 	int GetLevel() {return level;}
92 	int GetMaxLevel();
93 	SKILL_MASTERY GetMastery();
94 
95 	SKILL_TYPE skt;
96 	virtual void Store(XFile * f);
97 	virtual void Restore(XFile * f);
98 
99 	int Compare(XObject * o); //need for alphabetic sorting
100 
101 protected:
102 	int used_time;
103 	int	level;
104 };
105 
106 #endif
107