mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 23:26:23 +00:00
fix(Spell/Core): Prayer of Mending Heal not smart Healing [TC Cherry Pick] (#8753)
Co-authored by @Keader
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "GameObject.h"
|
||||
#include "Group.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectGridLoader.h"
|
||||
#include "Optional.h"
|
||||
@@ -1351,6 +1352,55 @@ namespace Acore
|
||||
float m_fRange;
|
||||
};
|
||||
|
||||
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 AllDeadCreaturesInRange
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user