too many things

This commit is contained in:
2025-07-18 13:11:18 +02:00
parent b788caafa6
commit 6d0e56eb46
26 changed files with 529 additions and 191 deletions

View File

@@ -10,8 +10,11 @@
#include <vector>
namespace td {
using Vec2fp = Vec2<FpFloat>;
namespace game {
struct WalkableTile;
enum class EffectType : std::uint8_t {
@@ -62,11 +65,12 @@ 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 : public utils::shape::Rectangle {
class Mob {
protected:
float m_Health;
private:
Vec2fp m_Position;
MobID m_ID;
PlayerID m_Sender;
MobLevel m_Level;
@@ -89,12 +93,14 @@ class Mob : public utils::shape::Rectangle {
virtual MobType GetType() const = 0;
virtual void Tick(std::uint64_t delta, World* world) {}
virtual bool OnDeath(World* world) {
return true;
}
Vec2fp& GetPosition() {
return m_Position;
}
MobID GetMobID() const {
return m_ID;
}
@@ -156,15 +162,15 @@ class Mob : public utils::shape::Rectangle {
return m_HitCooldown > 0;
}
// returns a float between 0 and 1 excluded
float GetTileX() {
return GetCenterX() - static_cast<float>(static_cast<std::int32_t>(GetCenterX()));
}
// // returns a float between 0 and 1 excluded
// float GetTileX() {
// return GetCenterX() - static_cast<float>(static_cast<std::int32_t>(GetCenterX()));
// }
// returns a float between 0 and 1 excluded
float GetTileY() {
return GetCenterY() - static_cast<float>(static_cast<std::int32_t>(GetCenterY()));
}
// // returns a float between 0 and 1 excluded
// float GetTileY() {
// return GetCenterY() - static_cast<float>(static_cast<std::int32_t>(GetCenterY()));
// }
Direction GetDirection() const {
return m_Direction;
@@ -176,7 +182,7 @@ class Mob : public utils::shape::Rectangle {
protected:
void InitMob() {
m_Health = static_cast<float>(GetStats()->m_MaxLife);
SetSize(GetStats()->m_Size.x, GetStats()->m_Size.y);
// SetSize(GetStats()->m_Size.x, GetStats()->m_Size.y);
}
private:
@@ -201,9 +207,7 @@ class ConcreteMob : public Mob {
virtual ~ConcreteMob() {}
virtual void Tick(std::uint64_t delta, World* world) {}
virtual constexpr MobType GetType() const {
virtual constexpr MobType GetType() const override {
return MT;
}
};