summaryrefslogtreecommitdiffstats
path: root/src/Mobs/AggressiveMonster.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-01-12 13:46:02 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-01-12 13:46:02 +0100
commitd4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3 (patch)
treef313b63965b5dde2d2d9255b3d0cda2dda1068e4 /src/Mobs/AggressiveMonster.cpp
parentMerge pull request #2860 from LogicParrot/wolfChecks (diff)
parentFix mob attack interval (diff)
downloadcuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.tar
cuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.tar.gz
cuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.tar.bz2
cuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.tar.lz
cuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.tar.xz
cuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.tar.zst
cuberite-d4e99aedb1d202b3fa6f6b3f5bd5fd31a4ecc2f3.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/AggressiveMonster.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 56500309d..faee4a049 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -75,7 +75,6 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
if (TargetIsInRange() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<int>(AttackDirection.Length())) && (GetHealth() > 0.0))
{
// Attack if reached destination, target isn't null, and have a clear line of sight to target (so won't attack through walls)
- StopMovingToPosition();
Attack(a_Dt);
}
}
@@ -86,14 +85,13 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
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))
+ if ((m_Target == nullptr) || (m_AttackCoolDownTicksLeft != 0))
{
return false;
}
// Setting this higher gives us more wiggle room for attackrate
- m_AttackInterval = 0.0;
+ ResetAttackCooldown();
m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0);
return true;