diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2024-12-08 20:27:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-08 20:27:07 +0100 |
commit | 794346bd42dada4923807e13246d982ce02bb49d (patch) | |
tree | ad2448a3dd242a5b30ee5539c2e67db6bb26c459 /src | |
parent | 752ea0f8e9a04abd53a3b811de2fbb91b689e69f (diff) |
Scripts/Spells: Fix demon hunter talent "Darkglare Boon" (#30496)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_dh.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index aa10a4e5b3e..329c30e1ea6 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -65,6 +65,8 @@ enum DemonHunterSpells SPELL_DH_CONSUME_SOUL_VENGEANCE = 208014, SPELL_DH_CONSUME_SOUL_VENGEANCE_DEMON = 210050, SPELL_DH_CONSUME_SOUL_VENGEANCE_SHATTERED = 210047, + SPELL_DH_DARKGLARE_BOON = 389708, + SPELL_DH_DARKGLARE_BOON_ENERGIZE = 391345, SPELL_DH_DARKNESS_ABSORB = 209426, SPELL_DH_DEMON_BLADES_DMG = 203796, SPELL_DH_DEMON_SPIKES = 203819, @@ -279,6 +281,55 @@ private: uint32 _healAmount = 0; }; +// Called by 212084 - Fel Devastation +class spell_dh_darkglare_boon : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!ValidateSpellInfo({ SPELL_DH_DARKGLARE_BOON_ENERGIZE, SPELL_DH_FEL_DEVASTATION }) + || !ValidateSpellEffect({ { SPELL_DH_DARKGLARE_BOON, EFFECT_3 } })) + return false; + + SpellInfo const* darkglareBoon = sSpellMgr->GetSpellInfo(SPELL_DH_DARKGLARE_BOON, DIFFICULTY_NONE); + return darkglareBoon->GetEffect(EFFECT_0).CalcValue() < darkglareBoon->GetEffect(EFFECT_1).CalcValue() + && darkglareBoon->GetEffect(EFFECT_2).CalcValue() < darkglareBoon->GetEffect(EFFECT_3).CalcValue(); + } + + bool Load() override + { + return GetUnitOwner()->HasAura(SPELL_DH_DARKGLARE_BOON); + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + // Tooltip mentions "fully channelled" being a requirement but ingame it always reduces cooldown and energizes, even when manually cancelled + //if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + // return; + + Unit* target = GetTarget(); + Aura const* darkglareBoon = target->GetAura(SPELL_DH_DARKGLARE_BOON); + + SpellHistory::Duration cooldown, categoryCooldown; + SpellHistory::GetCooldownDurations(GetSpellInfo(), 0, &cooldown, nullptr, &categoryCooldown); + int32 reductionPct = irand(darkglareBoon->GetEffect(EFFECT_0)->GetAmount(), darkglareBoon->GetEffect(EFFECT_1)->GetAmount()); + SpellHistory::Duration cooldownReduction(CalculatePct(std::max(cooldown, categoryCooldown).count(), reductionPct)); + + int32 energizeValue = irand(darkglareBoon->GetEffect(EFFECT_2)->GetAmount(), darkglareBoon->GetEffect(EFFECT_3)->GetAmount()); + + target->GetSpellHistory()->ModifyCooldown(SPELL_DH_FEL_DEVASTATION, -cooldownReduction); + + target->CastSpell(target, SPELL_DH_DARKGLARE_BOON_ENERGIZE, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .SpellValueOverrides = { { SPELLVALUE_BASE_POINT0, energizeValue } } + }); + } + + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_dh_darkglare_boon::HandleEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } +}; + // 209426 - Darkness class spell_dh_darkness : public AuraScript { @@ -691,6 +742,7 @@ void AddSC_demon_hunter_spell_scripts() RegisterSpellScript(spell_dh_chaos_strike); RegisterSpellScript(spell_dh_chaotic_transformation); RegisterSpellScript(spell_dh_charred_warblades); + RegisterSpellScript(spell_dh_darkglare_boon); RegisterSpellScript(spell_dh_darkness); RegisterSpellScript(spell_dh_eye_beam); RegisterSpellScript(spell_dh_sigil_of_chains); |