From ae37876848590a4bd336d38793f6a4da1ee2becb Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Sun, 1 Sep 2024 15:46:39 +0800 Subject: [PATCH] Shaman stats weight and totem --- conf/playerbots.conf.dist | 2 +- src/factory/StatsWeightCalculator.cpp | 20 +++++++++++++++---- src/strategy/shaman/CasterShamanStrategy.cpp | 4 +++- src/strategy/shaman/HealShamanStrategy.cpp | 5 +++++ src/strategy/shaman/MeleeShamanStrategy.cpp | 5 ++--- src/strategy/shaman/ShamanActions.h | 15 ++++++++++++++ src/strategy/shaman/ShamanAiObjectContext.cpp | 2 ++ src/strategy/shaman/TotemsShamanStrategy.cpp | 11 ++-------- 8 files changed, 46 insertions(+), 18 deletions(-) diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index 31fcf6eb..675c322b 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -916,7 +916,7 @@ AiPlayerbot.PremadeSpecGlyph.7.0 = 41536,43385,41532,43386,44923,45776 AiPlayerbot.PremadeSpecLink.7.0.60 = 4530001520213351102301351 AiPlayerbot.PremadeSpecLink.7.0.80 = 3530001523213351322301351-005050031 AiPlayerbot.PremadeSpecName.7.1 = enh pve -AiPlayerbot.PremadeSpecGlyph.7.1 = 41530,43385,41539,43386,44923,41540 +AiPlayerbot.PremadeSpecGlyph.7.1 = 41542,43385,41539,43386,44923,45771 AiPlayerbot.PremadeSpecLink.7.1.60 = -30205033005001333031131131051 AiPlayerbot.PremadeSpecLink.7.1.80 = 053030052-30205033005021333031131131051 AiPlayerbot.PremadeSpecName.7.2 = resto pve diff --git a/src/factory/StatsWeightCalculator.cpp b/src/factory/StatsWeightCalculator.cpp index 543de321..b0055272 100644 --- a/src/factory/StatsWeightCalculator.cpp +++ b/src/factory/StatsWeightCalculator.cpp @@ -132,7 +132,7 @@ void StatsWeightCalculator::GenerateBasicWeights(Player* player) stats_weights_[STATS_TYPE_HASTE] += 1.8f; stats_weights_[STATS_TYPE_RANGED_DPS] += 5.0f; } - else if ((cls == CLASS_ROGUE && tab == ROGUE_TAB_COMBAT) || (cls == CLASS_DRUID && tab == DRUID_TAB_FERAL && !PlayerbotAI::IsTank(player))) + else if (cls == CLASS_ROGUE && tab == ROGUE_TAB_COMBAT) { stats_weights_[STATS_TYPE_AGILITY] += 1.8f; stats_weights_[STATS_TYPE_STRENGTH] += 1.1f; @@ -143,7 +143,19 @@ void StatsWeightCalculator::GenerateBasicWeights(Player* player) stats_weights_[STATS_TYPE_HASTE] += 1.4f; stats_weights_[STATS_TYPE_EXPERTISE] += 2.0f; stats_weights_[STATS_TYPE_MELEE_DPS] += 5.0f; - } + } + else if (cls == CLASS_DRUID && tab == DRUID_TAB_FERAL && !PlayerbotAI::IsTank(player)) + { + stats_weights_[STATS_TYPE_AGILITY] += 2.4f; + stats_weights_[STATS_TYPE_STRENGTH] += 2.3f; + stats_weights_[STATS_TYPE_ATTACK_POWER] += 1.0f; + stats_weights_[STATS_TYPE_ARMOR_PENETRATION] += 2.1f; + stats_weights_[STATS_TYPE_HIT] += 1.9f; + stats_weights_[STATS_TYPE_CRIT] += 1.8f; + stats_weights_[STATS_TYPE_HASTE] += 1.4f; + stats_weights_[STATS_TYPE_EXPERTISE] += 2.0f; + stats_weights_[STATS_TYPE_MELEE_DPS] += 5.0f; + } else if (cls == CLASS_ROGUE && (tab == ROGUE_TAB_ASSASSINATION || tab == ROGUE_TAB_SUBTLETY)) { stats_weights_[STATS_TYPE_AGILITY] += 1.7f; @@ -224,13 +236,13 @@ void StatsWeightCalculator::GenerateBasicWeights(Player* player) stats_weights_[STATS_TYPE_STRENGTH] += 1.1f; stats_weights_[STATS_TYPE_INTELLECT] += 0.5f; stats_weights_[STATS_TYPE_ATTACK_POWER] += 1.0f; - stats_weights_[STATS_TYPE_SPELL_POWER] += 1.0f; + stats_weights_[STATS_TYPE_SPELL_POWER] += 0.9f; stats_weights_[STATS_TYPE_ARMOR_PENETRATION] += 1.2f; stats_weights_[STATS_TYPE_HIT] += 1.7f; stats_weights_[STATS_TYPE_CRIT] += 1.4f; stats_weights_[STATS_TYPE_HASTE] += 1.8f; stats_weights_[STATS_TYPE_EXPERTISE] += 2.0f; - stats_weights_[STATS_TYPE_MELEE_DPS] += 5.2f; + stats_weights_[STATS_TYPE_MELEE_DPS] += 8.5f; } else if (cls == CLASS_WARLOCK || cls == CLASS_MAGE || diff --git a/src/strategy/shaman/CasterShamanStrategy.cpp b/src/strategy/shaman/CasterShamanStrategy.cpp index 88e3ca06..c11c523d 100644 --- a/src/strategy/shaman/CasterShamanStrategy.cpp +++ b/src/strategy/shaman/CasterShamanStrategy.cpp @@ -66,7 +66,9 @@ void CasterShamanStrategy::InitTriggers(std::vector& triggers) // 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("fire elemental totem", + NextAction::array(0, new NextAction("fire elemental totem", 32.0f), nullptr))); + triggers.push_back( new TriggerNode("medium mana", NextAction::array(0, new NextAction("thunderstorm", ACTION_HIGH + 1), nullptr))); diff --git a/src/strategy/shaman/HealShamanStrategy.cpp b/src/strategy/shaman/HealShamanStrategy.cpp index 7fda4651..ff305559 100644 --- a/src/strategy/shaman/HealShamanStrategy.cpp +++ b/src/strategy/shaman/HealShamanStrategy.cpp @@ -104,6 +104,11 @@ void HealShamanStrategy::InitTriggers(std::vector& triggers) triggers.push_back( new TriggerNode("medium mana", NextAction::array(0, new NextAction("mana tide totem", ACTION_HIGH + 5), NULL))); + triggers.push_back( + new TriggerNode("no fire totem", NextAction::array(0, new NextAction("flametongue totem", 7.0f), + new NextAction("searing totem", 6.0f), nullptr))); + triggers.push_back(new TriggerNode("fire elemental totem", + NextAction::array(0, new NextAction("fire elemental totem", 32.0f), 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 + 1), nullptr))); diff --git a/src/strategy/shaman/MeleeShamanStrategy.cpp b/src/strategy/shaman/MeleeShamanStrategy.cpp index bf51ba9b..d38c163a 100644 --- a/src/strategy/shaman/MeleeShamanStrategy.cpp +++ b/src/strategy/shaman/MeleeShamanStrategy.cpp @@ -83,9 +83,8 @@ void MeleeShamanStrategy::InitTriggers(std::vector& triggers) "no fire totem", NextAction::array(0, new NextAction("reach melee", 23.0f), new NextAction("magma totem", 22.0f), nullptr))); - triggers.push_back(new TriggerNode("fire elemental totem", - NextAction::array(0, new NextAction("reach melee", 33.0f), - new NextAction("fire elemental totem", 32.0f), nullptr))); + triggers.push_back(new TriggerNode( + "fire elemental totem", NextAction::array(0, new NextAction("fire elemental totem melee", 32.0f), nullptr))); triggers.push_back( new TriggerNode("no air totem", NextAction::array(0, new NextAction("windfury totem", 20.0f), nullptr))); diff --git a/src/strategy/shaman/ShamanActions.h b/src/strategy/shaman/ShamanActions.h index 2568cd11..c4f6ce38 100644 --- a/src/strategy/shaman/ShamanActions.h +++ b/src/strategy/shaman/ShamanActions.h @@ -7,6 +7,7 @@ #define _PLAYERBOT_SHAMANACTIONS_H #include "GenericSpellActions.h" +#include "Playerbots.h" #include "SharedDefines.h" class PlayerbotAI; @@ -426,6 +427,20 @@ public: virtual bool isUseful() override { return CastTotemAction::isUseful(); } }; +class CastFireElementalTotemMeleeAction : public CastTotemAction +{ +public: + CastFireElementalTotemMeleeAction(PlayerbotAI* ai) : CastTotemAction(ai, "fire elemental totem", "", 0.0f) {} + virtual std::string const GetTargetName() override { return "self target"; } + virtual bool isUseful() override + { + Unit* target = AI_VALUE(Unit*, "current target"); + if (!target || !bot->IsWithinMeleeRange(target)) + return false; + return CastTotemAction::isUseful(); + } +}; + class CastWrathOfAirTotemAction : public CastTotemAction { public: diff --git a/src/strategy/shaman/ShamanAiObjectContext.cpp b/src/strategy/shaman/ShamanAiObjectContext.cpp index f6dd9400..e67f4230 100644 --- a/src/strategy/shaman/ShamanAiObjectContext.cpp +++ b/src/strategy/shaman/ShamanAiObjectContext.cpp @@ -238,6 +238,7 @@ public: 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["fire elemental totem melee"] = &ShamanAiObjectContextInternal::fire_elemental_totem_melee; creators["totem of wrath"] = &ShamanAiObjectContextInternal::totem_of_wrath; creators["wrath of air totem"] = &ShamanAiObjectContextInternal::wrath_of_air_totem; creators["shamanistic rage"] = &ShamanAiObjectContextInternal::shamanistic_rage; @@ -318,6 +319,7 @@ private: 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* fire_elemental_totem_melee(PlayerbotAI* ai) { return new CastFireElementalTotemMeleeAction(ai); } static Action* wrath_of_air_totem(PlayerbotAI* ai) { return new CastWrathOfAirTotemAction(ai); } static Action* shamanistic_rage(PlayerbotAI* ai) { return new CastShamanisticRageAction(ai); } static Action* feral_spirit(PlayerbotAI* ai) { return new CastFeralSpiritAction(ai); } diff --git a/src/strategy/shaman/TotemsShamanStrategy.cpp b/src/strategy/shaman/TotemsShamanStrategy.cpp index cfa0c3be..f3346a5c 100644 --- a/src/strategy/shaman/TotemsShamanStrategy.cpp +++ b/src/strategy/shaman/TotemsShamanStrategy.cpp @@ -13,20 +13,13 @@ void TotemsShamanStrategy::InitTriggers(std::vector& triggers) { GenericShamanStrategy::InitTriggers(triggers); - triggers.push_back(new TriggerNode("fire elemental totem", - NextAction::array(0, new NextAction("fire elemental totem", 32.0f), nullptr))); - triggers.push_back( - new TriggerNode("no air totem", NextAction::array(0, new NextAction("wrath of air totem", 8.0f), NULL))); + new TriggerNode("no air totem", NextAction::array(0, new NextAction("wrath of air totem", 8.0f), nullptr))); triggers.push_back( new TriggerNode("no water totem", NextAction::array(0, new NextAction("mana spring totem", 7.0f), new NextAction("healing stream totem", 6.0f), nullptr))); - triggers.push_back( - new TriggerNode("no fire totem", NextAction::array(0, new NextAction("flametongue totem", 7.0f), - new NextAction("searing totem", 6.0f), nullptr))); - triggers.push_back(new TriggerNode("strength of earth totem", - NextAction::array(0, new NextAction("strength of earth totem", 6.0f), NULL))); + NextAction::array(0, new NextAction("strength of earth totem", 6.0f), nullptr))); }