diff options
author | SafwatHalaby <SafwatHalaby@users.noreply.github.com> | 2015-05-28 16:45:47 +0200 |
---|---|---|
committer | SafwatHalaby <SafwatHalaby@users.noreply.github.com> | 2015-05-28 18:19:56 +0200 |
commit | f1540173da442878e132b0bbca1f8f60141e1cd0 (patch) | |
tree | 167748cd3f296946e245bc3809cf41153bd88c36 /src/Mobs/Skeleton.cpp | |
parent | Merge pull request #2152 from mc-server/fixes (diff) | |
download | cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.gz cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.bz2 cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.lz cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.xz cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.zst cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Skeleton.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index f99404669..d1a481960 100644 --- a/src/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp @@ -50,12 +50,13 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer) void cSkeleton::Attack(std::chrono::milliseconds a_Dt) { + cFastRandom Random; m_AttackInterval += (static_cast<float>(a_Dt.count()) / 1000) * m_AttackRate; if ((m_Target != nullptr) && (m_AttackInterval > 3.0)) { - // Setting this higher gives us more wiggle room for attackrate - Vector3d Speed = GetLookVector() * 20; - Speed.y = Speed.y + 1; + 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; + Speed.y = Speed.y - 1 + Random.NextInt(3); cArrowEntity * Arrow = new cArrowEntity(this, GetPosX(), GetPosY() + 1, GetPosZ(), Speed); if (Arrow == nullptr) { |