Revert "Withers now use the new invulnerable."
This reverts commit 619592b5a0
.
This commit is contained in:
parent
26e935cb20
commit
acd2804f31
@ -10,10 +10,9 @@
|
|||||||
|
|
||||||
cWither::cWither(void) :
|
cWither::cWither(void) :
|
||||||
super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0),
|
super("Wither", mtWither, "mob.wither.hurt", "mob.wither.death", 0.9, 4.0),
|
||||||
m_IsSpawnInvulnerable(true)
|
m_WitherInvulnerableTicks(220)
|
||||||
{
|
{
|
||||||
SetMaxHealth(300);
|
SetMaxHealth(300);
|
||||||
SetInvulnerableTicks(220);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +47,11 @@ bool cWither::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_WitherInvulnerableTicks > 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsArmored() && (a_TDI.DamageType == dtRangedAttack))
|
if (IsArmored() && (a_TDI.DamageType == dtRangedAttack))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -64,15 +68,22 @@ void cWither::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
{
|
{
|
||||||
super::Tick(a_Dt, a_Chunk);
|
super::Tick(a_Dt, a_Chunk);
|
||||||
|
|
||||||
if (GetInvulnerableTicks() <= 0 && m_IsSpawnInvulnerable)
|
if (m_WitherInvulnerableTicks > 0)
|
||||||
|
{
|
||||||
|
unsigned int NewTicks = m_WitherInvulnerableTicks - 1;
|
||||||
|
|
||||||
|
if (NewTicks == 0)
|
||||||
{
|
{
|
||||||
m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this);
|
m_World->DoExplosionAt(7.0, GetPosX(), GetPosY(), GetPosZ(), false, esWitherBirth, this);
|
||||||
m_IsSpawnInvulnerable = false;
|
|
||||||
}
|
}
|
||||||
else if (((GetInvulnerableTicks() % 10) == 0) && (GetInvulnerableTicks() > 10))
|
|
||||||
|
m_WitherInvulnerableTicks = NewTicks;
|
||||||
|
|
||||||
|
if ((NewTicks % 10) == 0)
|
||||||
{
|
{
|
||||||
Heal(10);
|
Heal(10);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_World->BroadcastEntityMetadata(*this);
|
m_World->BroadcastEntityMetadata(*this);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ public:
|
|||||||
|
|
||||||
CLASS_PROTODEF(cWither);
|
CLASS_PROTODEF(cWither);
|
||||||
|
|
||||||
|
unsigned int GetWitherInvulnerableTicks(void) const { return m_WitherInvulnerableTicks; }
|
||||||
|
|
||||||
|
void SetWitherInvulnerableTicks(unsigned int a_Ticks) { m_WitherInvulnerableTicks = a_Ticks; }
|
||||||
|
|
||||||
/** Returns whether the wither is invulnerable to arrows. */
|
/** Returns whether the wither is invulnerable to arrows. */
|
||||||
bool IsArmored(void) const;
|
bool IsArmored(void) const;
|
||||||
|
|
||||||
@ -28,7 +32,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_IsSpawnInvulnerable;
|
/** The number of ticks of invulnerability left after being initially created. Zero once invulnerability has expired. */
|
||||||
|
unsigned int m_WitherInvulnerableTicks;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user