-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCharacter_Skill.cpp
More file actions
52 lines (43 loc) 路 778 Bytes
/
Copy pathCharacter_Skill.cpp
File metadata and controls
52 lines (43 loc) 路 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#ifndef WORLDSIM_CHARACTER_SKILL_CPP
#define WORLDSIM_CHARACTER_SKILL_CPP
/* WorldSim: Character_Skill
#include "Character_Skill.cpp"
Container for managing Skills of a Character
*/
// For now levelling will be linear, however I might change it in the future.
class Skill
{
public:
std::string skillName;
int currentExp;
int expToNext;
int level;
int maxLevel;
Skill()
{
skillName="";
currentExp=0;
expToNext=0;
level=0;
maxLevel=100;
}
void init(std::string _skillName, int _expToNext)
{
skillName=_skillName;
currentExp=0;
expToNext=_expToNext;
level=0;
maxLevel=100;
}
void addExp(int _amount)
{
currentExp+=_amount;
while ( currentExp > expToNext)
{
++level;
currentExp-=expToNext;
}
}
};
#endif