From e0b1c3b2092eee891d0d4209f31b8743094ec899 Mon Sep 17 00:00:00 2001 From: Aqua Deus <95978183+aquadeus@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:29:11 +0100 Subject: Scripts/Spells: Implement demon hunter talent "Know Your Enemy" (#30553) --- src/server/scripts/Spells/spell_dh.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index d1b4bb0687e..5c803d6e47d 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -899,6 +899,31 @@ struct at_dh_inner_demon : AreaTriggerAI } }; +// 388118 - Know Your Enemy +class spell_dh_know_your_enemy : 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_know_your_enemy::CalcAmount, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dh_know_your_enemy::UpdatePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY); + } +}; + // 209258 - Last Resort class spell_dh_last_resort : public AuraScript { @@ -1349,6 +1374,7 @@ void AddSC_demon_hunter_spell_scripts() RegisterSpellScript(spell_dh_furious_gaze); RegisterSpellScript(spell_dh_inner_demon); RegisterAreaTriggerAI(at_dh_inner_demon); + RegisterSpellScript(spell_dh_know_your_enemy); RegisterSpellScript(spell_dh_last_resort); RegisterSpellScript(spell_dh_restless_hunter); RegisterSpellScript(spell_dh_shattered_destiny); -- cgit v1.2.3