Cuberite
A lightweight, fast and extensible game server for Minecraft
Slime.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "AggressiveMonster.h"
5 
6 
7 
8 
9 
10 class cSlime:
11  public cAggressiveMonster
12 {
14 
15 public:
16 
18  cSlime(int a_Size);
19 
21 
22  // cAggressiveMonster overrides:
23  virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
24  virtual bool Attack(std::chrono::milliseconds a_Dt) override;
25  virtual void KilledBy(TakeDamageInfo & a_TDI) override;
26 
27  int GetSize(void) const { return m_Size; }
28 
31  static AString GetSizeName(int a_Size);
32 
33 protected:
34 
37  int m_Size;
38 } ;
39 
40 
41 
42 
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
std::string AString
Definition: StringUtils.h:11
Definition: Entity.h:76
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
cAggressiveMonster(const AString &a_ConfigName, eMonsterType a_MobType, const AString &a_SoundHurt, const AString &a_SoundDeath, const AString &a_SoundAmbient, float a_Width, float a_Height)
Definition: Slime.h:12
int GetSize(void) const
Definition: Slime.h:27
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...
Definition: Slime.cpp:12
int m_Size
Size of the slime, with 1 being the smallest.
Definition: Slime.h:37
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
Definition: Slime.cpp:65
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: Slime.cpp:31
virtual bool Attack(std::chrono::milliseconds a_Dt) override
Try to perform attack returns true if attack was deemed successful (hit player, fired projectile,...
Definition: Slime.cpp:50
static AString GetSizeName(int a_Size)
Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
Definition: Slime.cpp:103