TrinityCore
spell_evoker.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Scripts for spells with SPELLFAMILY_EVOKER and SPELLFAMILY_GENERIC spells used by evoker players.
20 * Ordered alphabetically using scriptname.
21 * Scriptnames of files in this file should be prefixed with "spell_evo_".
22 */
23
24#include "Containers.h"
25#include "Player.h"
26#include "ScriptMgr.h"
27#include "Spell.h"
28#include "SpellAuraEffects.h"
29#include "SpellHistory.h"
30#include "SpellMgr.h"
31#include "SpellScript.h"
32
34{
44};
45
47{
49};
50
51// 362969 - Azure Strike (blue)
53{
54 void FilterTargets(std::list<WorldObject*>& targets)
55 {
56 targets.remove(GetExplTargetUnit());
58 targets.push_back(GetExplTargetUnit());
59 }
60
61 void Register() override
62 {
64 }
65};
66
67// 370455 - Charged Blast
69{
70 bool CheckProc(ProcEventInfo& procInfo)
71 {
72 return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_EVOKER_BLUE);
73 }
74
75 void Register() override
76 {
78 }
79};
80
81// 358733 - Glide (Racial)
83{
84 bool Validate(SpellInfo const* /*spellInfo*/) override
85 {
87 }
88
90 {
91 Unit* caster = GetCaster();
92
93 if (!caster->IsFalling())
95
96 return SPELL_CAST_OK;
97 }
98
100 {
101 Player* caster = GetCaster()->ToPlayer();
102 if (!caster)
103 return;
104
105 caster->CastSpell(caster, SPELL_EVOKER_GLIDE_KNOCKBACK, true);
106
107 caster->GetSpellHistory()->StartCooldown(sSpellMgr->AssertSpellInfo(SPELL_EVOKER_HOVER, GetCastDifficulty()), 0, nullptr, false, 250ms);
108 caster->GetSpellHistory()->StartCooldown(sSpellMgr->AssertSpellInfo(SPELL_EVOKER_SOAR_RACIAL, GetCastDifficulty()), 0, nullptr, false, 250ms);
109 }
110
111 void Register() override
112 {
115 }
116};
117
118// 361469 - Living Flame (Red)
120{
121 bool Validate(SpellInfo const* /*spellInfo*/) override
122 {
124 }
125
127 {
128 Unit* caster = GetCaster();
129 Unit* hitUnit = GetHitUnit();
130 if (caster->IsFriendlyTo(hitUnit))
131 caster->CastSpell(hitUnit, SPELL_EVOKER_LIVING_FLAME_HEAL, true);
132 else
133 caster->CastSpell(hitUnit, SPELL_EVOKER_LIVING_FLAME_DAMAGE, true);
134 }
135
137 {
138 Unit* caster = GetCaster();
139 if (caster->IsFriendlyTo(GetHitUnit()))
140 return;
141
143 {
144 int32 manaCost = GetSpell()->GetPowerTypeCostAmount(POWER_MANA).value_or(0);
145 if (manaCost != 0)
146 GetCaster()->ModifyPower(POWER_MANA, CalculatePct(manaCost, auraEffect->GetAmount()));
147 }
148 }
149
150 void Register() override
151 {
154 }
155};
156
157// 381773 - Permeating Chill
159{
160 bool Validate(SpellInfo const* /*spellInfo*/) override
161 {
163 }
164
165 bool CheckProc(ProcEventInfo& procInfo)
166 {
167 SpellInfo const* spellInfo = procInfo.GetSpellInfo();
168 if (!spellInfo)
169 return false;
170
171 if (!spellInfo->HasLabel(SPELL_LABEL_EVOKER_BLUE))
172 return false;
173
175 if (!spellInfo->IsAffected(SPELLFAMILY_EVOKER, { 0x40, 0, 0, 0 })) // disintegrate
176 return false;
177
178 return true;
179 }
180
181 void Register() override
182 {
184 }
185};
186
187// 393568 - Pyre
189{
190 bool Validate(SpellInfo const* /*spellInfo*/) override
191 {
193 }
194
195 void HandleDamage(SpellEffIndex /*effIndex*/)
196 {
197 GetCaster()->CastSpell(GetHitUnit()->GetPosition(), SPELL_EVOKER_PYRE_DAMAGE, true);
198 }
199
200 void Register() override
201 {
203 }
204};
205
207{
214}
int32_t int32
Definition: Define.h:138
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_DEST_AREA_ENEMY
@ SPELL_EFFECT_DUMMY
@ POWER_MANA
SpellCastResult
@ SPELL_FAILED_NOT_ON_GROUND
@ SPELL_CAST_OK
@ SPELLFAMILY_EVOKER
#define sSpellMgr
Definition: SpellMgr.h:849
#define SpellCheckCastFn(F)
Definition: SpellScript.h:830
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define SpellCastFn(F)
Definition: SpellScript.h:825
#define AuraCheckProcFn(F)
Definition: SpellScript.h:2130
T CalculatePct(T base, U pct)
Definition: Util.h:72
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:2129
static Player * ToPlayer(Object *o)
Definition: Object.h:213
SpellInfo const * GetSpellInfo() const
Definition: Unit.cpp:280
Unit * GetActor() const
Definition: Unit.h:493
void StartCooldown(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool onHold=false, Optional< Duration > forcedCooldown={})
bool IsAffected(uint32 familyName, flag128 const &familyFlags) const
Definition: SpellInfo.cpp:1795
bool HasLabel(uint32 labelId) const
Definition: SpellInfo.cpp:4937
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:829
Unit * GetCaster() const
Unit * GetHitUnit() const
SpellEffectInfo const & GetEffectInfo() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< CastHandler > OnCast
Definition: SpellScript.h:822
Spell * GetSpell() const
Definition: SpellScript.h:987
HookList< EffectHandler > OnEffectLaunchTarget
Definition: SpellScript.h:838
Difficulty GetCastDifficulty() const
Unit * GetExplTargetUnit() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
Optional< int32 > GetPowerTypeCostAmount(Powers power) const
Definition: Spell.cpp:7958
Definition: Unit.h:627
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:8280
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4464
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
SpellHistory * GetSpellHistory()
Definition: Unit.h:1457
bool IsFalling() const
Definition: Unit.cpp:12308
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool IsFriendlyTo(WorldObject const *target) const
Definition: Object.cpp:2865
void Register() override
void FilterTargets(std::list< WorldObject * > &targets)
bool CheckProc(ProcEventInfo &procInfo)
void Register() override
bool Validate(SpellInfo const *) override
SpellCastResult CheckCast()
void Register() override
void HandleHitTarget(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
void HandleLaunchTarget(SpellEffIndex)
bool Validate(SpellInfo const *) override
bool CheckProc(ProcEventInfo &procInfo)
void Register() override
bool Validate(SpellInfo const *) override
void HandleDamage(SpellEffIndex)
void RandomResize(C &container, std::size_t requestedSize)
Definition: Containers.h:67
EvokerSpells
@ SPELL_EVOKER_HOVER
@ SPELL_EVOKER_LIVING_FLAME
@ SPELL_EVOKER_SOAR_RACIAL
@ SPELL_EVOKER_GLIDE_KNOCKBACK
@ SPELL_EVOKER_ENERGIZING_FLAME
@ SPELL_EVOKER_LIVING_FLAME_DAMAGE
@ SPELL_EVOKER_LIVING_FLAME_HEAL
@ SPELL_EVOKER_PYRE_DAMAGE
@ SPELL_EVOKER_PERMEATING_CHILL_TALENT
EvokerSpellLabels
@ SPELL_LABEL_EVOKER_BLUE
void AddSC_evoker_spell_scripts()