From 1967b63bc11aa4ed2c3b6b3fc8ffbc45377345eb Mon Sep 17 00:00:00 2001 From: Crow Date: Fri, 24 Apr 2026 16:04:21 -0500 Subject: [PATCH] Cleanups for Shaman weapon enchant refactor (#2315) ## Pull Request Description I forgot to include some clean-ups relating to the recent commit to refactor Shaman weapon enchants. This is just deleting some now unneeded code and cleaning up a bit of other code. ## Feature Evaluation - Describe the **minimum logic** required to achieve the intended behavior. - Describe the **processing cost** when this logic executes across many bots. ## How to Test the Changes ## 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**) - 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 --------- Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com> Co-authored-by: bash Co-authored-by: Revision Co-authored-by: kadeshar --- src/Ai/Base/Value/ItemForSpellValue.cpp | 17 ----------------- src/Ai/Base/Value/SpellCastUsefulValue.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/Ai/Base/Value/ItemForSpellValue.cpp b/src/Ai/Base/Value/ItemForSpellValue.cpp index e14549da4..2cefe9062 100644 --- a/src/Ai/Base/Value/ItemForSpellValue.cpp +++ b/src/Ai/Base/Value/ItemForSpellValue.cpp @@ -48,23 +48,6 @@ Item* ItemForSpellValue::Calculate() } } - // Workaround as some spells have no item mask (e.g. shaman weapon enhancements) - if (!strcmpi(spellInfo->SpellName[0], "rockbiter weapon") || - !strcmpi(spellInfo->SpellName[0], "flametongue weapon") || - !strcmpi(spellInfo->SpellName[0], "earthliving weapon") || - !strcmpi(spellInfo->SpellName[0], "frostbrand weapon") || !strcmpi(spellInfo->SpellName[0], "windfury weapon")) - { - itemForSpell = GetItemFitsToSpellRequirements(EQUIPMENT_SLOT_MAINHAND, spellInfo); - if (itemForSpell && itemForSpell->GetTemplate()->Class == ITEM_CLASS_WEAPON) - return itemForSpell; - - itemForSpell = GetItemFitsToSpellRequirements(EQUIPMENT_SLOT_OFFHAND, spellInfo); - if (itemForSpell && itemForSpell->GetTemplate()->Class == ITEM_CLASS_WEAPON) - return itemForSpell; - - return nullptr; - } - if (!(spellInfo->Targets & TARGET_FLAG_ITEM)) return nullptr; diff --git a/src/Ai/Base/Value/SpellCastUsefulValue.cpp b/src/Ai/Base/Value/SpellCastUsefulValue.cpp index 9fa85b3a1..6841335d5 100644 --- a/src/Ai/Base/Value/SpellCastUsefulValue.cpp +++ b/src/Ai/Base/Value/SpellCastUsefulValue.cpp @@ -40,13 +40,13 @@ bool SpellCastUsefulValue::Calculate() return false; } - // TODO: workaround - if (qualifier == "windfury weapon" || qualifier == "flametongue weapon" || qualifier == "frostbrand weapon" || - qualifier == "rockbiter weapon" || qualifier == "earthliving weapon" || qualifier == "spellstone") + if (qualifier == "windfury weapon" || qualifier == "flametongue weapon" || + qualifier == "frostbrand weapon" || qualifier == "rockbiter weapon" || + qualifier == "earthliving weapon" || qualifier == "spellstone") { - if (Item* item = AI_VALUE2(Item*, "item for spell", spellid)) - if (item->IsInWorld() && item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) - return false; + if (Item* item = AI_VALUE2(Item*, "item for spell", spellid); + item && item->IsInWorld() && item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) + return false; } std::set& skipSpells = AI_VALUE(std::set&, "skip spells list");