Cave spider now poisons its victim, added IsPawn function to Entity
This commit is contained in:
parent
814cdca054
commit
71b4c49490
@ -158,6 +158,7 @@ public:
|
|||||||
bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
|
bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
|
||||||
bool IsPickup (void) const { return (m_EntityType == etPickup); }
|
bool IsPickup (void) const { return (m_EntityType == etPickup); }
|
||||||
bool IsMob (void) const { return (m_EntityType == etMonster); }
|
bool IsMob (void) const { return (m_EntityType == etMonster); }
|
||||||
|
bool IsPawn (void) const { return (IsMob() || IsPlayer()); }
|
||||||
bool IsFallingBlock(void) const { return (m_EntityType == etFallingBlock); }
|
bool IsFallingBlock(void) const { return (m_EntityType == etFallingBlock); }
|
||||||
bool IsMinecart (void) const { return (m_EntityType == etMinecart); }
|
bool IsMinecart (void) const { return (m_EntityType == etMinecart); }
|
||||||
bool IsBoat (void) const { return (m_EntityType == etBoat); }
|
bool IsBoat (void) const { return (m_EntityType == etBoat); }
|
||||||
|
@ -77,7 +77,7 @@ bool cSplashPotionEntity::cSplashPotionCallback::Item(cEntity * a_Entity)
|
|||||||
|
|
||||||
m_EntityEffect.SetDistanceModifier(reduction);
|
m_EntityEffect.SetDistanceModifier(reduction);
|
||||||
|
|
||||||
if (a_Entity->IsMob() || a_Entity->IsPlayer())
|
if (a_Entity->IsPawn())
|
||||||
{
|
{
|
||||||
((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect);
|
((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect);
|
||||||
}
|
}
|
||||||
|
@ -95,12 +95,14 @@ void cAggressiveMonster::Attack(float a_Dt)
|
|||||||
{
|
{
|
||||||
m_AttackInterval += a_Dt * m_AttackRate;
|
m_AttackInterval += a_Dt * m_AttackRate;
|
||||||
|
|
||||||
if ((m_Target != NULL) && (m_AttackInterval > 3.0))
|
if ((m_Target == NULL) || (m_AttackInterval < 3.0))
|
||||||
{
|
{
|
||||||
// Setting this higher gives us more wiggle room for attackrate
|
return;
|
||||||
m_AttackInterval = 0.0;
|
|
||||||
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setting this higher gives us more wiggle room for attackrate
|
||||||
|
m_AttackInterval = 0.0;
|
||||||
|
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,21 @@ void cCaveSpider::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cCaveSpider::Attack(float a_Dt)
|
||||||
|
{
|
||||||
|
super::Attack(a_Dt);
|
||||||
|
|
||||||
|
if (m_Target->IsPawn())
|
||||||
|
{
|
||||||
|
// TODO: Easy = no poison, Medium = 7 seconds, Hard = 15 seconds
|
||||||
|
((cPawn *) m_Target)->AddEntityEffect(cEntityEffect::effPoison, cEntityEffect(140, 0, this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
void cCaveSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
||||||
{
|
{
|
||||||
int LootingLevel = 0;
|
int LootingLevel = 0;
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
CLASS_PROTODEF(cCaveSpider);
|
CLASS_PROTODEF(cCaveSpider);
|
||||||
|
|
||||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||||
|
virtual void Attack(float a_Dt) override;
|
||||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user