Skip to content

Commit

Permalink
Implement possibility to get also not in combat unit for MostHPMissin…
Browse files Browse the repository at this point in the history
…gInRangeCheck
  • Loading branch information
Cyberium committed Sep 2, 2016
1 parent ccff463 commit c7f07d8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/game/GridNotifiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,14 @@ namespace MaNGOS
class MostHPMissingInRangeCheck
{
public:
MostHPMissingInRangeCheck(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) {}
MostHPMissingInRangeCheck(Unit const* obj, float range, uint32 hp, bool onlyInCombat = true) : i_obj(obj), i_range(range), i_hp(hp), i_onlyInCombat(onlyInCombat) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
if (!u->isAlive() || (i_onlyInCombat && !u->isInCombat()))
return false;

if (!i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
{
i_hp = u->GetMaxHealth() - u->GetHealth();
return true;
Expand All @@ -815,6 +818,7 @@ namespace MaNGOS
Unit const* i_obj;
float i_range;
uint32 i_hp;
bool i_onlyInCombat;
};

class FriendlyCCedInRangeCheck
Expand Down

0 comments on commit c7f07d8

Please sign in to comment.