diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2017-01-23 15:02:12 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2017-01-23 15:02:12 -0300 |
| commit | e33f0e06066a4a2501e60d011ebf4bc16c97649b (patch) | |
| tree | 24665e675bf565a521606d8c09a7b3e2a2a0b002 /src | |
| parent | 9442ce888cd9c89b4b983d4634c301f6c9db396a (diff) | |
Core/Scripts: implement lightwell aura removal at 30% damaged
Ref #18542
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
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 |
