Skip to content

Commit 39d07a8

Browse files
authored
Scripts/Spells: Implement evoker talent "Causality" (TrinityCore#30582)
1 parent 6a1a19d commit 39d07a8

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DELETE FROM `spell_script_names` WHERE `ScriptName`IN ('spell_evo_causality_pyre', 'spell_evo_causality_disintegrate');
2+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
3+
(357212, 'spell_evo_causality_pyre'),
4+
(356995, 'spell_evo_causality_disintegrate');

src/server/scripts/Spells/spell_evoker.cpp

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ enum EvokerSpells
5151
SPELL_EVOKER_BLESSING_OF_THE_BRONZE_SHAMAN = 381756,
5252
SPELL_EVOKER_BLESSING_OF_THE_BRONZE_WARLOCK = 381757,
5353
SPELL_EVOKER_BLESSING_OF_THE_BRONZE_WARRIOR = 381758,
54+
SPELL_EVOKER_CAUSALITY = 375777,
55+
SPELL_EVOKER_DISINTEGRATE = 356995,
5456
SPELL_EVOKER_EMERALD_BLOSSOM_HEAL = 355916,
5557
SPELL_EVOKER_ENERGIZING_FLAME = 400006,
5658
SPELL_EVOKER_ESSENCE_BURST = 359618,
5759
SPELL_EVOKER_FIRESTORM_DAMAGE = 369374,
60+
SPELL_EVOKER_ETERNITY_SURGE = 359073,
61+
SPELL_EVOKER_FIRE_BREATH = 357208,
5862
SPELL_EVOKER_FIRE_BREATH_DAMAGE = 357209,
5963
SPELL_EVOKER_GLIDE_KNOCKBACK = 358736,
6064
SPELL_EVOKER_HOVER = 358267,
@@ -149,6 +153,66 @@ class spell_evo_blessing_of_the_bronze : public SpellScript
149153
}
150154
};
151155

156+
static constexpr std::array<uint32, 2> CausalityAffectedEmpowerSpells = { SPELL_EVOKER_ETERNITY_SURGE, SPELL_EVOKER_FIRE_BREATH };
157+
158+
// Called by 356995 - Disintegrate (Blue)
159+
class spell_evo_causality_disintegrate : public AuraScript
160+
{
161+
bool Validate(SpellInfo const* /*spellInfo*/) override
162+
{
163+
return ValidateSpellEffect({ { SPELL_EVOKER_CAUSALITY, EFFECT_1 } });
164+
}
165+
166+
bool Load() override
167+
{
168+
return GetCaster()->HasAura(SPELL_EVOKER_CAUSALITY);
169+
}
170+
171+
void OnTick(AuraEffect const* /*aurEff*/) const
172+
{
173+
if (AuraEffect const* causality = GetCaster()->GetAuraEffect(SPELL_EVOKER_CAUSALITY, EFFECT_0))
174+
for (uint32 spell : CausalityAffectedEmpowerSpells)
175+
GetCaster()->GetSpellHistory()->ModifyCooldown(spell, Milliseconds(causality->GetAmount()));
176+
}
177+
178+
void Register() override
179+
{
180+
OnEffectPeriodic += AuraEffectPeriodicFn(spell_evo_causality_disintegrate::OnTick, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
181+
}
182+
};
183+
184+
// Called by 357212 - Pyre (Red)
185+
class spell_evo_causality_pyre : public SpellScript
186+
{
187+
static constexpr int64 TargetLimit = 5;
188+
189+
bool Validate(SpellInfo const* /*spellInfo*/) override
190+
{
191+
return ValidateSpellEffect({ { SPELL_EVOKER_CAUSALITY, EFFECT_1 } });
192+
}
193+
194+
bool Load() override
195+
{
196+
return GetCaster()->HasAura(SPELL_EVOKER_CAUSALITY);
197+
}
198+
199+
void HandleCooldown() const
200+
{
201+
AuraEffect const* causality = GetCaster()->GetAuraEffect(SPELL_EVOKER_CAUSALITY, EFFECT_1);
202+
if (!causality)
203+
return;
204+
205+
Milliseconds cooldownReduction = Milliseconds(std::min(GetUnitTargetCountForEffect(EFFECT_0), TargetLimit) * causality->GetAmount());
206+
for (uint32 spell : CausalityAffectedEmpowerSpells)
207+
GetCaster()->GetSpellHistory()->ModifyCooldown(spell, cooldownReduction);
208+
}
209+
210+
void Register() override
211+
{
212+
AfterCast += SpellCastFn(spell_evo_causality_pyre::HandleCooldown);
213+
}
214+
};
215+
152216
// 370455 - Charged Blast
153217
class spell_evo_charged_blast : public AuraScript
154218
{
@@ -621,6 +685,8 @@ void AddSC_evoker_spell_scripts()
621685
{
622686
RegisterSpellScript(spell_evo_azure_strike);
623687
RegisterSpellScript(spell_evo_blessing_of_the_bronze);
688+
RegisterSpellScript(spell_evo_causality_disintegrate);
689+
RegisterSpellScript(spell_evo_causality_pyre);
624690
RegisterSpellScript(spell_evo_charged_blast);
625691
RegisterAreaTriggerAI(at_evo_emerald_blossom);
626692
RegisterSpellScript(spell_evo_emerald_blossom_heal);

0 commit comments

Comments
 (0)