void HandleDispel(DispelInfo dispelInfo) { Unit target = GetUnitOwner(); if (target != null) { AuraEffect aurEff = GetEffect(1); if (aurEff != null) { // final heal uint healAmount = (uint)aurEff.GetAmount(); Unit caster = GetCaster(); if (caster != null) { healAmount = caster.SpellHealingBonusDone(target, GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), dispelInfo.GetRemovedCharges()); healAmount = target.SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), dispelInfo.GetRemovedCharges()); target.CastCustomSpell(target, SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, null, GetCasterGUID()); // restore mana var costs = GetSpellInfo().CalcPowerCost(caster, GetSpellInfo().GetSchoolMask()); var m = costs.Find(cost => cost.Power == PowerType.Mana); if (m != null) { int returnMana = m.Amount * dispelInfo.GetRemovedCharges() / 2; caster.CastCustomSpell(caster, SpellIds.LifebloomEnergize, returnMana, 0, 0, true, null, null, GetCasterGUID()); } return; } target.CastCustomSpell(target, SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, null, GetCasterGUID()); } } }
void AfterRemove(AuraEffect aurEff, AuraEffectHandleModes mode) { // Final heal only on duration end if (GetTargetApplication().GetRemoveMode() != AuraRemoveMode.Expire) { return; } // final heal uint stack = GetStackAmount(); uint healAmount = (uint)aurEff.GetAmount(); Unit caster = GetCaster(); if (caster != null) { healAmount = caster.SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), stack); healAmount = GetTarget().SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, DamageEffectType.Heal, aurEff.GetSpellEffectInfo(), stack); GetTarget().CastCustomSpell(GetTarget(), SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, aurEff, GetCasterGUID()); // restore mana var costs = GetSpellInfo().CalcPowerCost(caster, GetSpellInfo().GetSchoolMask()); var m = costs.Find(cost => cost.Power == PowerType.Mana); if (m != null) { int returnMana = m.Amount * (int)stack / 2; caster.CastCustomSpell(caster, SpellIds.LifebloomEnergize, returnMana, 0, 0, true, null, aurEff, GetCasterGUID()); } return; } GetTarget().CastCustomSpell(GetTarget(), SpellIds.LifebloomFinalHeal, (int)healAmount, 0, 0, true, null, aurEff, GetCasterGUID()); }