aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Grids/Notifiers
diff options
context:
space:
mode:
authorKeader <keader.android@gmail.com>2016-11-27 20:28:06 -0200
committerDoctorKraft <DoctorKraft@users.noreply.github.com>2018-03-11 16:42:26 +0100
commite65ddccd1b82ed3e2b49a7032d7ed4b69ff2276b (patch)
treee5c6feef19098108fc1f66df08ecf6635e95272a /src/server/game/Grids/Notifiers
parent203ec72ecc387e2d5d4b26450087798a6c8f31cc (diff)
Core/AI: Added new method for search friendly targets with certain entry and hp pct below a value (#18310)
(cherry picked from commit e7024f8a4c514eb4d8466383f8b5367ad7bab630)
Diffstat (limited to 'src/server/game/Grids/Notifiers')
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index f2611edab14..4635f16042a 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -804,6 +804,28 @@ namespace Trinity
uint64 i_hp;
};
+ class FriendlyBelowHpPctEntryInRange
+ {
+ public:
+ FriendlyBelowHpPctEntryInRange(Unit const* obj, uint32 entry, float range, uint8 pct, bool excludeSelf) : i_obj(obj), i_entry(entry), i_range(range), i_pct(pct), i_excludeSelf(excludeSelf) { }
+
+ bool operator()(Unit* u)
+ {
+ if (i_excludeSelf && i_obj->GetGUID() == u->GetGUID())
+ return false;
+ if (u->GetEntry() == i_entry && u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->HealthBelowPct(i_pct))
+ return true;
+ return false;
+ }
+
+ private:
+ Unit const* i_obj;
+ uint32 i_entry;
+ float i_range;
+ uint8 i_pct;
+ bool i_excludeSelf;
+ };
+
class FriendlyCCedInRange
{
public: