mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Discipline priest shield
This commit is contained in:
@@ -24,12 +24,12 @@ void HealPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
"enemy out of spell",
|
||||
NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), NULL)));
|
||||
|
||||
triggers.push_back(new TriggerNode(
|
||||
"medium aoe heal",
|
||||
NextAction::array(0,
|
||||
new NextAction("circle of healing", ACTION_MEDIUM_HEAL + 8),
|
||||
// new NextAction("power word: shield on almost full health below", ACTION_MEDIUM_HEAL + 7),
|
||||
NULL)));
|
||||
// triggers.push_back(new TriggerNode(
|
||||
// "medium aoe heal",
|
||||
// NextAction::array(0,
|
||||
// new NextAction("circle of healing", ACTION_MEDIUM_HEAL + 8),
|
||||
// // new NextAction("power word: shield on almost full health below", ACTION_MEDIUM_HEAL + 7),
|
||||
// NULL)));
|
||||
|
||||
triggers.push_back(new TriggerNode(
|
||||
"group heal occasion",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -149,4 +149,11 @@ public:
|
||||
CastShadowfiendAction(PlayerbotAI* ai) : CastSpellAction(ai, "shadowfiend") {}
|
||||
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
|
||||
|
||||
@@ -158,6 +158,7 @@ class PriestAiObjectContextInternal : public NamedObjectContext<Action>
|
||||
creators["divine spirit on party"] = &PriestAiObjectContextInternal::divine_spirit_on_party;
|
||||
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 almost full health below"] = &PriestAiObjectContextInternal::power_word_shield_on_almost_full_health_below;
|
||||
creators["renew"] = &PriestAiObjectContextInternal::renew;
|
||||
creators["renew on party"] = &PriestAiObjectContextInternal::renew_on_party;
|
||||
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* 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_almost_full_health_below(PlayerbotAI* ai) { return new CastPowerWordShieldOnAlmostFullHealthBelow(ai); }
|
||||
static Action* renew(PlayerbotAI* botAI) { return new CastRenewAction(botAI); }
|
||||
static Action* renew_on_party(PlayerbotAI* botAI) { return new CastRenewOnPartyAction(botAI); }
|
||||
static Action* greater_heal(PlayerbotAI* botAI) { return new CastGreaterHealAction(botAI); }
|
||||
|
||||
Reference in New Issue
Block a user