-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAi.hpp
45 lines (42 loc) · 1.01 KB
/
Ai.hpp
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
class Ai : public Persistent {
public:
virtual void update(Actor *owner) = 0;
virtual ~Ai() {}
static Ai *create(TCODZip &zip);
protected:
enum AiType {
MONSTER,CONFUSED_MONSTER,PLAYER
};
};
class PlayerAi : public Ai {
public:
int xpLevel;
PlayerAi();
int getNextLevelXp();
void update(Actor *owner);
void load(TCODZip &zip);
void save(TCODZip &zip);
protected:
bool moveOrAttack(Actor *owner, int targetx, int targety);
void handleActionKey(Actor *owner, int ascii);
Actor *choseFromInventory(Actor *owner);
};
class MonsterAi : public Ai {
public:
void update(Actor *owner);
void load(TCODZip &zip);
void save(TCODZip &zip);
protected:
int moveCount;
void moveOrAttack(Actor *owner, int targetx, int targety);
};
class ConfusedMonsterAi : public Ai {
public:
ConfusedMonsterAi(int nbTurns, Ai *oldAi);
void update(Actor *owner);
void load(TCODZip &zip);
void save(TCODZip &zip);
protected:
int nbTurns;
Ai *oldAi;
};