aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Grids
diff options
context:
space:
mode:
authorLucas Nascimento <keader.android@gmail.com>2021-10-25 19:31:58 -0300
committerGitHub <noreply@github.com>2021-10-25 19:31:58 -0300
commit1403de8dafbadb92dfd16c47b63156f9216a2bdd (patch)
treef423f497baa5ce56b24f6a07672fa8b6b429d709 /src/server/game/Grids
parentb0eaa938c9fcbbd5ec16a564b8bc2e2a5570f7de (diff)
Core/Spells: Fixed Prayer of Mending (#27105)
Closes #3770
Diffstat (limited to 'src/server/game/Grids')
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index ed2edd41f62..65fb265c9d9 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -23,6 +23,7 @@
#include "CreatureAI.h"
#include "DynamicObject.h"
#include "GameObject.h"
+#include "Group.h"
#include "Player.h"
#include "Spell.h"
#include "SpellInfo.h"
@@ -874,6 +875,44 @@ namespace Trinity
bool i_excludeSelf;
};
+ class MostHPMissingGroupInRange
+ {
+ public:
+ MostHPMissingGroupInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) { }
+
+ bool operator()(Unit* u)
+ {
+ if (i_obj == u)
+ return false;
+
+ Player* player = nullptr;
+ if (u->GetTypeId() == TYPEID_PLAYER)
+ player = u->ToPlayer();
+ else if (u->IsPet() && u->GetOwner())
+ player = u->GetOwner()->ToPlayer();
+
+ if (!player)
+ return false;
+
+ Group* group = player->GetGroup();
+ if (!group || !group->IsMember(i_obj->IsPet() ? i_obj->GetOwnerGUID() : i_obj->GetGUID()))
+ return false;
+
+ if (u->IsAlive() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
+ {
+ i_hp = u->GetMaxHealth() - u->GetHealth();
+ return true;
+ }
+
+ return false;
+ }
+
+ private:
+ Unit const* i_obj;
+ float i_range;
+ uint32 i_hp;
+ };
+
class FriendlyCCedInRange
{
public: