Enchant paladin divine sacrifice

This commit is contained in:
Yunfan Li
2024-03-27 10:26:14 +08:00
parent 47928a9735
commit f03e12cb38
8 changed files with 89 additions and 29 deletions

View File

@@ -305,7 +305,6 @@ AiPlayerbot.AlmostFullHealth = 85
AiPlayerbot.LowMana = 15 AiPlayerbot.LowMana = 15
AiPlayerbot.MediumMana = 40 AiPlayerbot.MediumMana = 40
# Random bot default strategies (applied after defaults)
# Enable healer bot save mana # Enable healer bot save mana
# Default: 1 (enable) # Default: 1 (enable)
@@ -316,6 +315,7 @@ AiPlayerbot.AutoSaveMana = 1
AiPlayerbot.SaveManaThreshold = 60 AiPlayerbot.SaveManaThreshold = 60
# Random bot default strategies (applied after defaults)
AiPlayerbot.RandomBotCombatStrategies = "+dps,+dps assist,-threat" AiPlayerbot.RandomBotCombatStrategies = "+dps,+dps assist,-threat"
# AiPlayerbot.RandomBotNonCombatStrategies = "+grind,+loot,+rpg,+custom::say" # AiPlayerbot.RandomBotNonCombatStrategies = "+grind,+loot,+rpg,+custom::say"
AiPlayerbot.RandomBotNonCombatStrategies = "" AiPlayerbot.RandomBotNonCombatStrategies = ""

View File

@@ -43,6 +43,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
creators["taunt spell"] = &hand_of_reckoning; creators["taunt spell"] = &hand_of_reckoning;
creators["righteous defense"] = &righteous_defense; creators["righteous defense"] = &righteous_defense;
creators["avenger's shield"] = &avengers_shield; creators["avenger's shield"] = &avengers_shield;
creators["divine sacrifice"] = &divine_sacrifice;
} }
private: private:
static ActionNode* blessing_of_sanctuary(PlayerbotAI* ai) static ActionNode* blessing_of_sanctuary(PlayerbotAI* ai)
@@ -84,7 +85,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{ {
return new ActionNode ("retribution aura", return new ActionNode ("retribution aura",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("devotion aura"), NULL), /*A*/ NextAction::array(0, new NextAction("devotion aura"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* lay_on_hands(PlayerbotAI* ai) static ActionNode* lay_on_hands(PlayerbotAI* ai)
@@ -112,7 +113,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{ {
return new ActionNode ("cleanse poison", return new ActionNode ("cleanse poison",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify poison"), NULL), /*A*/ NextAction::array(0, new NextAction("purify poison"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* cleanse_magic(PlayerbotAI* ai) static ActionNode* cleanse_magic(PlayerbotAI* ai)
@@ -126,21 +127,21 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{ {
return new ActionNode ("cleanse disease", return new ActionNode ("cleanse disease",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify disease"), NULL), /*A*/ NextAction::array(0, new NextAction("purify disease"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* cleanse_poison_on_party(PlayerbotAI* ai) static ActionNode* cleanse_poison_on_party(PlayerbotAI* ai)
{ {
return new ActionNode ("cleanse poison on party", return new ActionNode ("cleanse poison on party",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify poison on party"), NULL), /*A*/ NextAction::array(0, new NextAction("purify poison on party"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* cleanse_disease_on_party(PlayerbotAI* ai) static ActionNode* cleanse_disease_on_party(PlayerbotAI* ai)
{ {
return new ActionNode ("cleanse disease on party", return new ActionNode ("cleanse disease on party",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("purify disease on party"), NULL), /*A*/ NextAction::array(0, new NextAction("purify disease on party"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
// static ActionNode* seal_of_wisdom(PlayerbotAI* ai) // static ActionNode* seal_of_wisdom(PlayerbotAI* ai)
@@ -154,35 +155,42 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{ {
return new ActionNode ("seal of justice", return new ActionNode ("seal of justice",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL), /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* hand_of_reckoning(PlayerbotAI* ai) static ActionNode* hand_of_reckoning(PlayerbotAI* ai)
{ {
return new ActionNode ("hand of reckoning", return new ActionNode ("hand of reckoning",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("righteous defense"), NULL), /*A*/ NextAction::array(0, new NextAction("righteous defense"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* righteous_defense(PlayerbotAI* ai) static ActionNode* righteous_defense(PlayerbotAI* ai)
{ {
return new ActionNode ("righteous defense", return new ActionNode ("righteous defense",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("avenger's shield"), NULL), /*A*/ NextAction::array(0, new NextAction("avenger's shield"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* avengers_shield(PlayerbotAI* ai) static ActionNode* avengers_shield(PlayerbotAI* ai)
{ {
return new ActionNode ("avenger's shield", return new ActionNode ("avenger's shield",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("judgement of wisdom"), NULL), /*A*/ NextAction::array(0, new NextAction("judgement of wisdom"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* divine_sacrifice(PlayerbotAI* ai)
{
return new ActionNode ("divine sacrifice",
/*P*/ nullptr,
/*A*/ nullptr,
/*C*/ NextAction::array(0, new NextAction("cancel divine sacrifice"), nullptr));
}
static ActionNode* judgement_of_wisdom(PlayerbotAI* ai) static ActionNode* judgement_of_wisdom(PlayerbotAI* ai)
{ {
return new ActionNode ("judgement of wisdom", return new ActionNode ("judgement of wisdom",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("judgement of light"), NULL), /*A*/ NextAction::array(0, new NextAction("judgement of light"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* judgement(PlayerbotAI* ai) static ActionNode* judgement(PlayerbotAI* ai)
@@ -196,21 +204,21 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{ {
return new ActionNode ("divine shield", return new ActionNode ("divine shield",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("divine protection"), NULL), /*A*/ NextAction::array(0, new NextAction("divine protection"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* flash_of_light(PlayerbotAI* ai) static ActionNode* flash_of_light(PlayerbotAI* ai)
{ {
return new ActionNode ("flash of light", return new ActionNode ("flash of light",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("holy light"), NULL), /*A*/ NextAction::array(0, new NextAction("holy light"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* flash_of_light_on_party(PlayerbotAI* ai) static ActionNode* flash_of_light_on_party(PlayerbotAI* ai)
{ {
return new ActionNode ("flash of light on party", return new ActionNode ("flash of light on party",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("holy light on party"), NULL), /*A*/ NextAction::array(0, new NextAction("holy light on party"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* holy_wrath(PlayerbotAI* ai) static ActionNode* holy_wrath(PlayerbotAI* ai)
@@ -231,7 +239,7 @@ class GenericPaladinStrategyActionNodeFactory : public NamedObjectFactory<Action
{ {
return new ActionNode ("seal of command", return new ActionNode ("seal of command",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("seal of righteousness"), NULL), /*A*/ NextAction::array(0, new NextAction("seal of righteousness"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
}; };

View File

@@ -34,42 +34,48 @@ void HealPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
// triggers.push_back(new TriggerNode("concentration aura", NextAction::array(0, new NextAction("concentration aura", ACTION_NORMAL), nullptr))); // triggers.push_back(new TriggerNode("concentration aura", NextAction::array(0, new NextAction("concentration aura", ACTION_NORMAL), nullptr)));
triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH), nullptr))); triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH), nullptr)));
triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("divine illumination", ACTION_HIGH + 2), nullptr)));
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("divine favor", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("divine favor", ACTION_HIGH + 1), nullptr)));
// triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", ACTION_HIGH + 9), nullptr))); // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", ACTION_HIGH + 9), nullptr)));
triggers.push_back(new TriggerNode("party member to heal out of spell range", NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr))); triggers.push_back(new TriggerNode("party member to heal out of spell range", NextAction::array(0, new NextAction("reach party member to heal", ACTION_EMERGENCY + 3), nullptr)));
triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member critical health", "party member critical health",
NextAction::array(0, NextAction::array(0,
new NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 5), new NextAction("holy shock on party", ACTION_CRITICAL_HEAL + 6),
new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5),
new NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4), new NextAction("holy light on party", ACTION_CRITICAL_HEAL + 4),
NULL))); nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member low health", "party member low health",
NextAction::array(0, NextAction::array(0,
new NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5), new NextAction("holy light on party", ACTION_MEDIUM_HEAL + 5),
NULL))); nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member medium health", "party member medium health",
NextAction::array(0, NextAction::array(0,
new NextAction("holy light on party", ACTION_LIGHT_HEAL + 9), new NextAction("holy light on party", ACTION_LIGHT_HEAL + 9),
new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8), new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 8),
NULL))); nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member almost full health", "party member almost full health",
NextAction::array(0, NextAction::array(0,
new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3), new NextAction("flash of light on party", ACTION_LIGHT_HEAL + 3),
NULL))); nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"beacon of light on main tank", "beacon of light on main tank",
NextAction::array(0, new NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7), NULL))); NextAction::array(0, new NextAction("beacon of light on main tank", ACTION_CRITICAL_HEAL + 7), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"sacred shield on main tank", "sacred shield on main tank",
NextAction::array(0, new NextAction("sacred shield on main tank", ACTION_CRITICAL_HEAL + 6), NULL))); NextAction::array(0, new NextAction("sacred shield on main tank", ACTION_CRITICAL_HEAL + 6), nullptr)));
} }

View File

@@ -155,3 +155,19 @@ bool CastMeleeConsecrationAction::isUseful()
// float dis = distance + CONTACT_DISTANCE; // float dis = distance + CONTACT_DISTANCE;
return target && bot->IsWithinCombatRange(target, sPlayerbotAIConfig->meleeDistance); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance); return target && bot->IsWithinCombatRange(target, sPlayerbotAIConfig->meleeDistance); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance);
} }
bool CastDivineSacrificeAction::isUseful()
{
return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura("divine guardian", GetTarget(), false, false, -1, true);
}
bool CastCancelDivineSacrificeAction::Execute(Event event)
{
botAI->RemoveAura("divine sacrifice");
return true;
}
bool CastCancelDivineSacrificeAction::isUseful()
{
return botAI->HasAura("divine sacrifice", GetTarget(), false, true, -1, true);
}

View File

@@ -170,13 +170,13 @@ class CastHolyLightAction : public CastHealingSpellAction
class CastHolyShockOnPartyAction : public HealPartyMemberAction class CastHolyShockOnPartyAction : public HealPartyMemberAction
{ {
public: public:
CastHolyShockOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy shock", 25.0f, HealingManaEfficiency::MEDIUM) { } CastHolyShockOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy shock", 25.0f, HealingManaEfficiency::LOW) { }
}; };
class CastHolyLightOnPartyAction : public HealPartyMemberAction class CastHolyLightOnPartyAction : public HealPartyMemberAction
{ {
public: public:
CastHolyLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy light", 50.0f, HealingManaEfficiency::HIGH) { } CastHolyLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "holy light", 50.0f, HealingManaEfficiency::MEDIUM) { }
}; };
class CastFlashOfLightAction : public CastHealingSpellAction class CastFlashOfLightAction : public CastHealingSpellAction
@@ -188,7 +188,7 @@ class CastFlashOfLightAction : public CastHealingSpellAction
class CastFlashOfLightOnPartyAction : public HealPartyMemberAction class CastFlashOfLightOnPartyAction : public HealPartyMemberAction
{ {
public: public:
CastFlashOfLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "flash of light", 15.0f, HealingManaEfficiency::LOW) { } CastFlashOfLightOnPartyAction(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, "flash of light", 15.0f, HealingManaEfficiency::HIGH) { }
}; };
class CastLayOnHandsAction : public CastHealingSpellAction class CastLayOnHandsAction : public CastHealingSpellAction
@@ -393,4 +393,25 @@ class CastAvengingWrathAction : public CastBuffSpellAction
public: public:
CastAvengingWrathAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "avenging wrath") {} CastAvengingWrathAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "avenging wrath") {}
}; };
class CastDivineIlluminationAction : public CastBuffSpellAction
{
public:
CastDivineIlluminationAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "divine illumination") {}
};
class CastDivineSacrificeAction : public CastBuffSpellAction
{
public:
CastDivineSacrificeAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "divine sacrifice") {}
bool isUseful() override;
};
class CastCancelDivineSacrificeAction : public Action
{
public:
CastCancelDivineSacrificeAction(PlayerbotAI* botAI) : Action(botAI, "cancel divine sacrifice") {}
bool Execute(Event event) override;
bool isUseful() override;
};
#endif #endif

View File

@@ -263,6 +263,9 @@ class PaladinAiObjectContextInternal : public NamedObjectContext<Action>
creators["beacon of light on main tank"] = &PaladinAiObjectContextInternal::beacon_of_light_on_main_tank; creators["beacon of light on main tank"] = &PaladinAiObjectContextInternal::beacon_of_light_on_main_tank;
creators["sacred shield on main tank"] = &PaladinAiObjectContextInternal::sacred_shield_on_main_tank; creators["sacred shield on main tank"] = &PaladinAiObjectContextInternal::sacred_shield_on_main_tank;
creators["avenging wrath"] = &PaladinAiObjectContextInternal::avenging_wrath; creators["avenging wrath"] = &PaladinAiObjectContextInternal::avenging_wrath;
creators["divine illumination"] = &PaladinAiObjectContextInternal::divine_illumination;
creators["divine sacrifice"] = &PaladinAiObjectContextInternal::divine_sacrifice;
creators["cancel divine sacrifice"] = &PaladinAiObjectContextInternal::cancel_divine_sacrifice;
} }
private: private:
@@ -341,6 +344,9 @@ class PaladinAiObjectContextInternal : public NamedObjectContext<Action>
static Action* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new CastBeaconOfLightOnMainTankAction(ai); } static Action* beacon_of_light_on_main_tank(PlayerbotAI* ai) { return new CastBeaconOfLightOnMainTankAction(ai); }
static Action* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new CastSacredShieldOnMainTankAction(ai); } static Action* sacred_shield_on_main_tank(PlayerbotAI* ai) { return new CastSacredShieldOnMainTankAction(ai); }
static Action* avenging_wrath(PlayerbotAI* ai) { return new CastAvengingWrathAction(ai); } static Action* avenging_wrath(PlayerbotAI* ai) { return new CastAvengingWrathAction(ai); }
static Action* divine_illumination(PlayerbotAI* ai) { return new CastDivineIlluminationAction(ai); }
static Action* divine_sacrifice(PlayerbotAI* ai) { return new CastDivineSacrificeAction(ai); }
static Action* cancel_divine_sacrifice(PlayerbotAI* ai) { return new CastCancelDivineSacrificeAction(ai); }
}; };
PaladinAiObjectContext::PaladinAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI) PaladinAiObjectContext::PaladinAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI)

View File

@@ -91,6 +91,9 @@ void TankPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"righteous fury", "righteous fury",
NextAction::array(0, new NextAction("righteous fury", ACTION_HIGH + 8), nullptr))); NextAction::array(0, new NextAction("righteous fury", ACTION_HIGH + 8), nullptr)));
triggers.push_back(new TriggerNode(
"medium group heal occasion",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_HIGH + 5), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"not facing target", "not facing target",
NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr))); NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr)));

View File

@@ -49,19 +49,19 @@ void HealShamanStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member critical health", "party member critical health",
NextAction::array(0, new NextAction("riptide on party", 24.0f), new NextAction("lesser healing wave on party", 23.0f), nullptr))); NextAction::array(0, new NextAction("riptide on party", 25.0f), new NextAction("healing wave on party", 24.0f), new NextAction("lesser healing wave on party", 23.0f), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member low health", "party member low health",
NextAction::array(0, new NextAction("riptide on party", 18.0f), new NextAction("lesser healing wave on party", 17.0f), nullptr))); NextAction::array(0, new NextAction("riptide on party", 19.0f), new NextAction("healing wave on party", 18.0f), new NextAction("lesser healing wave on party", 17.0f), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member medium health", "party member medium health",
NextAction::array(0, new NextAction("riptide on party", 15.0f), new NextAction("lesser healing wave on party", 14.0f), nullptr))); NextAction::array(0, new NextAction("riptide on party", 16.0f), new NextAction("healing wave on party", 15.0f), new NextAction("lesser healing wave on party", 14.0f), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member almost full health", "party member almost full health",
NextAction::array(0, new NextAction("riptide on party", 12.0f), nullptr))); NextAction::array(0, new NextAction("riptide on party", 12.0f), new NextAction("lesser healing wave on party", 11.0f), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"party member cleanse spirit poison", "party member cleanse spirit poison",