-
Notifications
You must be signed in to change notification settings - Fork 0
/
character.h
55 lines (33 loc) · 809 Bytes
/
character.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
#ifndef __CHARACTERS_H__
#define __CHARACTERS_H__
#include "entity.h"
#include <cmath>
struct Posn;
class Tile;
class Character : public Entity {
const int maxhp;
int hp;
int att;
int def;
protected:
virtual void moveEffect();
virtual bool canMove(const Posn &np);
public:
Character(int maxhp, int hp, int att, int def, Posn p, char icon);
void detachTiles();
// accessors:
int getMaxHp() const;
int getHp() const;
int getAtt() const;
int getDef() const;
// char move takes a posn instead of a string direction.
bool move(const Posn &np);
int calculateDamage(Character *attacker);
virtual int defaultAttack(Character *c);
// mutators:
void setHp(int newHp);
void setAtt(int newAtt);
void setDef(int newDef);
virtual std::string getRace() const = 0;
};
#endif