6 #include "../Entities/GhastFireballEntity.h"
12 Super(
"Ghast",
mtGhast,
"entity.ghast.hurt",
"entity.ghast.death",
"entity.ghast.ambient", 4, 4),
30 auto SoundPitchMultiplier = 1.0f + (Random.RandReal(1.0f) - Random.RandReal(1.0f)) * 0.2f;
61 unsigned int LootingLevel = 0;
62 if (a_Killer !=
nullptr)
90 Speed.
y = Speed.
y + 1;
92 auto GhastBall = std::make_unique<cGhastFireballEntity>(
this,
GetPosition(), Speed);
93 auto GhastBallPtr = GhastBall.get();
94 GhastBallPtr->Initialize(std::move(GhastBall), *
m_World);
106 auto SpeedVector =
Vector3d(Random.RandReal(-0.3, 0.3), Random.RandReal(-0.4, 0.4), Random.RandReal(-0.3, 0.3));
110 SpeedVector =
Vector3d(Random.RandReal(-0.4, 0.4), Random.RandReal(-0.45, 0.4), Random.RandReal(-0.4, 0.4));
MTRand & GetRandomProvider()
Returns the current thread's random number source.
Vector3< double > Vector3d
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
void AddSpeed(double a_AddSpeedX, double a_AddSpeedY, double a_AddSpeedZ)
bool IsTicking(void) const
Returns true if the entity is valid and ticking.
void SetGravity(float a_Gravity)
double GetPosY(void) const
void SetAirDrag(float a_AirDrag)
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
Vector3d GetLookVector(void) const
cEnchantments m_Enchantments
This class bridges a vector of cItem for safe access via Lua.
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
virtual bool Attack(std::chrono::milliseconds a_Dt) override
Try to perform attack returns true if attack was deemed successful (hit player, fired projectile,...
int m_FlightCooldown
Number of ticks until the ghast tries to fly to another position.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
int m_TicksUntilShot
Number of ticks until a projectile is created.
bool m_IsCharging
Specifies whether or not the ghast has started shooting a fireball.
void ResetAttackCooldown()
void AddRandomDropItem(cItems &a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth=0)
Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops.
cPawn * GetTarget()
Returns the current target.
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
int m_AttackCoolDownTicksLeft
virtual void BroadcastEntityMetadata(const cEntity &a_Entity, const cClientHandle *a_Exclude=nullptr) override
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override