Scripts/Spells: Implement warlock talent Perpetual Unstability (#30162)

This commit is contained in:
Aqua Deus
2024-09-07 19:48:37 +02:00
committed by GitHub
parent c6af3087d0
commit 5192f36a0d
2 changed files with 39 additions and 0 deletions

View File

@@ -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');

View File

@@ -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);