From 21df3cb0d8a194461bbcec5803c5d6243f254a95 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Tue, 12 Jan 2016 12:11:10 +0200 Subject: Fix mob attack interval --- src/Mobs/Ghast.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/Mobs/Ghast.cpp') diff --git a/src/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp index fe3cc8be3..9ac16866e 100644 --- a/src/Mobs/Ghast.cpp +++ b/src/Mobs/Ghast.cpp @@ -34,9 +34,7 @@ void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer) bool cGhast::Attack(std::chrono::milliseconds a_Dt) { - m_AttackInterval += (static_cast(a_Dt.count()) / 1000) * m_AttackRate; - - if ((m_Target != nullptr) && (m_AttackInterval > 3.0)) + if ((m_Target != nullptr) && (m_AttackCoolDownTicksLeft == 0)) { // Setting this higher gives us more wiggle room for attackrate Vector3d Speed = GetLookVector() * 20; @@ -53,8 +51,7 @@ bool cGhast::Attack(std::chrono::milliseconds a_Dt) return false; } m_World->BroadcastSpawnEntity(*GhastBall); - m_AttackInterval = 0.0; - + ResetAttackCooldown(); return true; } return false; -- cgit v1.2.3