From 04f8b0dd13d914d4bc4fbbaba4f388b4beced895 Mon Sep 17 00:00:00 2001 From: kadeshar Date: Fri, 24 Apr 2026 23:03:57 +0200 Subject: [PATCH] Stat weights fix (#2313) ## Pull Request Description Added support for Warlock stat weights when he dont have Fel Armor. Fixed Mage weights when he dont have Molten Armor ## How to Test the Changes 1. Invite mage which dont have Molten Armor (level < 62) or warlock which dont have Fel 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? - - [x] No - - [ ] Yes (**explain why**) Mage and Warlock before getting Molten Armor/Fel 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? - - [x] No - - [ ] Yes (**explain below**) ## 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 --- src/Mgr/Item/StatsWeightCalculator.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Mgr/Item/StatsWeightCalculator.cpp b/src/Mgr/Item/StatsWeightCalculator.cpp index b3b593606..faa06ff0f 100644 --- a/src/Mgr/Item/StatsWeightCalculator.cpp +++ b/src/Mgr/Item/StatsWeightCalculator.cpp @@ -25,6 +25,10 @@ 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; +constexpr uint32 SPELL_FEL_ARMOR_RANK_1 = 28176; +constexpr uint32 SPELL_FEL_ARMOR_RANK_2 = 28189; +constexpr uint32 SPELL_FEL_ARMOR_RANK_3 = 47892; +constexpr uint32 SPELL_FEL_ARMOR_RANK_4 = 47893; } StatsWeightCalculator::StatsWeightCalculator(Player* player) : player_(player) @@ -467,10 +471,18 @@ void StatsWeightCalculator::GenerateAdditionalWeights(Player* player) && !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; + if (tab != MAGE_TAB_FIRE) + stats_weights_[STATS_TYPE_SPIRIT] -= 0.6f; + else + stats_weights_[STATS_TYPE_SPIRIT] -= 0.7f; } } + else if (cls == CLASS_WARLOCK) + { + if (!player->HasSpell(SPELL_FEL_ARMOR_RANK_1) && !player->HasSpell(SPELL_FEL_ARMOR_RANK_2) && + !player->HasSpell(SPELL_FEL_ARMOR_RANK_3) && !player->HasSpell(SPELL_FEL_ARMOR_RANK_4)) + stats_weights_[STATS_TYPE_SPIRIT] -= 0.4f; + } } void StatsWeightCalculator::CalculateItemSetMod(Player* player, ItemTemplate const* proto)