5 #include "../FastRandom.h" 15 Printf(
"entity.%sslime.hurt", GetSizeName(a_Size).c_str()),
16 Printf(
"entity.%sslime.death", GetSizeName(a_Size).c_str()),
32 unsigned int LootingLevel = 0;
33 if (a_Killer !=
nullptr)
74 int SpawnAmount = Random.RandInt(2, 4);
76 for (
int i = 0; i < SpawnAmount; ++i)
78 double AddX = (i % 2 - 0.5) *
m_Size / 4.0;
79 double AddZ = (i / 2 - 0.5) *
m_Size / 4.0;
81 auto NewSlime = cpp14::make_unique<cSlime>(
m_Size / 2);
83 NewSlime->SetYaw(Random.RandReal(360.0f));
double GetPosY(void) const
double GetPosX(void) const
virtual bool Attack(std::chrono::milliseconds a_Dt)
Try to perform attack returns true if attack was deemed successful (hit player, fired projectile...
MTRand & GetRandomProvider()
Returns the current thread's random number source.
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.
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
cSlime(int a_Size)
Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tal...
void SetMaxHealth(float a_MaxHealth)
Sets the maximum value for the health.
cEnchantments m_Enchantments
void SetAttackDamage(int a_AttackDamage)
AString & Printf(AString &str, const char *format, fmt::ArgList args)
Output the formatted text into the string.
float GetHealth(void) const
Returns the health of this entity.
static AString GetSizeName(int a_Size)
Returns the text describing the slime's size, as used by the client's resource subsystem for sounds...
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
UInt32 SpawnMobFinalize(std::unique_ptr< cMonster > a_Monster)
Wraps cEntity::Initialize, doing Monster-specific things before spawning the monster.
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
double GetPosZ(void) const
int m_Size
Size of the slime, with 1 being the smallest.
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
This class bridges a vector of cItem for safe access via Lua.
virtual bool Attack(std::chrono::milliseconds a_Dt) override
Try to perform attack returns true if attack was deemed successful (hit player, fired projectile...