[Class spell] Fix healing priests stop casting due to threat

This commit is contained in:
Yunfan Li
2024-05-07 22:21:38 +08:00
parent 063d8e17d0
commit 26faac914e
4 changed files with 85 additions and 9 deletions

View File

@@ -277,12 +277,12 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
switch (player->getClass())
{
case CLASS_PRIEST:
if (tab == 2)
{
if (tab == 2) {
engine->addStrategies("dps", "shadow debuff", "shadow aoe", "threat", nullptr);
}
else {
engine->addStrategies("heal", "threat", nullptr);
} else if (tab == PRIEST_TAB_DISIPLINE) {
engine->addStrategies("heal", nullptr);
} else {
engine->addStrategies("holy heal", nullptr);
}
engine->addStrategies("dps assist", "cure", nullptr);
@@ -375,7 +375,7 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
switch (player->getClass()) {
case CLASS_PRIEST: {
if (tab != PRIEST_TAB_SHADOW) {
engine->addStrategies("holy", "shadow debuff", "shadow aoe", nullptr);
engine->addStrategies("holy dps", "shadow debuff", "shadow aoe", nullptr);
}
break;
}

View File

@@ -42,3 +42,64 @@ void HolyPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("shadowfiend", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("mana burn", ACTION_HIGH), nullptr)));
}
HolyHealPriestStrategy::HolyHealPriestStrategy(PlayerbotAI* botAI) : GenericPriestStrategy(botAI)
{
actionNodeFactories.Add(new GenericPriestStrategyActionNodeFactory());
}
NextAction** HolyHealPriestStrategy::getDefaultActions()
{
return NextAction::array(0, new NextAction("shoot", ACTION_DEFAULT), nullptr);
}
void HolyHealPriestStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
GenericPriestStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode(
"group heal occasion",
NextAction::array(0,
new NextAction("circle of healing", ACTION_MEDIUM_HEAL + 8),
new NextAction("prayer of healing on party", ACTION_MEDIUM_HEAL + 6),
NULL)));
triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine hymn", ACTION_CRITICAL_HEAL + 5), NULL)));
triggers.push_back(new TriggerNode(
"party member critical health",
NextAction::array(0,
new NextAction("power word: shield on party", ACTION_CRITICAL_HEAL + 5),
new NextAction("flash heal on party", ACTION_CRITICAL_HEAL + 3),
new NextAction("prayer of mending on party", ACTION_CRITICAL_HEAL + 2),
NULL)));
triggers.push_back(new TriggerNode(
"party member low health",
NextAction::array(0,
new NextAction("circle of healing", ACTION_MEDIUM_HEAL + 4),
new NextAction("greater heal on party", ACTION_MEDIUM_HEAL + 3),
new NextAction("prayer of mending on party", ACTION_MEDIUM_HEAL + 2),
new NextAction("flash heal on party", ACTION_MEDIUM_HEAL + 1),
NULL)));
triggers.push_back(new TriggerNode(
"party member medium health",
NextAction::array(0,
new NextAction("circle of healing", ACTION_LIGHT_HEAL + 7),
new NextAction("prayer of mending on party", ACTION_LIGHT_HEAL + 6),
new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 5),
// new NextAction("renew on party", ACTION_LIGHT_HEAL + 8),
NULL)));
triggers.push_back(new TriggerNode(
"party member almost full health",
NextAction::array(0,
new NextAction("renew on party", ACTION_LIGHT_HEAL + 2),
// new NextAction("flash heal on party", ACTION_LIGHT_HEAL + 1),
NULL)));
triggers.push_back(new TriggerNode("party member to heal out of spell range", NextAction::array(0, new NextAction("reach party member to heal", ACTION_CRITICAL_HEAL + 10), nullptr)));
}

View File

@@ -6,6 +6,7 @@
#define _PLAYERBOT_HOLYPRIESTSTRATEGY_H
#include "HealPriestStrategy.h"
#include "GenericPriestStrategyActionNodeFactory.h"
class PlayerbotAI;
@@ -16,8 +17,20 @@ class HolyPriestStrategy : public HealPriestStrategy
NextAction** getDefaultActions() override;
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
std::string const getName() override { return "holy"; }
std::string const getName() override { return "holy dps"; }
uint32 GetType() const override { return STRATEGY_TYPE_DPS | STRATEGY_TYPE_RANGED; }
};
class HolyHealPriestStrategy : public GenericPriestStrategy
{
public:
HolyHealPriestStrategy(PlayerbotAI* botAI);
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
NextAction** getDefaultActions() override;
std::string const getName() override { return "holy heal"; }
uint32 GetType() const override { return STRATEGY_TYPE_HEAL | STRATEGY_TYPE_RANGED; }
};
#endif

View File

@@ -50,13 +50,15 @@ class PriestCombatStrategyFactoryInternal : public NamedObjectContext<Strategy>
creators["heal"] = &PriestCombatStrategyFactoryInternal::heal;
creators["shadow"] = &PriestCombatStrategyFactoryInternal::dps;
creators["dps"] = &PriestCombatStrategyFactoryInternal::dps;
creators["holy"] = &PriestCombatStrategyFactoryInternal::holy;
creators["holy dps"] = &PriestCombatStrategyFactoryInternal::holy_dps;
creators["holy heal"] = &PriestCombatStrategyFactoryInternal::holy_heal;
}
private:
static Strategy* heal(PlayerbotAI* botAI) { return new HealPriestStrategy(botAI); }
static Strategy* dps(PlayerbotAI* botAI) { return new ShadowPriestStrategy(botAI); }
static Strategy* holy(PlayerbotAI* botAI) { return new HolyPriestStrategy(botAI); }
static Strategy* holy_dps(PlayerbotAI* botAI) { return new HolyPriestStrategy(botAI); }
static Strategy* holy_heal(PlayerbotAI* botAI) { return new HolyHealPriestStrategy(botAI); }
};
class PriestTriggerFactoryInternal : public NamedObjectContext<Trigger>