-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActions.h
45 lines (34 loc) · 1004 Bytes
/
Actions.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
#ifndef __ACTION
#define __ACTION
#include <vector>
extern std::vector<class Action*> availableAction;
extern class Action action_Attack;
extern class Action action_Skill;
extern class Action action_Defence;
extern class Action action_Fill_Health;
class Action
{
char key;
const char* explain;
bool (*currentFunction)();
public:
Action( char wantKey, const char* wantExplain, bool(*wantFunction)() ) {
key = wantKey;
explain = wantExplain;
currentFunction = wantFunction;
}
__inline char GetKey() { return key; }
__inline char GetUpperKey(){ return (key >= 'a' && key <= 'z') ? key - 32 : key ; }
__inline char GetLowerKey(){ return (key >= 'A' && key <= 'Z') ? key + 32 : key; }
__inline const char* GetExplain() { return explain; }
bool TryKey(char wantKey)
{
if (key != wantKey) return false;
if (currentFunction == nullptr) return false;
return currentFunction();
}
};
void ClearAction();
void AddAction(Action& target);
void ImportCombatAction();
#endif