From 74ccc6fbe99cffe4bc1c860ede0997af6eb1e4ee Mon Sep 17 00:00:00 2001 From: kadeshar Date: Sat, 11 Apr 2026 07:16:28 +0200 Subject: [PATCH] Mage additional stat weight (#2299) ## Pull Request Description Mage before getting Molten Armor dont prioritize Spirit before Intellect ## How to Test the Changes 1. Invite mage which dont have Molten Armor (level < 62) 2. Give him 2 items for same slot one with spirit one with intellect and unequip item on this slot and destroy 3. Bot should equip this with intellect (if other stats are same) ## Impact Assessment - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [ ] No - - [x] Yes (**explain why**) Mage before getting Molten Armor dont prioritize Spirit before Intellect - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## AI Assistance Was AI assistance used while working on this change? - - [ ] No - - [x] Yes (**explain below**) To find best spot to change stat weights depending of class and HasSpell. ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Any new bot dialogue lines are translated. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers Example stat weights when using Molten Armor (Fire P1 Preset) obraz Example stat weight when using Mage Armor (Fire P1 Preset) obraz --- src/Mgr/Item/StatsWeightCalculator.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Mgr/Item/StatsWeightCalculator.cpp b/src/Mgr/Item/StatsWeightCalculator.cpp index 1b3f3dcfc..361e4a5f7 100644 --- a/src/Mgr/Item/StatsWeightCalculator.cpp +++ b/src/Mgr/Item/StatsWeightCalculator.cpp @@ -20,6 +20,13 @@ #include "StatsCollector.h" #include "Unit.h" +namespace +{ +constexpr uint32 SPELL_MOLTEN_ARMOR_RANK_1 = 30482; +constexpr uint32 SPELL_MOLTEN_ARMOR_RANK_2 = 43045; +constexpr uint32 SPELL_MOLTEN_ARMOR_RANK_3 = 43046; +} + StatsWeightCalculator::StatsWeightCalculator(Player* player) : player_(player) { if (PlayerbotAI::IsHeal(player)) @@ -454,6 +461,16 @@ void StatsWeightCalculator::GenerateAdditionalWeights(Player* player) if (player->HasAura(51885)) stats_weights_[STATS_TYPE_INTELLECT] += 1.1f; } + else if (cls == CLASS_MAGE) + { + if (!player->HasSpell(SPELL_MOLTEN_ARMOR_RANK_1) + && !player->HasSpell(SPELL_MOLTEN_ARMOR_RANK_2) + && !player->HasSpell(SPELL_MOLTEN_ARMOR_RANK_3)) + { + stats_weights_[STATS_TYPE_INTELLECT] += 0.2f; + stats_weights_[STATS_TYPE_SPIRIT] -= 0.0f; + } + } } void StatsWeightCalculator::CalculateItemSetMod(Player* player, ItemTemplate const* proto)