diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_dh.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index 1820cae34eb..adfa2b7ab10 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -26,6 +26,7 @@ #include "DB2Stores.h" #include "Player.h" #include "ScriptMgr.h" +#include "Spell.h" #include "SpellAuraEffects.h" #include "SpellAuras.h" #include "SpellHistory.h" @@ -913,6 +914,51 @@ class spell_dh_glide_timer : public AuraScript } }; +// 388116 - Shattered Destiny +class spell_dh_shattered_destiny : public AuraScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ SPELL_DH_METAMORPHOSIS_TRANSFORM }) + && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }) + && spellInfo->GetEffect(EFFECT_0).IsAura() + && spellInfo->GetEffect(EFFECT_1).IsAura(); + } + + bool CheckFurySpent(ProcEventInfo const& eventInfo) + { + Spell const* procSpell = eventInfo.GetProcSpell(); + if (!procSpell) + return false; + + if (!eventInfo.GetActor()->HasAura(SPELL_DH_METAMORPHOSIS_TRANSFORM)) + return false; + + _furySpent += procSpell->GetPowerTypeCostAmount(POWER_FURY).value_or(0); + return _furySpent >= GetEffect(EFFECT_1)->GetAmount(); + } + + void HandleProc(ProcEventInfo const& /*eventInfo*/) + { + Aura* metamorphosis = GetTarget()->GetAura(SPELL_DH_METAMORPHOSIS_TRANSFORM); + if (!metamorphosis) + return; + + int32 requiredFuryAmount = GetEffect(EFFECT_1)->GetAmount(); + metamorphosis->SetDuration(metamorphosis->GetDuration() + _furySpent / requiredFuryAmount * GetEffect(EFFECT_0)->GetAmount()); + _furySpent %= requiredFuryAmount; + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_dh_shattered_destiny::CheckFurySpent); + OnProc += AuraProcFn(spell_dh_shattered_destiny::HandleProc); + } + +private: + int32 _furySpent = 0; +}; + // 391166 - Soul Furnace class spell_dh_soul_furnace : public AuraScript { @@ -1093,6 +1139,7 @@ void AddSC_demon_hunter_spell_scripts() RegisterSpellScript(spell_dh_felblade_cooldown_reset_proc); RegisterSpellScript(spell_dh_furious_gaze); RegisterSpellScript(spell_dh_last_resort); + RegisterSpellScript(spell_dh_shattered_destiny); RegisterSpellScript(spell_dh_sigil_of_chains); RegisterSpellScript(spell_dh_tactical_retreat); RegisterSpellScript(spell_dh_vengeful_retreat_damage); |