summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Skeleton.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/Skeleton.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 'src/Mobs/Skeleton.cpp')
-rw-r--r--src/Mobs/Skeleton.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index 27e038e1e..5032ec5b0 100644
--- a/src/Mobs/Skeleton.cpp
+++ b/src/Mobs/Skeleton.cpp
@@ -50,9 +50,9 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
bool cSkeleton::Attack(std::chrono::milliseconds a_Dt)
{
+ StopMovingToPosition(); // Todo handle this in a better way, the skeleton does some uneeded recalcs due to inStateChasing
cFastRandom Random;
- 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))
{
Vector3d Inaccuracy = Vector3d(Random.NextFloat(0.5) - 0.25, Random.NextFloat(0.5) - 0.25, Random.NextFloat(0.5) - 0.25);
Vector3d Speed = (m_Target->GetPosition() + Inaccuracy - GetPosition()) * 5;
@@ -69,8 +69,8 @@ bool cSkeleton::Attack(std::chrono::milliseconds a_Dt)
return false;
}
m_World->BroadcastSpawnEntity(*Arrow);
- m_AttackInterval = 0.0;
-
+ ResetAttackCooldown();
+
return true;
}
return false;