diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 7389c72c..491e93ec 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -724,14 +724,14 @@ std::string const PlayerbotHolder::ProcessBotCommand(std::string const cmd, Obje sPlayerbotAIConfig->autoInitEquipLevelLimitRatio; PlayerbotFactory factory(bot, master->GetLevel(), ITEM_QUALITY_LEGENDARY, mixedGearScore); factory.Randomize(false); - return "ok, gear score limit: " + std::to_string(mixedGearScore / (ITEM_QUALITY_EPIC + 1)) + + return "ok, gear score limit: " + std::to_string(mixedGearScore / PlayerbotAI::GetItemScoreMultiplier(ItemQualities(ITEM_QUALITY_EPIC))) + "(for epic)"; } else if (cmd.starts_with("init=") && sscanf(cmd.c_str(), "init=%d", &gs) != -1) { PlayerbotFactory factory(bot, master->GetLevel(), ITEM_QUALITY_LEGENDARY, gs); factory.Randomize(false); - return "ok, gear score limit: " + std::to_string(gs / (ITEM_QUALITY_EPIC + 1)) + "(for epic)"; + return "ok, gear score limit: " + std::to_string(gs / PlayerbotAI::GetItemScoreMultiplier(ItemQualities(ITEM_QUALITY_EPIC))) + "(for epic)"; } } diff --git a/src/strategy/hunter/DpsHunterStrategy.cpp b/src/strategy/hunter/DpsHunterStrategy.cpp index e9d0e2f5..3ba171a2 100644 --- a/src/strategy/hunter/DpsHunterStrategy.cpp +++ b/src/strategy/hunter/DpsHunterStrategy.cpp @@ -45,7 +45,7 @@ NextAction** DpsHunterStrategy::getDefaultActions() new NextAction("explosive shot", ACTION_DEFAULT + 0.6f), new NextAction("aimed shot", ACTION_DEFAULT + 0.5f), new NextAction("silencing shot", ACTION_DEFAULT + 0.4f), new NextAction("kill command", ACTION_DEFAULT + 0.3f), - new NextAction("arcane shot", ACTION_DEFAULT + 0.2f), + // new NextAction("arcane shot", ACTION_DEFAULT + 0.2f), new NextAction("steady shot", ACTION_DEFAULT + 0.1f), new NextAction("auto shot", ACTION_DEFAULT), nullptr); } diff --git a/src/strategy/hunter/GenericHunterStrategy.cpp b/src/strategy/hunter/GenericHunterStrategy.cpp index e59df4cd..0974e2d4 100644 --- a/src/strategy/hunter/GenericHunterStrategy.cpp +++ b/src/strategy/hunter/GenericHunterStrategy.cpp @@ -95,7 +95,7 @@ void GenericHunterStrategy::InitTriggers(std::vector& triggers) triggers.push_back(new TriggerNode("enemy too close for auto shot", NextAction::array(0, new NextAction("flee", ACTION_MOVE + 9), nullptr))); triggers.push_back( - new TriggerNode("misdirection on main tank", + new TriggerNode("low tank threat", NextAction::array(0, new NextAction("misdirection on main tank", ACTION_HIGH + 7), NULL))); triggers.push_back( new TriggerNode("low health", NextAction::array(0, new NextAction("deterrence", ACTION_HIGH + 5), nullptr))); diff --git a/src/strategy/rogue/AssassinationRogueStrategy.cpp b/src/strategy/rogue/AssassinationRogueStrategy.cpp index 380ac292..5f3d2211 100644 --- a/src/strategy/rogue/AssassinationRogueStrategy.cpp +++ b/src/strategy/rogue/AssassinationRogueStrategy.cpp @@ -83,7 +83,7 @@ void AssassinationRogueStrategy::InitTriggers(std::vector& trigger 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", + "low tank threat", NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), NULL))); triggers.push_back(new TriggerNode( diff --git a/src/strategy/rogue/DpsRogueStrategy.cpp b/src/strategy/rogue/DpsRogueStrategy.cpp index 91cc8044..0fd0d003 100644 --- a/src/strategy/rogue/DpsRogueStrategy.cpp +++ b/src/strategy/rogue/DpsRogueStrategy.cpp @@ -141,7 +141,7 @@ void DpsRogueStrategy::InitTriggers(std::vector& triggers) NextAction::array(0, new NextAction("expose armor", ACTION_HIGH + 3), nullptr))); triggers.push_back(new TriggerNode( - "tricks of the trade on main tank", + "low tank threat", NextAction::array(0, new NextAction("tricks of the trade on main tank", ACTION_HIGH + 7), nullptr))); } diff --git a/src/strategy/triggers/GenericTriggers.cpp b/src/strategy/triggers/GenericTriggers.cpp index 2c69b72a..7826616f 100644 --- a/src/strategy/triggers/GenericTriggers.cpp +++ b/src/strategy/triggers/GenericTriggers.cpp @@ -14,6 +14,7 @@ #include "Playerbots.h" #include "SharedDefines.h" #include "TemporarySummon.h" +#include "ThreatMgr.h" #include "Timer.h" bool LowManaTrigger::IsActive() @@ -185,6 +186,22 @@ bool MyAttackerCountTrigger::IsActive() return AI_VALUE2(bool, "combat", "self target") && AI_VALUE(uint8, "my attacker count") >= amount; } +bool LowTankThreatTrigger::IsActive() +{ + Unit* mt = AI_VALUE(Unit*, "main tank"); + if (!mt) + return false; + + Unit* current_target = AI_VALUE(Unit*, "current target"); + if (!current_target) + return false; + + ThreatMgr& mgr = current_target->GetThreatMgr(); + float threat = mgr.GetThreat(bot); + float tankThreat = mgr.GetThreat(mt); + return tankThreat == 0.0f || threat > tankThreat * 0.5f; +} + bool AoeTrigger::IsActive() { Unit* current_target = AI_VALUE(Unit*, "current target"); diff --git a/src/strategy/triggers/GenericTriggers.h b/src/strategy/triggers/GenericTriggers.h index 132e6b66..b7217447 100644 --- a/src/strategy/triggers/GenericTriggers.h +++ b/src/strategy/triggers/GenericTriggers.h @@ -10,6 +10,7 @@ #include "HealthTriggers.h" #include "RangeTriggers.h" +#include "Trigger.h" class PlayerbotAI; class Unit; @@ -248,6 +249,13 @@ public: MediumThreatTrigger(PlayerbotAI* botAI) : MyAttackerCountTrigger(botAI, 2) {} }; +class LowTankThreatTrigger : public Trigger +{ +public: + LowTankThreatTrigger(PlayerbotAI* botAI) : Trigger(botAI, "low tank threat") {} + bool IsActive() override; +}; + class AoeTrigger : public AttackerCountTrigger { public: diff --git a/src/strategy/triggers/TriggerContext.h b/src/strategy/triggers/TriggerContext.h index e1c4ec7d..860ee682 100644 --- a/src/strategy/triggers/TriggerContext.h +++ b/src/strategy/triggers/TriggerContext.h @@ -102,6 +102,7 @@ public: creators["combo points not full and high energy"] = &TriggerContext::ComboPointsNotFullAndHighEnergy; creators["medium threat"] = &TriggerContext::MediumThreat; + creators["low tank threat"] = &TriggerContext::low_tank_threat; creators["dead"] = &TriggerContext::Dead; creators["corpse near"] = &TriggerContext::corpse_near; @@ -321,6 +322,8 @@ private: static Trigger* ComboPointsNotFull(PlayerbotAI* botAI) { return new ComboPointsNotFullTrigger(botAI); } static Trigger* ComboPointsNotFullAndHighEnergy(PlayerbotAI* botAI) { return new TwoTriggers(botAI, "combo points not full", "high energy available"); } static Trigger* MediumThreat(PlayerbotAI* botAI) { return new MediumThreatTrigger(botAI); } + static Trigger* low_tank_threat(PlayerbotAI* botAI) { return new LowTankThreatTrigger(botAI); } + // 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); } static Trigger* PartyMemberDead(PlayerbotAI* botAI) { return new PartyMemberDeadTrigger(botAI); }