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

@ -24,12 +24,12 @@ void HealPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
"enemy out of spell", "enemy out of spell",
NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), NULL))); NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), NULL)));
triggers.push_back(new TriggerNode( // triggers.push_back(new TriggerNode(
"medium aoe heal", // "medium aoe heal",
NextAction::array(0, // NextAction::array(0,
new NextAction("circle of healing", ACTION_MEDIUM_HEAL + 8), // new NextAction("circle of healing", ACTION_MEDIUM_HEAL + 8),
// new NextAction("power word: shield on almost full health below", ACTION_MEDIUM_HEAL + 7), // // new NextAction("power word: shield on almost full health below", ACTION_MEDIUM_HEAL + 7),
NULL))); // NULL)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"group heal occasion", "group heal occasion",

View File

@ -21,3 +21,53 @@ bool CastRemoveShadowformAction::Execute(Event event)
botAI->RemoveAura("shadowform"); botAI->RemoveAura("shadowform");
return true; 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;
}

View File

@ -149,4 +149,11 @@ public:
CastShadowfiendAction(PlayerbotAI* ai) : CastSpellAction(ai, "shadowfiend") {} CastShadowfiendAction(PlayerbotAI* ai) : CastSpellAction(ai, "shadowfiend") {}
virtual std::string const GetTargetName() { return "current target"; } virtual std::string const GetTargetName() { return "current target"; }
}; };
class CastPowerWordShieldOnAlmostFullHealthBelow : public HealPartyMemberAction {
public:
CastPowerWordShieldOnAlmostFullHealthBelow(PlayerbotAI* ai) : HealPartyMemberAction(ai, "power word: shield") {}
bool isUseful() override;
Unit* GetTarget() override;
};
#endif #endif

View File

@ -158,6 +158,7 @@ class PriestAiObjectContextInternal : public NamedObjectContext<Action>
creators["divine spirit on party"] = &PriestAiObjectContextInternal::divine_spirit_on_party; creators["divine spirit on party"] = &PriestAiObjectContextInternal::divine_spirit_on_party;
creators["power word: shield"] = &PriestAiObjectContextInternal::power_word_shield; creators["power word: shield"] = &PriestAiObjectContextInternal::power_word_shield;
creators["power word: shield on party"] = &PriestAiObjectContextInternal::power_word_shield_on_party; creators["power word: shield on party"] = &PriestAiObjectContextInternal::power_word_shield_on_party;
creators["power word: shield on almost full health below"] = &PriestAiObjectContextInternal::power_word_shield_on_almost_full_health_below;
creators["renew"] = &PriestAiObjectContextInternal::renew; creators["renew"] = &PriestAiObjectContextInternal::renew;
creators["renew on party"] = &PriestAiObjectContextInternal::renew_on_party; creators["renew on party"] = &PriestAiObjectContextInternal::renew_on_party;
creators["greater heal"] = &PriestAiObjectContextInternal::greater_heal; creators["greater heal"] = &PriestAiObjectContextInternal::greater_heal;
@ -247,6 +248,7 @@ class PriestAiObjectContextInternal : public NamedObjectContext<Action>
static Action* divine_spirit_on_party(PlayerbotAI* botAI) { return new CastDivineSpiritOnPartyAction(botAI); } static Action* divine_spirit_on_party(PlayerbotAI* botAI) { return new CastDivineSpiritOnPartyAction(botAI); }
static Action* power_word_shield(PlayerbotAI* botAI) { return new CastPowerWordShieldAction(botAI); } static Action* power_word_shield(PlayerbotAI* botAI) { return new CastPowerWordShieldAction(botAI); }
static Action* power_word_shield_on_party(PlayerbotAI* botAI) { return new CastPowerWordShieldOnPartyAction(botAI); } static Action* power_word_shield_on_party(PlayerbotAI* botAI) { return new CastPowerWordShieldOnPartyAction(botAI); }
static Action* power_word_shield_on_almost_full_health_below(PlayerbotAI* ai) { return new CastPowerWordShieldOnAlmostFullHealthBelow(ai); }
static Action* renew(PlayerbotAI* botAI) { return new CastRenewAction(botAI); } static Action* renew(PlayerbotAI* botAI) { return new CastRenewAction(botAI); }
static Action* renew_on_party(PlayerbotAI* botAI) { return new CastRenewOnPartyAction(botAI); } static Action* renew_on_party(PlayerbotAI* botAI) { return new CastRenewOnPartyAction(botAI); }
static Action* greater_heal(PlayerbotAI* botAI) { return new CastGreaterHealAction(botAI); } static Action* greater_heal(PlayerbotAI* botAI) { return new CastGreaterHealAction(botAI); }