1
0

Cave spider now poisons its victim, added IsPawn function to Entity

This commit is contained in:
archshift 2014-06-11 16:21:47 -07:00
parent 814cdca054
commit 71b4c49490
5 changed files with 24 additions and 5 deletions

View File

@ -158,6 +158,7 @@ public:
bool IsPlayer (void) const { return (m_EntityType == etPlayer); }
bool IsPickup (void) const { return (m_EntityType == etPickup); }
bool IsMob (void) const { return (m_EntityType == etMonster); }
bool IsPawn (void) const { return (IsMob() || IsPlayer()); }
bool IsFallingBlock(void) const { return (m_EntityType == etFallingBlock); }
bool IsMinecart (void) const { return (m_EntityType == etMinecart); }
bool IsBoat (void) const { return (m_EntityType == etBoat); }

View File

@ -77,7 +77,7 @@ bool cSplashPotionEntity::cSplashPotionCallback::Item(cEntity * a_Entity)
m_EntityEffect.SetDistanceModifier(reduction);
if (a_Entity->IsMob() || a_Entity->IsPlayer())
if (a_Entity->IsPawn())
{
((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect);
}

View File

@ -95,12 +95,14 @@ void cAggressiveMonster::Attack(float a_Dt)
{
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
m_AttackInterval = 0.0;
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
return;
}
// Setting this higher gives us more wiggle room for attackrate
m_AttackInterval = 0.0;
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
}

View File

@ -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)
{
int LootingLevel = 0;

View File

@ -17,6 +17,7 @@ public:
CLASS_PROTODEF(cCaveSpider);
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;
} ;