summaryrefslogtreecommitdiffstats
path: root/src/Mobs/WitherSkeleton.cpp
diff options
context:
space:
mode:
authorMat <mail@mathias.is>2020-04-04 13:44:17 +0200
committerGitHub <noreply@github.com>2020-04-04 13:44:17 +0200
commit60bcc06f43e0c249204149153976e534b239d138 (patch)
treedc3178edca8b8a0ad77b6002621fd5765398d8e6 /src/Mobs/WitherSkeleton.cpp
parentManage block entity lifetime with unique_ptr (#4080) (diff)
downloadcuberite-60bcc06f43e0c249204149153976e534b239d138.tar
cuberite-60bcc06f43e0c249204149153976e534b239d138.tar.gz
cuberite-60bcc06f43e0c249204149153976e534b239d138.tar.bz2
cuberite-60bcc06f43e0c249204149153976e534b239d138.tar.lz
cuberite-60bcc06f43e0c249204149153976e534b239d138.tar.xz
cuberite-60bcc06f43e0c249204149153976e534b239d138.tar.zst
cuberite-60bcc06f43e0c249204149153976e534b239d138.zip
Diffstat (limited to 'src/Mobs/WitherSkeleton.cpp')
-rw-r--r--src/Mobs/WitherSkeleton.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/Mobs/WitherSkeleton.cpp b/src/Mobs/WitherSkeleton.cpp
new file mode 100644
index 000000000..7dd8d5017
--- /dev/null
+++ b/src/Mobs/WitherSkeleton.cpp
@@ -0,0 +1,62 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "WitherSkeleton.h"
+#include "../World.h"
+#include "../ClientHandle.h"
+
+
+
+
+cWitherSkeleton::cWitherSkeleton(void) :
+ super("WitherSkeleton", mtWitherSkeleton, "entity.wither_skeleton.hurt", "entity.wither_skeleton.death", "entity.wither_skeleton.ambient", 0.7, 2.4)
+{
+}
+
+
+
+
+
+bool cWitherSkeleton::Attack(std::chrono::milliseconds a_Dt)
+{
+ if (GetTarget() == nullptr)
+ {
+ return false;
+ }
+
+ GetTarget()->AddEntityEffect(cEntityEffect::effWither, 200, 0);
+ return super::Attack(a_Dt);
+}
+
+
+
+
+
+void cWitherSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+{
+ unsigned int LootingLevel = 0;
+ if (a_Killer != nullptr)
+ {
+ LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
+ }
+ AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL);
+ AddRandomUncommonDropItem(a_Drops, 8.5f, E_ITEM_STONE_SWORD, GetRandomProvider().RandInt<short>(50));
+
+ cItems RareDrops;
+ RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1));
+ AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
+
+ AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
+ AddRandomArmorDropItem(a_Drops, LootingLevel);
+ AddRandomWeaponDropItem(a_Drops, LootingLevel);
+}
+
+
+
+
+
+void cWitherSkeleton::SpawnOn(cClientHandle & a_ClientHandle)
+{
+ super::SpawnOn(a_ClientHandle);
+ a_ClientHandle.SendEntityEquipment(*this, 0, cItem(E_ITEM_STONE_SWORD));
+}