/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it * and/or modify it under version 2 of the License, or (at your option), any later version. */ #include "CombatStrategy.h" #include "Playerbots.h" #include "Strategy.h" void CombatStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", ACTION_HIGH), nullptr))); // drop target relevance 99 (lower than Worldpacket triggers) triggers.push_back( new TriggerNode("invalid target", NextAction::array(0, new NextAction("drop target", 99), nullptr))); triggers.push_back( new TriggerNode("mounted", NextAction::array(0, new NextAction("check mount state", 54), nullptr))); // triggers.push_back(new TriggerNode("out of react range", NextAction::array(0, new NextAction("flee to master", // 55), nullptr))); triggers.push_back(new TriggerNode("combat stuck", NextAction::array(0, new NextAction("reset", 1.0f), nullptr))); triggers.push_back(new TriggerNode("not facing target", NextAction::array(0, new NextAction("set facing", ACTION_MOVE + 7), nullptr))); triggers.push_back( new TriggerNode("pet attack", NextAction::array(0, new NextAction("pet attack", 40.0f), nullptr))); // triggers.push_back(new TriggerNode("combat long stuck", NextAction::array(0, new NextAction("hearthstone", 0.9f), // new NextAction("repop", 0.8f), nullptr))); } AvoidAoeStrategy::AvoidAoeStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} // class AvoidAoeStrategyMultiplier : public Multiplier // { // public: // AvoidAoeStrategyMultiplier(PlayerbotAI* botAI) : Multiplier(botAI, "run away on area debuff") {} // public: // virtual float GetValue(Action* action); // private: // }; // float AvoidAoeStrategyMultiplier::GetValue(Action* action) // { // if (!action) // return 1.0f; // std::string name = action->getName(); // if (name == "follow" || name == "co" || name == "nc" || name == "drop target") // return 1.0f; // uint32 spellId = AI_VALUE2(uint32, "spell id", name); // const SpellInfo* const pSpellInfo = sSpellMgr->GetSpellInfo(spellId); // if (!pSpellInfo) return 1.0f; // if (spellId && pSpellInfo->Targets & TARGET_FLAG_DEST_LOCATION) // return 1.0f; // else if (spellId && pSpellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION) // return 1.0f; // uint32 castTime = pSpellInfo->CalcCastTime(bot); // if (AI_VALUE2(bool, "has area debuff", "self target") && spellId && castTime > 0) // { // return 0.0f; // } // return 1.0f; // } NextAction** AvoidAoeStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("avoid aoe", ACTION_EMERGENCY), nullptr); } void AvoidAoeStrategy::InitTriggers(std::vector& triggers) { } void AvoidAoeStrategy::InitMultipliers(std::vector& multipliers) { // multipliers.push_back(new AvoidAoeStrategyMultiplier(botAI)); } TankFaceStrategy::TankFaceStrategy(PlayerbotAI* botAI) : Strategy(botAI) {} NextAction** TankFaceStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("tank face", ACTION_MOVE), nullptr); } void TankFaceStrategy::InitTriggers(std::vector& triggers) { } NextAction** CombatFormationStrategy::getDefaultActions() { return NextAction::array(0, new NextAction("combat formation move", ACTION_NORMAL), nullptr); }