summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wither.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-04-02 12:00:26 +0200
committerMattes D <github@xoft.cz>2014-04-02 12:00:26 +0200
commit01c38505fd26a207e6bb0ad5916311c082c12b31 (patch)
tree56e499098895a03bc66beac5aa33ba4ee261f17e /src/Mobs/Wither.cpp
parentDebuggers: Added a Base64 API roundtrip test. (diff)
parentFixed clang compilation (diff)
downloadcuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.tar
cuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.tar.gz
cuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.tar.bz2
cuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.tar.lz
cuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.tar.xz
cuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.tar.zst
cuberite-01c38505fd26a207e6bb0ad5916311c082c12b31.zip
Diffstat (limited to 'src/Mobs/Wither.cpp')
-rw-r--r--src/Mobs/Wither.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp
index 0e42194ac..8f5d28b68 100644
--- a/src/Mobs/Wither.cpp
+++ b/src/Mobs/Wither.cpp
@@ -13,8 +13,27 @@ cWither::cWither(void) :
m_InvulnerableTicks(220)
{
SetMaxHealth(300);
+}
+
+
+
+
+
+bool cWither::IsArmored(void) const
+{
+ return GetHealth() <= (GetMaxHealth() / 2);
+}
+
+
+
+
+bool cWither::Initialize(cWorld * a_World)
+{
+ // Set health before BroadcastSpawnEntity()
SetHealth(GetMaxHealth() / 3);
+
+ return super::Initialize(a_World);
}
@@ -33,6 +52,11 @@ void cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
return;
}
+ if (IsArmored() && (a_TDI.DamageType == dtRangedAttack))
+ {
+ return;
+ }
+
super::DoTakeDamage(a_TDI);
}
@@ -60,6 +84,8 @@ void cWither::Tick(float a_Dt, cChunk & a_Chunk)
Heal(10);
}
}
+
+ m_World->BroadcastEntityMetadata(*this);
}