summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Mobs/Wither.cpp16
-rw-r--r--src/Mobs/Wither.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp
index 0e42194ac..790f127f2 100644
--- a/src/Mobs/Wither.cpp
+++ b/src/Mobs/Wither.cpp
@@ -21,6 +21,15 @@ cWither::cWither(void) :
+bool cWither::IsArmored(void) const
+{
+ return GetHealth() <= (GetMaxHealth() / 2);
+}
+
+
+
+
+
void cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if (a_TDI.DamageType == dtDrowning)
@@ -33,6 +42,11 @@ void cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
return;
}
+ if (IsArmored() && (a_TDI.DamageType == dtRangedAttack))
+ {
+ return;
+ }
+
super::DoTakeDamage(a_TDI);
}
@@ -60,6 +74,8 @@ void cWither::Tick(float a_Dt, cChunk & a_Chunk)
Heal(10);
}
}
+
+ m_World->BroadcastEntityMetadata(*this);
}
diff --git a/src/Mobs/Wither.h b/src/Mobs/Wither.h
index d09e3607a..52666a190 100644
--- a/src/Mobs/Wither.h
+++ b/src/Mobs/Wither.h
@@ -20,6 +20,9 @@ public:
unsigned int GetNumInvulnerableTicks(void) const { return m_InvulnerableTicks; }
void SetNumInvulnerableTicks(unsigned int a_Ticks) { m_InvulnerableTicks = a_Ticks; }
+
+ /** Returns whether the wither is invulnerable to arrows. */
+ bool IsArmored(void) const;
// cEntity overrides
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;