aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Northrend/zone_wintergrasp.cpp31
1 files changed, 29 insertions, 2 deletions
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);
}
};