#ifndef ROGUE_CHARACTER_H
#define ROGUE_CHARACTER_H

#include "core/roguedefs.h"
#include <memory>

namespace rogue {
class World;
class Character;

struct CharacterLogic {
	virtual ~CharacterLogic();

	virtual Tile move() = 0;
protected:
	Character *character{nullptr};
private:
	friend class Character;
	void set_character(Character *character);
};

struct CharacterData {
	int health{1};
	int damage{1};
	Sprite sprite{0};
};

struct Character {
	Character() = default;
	Character(Tile location, CharacterLogic *logic, CharacterData stats);

	void act();
	void draw();
	bool deal_damage(int damage);

	CharacterData data{};
	int health{1};
	Tile location{0, 0};
	World *world{nullptr};
private:
	std::shared_ptr<CharacterLogic> logic{nullptr};
};

struct NullCharacterLogic : public CharacterLogic {
 	virtual Tile move() override;
};
}

#endif // !ROGUE_CHARACTER_H
