Cuberite
A lightweight, fast and extensible game server for Minecraft
EnderDragon.cpp
Go to the documentation of this file.
1 
2 #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
3 
4 #include "EnderDragon.h"
5 #include "../ClientHandle.h"
6 #include "../CompositeChat.h"
7 
8 
9 
10 
11 
13  Super("EnderDragon", mtEnderDragon, "entity.enderdragon.hurt", "entity.enderdragon.death", "entity.enderdragon.ambient", 16, 8)
14 {
15 }
16 
17 
18 
19 
20 
22 {
23  if (!Super::DoTakeDamage(a_TDI))
24  {
25  return false;
26  }
27 
29  return true;
30 }
31 
32 
33 
34 
35 
36 void cEnderDragon::GetDrops(cItems & a_Drops, cEntity * a_Killer)
37 {
38  // No drops
39 }
40 
41 
42 
43 
44 
46 {
47  Super::SpawnOn(a_Client);
48 
49  // Red boss bar with no divisions that plays boss music and creates fog:
50  a_Client.SendBossBarAdd(GetUniqueID(), cCompositeChat("Ender Dragon"), GetHealth() / GetMaxHealth(), BossBarColor::Red, BossBarDivisionType::None, false, true, true);
51 }
@ mtEnderDragon
Definition: MonsterTypes.h:26
void SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat &a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog)
Container for a single chat message composed of multiple functional parts.
Definition: CompositeChat.h:34
Definition: Entity.h:76
float GetMaxHealth(void) const
Definition: Entity.h:407
cWorld * m_World
Definition: Entity.h:624
UInt32 GetUniqueID(void) const
Definition: Entity.h:253
float GetHealth(void) const
Returns the health of this entity.
Definition: Entity.h:367
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
Definition: EnderDragon.cpp:21
virtual void SpawnOn(cClientHandle &a_Client) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
Definition: EnderDragon.cpp:45
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: EnderDragon.cpp:36
virtual void SpawnOn(cClientHandle &a_ClientHandle) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
Definition: Monster.cpp:167
virtual bool DoTakeDamage(TakeDamageInfo &a_TDI) override
Makes this entity take damage specified in the a_TDI.
Definition: Monster.cpp:572
virtual void BroadcastBossBarUpdateHealth(const cEntity &a_Entity, UInt32 a_UniqueID, float a_FractionFilled) override