diff --git a/sql/updates/world/master/2024_09_07_01_world.sql b/sql/updates/world/master/2024_09_07_01_world.sql new file mode 100644 index 0000000000000..5008e78a006af --- /dev/null +++ b/sql/updates/world/master/2024_09_07_01_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_perpetual_unstability'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(316099, 'spell_warl_perpetual_unstability'); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 5fe05f47b7040..3c7fdd5433974 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -58,6 +58,8 @@ enum WarlockSpells SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R2 = 18704, + SPELL_WARLOCK_PERPETUAL_UNSTABILITY_TALENT = 459376, + SPELL_WARLOCK_PERPETUAL_UNSTABILITY_DAMAGE = 459461, SPELL_WARLOCK_RAIN_OF_FIRE = 5740, SPELL_WARLOCK_RAIN_OF_FIRE_DAMAGE = 42223, SPELL_WARLOCK_SEED_OF_CORRUPTION_DAMAGE = 27285, @@ -535,6 +537,39 @@ class spell_warl_immolate : public SpellScript } }; +// Called by 316099 - Unstable Affliction +// 459376 - Perpetual Unstability +class spell_warl_perpetual_unstability : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_WARLOCK_PERPETUAL_UNSTABILITY_TALENT, SPELL_WARLOCK_PERPETUAL_UNSTABILITY_DAMAGE }); + } + + void TriggerExplosion() const + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + if (AuraEffect const* perpetualUnstability = caster->GetAuraEffect(SPELL_WARLOCK_PERPETUAL_UNSTABILITY_TALENT, EFFECT_0)) + { + if (Aura const* unstableAfflictionAura = target->GetAura(GetSpellInfo()->Id, caster->GetGUID())) + { + Milliseconds maxUnstableAfflictionDuration = Seconds(perpetualUnstability->GetAmount()); + if (Milliseconds(unstableAfflictionAura->GetDuration()) <= maxUnstableAfflictionDuration) + caster->CastSpell(target, SPELL_WARLOCK_PERPETUAL_UNSTABILITY_DAMAGE, CastSpellExtraArgs() + .SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR) + .SetTriggeringSpell(GetSpell())); + } + } + } + + void Register() override + { + OnHit += SpellHitFn(spell_warl_perpetual_unstability::TriggerExplosion); + } +}; + // 5740 - Rain of Fire /// Updated 11.0.2 class spell_warl_rain_of_fire : public AuraScript @@ -1241,6 +1276,7 @@ void AddSC_warlock_spell_scripts() RegisterSpellScript(spell_warl_health_funnel); RegisterSpellScript(spell_warl_healthstone_heal); RegisterSpellScript(spell_warl_immolate); + RegisterSpellScript(spell_warl_perpetual_unstability); RegisterSpellScript(spell_warl_rain_of_fire); RegisterSpellScript(spell_warl_random_sayaad); RegisterSpellScript(spell_warl_sayaad_precast_disorientation);