paladin buff strategy

This commit is contained in:
Yunfan Li
2023-07-15 15:10:18 +08:00
parent 071e9e6a49
commit 263651720f
5 changed files with 84 additions and 14 deletions

View File

@@ -5,6 +5,7 @@
#include "PaladinActions.h" #include "PaladinActions.h"
#include "Event.h" #include "Event.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "SharedDefines.h"
inline std::string const GetActualBlessingOfMight(Unit* target) inline std::string const GetActualBlessingOfMight(Unit* target)
{ {
@@ -25,6 +26,7 @@ inline std::string const GetActualBlessingOfWisdom(Unit* target)
{ {
case CLASS_WARRIOR: case CLASS_WARRIOR:
case CLASS_ROGUE: case CLASS_ROGUE:
case CLASS_DEATH_KNIGHT:
return "blessing of might"; return "blessing of might";
} }
@@ -33,7 +35,7 @@ inline std::string const GetActualBlessingOfWisdom(Unit* target)
Value<Unit*>* CastBlessingOnPartyAction::GetTargetValue() Value<Unit*>* CastBlessingOnPartyAction::GetTargetValue()
{ {
return context->GetValue<Unit*>("party member without aura", "blessing of kings,blessing of might,blessing of wisdom"); return context->GetValue<Unit*>("party member without aura", name);
} }
bool CastBlessingOfMightAction::Execute(Event event) bool CastBlessingOfMightAction::Execute(Event event)
@@ -45,6 +47,12 @@ bool CastBlessingOfMightAction::Execute(Event event)
return botAI->CastSpell(GetActualBlessingOfMight(target), target); return botAI->CastSpell(GetActualBlessingOfMight(target), target);
} }
Value<Unit*>* CastBlessingOfMightOnPartyAction::GetTargetValue()
{
return context->GetValue<Unit*>("party member without aura", "blessing of might,blessing of wisdom");
}
bool CastBlessingOfMightOnPartyAction::Execute(Event event) bool CastBlessingOfMightOnPartyAction::Execute(Event event)
{ {
Unit* target = GetTarget(); Unit* target = GetTarget();
@@ -63,6 +71,11 @@ bool CastBlessingOfWisdomAction::Execute(Event event)
return botAI->CastSpell(GetActualBlessingOfWisdom(target), target); return botAI->CastSpell(GetActualBlessingOfWisdom(target), target);
} }
Value<Unit*>* CastBlessingOfWisdomOnPartyAction::GetTargetValue()
{
return context->GetValue<Unit*>("party member without aura", "blessing of might,blessing of wisdom");
}
bool CastBlessingOfWisdomOnPartyAction::Execute(Event event) bool CastBlessingOfWisdomOnPartyAction::Execute(Event event)
{ {
Unit* target = GetTarget(); Unit* target = GetTarget();

View File

@@ -90,17 +90,21 @@ class CastBlessingOfMightAction : public CastBuffSpellAction
class CastBlessingOnPartyAction : public BuffOnPartyAction class CastBlessingOnPartyAction : public BuffOnPartyAction
{ {
public: public:
CastBlessingOnPartyAction(PlayerbotAI* botAI, std::string const name) : BuffOnPartyAction(botAI, name) { } CastBlessingOnPartyAction(PlayerbotAI* botAI, std::string const name) : BuffOnPartyAction(botAI, name), name(name) { }
Value<Unit*>* GetTargetValue() override; Value<Unit*>* GetTargetValue() override;
private:
std::string name;
}; };
class CastBlessingOfMightOnPartyAction : public CastBlessingOnPartyAction class CastBlessingOfMightOnPartyAction : public BuffOnPartyAction
{ {
public: public:
CastBlessingOfMightOnPartyAction(PlayerbotAI* botAI) : CastBlessingOnPartyAction(botAI, "blessing of might") { } CastBlessingOfMightOnPartyAction(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, "blessing of might") { }
std::string const getName() override { return "blessing of might on party";} std::string const getName() override { return "blessing of might on party";}
Value<Unit*>* GetTargetValue() override;
bool Execute(Event event) override; bool Execute(Event event) override;
}; };
@@ -112,12 +116,13 @@ class CastBlessingOfWisdomAction : public CastBuffSpellAction
bool Execute(Event event) override; bool Execute(Event event) override;
}; };
class CastBlessingOfWisdomOnPartyAction : public CastBlessingOnPartyAction class CastBlessingOfWisdomOnPartyAction : public BuffOnPartyAction
{ {
public: public:
CastBlessingOfWisdomOnPartyAction(PlayerbotAI* botAI) : CastBlessingOnPartyAction(botAI, "blessing of wisdom") { } CastBlessingOfWisdomOnPartyAction(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, "blessing of wisdom") { }
std::string const getName() override { return "blessing of wisdom on party";} std::string const getName() override { return "blessing of wisdom on party";}
Value<Unit*>* GetTargetValue() override;
bool Execute(Event event) override; bool Execute(Event event) override;
}; };

View File

@@ -128,6 +128,10 @@ class PaladinTriggerFactoryInternal : public NamedObjectContext<Trigger>
creators["repentance interrupt"] = &PaladinTriggerFactoryInternal::repentance_interrupt; creators["repentance interrupt"] = &PaladinTriggerFactoryInternal::repentance_interrupt;
creators["beacon of light on main tank"] = &PaladinTriggerFactoryInternal::beacon_of_light_on_main_tank; creators["beacon of light on main tank"] = &PaladinTriggerFactoryInternal::beacon_of_light_on_main_tank;
creators["sacred shield on main tank"] = &PaladinTriggerFactoryInternal::sacred_shield_on_main_tank; creators["sacred shield on main tank"] = &PaladinTriggerFactoryInternal::sacred_shield_on_main_tank;
creators["blessing of kings on party"] = &PaladinTriggerFactoryInternal::blessing_of_kings_on_party;
creators["blessing of wisdom on party"] = &PaladinTriggerFactoryInternal::blessing_of_wisdom_on_party;
creators["blessing of might on party"] = &PaladinTriggerFactoryInternal::blessing_of_might_on_party;
} }
private: private:
@@ -167,6 +171,10 @@ class PaladinTriggerFactoryInternal : public NamedObjectContext<Trigger>
static Trigger* repentance_interrupt(PlayerbotAI* botAI) { return new RepentanceInterruptTrigger(botAI); } static Trigger* repentance_interrupt(PlayerbotAI* botAI) { return new RepentanceInterruptTrigger(botAI); }
static Trigger* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new BeaconOfLightOnMainTankTrigger(ai); } static Trigger* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new BeaconOfLightOnMainTankTrigger(ai); }
static Trigger* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new SacredShieldOnMainTankTrigger(ai); } static Trigger* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new SacredShieldOnMainTankTrigger(ai); }
static Trigger* blessing_of_kings_on_party(PlayerbotAI* botAI) { return new BlessingOfKingsOnPartyTrigger(botAI); }
static Trigger* blessing_of_wisdom_on_party(PlayerbotAI* botAI) { return new BlessingOfWisdomOnPartyTrigger(botAI); }
static Trigger* blessing_of_might_on_party(PlayerbotAI* botAI) { return new BlessingOfMightOnPartyTrigger(botAI); }
}; };
class PaladinAiObjectContextInternal : public NamedObjectContext<Action> class PaladinAiObjectContextInternal : public NamedObjectContext<Action>

View File

@@ -7,20 +7,20 @@
void PaladinBuffManaStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinBuffManaStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
triggers.push_back(new TriggerNode("blessing on party", NextAction::array(0, new NextAction("blessing of wisdom on party", 11.0f), nullptr))); triggers.push_back(new TriggerNode("blessing of wisdom on party", NextAction::array(0, new NextAction("blessing of wisdom on party", 11.0f), nullptr)));
triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of wisdom", ACTION_HIGH + 8), nullptr))); // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of wisdom", ACTION_HIGH + 8), nullptr)));
} }
void PaladinBuffHealthStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinBuffHealthStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
triggers.push_back(new TriggerNode("blessing on party", NextAction::array(0, new NextAction("blessing of kings on party", 11.0f), nullptr))); triggers.push_back(new TriggerNode("blessing of kings on party", NextAction::array(0, new NextAction("blessing of kings on party", 11.0f), nullptr)));
triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of kings", ACTION_HIGH + 8), nullptr))); // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of kings", ACTION_HIGH + 8), nullptr)));
} }
void PaladinBuffDpsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinBuffDpsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
triggers.push_back(new TriggerNode("blessing on party", NextAction::array(0, new NextAction("blessing of might on party", 11.0f), nullptr))); triggers.push_back(new TriggerNode("blessing of might on party", NextAction::array(0, new NextAction("blessing of might on party", 11.0f), nullptr)));
triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of might", ACTION_HIGH + 8), nullptr))); // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of might", ACTION_HIGH + 8), nullptr)));
} }
void PaladinShadowResistanceStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinShadowResistanceStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
@@ -56,6 +56,6 @@ void PaladinBuffThreatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers
void PaladinBuffStatsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinBuffStatsStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
triggers.push_back(new TriggerNode("blessing on party", NextAction::array(0, new NextAction("blessing of kings on party", 11.0f), nullptr))); triggers.push_back(new TriggerNode("blessing of kings on party", NextAction::array(0, new NextAction("blessing of kings on party", 11.0f), nullptr)));
triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of kings", ACTION_HIGH + 8), nullptr))); // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of kings", ACTION_HIGH + 8), nullptr)));
} }

View File

@@ -10,6 +10,32 @@
class PlayerbotAI; class PlayerbotAI;
inline std::string const GetActualBlessingOfMight(Unit* target)
{
switch (target->getClass())
{
case CLASS_MAGE:
case CLASS_PRIEST:
case CLASS_WARLOCK:
return "blessing of wisdom";
}
return "blessing of might";
}
inline std::string const GetActualBlessingOfWisdom(Unit* target)
{
switch (target->getClass())
{
case CLASS_WARRIOR:
case CLASS_ROGUE:
case CLASS_DEATH_KNIGHT:
return "blessing of might";
}
return "blessing of wisdom";
}
BUFF_TRIGGER(HolyShieldTrigger, "holy shield"); BUFF_TRIGGER(HolyShieldTrigger, "holy shield");
BUFF_TRIGGER(RighteousFuryTrigger, "righteous fury"); BUFF_TRIGGER(RighteousFuryTrigger, "righteous fury");
@@ -171,4 +197,22 @@ class SacredShieldOnMainTankTrigger : public BuffOnMainTankTrigger
public: public:
SacredShieldOnMainTankTrigger(PlayerbotAI* ai) : BuffOnMainTankTrigger(ai, "sacred shield", false) {} SacredShieldOnMainTankTrigger(PlayerbotAI* ai) : BuffOnMainTankTrigger(ai, "sacred shield", false) {}
}; };
class BlessingOfKingsOnPartyTrigger : public BuffOnPartyTrigger
{
public:
BlessingOfKingsOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of kings", 2) { }
};
class BlessingOfWisdomOnPartyTrigger : public BuffOnPartyTrigger
{
public:
BlessingOfWisdomOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of might,blessing of wisdom", 2) { }
};
class BlessingOfMightOnPartyTrigger : public BuffOnPartyTrigger
{
public:
BlessingOfMightOnPartyTrigger(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, "blessing of might,blessing of wisdom", 2) { }
};
#endif #endif