summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Monster.h')
-rw-r--r--src/Mobs/Monster.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index c4043b0e5..1076c9544 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));
@@ -274,13 +277,13 @@ protected:
void AddRandomUncommonDropItem(cItems & a_Drops, float a_Chance, short a_Item, short a_ItemHealth = 0);
/** Adds one rare item out of the list of rare items a_Items modified by the looting level a_LootingLevel(I-III or custom) to the itemdrop a_Drops*/
- void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, short a_LootingLevel);
+ void AddRandomRareDropItem(cItems & a_Drops, cItems & a_Items, unsigned int a_LootingLevel);
/** Adds armor that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
- void AddRandomArmorDropItem(cItems & a_Drops, short a_LootingLevel);
+ void AddRandomArmorDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
/** Adds weapon that is equipped with the chance saved in m_DropChance[...] (this will be greter than 1 if piccked up or 0.085 + (0.01 per LootingLevel) if born with) to the drop*/
- void AddRandomWeaponDropItem(cItems & a_Drops, short a_LootingLevel);
+ void AddRandomWeaponDropItem(cItems & a_Drops, unsigned int a_LootingLevel);
} ; // tolua_export