Added facing check to auto attack LoS code

The Mob::InFrontMob check uses 56 degrees which is where the
client will generate the "You cannon see your target." message.
There were still a few weird angles that I was able to still
attack, but in like 99% of the cases it should work ...
This commit is contained in:
Michael Cook (mackal)
2013-12-20 17:47:28 -05:00
parent 9fff694382
commit 5ac23a2f8f
6 changed files with 60 additions and 37 deletions
+7 -1
View File
@@ -106,7 +106,13 @@ public:
//Attack
virtual void RogueBackstab(Mob* other, bool min_damage = false, int ReuseTime = 10);
virtual void RogueAssassinate(Mob* other); // solar
bool BehindMob(Mob* other = 0, float playerx = 0.0f, float playery = 0.0f) const;
float MobAngle(Mob *other = 0, float ourx = 0.0f, float oury = 0.0f) const;
// greater than 90 is behind
inline bool BehindMob(Mob *other = 0, float ourx = 0.0f, float oury = 0.0f) const
{ return (!other || other == this) ? true : MobAngle(other, ourx, oury) > 90.0f; }
// less than 56 is in front, greater than 56 is usually where the client generates the messages
inline bool InFrontMob(Mob *other = 0, float ourx = 0.0f, float oury = 0.0f) const
{ return (!other || other == this) ? true : MobAngle(other, ourx, oury) < 56.0f; }
virtual void RangedAttack(Mob* other) { }
virtual void ThrowingAttack(Mob* other) { }
uint16 GetThrownDamage(int16 wDmg, int32& TotalDmg, int& minDmg);