dungeon/src/Actor.h

56 lines
1.2 KiB
C
Raw Normal View History

2017-09-17 13:43:13 +02:00
#pragma once
#include "vec2i.h"
2017-09-26 15:49:11 +02:00
#include "Entity.h"
2017-09-24 00:15:28 +02:00
#include <string>
2017-09-17 13:43:13 +02:00
class BehaviourTree;
enum Actors {
ACT_BASE,
ACT_HERO,
ACT_GOBLIN,
ACT_SHAMAN
};
2017-09-26 15:49:11 +02:00
enum ActorTeams {
TEAM_NONE,
TEAM_PLAYER,
TEAM_GOBS
};
2017-09-17 13:43:13 +02:00
class Tilemap;
2017-09-26 15:49:11 +02:00
class Actor : public Entity {
2017-09-17 13:43:13 +02:00
int healcounter;
protected:
BehaviourTree* bt;
2017-09-26 15:49:11 +02:00
int health;
int health_max;
int strength;
float range;
bool alive;
ActorTeams team;
2017-09-17 13:43:13 +02:00
public:
2017-09-24 00:15:28 +02:00
int id;
std::string name;
2017-09-17 13:43:13 +02:00
2017-09-26 15:49:11 +02:00
Actor(Tilemap *map, vec2i pos);
bool is_alive(){ return alive; };
void attack(vec2i dpos); // basic melee attack
void attack(Actor* act);
void heal(int amount);
void damage(int strength);
int get_strength() { return strength; }
int get_health() { return health; }
int get_health_max() { return health_max; }
ActorTeams get_actor_team() { return team; }
float get_range() { return range; }
void kill() { alive = false; health = 0; collision = false; };
2017-09-21 22:44:05 +02:00
void update();
2017-09-26 15:49:11 +02:00
virtual bool is_type_of(Actors actor){ return actor == ACT_BASE; };
virtual Actors type() { return ACT_BASE; };
EntityTypes entity_type() override { return ENTITY_ACTOR; };
2017-09-17 13:43:13 +02:00
~Actor();
};