From c3e1f41bc2b71983f07d435550c18d535caf89a1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 May 2011 13:21:12 +0200 Subject: Scripts/Spells: Use more appropriate hook for Lifeblood calculations --- src/server/scripts/Spells/spell_generic.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 5424a2e59d6..126bb2e40f3 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1070,16 +1070,15 @@ class spell_gen_lifeblood : public SpellScriptLoader { PrepareAuraScript(spell_gen_lifeblood_AuraScript); - void HandleEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { - Unit * caster = GetCaster(); - - const_cast(aurEff)->SetAmount(aurEff->GetAmount() + CalculatePctF(caster->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks())); + if (Unit* owner = GetUnitOwner()) + amount += int32(CalculatePctF(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks())); } void Register() { - OnEffectApply += AuraEffectApplyFn(spell_gen_lifeblood_AuraScript::HandleEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_lifeblood_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); } }; -- cgit v1.2.3