From c197a59eb394d8c9dfb932e9cfd60787cc81746d Mon Sep 17 00:00:00 2001 From: Aqua Deus <95978183+aquadeus@users.noreply.github.com> Date: Sun, 29 Dec 2024 21:04:04 +0100 Subject: [PATCH 1/2] Scripts/Spells: Implement demon hunter talent "Last Resort" (#30500) --- .../world/master/2024_12_29_03_world.sql | 3 ++ src/server/scripts/Spells/spell_dh.cpp | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 sql/updates/world/master/2024_12_29_03_world.sql diff --git a/sql/updates/world/master/2024_12_29_03_world.sql b/sql/updates/world/master/2024_12_29_03_world.sql new file mode 100644 index 0000000000000..1e04cd19ac6bc --- /dev/null +++ b/sql/updates/world/master/2024_12_29_03_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_last_resort'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(209258, 'spell_dh_last_resort'); diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index 54df607a267e8..1820cae34eb45 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -727,6 +727,40 @@ class spell_dh_furious_gaze : public AuraScript } }; +// 209258 - Last Resort +class spell_dh_last_resort : public AuraScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ SPELL_DH_UNCONTAINED_FEL, SPELL_DH_METAMORPHOSIS_VENGEANCE_TRANSFORM }) + && ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }); + } + + void HandleAbsorb(AuraEffect const* /*aurEff*/, DamageInfo const& /*dmgInfo*/, uint32& absorbAmount) + { + Unit* target = GetTarget(); + if (target->HasAura(SPELL_DH_UNCONTAINED_FEL)) + { + absorbAmount = 0; + return; + } + + PreventDefaultAction(); + + CastSpellExtraArgs castArgs = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR | TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD; + + target->CastSpell(target, SPELL_DH_METAMORPHOSIS_VENGEANCE_TRANSFORM, castArgs); + target->CastSpell(target, SPELL_DH_UNCONTAINED_FEL, castArgs); + + target->SetHealth(target->CountPctFromMaxHealth(GetEffectInfo(EFFECT_1).CalcValue(target))); + } + + void Register() override + { + OnEffectAbsorb += AuraEffectAbsorbOverkillFn(spell_dh_last_resort::HandleAbsorb, EFFECT_0); + } +}; + // 188499 - Blade Dance // 210152 - Death Sweep class spell_dh_blade_dance : public SpellScript @@ -1058,6 +1092,7 @@ void AddSC_demon_hunter_spell_scripts() RegisterSpellScript(spell_dh_felblade_charge); RegisterSpellScript(spell_dh_felblade_cooldown_reset_proc); RegisterSpellScript(spell_dh_furious_gaze); + RegisterSpellScript(spell_dh_last_resort); RegisterSpellScript(spell_dh_sigil_of_chains); RegisterSpellScript(spell_dh_tactical_retreat); RegisterSpellScript(spell_dh_vengeful_retreat_damage); From ae28344083a510c5007ae6813e2e85ad2e155f33 Mon Sep 17 00:00:00 2001 From: Aqua Deus <95978183+aquadeus@users.noreply.github.com> Date: Sun, 29 Dec 2024 22:56:24 +0100 Subject: [PATCH 2/2] Scripts/Spells: Implement demon hunter talent "Shattered Destiny" (#30536) --- .../world/master/2024_12_29_04_world.sql | 3 ++ src/server/scripts/Spells/spell_dh.cpp | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 sql/updates/world/master/2024_12_29_04_world.sql diff --git a/sql/updates/world/master/2024_12_29_04_world.sql b/sql/updates/world/master/2024_12_29_04_world.sql new file mode 100644 index 0000000000000..31c8b465c40d3 --- /dev/null +++ b/sql/updates/world/master/2024_12_29_04_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_shattered_destiny'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(388116, 'spell_dh_shattered_destiny'); diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index 1820cae34eb45..adfa2b7ab107c 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);