From 404240fb6820ab997b65740b234305c4c654c543 Mon Sep 17 00:00:00 2001 From: ariel- Date: Mon, 12 Feb 2018 18:34:22 -0300 Subject: Core/Scripts: remove Tenacity hack, implemented with proper aura --- src/server/scripts/Northrend/zone_wintergrasp.cpp | 31 +++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index 045fe331275..fbbfd750aad 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -29,6 +29,7 @@ #include "ScriptedGossip.h" #include "ScriptSystem.h" #include "SpellAuras.h" +#include "SpellAuraEffects.h" #include "SpellScript.h" #include "Vehicle.h" #include "WorldSession.h" @@ -587,14 +588,40 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript { PrepareAuraScript(spell_wintergrasp_tenacity_refresh); - void Refresh(AuraEffect* /*aurEff*/) + bool Validate(SpellInfo const* spellInfo) override { - GetAura()->RefreshDuration(); + uint32 triggeredSpellId = spellInfo->Effects[EFFECT_2].CalcValue(); + return !triggeredSpellId || ValidateSpellInfo({ triggeredSpellId }); + } + + void Refresh(AuraEffect* aurEff) + { + if (uint32 triggeredSpellId = aurEff->GetAmount()) + { + int32 bp = 0; + if (AuraEffect const* healEffect = GetEffect(EFFECT_0)) + bp = healEffect->GetAmount(); + + CastSpellExtraArgs args(aurEff); + args + .AddSpellMod(SPELLVALUE_BASE_POINT0, bp) + .AddSpellMod(SPELLVALUE_BASE_POINT1, bp); + GetTarget()->CastSpell(nullptr, triggeredSpellId, args); + } + + RefreshDuration(); + } + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (uint32 triggeredSpellId = aurEff->GetAmount()) + GetTarget()->RemoveAurasDueToSpell(triggeredSpellId); } void Register() override { OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_wintergrasp_tenacity_refresh::Refresh, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_wintergrasp_tenacity_refresh::OnRemove, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; -- cgit v1.2.3