summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Skeleton.cpp
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-29 01:12:56 +0200
committertycho <work.tycho@gmail.com>2015-05-29 01:12:56 +0200
commit4956e8700d9a578fc65481c0fcfddf812366f08b (patch)
tree47ae313c74a228d254b08c5a146bbd2ea10e08b7 /src/Mobs/Skeleton.cpp
parentFix comments (diff)
parentFixed Info.lua documentation (diff)
downloadcuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.gz
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.bz2
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.lz
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.xz
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.zst
cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.zip
Diffstat (limited to 'src/Mobs/Skeleton.cpp')
-rw-r--r--src/Mobs/Skeleton.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp
index 9a99a107c..767e5b95c 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)
{