-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacter.h
90 lines (76 loc) · 2.26 KB
/
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
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
#ifndef CHARACTER_H
#define CHARACTER_H
/*External libs*/
#include <stdint.h>
#include "object_parser.h"
#ifndef __cplusplus
typedef void Character;
#endif
#ifdef __cplusplus
class Character{
private:
int x;
int y;
uint8_t type:4;
int: 4;
uint8_t id; //int?
uint32_t pace;
protected:
Character();
uint8_t speed;
char symbol;
int color;
int hp;
object_parser::private_wrapper::dice damage;
public:
Character(uint8_t id, int x, int y);
Character(uint8_t id, int x, int y, int speed, uint8_t type);
void setPos(const void* x, const void* y);
void setType(uint8_t type);
void updatePace();
void printCharacter() const;
int getX() const;
int getY() const;
int getId() const;
// Pair getPos() const; //remove?
char getSymbol() const;
uint8_t getSpeed() const;
int getColor() const;
int getHp() const;
bool checkType(uint8_t type) const;
void killCharacter();
virtual int attack() const;
/**
* Reduces the characters hp by @damage and returns true
* if character dies after damage else false
* @damage amount of damage dealt to the character
*/
virtual bool takeDamage(int damage);
bool operator<(const Character& rhs) const;
bool operator>(const Character& rhs) const;
bool operator==(const Character& rhs) const;
virtual ~Character();
};
extern "C" {
#endif /*EXTERN OPEN*/
// struct CharacterComparator;
// bool operator<(const Character& lhs, const Character& rhs);
Character* c_construct(uint8_t id, int x, int y);
Character* construct_Character(uint8_t id, int x, int y, int speed, uint8_t type);
void csetPos(Character* p, void* x, void* y);
void csetType(Character* p, uint8_t type);
// char** csetSight(Character* p, int height, int width);
// void cupdateSight(Character* p, int height, int width, char map[][width]);
void cprintCharacter(Character* p);
int cgetX(Character* p);
int cgetY(Character* p);
int cgetId(Character* p);
char cgetSymbol(Character *p);
int ccheckType(Character* p, uint8_t type);
void ckillCharacter(Character *p);
uint8_t cgetSpeed(Character* p);
void deleteCharacter(Character* p);
#ifdef __cplusplus
}
#endif /*EXTERN CLOSE*/
#endif /*Character_H*/