summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2014-08-21 02:56:31 +0200
committerSamuel Barney <samjbarney@gmail.com>2014-08-21 02:56:31 +0200
commit34e0bc759326803ead6e752533b402ff32db9dd2 (patch)
treef535df9df31aaac33f5f8461733503a842adea66
parentTemporarily instantiating components here. (diff)
downloadcuberite-34e0bc759326803ead6e752533b402ff32db9dd2.tar
cuberite-34e0bc759326803ead6e752533b402ff32db9dd2.tar.gz
cuberite-34e0bc759326803ead6e752533b402ff32db9dd2.tar.bz2
cuberite-34e0bc759326803ead6e752533b402ff32db9dd2.tar.lz
cuberite-34e0bc759326803ead6e752533b402ff32db9dd2.tar.xz
cuberite-34e0bc759326803ead6e752533b402ff32db9dd2.tar.zst
cuberite-34e0bc759326803ead6e752533b402ff32db9dd2.zip
-rw-r--r--src/Mobs/CMakeLists.txt60
-rw-r--r--src/Mobs/NewBat.cpp14
-rw-r--r--src/Mobs/NewBat.h25
-rw-r--r--src/Mobs/NewBlaze.cpp27
-rw-r--r--src/Mobs/NewBlaze.h21
-rw-r--r--src/Mobs/NewCaveSpider.cpp44
-rw-r--r--src/Mobs/NewCaveSpider.h25
-rw-r--r--src/Mobs/NewChicken.cpp66
-rw-r--r--src/Mobs/NewChicken.h28
-rw-r--r--src/Mobs/NewCow.cpp33
-rw-r--r--src/Mobs/NewCow.h25
-rw-r--r--src/Mobs/NewCreeper.cpp69
-rw-r--r--src/Mobs/NewCreeper.h34
-rw-r--r--src/Mobs/NewEnderDragon.cpp27
-rw-r--r--src/Mobs/NewEnderDragon.h25
-rw-r--r--src/Mobs/NewEnderman.cpp32
-rw-r--r--src/Mobs/NewEnderman.h36
-rw-r--r--src/Mobs/NewGhast.cpp32
-rw-r--r--src/Mobs/NewGhast.h27
-rw-r--r--src/Mobs/NewGiant.cpp27
-rw-r--r--src/Mobs/NewGiant.h25
-rw-r--r--src/Mobs/NewHorse.cpp109
-rw-r--r--src/Mobs/NewHorse.h43
-rw-r--r--src/Mobs/NewIronGolem.cpp28
-rw-r--r--src/Mobs/NewIronGolem.h25
-rw-r--r--src/Mobs/NewMagmaCube.cpp30
-rw-r--r--src/Mobs/NewMagmaCube.h31
-rw-r--r--src/Mobs/NewMonster.cpp88
-rw-r--r--src/Mobs/NewMonster.h24
-rw-r--r--src/Mobs/NewMooshroom.cpp35
-rw-r--r--src/Mobs/NewMooshroom.h25
-rw-r--r--src/Mobs/NewOcelot.h26
-rw-r--r--src/Mobs/NewPig.cpp38
-rw-r--r--src/Mobs/NewPig.h32
-rw-r--r--src/Mobs/NewSheep.cpp78
-rw-r--r--src/Mobs/NewSheep.h46
-rw-r--r--src/Mobs/NewSilverfish.h26
-rw-r--r--src/Mobs/NewSkeleton.cpp58
-rw-r--r--src/Mobs/NewSkeleton.h33
-rw-r--r--src/Mobs/NewSlime.cpp61
-rw-r--r--src/Mobs/NewSlime.h39
-rw-r--r--src/Mobs/NewSnowGolem.cpp24
-rw-r--r--src/Mobs/NewSnowGolem.h25
-rw-r--r--src/Mobs/NewSpider.cpp35
-rw-r--r--src/Mobs/NewSpider.h25
-rw-r--r--src/Mobs/NewSquid.cpp33
-rw-r--r--src/Mobs/NewSquid.h25
-rw-r--r--src/Mobs/NewVillager.cpp19
-rw-r--r--src/Mobs/NewVillager.h43
-rw-r--r--src/Mobs/NewWitch.cpp47
-rw-r--r--src/Mobs/NewWitch.h28
-rw-r--r--src/Mobs/NewWither.cpp42
-rw-r--r--src/Mobs/NewWither.h31
-rw-r--r--src/Mobs/NewWolf.cpp24
-rw-r--r--src/Mobs/NewWolf.h43
-rw-r--r--src/Mobs/NewZombie.cpp42
-rw-r--r--src/Mobs/NewZombie.h33
-rw-r--r--src/Mobs/NewZombiePigman.cpp38
-rw-r--r--src/Mobs/NewZombiePigman.h24
59 files changed, 2156 insertions, 2 deletions
diff --git a/src/Mobs/CMakeLists.txt b/src/Mobs/CMakeLists.txt
index 060c012fc..1cb01443e 100644
--- a/src/Mobs/CMakeLists.txt
+++ b/src/Mobs/CMakeLists.txt
@@ -36,7 +36,34 @@ SET (SRCS
Wither.cpp
Wolf.cpp
Zombie.cpp
- ZombiePigman.cpp)
+ ZombiePigman.cpp
+ NewBat.cpp
+ NewBlaze.cpp
+ NewCaveSpider.cpp
+ NewChicken.cpp
+ NewCow.cpp
+ NewCreeper.cpp
+ NewEnderDragon.cpp
+ NewEnderman.cpp
+ NewGhast.cpp
+ NewGiant.cpp
+ NewHorse.cpp
+ NewIronGolem.cpp
+ NewMagmaCube.cpp
+ NewMooshroom.cpp
+ NewPig.cpp
+ NewSheep.cpp
+ NewSkeleton.cpp
+ NewSlime.cpp
+ NewSnowGolem.cpp
+ NewSpider.cpp
+ NewSquid.cpp
+ NewVillager.cpp
+ NewWitch.cpp
+ NewWither.cpp
+ NewWolf.cpp
+ NewZombie.cpp
+ NewZombiePigman.cpp)
SET (HDRS
AggressiveMonster.h
@@ -73,7 +100,36 @@ SET (HDRS
Wither.h
Wolf.h
Zombie.h
- ZombiePigman.h)
+ ZombiePigman.h
+ NewBat.h
+ NewBlaze.h
+ NewCaveSpider.h
+ NewChicken.h
+ NewCow.h
+ NewCreeper.h
+ NewEnderDragon.h
+ NewEnderman.h
+ NewGhast.h
+ NewGiant.h
+ NewHorse.h
+ NewIronGolem.h
+ NewMagmaCube.h
+ NewMooshroom.h
+ NewOcelot.h
+ NewPig.h
+ NewSheep.h
+ NewSilverfish.h
+ NewSkeleton.h
+ NewSlime.h
+ NewSnowGolem.h
+ NewSpider.h
+ NewSquid.h
+ NewVillager.h
+ NewWitch.h
+ NewWither.h
+ NewWolf.h
+ NewZombie.h
+ NewZombiePigman.h)
if(NOT MSVC)
add_library(Mobs ${SRCS} ${HDRS})
diff --git a/src/Mobs/NewBat.cpp b/src/Mobs/NewBat.cpp
new file mode 100644
index 000000000..2de28d63a
--- /dev/null
+++ b/src/Mobs/NewBat.cpp
@@ -0,0 +1,14 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewBat.h"
+#include "../Vector3.h"
+#include "../Chunk.h"
+
+
+cNewBat::cNewBat(void) :
+ super("Bat", mtBat, "mob.bat.hurt", "mob.bat.death", 0.5, 0.9)
+{
+}
+
+
diff --git a/src/Mobs/NewBat.h b/src/Mobs/NewBat.h
new file mode 100644
index 000000000..354413cdf
--- /dev/null
+++ b/src/Mobs/NewBat.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewBat :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewBat(void);
+
+ CLASS_PROTODEF(cNewBat)
+
+ bool IsHanging(void) const {return false; }
+} ;
+
+
+
+
diff --git a/src/Mobs/NewBlaze.cpp b/src/Mobs/NewBlaze.cpp
new file mode 100644
index 000000000..699a14227
--- /dev/null
+++ b/src/Mobs/NewBlaze.cpp
@@ -0,0 +1,27 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewBlaze.h"
+#include "../World.h"
+#include "../Entities/FireChargeEntity.h"
+
+
+
+
+cNewBlaze::cNewBlaze(void) :
+ super("Blaze", mtBlaze, "mob.blaze.hit", "mob.blaze.death", 0.6, 1.8)
+{
+}
+
+
+
+
+
+void cNewBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
+ {
+ int LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_BLAZE_ROD);
+ }
+}
diff --git a/src/Mobs/NewBlaze.h b/src/Mobs/NewBlaze.h
new file mode 100644
index 000000000..eebe491f5
--- /dev/null
+++ b/src/Mobs/NewBlaze.h
@@ -0,0 +1,21 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewBlaze :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewBlaze(void);
+
+ CLASS_PROTODEF(cNewBlaze)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
diff --git a/src/Mobs/NewCaveSpider.cpp b/src/Mobs/NewCaveSpider.cpp
new file mode 100644
index 000000000..c3acb926b
--- /dev/null
+++ b/src/Mobs/NewCaveSpider.cpp
@@ -0,0 +1,44 @@
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewCaveSpider.h"
+#include "../World.h"
+
+
+
+
+
+cNewCaveSpider::cNewCaveSpider(void) :
+ super("CaveSpider", mtCaveSpider, "mob.spider.say", "mob.spider.death", 0.7, 0.5)
+{
+}
+
+
+
+
+
+void cNewCaveSpider::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+}
+
+
+
+
+
+void cNewCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING);
+ if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
+ {
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE);
+ }
+}
+
+
+
+
diff --git a/src/Mobs/NewCaveSpider.h b/src/Mobs/NewCaveSpider.h
new file mode 100644
index 000000000..3e52189a0
--- /dev/null
+++ b/src/Mobs/NewCaveSpider.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewCaveSpider :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewCaveSpider(void);
+
+ CLASS_PROTODEF(cNewCaveSpider)
+
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewChicken.cpp b/src/Mobs/NewChicken.cpp
new file mode 100644
index 000000000..6c61507f2
--- /dev/null
+++ b/src/Mobs/NewChicken.cpp
@@ -0,0 +1,66 @@
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewChicken.h"
+#include "../World.h"
+
+
+
+
+
+
+
+cNewChicken::cNewChicken(void) :
+ super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4),
+ m_EggDropTimer(0)
+{
+}
+
+
+
+
+void cNewChicken::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+
+ if ((m_EggDropTimer == 6000) && (m_World->GetTickRandomNumber(1) == 0))
+ {
+ cItems Drops;
+ m_EggDropTimer = 0;
+ Drops.push_back(cItem(E_ITEM_EGG, 1));
+ m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
+ }
+ else if (m_EggDropTimer == 12000)
+ {
+ cItems Drops;
+ m_EggDropTimer = 0;
+ Drops.push_back(cItem(E_ITEM_EGG, 1));
+ m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
+ }
+ else
+ {
+ m_EggDropTimer++;
+ }
+}
+
+
+
+
+
+void cNewChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_FEATHER);
+ AddRandomDropItem(a_Drops, 1, 1, IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN);
+}
+
+
+
+
+
+
+
+
diff --git a/src/Mobs/NewChicken.h b/src/Mobs/NewChicken.h
new file mode 100644
index 000000000..4323585e6
--- /dev/null
+++ b/src/Mobs/NewChicken.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewChicken :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewChicken(void);
+
+ CLASS_PROTODEF(cNewChicken)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+
+private:
+
+ int m_EggDropTimer;
+} ;
+
+
+
diff --git a/src/Mobs/NewCow.cpp b/src/Mobs/NewCow.cpp
new file mode 100644
index 000000000..8009a5f0d
--- /dev/null
+++ b/src/Mobs/NewCow.cpp
@@ -0,0 +1,33 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewCow.h"
+#include "../Entities/Player.h"
+
+
+
+
+
+
+
+cNewCow::cNewCow(void) :
+ super("Cow", mtCow, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3)
+{
+}
+
+
+
+
+
+void cNewCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
+ AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
+}
+
+
diff --git a/src/Mobs/NewCow.h b/src/Mobs/NewCow.h
new file mode 100644
index 000000000..b0c770e84
--- /dev/null
+++ b/src/Mobs/NewCow.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewCow :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewCow();
+
+ CLASS_PROTODEF(cNewCow)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewCreeper.cpp b/src/Mobs/NewCreeper.cpp
new file mode 100644
index 000000000..a6f5e0e4d
--- /dev/null
+++ b/src/Mobs/NewCreeper.cpp
@@ -0,0 +1,69 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewCreeper.h"
+#include "../World.h"
+#include "../Entities/ProjectileEntity.h"
+#include "../Entities/Player.h"
+#include "../Entities/Entity.h"
+
+
+
+
+
+cNewCreeper::cNewCreeper(void) :
+ super("Creeper", mtCreeper, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8),
+ m_bIsBlowing(false),
+ m_bIsCharged(false),
+ // m_BurnedWithFlintAndSteel(false),
+ m_ExplodingTimer(0)
+{
+}
+
+
+
+
+
+void cNewCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ if (m_ExplodingTimer == 30)
+ {
+ // Exploded creepers drop naught but charred flesh, which Minecraft doesn't have
+ return;
+ }
+
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
+
+ if ((a_Killer != NULL) && a_Killer->IsProjectile() && (((cProjectileEntity *)a_Killer)->GetCreatorUniqueID() >= 0))
+ {
+ class cProjectileCreatorCallback : public cEntityCallback
+ {
+ public:
+ cProjectileCreatorCallback(void)
+ {
+ }
+
+ virtual bool Item(cEntity * a_Entity) override
+ {
+ if (a_Entity->IsMob() && ((cNewMonster *)a_Entity)->GetMobType() == mtSkeleton)
+ {
+ return true;
+ }
+ return false;
+ }
+ };
+
+ cProjectileCreatorCallback PCC;
+ if (GetWorld()->DoWithEntityByID(((cProjectileEntity *)a_Killer)->GetCreatorUniqueID(), PCC))
+ {
+ // 12 music discs. TickRand starts from 0 to 11. Disk IDs start at 2256, so add that. There.
+ AddRandomDropItem(a_Drops, 1, 1, (short)m_World->GetTickRandomNumber(11) + 2256);
+ }
+ }
+}
+
diff --git a/src/Mobs/NewCreeper.h b/src/Mobs/NewCreeper.h
new file mode 100644
index 000000000..61a16bf68
--- /dev/null
+++ b/src/Mobs/NewCreeper.h
@@ -0,0 +1,34 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewCreeper :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewCreeper(void);
+
+ CLASS_PROTODEF(cNewCreeper)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsBlowing(void) const {return m_bIsBlowing; }
+ bool IsCharged(void) const {return m_bIsCharged; }
+
+private:
+
+ bool m_bIsBlowing, m_bIsCharged/*, m_BurnedWithFlintAndSteel*/;
+ int m_ExplodingTimer;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewEnderDragon.cpp b/src/Mobs/NewEnderDragon.cpp
new file mode 100644
index 000000000..7ed9ab25a
--- /dev/null
+++ b/src/Mobs/NewEnderDragon.cpp
@@ -0,0 +1,27 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewEnderDragon.h"
+
+
+
+
+
+cNewEnderDragon::cNewEnderDragon(void) :
+ // TODO: Vanilla source says this, but is it right? Dragons fly, they don't stand
+ super("EnderDragon", mtEnderDragon, "mob.enderdragon.hit", "mob.enderdragon.end", 16.0, 8.0)
+{
+}
+
+
+
+
+
+void cNewEnderDragon::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ return;
+}
+
+
+
+
diff --git a/src/Mobs/NewEnderDragon.h b/src/Mobs/NewEnderDragon.h
new file mode 100644
index 000000000..524124f18
--- /dev/null
+++ b/src/Mobs/NewEnderDragon.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewEnderDragon :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewEnderDragon(void);
+
+ CLASS_PROTODEF(cNewEnderDragon)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewEnderman.cpp b/src/Mobs/NewEnderman.cpp
new file mode 100644
index 000000000..5a61265d7
--- /dev/null
+++ b/src/Mobs/NewEnderman.cpp
@@ -0,0 +1,32 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewEnderman.h"
+#include "../Entities/Player.h"
+#include "../Tracer.h"
+
+
+
+
+
+cNewEnderman::cNewEnderman(void) :
+ super("Enderman", mtEnderman, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.9),
+ m_bIsScreaming(false),
+ CarriedBlock(E_BLOCK_AIR),
+ CarriedMeta(0)
+{
+}
+
+
+
+
+
+void cNewEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ENDER_PEARL);
+}
diff --git a/src/Mobs/NewEnderman.h b/src/Mobs/NewEnderman.h
new file mode 100644
index 000000000..1a0a9a81b
--- /dev/null
+++ b/src/Mobs/NewEnderman.h
@@ -0,0 +1,36 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewEnderman :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewEnderman(void);
+
+ CLASS_PROTODEF(cNewEnderman)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsScreaming(void) const {return m_bIsScreaming; }
+ BLOCKTYPE GetCarriedBlock(void) const {return CarriedBlock; }
+ NIBBLETYPE GetCarriedMeta(void) const {return CarriedMeta; }
+
+private:
+
+ bool m_bIsScreaming;
+ BLOCKTYPE CarriedBlock;
+ NIBBLETYPE CarriedMeta;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewGhast.cpp b/src/Mobs/NewGhast.cpp
new file mode 100644
index 000000000..eb49a7a4f
--- /dev/null
+++ b/src/Mobs/NewGhast.cpp
@@ -0,0 +1,32 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewGhast.h"
+#include "../World.h"
+#include "../Entities/GhastFireballEntity.h"
+
+
+
+
+cNewGhast::cNewGhast(void) :
+ super("Ghast", mtGhast, "mob.ghast.scream", "mob.ghast.death", 4, 4)
+{
+}
+
+
+
+
+
+void cNewGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GHAST_TEAR);
+}
+
+
+
diff --git a/src/Mobs/NewGhast.h b/src/Mobs/NewGhast.h
new file mode 100644
index 000000000..d0af768c5
--- /dev/null
+++ b/src/Mobs/NewGhast.h
@@ -0,0 +1,27 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewGhast :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewGhast(void);
+
+ CLASS_PROTODEF(cNewGhast)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsCharging(void) const {return false; }
+} ;
+
+
+
+
diff --git a/src/Mobs/NewGiant.cpp b/src/Mobs/NewGiant.cpp
new file mode 100644
index 000000000..a6bb0b3ed
--- /dev/null
+++ b/src/Mobs/NewGiant.cpp
@@ -0,0 +1,27 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewGiant.h"
+
+
+
+
+
+cNewGiant::cNewGiant(void) :
+ super("Giant", mtGiant, "mob.zombie.hurt", "mob.zombie.death", 3.6, 10.8)
+{
+
+}
+
+
+
+
+
+void cNewGiant::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ AddRandomDropItem(a_Drops, 10, 50, E_ITEM_ROTTEN_FLESH);
+}
+
+
+
+
diff --git a/src/Mobs/NewGiant.h b/src/Mobs/NewGiant.h
new file mode 100644
index 000000000..823cb9638
--- /dev/null
+++ b/src/Mobs/NewGiant.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewGiant :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewGiant(void);
+
+ CLASS_PROTODEF(cNewGiant)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewHorse.cpp b/src/Mobs/NewHorse.cpp
new file mode 100644
index 000000000..2d02aeed2
--- /dev/null
+++ b/src/Mobs/NewHorse.cpp
@@ -0,0 +1,109 @@
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewHorse.h"
+#include "../World.h"
+#include "../Entities/Player.h"
+
+
+
+
+
+cNewHorse::cNewHorse(int Type, int Color, int Style, int TameTimes) :
+ super("Horse", mtHorse, "mob.horse.hit", "mob.horse.death", 1.4, 1.6),
+ m_bHasChest(false),
+ m_bIsEating(false),
+ m_bIsRearing(false),
+ m_bIsMouthOpen(false),
+ m_bIsTame(false),
+ m_bIsSaddled(false),
+ m_Type(Type),
+ m_Color(Color),
+ m_Style(Style),
+ m_Armour(0),
+ m_TimesToTame(TameTimes),
+ m_TameAttemptTimes(0),
+ m_RearTickCount(0)
+{
+}
+
+
+
+
+
+void cNewHorse::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+
+ if (!m_bIsMouthOpen)
+ {
+ if (m_World->GetTickRandomNumber(50) == 25)
+ {
+ m_bIsMouthOpen = true;
+ }
+ }
+ else
+ {
+ if (m_World->GetTickRandomNumber(10) == 5)
+ {
+ m_bIsMouthOpen = false;
+ }
+ }
+
+ if ((m_Attachee != NULL) && (!m_bIsTame))
+ {
+ if (m_TameAttemptTimes < m_TimesToTame)
+ {
+ if (m_World->GetTickRandomNumber(50) == 25)
+ {
+ m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 0);
+ m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 2);
+ m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 6);
+ m_World->BroadcastSoundParticleEffect(2000, (int)GetPosX(), (int)GetPosY(), (int)GetPosZ(), 8);
+
+ m_Attachee->Detach();
+ m_bIsRearing = true;
+ }
+ }
+ else
+ {
+ m_bIsTame = true;
+ }
+ }
+
+ if (m_bIsRearing)
+ {
+ if (m_RearTickCount == 20)
+ {
+ m_bIsRearing = false;
+ m_RearTickCount = 0;
+ }
+ else
+ {
+ m_RearTickCount++;
+ }
+ }
+
+ m_World->BroadcastEntityMetadata(*this);
+}
+
+
+
+
+
+void cNewHorse::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
+ if (m_bIsSaddled)
+ {
+ a_Drops.push_back(cItem(E_ITEM_SADDLE, 1));
+ }
+}
+
+
+
+
diff --git a/src/Mobs/NewHorse.h b/src/Mobs/NewHorse.h
new file mode 100644
index 000000000..8eadf01d4
--- /dev/null
+++ b/src/Mobs/NewHorse.h
@@ -0,0 +1,43 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewHorse :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewHorse(int Type, int Color, int Style, int TameTimes);
+
+ CLASS_PROTODEF(cNewHorse)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
+
+ bool IsSaddled (void) const {return m_bIsSaddled; }
+ bool IsChested (void) const {return m_bHasChest; }
+ bool IsEating (void) const {return m_bIsEating; }
+ bool IsRearing (void) const {return m_bIsRearing; }
+ bool IsMthOpen (void) const {return m_bIsMouthOpen; }
+ bool IsTame (void) const {return m_bIsTame; }
+ int GetHorseType (void) const {return m_Type; }
+ int GetHorseColor (void) const {return m_Color; }
+ int GetHorseStyle (void) const {return m_Style; }
+ int GetHorseArmour (void) const {return m_Armour;}
+
+private:
+
+ bool m_bHasChest, m_bIsEating, m_bIsRearing, m_bIsMouthOpen, m_bIsTame, m_bIsSaddled;
+ int m_Type, m_Color, m_Style, m_Armour, m_TimesToTame, m_TameAttemptTimes, m_RearTickCount;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewIronGolem.cpp b/src/Mobs/NewIronGolem.cpp
new file mode 100644
index 000000000..0fa3eadee
--- /dev/null
+++ b/src/Mobs/NewIronGolem.cpp
@@ -0,0 +1,28 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewIronGolem.h"
+
+
+
+
+
+cNewIronGolem::cNewIronGolem(void) :
+ super("IronGolem", mtIronGolem, "mob.IronGolem.hit", "mob.IronGolem.death", 1.4, 2.9)
+{
+}
+
+
+
+
+
+void cNewIronGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ UNUSED(a_Killer);
+ AddRandomDropItem(a_Drops, 0, 5, E_ITEM_IRON);
+ AddRandomDropItem(a_Drops, 0, 2, E_BLOCK_FLOWER);
+}
+
+
+
+
diff --git a/src/Mobs/NewIronGolem.h b/src/Mobs/NewIronGolem.h
new file mode 100644
index 000000000..6cd86b237
--- /dev/null
+++ b/src/Mobs/NewIronGolem.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewIronGolem :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewIronGolem(void);
+
+ CLASS_PROTODEF(cNewIronGolem)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewMagmaCube.cpp b/src/Mobs/NewMagmaCube.cpp
new file mode 100644
index 000000000..931adf12d
--- /dev/null
+++ b/src/Mobs/NewMagmaCube.cpp
@@ -0,0 +1,30 @@
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewMagmaCube.h"
+
+
+
+
+
+cNewMagmaCube::cNewMagmaCube(int a_Size) :
+ super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size),
+ m_Size(a_Size)
+{
+}
+
+
+
+
+
+void cNewMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ UNUSED(a_Killer);
+ if (GetSize() > 1)
+ {
+ AddRandomUncommonDropItem(a_Drops, 25.0f, E_ITEM_MAGMA_CREAM);
+ }
+}
+
+
+
+
diff --git a/src/Mobs/NewMagmaCube.h b/src/Mobs/NewMagmaCube.h
new file mode 100644
index 000000000..f55f0164a
--- /dev/null
+++ b/src/Mobs/NewMagmaCube.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewMagmaCube :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest
+ cNewMagmaCube(int a_Size);
+
+ CLASS_PROTODEF(cNewMagmaCube)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ int GetSize(void) const { return m_Size; }
+
+protected:
+
+ /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest
+ int m_Size;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewMonster.cpp b/src/Mobs/NewMonster.cpp
index 3245bd83d..feeac2489 100644
--- a/src/Mobs/NewMonster.cpp
+++ b/src/Mobs/NewMonster.cpp
@@ -1,6 +1,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "NewMonster.h"
#include "../ClientHandle.h"
+#include "../MersenneTwister.h"
cNewMonster::cNewMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height)
: super(etMonster, a_Width, a_Height)
@@ -14,8 +15,95 @@ cNewMonster::cNewMonster(const AString & a_ConfigName, eType a_MobType, const AS
m_Movement = new cMovementComponent(this);
}
+
+
+
+
void cNewMonster::SpawnOn(cClientHandle & a_Client)
{
a_Client.SendSpawnMob(*this);
}
+
+
+
+
+void cNewMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth)
+{
+ MTRand r1;
+ int Count = r1.randInt() % (a_Max + 1 - a_Min) + a_Min;
+ if (Count > 0)
+ {
+ a_Drops.push_back(cItem(a_Item, Count, a_ItemHealth));
+ }
+}
+
+
+
+
+
+void cNewMonster::AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth)
+{
+ MTRand r1;
+ int Count = r1.randInt() % 1000;
+ if (Count < (a_Chance * 10))
+ {
+ a_Drops.push_back(cItem(a_Item, 1, a_ItemHealth));
+ }
+}
+
+
+
+
+
+void cNewMonster::AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel)
+{
+ MTRand r1;
+ int Count = r1.randInt() % 200;
+ if (Count < (5 + a_LootingLevel))
+ {
+ int Rare = r1.randInt() % a_Items.Size();
+ a_Drops.push_back(a_Items.at(Rare));
+ }
+}
+
+
+
+
+
+void cNewMonster::AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel)
+{
+ MTRand r1;
+ if (r1.randInt() % 200 < ((m_DropChanceHelmet * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedHelmet().IsEmpty()) a_Drops.push_back(GetEquippedHelmet());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceChestplate * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedChestplate().IsEmpty()) a_Drops.push_back(GetEquippedChestplate());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceLeggings * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedLeggings().IsEmpty()) a_Drops.push_back(GetEquippedLeggings());
+ }
+
+ if (r1.randInt() % 200 < ((m_DropChanceBoots * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedBoots().IsEmpty()) a_Drops.push_back(GetEquippedBoots());
+ }
+}
+
+
+
+
+
+void cNewMonster::AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel)
+{
+ MTRand r1;
+ if (r1.randInt() % 200 < ((m_DropChanceWeapon * 200) + (a_LootingLevel * 2)))
+ {
+ if (!GetEquippedWeapon().IsEmpty()) a_Drops.push_back(GetEquippedWeapon());
+ }
+}
diff --git a/src/Mobs/NewMonster.h b/src/Mobs/NewMonster.h
index 074538762..cfcfb4db5 100644
--- a/src/Mobs/NewMonster.h
+++ b/src/Mobs/NewMonster.h
@@ -62,6 +62,23 @@ public:
eType GetMobType() const { return m_MobType; }
protected:
+
+
+ /** Adds a random number of a_Item between a_Min and a_Max to itemdrops a_Drops*/
+ void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
+
+ /** Adds a item a_Item with the chance of a_Chance (in percent) to itemdrops a_Drops*/
+ void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
+
+ /** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
+ void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
+
+ /** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
+ void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel);
+
+ /** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
+ void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel);
+
AString m_SoundHurt;
AString m_SoundDeath;
@@ -69,4 +86,11 @@ protected:
cAttackComponent * m_Attack;
cEnvironmentComponent * m_Environment;
cMovementComponent * m_Movement;
+
+ // Temporary placement till I figure out where to put it
+ float m_DropChanceWeapon;
+ float m_DropChanceHelmet;
+ float m_DropChanceChestplate;
+ float m_DropChanceLeggings;
+ float m_DropChanceBoots;
};
diff --git a/src/Mobs/NewMooshroom.cpp b/src/Mobs/NewMooshroom.cpp
new file mode 100644
index 000000000..c9362b0f2
--- /dev/null
+++ b/src/Mobs/NewMooshroom.cpp
@@ -0,0 +1,35 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewMooshroom.h"
+#include "../Entities/Player.h"
+
+
+
+
+
+
+
+
+
+
+cNewMooshroom::cNewMooshroom(void) :
+ super("Mooshroom", mtMooshroom, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3)
+{
+}
+
+
+
+
+
+void cNewMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_LEATHER);
+ AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
+}
+
diff --git a/src/Mobs/NewMooshroom.h b/src/Mobs/NewMooshroom.h
new file mode 100644
index 000000000..2e10ad0a3
--- /dev/null
+++ b/src/Mobs/NewMooshroom.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewMooshroom :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewMooshroom(void);
+
+ CLASS_PROTODEF(cNewMooshroom)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewOcelot.h b/src/Mobs/NewOcelot.h
new file mode 100644
index 000000000..c1eb3b9e3
--- /dev/null
+++ b/src/Mobs/NewOcelot.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewOcelot :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewOcelot(void) :
+ super("Ocelot", mtOcelot, "mob.cat.hitt", "mob.cat.hitt", 0.6, 0.8)
+ {
+ }
+
+ CLASS_PROTODEF(cNewOcelot)
+} ;
+
+
+
+
diff --git a/src/Mobs/NewPig.cpp b/src/Mobs/NewPig.cpp
new file mode 100644
index 000000000..c5fbddfd0
--- /dev/null
+++ b/src/Mobs/NewPig.cpp
@@ -0,0 +1,38 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewPig.h"
+#include "../Entities/Player.h"
+#include "../World.h"
+
+
+
+
+
+cNewPig::cNewPig(void) :
+ super("Pig", mtPig, "mob.pig.say", "mob.pig.death", 0.9, 0.9),
+ m_bIsSaddled(false)
+{
+}
+
+
+
+
+
+void cNewPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 1, 3 + LootingLevel, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
+ if (m_bIsSaddled)
+ {
+ a_Drops.push_back(cItem(E_ITEM_SADDLE, 1));
+ }
+}
+
+
+
+
diff --git a/src/Mobs/NewPig.h b/src/Mobs/NewPig.h
new file mode 100644
index 000000000..2255c44c8
--- /dev/null
+++ b/src/Mobs/NewPig.h
@@ -0,0 +1,32 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewPig :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewPig(void);
+
+ CLASS_PROTODEF(cNewPig)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsSaddled(void) const { return m_bIsSaddled; }
+
+private:
+
+ bool m_bIsSaddled;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSheep.cpp b/src/Mobs/NewSheep.cpp
new file mode 100644
index 000000000..78e3418e8
--- /dev/null
+++ b/src/Mobs/NewSheep.cpp
@@ -0,0 +1,78 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewSheep.h"
+#include "../BlockID.h"
+#include "../Entities/Player.h"
+#include "../World.h"
+#include "FastRandom.h"
+
+
+
+
+
+cNewSheep::cNewSheep(int a_Color) :
+ super("Sheep", mtSheep, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3),
+ m_IsSheared(false),
+ m_WoolColor(a_Color)
+ // m_TimeToStopEating(-1)
+{
+ // Generate random wool color.
+ if (m_WoolColor == -1)
+ {
+ m_WoolColor = GenerateNaturalRandomColor();
+ }
+
+ if ((m_WoolColor < 0) || (m_WoolColor > 15))
+ {
+ m_WoolColor = 0;
+ }
+}
+
+
+
+
+
+void cNewSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ if (!m_IsSheared)
+ {
+ a_Drops.push_back(cItem(E_BLOCK_WOOL, 1, m_WoolColor));
+ }
+}
+
+
+
+
+
+NIBBLETYPE cNewSheep::GenerateNaturalRandomColor(void)
+{
+ cFastRandom Random;
+ int Chance = Random.NextInt(101);
+
+ if (Chance <= 81)
+ {
+ return E_META_WOOL_WHITE;
+ }
+ else if (Chance <= 86)
+ {
+ return E_META_WOOL_BLACK;
+ }
+ else if (Chance <= 91)
+ {
+ return E_META_WOOL_GRAY;
+ }
+ else if (Chance <= 96)
+ {
+ return E_META_WOOL_LIGHTGRAY;
+ }
+ else if (Chance <= 99)
+ {
+ return E_META_WOOL_BROWN;
+ }
+ else
+ {
+ return E_META_WOOL_PINK;
+ }
+}
+
diff --git a/src/Mobs/NewSheep.h b/src/Mobs/NewSheep.h
new file mode 100644
index 000000000..a4925b686
--- /dev/null
+++ b/src/Mobs/NewSheep.h
@@ -0,0 +1,46 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewSheep :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+
+ /** The number is the color of the sheep.
+ Use E_META_WOOL_* constants for the wool color.
+ If you type -1, the server will generate a random color
+ with the GenerateNaturalRandomColor() function. */
+ cNewSheep(int a_Color = -1);
+
+ CLASS_PROTODEF(cNewSheep)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ /** Generates a random color for the sheep like the vanilla server.
+ The percent's where used are from the wiki: http://minecraft.gamepedia.com/Sheep#Breeding */
+ static NIBBLETYPE GenerateNaturalRandomColor(void);
+
+ bool IsSheared(void) const { return m_IsSheared; }
+ void SetSheared(bool a_IsSheared) { m_IsSheared = a_IsSheared; }
+
+ int GetFurColor(void) const { return m_WoolColor; }
+ void SetFurColor(int a_WoolColor) { m_WoolColor = a_WoolColor; }
+
+private:
+ bool m_IsSheared;
+ int m_WoolColor;
+ // int m_TimeToStopEating;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSilverfish.h b/src/Mobs/NewSilverfish.h
new file mode 100644
index 000000000..e056a0547
--- /dev/null
+++ b/src/Mobs/NewSilverfish.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+#include "ANewMonster.h"
+
+
+
+
+
+class cNewSilverfish :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewSilverfish(void) :
+ super("Silverfish", mtSilverfish, "mob.silverfish.hit", "mob.silverfish.kill", 0.3, 0.7)
+ {
+ }
+
+ CLASS_PROTODEF(cNewSilverfish)
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSkeleton.cpp b/src/Mobs/NewSkeleton.cpp
new file mode 100644
index 000000000..4c9e31e63
--- /dev/null
+++ b/src/Mobs/NewSkeleton.cpp
@@ -0,0 +1,58 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewSkeleton.h"
+#include "../World.h"
+#include "../Entities/ArrowEntity.h"
+#include "ClientHandle.h"
+
+
+
+
+cNewSkeleton::cNewSkeleton(bool IsWither) :
+ super("Skeleton", mtSkeleton, "mob.skeleton.hurt", "mob.skeleton.death", 0.6, 1.8),
+ m_bIsWither(IsWither)
+{
+}
+
+
+
+
+
+void cNewSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ if (IsWither())
+ {
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL);
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1));
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ }
+ else
+ {
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ARROW);
+
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
+}
+
+
+
+
+
+void cNewSkeleton::SpawnOn(cClientHandle & a_ClientHandle)
+{
+ super::SpawnOn(a_ClientHandle);
+ a_ClientHandle.SendEntityEquipment(*this, 0, cItem(E_ITEM_BOW));
+}
+
+
+
+
diff --git a/src/Mobs/NewSkeleton.h b/src/Mobs/NewSkeleton.h
new file mode 100644
index 000000000..2355a377e
--- /dev/null
+++ b/src/Mobs/NewSkeleton.h
@@ -0,0 +1,33 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewSkeleton :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewSkeleton(bool IsWither);
+
+ CLASS_PROTODEF(cNewSkeleton)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;\
+ virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
+
+ bool IsWither(void) const { return m_bIsWither; }
+
+private:
+
+ bool m_bIsWither;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSlime.cpp b/src/Mobs/NewSlime.cpp
new file mode 100644
index 000000000..60f0021ab
--- /dev/null
+++ b/src/Mobs/NewSlime.cpp
@@ -0,0 +1,61 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewSlime.h"
+#include "FastRandom.h"
+#include "World.h"
+
+
+
+
+
+cNewSlime::cNewSlime(int a_Size) :
+ super("Slime",
+ mtSlime,
+ Printf("mob.slime.%s", GetSizeName(a_Size).c_str()),
+ Printf("mob.slime.%s", GetSizeName(a_Size).c_str()),
+ 0.6 * a_Size,
+ 0.6 * a_Size
+ ),
+ m_Size(a_Size)
+{
+}
+
+
+
+
+
+void cNewSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+
+ // Only slimes with the size 1 can drop slimeballs.
+ if (m_Size == 1)
+ {
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SLIMEBALL);
+ }
+}
+
+
+
+
+
+const AString cNewSlime::GetSizeName(int a_Size) const
+{
+ if (a_Size > 1)
+ {
+ return "big";
+ }
+ else
+ {
+ return "small";
+ }
+}
+
+
+
+
diff --git a/src/Mobs/NewSlime.h b/src/Mobs/NewSlime.h
new file mode 100644
index 000000000..458879a76
--- /dev/null
+++ b/src/Mobs/NewSlime.h
@@ -0,0 +1,39 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewSlime :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ /** Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tallest. */
+ cNewSlime(int a_Size);
+
+ CLASS_PROTODEF(cNewSlime)
+
+ // cAggressiveMonster overrides:
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ int GetSize(void) const { return m_Size; }
+
+ /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
+ Returns either "big" or "small". */
+ const AString GetSizeName(int a_Size) const;
+
+protected:
+
+ /** Size of the slime, with 1 being the smallest.
+ Vanilla uses sizes 1, 2 and 4 only. */
+ int m_Size;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSnowGolem.cpp b/src/Mobs/NewSnowGolem.cpp
new file mode 100644
index 000000000..c7f91b1ce
--- /dev/null
+++ b/src/Mobs/NewSnowGolem.cpp
@@ -0,0 +1,24 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewSnowGolem.h"
+#include "../World.h"
+
+
+
+
+
+cNewSnowGolem::cNewSnowGolem(void) :
+ super("SnowGolem", mtSnowGolem, "", "", 0.4, 1.8)
+{
+}
+
+
+
+
+
+void cNewSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ UNUSED(a_Killer);
+ AddRandomDropItem(a_Drops, 0, 15, E_ITEM_SNOWBALL);
+}
diff --git a/src/Mobs/NewSnowGolem.h b/src/Mobs/NewSnowGolem.h
new file mode 100644
index 000000000..3305bf3c2
--- /dev/null
+++ b/src/Mobs/NewSnowGolem.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewSnowGolem :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewSnowGolem(void);
+
+ CLASS_PROTODEF(cNewSnowGolem)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSpider.cpp b/src/Mobs/NewSpider.cpp
new file mode 100644
index 000000000..56d04c0ae
--- /dev/null
+++ b/src/Mobs/NewSpider.cpp
@@ -0,0 +1,35 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewSpider.h"
+
+
+
+
+
+cNewSpider::cNewSpider(void) :
+ super("Spider", mtSpider, "mob.spider.say", "mob.spider.death", 1.4, 0.9)
+{
+}
+
+
+
+
+
+void cNewSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STRING);
+ if ((a_Killer != NULL) && (a_Killer->IsPlayer() || a_Killer->IsA("cWolf")))
+ {
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_SPIDER_EYE);
+ }
+}
+
+
+
+
diff --git a/src/Mobs/NewSpider.h b/src/Mobs/NewSpider.h
new file mode 100644
index 000000000..f0543d1e1
--- /dev/null
+++ b/src/Mobs/NewSpider.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewSpider :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewSpider(void);
+
+ CLASS_PROTODEF(cNewSpider)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewSquid.cpp b/src/Mobs/NewSquid.cpp
new file mode 100644
index 000000000..40f4ed3c1
--- /dev/null
+++ b/src/Mobs/NewSquid.cpp
@@ -0,0 +1,33 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewSquid.h"
+#include "../Vector3.h"
+#include "../Chunk.h"
+
+
+
+
+
+cNewSquid::cNewSquid(void) :
+ super("Squid", mtSquid, "", "", 0.95, 0.95)
+{
+}
+
+
+
+
+
+void cNewSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ // Drops 0-3 Ink Sacs
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 3 + LootingLevel, E_ITEM_DYE, E_META_DYE_BLACK);
+}
+
+
+
diff --git a/src/Mobs/NewSquid.h b/src/Mobs/NewSquid.h
new file mode 100644
index 000000000..203ff7af5
--- /dev/null
+++ b/src/Mobs/NewSquid.h
@@ -0,0 +1,25 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewSquid :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewSquid();
+
+ CLASS_PROTODEF(cNewSquid)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewVillager.cpp b/src/Mobs/NewVillager.cpp
new file mode 100644
index 000000000..844d65b61
--- /dev/null
+++ b/src/Mobs/NewVillager.cpp
@@ -0,0 +1,19 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewVillager.h"
+#include "../World.h"
+#include "../BlockArea.h"
+#include "../Blocks/BlockHandler.h"
+#include "../BlockInServerPluginInterface.h"
+
+
+
+
+
+cNewVillager::cNewVillager(eVillagerType VillagerType) :
+ super("Villager", mtVillager, "", "", 0.6, 1.8),
+ m_Type(VillagerType)
+{
+}
+
diff --git a/src/Mobs/NewVillager.h b/src/Mobs/NewVillager.h
new file mode 100644
index 000000000..fb543d90c
--- /dev/null
+++ b/src/Mobs/NewVillager.h
@@ -0,0 +1,43 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewVillager :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+
+ enum eVillagerType
+ {
+ vtFarmer = 0,
+ vtLibrarian = 1,
+ vtPriest = 2,
+ vtBlacksmith = 3,
+ vtButcher = 4,
+ vtGeneric = 5,
+ vtMax
+ } ;
+
+ cNewVillager(eVillagerType VillagerType);
+
+ CLASS_PROTODEF(cNewVillager)
+
+ // Get and set functions.
+ int GetVilType(void) const { return m_Type; }
+
+private:
+
+ int m_Type;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewWitch.cpp b/src/Mobs/NewWitch.cpp
new file mode 100644
index 000000000..34036fe4b
--- /dev/null
+++ b/src/Mobs/NewWitch.cpp
@@ -0,0 +1,47 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewWitch.h"
+
+
+
+
+
+cNewWitch::cNewWitch(void) :
+ super("Witch", mtWitch, "", "", 0.6, 1.8)
+{
+}
+
+
+
+
+
+void cNewWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ MTRand r1;
+ int DropTypeCount = (r1.randInt() % 3) + 1;
+ for (int i = 0; i < DropTypeCount; i++)
+ {
+ int DropType = r1.randInt() % 7;
+ switch (DropType)
+ {
+ case 0: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLASS_BOTTLE); break;
+ case 1: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GLOWSTONE_DUST); break;
+ case 2: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_GUNPOWDER); break;
+ case 3: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_REDSTONE_DUST); break;
+ case 4: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SPIDER_EYE); break;
+ case 5: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_STICK); break;
+ case 6: AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_SUGAR); break;
+ }
+ }
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
+}
+
+
+
+
diff --git a/src/Mobs/NewWitch.h b/src/Mobs/NewWitch.h
new file mode 100644
index 000000000..02d9cc3d0
--- /dev/null
+++ b/src/Mobs/NewWitch.h
@@ -0,0 +1,28 @@
+
+#pragma once
+
+#include "NewMonster.h"
+#include "../MersenneTwister.h"
+
+
+
+
+
+class cNewWitch :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewWitch();
+
+ CLASS_PROTODEF(cNewWitch)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsAngry(void) const {return false; }
+} ;
+
+
+
+
diff --git a/src/Mobs/NewWither.cpp b/src/Mobs/NewWither.cpp
new file mode 100644
index 000000000..c4f26f1da
--- /dev/null
+++ b/src/Mobs/NewWither.cpp
@@ -0,0 +1,42 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewWither.h"
+
+#include "../World.h"
+#include "../Entities/Player.h"
+
+
+
+
+
+cNewWither::cNewWither(void) :
+ super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0)
+{
+ SetMaxHealth(300);
+}
+
+
+
+
+
+bool cNewWither::Initialize(cWorld & a_World)
+{
+ // Set health before BroadcastSpawnEntity()
+ SetHealth(GetMaxHealth() / 3);
+
+ return super::Initialize(a_World);
+}
+
+
+
+
+
+void cNewWither::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ AddRandomDropItem(a_Drops, 1, 1, E_ITEM_NETHER_STAR);
+}
+
+
+
+
diff --git a/src/Mobs/NewWither.h b/src/Mobs/NewWither.h
new file mode 100644
index 000000000..91f824016
--- /dev/null
+++ b/src/Mobs/NewWither.h
@@ -0,0 +1,31 @@
+
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewWither :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewWither(void);
+
+ CLASS_PROTODEF(cNewWither)
+
+ /** Returns whether the wither is invulnerable to arrows. */
+ bool IsArmored(void) const;
+
+ // cEntity overrides
+ virtual bool Initialize(cWorld & a_World) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewWolf.cpp b/src/Mobs/NewWolf.cpp
new file mode 100644
index 000000000..4e95bf6e8
--- /dev/null
+++ b/src/Mobs/NewWolf.cpp
@@ -0,0 +1,24 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewWolf.h"
+#include "../World.h"
+#include "../Entities/Player.h"
+#include "../Items/ItemHandler.h"
+
+
+
+
+
+cNewWolf::cNewWolf(void) :
+ super("Wolf", mtWolf, "mob.wolf.hurt", "mob.wolf.death", 0.6, 0.8),
+ m_IsSitting(false),
+ m_IsBegging(false),
+ m_IsAngry(false),
+ m_CollarColor(14)
+{
+}
+
+
+
+
diff --git a/src/Mobs/NewWolf.h b/src/Mobs/NewWolf.h
new file mode 100644
index 000000000..6df63d795
--- /dev/null
+++ b/src/Mobs/NewWolf.h
@@ -0,0 +1,43 @@
+
+#pragma once
+
+#include "NewMonster.h"
+#include "../Entities/Entity.h"
+
+
+
+
+
+class cNewWolf :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewWolf(void);
+
+ CLASS_PROTODEF(cNewWolf)
+
+ // Get functions
+ bool IsSitting (void) const { return m_IsSitting; }
+ bool IsBegging (void) const { return m_IsBegging; }
+ bool IsAngry (void) const { return m_IsAngry; }
+ int GetCollarColor(void) const { return m_CollarColor; }
+
+ // Set functions
+ void SetIsSitting (bool a_IsSitting) { m_IsSitting = a_IsSitting; }
+ void SetIsBegging (bool a_IsBegging) { m_IsBegging = a_IsBegging; }
+ void SetIsAngry (bool a_IsAngry) { m_IsAngry = a_IsAngry; }
+ void SetCollarColor(int a_CollarColor) { m_CollarColor = a_CollarColor; }
+
+protected:
+
+ bool m_IsSitting;
+ bool m_IsBegging;
+ bool m_IsAngry;
+ int m_CollarColor;
+} ;
+
+
+
+
diff --git a/src/Mobs/NewZombie.cpp b/src/Mobs/NewZombie.cpp
new file mode 100644
index 000000000..d37ea22bc
--- /dev/null
+++ b/src/Mobs/NewZombie.cpp
@@ -0,0 +1,42 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewZombie.h"
+#include "../World.h"
+#include "../LineBlockTracer.h"
+
+
+
+
+
+cNewZombie::cNewZombie(bool a_IsVillagerZombie) :
+ super("Zombie", mtZombie, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8),
+ m_IsVillagerZombie(a_IsVillagerZombie),
+ m_IsConverting(false)
+{
+}
+
+
+
+
+
+void cNewZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ROTTEN_FLESH);
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_IRON));
+ RareDrops.Add(cItem(E_ITEM_CARROT));
+ RareDrops.Add(cItem(E_ITEM_POTATO));
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
+}
+
+
+
+
diff --git a/src/Mobs/NewZombie.h b/src/Mobs/NewZombie.h
new file mode 100644
index 000000000..7388711c6
--- /dev/null
+++ b/src/Mobs/NewZombie.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewZombie :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewZombie(bool a_IsVillagerZombie);
+
+ CLASS_PROTODEF(cNewZombie)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsVillagerZombie(void) const { return m_IsVillagerZombie; }
+ bool IsConverting (void) const { return m_IsConverting; }
+
+private:
+
+ bool m_IsVillagerZombie;
+ bool m_IsConverting;
+
+} ;
+
+
+
+
diff --git a/src/Mobs/NewZombiePigman.cpp b/src/Mobs/NewZombiePigman.cpp
new file mode 100644
index 000000000..e0a491805
--- /dev/null
+++ b/src/Mobs/NewZombiePigman.cpp
@@ -0,0 +1,38 @@
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "NewZombiePigman.h"
+#include "../World.h"
+
+
+
+
+
+cNewZombiePigman::cNewZombiePigman(void) :
+ super("ZombiePigman", mtZombiePigman, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8)
+{
+}
+
+
+
+
+
+void cNewZombiePigman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ int LootingLevel = 0;
+ if (a_Killer != NULL)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_ROTTEN_FLESH);
+ AddRandomDropItem(a_Drops, 0, 1 + LootingLevel, E_ITEM_GOLD_NUGGET);
+
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_GOLD));
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
+}
+
+
+
+
diff --git a/src/Mobs/NewZombiePigman.h b/src/Mobs/NewZombiePigman.h
new file mode 100644
index 000000000..13a67f4b0
--- /dev/null
+++ b/src/Mobs/NewZombiePigman.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "NewMonster.h"
+
+
+
+
+
+class cNewZombiePigman :
+ public cNewMonster
+{
+ typedef cNewMonster super;
+
+public:
+ cNewZombiePigman(void);
+
+ CLASS_PROTODEF(cNewZombiePigman)
+
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+} ;
+
+
+
+