summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Wither.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-04-26 17:37:35 +0200
committerHowaner <franzi.moos@googlemail.com>2014-04-26 17:37:35 +0200
commit619592b5a0ab651e714d55932bc7909e4204cee9 (patch)
treec9d67cb8336f9d47b643fc1ee7c4d3248a8d15f4 /src/Mobs/Wither.cpp
parentFixes (diff)
downloadcuberite-619592b5a0ab651e714d55932bc7909e4204cee9.tar
cuberite-619592b5a0ab651e714d55932bc7909e4204cee9.tar.gz
cuberite-619592b5a0ab651e714d55932bc7909e4204cee9.tar.bz2
cuberite-619592b5a0ab651e714d55932bc7909e4204cee9.tar.lz
cuberite-619592b5a0ab651e714d55932bc7909e4204cee9.tar.xz
cuberite-619592b5a0ab651e714d55932bc7909e4204cee9.tar.zst
cuberite-619592b5a0ab651e714d55932bc7909e4204cee9.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Wither.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/Mobs/Wither.cpp b/src/Mobs/Wither.cpp
index 5b6e895e1..fe4dbb28b 100644
--- a/src/Mobs/Wither.cpp
+++ b/src/Mobs/Wither.cpp
@@ -10,9 +10,10 @@
cWither::cWither(void) :
super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0),
- m_WitherInvulnerableTicks(220)
+ m_IsSpawnInvulnerable(true)
{
SetMaxHealth(300);
+ SetInvulnerableTicks(220);
}
@@ -47,11 +48,6 @@ bool cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
return false;
}
- if (m_WitherInvulnerableTicks > 0)
- {
- return false;
- }
-
if (IsArmored() && (a_TDI.DamageType == dtRangedAttack))
{
return false;
@@ -68,21 +64,14 @@ void cWither::Tick(float a_Dt, cChunk & a_Chunk)
{
super::Tick(a_Dt, a_Chunk);
- if (m_WitherInvulnerableTicks > 0)
+ if (GetInvulnerableTicks() <= 0 && m_IsSpawnInvulnerable)
{
- unsigned int NewTicks = m_WitherInvulnerableTicks - 1;
-
- if (NewTicks == 0)
- {
- m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this);
- }
-
- m_WitherInvulnerableTicks = NewTicks;
-
- if ((NewTicks % 10) == 0)
- {
- Heal(10);
- }
+ m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this);
+ m_IsSpawnInvulnerable = false;
+ }
+ else if (((GetInvulnerableTicks() % 10) == 0) && (GetInvulnerableTicks() > 10))
+ {
+ Heal(10);
}
m_World->BroadcastEntityMetadata(*this);