feat: implement shapes for entities
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Towers.h"
|
||||
#include "Types.h"
|
||||
#include "Team.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -75,7 +76,7 @@ const MobStats* getMobStats(MobType type, std::uint8_t level);
|
||||
const TowerImmunities& getMobTowerImmunities(MobType type, std::uint8_t level);
|
||||
const EffectImmunities& getMobEffectImmunities(MobType type, std::uint8_t level);
|
||||
|
||||
class Mob {
|
||||
class Mob : public utils::shape::Rectangle{
|
||||
protected:
|
||||
float m_Health;
|
||||
private:
|
||||
@@ -84,13 +85,12 @@ private:
|
||||
MobLevel m_Level;
|
||||
Direction m_Direction;
|
||||
std::vector<EffectDuration> m_Effects;
|
||||
const Tower* m_LastDamage; // the tower that damaged the mob
|
||||
const Tower* m_LastDamage; // the last tower that damaged the mob
|
||||
|
||||
utils::Timer m_EffectFireTimer;
|
||||
utils::Timer m_EffectPoisonTimer;
|
||||
utils::Timer m_EffectHealTimer;
|
||||
|
||||
float m_X = 0, m_Y = 0;
|
||||
public:
|
||||
Mob(MobID id, MobLevel level, PlayerID sender) : m_Sender(sender), m_Level(level),
|
||||
m_EffectFireTimer(1000), m_EffectPoisonTimer(1000), m_EffectHealTimer(1000) {
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
|
||||
virtual void tick(std::uint64_t delta);
|
||||
|
||||
virtual void OnDeath(World* world) {}
|
||||
virtual bool OnDeath(World* world) { return true; }
|
||||
|
||||
const TowerImmunities& getTowerImmunities() const { return getMobTowerImmunities(getType(), m_Level); }
|
||||
const EffectImmunities& getEffectImmunities() const { return getMobEffectImmunities(getType(), m_Level); }
|
||||
@@ -116,12 +116,6 @@ public:
|
||||
void damage(float dmg, const Tower* damager) { m_Health = std::max(0.0f, m_Health - dmg); m_LastDamage = damager; }
|
||||
void heal(float heal) { m_Health = std::min(static_cast<float>(getStats()->getMaxLife()), m_Health + heal); }
|
||||
|
||||
float getX() const { return m_X; }
|
||||
void setX(float x) { m_X = x; }
|
||||
|
||||
float getY() const { return m_Y; }
|
||||
void setY(float y) { m_Y = y; }
|
||||
|
||||
bool isImmuneTo(TowerType type);
|
||||
|
||||
bool isImmuneTo(EffectType type);
|
||||
|
||||
Reference in New Issue
Block a user