fix(Core/Spells): Master of Elements mana refund with Living Bomb and base cost calculation (#24775)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
blinkysc
2026-02-20 10:06:43 -06:00
committed by GitHub
parent 5a128c69d8
commit a757e306cf

View File

@@ -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)