3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
17 int CWeaponSkillLevelMap
[] = {
18 0, 1500, 2000, 3000, 5000, 7500, 10000, 15000,
19 20000, 30000, 50000, 75000, 100000, 150000,
20 200000, 300000, 500000, 750000, 1000000,
24 feuLong CWeaponSkillUnuseTickMap
[] = {
25 500000, 400000, 300000, 250000, 200000,
26 150000, 125000, 100000, 80000, 62500,
27 50000, 40000, 30000, 25000, 20000,
28 15000, 12500, 10000, 8000, 6250, 5000
31 int CWeaponSkillUnusePenaltyMap
[] = {
32 100, 125, 150, 200, 250, 300, 400, 500,
33 625, 800, 1000, 1250, 1500, 2000, 2500,
34 3000, 4000, 5000, 6250, 8000, 10000
37 cchar
*CWeaponSkillName
[WEAPON_SKILL_CATEGORIES
] = {
51 int SWeaponSkillLevelMap
[] = {
52 0, 500, 750, 1000, 1500, 2000, 3000, 5000,
53 7500, 10000, 15000, 20000, 30000, 50000,
54 75000, 100000, 150000, 200000, 300000,
58 feuLong SWeaponSkillUnuseTickMap
[] = {
59 250000, 200000, 150000, 125000, 100000,
60 80000, 62500, 50000, 40000, 30000,
61 25000, 20000, 15000, 12500, 10000,
62 8000, 6250, 5000, 4000, 3000, 2500
65 int SWeaponSkillUnusePenaltyMap
[] = {
66 250, 300, 400, 500, 625, 800, 1000,
67 1250, 1500, 2000, 2500, 3000, 4000,
68 5000, 6250, 8000, 10000, 12500, 15000,
73 int cweaponskill::GetLevelMap (int I
) const { return CWeaponSkillLevelMap
[I
]; }
74 feuLong
cweaponskill::GetUnuseTickMap (int I
) const { return CWeaponSkillUnuseTickMap
[I
]; }
75 int cweaponskill::GetUnusePenaltyMap (int I
) const { return CWeaponSkillUnusePenaltyMap
[I
]; }
76 cchar
*cweaponskill::GetName (int Category
) const { return CWeaponSkillName
[Category
]; }
78 sweaponskill::sweaponskill (citem
*Item
) : ID(Item
->GetID()), Weight(Item
->GetWeight()), Config(Item
->GetConfig()) {}
79 int sweaponskill::GetLevelMap (int I
) const { return SWeaponSkillLevelMap
[I
]; }
80 feuLong
sweaponskill::GetUnuseTickMap (int I
) const { return SWeaponSkillUnuseTickMap
[I
]; }
81 int sweaponskill::GetUnusePenaltyMap (int I
) const { return SWeaponSkillUnusePenaltyMap
[I
]; }
83 void weaponskill::Save (outputfile
&SaveFile
) const { SaveFile
<< (int)Level
<< (int)Hits
<< (int)HitCounter
; }
84 void weaponskill::Load (inputfile
&SaveFile
) { SaveFile
>> (int&)Level
>> (int&)Hits
>> (int&)HitCounter
; }
86 truth
weaponskill::AddHit (int AddHits
) {
87 if (!AddHits
) return false;
89 if (Hits
<= 5000000-AddHits
) Hits
+= AddHits
; else Hits
= 5000000;
91 while (Level
< 20 && Hits
>= GetLevelMap(Level
+ 1)) ++Level
;
92 return Level
!= OldLevel
;
96 truth
weaponskill::SubHit (int SubHits
) {
97 if (!SubHits
) return false;
98 if (Hits
>= SubHits
) Hits
-= SubHits
; else Hits
= 0;
100 while (Level
&& Hits
< GetLevelMap(Level
)) --Level
;
101 return Level
!= OldLevel
;
105 void cweaponskill::AddLevelUpMessage (int Category
) const {
106 ADD_MESSAGE("You advance to skill level %d with %s!", Level
, CWeaponSkillName
[Category
]);
110 void cweaponskill::AddLevelDownMessage (int Category
) const {
111 ADD_MESSAGE("You have not practised enough with %s lately. Your skill level is reduced to %d!", CWeaponSkillName
[Category
], Level
);
115 void sweaponskill::AddLevelUpMessage (cchar
*WeaponName
) const {
116 ADD_MESSAGE("You advance to skill level %d with your %s!", Level
, WeaponName
);
120 void sweaponskill::AddLevelDownMessage (cchar
*WeaponName
) const {
121 ADD_MESSAGE("You have not practised enough with your %s lately. Your skill level is reduced to %d!", WeaponName
, Level
);
125 void sweaponskill::Save (outputfile
&SaveFile
) const {
126 weaponskill::Save(SaveFile
);
127 SaveFile
<< ID
<< Weight
<< (int)Config
;
131 void sweaponskill::Load (inputfile
&SaveFile
) {
132 weaponskill::Load(SaveFile
);
133 SaveFile
>> ID
>> Weight
>> (int&)Config
;
137 truth
weaponskill::Tick () {
138 if (Hits
&& HitCounter
++ >= GetUnuseTickMap(Level
)) {
139 HitCounter
-= GetUnuseTickMap(Level
);
140 if (SubHit(GetUnusePenaltyMap(Level
))) return true;
146 truth
sweaponskill::IsSkillOf (citem
*Item
) const {
147 return (ID
== Item
->GetID() && Weight
== Item
->GetWeight() && Config
== Item
->GetConfig());
151 truth
sweaponskill::IsSkillOfCloneMother (citem
*Item
, feuLong CMID
) const {
152 return (ID
== CMID
&& Weight
== Item
->GetWeight() && Config
== Item
->GetConfig());