summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wither.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-03-25 08:54:13 +0100
committerMattes D <github@xoft.cz>2014-03-25 08:54:13 +0100
commitc6186acf58d01697d5349edf1b44bde5038daec4 (patch)
tree40c5ef7ddec8467bd711d43f5db0262942415d17 /src/Mobs/Wither.cpp
parentMerge pull request #829 from Howaner/Cake (diff)
parentMinor fixes (diff)
downloadcuberite-c6186acf58d01697d5349edf1b44bde5038daec4.tar
cuberite-c6186acf58d01697d5349edf1b44bde5038daec4.tar.gz
cuberite-c6186acf58d01697d5349edf1b44bde5038daec4.tar.bz2
cuberite-c6186acf58d01697d5349edf1b44bde5038daec4.tar.lz
cuberite-c6186acf58d01697d5349edf1b44bde5038daec4.tar.xz
cuberite-c6186acf58d01697d5349edf1b44bde5038daec4.tar.zst
cuberite-c6186acf58d01697d5349edf1b44bde5038daec4.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Wither.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp
index c46e0beab..0e42194ac 100644
--- a/src/Mobs/Wither.cpp
+++ b/src/Mobs/Wither.cpp
@@ -2,14 +2,64 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Wither.h"
+#include "../World.h"
cWither::cWither(void) :
- super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0)
+ super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0),
+ m_InvulnerableTicks(220)
{
+ SetMaxHealth(300);
+
+ SetHealth(GetMaxHealth() / 3);
+}
+
+
+
+
+
+void cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
+{
+ if (a_TDI.DamageType == dtDrowning)
+ {
+ return;
+ }
+
+ if (m_InvulnerableTicks > 0)
+ {
+ return;
+ }
+
+ super::DoTakeDamage(a_TDI);
+}
+
+
+
+
+
+void cWither::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+
+ if (m_InvulnerableTicks > 0)
+ {
+ unsigned int NewTicks = m_InvulnerableTicks - 1;
+
+ if (NewTicks == 0)
+ {
+ m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this);
+ }
+
+ m_InvulnerableTicks = NewTicks;
+
+ if ((NewTicks % 10) == 0)
+ {
+ Heal(10);
+ }
+ }
}