From 10462126b4da57e6be96bab1d9cbe4b7e4737833 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 25 Oct 2023 20:29:32 +0800 Subject: [PATCH] miscs --- src/PlayerbotFactory.cpp | 2 +- src/strategy/hunter/HunterTriggers.cpp | 7 +++++++ src/strategy/hunter/HunterTriggers.h | 1 + src/strategy/priest/ShadowPriestStrategy.cpp | 2 +- src/strategy/shaman/GenericShamanStrategy.cpp | 3 ++- src/strategy/triggers/CureTriggers.h | 2 +- src/strategy/values/ExpectedLifetimeValue.cpp | 2 +- 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/PlayerbotFactory.cpp b/src/PlayerbotFactory.cpp index 57735710..9c84de08 100644 --- a/src/PlayerbotFactory.cpp +++ b/src/PlayerbotFactory.cpp @@ -1335,7 +1335,7 @@ void PlayerbotFactory::InitEquipment(bool incremental) float bestScoreForSlot = -1; uint32 bestItemForSlot = 0; - for (int attempts = 0; attempts < std::min((int)ids.size(), 25); attempts++) + for (int attempts = 0; attempts < std::max((int)(ids.size() * 0.75), 1); attempts++) { uint32 index = urand(0, ids.size() - 1); uint32 newItemId = ids[index]; diff --git a/src/strategy/hunter/HunterTriggers.cpp b/src/strategy/hunter/HunterTriggers.cpp index db6c7795..f56065b1 100644 --- a/src/strategy/hunter/HunterTriggers.cpp +++ b/src/strategy/hunter/HunterTriggers.cpp @@ -7,6 +7,7 @@ #include "HunterActions.h" #include "Playerbots.h" #include "ServerFacade.h" +#include "SharedDefines.h" bool HunterAspectOfTheHawkTrigger::IsActive() { @@ -77,3 +78,9 @@ bool SwitchToMeleeTrigger::IsActive() return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) && target && (target->GetVictim() == bot && sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f)); } + +bool TargetRemoveEnrageTrigger::IsActive() +{ + Unit* target = GetTarget(); + return target && (botAI->HasAuraToDispel(target, DISPEL_ENRAGE) || botAI->HasAuraToDispel(target, DISPEL_MAGIC)); +} \ No newline at end of file diff --git a/src/strategy/hunter/HunterTriggers.h b/src/strategy/hunter/HunterTriggers.h index 6096bca7..c904732e 100644 --- a/src/strategy/hunter/HunterTriggers.h +++ b/src/strategy/hunter/HunterTriggers.h @@ -160,5 +160,6 @@ class TargetRemoveEnrageTrigger : public TargetAuraDispelTrigger { public: TargetRemoveEnrageTrigger(PlayerbotAI* ai) : TargetAuraDispelTrigger(ai, "tranquilizing shot", DISPEL_ENRAGE) {} + bool IsActive() override; }; #endif diff --git a/src/strategy/priest/ShadowPriestStrategy.cpp b/src/strategy/priest/ShadowPriestStrategy.cpp index e2fae3c0..8c00165b 100644 --- a/src/strategy/priest/ShadowPriestStrategy.cpp +++ b/src/strategy/priest/ShadowPriestStrategy.cpp @@ -40,7 +40,7 @@ void ShadowPriestAoeStrategy::InitTriggers(std::vector& triggers) { triggers.push_back(new TriggerNode("shadow word: pain on attacker", NextAction::array(0, new NextAction("shadow word: pain on attacker", ACTION_NORMAL + 5), nullptr))); triggers.push_back(new TriggerNode("vampiric touch on attacker", NextAction::array(0, new NextAction("vampiric touch on attacker", ACTION_NORMAL + 4), nullptr))); - // triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("mind sear", ACTION_HIGH + 4), nullptr))); + triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("mind sear", ACTION_HIGH + 4), nullptr))); } void ShadowPriestDebuffStrategy::InitTriggers(std::vector& triggers) diff --git a/src/strategy/shaman/GenericShamanStrategy.cpp b/src/strategy/shaman/GenericShamanStrategy.cpp index e05c9754..9a0583f0 100644 --- a/src/strategy/shaman/GenericShamanStrategy.cpp +++ b/src/strategy/shaman/GenericShamanStrategy.cpp @@ -4,6 +4,7 @@ #include "HealShamanStrategy.h" #include "Playerbots.h" +#include "Strategy.h" class GenericShamanStrategyActionNodeFactory : public NamedObjectFactory { @@ -116,7 +117,7 @@ void GenericShamanStrategy::InitTriggers(std::vector& 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("purge", NextAction::array(0, new NextAction("purge", ACTION_DISPEL), 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))); diff --git a/src/strategy/triggers/CureTriggers.h b/src/strategy/triggers/CureTriggers.h index 4632f154..50bedf2f 100644 --- a/src/strategy/triggers/CureTriggers.h +++ b/src/strategy/triggers/CureTriggers.h @@ -13,7 +13,7 @@ class Unit; class NeedCureTrigger : public SpellTrigger { public: - NeedCureTrigger(PlayerbotAI* botAI, std::string const spell, uint32 dispelType) : SpellTrigger(botAI, spell, 2 * 1000), dispelType(dispelType) { } + NeedCureTrigger(PlayerbotAI* botAI, std::string const spell, uint32 dispelType) : SpellTrigger(botAI, spell, 1 * 1000), dispelType(dispelType) { } std::string const GetTargetName() override { return "self target"; } bool IsActive() override; diff --git a/src/strategy/values/ExpectedLifetimeValue.cpp b/src/strategy/values/ExpectedLifetimeValue.cpp index b41fff14..084593cd 100644 --- a/src/strategy/values/ExpectedLifetimeValue.cpp +++ b/src/strategy/values/ExpectedLifetimeValue.cpp @@ -64,7 +64,7 @@ float ExpectedGroupDpsValue::Calculate() gs_modifier = gs_modifier * 3 + 1; if (gs_modifier < 0.5) gs_modifier = 0.5; - if (gs_modifier > 4) gs_modifier = 3; + if (gs_modifier > 4) gs_modifier = 4; return dps_num * basic_dps * gs_modifier; } \ No newline at end of file