#pragma once
#include
#include |
#include |
#include |
#include
#include
#include
#include
#include
namespace td {
using Vec2fp = Vec2;
namespace game {
struct WalkableTile;
enum class EffectType : std::uint8_t {
Slowness = 0,
Stun,
Fire,
Poison,
Heal,
};
enum class MobType : std::uint8_t {
Zombie = 0,
Spider,
Skeleton,
Pigman,
Creeper,
Silverfish,
Blaze,
Witch,
Slime,
Giant,
MOB_COUNT
};
typedef std::uint32_t MobID;
typedef std::uint8_t MobLevel;
typedef std::vector TowerImmunities;
typedef std::vector EffectImmunities;
struct MobStats {
float m_Damage;
float m_Speed;
Vec2f m_Size;
std::uint16_t m_MoneyCost;
std::uint16_t m_ExpCost;
std::uint16_t m_MaxLife;
std::uint16_t m_ExpReward;
};
struct EffectDuration {
EffectType type;
float duration; // in seconds
Tower* tower; // the tower that gived the effect
};
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 MobHandler;
struct MobData {};
class Mob : public sp::MessageBase {
public:
MobID m_ID;
MobLevel m_Level;
PlayerID m_Sender;
float m_Health;
Vec2fp m_Position;
Direction m_Direction;
std::vector m_Effects;
const Tower* m_LastDamage; // the last tower that damaged the mob
float m_HitCooldown;
TeamCastle* m_CastleTarget;
// utils::CooldownTimer m_AttackTimer;
MobPtr m_Next;
Mob() {}
Mob& operator=(const Mob& a_Other) = default;
};
template
using ConcreteMob = sp::ConcreteMessage;
using Zombie = ConcreteMob;
using Spider = ConcreteMob;
using Skeleton = ConcreteMob;
using PigMan = ConcreteMob;
using Creeper = ConcreteMob;
using Silverfish = ConcreteMob;
using Blaze = ConcreteMob;
using Witch = ConcreteMob;
using Slime = ConcreteMob;
using Giant = ConcreteMob;
using AllMobs = std::tuple;
class MobHandler : public sp::GenericHandler {};
using MobFactory = sp::MessageFactory;
class MobListener {
public:
virtual void OnMobSpawn(Mob* mob) {
MobHandler h;
}
virtual void OnMobDie(Mob* mob) {}
virtual void OnMobDamage(Mob* target, float damage, Tower* damager) {}
virtual void OnMobTouchCastle(Mob* damager, TeamCastle* enemyCastle) {}
virtual void OnMobCastleDamage(Mob* damager, TeamCastle* enemyCastle, float damage) {}
};
// typedef utils::ObjectNotifier MobNotifier;
} // namespace game
} // namespace td
|