From f1540173da442878e132b0bbca1f8f60141e1cd0 Mon Sep 17 00:00:00 2001 From: SafwatHalaby Date: Thu, 28 May 2015 17:45:47 +0300 Subject: AI - Sane Skeleton --- src/Mobs/Monster.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Mobs/Monster.h') diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index c4043b0e5..fa23df3db 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -193,13 +193,16 @@ protected: If no suitable position is found, returns cChunkDef::Height. */ int FindFirstNonAirBlockPosition(double a_PosX, double a_PosZ); - /** Returns if the ultimate, final destination has been reached */ - bool ReachedFinalDestination(void) { return ((m_FinalDestination - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); } + /** Returns if the ultimate, final destination has been reached. */ + bool ReachedFinalDestination(void) { return ((m_FinalDestination - GetPosition()).Length() < GetWidth()/2); } + + /** Returns whether or not the target is close enough for attack. */ + bool TargetIsInRange(void) { return ((m_FinalDestination - GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); } /** Returns if the intermediate waypoint of m_NextWayPointPosition has been reached */ bool ReachedNextWaypoint(void) { return ((m_NextWayPointPosition - GetPosition()).SqrLength() < 0.25); } - /** Returns if a monster can reach a given height by jumping */ + /** Returns if a monster can reach a given height by jumping. */ inline bool DoesPosYRequireJump(int a_PosY) { return ((a_PosY > POSY_TOINT) && (a_PosY == POSY_TOINT + 1)); -- cgit v1.2.3