aboutsummaryrefslogtreecommitdiff
path: root/src/game/GridNotifiers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/GridNotifiers.h')
-rw-r--r--src/game/GridNotifiers.h57
1 files changed, 32 insertions, 25 deletions
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 2295f72e4c9..21ef9d0c81b 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -950,31 +950,6 @@ namespace Trinity
NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const&);
};
- class NearestAssistCreatureInCreatureRangeCheck
- {
- public:
- NearestAssistCreatureInCreatureRangeCheck(Creature* obj,Unit* enemy, float range)
- : i_obj(obj), i_enemy(enemy), i_range(range) {}
-
- bool operator()(Creature* u)
- {
- if(u->getFaction() == i_obj->getFaction() && !u->isInCombat() && !u->GetCharmerOrOwnerGUID() && u->IsHostileTo(i_enemy) && u->isAlive()&& i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsWithinLOSInMap(u))
- {
- i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
- return true;
- }
- return false;
- }
- float GetLastRange() const { return i_range; }
- private:
- Creature* const i_obj;
- Unit* const i_enemy;
- float i_range;
-
- // prevent clone this object
- NearestAssistCreatureInCreatureRangeCheck(NearestAssistCreatureInCreatureRangeCheck const&);
- };
-
class AnyAssistCreatureInRangeCheck
{
public:
@@ -1006,6 +981,38 @@ namespace Trinity
float i_range;
};
+ class NearestAssistCreatureInCreatureRangeCheck
+ {
+ public:
+ NearestAssistCreatureInCreatureRangeCheck(Creature* obj, Unit* enemy, float range)
+ : i_obj(obj), i_enemy(enemy), i_range(range) {}
+
+ bool operator()(Creature* u)
+ {
+ if(u == i_obj)
+ return false;
+ if(!u->CanAssistTo(i_obj,i_enemy))
+ return false;
+
+ if(!i_obj->IsWithinDistInMap(u, i_range))
+ return false;
+
+ if(!i_obj->IsWithinLOSInMap(u))
+ return false;
+
+ i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
+ return true;
+ }
+ float GetLastRange() const { return i_range; }
+ private:
+ Creature* const i_obj;
+ Unit* const i_enemy;
+ float i_range;
+
+ // prevent clone this object
+ NearestAssistCreatureInCreatureRangeCheck(NearestAssistCreatureInCreatureRangeCheck const&);
+ };
+
// Success at unit in range, range update for next check (this can be use with CreatureLastSearcher to find nearest creature)
class NearestCreatureEntryWithLiveStateInObjectRangeCheck
{