From a757e306cfeb268f987a0b29b88e8dcd25abe4b8 Mon Sep 17 00:00:00 2001 From: blinkysc <37940565+blinkysc@users.noreply.github.com> Date: Fri, 20 Feb 2026 10:06:43 -0600 Subject: [PATCH] fix(Core/Spells): Master of Elements mana refund with Living Bomb and base cost calculation (#24775) Co-authored-by: blinkysc --- src/server/scripts/Spells/spell_mage.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 11b2f4bbf..67cfc1bf1 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -70,7 +70,8 @@ enum MageSpells SPELL_MAGE_CHILLED_R2 = 12485, SPELL_MAGE_CHILLED_R3 = 12486, SPELL_MAGE_MANA_SURGE = 37445, - SPELL_MAGE_FROST_NOVA = 122 + SPELL_MAGE_FROST_NOVA = 122, + SPELL_MAGE_LIVING_BOMB_R1 = 44457 }; enum MageSpellIcons @@ -807,7 +808,7 @@ class spell_mage_master_of_elements : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo({ SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE }); + return ValidateSpellInfo({ SPELL_MAGE_MASTER_OF_ELEMENTS_ENERGIZE, SPELL_MAGE_LIVING_BOMB_R1 }); } bool CheckProc(ProcEventInfo& eventInfo) @@ -823,7 +824,23 @@ class spell_mage_master_of_elements : public AuraScript { PreventDefaultAction(); - int32 mana = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask()); + SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo(); + + // Living Bomb explosion has no mana cost, use the aura spell's cost instead + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE + && spellInfo->SpellIconID == MAGE_ICON_LIVING_BOMB + && !spellInfo->ManaCost && !spellInfo->ManaCostPercentage) + { + uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id); + spellInfo = sSpellMgr->GetSpellInfo( + sSpellMgr->GetSpellWithRank(SPELL_MAGE_LIVING_BOMB_R1, rank)); + if (!spellInfo) + return; + } + + // Use base mana cost (ManaCost + ManaCostPercentage) without spell mods, + // as the talent refunds based on "base mana cost" + int32 mana = spellInfo->ManaCost + int32(CalculatePct(GetTarget()->GetCreateMana(), spellInfo->ManaCostPercentage)); mana = CalculatePct(mana, aurEff->GetAmount()); if (mana > 0)