summaryrefslogtreecommitdiffstats
path: root/src/Mobs/AggressiveMonster.cpp
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-06-12 01:21:47 +0200
committerarchshift <admin@archshift.com>2014-06-17 20:39:21 +0200
commit71b4c4949087860ab9962d6545a0ad2eb9c0ee5a (patch)
tree95de954af7f5b4a921c36172f2fd550cfc0545b6 /src/Mobs/AggressiveMonster.cpp
parentAdded wither damage type, wither entity effect. (diff)
downloadcuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.tar
cuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.tar.gz
cuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.tar.bz2
cuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.tar.lz
cuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.tar.xz
cuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.tar.zst
cuberite-71b4c4949087860ab9962d6545a0ad2eb9c0ee5a.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/AggressiveMonster.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 85b122034..de881f4eb 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -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);
}