#pragma once #include #include "libtcod.hpp" #include "Persistance.h" class Actor; class Destructible : public Persistent { public: float maxHp; // maximum health points float hp; // current health points float defense; // hit points deflected std::string corpseName; // the actor's name once dead/destroyed Destructible(float maxHp, float defense, std::string corpseName); virtual ~Destructible() {}; inline bool isDead() { return hp <= 0; } float takeDamage(Actor* owner, float damage); virtual void die(Actor* owner); float heal(float amount); void load(TCODZip& zip); void save(TCODZip& zip); static Destructible* create(TCODZip& zip); protected: enum DestructibleType { MONSTER, PLAYER }; }; class MonsterDestructible : public Destructible { public: MonsterDestructible(float maxHp, float defense, std::string corpseName); void save(TCODZip& zip); void die(Actor* owner); }; class PlayerDestructible : public Destructible { public: PlayerDestructible(float maxHp, float defense, std::string corpseName); void save(TCODZip& zip); void die(Actor* owner); };