-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNPC.h
46 lines (40 loc) · 1.1 KB
/
NPC.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
#pragma once
#include <iostream>
#include <string>
#include "NPCdef.h"
class NPC
{
protected:
unsigned char x, y;
char symbol;
int hitpoints, speed, initiative;
unsigned int abilities;
std::string name, description;
short color;
Dice damage;
bool alive;
public:
NPC();
NPC(unsigned char x, unsigned char y);
NPC(unsigned char x, unsigned char y, NPCdef *def);
virtual ~NPC();
void setPos(unsigned char x, unsigned char y);
virtual void attack(NPC* defender);
virtual void hit(int amount);
void reset_initiative();
void use_initiative();
bool is_next_turn();
inline unsigned char getX(){ return x; }
inline unsigned char getY(){ return y; }
inline unsigned int getAbilities(){ return abilities; }
inline int getInitiative() { return initiative; }
inline char getSymbol(){return symbol;}
inline short getColor() {return color;}
inline int getHitpoints() {return hitpoints;}
inline bool isAlive() {return alive;}
inline int isNextTurn()
{
return initiative >= 10/speed;
}
friend std::ostream &operator<<(std::ostream &o, const NPC &npc);
};