Skip to content

Commit

Permalink
Scripts/Spells: Implement warlock talent Perpetual Unstability (Trini…
Browse files Browse the repository at this point in the history
  • Loading branch information
aquadeus authored Sep 7, 2024
1 parent c6af308 commit 5192f36
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sql/updates/world/master/2024_09_07_01_world.sql
Original file line number Diff line number Diff line change
@@ -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');
36 changes: 36 additions & 0 deletions src/server/scripts/Spells/spell_warlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5192f36

Please sign in to comment.