diff --git a/src/AiFactory.cpp b/src/AiFactory.cpp index c4d9e49a..9015dc80 100644 --- a/src/AiFactory.cpp +++ b/src/AiFactory.cpp @@ -4,6 +4,7 @@ #include "AiFactory.h" #include "BattlegroundMgr.h" +#include "Item.h" #include "PlayerbotAI.h" #include "Playerbots.h" #include "Engine.h" @@ -300,7 +301,7 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa else if (tab == 2) engine->addStrategies("heal", "bmana", "ranged", nullptr); else - engine->addStrategies("dps", "melee aoe", "bdps", "threat", "close", nullptr); + engine->addStrategies("melee", "melee aoe", "bdps", "threat", "close", nullptr); engine->addStrategies("dps assist", "cure", "totems", nullptr); break; @@ -344,7 +345,11 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa engine->addStrategy("dps debuff"); break; case CLASS_ROGUE: - engine->addStrategies("dps", "threat", "dps assist", "aoe", "close", "behind", "stealth", nullptr); + if (tab == ROGUE_TAB_ASSASSINATION) { + engine->addStrategies("melee", "threat", "dps assist", "aoe", "close", "behind", nullptr); + } else { + engine->addStrategies("dps", "threat", "dps assist", "aoe", "close", "behind", nullptr); + } break; case CLASS_WARLOCK: engine->addStrategies("dps assist", "dps", "dps debuff", "aoe", "ranged", "threat", nullptr); diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index d16e4614..d448352d 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -2264,6 +2264,8 @@ void PlayerbotFactory::InitMounts() fslow = { 32244, 32245, 32243 }; ffast = { 32295, 32297, 32246, 32296 }; break; + default: + break; } mounts[bot->getRace()][0] = slow; diff --git a/src/strategy/ItemVisitors.cpp b/src/strategy/ItemVisitors.cpp index a989bdac..ce9d0266 100644 --- a/src/strategy/ItemVisitors.cpp +++ b/src/strategy/ItemVisitors.cpp @@ -88,5 +88,5 @@ bool FindItemUsageVisitor::Accept(ItemTemplate const* proto) bool FindUsableNamedItemVisitor::Accept(ItemTemplate const* proto) { - return true; + return proto && !proto->Name1.empty() && strstri(proto->Name1.c_str(), name.c_str()); } \ No newline at end of file diff --git a/src/strategy/ItemVisitors.h b/src/strategy/ItemVisitors.h index 9026d19c..d4e0244c 100644 --- a/src/strategy/ItemVisitors.h +++ b/src/strategy/ItemVisitors.h @@ -414,9 +414,10 @@ class FindItemUsageVisitor : public FindUsableItemVisitor class FindUsableNamedItemVisitor : public FindUsableItemVisitor { public: - FindUsableNamedItemVisitor(Player* bot): FindUsableItemVisitor(bot) {} + FindUsableNamedItemVisitor(Player* bot, std::string name): FindUsableItemVisitor(bot), name(name) {} bool Accept(ItemTemplate const* proto) override; - + private: + std::string name; }; #endif diff --git a/src/strategy/actions/InventoryAction.cpp b/src/strategy/actions/InventoryAction.cpp index 416d9d52..75a3af74 100644 --- a/src/strategy/actions/InventoryAction.cpp +++ b/src/strategy/actions/InventoryAction.cpp @@ -288,12 +288,10 @@ std::vector InventoryAction::parseItems(std::string const text, IterateIt IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS); found.insert(visitor.GetResult().begin(), visitor.GetResult().end()); } - if (text == "") - { - FindUsableNamedItemVisitor visitor(bot); - IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS); - found.insert(visitor.GetResult().begin(), visitor.GetResult().end()); - } + + FindUsableNamedItemVisitor visitor(bot, text); + IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS); + found.insert(visitor.GetResult().begin(), visitor.GetResult().end()); uint32 quality = chat->parseItemQuality(text); if (quality != MAX_ITEM_QUALITY) diff --git a/src/strategy/actions/UseItemAction.cpp b/src/strategy/actions/UseItemAction.cpp index f7925c2b..731395df 100644 --- a/src/strategy/actions/UseItemAction.cpp +++ b/src/strategy/actions/UseItemAction.cpp @@ -19,7 +19,9 @@ bool UseItemAction::Execute(Event event) if (gos.empty()) { - return UseItemAuto(*items.begin()); + if (!items.empty()) { + return UseItemAuto(*items.begin()); + } } else { diff --git a/src/strategy/druid/CasterDruidStrategy.cpp b/src/strategy/druid/CasterDruidStrategy.cpp index b65e40d1..09f0256f 100644 --- a/src/strategy/druid/CasterDruidStrategy.cpp +++ b/src/strategy/druid/CasterDruidStrategy.cpp @@ -122,6 +122,9 @@ void CasterDruidStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("moonfire", NextAction::array(0, new NextAction("moonfire", ACTION_NORMAL + 4), nullptr))); triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("innervate", ACTION_HIGH + 5), NULL))); triggers.push_back(new TriggerNode("enemy too close for spell", NextAction::array(0, new NextAction("flee", 49.0f), NULL))); + triggers.push_back(new TriggerNode( + "party member remove curse", + NextAction::array(0, new NextAction("remove curse on party", ACTION_DISPEL + 7), NULL))); } void CasterDruidAoeStrategy::InitTriggers(std::vector& triggers) diff --git a/src/strategy/druid/DruidActions.h b/src/strategy/druid/DruidActions.h index 3aceea96..2b580e05 100644 --- a/src/strategy/druid/DruidActions.h +++ b/src/strategy/druid/DruidActions.h @@ -253,4 +253,10 @@ class CastPartyNourishAction : public HealPartyMemberAction public: CastPartyNourishAction(PlayerbotAI* ai) : HealPartyMemberAction(ai, "nourish") {} }; + +class CastDruidRemoveCurseOnPartyAction : public CurePartyMemberAction +{ + public: + CastDruidRemoveCurseOnPartyAction(PlayerbotAI* ai) : CurePartyMemberAction(ai, "remove curse", DISPEL_CURSE) {} +}; #endif diff --git a/src/strategy/druid/DruidAiObjectContext.cpp b/src/strategy/druid/DruidAiObjectContext.cpp index c53973e4..3377d394 100644 --- a/src/strategy/druid/DruidAiObjectContext.cpp +++ b/src/strategy/druid/DruidAiObjectContext.cpp @@ -95,6 +95,7 @@ class DruidTriggerFactoryInternal : public NamedObjectContext creators["eclipse (lunar)"] = &DruidTriggerFactoryInternal::eclipse_lunar; creators["bash on enemy healer"] = &DruidTriggerFactoryInternal::bash_on_enemy_healer; creators["nature's swiftness"] = &DruidTriggerFactoryInternal::natures_swiftness; + creators["party member remove curse"] = &DruidTriggerFactoryInternal::party_member_remove_curse; } private: @@ -123,6 +124,7 @@ class DruidTriggerFactoryInternal : public NamedObjectContext static Trigger* tree_form(PlayerbotAI* botAI) { return new TreeFormTrigger(botAI); } static Trigger* bash_on_enemy_healer(PlayerbotAI* botAI) { return new BashInterruptEnemyHealerSpellTrigger(botAI); } static Trigger* omen_of_clarity(PlayerbotAI* botAI) { return new OmenOfClarityTrigger(botAI); } + static Trigger* party_member_remove_curse(PlayerbotAI* ai) { return new DruidPartyMemberRemoveCurseTrigger(ai); } }; class DruidAiObjectContextInternal : public NamedObjectContext @@ -202,6 +204,7 @@ class DruidAiObjectContextInternal : public NamedObjectContext creators["wild growth on party"] = &DruidAiObjectContextInternal::wild_growth_on_party; creators["swiftmend on party"] = &DruidAiObjectContextInternal::swiftmend_on_party; creators["nourish on party"] = &DruidAiObjectContextInternal::nourish_on_party; + creators["remove curse on party"] = &DruidAiObjectContextInternal::remove_curse_on_party; } private: @@ -276,6 +279,7 @@ class DruidAiObjectContextInternal : public NamedObjectContext static Action* wild_growth_on_party(PlayerbotAI* ai) { return new CastWildGrowthOnPartyAction(ai); } static Action* swiftmend_on_party(PlayerbotAI *ai) { return new CastPartySwiftmendAction(ai); } static Action* nourish_on_party(PlayerbotAI *ai) { return new CastPartyNourishAction(ai); } + static Action* remove_curse_on_party(PlayerbotAI *ai) { return new CastDruidRemoveCurseOnPartyAction(ai); } }; DruidAiObjectContext::DruidAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI) diff --git a/src/strategy/druid/DruidTriggers.h b/src/strategy/druid/DruidTriggers.h index 4d47db58..a45be4cf 100644 --- a/src/strategy/druid/DruidTriggers.h +++ b/src/strategy/druid/DruidTriggers.h @@ -178,4 +178,9 @@ class NaturesSwiftnessTrigger : public BuffTrigger NaturesSwiftnessTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "nature's swiftness") { } }; +class DruidPartyMemberRemoveCurseTrigger : public PartyMemberNeedCureTrigger +{ + public: + DruidPartyMemberRemoveCurseTrigger(PlayerbotAI* ai) : PartyMemberNeedCureTrigger(ai, "druid remove curse", DISPEL_CURSE) {} +}; #endif diff --git a/src/strategy/druid/HealDruidStrategy.cpp b/src/strategy/druid/HealDruidStrategy.cpp index 4ea3b6ba..65e95a6b 100644 --- a/src/strategy/druid/HealDruidStrategy.cpp +++ b/src/strategy/druid/HealDruidStrategy.cpp @@ -23,7 +23,9 @@ void HealDruidStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("tree form", NextAction::array(0, new NextAction("tree form", ACTION_HIGH + 1), 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_CRITICAL_HEAL + 9), nullptr))); - + triggers.push_back(new TriggerNode( + "party member remove curse", + NextAction::array(0, new NextAction("remove curse on party", ACTION_DISPEL + 7), NULL))); // CRITICAL triggers.push_back(new TriggerNode( "party member critical health", diff --git a/src/strategy/rogue/AssassinationRogueStrategy.cpp b/src/strategy/rogue/AssassinationRogueStrategy.cpp new file mode 100644 index 00000000..990264d7 --- /dev/null +++ b/src/strategy/rogue/AssassinationRogueStrategy.cpp @@ -0,0 +1,93 @@ + +#include "AssassinationRogueStrategy.h" +#include "Playerbots.h" + +class AssassinationRogueStrategyActionNodeFactory : public NamedObjectFactory +{ +public: + AssassinationRogueStrategyActionNodeFactory() + { + creators["mutilate"] = &mutilate; + creators["envenom"] = &envenom; + } +private: + static ActionNode* mutilate(PlayerbotAI* ai) + { + return new ActionNode ("mutilate", + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("sinister strike"), NULL), + /*C*/ NULL); + } + static ActionNode* envenom(PlayerbotAI* ai) + { + return new ActionNode ("envenom", + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("eviscerate"), NULL), + /*C*/ NULL); + } +}; + +AssassinationRogueStrategy::AssassinationRogueStrategy(PlayerbotAI* ai) : MeleeCombatStrategy(ai) +{ + actionNodeFactories.Add(new AssassinationRogueStrategyActionNodeFactory()); +} + +NextAction** AssassinationRogueStrategy::getDefaultActions() +{ + return NextAction::array(0, + new NextAction("melee", ACTION_NORMAL), + NULL); +} + +void AssassinationRogueStrategy::InitTriggers(std::vector &triggers) +{ + MeleeCombatStrategy::InitTriggers(triggers); + + triggers.push_back(new TriggerNode( + "high energy available", + NextAction::array(0, new NextAction("mutilate", ACTION_NORMAL + 3), NULL))); + + triggers.push_back(new TriggerNode( + "slice and dice", + NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 5), NULL))); + + triggers.push_back(new TriggerNode( + "combo points 3 available", + NextAction::array(0, new NextAction("envenom", ACTION_HIGH + 4), NULL))); + + triggers.push_back(new TriggerNode( + "expose armor", + NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), NULL))); + + triggers.push_back(new TriggerNode( + "medium threat", + NextAction::array(0, new NextAction("vanish", ACTION_HIGH), NULL))); + + triggers.push_back(new TriggerNode( + "low health", + NextAction::array(0, new NextAction("evasion", ACTION_EMERGENCY), new NextAction("feint", ACTION_EMERGENCY), NULL))); + + triggers.push_back(new TriggerNode( + "kick", + NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), NULL))); + + triggers.push_back(new TriggerNode( + "kick on enemy healer", + NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), NULL))); + + triggers.push_back(new TriggerNode( + "medium aoe", + NextAction::array(0, new NextAction("fan of knives", ACTION_NORMAL + 5), NULL))); + + triggers.push_back(new TriggerNode( + "tricks of the trade on main tank", + NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), NULL))); + + triggers.push_back(new TriggerNode( + "enemy out of melee", + NextAction::array(0, + new NextAction("stealth", ACTION_NORMAL + 9), + new NextAction("sprint", ACTION_NORMAL + 8), + new NextAction("reach melee", ACTION_NORMAL + 7), + NULL))); +} diff --git a/src/strategy/rogue/AssassinationRogueStrategy.h b/src/strategy/rogue/AssassinationRogueStrategy.h new file mode 100644 index 00000000..39f3a671 --- /dev/null +++ b/src/strategy/rogue/AssassinationRogueStrategy.h @@ -0,0 +1,19 @@ + +#ifndef _PLAYERBOT_ASSASSINATIONROGUESTRATEGY_H +#define _PLAYERBOT_ASSASSINATIONROGUESTRATEGY_H + +#include "MeleeCombatStrategy.h" + +class AssassinationRogueStrategy : public MeleeCombatStrategy +{ +public: + AssassinationRogueStrategy(PlayerbotAI* ai); + +public: + virtual void InitTriggers(std::vector &triggers) override; + virtual std::string const getName() override { return "melee"; } + virtual NextAction** getDefaultActions() override; + virtual int GetType() { return MeleeCombatStrategy::GetType() | STRATEGY_TYPE_DPS; } +}; + +#endif \ No newline at end of file diff --git a/src/strategy/rogue/DpsRogueStrategy.cpp b/src/strategy/rogue/DpsRogueStrategy.cpp index d5d2c2b5..bbf49c4f 100644 --- a/src/strategy/rogue/DpsRogueStrategy.cpp +++ b/src/strategy/rogue/DpsRogueStrategy.cpp @@ -10,101 +10,116 @@ class DpsRogueStrategyActionNodeFactory : public NamedObjectFactory public: DpsRogueStrategyActionNodeFactory() { - creators["riposte"] = &riposte; creators["mutilate"] = &mutilate; creators["sinister strike"] = &sinister_strike; creators["kick"] = &kick; creators["kidney shot"] = &kidney_shot; - creators["slice and dice"] = &slice_and_dice; - creators["rupture"] = &rupture; creators["backstab"] = &backstab; + creators["melee"] = &melee; } private: - static ActionNode* riposte([[maybe_unused]] PlayerbotAI* botAI) + static ActionNode* melee(PlayerbotAI* botAI) { - return new ActionNode ("riposte", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("mutilate"), nullptr), - /*C*/ nullptr); + return new ActionNode ("melee", + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("mutilate"), NULL), + /*C*/ NULL); } - - static ActionNode* mutilate([[maybe_unused]] PlayerbotAI* botAI) + static ActionNode* mutilate(PlayerbotAI* botAI) { return new ActionNode ("mutilate", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("sinister strike"), nullptr), - /*C*/ nullptr); + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("sinister strike"), NULL), + /*C*/ NULL); } - - static ActionNode* sinister_strike([[maybe_unused]] PlayerbotAI* botAI) + static ActionNode* sinister_strike(PlayerbotAI* botAI) { return new ActionNode ("sinister strike", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("melee"), nullptr), - /*C*/ nullptr); + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("melee"), NULL), + /*C*/ NULL); } - - static ActionNode* kick([[maybe_unused]] PlayerbotAI* botAI) + static ActionNode* kick(PlayerbotAI* botAI) { return new ActionNode ("kick", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("kidney shot"), nullptr), - /*C*/ nullptr); + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("kidney shot"), NULL), + /*C*/ NULL); } - - static ActionNode* kidney_shot([[maybe_unused]] PlayerbotAI* botAI) + static ActionNode* kidney_shot(PlayerbotAI* botAI) { return new ActionNode ("kidney shot", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ NULL, + /*A*/ NULL, + /*C*/ NULL); } - - static ActionNode* rupture([[maybe_unused]] PlayerbotAI* botAI) - { - return new ActionNode ("rupture", - /*P*/ nullptr, - /*A*/ NextAction::array(0, new NextAction("eviscerate"), nullptr), - /*C*/ nullptr); - } - - ACTION_NODE_A(slice_and_dice, "slice and dice", "rupture"); - static ActionNode* backstab([[maybe_unused]] PlayerbotAI* botAI) + static ActionNode* backstab(PlayerbotAI* botAI) { return new ActionNode ("backstab", - /*P*/ nullptr, - /*A*/ nullptr, - /*C*/ nullptr); + /*P*/ NULL, + /*A*/ NextAction::array(0, new NextAction("mutilate"), NULL), + /*C*/ NULL); } }; -DpsRogueStrategy::DpsRogueStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI) +DpsRogueStrategy::DpsRogueStrategy(PlayerbotAI* botAI) : MeleeCombatStrategy(botAI) { actionNodeFactories.Add(new DpsRogueStrategyActionNodeFactory()); } NextAction** DpsRogueStrategy::getDefaultActions() { - return NextAction::array(0, new NextAction("riposte", ACTION_NORMAL), nullptr); + return NextAction::array(0, new NextAction("melee", ACTION_NORMAL), NULL); } void DpsRogueStrategy::InitTriggers(std::vector& triggers) { - CombatStrategy::InitTriggers(triggers); + MeleeCombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("combo points available", NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 2), nullptr))); - triggers.push_back(new TriggerNode("medium threat", NextAction::array(0, new NextAction("feint", ACTION_HIGH), nullptr))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("evasion", ACTION_EMERGENCY), new NextAction("feint", ACTION_EMERGENCY), nullptr))); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("blind", ACTION_EMERGENCY), new NextAction("vanish", ACTION_EMERGENCY), nullptr))); - triggers.push_back(new TriggerNode("kick", NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), nullptr))); - triggers.push_back(new TriggerNode("kick on enemy healer", NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), nullptr))); - triggers.push_back(new TriggerNode("behind target", NextAction::array(0, new NextAction("backstab", ACTION_HIGH + 1), nullptr))); - triggers.push_back(new TriggerNode("player has flag", NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 2), nullptr))); - triggers.push_back(new TriggerNode("enemy flagcarrier near", NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 1), nullptr))); - triggers.push_back(new TriggerNode("in stealth", NextAction::array(0, new NextAction("check stealth", ACTION_EMERGENCY), nullptr))); - triggers.push_back(new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", ACTION_NORMAL), nullptr))); - triggers.push_back(new TriggerNode("sprint", NextAction::array(0, new NextAction("sprint", ACTION_INTERRUPT), nullptr))); + triggers.push_back(new TriggerNode( + "high energy available", + NextAction::array(0, new NextAction("sinister strike", ACTION_NORMAL + 3), NULL))); + + triggers.push_back(new TriggerNode( + "slice and dice", + NextAction::array(0, new NextAction("slice and dice", ACTION_HIGH + 2), NULL))); + + triggers.push_back(new TriggerNode( + "combo points available", + NextAction::array(0, new NextAction("rupture", ACTION_HIGH + 1), NULL))); + + triggers.push_back(new TriggerNode( + "medium threat", + NextAction::array(0, new NextAction("vanish", ACTION_HIGH), NULL))); + + triggers.push_back(new TriggerNode( + "low health", + NextAction::array(0, new NextAction("evasion", ACTION_EMERGENCY), new NextAction("feint", ACTION_EMERGENCY), NULL))); + + triggers.push_back(new TriggerNode( + "kick", + NextAction::array(0, new NextAction("kick", ACTION_INTERRUPT + 2), NULL))); + + triggers.push_back(new TriggerNode( + "kick on enemy healer", + NextAction::array(0, new NextAction("kick on enemy healer", ACTION_INTERRUPT + 1), NULL))); + + triggers.push_back(new TriggerNode( + "behind target", + NextAction::array(0, new NextAction("backstab", ACTION_NORMAL), NULL))); + + triggers.push_back(new TriggerNode( + "light aoe", + NextAction::array(0, new NextAction("blade flurry", ACTION_HIGH + 3), NULL))); + + triggers.push_back(new TriggerNode( + "enemy out of melee", + NextAction::array(0, new NextAction("stealth", ACTION_NORMAL + 9), new NextAction("reach melee", ACTION_NORMAL + 8), NULL))); + + triggers.push_back(new TriggerNode( + "expose armor", + NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), NULL))); } class StealthedRogueStrategyActionNodeFactory : public NamedObjectFactory diff --git a/src/strategy/rogue/DpsRogueStrategy.h b/src/strategy/rogue/DpsRogueStrategy.h index 63da3bbf..3d9ec50a 100644 --- a/src/strategy/rogue/DpsRogueStrategy.h +++ b/src/strategy/rogue/DpsRogueStrategy.h @@ -6,10 +6,11 @@ #define _PLAYERBOT_DPSROGUESTRATEGY_H #include "CombatStrategy.h" +#include "MeleeCombatStrategy.h" class PlayerbotAI; -class DpsRogueStrategy : public CombatStrategy +class DpsRogueStrategy : public MeleeCombatStrategy { public: DpsRogueStrategy(PlayerbotAI* botAI); @@ -17,6 +18,7 @@ class DpsRogueStrategy : public CombatStrategy void InitTriggers(std::vector& triggers) override; std::string const getName() override { return "dps"; } NextAction** getDefaultActions() override; + virtual int GetType() { return MeleeCombatStrategy::GetType() | STRATEGY_TYPE_DPS; } }; class StealthedRogueStrategy : public Strategy diff --git a/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp b/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp index a2691378..801e3d77 100644 --- a/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp +++ b/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp @@ -11,6 +11,22 @@ void GenericRogueNonCombatStrategy::InitTriggers(std::vector& trig triggers.push_back(new TriggerNode("player has flag", NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 1), nullptr))); triggers.push_back(new TriggerNode("enemy flagcarrier near", NextAction::array(0, new NextAction("sprint", ACTION_EMERGENCY + 2), nullptr))); - triggers.push_back(new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", 1.0f), nullptr))); - triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply poison", 1.0f), nullptr))); + // triggers.push_back(new TriggerNode("unstealth", NextAction::array(0, new NextAction("unstealth", 1.0f), nullptr))); + // triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("apply poison", 1.0f), nullptr))); + + triggers.push_back(new TriggerNode( + "main hand weapon no enchant", + NextAction::array(0, new NextAction("use instant poison", 20.0f), NULL))); + + triggers.push_back(new TriggerNode( + "off hand weapon no enchant", + NextAction::array(0, new NextAction("use deadly poison", 19.0f), NULL))); + + triggers.push_back(new TriggerNode( + "off hand weapon no enchant", + NextAction::array(0, new NextAction("use instant poison", 18.0f), NULL))); + + triggers.push_back(new TriggerNode( + "often", + NextAction::array(0, new NextAction("unstealth", 10.0f), NULL))); } diff --git a/src/strategy/rogue/RogueActions.cpp b/src/strategy/rogue/RogueActions.cpp index 65f42c5a..9858684e 100644 --- a/src/strategy/rogue/RogueActions.cpp +++ b/src/strategy/rogue/RogueActions.cpp @@ -16,7 +16,7 @@ bool CastStealthAction::Execute(Event event) { if (botAI->CastSpell("stealth", bot)) { - botAI->ChangeStrategy("-dps,+stealthed", BOT_STATE_COMBAT); + // botAI->ChangeStrategy("-dps,+stealthed", BOT_STATE_COMBAT); } return true; @@ -25,7 +25,7 @@ bool CastStealthAction::Execute(Event event) bool UnstealthAction::Execute(Event event) { botAI->RemoveAura("stealth"); - botAI->ChangeStrategy("+dps,-stealthed", BOT_STATE_COMBAT); + // botAI->ChangeStrategy("+dps,-stealthed", BOT_STATE_COMBAT); return true; } @@ -49,3 +49,69 @@ bool CastVanishAction::isUseful() // do not use with WSG flag or EYE flag return !botAI->HasAura(23333, bot) && !botAI->HasAura(23335, bot) && !botAI->HasAura(34976, bot); } + +bool CastTricksOfTheTradeOnMainTankAction::isUseful() { + return CastSpellAction::isUseful() && AI_VALUE2(float, "distance", GetTargetName()) < 20.0f; +} + +bool UseDeadlyPoisonAction::Execute(Event event) { + std::vector poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""}; + std::vector items; + std::string poison_name; + for (std::string& suffix: poison_suffixs) { + poison_name = getName() + suffix; + items = AI_VALUE2(std::vector, "inventory items", poison_name); + if (!items.empty()) { + break; + } + } + if (items.empty()) { + return false; + } + return UseItemAuto(*items.begin()); +} + +bool UseDeadlyPoisonAction::isPossible() { + std::vector poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""}; + std::vector items; + std::string poison_name; + for (std::string& suffix: poison_suffixs) { + poison_name = getName() + suffix; + items = AI_VALUE2(std::vector, "inventory items", poison_name); + if (!items.empty()) { + break; + } + } + return !items.empty(); +} + +bool UseInstantPoisonAction::Execute(Event event) { + std::vector poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""}; + std::vector items; + std::string poison_name; + for (std::string& suffix: poison_suffixs) { + poison_name = getName() + suffix; + items = AI_VALUE2(std::vector, "inventory items", poison_name); + if (!items.empty()) { + break; + } + } + if (items.empty()) { + return false; + } + return UseItemAuto(*items.begin()); +} + +bool UseInstantPoisonAction::isPossible() { + std::vector poison_suffixs = {" IX", " VIII", " VII", " VI", " V", " IV", " III", " II", ""}; + std::vector items; + std::string poison_name; + for (std::string& suffix: poison_suffixs) { + poison_name = getName() + suffix; + items = AI_VALUE2(std::vector, "inventory items", poison_name); + if (!items.empty()) { + break; + } + } + return !items.empty(); +} \ No newline at end of file diff --git a/src/strategy/rogue/RogueActions.h b/src/strategy/rogue/RogueActions.h index 3bab46f1..b0676132 100644 --- a/src/strategy/rogue/RogueActions.h +++ b/src/strategy/rogue/RogueActions.h @@ -6,6 +6,7 @@ #define _PLAYERBOT_ROGUEACTIONS_H #include "GenericSpellActions.h" +#include "UseItemAction.h" class PlayerbotAI; @@ -113,4 +114,32 @@ class CastKickOnEnemyHealerAction : public CastSpellOnEnemyHealerAction CastKickOnEnemyHealerAction(PlayerbotAI* botAI) : CastSpellOnEnemyHealerAction(botAI, "kick") { } }; +class EnvenomAction : public CastMeleeSpellAction +{ + public: + EnvenomAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "envenom") {} +}; + +class CastTricksOfTheTradeOnMainTankAction : public BuffOnMainTankAction +{ + public: + CastTricksOfTheTradeOnMainTankAction(PlayerbotAI* ai) : BuffOnMainTankAction(ai, "tricks of the trade", true) {} + virtual bool isUseful() override; +}; + +class UseDeadlyPoisonAction : public UseItemAction +{ + public: + UseDeadlyPoisonAction(PlayerbotAI* ai) : UseItemAction(ai, "Deadly Poison") {} + virtual bool Execute(Event event) override; + virtual bool isPossible() override; +}; + +class UseInstantPoisonAction : public UseItemAction +{ + public: + UseInstantPoisonAction(PlayerbotAI* ai) : UseItemAction(ai, "Instant Poison") {} + virtual bool Execute(Event event) override; + virtual bool isPossible() override; +}; #endif diff --git a/src/strategy/rogue/RogueAiObjectContext.cpp b/src/strategy/rogue/RogueAiObjectContext.cpp index cd52c857..48ca9dcf 100644 --- a/src/strategy/rogue/RogueAiObjectContext.cpp +++ b/src/strategy/rogue/RogueAiObjectContext.cpp @@ -13,6 +13,7 @@ #include "NamedObjectContext.h" #include "PullStrategy.h" #include "Playerbots.h" +#include "AssassinationRogueStrategy.h" class RogueStrategyFactoryInternal : public NamedObjectContext { @@ -27,6 +28,7 @@ class RogueStrategyFactoryInternal : public NamedObjectContext creators["stealthed"] = &RogueStrategyFactoryInternal::stealthed; creators["stealth"] = &RogueStrategyFactoryInternal::stealth; creators["cc"] = &RogueStrategyFactoryInternal::cc; + creators["melee"] = &RogueStrategyFactoryInternal::melee; } private: @@ -38,6 +40,7 @@ class RogueStrategyFactoryInternal : public NamedObjectContext static Strategy* stealthed(PlayerbotAI* botAI) { return new StealthedRogueStrategy(botAI); } static Strategy* stealth(PlayerbotAI* botAI) { return new StealthStrategy(botAI); } static Strategy* cc(PlayerbotAI* botAI) { return new RogueCcStrategy(botAI); } + static Strategy* melee(PlayerbotAI* botAI) { return new AssassinationRogueStrategy(botAI); } }; class RogueTriggerFactoryInternal : public NamedObjectContext @@ -56,6 +59,9 @@ class RogueTriggerFactoryInternal : public NamedObjectContext creators["no stealth"] = &RogueTriggerFactoryInternal::no_stealth; creators["stealth"] = &RogueTriggerFactoryInternal::stealth; creators["sprint"] = &RogueTriggerFactoryInternal::sprint; + creators["main hand weapon no enchant"] = &RogueTriggerFactoryInternal::main_hand_weapon_no_enchant; + creators["off hand weapon no enchant"] = &RogueTriggerFactoryInternal::off_hand_weapon_no_enchant; + creators["tricks of the trade on main tank"] = &RogueTriggerFactoryInternal::tricks_of_the_trade_on_main_tank; } private: @@ -71,6 +77,9 @@ class RogueTriggerFactoryInternal : public NamedObjectContext static Trigger* no_stealth(PlayerbotAI* botAI) { return new NoStealthTrigger(botAI); } static Trigger* stealth(PlayerbotAI* botAI) { return new StealthTrigger(botAI); } static Trigger* sprint(PlayerbotAI* botAI) { return new SprintTrigger(botAI); } + static Trigger* main_hand_weapon_no_enchant(PlayerbotAI* ai) { return new MainHandWeaponNoEnchantTrigger(ai); } + static Trigger* off_hand_weapon_no_enchant(PlayerbotAI* ai) { return new OffHandWeaponNoEnchantTrigger(ai); } + static Trigger* tricks_of_the_trade_on_main_tank(PlayerbotAI* ai) { return new TricksOfTheTradeOnMainTankTrigger(ai); } }; class RogueAiObjectContextInternal : public NamedObjectContext @@ -104,6 +113,10 @@ class RogueAiObjectContextInternal : public NamedObjectContext creators["unstealth"] = &RogueAiObjectContextInternal::unstealth; creators["sap"] = &RogueAiObjectContextInternal::sap; creators["check stealth"] = &RogueAiObjectContextInternal::check_stealth; + creators["envenom"] = &RogueAiObjectContextInternal::envenom; + creators["tricks of the trade on main tank"] = &RogueAiObjectContextInternal::tricks_of_the_trade_on_main_tank; + creators["use instant poison"] = &RogueAiObjectContextInternal::use_instant_poison; + creators["use deadly poison"] = &RogueAiObjectContextInternal::use_deadly_poison; } private: @@ -133,6 +146,10 @@ class RogueAiObjectContextInternal : public NamedObjectContext static Action* check_stealth(PlayerbotAI* botAI) { return new CheckStealthAction(botAI); } static Action* sap(PlayerbotAI* botAI) { return new CastSapAction(botAI); } static Action* unstealth(PlayerbotAI* botAI) { return new UnstealthAction(botAI); } + static Action* envenom(PlayerbotAI* ai) { return new EnvenomAction(ai); } + static Action* tricks_of_the_trade_on_main_tank(PlayerbotAI* ai) { return new CastTricksOfTheTradeOnMainTankAction(ai); } + static Action* use_instant_poison(PlayerbotAI* ai) { return new UseInstantPoisonAction(ai); } + static Action* use_deadly_poison(PlayerbotAI* ai) { return new UseDeadlyPoisonAction(ai); } }; RogueAiObjectContext::RogueAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI) diff --git a/src/strategy/rogue/RogueTriggers.cpp b/src/strategy/rogue/RogueTriggers.cpp index 03eeb036..c31b903d 100644 --- a/src/strategy/rogue/RogueTriggers.cpp +++ b/src/strategy/rogue/RogueTriggers.cpp @@ -92,3 +92,21 @@ bool SprintTrigger::IsActive() targeted && (sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), distance) || sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), distance)); } + +bool ExposeArmorTrigger::IsActive() { + return DebuffTrigger::IsActive() && !botAI->HasAura("sunder armor", bot, false, false, -1, true) && AI_VALUE2(uint8, "combo", "current target") <= 3; +} + +bool MainHandWeaponNoEnchantTrigger::IsActive() { + Item* const itemForSpell = bot->GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND ); + if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) + return false; + return true; +} + +bool OffHandWeaponNoEnchantTrigger::IsActive() { + Item* const itemForSpell = bot->GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND ); + if (!itemForSpell || itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) + return false; + return true; +} \ No newline at end of file diff --git a/src/strategy/rogue/RogueTriggers.h b/src/strategy/rogue/RogueTriggers.h index 76115d08..8e94c23f 100644 --- a/src/strategy/rogue/RogueTriggers.h +++ b/src/strategy/rogue/RogueTriggers.h @@ -39,6 +39,7 @@ class ExposeArmorTrigger : public DebuffTrigger { public: ExposeArmorTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "expose armor") { } + virtual bool IsActive() override; }; class KickInterruptEnemyHealerSpellTrigger : public InterruptEnemyHealerTrigger @@ -92,4 +93,24 @@ class SprintTrigger : public BuffTrigger bool IsActive() override; }; +class MainHandWeaponNoEnchantTrigger : public BuffTrigger +{ + public: + MainHandWeaponNoEnchantTrigger(PlayerbotAI* ai) : BuffTrigger(ai, "main hand", 1) {} + virtual bool IsActive(); +}; + +class OffHandWeaponNoEnchantTrigger : public BuffTrigger +{ + public: + OffHandWeaponNoEnchantTrigger(PlayerbotAI* ai) : BuffTrigger(ai, "off hand", 1) {} + virtual bool IsActive(); +}; + +class TricksOfTheTradeOnMainTankTrigger : public BuffOnMainTankTrigger +{ + public: + TricksOfTheTradeOnMainTankTrigger(PlayerbotAI* ai) : BuffOnMainTankTrigger(ai, "tricks of the trade", true) {} +}; + #endif diff --git a/src/strategy/shaman/CasterShamanStrategy.cpp b/src/strategy/shaman/CasterShamanStrategy.cpp index c5b56300..1c1fc431 100644 --- a/src/strategy/shaman/CasterShamanStrategy.cpp +++ b/src/strategy/shaman/CasterShamanStrategy.cpp @@ -11,6 +11,7 @@ class CasterShamanStrategyActionNodeFactory : public NamedObjectFactory& triggers) @@ -39,10 +50,16 @@ void CasterShamanStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("shaman weapon", NextAction::array(0, new NextAction("flametongue weapon", 23.0f), nullptr))); - triggers.push_back(new TriggerNode("searing totem", NextAction::array(0, new NextAction("searing totem", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("shock", NextAction::array(0, new NextAction("earth shock", 20.0f), nullptr))); - triggers.push_back(new TriggerNode("frost shock snare", NextAction::array(0, new NextAction("frost shock", 21.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("flametongue totem", ACTION_LIGHT_HEAL), nullptr))); + // triggers.push_back(new TriggerNode("searing totem", NextAction::array(0, new NextAction("searing totem", 19.0f), nullptr))); + triggers.push_back(new TriggerNode("flame shock", NextAction::array(0, new NextAction("flame shock", 20.0f), nullptr))); + // triggers.push_back(new TriggerNode("frost shock snare", NextAction::array(0, new NextAction("frost shock", 21.0f), nullptr))); + triggers.push_back(new TriggerNode( + "no fire totem", + NextAction::array(0, new NextAction("totem of wrath", 15.0f), NULL))); + + triggers.push_back(new TriggerNode( + "enemy too close for spell", + NextAction::array(0, new NextAction("flee", 49.0f), NULL))); } void CasterAoeShamanStrategy::InitTriggers(std::vector& triggers) diff --git a/src/strategy/shaman/GenericShamanStrategy.cpp b/src/strategy/shaman/GenericShamanStrategy.cpp index ae0c2e64..582c164e 100644 --- a/src/strategy/shaman/GenericShamanStrategy.cpp +++ b/src/strategy/shaman/GenericShamanStrategy.cpp @@ -99,7 +99,8 @@ class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory& triggers) triggers.push_back(new TriggerNode("wind shear", NextAction::array(0, new NextAction("wind shear", 23.0f), nullptr))); triggers.push_back(new TriggerNode("wind shear on enemy healer", NextAction::array(0, new NextAction("wind shear on enemy healer", 23.0f), nullptr))); triggers.push_back(new TriggerNode("purge", NextAction::array(0, new NextAction("purge", 10.0f), nullptr))); - triggers.push_back(new TriggerNode("party member medium health", NextAction::array(0, new NextAction("lesser healing wave on party", 25.0f), nullptr))); - triggers.push_back(new TriggerNode("party member low health", NextAction::array(0, new NextAction("riptide on party", 25.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe heal", NextAction::array(0, new NextAction("chain heal", 27.0f), nullptr))); - triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("lesser healing wave", 26.0f), nullptr))); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("riptide", 26.0f), nullptr))); + // triggers.push_back(new TriggerNode("party member medium health", NextAction::array(0, new NextAction("lesser healing wave on party", 25.0f), nullptr))); + // triggers.push_back(new TriggerNode("party member low health", NextAction::array(0, new NextAction("riptide on party", 25.0f), nullptr))); + // triggers.push_back(new TriggerNode("medium aoe heal", NextAction::array(0, new NextAction("chain heal", 27.0f), nullptr))); + // triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("lesser healing wave", 26.0f), nullptr))); + // triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("riptide", 26.0f), nullptr))); triggers.push_back(new TriggerNode("heroism", NextAction::array(0, new NextAction("heroism", 31.0f), nullptr))); triggers.push_back(new TriggerNode("bloodlust", NextAction::array(0, new NextAction("bloodlust", 30.0f), nullptr))); + triggers.push_back(new TriggerNode( + "medium mana", + NextAction::array(0, new NextAction("mana tide totem", ACTION_EMERGENCY + 5), NULL))); } void ShamanBuffDpsStrategy::InitTriggers(std::vector& triggers) diff --git a/src/strategy/shaman/HealShamanStrategy.cpp b/src/strategy/shaman/HealShamanStrategy.cpp index 33e3d61a..3df7ff3b 100644 --- a/src/strategy/shaman/HealShamanStrategy.cpp +++ b/src/strategy/shaman/HealShamanStrategy.cpp @@ -43,7 +43,59 @@ void HealShamanStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("shaman weapon", NextAction::array(0, new NextAction("earthliving weapon", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("mana tide totem", ACTION_EMERGENCY + 5), nullptr))); - triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("healing stream totem", ACTION_LIGHT_HEAL), nullptr))); + triggers.push_back(new TriggerNode( + "group heal occasion", + NextAction::array(0, new NextAction("chain heal", 22.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member critical health", + NextAction::array(0, new NextAction("riptide on party", 24.0f), new NextAction("lesser healing wave on party", 23.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member low health", + NextAction::array(0, new NextAction("riptide on party", 18.0f), new NextAction("lesser healing wave on party", 17.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member medium health", + NextAction::array(0, new NextAction("riptide on party", 15.0f), new NextAction("lesser healing wave on party", 14.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member almost full health", + NextAction::array(0, new NextAction("riptide on party", 12.0f), new NextAction("lesser healing wave on party", 11.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member cleanse spirit poison", + NextAction::array(0, + new NextAction("cleanse spirit poison on party", ACTION_DISPEL + 2), + new NextAction("cleansing totem", ACTION_DISPEL + 2), + NULL))); + + triggers.push_back(new TriggerNode( + "party member cleanse spirit disease", + NextAction::array(0, + new NextAction("cleanse spirit disease on party", ACTION_DISPEL + 2), + new NextAction("cleansing totem", ACTION_DISPEL + 1), + NULL))); + + triggers.push_back(new TriggerNode( + "party member cleanse spirit curse", + NextAction::array(0, new NextAction("cleanse spirit curse on party", ACTION_DISPEL + 2), NULL))); + + triggers.push_back(new TriggerNode( + "no fire totem", + NextAction::array(0, new NextAction("fire elemental totem", 11.0f), new NextAction("flametongue totem", 10.0f), NULL))); + + triggers.push_back(new TriggerNode( + "no water totem", + NextAction::array(0, new NextAction("healing stream totem", 13.0f), NULL))); + + triggers.push_back(new TriggerNode( + "earth shield on main tank", + NextAction::array(0, new NextAction("earth shield on main tank", ACTION_HIGH + 7), NULL))); + + triggers.push_back(new TriggerNode( + "enemy too close for spell", + NextAction::array(0, new NextAction("flee", 49.0f), 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 + 1), nullptr))); } diff --git a/src/strategy/shaman/MeleeShamanStrategy.cpp b/src/strategy/shaman/MeleeShamanStrategy.cpp index ab08fd74..545bf92a 100644 --- a/src/strategy/shaman/MeleeShamanStrategy.cpp +++ b/src/strategy/shaman/MeleeShamanStrategy.cpp @@ -20,7 +20,8 @@ class MeleeShamanStrategyActionNodeFactory : public NamedObjectFactory& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("shaman weapon", NextAction::array(0, new NextAction("windfury weapon", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("searing totem", NextAction::array(0, new NextAction("reach melee", 22.0f), new NextAction("searing totem", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("shock", NextAction::array(0, new NextAction("earth shock", 20.0f), nullptr))); + triggers.push_back(new TriggerNode("shaman weapon", NextAction::array(0, new NextAction("flametongue weapon", 22.0f), nullptr))); + // triggers.push_back(new TriggerNode("searing totem", NextAction::array(0, new NextAction("reach melee", 22.0f), new NextAction("searing totem", 22.0f), nullptr))); + triggers.push_back(new TriggerNode("flame shock", NextAction::array(0, new NextAction("flame shock", 20.0f), nullptr))); + triggers.push_back(new TriggerNode( + "maelstrom weapon", + NextAction::array(0, new NextAction("lightning bolt", 25.0f), NULL))); triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), nullptr))); - triggers.push_back(new TriggerNode("enemy too close for melee", NextAction::array(0, new NextAction("move out of enemy contact", ACTION_NORMAL + 8), nullptr))); + // triggers.push_back(new TriggerNode("enemy too close for melee", NextAction::array(0, new NextAction("move out of enemy contact", ACTION_NORMAL + 8), nullptr))); triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("strength of earth totem", ACTION_LIGHT_HEAL), nullptr))); + triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_NORMAL + 8), nullptr))); + triggers.push_back(new TriggerNode( + "no fire totem", + NextAction::array(0, new NextAction("reach melee", 23.0f), new NextAction("magma totem", 22.0f), NULL))); } void MeleeAoeShamanStrategy::InitTriggers(std::vector& triggers) { - triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_NORMAL + 8), nullptr))); + triggers.push_back(new TriggerNode("magma totem", NextAction::array(0, new NextAction("magma totem", 26.0f), nullptr))); triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("fire nova", 25.0f), nullptr))); } diff --git a/src/strategy/shaman/ShamanActions.cpp b/src/strategy/shaman/ShamanActions.cpp index 1649cb8f..c8ede56d 100644 --- a/src/strategy/shaman/ShamanActions.cpp +++ b/src/strategy/shaman/ShamanActions.cpp @@ -29,3 +29,8 @@ bool CastMagmaTotemAction::isUseful() { return CastMeleeSpellAction::isUseful() && !AI_VALUE2(bool, "has totem", name); } + +bool CastCleansingTotemAction::isUseful() +{ + return CastTotemAction::isUseful() && !AI_VALUE2(bool, "has totem", "mana tide totem"); +} \ No newline at end of file diff --git a/src/strategy/shaman/ShamanActions.h b/src/strategy/shaman/ShamanActions.h index 26e0a21e..3928d04d 100644 --- a/src/strategy/shaman/ShamanActions.h +++ b/src/strategy/shaman/ShamanActions.h @@ -158,6 +158,7 @@ class CastCleansingTotemAction : public CastTotemAction { public: CastCleansingTotemAction(PlayerbotAI* botAI) : CastTotemAction(botAI, "cleansing totem") { } + virtual bool isUseful(); }; class CastFlametongueTotemAction : public CastTotemAction @@ -368,4 +369,37 @@ class CastWindShearOnEnemyHealerAction : public CastSpellOnEnemyHealerAction // std::string const getName() override { return "cure disease on party"; } // }; +class CastLavaBurstAction : public CastSpellAction +{ + public: + CastLavaBurstAction(PlayerbotAI* ai) : CastSpellAction(ai, "lava burst") {} +}; + +class CastEarthShieldOnMainTankAction : public BuffOnMainTankAction +{ + public: + CastEarthShieldOnMainTankAction(PlayerbotAI* ai) : BuffOnMainTankAction(ai, "earth shield", true) {} +}; + +class CastTotemOfWrathAction : public CastTotemAction +{ + public: + CastTotemOfWrathAction(PlayerbotAI* ai) : CastTotemAction(ai, "totem of wrath") {} + virtual std::string const GetTargetName() override { return "self target"; } + virtual bool isUseful() override { return CastTotemAction::isUseful(); } +}; + +class CastFireElementalTotemAction : public CastTotemAction +{ + public: + CastFireElementalTotemAction(PlayerbotAI* ai) : CastTotemAction(ai, "fire elemental totem") {} + virtual std::string const GetTargetName() override { return "self target"; } + virtual bool isUseful() override { return CastTotemAction::isUseful(); } +}; + +class CastWrathOfAirTotemAction : public CastTotemAction +{ + public: + CastWrathOfAirTotemAction(PlayerbotAI* ai) : CastTotemAction(ai, "wrath of air totem") {} +}; #endif diff --git a/src/strategy/shaman/ShamanAiObjectContext.cpp b/src/strategy/shaman/ShamanAiObjectContext.cpp index 0673a32e..406df864 100644 --- a/src/strategy/shaman/ShamanAiObjectContext.cpp +++ b/src/strategy/shaman/ShamanAiObjectContext.cpp @@ -95,12 +95,17 @@ class ShamanATriggerFactoryInternal : public NamedObjectContext creators["frost shock snare"] = &ShamanATriggerFactoryInternal::frost_shock_snare; creators["heroism"] = &ShamanATriggerFactoryInternal::heroism; creators["bloodlust"] = &ShamanATriggerFactoryInternal::bloodlust; - creators["maelstrom weapon"] = &ShamanATriggerFactoryInternal::maelstrom_weapon; creators["wind shear on enemy healer"] = &ShamanATriggerFactoryInternal::wind_shear_on_enemy_healer; creators["cure poison"] = &ShamanATriggerFactoryInternal::cure_poison; creators["party member cure poison"] = &ShamanATriggerFactoryInternal::party_member_cure_poison; - // creators["cure disease"] = &ShamanATriggerFactoryInternal::cure_disease; + creators["cure disease"] = &ShamanATriggerFactoryInternal::cure_disease; creators["party member cure disease"] = &ShamanATriggerFactoryInternal::party_member_cure_disease; + creators["no fire totem"] = &ShamanATriggerFactoryInternal::no_fire_totem; + creators["no water totem"] = &ShamanATriggerFactoryInternal::no_water_totem; + creators["earth shield on main tank"] = &ShamanATriggerFactoryInternal::earth_shield_on_main_tank; + creators["maelstrom weapon"] = &ShamanATriggerFactoryInternal::maelstrom_weapon; + creators["flame shock"] = &ShamanATriggerFactoryInternal::flame_shock; + creators["wrath of air totem"] = &ShamanATriggerFactoryInternal::wrath_of_air_totem; } private: @@ -136,6 +141,11 @@ class ShamanATriggerFactoryInternal : public NamedObjectContext static Trigger* party_member_cure_poison(PlayerbotAI* botAI) { return new PartyMemberCurePoisonTrigger(botAI); } static Trigger* cure_disease(PlayerbotAI* botAI) { return new CureDiseaseTrigger(botAI); } static Trigger* party_member_cure_disease(PlayerbotAI* botAI) { return new PartyMemberCureDiseaseTrigger(botAI); } + static Trigger* no_fire_totem(PlayerbotAI* ai) { return new NoFireTotemTrigger(ai); } + static Trigger* no_water_totem(PlayerbotAI* ai) { return new NoWaterTotemTrigger(ai); } + static Trigger* earth_shield_on_main_tank(PlayerbotAI* ai) { return new EarthShieldOnMainTankTrigger(ai); } + static Trigger* flame_shock(PlayerbotAI* ai) { return new FlameShockTrigger(ai); } + static Trigger* wrath_of_air_totem(PlayerbotAI* ai) { return new WrathOfAirTotemTrigger(ai); } }; class ShamanAiObjectContextInternal : public NamedObjectContext @@ -196,6 +206,12 @@ class ShamanAiObjectContextInternal : public NamedObjectContext // creators["cure disease on party"] = &ShamanAiObjectContextInternal::cure_disease_on_party; // creators["cure poison"] = &ShamanAiObjectContextInternal::cure_poison; // creators["cure poison on party"] = &ShamanAiObjectContextInternal::cure_poison_on_party; + creators["lava burst"] = &ShamanAiObjectContextInternal::lava_burst; + creators["earth shield on main tank"] = &ShamanAiObjectContextInternal::earth_shield_on_main_tank; + creators["fire elemental totem"] = &ShamanAiObjectContextInternal::fire_elemental_totem; + creators["totem of wrath"] = &ShamanAiObjectContextInternal::totem_of_wrath; + creators["fire elemental totem"] = &ShamanAiObjectContextInternal::fire_elemental_totem; + creators["wrath of air totem"] = &ShamanAiObjectContextInternal::wrath_of_air_totem; } private: @@ -252,6 +268,12 @@ class ShamanAiObjectContextInternal : public NamedObjectContext // static Action* cure_poison_on_party(PlayerbotAI* botAI) { return new CastCurePoisonOnPartyAction(botAI); } // static Action* cure_disease(PlayerbotAI* botAI) { return new CastCureDiseaseAction(botAI); } // static Action* cure_disease_on_party(PlayerbotAI* botAI) { return new CastCureDiseaseOnPartyAction(botAI); } + static Action* lava_burst(PlayerbotAI* ai) { return new CastLavaBurstAction(ai); } + static Action* earth_shield_on_main_tank(PlayerbotAI* ai) { return new CastEarthShieldOnMainTankAction(ai); } + static Action* totem_of_wrath(PlayerbotAI* ai) { return new CastTotemOfWrathAction(ai); } + static Action* fire_elemental_totem(PlayerbotAI* ai) { return new CastFireElementalTotemAction(ai); } + static Action* wrath_of_air_totem(PlayerbotAI* ai) { return new CastWrathOfAirTotemAction(ai); } + }; ShamanAiObjectContext::ShamanAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI) diff --git a/src/strategy/shaman/ShamanNonCombatStrategy.cpp b/src/strategy/shaman/ShamanNonCombatStrategy.cpp index 8fc6d691..9f3a6952 100644 --- a/src/strategy/shaman/ShamanNonCombatStrategy.cpp +++ b/src/strategy/shaman/ShamanNonCombatStrategy.cpp @@ -14,9 +14,26 @@ void ShamanNonCombatStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("water walking", NextAction::array(0, new NextAction("water walking", 12.0f), nullptr))); triggers.push_back(new TriggerNode("water breathing on party", NextAction::array(0, new NextAction("water breathing on party", 11.0f), nullptr))); triggers.push_back(new TriggerNode("water walking on party", NextAction::array(0, new NextAction("water walking on party", 11.0f), nullptr))); - triggers.push_back(new TriggerNode("critical health", NextAction::array(0, new NextAction("healing wave", 70.0f), nullptr))); - triggers.push_back(new TriggerNode("party member critical health", NextAction::array(0, new NextAction("healing wave on party", 60.0f), nullptr))); - triggers.push_back(new TriggerNode("medium aoe heal", NextAction::array(0, new NextAction("chain heal", 27.0f), nullptr))); + triggers.push_back(new TriggerNode( + "party member critical health", + NextAction::array(0, new NextAction("healing wave on party", 27.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member low health", + NextAction::array(0, new NextAction("healing wave on party", 26.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member medium health", + NextAction::array(0, new NextAction("healing wave on party", 25.0f), NULL))); + + triggers.push_back(new TriggerNode( + "party member almost full health", + NextAction::array(0, new NextAction("healing wave on party", 24.0f), NULL))); + + triggers.push_back(new TriggerNode( + "medium aoe heal", + NextAction::array(0, new NextAction("chain heal", 27.0f), NULL))); + triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("cure poison", 21.0f), nullptr))); triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("cure poison on party", 21.0f), nullptr))); triggers.push_back(new TriggerNode("cure disease", NextAction::array(0, new NextAction("cure disease", 31.0f), nullptr))); diff --git a/src/strategy/shaman/ShamanTriggers.cpp b/src/strategy/shaman/ShamanTriggers.cpp index a7f9778b..3d88514e 100644 --- a/src/strategy/shaman/ShamanTriggers.cpp +++ b/src/strategy/shaman/ShamanTriggers.cpp @@ -66,3 +66,22 @@ bool WaterBreathingOnPartyTrigger::IsActive() { return BuffOnPartyTrigger::IsActive() && AI_VALUE2(bool, "swimming", "self target"); } + +bool NoFireTotemTrigger::IsActive() +{ + return !AI_VALUE2(bool, "has totem", "magma totem") && + !AI_VALUE2(bool, "has totem", "flametongue totem") && + !AI_VALUE2(bool, "has totem", "searing totem") && + !AI_VALUE2(bool, "has totem", "fire elemental totem") && + !AI_VALUE2(bool, "has totem", "frost resistance totem") && + !AI_VALUE2(bool, "has totem", "totem of wrath"); +} + +bool NoWaterTotemTrigger::IsActive() +{ + return !AI_VALUE2(bool, "has totem", "fire resistance totem") && + !AI_VALUE2(bool, "has totem", "mana tide totem") && + !AI_VALUE2(bool, "has totem", "cleansing totem") && + !AI_VALUE2(bool, "has totem", "mana spring totem") && + !AI_VALUE2(bool, "has totem", "healing stream totem"); +} \ No newline at end of file diff --git a/src/strategy/shaman/ShamanTriggers.h b/src/strategy/shaman/ShamanTriggers.h index 5b0f9eb9..138c6874 100644 --- a/src/strategy/shaman/ShamanTriggers.h +++ b/src/strategy/shaman/ShamanTriggers.h @@ -6,6 +6,7 @@ #define _PLAYERBOT_SHAMANTRIGGERS_H #include "CureTriggers.h" +#include "GenericTriggers.h" #include "SharedDefines.h" class PlayerbotAI; @@ -194,10 +195,10 @@ class BloodlustTrigger : public BoostTrigger BloodlustTrigger(PlayerbotAI* botAI) : BoostTrigger(botAI, "bloodlust") { } }; -class MaelstromWeaponTrigger : public HasAuraTrigger +class MaelstromWeaponTrigger : public HasAuraStackTrigger { public: - MaelstromWeaponTrigger(PlayerbotAI* botAI) : HasAuraTrigger(botAI, "maelstrom weapon") { } + MaelstromWeaponTrigger(PlayerbotAI* botAI) : HasAuraStackTrigger(botAI, "maelstrom weapon", 5) { } }; class WindShearInterruptEnemyHealerSpellTrigger : public InterruptEnemyHealerTrigger @@ -230,4 +231,32 @@ class PartyMemberCureDiseaseTrigger : public PartyMemberNeedCureTrigger PartyMemberCureDiseaseTrigger(PlayerbotAI* botAI) : PartyMemberNeedCureTrigger(botAI, "cure disease", DISPEL_DISEASE) { } }; +class NoFireTotemTrigger : public Trigger { + public: + NoFireTotemTrigger(PlayerbotAI* ai) : Trigger(ai, "no fire totem") {} + virtual bool IsActive() override; +}; + +class NoWaterTotemTrigger : public Trigger { + public: + NoWaterTotemTrigger(PlayerbotAI* ai) : Trigger(ai, "no water totem") {} + virtual bool IsActive() override; +}; + +class EarthShieldOnMainTankTrigger : public BuffOnMainTankTrigger +{ + public: + EarthShieldOnMainTankTrigger(PlayerbotAI* botAI) : BuffOnMainTankTrigger(botAI, "earth shield", true) {} +}; + +class FlameShockTrigger : public DebuffTrigger { + public: + FlameShockTrigger(PlayerbotAI* ai) : DebuffTrigger(ai, "flame shock", 1, true) {} +}; + +class WrathOfAirTotemTrigger : public TotemTrigger +{ + public: + WrathOfAirTotemTrigger(PlayerbotAI* ai) : TotemTrigger(ai, "wrath of air totem") {} +}; #endif diff --git a/src/strategy/shaman/TotemsShamanStrategy.cpp b/src/strategy/shaman/TotemsShamanStrategy.cpp index 0b4ac389..fabfa8cd 100644 --- a/src/strategy/shaman/TotemsShamanStrategy.cpp +++ b/src/strategy/shaman/TotemsShamanStrategy.cpp @@ -13,8 +13,19 @@ void TotemsShamanStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("grace of air totem", NextAction::array(0, new NextAction("grace of air totem", 16.0f), nullptr))); - triggers.push_back(new TriggerNode("mana spring totem", NextAction::array(0, new NextAction("mana spring totem", 19.0f), nullptr))); - triggers.push_back(new TriggerNode("strength of earth totem", NextAction::array(0, new NextAction("strength of earth totem", 18.0f), nullptr))); - triggers.push_back(new TriggerNode("flametongue totem", NextAction::array(0, new NextAction("flametongue totem", 17.0f), nullptr))); + triggers.push_back(new TriggerNode( + "wrath of air totem", + NextAction::array(0, new NextAction("wrath of air totem", 8.0f), NULL))); + + triggers.push_back(new TriggerNode( + "no water totem", + NextAction::array(0, new NextAction("mana spring totem", 7.0f), NULL))); + + triggers.push_back(new TriggerNode( + "strength of earth totem", + NextAction::array(0, new NextAction("strength of earth totem", 6.0f), NULL))); + + triggers.push_back(new TriggerNode( + "no fire totem", + NextAction::array(0, new NextAction("flametongue totem", 5.0f), NULL))); } diff --git a/src/strategy/triggers/TriggerContext.h b/src/strategy/triggers/TriggerContext.h index 888803d0..c096f0f1 100644 --- a/src/strategy/triggers/TriggerContext.h +++ b/src/strategy/triggers/TriggerContext.h @@ -91,6 +91,7 @@ class TriggerContext : public NamedObjectContext creators["party member to heal out of spell range"] = &TriggerContext::party_member_to_heal_out_of_spell_range; creators["combo points available"] = &TriggerContext::ComboPointsAvailable; + creators["combo points 3 available"] = &TriggerContext::ComboPoints3Available; creators["medium threat"] = &TriggerContext::MediumThreat; @@ -303,6 +304,7 @@ class TriggerContext : public NamedObjectContext static Trigger* enemy_is_close(PlayerbotAI* botAI) { return new EnemyIsCloseTrigger(botAI); } static Trigger* party_member_to_heal_out_of_spell_range(PlayerbotAI* botAI) { return new PartyMemberToHealOutOfSpellRangeTrigger(botAI); } static Trigger* ComboPointsAvailable(PlayerbotAI* botAI) { return new ComboPointsAvailableTrigger(botAI); } + static Trigger* ComboPoints3Available(PlayerbotAI* botAI) { return new ComboPointsAvailableTrigger(botAI, 3); } static Trigger* MediumThreat(PlayerbotAI* botAI) { return new MediumThreatTrigger(botAI); } static Trigger* Dead(PlayerbotAI* botAI) { return new DeadTrigger(botAI); } static Trigger* corpse_near(PlayerbotAI* botAI) { return new CorpseNearTrigger(botAI); } @@ -391,3 +393,4 @@ class TriggerContext : public NamedObjectContext }; #endif + diff --git a/src/strategy/values/HasTotemValue.cpp b/src/strategy/values/HasTotemValue.cpp index 746cf737..3c31fc40 100644 --- a/src/strategy/values/HasTotemValue.cpp +++ b/src/strategy/values/HasTotemValue.cpp @@ -20,6 +20,10 @@ bool HasTotemValue::Calculate() if (!creature || !creature->IsTotem()) continue; + if (creature->GetOwner() != bot) { + continue; + } + if (strstri(creature->GetName().c_str(), qualifier.c_str()) && bot->GetDistance(creature) <= botAI->GetRange("spell")) return true; }