From e7448794057733f04d79319882323b7cebb36c6c Mon Sep 17 00:00:00 2001 From: Aqua Deus <95978183+aquadeus@users.noreply.github.com> Date: Thu, 21 Aug 2025 23:13:51 +0200 Subject: [PATCH] Scripts/Spells: Implement dh talent Critical Chaos (#30752) --- .../world/master/2025_08_21_00_world.sql | 3 +++ src/server/scripts/Spells/spell_dh.cpp | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 sql/updates/world/master/2025_08_21_00_world.sql diff --git a/sql/updates/world/master/2025_08_21_00_world.sql b/sql/updates/world/master/2025_08_21_00_world.sql new file mode 100644 index 00000000000..73eb6e20289 --- /dev/null +++ b/sql/updates/world/master/2025_08_21_00_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dh_critical_chaos'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(320413,'spell_dh_critical_chaos'); diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index d3d307bb75e..2f756e609af 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -534,6 +534,31 @@ class spell_dh_collective_anguish_eye_beam : public AuraScript } }; +// 320413 - Critical Chaos +class spell_dh_critical_chaos : public AuraScript +{ + void CalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool const& /*canBeRecalculated*/) const + { + if (AuraEffect const* amountHolder = GetEffect(EFFECT_1)) + { + float critChanceDone = GetUnitOwner()->GetUnitCriticalChanceDone(BASE_ATTACK); + amount = CalculatePct(critChanceDone, amountHolder->GetAmount()); + } + } + + void UpdatePeriodic(AuraEffect const* aurEff) const + { + if (AuraEffect* bonus = GetEffect(EFFECT_0)) + bonus->RecalculateAmount(aurEff); + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dh_critical_chaos::CalcAmount, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dh_critical_chaos::UpdatePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } +}; + // Called by 198013 - Eye Beam class spell_dh_cycle_of_hatred : public SpellScript { @@ -1718,6 +1743,7 @@ void AddSC_demon_hunter_spell_scripts() RegisterSpellScript(spell_dh_chaos_theory_drop_charge); RegisterSpellScript(spell_dh_chaotic_transformation); RegisterSpellScript(spell_dh_charred_warblades); + RegisterSpellScript(spell_dh_critical_chaos); RegisterSpellScript(spell_dh_collective_anguish); RegisterSpellScript(spell_dh_collective_anguish_eye_beam); RegisterSpellScript(spell_dh_cycle_of_hatred);