2026-03-01 12:16:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
#include "FlyingMob.h"
|
|
|
|
|
#include "Enemy.h"
|
|
|
|
|
|
|
|
|
|
class GhastClass;
|
|
|
|
|
class Level;
|
|
|
|
|
|
|
|
|
|
class Ghast : public FlyingMob, public Enemy
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
eINSTANCEOF GetType() { return eTYPE_GHAST; }
|
|
|
|
|
static Entity *create(Level *level) { return new Ghast(level); }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
static const int DATA_IS_CHARGING = 16;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
int floatDuration;
|
|
|
|
|
double xTarget, yTarget, zTarget;
|
|
|
|
|
|
2026-03-02 17:37:16 +07:00
|
|
|
private:
|
|
|
|
|
shared_ptr<Entity> target;
|
2026-03-01 12:16:08 +08:00
|
|
|
int retargetTime;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
int oCharge;
|
|
|
|
|
int charge;
|
|
|
|
|
|
|
|
|
|
private:
|
2026-03-03 03:04:10 +08:00
|
|
|
int explosionPower;
|
|
|
|
|
|
|
|
|
|
|
2026-03-01 12:16:08 +08:00
|
|
|
void _init();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Ghast(Level *level);
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
virtual bool isCharging();
|
|
|
|
|
virtual bool hurt(DamageSource *source, float dmg);
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void defineSynchedData();
|
2026-03-03 03:04:10 +08:00
|
|
|
virtual void registerAttributes();
|
2026-03-01 12:16:08 +08:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void serverAiStep();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
virtual bool canReach(double xt, double yt, double zt, double dist);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual int getAmbientSound();
|
|
|
|
|
virtual int getHurtSound();
|
|
|
|
|
virtual int getDeathSound();
|
|
|
|
|
virtual int getDeathLoot();
|
|
|
|
|
virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel);
|
|
|
|
|
virtual float getSoundVolume();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual bool canSpawn();
|
2026-03-03 03:04:10 +08:00
|
|
|
virtual int getMaxSpawnClusterSize();
|
|
|
|
|
virtual void addAdditonalSaveData(CompoundTag *tag);
|
|
|
|
|
virtual void readAdditionalSaveData(CompoundTag *tag);
|
2026-03-01 12:16:08 +08:00
|
|
|
};
|