moved almost all hardcoded constants to "define.dat"
[k8-i-v-a-n.git] / src / game / wskill.h
blob4894ef4d7b26172a00abfcd8762a63a85757cce6
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __WSKILL_H__
13 #define __WSKILL_H__
15 #include "ivancommon.h"
17 #include "ivandef.h"
20 class outputfile;
21 class inputfile;
24 class weaponskill {
25 public:
26 weaponskill () : Level(0), Hits(0), HitCounter(0) {}
27 virtual ~weaponskill () {}
29 int GetLevel () const { return Level; }
30 int GetHits () const { return Hits; }
31 truth Tick ();
32 truth AddHit (int);
33 truth SubHit (int);
35 virtual void Save (outputfile &) const;
36 virtual void Load (inputfile &);
37 virtual int GetLevelMap (int) const = 0;
38 virtual feuLong GetUnuseTickMap (int) const = 0;
39 virtual int GetUnusePenaltyMap (int) const = 0;
41 protected:
42 int Level;
43 int Hits;
44 uInt HitCounter;
48 class cweaponskill : public weaponskill {
49 public:
50 virtual ~cweaponskill () {}
52 virtual int GetLevelMap (int) const;
53 virtual feuLong GetUnuseTickMap (int) const;
54 virtual int GetUnusePenaltyMap (int) const;
55 cchar *GetName (int) const;
56 int GetBonus () const { return 1000+50*Level; }
57 void AddLevelUpMessage (int) const;
58 void AddLevelDownMessage (int) const;
62 inline outputfile &operator << (outputfile &SaveFile, const cweaponskill &WeaponSkill) {
63 WeaponSkill.Save(SaveFile);
64 return SaveFile;
68 inline inputfile &operator >> (inputfile &SaveFile, cweaponskill &WeaponSkill) {
69 WeaponSkill.Load(SaveFile);
70 return SaveFile;
74 class sweaponskill : public weaponskill {
75 public:
76 sweaponskill () : ID(0), Weight(0), Config(0) {}
77 sweaponskill (citem *);
78 virtual ~sweaponskill () {}
80 virtual int GetLevelMap (int) const;
81 virtual feuLong GetUnuseTickMap (int) const;
82 virtual int GetUnusePenaltyMap (int) const;
83 int GetBonus () const { return Level ? 1150+25*(Level-1) : 1000; }
84 void AddLevelUpMessage (cchar *) const;
85 void AddLevelDownMessage (cchar *) const;
86 virtual void Save (outputfile &) const;
87 virtual void Load (inputfile &);
88 truth IsSkillOf (citem *) const;
89 truth IsSkillOfCloneMother (citem *, feuLong) const;
90 void SetID (feuLong What) { ID = What; }
91 feuLong GetID () const { return ID; }
92 void PreProcessForBone () { ID = -ID; }
94 private:
95 feuLong ID;
96 sLong Weight;
97 int Config;
101 inline outputfile &operator << (outputfile &SaveFile, const sweaponskill *WeaponSkill) {
102 WeaponSkill->Save(SaveFile);
103 return SaveFile;
107 inline inputfile &operator >> (inputfile &SaveFile, sweaponskill *&WeaponSkill) {
108 WeaponSkill = new sweaponskill;
109 WeaponSkill->Load(SaveFile);
110 return SaveFile;
114 #endif