diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2025-03-11 19:23:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-11 19:23:24 +0100 |
commit | 3ae9dfd4f52192dde3b6415fef756b746d12860b (patch) | |
tree | bc827762127aec95489127c4f0df46882e2579f2 | |
parent | 44b51616a5d6c005e33899aa5e91319965e6d9dc (diff) |
Scripts/Spells: Update Cycle of Hatred talent for patch 11.1 (#30721)
-rw-r--r-- | sql/updates/world/master/2025_03_11_00_world.sql | 5 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_dh.cpp | 80 |
2 files changed, 72 insertions, 13 deletions
diff --git a/sql/updates/world/master/2025_03_11_00_world.sql b/sql/updates/world/master/2025_03_11_00_world.sql new file mode 100644 index 00000000000..4324d10e541 --- /dev/null +++ b/sql/updates/world/master/2025_03_11_00_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dh_cycle_of_hatred', 'spell_dh_cycle_of_hatred_talent', 'spell_dh_cycle_of_hatred_remove_stacks'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(198013, 'spell_dh_cycle_of_hatred'), +(258887, 'spell_dh_cycle_of_hatred_talent'), +(1214890, 'spell_dh_cycle_of_hatred_remove_stacks'); diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index eb91f1d1a46..9bdea0bfd49 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -78,7 +78,9 @@ enum DemonHunterSpells SPELL_DH_CONSUME_SOUL_VENGEANCE = 208014, SPELL_DH_CONSUME_SOUL_VENGEANCE_DEMON = 210050, SPELL_DH_CONSUME_SOUL_VENGEANCE_SHATTERED = 210047, - SPELL_DH_CYCLE_OF_HATRED = 258887, + SPELL_DH_CYCLE_OF_HATRED_TALENT = 258887, + SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION = 1214887, + SPELL_DH_CYCLE_OF_HATRED_REMOVE_STACKS = 1214890, SPELL_DH_DARKGLARE_BOON = 389708, SPELL_DH_DARKGLARE_BOON_ENERGIZE = 391345, SPELL_DH_DARKNESS_ABSORB = 209426, @@ -507,35 +509,85 @@ class spell_dh_collective_anguish_eye_beam : public AuraScript } }; -// Called by 188499 - Blade Dance, 162794 - Chaos Strike, 185123 - Throw Glaive and 342817 - Glaive Tempest +// Called by 198013 - Eye Beam class spell_dh_cycle_of_hatred : public SpellScript { bool Validate(SpellInfo const* /*spellInfo*/) override { - return ValidateSpellInfo({ SPELL_DH_CYCLE_OF_HATRED }); + return ValidateSpellInfo({ SPELL_DH_CYCLE_OF_HATRED_TALENT, SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION, SPELL_DH_CYCLE_OF_HATRED_REMOVE_STACKS }); } bool Load() override { - if (!GetCaster()->HasAura(SPELL_DH_CYCLE_OF_HATRED)) - return false; + return GetCaster()->HasAuraEffect(SPELL_DH_CYCLE_OF_HATRED_TALENT, EFFECT_0); + } + + void HandleCycleOfHatred() const + { + Unit* caster = GetCaster(); + + // First calculate cooldown then add another stack + uint32 cycleOfHatredStack = caster->GetAuraCount(SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION); + AuraEffect const* cycleOfHatred = caster->GetAuraEffect(SPELL_DH_CYCLE_OF_HATRED_TALENT, EFFECT_0); + caster->GetSpellHistory()->ModifyCooldown(GetSpellInfo(), -Milliseconds(cycleOfHatred->GetAmount() * cycleOfHatredStack)); - if (GetSpellInfo()->Id != SPELL_DH_THROW_GLAIVE) - return true; + CastSpellExtraArgs args; + args.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + args.SetTriggeringSpell(GetSpell()); - // Throw Glaive triggers this talent only with Furious Throws - return GetCaster()->HasAura(SPELL_DH_FURIOUS_THROWS); + caster->CastSpell(caster, SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION, args); + caster->CastSpell(caster, SPELL_DH_CYCLE_OF_HATRED_REMOVE_STACKS, args); } - void ReduceEyeBeamCooldown() const + void Register() override + { + AfterCast += SpellCastFn(spell_dh_cycle_of_hatred::HandleCycleOfHatred); + } +}; + +// 1214890 - Cycle of Hatred +class spell_dh_cycle_of_hatred_remove_stacks : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION }); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + if (Aura* aura = GetTarget()->GetAura(SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION)) + aura->SetStackAmount(1); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_dh_cycle_of_hatred_remove_stacks::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 258887 - Cycle of Hatred +class spell_dh_cycle_of_hatred_talent : public AuraScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION }); + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + Unit* target = GetTarget(); + target->CastSpell(target, SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const { - if (AuraEffect const* aurEff = GetCaster()->GetAuraEffect(SPELL_DH_CYCLE_OF_HATRED, EFFECT_0)) - GetCaster()->GetSpellHistory()->ModifyCooldown(SPELL_DH_EYE_BEAM, Milliseconds(-aurEff->GetAmount())); + GetTarget()->RemoveAurasDueToSpell(SPELL_DH_CYCLE_OF_HATRED_COOLDOWN_REDUCTION); } void Register() override { - AfterCast += SpellCastFn(spell_dh_cycle_of_hatred::ReduceEyeBeamCooldown); + AfterEffectApply += AuraEffectApplyFn(spell_dh_cycle_of_hatred_talent::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_dh_cycle_of_hatred_talent::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; @@ -1564,6 +1616,8 @@ void AddSC_demon_hunter_spell_scripts() RegisterSpellScript(spell_dh_collective_anguish); RegisterSpellScript(spell_dh_collective_anguish_eye_beam); RegisterSpellScript(spell_dh_cycle_of_hatred); + RegisterSpellScript(spell_dh_cycle_of_hatred_remove_stacks); + RegisterSpellScript(spell_dh_cycle_of_hatred_talent); RegisterSpellScript(spell_dh_darkglare_boon); RegisterSpellScript(spell_dh_darkness); RegisterSpellScript(spell_dh_deflecting_spikes); |