Scripts/Spells: Implement dh talent Critical Chaos (#30752)

This commit is contained in:
Aqua Deus
2025-08-21 23:13:51 +02:00
committed by GitHub
parent d4e9fea433
commit e744879405
2 changed files with 29 additions and 0 deletions

View File

@@ -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');

View File

@@ -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);