From e33f0e06066a4a2501e60d011ebf4bc16c97649b Mon Sep 17 00:00:00 2001 From: ariel- Date: Mon, 23 Jan 2017 15:02:12 -0300 Subject: Core/Scripts: implement lightwell aura removal at 30% damaged Ref #18542 --- src/server/scripts/Spells/spell_priest.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/server/scripts/Spells') diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 7b3b6959c0a..86a8c376dc2 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -703,10 +703,37 @@ class spell_pri_lightwell_renew : public SpellScriptLoader } } + void InitializeAmount(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // Attacks done to you equal to 30% of your total health will cancel the effect + _remainingAmount = GetTarget()->CountPctFromMaxHealth(30); + } + + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo) + return; + + uint32 damage = damageInfo->GetDamage(); + if (_remainingAmount <= damage) + { + DropCharge(AURA_REMOVE_BY_ENEMY_SPELL); + return; + } + + _remainingAmount -= damage; + } + void Register() override { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_lightwell_renew_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + + AfterEffectApply += AuraEffectApplyFn(spell_pri_lightwell_renew_AuraScript::InitializeAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectProc += AuraEffectProcFn(spell_pri_lightwell_renew_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); } + + uint32 _remainingAmount = 0; }; AuraScript* GetAuraScript() const override -- cgit v1.2.3