adg5/Destructible.h
2025-04-20 14:24:02 +10:00

31 lines
805 B
C++

#pragma once
#include <string>
class Actor;
class Destructible {
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);
inline bool isDead() { return hp <= 0; }
float takeDamage(Actor* owner, float damage);
virtual void die(Actor* owner);
};
class MonsterDestructible : public Destructible {
public:
MonsterDestructible(float maxHp, float defense, std::string corpseName);
void die(Actor* owner);
};
class PlayerDestructible : public Destructible {
public:
PlayerDestructible(float maxHp, float defense, std::string corpseName);
void die(Actor* owner);
};