-
Notifications
You must be signed in to change notification settings - Fork 0
/
skills.h
109 lines (84 loc) · 3.1 KB
/
skills.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#pragma once
#include <list>
#include <memory>
#include <map>
#include "creature.h" //Stats and Points structs
#include "buffs.h"
enum skillTargetType {
TYPE_SELF,
TYPE_ENEMY
};
enum skillReturnType {
SKILL_SUCCESS = 0, //Skill used - go to next turn
SKILL_FAIL_COST = 1, //Could not afford to cast
SKILL_NOT_UNLOCKED = 2,
SKILL_BASE_CLASS_ERROR = 99
};
//============================
// Skill & subclasses
//============================
class Skill {
//Pointer to parent in skill tree
const Skill *parent;
bool unlocked;
std::string name;
std::string description;
bool passive = false;
skillTargetType targetType;
Points cost;
skillDamageType damageType;
protected:
bool checkCost(Creature &caster);
skillReturnType canCast(Creature &caster);
public:
const char shortcut;
virtual skillReturnType Use(Creature &caster);
virtual skillReturnType Use(Creature &caster, Creature &target);
std::string getName();
std::string getDesc();
Points getCost();
skillDamageType getDamageType();
bool isUnlocked() const;
bool canUnlock();
void unlock();
skillTargetType getTargetType();
Skill() : shortcut('@') {}; //Required by compiler. If we ever see '@' as a hotkey, something broke!
Skill(skillTargetType type, skillDamageType damageType, bool startsUnlocked, bool isPassive, Skill *parentNode, char key, std::string skillName, std::string skillDescription, Points cost);
};
class Heal : public Skill {
//Stored as negative (damage)
Points baseHealPoints;
public:
skillReturnType Use(Creature &caster);
Heal();
Heal(bool startsUnlocked, Skill *parentNode, char key, std::string skillName, std::string skillDescription, Points costPoints, Points basePointsToHeal);
};
class Melee : public Skill {
int baseDamage; //TODO replace baseDamage with Points
//If 0, not used
//Else, each multiplied by stat and added (subject to change)
Stats statDamageFactors;
public:
skillReturnType Use(Creature &caster, Creature &target);
Melee();
Melee(bool startsUnlocked, Skill *parentNode, char key, std::string skillName, std::string skillDescription, Points costPoints, int bDmg, Stats damageFactors );
};
//Flame touch, ice, necro?, etc
class MagicTouch : public Skill {
//Direct damage
int baseDamage; //TODO replace baseDamage with Points
Stats statDamageFactors;
Buff *debuff;
public:
skillReturnType Use(Creature &caster, Creature &target);
MagicTouch();
MagicTouch(bool startsUnlocked, Skill *parentNode, char key, std::string name, std::string skillDescription, Points costPoints, int bDmg, Stats damageFactors, Buff *buff);
};
//typedef std::map<std::string,Heal> healPtrMap;
//typedef std::map<std::string,Melee> meleePtrMap;
typedef std::list<Skill*> skillPtrList;
skillPtrList createSkillPtrList(); //Player skill list
skillPtrList createMonsterSkillList();//Default Skill list for monsters
//typedef std::list<std::shared_ptr<Skill>> skillSharedPtrList;
//skillSharedPtrList createSafeSkillList();
Skill * getSkillByHotkey(skillPtrList &skillPtrs, char key);