2013-09-18 17:17:43 -04:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
|
|
|
#include "Wither.h"
|
2014-03-24 06:29:19 -04:00
|
|
|
#include "../World.h"
|
2013-09-18 17:17:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cWither::cWither(void) :
|
2014-03-24 06:29:19 -04:00
|
|
|
super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0),
|
|
|
|
m_InvulnerableTicks(220)
|
2013-09-18 17:17:43 -04:00
|
|
|
{
|
2014-03-24 06:29:19 -04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2013-09-18 17:17:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cWither::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
|
|
|
{
|
|
|
|
AddRandomDropItem(a_Drops, 1, 1, E_ITEM_NETHER_STAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|