diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-04-02 15:37:24 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-04-02 15:37:24 +0200 |
commit | 741a64c250a1085108f24f351e9d9dacd085cc82 (patch) | |
tree | a69b5aba676473e5f75822a02e14e2acc542b263 /src/Mobs/Wither.cpp | |
parent | Fixed All signedness warnings in HTTPServer.cpp (diff) | |
parent | Merge branch 'master' into globals (diff) | |
download | cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.gz cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.bz2 cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.lz cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.xz cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.tar.zst cuberite-741a64c250a1085108f24f351e9d9dacd085cc82.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Wither.cpp | 26 |
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); } |