summaryrefslogtreecommitdiffstats
path: root/src/Mobs/AggressiveMonster.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-11-08 23:08:40 +0100
committerworktycho <work.tycho@gmail.com>2015-11-08 23:08:40 +0100
commita1926ca16e76f082b2139b1686fd19c0c42c585e (patch)
tree3a8a282d1966476ea8f6031a1ea15388330fede8 /src/Mobs/AggressiveMonster.cpp
parentMerge pull request #2616 from Gargaj/patch-1 (diff)
parentfix cavespider poisoning even if attack is in cooldown (diff)
downloadcuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.tar
cuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.tar.gz
cuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.tar.bz2
cuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.tar.lz
cuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.tar.xz
cuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.tar.zst
cuberite-a1926ca16e76f082b2139b1686fd19c0c42c585e.zip
Diffstat (limited to 'src/Mobs/AggressiveMonster.cpp')
-rw-r--r--src/Mobs/AggressiveMonster.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 1355a3627..a7a1eeef5 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -92,15 +92,17 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-void cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
+bool cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt)
{
m_AttackInterval += (static_cast<float>(a_Dt.count()) / 1000) * m_AttackRate;
if ((m_Target == nullptr) || (m_AttackInterval < 3.0))
{
- return;
+ return false;
}
// Setting this higher gives us more wiggle room for attackrate
m_AttackInterval = 0.0;
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
+
+ return true;
}