diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_dh.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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); |