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
committerariel- <ariel-@users.noreply.github.com>2017-12-15 00:37:12 -0300
commit16e20711d277bc43ae3ac350208df73827306ea6 (patch)
tree3b49536b5dce44886127b92e683deb6b1794bdb3 /src/server/scripts/Spells
parent0510bf7afe9fa5ded572cda00f5a5a989a887146 (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
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 05fbc6b3423..bc3ce8a88a7 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -2454,6 +2454,84 @@ 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()->Effects[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()->Effects[EFFECT_1].IsEffect() && !GetSpellInfo()->Effects[EFFECT_2].IsEffect();
+ 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
+// 71317 - 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,
@@ -3648,6 +3726,9 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_profession_research);
RegisterSpellScript(spell_gen_remove_flight_auras);
RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura);
+ 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);