Discipline priest shield

This commit is contained in:
Yunfan Li
2023-07-24 14:42:40 +08:00
parent f3a0a53457
commit f8cc3810b6
4 changed files with 65 additions and 6 deletions

View File

@@ -21,3 +21,53 @@ bool CastRemoveShadowformAction::Execute(Event event)
botAI->RemoveAura("shadowform");
return true;
}
Unit* CastPowerWordShieldOnAlmostFullHealthBelow::GetTarget()
{
Group *group = bot->GetGroup();
for (GroupReference *gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* player = gref->GetSource();
if (!player)
continue;
if (player->isDead()) {
continue;
}
if (player->GetHealthPct() > sPlayerbotAIConfig->almostFullHealth) {
continue;
}
if (player->GetDistance2d(bot) > sPlayerbotAIConfig->spellDistance) {
continue;
}
if (botAI->HasAnyAuraOf(player, "weakened soul", "power word: shield", NULL)) {
continue;
}
return player;
}
return NULL;
}
bool CastPowerWordShieldOnAlmostFullHealthBelow::isUseful()
{
Group *group = bot->GetGroup();
for (GroupReference *gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* player = gref->GetSource();
if (!player)
continue;
if (player->isDead()) {
continue;
}
if (player->GetHealthPct() > sPlayerbotAIConfig->almostFullHealth) {
continue;
}
if (player->GetDistance2d(bot) > sPlayerbotAIConfig->spellDistance) {
continue;
}
if (botAI->HasAnyAuraOf(player, "weakened soul", "power word: shield", NULL)) {
continue;
}
return true;
}
return false;
}