diff --git a/src/PlayerbotAI.cpp b/src/PlayerbotAI.cpp index f11593b7..3ec22c1e 100644 --- a/src/PlayerbotAI.cpp +++ b/src/PlayerbotAI.cpp @@ -1882,7 +1882,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, } } - ObjectGuid oldSel = bot->GetSelectedUnit()->GetGUID(); + Unit* oldSel = bot->GetSelectedUnit(); Spell* spell = new Spell(bot, spellInfo, TRIGGERED_NONE); spell->m_targets.SetUnitTarget(target); @@ -1901,7 +1901,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, } if (oldSel) - bot->SetSelection(oldSel); + bot->SetSelection(oldSel->GetGUID()); switch (result) { diff --git a/src/strategy/actions/GenericSpellActions.cpp b/src/strategy/actions/GenericSpellActions.cpp index ec131996..aa25fee2 100644 --- a/src/strategy/actions/GenericSpellActions.cpp +++ b/src/strategy/actions/GenericSpellActions.cpp @@ -137,15 +137,16 @@ CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string con bool CastEnchantItemAction::isPossible() { - if (!CastSpellAction::isPossible()) { + // if (!CastSpellAction::isPossible()) { - botAI->TellMasterNoFacing("Impossible: " + spell); - return false; - } + // botAI->TellMasterNoFacing("Impossible: " + spell); + // return false; + // } uint32 spellId = AI_VALUE2(uint32, "spell id", spell); bool ok = AI_VALUE2(Item*, "item for spell", spellId); + Item* item = AI_VALUE2(Item*, "item for spell", spellId); botAI->TellMasterNoFacing("spell: " + spell + ", spell id: " + std::to_string(spellId) + " item for spell: " + std::to_string(ok)); return spellId && AI_VALUE2(Item*, "item for spell", spellId); } diff --git a/src/strategy/paladin/DpsPaladinStrategy.cpp b/src/strategy/paladin/DpsPaladinStrategy.cpp index 390c0221..e7e385c5 100644 --- a/src/strategy/paladin/DpsPaladinStrategy.cpp +++ b/src/strategy/paladin/DpsPaladinStrategy.cpp @@ -81,7 +81,10 @@ void DpsPaladinStrategy::InitTriggers(std::vector& triggers) { GenericPaladinStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), nullptr))); + triggers.push_back(new TriggerNode( + "seal", + NextAction::array(0, new NextAction("seal of vengeance", 89.0f), NULL))); + // triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), nullptr))); triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", 91.0f), nullptr))); triggers.push_back(new TriggerNode("sanctity aura", NextAction::array(0, new NextAction("sanctity aura", 90.0f), nullptr))); // triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("repentance or shield", ACTION_CRITICAL_HEAL + 3), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr))); diff --git a/src/strategy/paladin/GenericPaladinStrategy.cpp b/src/strategy/paladin/GenericPaladinStrategy.cpp index ddb025b5..07437545 100644 --- a/src/strategy/paladin/GenericPaladinStrategy.cpp +++ b/src/strategy/paladin/GenericPaladinStrategy.cpp @@ -15,7 +15,7 @@ void GenericPaladinStrategy::InitTriggers(std::vector& triggers) { CombatStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("divine shield", ACTION_CRITICAL_HEAL + 2), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr))); + // triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("divine shield", ACTION_CRITICAL_HEAL + 2), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr))); triggers.push_back(new TriggerNode("hammer of justice interrupt", NextAction::array(0, new NextAction("hammer of justice", ACTION_INTERRUPT), nullptr))); triggers.push_back(new TriggerNode("hammer of justice on enemy healer", NextAction::array(0, new NextAction("hammer of justice on enemy healer", ACTION_INTERRUPT), nullptr))); triggers.push_back(new TriggerNode("hammer of justice on snare target", NextAction::array(0, new NextAction("hammer of justice on snare target", ACTION_INTERRUPT), nullptr))); diff --git a/src/strategy/paladin/TankPaladinStrategy.cpp b/src/strategy/paladin/TankPaladinStrategy.cpp index 8b032e7e..62797db4 100644 --- a/src/strategy/paladin/TankPaladinStrategy.cpp +++ b/src/strategy/paladin/TankPaladinStrategy.cpp @@ -47,8 +47,12 @@ void TankPaladinStrategy::InitTriggers(std::vector& triggers) { GenericPaladinStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of vengeance", 90.0f), NULL))); + triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), NULL))); triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", 91.0f), nullptr))); + triggers.push_back(new TriggerNode( + "devotion aura", + NextAction::array(0, new NextAction("devotion aura", 90.0f), NULL))); + // triggers.push_back(new TriggerNode("judgement of light", NextAction::array(0, new NextAction("judgement of light", ACTION_HIGH + 6), nullptr))); // triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("judgement of wisdom", ACTION_HIGH + 6), nullptr))); // triggers.push_back(new TriggerNode("judgement", NextAction::array(0, new NextAction("judgement", ACTION_HIGH + 6), nullptr))); diff --git a/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp b/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp index 801e3d77..52c10ddc 100644 --- a/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp +++ b/src/strategy/rogue/GenericRogueNonCombatStrategy.cpp @@ -16,15 +16,15 @@ void GenericRogueNonCombatStrategy::InitTriggers(std::vector& trig triggers.push_back(new TriggerNode( "main hand weapon no enchant", - NextAction::array(0, new NextAction("use instant poison", 20.0f), NULL))); + NextAction::array(0, new NextAction("use instant poison on main hand", 20.0f), NULL))); triggers.push_back(new TriggerNode( "off hand weapon no enchant", - NextAction::array(0, new NextAction("use deadly poison", 19.0f), NULL))); + NextAction::array(0, new NextAction("use deadly poison on off hand", 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( + // "off hand weapon no enchant", + // NextAction::array(0, new NextAction("use instant poison", 18.0f), NULL))); triggers.push_back(new TriggerNode( "often", diff --git a/src/strategy/rogue/RogueActions.cpp b/src/strategy/rogue/RogueActions.cpp index 9858684e..99ffcc64 100644 --- a/src/strategy/rogue/RogueActions.cpp +++ b/src/strategy/rogue/RogueActions.cpp @@ -4,6 +4,8 @@ #include "RogueActions.h" #include "Event.h" +#include "ObjectGuid.h" +#include "Player.h" #include "Playerbots.h" bool CastStealthAction::isPossible() @@ -68,7 +70,9 @@ bool UseDeadlyPoisonAction::Execute(Event event) { if (items.empty()) { return false; } - return UseItemAuto(*items.begin()); + Item* const itemForSpell = bot->GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND ); + return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell); + // return UseItemAuto(*items.begin()); } bool UseDeadlyPoisonAction::isPossible() { @@ -99,7 +103,8 @@ bool UseInstantPoisonAction::Execute(Event event) { if (items.empty()) { return false; } - return UseItemAuto(*items.begin()); + Item* const itemForSpell = bot->GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND ); + return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell); } bool UseInstantPoisonAction::isPossible() { diff --git a/src/strategy/rogue/RogueAiObjectContext.cpp b/src/strategy/rogue/RogueAiObjectContext.cpp index 48ca9dcf..f26e7fd9 100644 --- a/src/strategy/rogue/RogueAiObjectContext.cpp +++ b/src/strategy/rogue/RogueAiObjectContext.cpp @@ -20,7 +20,6 @@ class RogueStrategyFactoryInternal : public NamedObjectContext public: RogueStrategyFactoryInternal() { - creators["dps"] = &RogueStrategyFactoryInternal::dps; creators["nc"] = &RogueStrategyFactoryInternal::nc; creators["pull"] = &RogueStrategyFactoryInternal::pull; creators["aoe"] = &RogueStrategyFactoryInternal::aoe; @@ -28,18 +27,29 @@ class RogueStrategyFactoryInternal : public NamedObjectContext creators["stealthed"] = &RogueStrategyFactoryInternal::stealthed; creators["stealth"] = &RogueStrategyFactoryInternal::stealth; creators["cc"] = &RogueStrategyFactoryInternal::cc; - creators["melee"] = &RogueStrategyFactoryInternal::melee; } private: static Strategy* boost(PlayerbotAI* botAI) { return new RogueBoostStrategy(botAI); } static Strategy* aoe(PlayerbotAI* botAI) { return new RogueAoeStrategy(botAI); } - static Strategy* dps(PlayerbotAI* botAI) { return new DpsRogueStrategy(botAI); } static Strategy* nc(PlayerbotAI* botAI) { return new GenericRogueNonCombatStrategy(botAI); } static Strategy* pull(PlayerbotAI* botAI) { return new PullStrategy(botAI, "shoot"); } 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); } +}; + +class RogueCombatStrategyFactoryInternal : public NamedObjectContext +{ + public: + RogueCombatStrategyFactoryInternal() : NamedObjectContext(false, true) + { + creators["dps"] = &RogueCombatStrategyFactoryInternal::dps; + creators["melee"] = &RogueCombatStrategyFactoryInternal::melee; + } + + private: + static Strategy* dps(PlayerbotAI* botAI) { return new DpsRogueStrategy(botAI); } static Strategy* melee(PlayerbotAI* botAI) { return new AssassinationRogueStrategy(botAI); } }; @@ -115,8 +125,8 @@ class RogueAiObjectContextInternal : public NamedObjectContext 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; + creators["use instant poison on main hand"] = &RogueAiObjectContextInternal::use_instant_poison; + creators["use deadly poison on off hand"] = &RogueAiObjectContextInternal::use_deadly_poison; } private: @@ -155,6 +165,7 @@ class RogueAiObjectContextInternal : public NamedObjectContext RogueAiObjectContext::RogueAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI) { strategyContexts.Add(new RogueStrategyFactoryInternal()); + strategyContexts.Add(new RogueCombatStrategyFactoryInternal()); actionContexts.Add(new RogueAiObjectContextInternal()); triggerContexts.Add(new RogueTriggerFactoryInternal()); } diff --git a/src/strategy/shaman/ShamanTriggers.cpp b/src/strategy/shaman/ShamanTriggers.cpp index 3d88514e..684360f5 100644 --- a/src/strategy/shaman/ShamanTriggers.cpp +++ b/src/strategy/shaman/ShamanTriggers.cpp @@ -39,7 +39,7 @@ bool ShockTrigger::IsActive() bool TotemTrigger::IsActive() { - return AI_VALUE(uint8, "attacker count") >= attackerCount && !AI_VALUE2(bool, "has totem", name); + return AI_VALUE(uint8, "attacker count") >= attackerCount && !AI_VALUE2(bool, "has totem", name) && !botAI->HasAura(name, bot); } bool ManaSpringTotemTrigger::IsActive() diff --git a/src/strategy/warrior/GenericWarriorStrategy.cpp b/src/strategy/warrior/GenericWarriorStrategy.cpp index 3174441a..c29f2155 100644 --- a/src/strategy/warrior/GenericWarriorStrategy.cpp +++ b/src/strategy/warrior/GenericWarriorStrategy.cpp @@ -25,11 +25,11 @@ class WarrirorAoeStrategyActionNodeFactory : public NamedObjectFactory