TrinityCore
spell_torghast.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#include "ScriptMgr.h"
19#include "Spell.h"
20#include "SpellAuraEffects.h"
21#include "SpellHistory.h"
22#include "SpellMgr.h"
23#include "SpellScript.h"
24#include "Unit.h"
25
26// 297721 - Subjugator's Manacles
28{
29 bool CheckProc(AuraEffect const* /*aurEff*/, ProcEventInfo& procInfo)
30 {
31 if (_triggeredTargets.contains(procInfo.GetProcTarget()->GetGUID()))
32 return false;
33
34 _triggeredTargets.insert(procInfo.GetProcTarget()->GetGUID());
35 return true;
36 }
37
38 void ResetMarkedTargets(bool isNowInCombat)
39 {
40 if (!isNowInCombat)
41 _triggeredTargets.clear();
42 }
43
44 void Register() override
45 {
48 }
49
50 std::unordered_set<ObjectGuid> _triggeredTargets;
51};
52
53// 300771 - Blade of the Lifetaker
55{
56 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
57 {
59
60 procInfo.GetActor()->CastSpell(procInfo.GetProcTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, CastSpellExtraArgs(aurEff)
61 .AddSpellMod(SPELLVALUE_BASE_POINT0, GetTarget()->CountPctFromMaxHealth(aurEff->GetAmount()))
62 .SetTriggeringSpell(procInfo.GetProcSpell()));
63 }
64
65 void Register() override
66 {
68 }
69};
70
71// 300796 - Touch of the Unseen
73{
74 static constexpr uint32 SPELL_DOOR_OF_SHADOWS = 300728;
75
76 bool Validate(SpellInfo const* /*spellInfo*/) override
77 {
79 }
80
81 bool CheckProc(ProcEventInfo& procInfo)
82 {
83 return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->Id == SPELL_DOOR_OF_SHADOWS;
84 }
85
86 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
87 {
89
90 procInfo.GetActor()->CastSpell(procInfo.GetProcTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, CastSpellExtraArgs(aurEff)
91 .AddSpellMod(SPELLVALUE_BASE_POINT0, GetTarget()->CountPctFromMaxHealth(aurEff->GetAmount()))
92 .SetTriggeringSpell(procInfo.GetProcSpell()));
93 }
94
95 void Register() override
96 {
99 }
100};
101
102// 305060 - Yel'Shir's Powerglove
104{
105 void CalculateDamage(Unit const* /*victim*/, int32& /*damage*/, int32& /*flatMod*/, float& pctMod) const
106 {
107 if (SpellInfo const* triggeringSpell = GetTriggeringSpell())
108 if (Aura const* triggerAura = GetCaster()->GetAura(triggeringSpell->Id))
109 pctMod *= triggerAura->GetStackAmount();
110 }
111
112 void Register() override
113 {
115 }
116};
117
118// 321706 - Dimensional Blade
120{
121 static constexpr uint32 SPELL_MAGE_BLINK = 1953;
122 static constexpr uint32 SPELL_MAGE_SHIMMER = 212653;
123
124 bool Validate(SpellInfo const* /*spellInfo*/) override
125 {
127 }
128
129 void FilterTargets(std::list<WorldObject*>& targets)
130 {
131 if (!targets.empty())
132 {
133 GetCaster()->GetSpellHistory()->RestoreCharge(sSpellMgr->AssertSpellInfo(SPELL_MAGE_BLINK, DIFFICULTY_NONE)->ChargeCategoryId);
134 GetCaster()->GetSpellHistory()->RestoreCharge(sSpellMgr->AssertSpellInfo(SPELL_MAGE_SHIMMER, DIFFICULTY_NONE)->ChargeCategoryId);
135 }
136
137 // filter targets by entry here and not with conditions table because we need to know if any enemy was hit for charge restoration, not just mawrats
138 targets.remove_if([](WorldObject const* target)
139 {
140 switch (target->GetEntry())
141 {
142 case 151353: // Mawrat
143 case 179458: // Protective Mawrat
144 case 154030: // Oddly Large Mawrat
145 case 169871: // Hungry Mawrat
146 return false;
147 default:
148 break;
149 }
150 return true;
151 });
152 }
153
154 void Register() override
155 {
157 }
158};
159
160// 341324 - Uncontrolled Darkness
162{
163 void Register() override
164 {
165 // just a value holder, no hooks
166 }
167
168public:
170};
171
172// 343174 - Uncontrolled Darkness
174{
175 static constexpr uint32 SPELL_UNCONTROLLED_DARKNESS = 341324;
176 static constexpr uint32 SPELL_UNCONTROLLED_DARKNESS_BUFF = 341375;
177
178 bool Validate(SpellInfo const* /*spellInfo*/) override
179 {
182 }
183
184 void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& /*procInfo*/)
185 {
186 Unit* caster = GetCaster();
187 if (!caster)
188 return;
189
190 Aura* uncontrolledDarkness = caster->GetAura(SPELL_UNCONTROLLED_DARKNESS, caster->GetGUID());
191 if (!uncontrolledDarkness)
192 return;
193
195 if (!script)
196 return;
197
199 {
200 if (++script->KillCounter >= uncontrolledDarkness->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue())
201 {
203 script->KillCounter = 0;
204 }
205 }
206 else
207 {
208 if (++script->KillCounter >= uncontrolledDarkness->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue())
209 {
210 caster->CastSpell(caster, SPELL_UNCONTROLLED_DARKNESS_BUFF, true);
211 script->KillCounter = 0;
212 }
213 }
214 }
215
216 void Register() override
217 {
219 }
220};
221
222// 342632 - Malevolent Stitching
224{
225 static constexpr uint32 SPELL_LABEL_FLESHCRAFT_BUFF = 1103;
226
227 bool CheckProc(ProcEventInfo& procInfo)
228 {
229 return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_FLESHCRAFT_BUFF);
230 }
231
232 void Register() override
233 {
235 }
236};
237
238// 342779 - Crystallized Dreams
240{
241 static constexpr uint32 SPELL_LABEL_SOULSHAPE = 1100;
242
243 bool CheckProc(ProcEventInfo& procInfo)
244 {
245 return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_SOULSHAPE);
246 }
247
248 void Register() override
249 {
251 }
252};
253
254// 342793 - Murmuring Shawl
255// 342799 - Gnarled Key
257{
258 static constexpr uint32 SPELL_LABEL_DOOR_OF_SHADOWS = 726;
259
260 bool CheckProc(ProcEventInfo& procInfo)
261 {
262 return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_DOOR_OF_SHADOWS);
263 }
264
265 void Register() override
266 {
268 }
269};
270
271// 348908 - Ethereal Wildseed
273{
274 static constexpr uint32 SPELL_LABEL_FLICKER = 1105;
275
276 bool CheckProc(ProcEventInfo& procInfo)
277 {
278 return procInfo.GetSpellInfo() && procInfo.GetSpellInfo()->HasLabel(SPELL_LABEL_FLICKER);
279 }
280
281 void Register() override
282 {
284 }
285};
286
287// 354569 - Potent Potion
289{
291
292 bool CheckProc(ProcEventInfo& procInfo)
293 {
295 }
296
297 void Register() override
298 {
300 }
301};
302
303// 354706 - Spiritual Rejuvenation Potion
305{
307
308 bool Validate(SpellInfo const* /*spellInfo*/) override
309 {
311 }
312
313 void SetValue(SpellEffIndex effIndex)
314 {
316 .CalcValue(GetCaster(), nullptr, GetHitUnit()));
317 }
318
319 void Register() override
320 {
323 }
324};
325
326// 373761 - Poisonous Spores
328{
329 void HandleProc(AuraEffect* aurEff, ProcEventInfo& procInfo)
330 {
332
333 Spell const* procSpell = procInfo.GetProcSpell();
334 procInfo.GetActor()->CastSpell(*procSpell->m_targets.GetDst(), aurEff->GetSpellEffectInfo().TriggerSpell,
335 CastSpellExtraArgs(aurEff).SetTriggeringSpell(procSpell));
336 }
337
338 void Register() override
339 {
341 }
342};
343
345{
360}
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
#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_HEAL
@ SPELL_EFFECT_ENERGIZE
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_DUMMY
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:196
#define sSpellMgr
Definition: SpellMgr.h:849
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:2160
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
#define AuraCheckEffectProcFn(F, I, N)
Definition: SpellScript.h:2136
#define SpellCalcDamageFn(F)
Definition: SpellScript.h:879
#define AuraCheckProcFn(F)
Definition: SpellScript.h:2130
#define AuraEnterLeaveCombatFn(F)
Definition: SpellScript.h:2166
SpellEffectInfo const & GetSpellEffectInfo() const
int32 GetAmount() const
void PreventDefaultAction()
HookList< CheckEffectProcHandler > DoCheckEffectProc
Definition: SpellScript.h:2135
Unit * GetCaster() const
HookList< EnterLeaveCombatHandler > OnEnterLeaveCombat
Definition: SpellScript.h:2165
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:2129
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:134
Script * GetScript() const
Definition: SpellAuras.h:301
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
Spell const * GetProcSpell() const
Definition: Unit.h:508
SpellInfo const * GetSpellInfo() const
Definition: Unit.cpp:280
Unit * GetProcTarget() const
Definition: Unit.h:495
Unit * GetActor() const
Definition: Unit.h:493
SpellDestination const * GetDst() const
Definition: Spell.cpp:363
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
uint32 TriggerSpell
Definition: SpellInfo.h:237
void RestoreCharge(uint32 chargeCategoryId)
uint32 const Id
Definition: SpellInfo.h:325
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
bool HasLabel(uint32 labelId) const
Definition: SpellInfo.cpp:4937
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
Definition: SpellScript.h:173
HookList< DamageAndHealingCalcHandler > CalcDamage
Definition: SpellScript.h:878
void SetEffectValue(int32 value)
Unit * GetCaster() const
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
HookList< EffectHandler > OnEffectLaunchTarget
Definition: SpellScript.h:838
Difficulty GetCastDifficulty() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
Definition: Spell.h:255
SpellCastTargets m_targets
Definition: Spell.h:607
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
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
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
static constexpr uint32 SPELL_MAGE_SHIMMER
static constexpr uint32 SPELL_MAGE_BLINK
static constexpr uint32 SPELL_LABEL_DOOR_OF_SHADOWS
bool CheckProc(ProcEventInfo &procInfo)
bool CheckProc(ProcEventInfo &procInfo)
static constexpr uint32 SPELL_LABEL_FLESHCRAFT_BUFF
bool CheckProc(ProcEventInfo &procInfo)
static constexpr uint32 SPELL_LABEL_FLICKER
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
void SetValue(SpellEffIndex effIndex)
static constexpr uint32 SPELL_LABEL_SPIRITUAL_REJUVENATION_POTION
bool Validate(SpellInfo const *) override
bool CheckProc(ProcEventInfo &procInfo)
static constexpr uint32 SPELL_LABEL_REJUVENATING_SIPHONED_ESSENCE
static constexpr uint32 SPELL_LABEL_SOULSHAPE
bool CheckProc(ProcEventInfo &procInfo)
void ResetMarkedTargets(bool isNowInCombat)
bool CheckProc(AuraEffect const *, ProcEventInfo &procInfo)
std::unordered_set< ObjectGuid > _triggeredTargets
bool Validate(SpellInfo const *) override
bool CheckProc(ProcEventInfo &procInfo)
static constexpr uint32 SPELL_DOOR_OF_SHADOWS
void HandleProc(AuraEffect *aurEff, ProcEventInfo &procInfo)
static constexpr uint32 SPELL_UNCONTROLLED_DARKNESS
bool Validate(SpellInfo const *) override
static constexpr uint32 SPELL_UNCONTROLLED_DARKNESS_BUFF
void HandleProc(AuraEffect *, ProcEventInfo &)
void CalculateDamage(Unit const *, int32 &, int32 &, float &pctMod) const
void AddSC_torghast_spell_scripts()
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition: Spell.cpp:9403