diff options
-rw-r--r-- | sql/updates/world/master/2024_12_08_00_world.sql | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_dh.cpp | 52 |
2 files changed, 55 insertions, 0 deletions
diff --git a/sql/updates/world/master/2024_12_08_00_world.sql b/sql/updates/world/master/2024_12_08_00_world.sql new file mode 100644 index 00000000000..d4e65c2f745 --- /dev/null +++ b/sql/updates/world/master/2024_12_08_00_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_darkglare_boon'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(212084, 'spell_dh_darkglare_boon'); 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); |