mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 09:50:27 +00:00
Improve party member to heal and has aura to dispel check performance
This commit is contained in:
@@ -41,36 +41,54 @@ Unit* PartyMemberToHeal::Calculate()
|
||||
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
||||
{
|
||||
Player* player = gref->GetSource();
|
||||
if (player && Check(player) && player->IsAlive())
|
||||
if (player && player->IsAlive())
|
||||
{
|
||||
uint8 health = player->GetHealthPct();
|
||||
if (isRaid || health < sPlayerbotAIConfig->mediumHealth || !IsTargetOfSpellCast(player, predicate))
|
||||
{
|
||||
uint32 probeValue = 100;
|
||||
if (player->GetDistance2d(bot) > sPlayerbotAIConfig->healDistance)
|
||||
{
|
||||
calc.probe(health + 30, player);
|
||||
probeValue = health + 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
calc.probe(health + player->GetDistance2d(bot) / 10, player);
|
||||
probeValue = health + player->GetDistance2d(bot) / 10;
|
||||
}
|
||||
// delay Check player to here for better performance
|
||||
if (probeValue < calc.minValue && Check(player))
|
||||
{
|
||||
calc.probe(probeValue, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pet* pet = player->GetPet();
|
||||
if (pet && Check(pet) && pet->IsAlive())
|
||||
if (pet && pet->IsAlive())
|
||||
{
|
||||
uint8 health = ((Unit*)pet)->GetHealthPct();
|
||||
uint32 probeValue = 100;
|
||||
if (isRaid || health < sPlayerbotAIConfig->mediumHealth)
|
||||
calc.probe(health + 30, pet);
|
||||
probeValue = health + 30;
|
||||
// delay Check pet to here for better performance
|
||||
if (probeValue < calc.minValue && Check(pet))
|
||||
{
|
||||
calc.probe(probeValue, pet);
|
||||
}
|
||||
}
|
||||
|
||||
Unit* charm = player->GetCharm();
|
||||
if (charm && Check(charm) && charm->IsAlive())
|
||||
if (charm && charm->IsAlive())
|
||||
{
|
||||
uint8 health = charm->GetHealthPct();
|
||||
uint32 probeValue = 100;
|
||||
if (isRaid || health < sPlayerbotAIConfig->mediumHealth)
|
||||
calc.probe(health, charm);
|
||||
probeValue = health + 30;
|
||||
// delay Check charm to here for better performance
|
||||
if (probeValue < calc.minValue && Check(charm))
|
||||
{
|
||||
calc.probe(probeValue, charm);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (Unit*)calc.param;
|
||||
|
||||
Reference in New Issue
Block a user