Cuberite
A lightweight, fast and extensible game server for Minecraft
Zombie.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 "Zombie.h"
5 #include "../World.h"
6 #include "../LineBlockTracer.h"
7 
8 
9 
10 
11 
13  Super("Zombie", mtZombie, "entity.zombie.hurt", "entity.zombie.death", "entity.zombie.ambient", 0.6f, 1.95f)
14 {
15 }
16 
17 
18 
19 
20 
21 void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
22 {
23  unsigned int LootingLevel = 0;
24  if (a_Killer != nullptr)
25  {
27  }
28  AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ROTTEN_FLESH);
29  cItems RareDrops;
30  RareDrops.Add(cItem(E_ITEM_IRON));
31  RareDrops.Add(cItem(E_ITEM_CARROT));
32  RareDrops.Add(cItem(E_ITEM_POTATO));
33  AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
34  AddRandomArmorDropItem(a_Drops, LootingLevel);
35  AddRandomWeaponDropItem(a_Drops, LootingLevel);
36 }
@ E_ITEM_IRON
Definition: BlockType.h:309
@ E_ITEM_ROTTEN_FLESH
Definition: BlockType.h:412
@ E_ITEM_CARROT
Definition: BlockType.h:437
@ E_ITEM_POTATO
Definition: BlockType.h:438
@ mtZombie
Definition: MonsterTypes.h:79
unsigned int GetLevel(int a_EnchantmentID) const
Returns the level for the specified enchantment; 0 if not stored.
Definition: Entity.h:76
virtual cItem GetEquippedWeapon(void) const
Returns the curently equipped weapon; empty item if none.
Definition: Entity.h:333
Definition: Item.h:37
cEnchantments m_Enchantments
Definition: Item.h:166
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
void Add(const cItem &a_Item)
Definition: Item.h:233
void AddRandomRareDropItem(cItems &a_Drops, cItems &a_Items, unsigned int a_LootingLevel)
Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel...
Definition: Monster.cpp:1549
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.
Definition: Monster.cpp:1518
void AddRandomWeaponDropItem(cItems &a_Drops, unsigned int a_LootingLevel)
Adds weapon that is equipped with the chance saved in m_DropChance... to the drop.
Definition: Monster.cpp:1606
void AddRandomArmorDropItem(cItems &a_Drops, unsigned int a_LootingLevel)
Adds armor that is equipped with the chance saved in m_DropChance... to the drop.
Definition: Monster.cpp:1563
virtual void GetDrops(cItems &a_Drops, cEntity *a_Killer=nullptr) override
Returns the list of drops for this pawn when it is killed.
Definition: Zombie.cpp:21
cZombie()
Definition: Zombie.cpp:12