aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-12-14 13:39:05 -0300
committerfunjoker <funjoker109@gmail.com>2021-03-15 20:17:31 +0100
commit97e869e8b36afd9e7f0452b9001287f6b4a02ef2 (patch)
tree1ff3293a43a66744da16506fac7a93de96bb030a /src/server/scripts/Spells
parentfd786c03a369b60bd29773e19f4213fd2e01624b (diff)
Core/Auras: periodics refactor part 3: move more switch hacks to scripts
- Incidentally fixed some spells which were supposed to be removed by proc instead of healing to full (cherry picked from commit 16e20711d277bc43ae3ac350208df73827306ea6)
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index d1f1e6c7e18..d3a080b2c74 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -2264,6 +2264,83 @@ class spell_gen_remove_flight_auras : public SpellScript
}
};
+// 38772 Grievous Wound
+// 43937 Grievous Wound
+// 62331 Impale
+// 62418 Impale
+class spell_gen_remove_on_health_pct : public AuraScript
+{
+ PrepareAuraScript(spell_gen_remove_on_health_pct);
+
+ void PeriodicTick(AuraEffect const* /*aurEff*/)
+ {
+ // they apply damage so no need to check for ticks here
+
+ if (GetTarget()->HealthAbovePct(GetSpellInfo()->GetEffect(EFFECT_1)->CalcValue()))
+ {
+ Remove(AURA_REMOVE_BY_ENEMY_SPELL);
+ PreventDefaultAction();
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_remove_on_health_pct::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+};
+
+// 31956 Grievous Wound
+// 38801 Grievous Wound
+// 43093 Grievous Throw
+// 58517 Grievous Wound
+// 59262 Grievous Wound
+class spell_gen_remove_on_full_health : public AuraScript
+{
+ PrepareAuraScript(spell_gen_remove_on_full_health);
+
+ void PeriodicTick(AuraEffect const* aurEff)
+ {
+ // if it has only periodic effect, allow 1 tick
+ bool onlyEffect = (GetSpellInfo()->GetEffects().size() == 1);
+ if (onlyEffect && aurEff->GetTickNumber() <= 1)
+ return;
+
+ if (GetTarget()->IsFullHealth())
+ {
+ Remove(AURA_REMOVE_BY_ENEMY_SPELL);
+ PreventDefaultAction();
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_remove_on_full_health::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+};
+
+// 70292 - Glacial Strike
+// 71316 - Glacial Strike
+class spell_gen_remove_on_full_health_pct : public AuraScript
+{
+ PrepareAuraScript(spell_gen_remove_on_full_health_pct);
+
+ void PeriodicTick(AuraEffect const* /*aurEff*/)
+ {
+ // they apply damage so no need to check for ticks here
+
+ if (GetTarget()->IsFullHealth())
+ {
+ Remove(AURA_REMOVE_BY_ENEMY_SPELL);
+ PreventDefaultAction();
+ }
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_remove_on_full_health_pct::PeriodicTick, EFFECT_2, SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
+ }
+};
+
enum Replenishment
{
SPELL_REPLENISHMENT = 57669,
@@ -3765,6 +3842,9 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_two_forms);
RegisterSpellScript(spell_gen_darkflight);
/* */
+ RegisterAuraScript(spell_gen_remove_on_health_pct);
+ RegisterAuraScript(spell_gen_remove_on_full_health);
+ RegisterAuraScript(spell_gen_remove_on_full_health_pct);
RegisterSpellScript(spell_gen_seaforium_blast);
RegisterSpellScript(spell_gen_spectator_cheer_trigger);
RegisterSpellScript(spell_gen_spirit_healer_res);