dungeon/src/Actor.h

58 lines
1.3 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 { // TODO: Softcode this
2017-09-17 13:43:13 +02:00
ACT_BASE,
ACT_HERO,
ACT_GOBLIN,
ACT_SHAMAN
};
enum ActorFactions { // TODO: Make factions dynamic
FACTION_NONE,
FACTION_PLAYER,
FACTION_GOBS
2017-09-26 15:49:11 +02:00
};
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;
ActorFactions faction;
2018-01-09 21:59:05 +01:00
Actor(vec2i pos);
2017-09-17 13:43:13 +02:00
public:
2017-09-24 00:15:28 +02:00
int id;
std::string name;
bool player_controlled;
2017-09-17 13:43:13 +02:00
//Actor(Tilemap *map, vec2i pos, std::string datakey);
2017-09-26 15:49:11 +02:00
bool is_alive(){ return alive; };
2018-01-09 21:59:05 +01:00
void attack(vec2i dpos, Tilemap* map); // basic melee attack
2017-09-26 15:49:11 +02:00
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; }
ActorFactions get_actor_faction() { return faction; }
2017-09-26 15:49:11 +02:00
float get_range() { return range; }
void kill() { alive = false; health = 0; collision = false; };
2018-01-09 21:59:05 +01:00
void update(Tilemap* map);
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();
};