TrinityCore
Loading...
Searching...
No Matches
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
49
50 std::unordered_set<ObjectGuid> _triggeredTargets;
51};
52
53// 300771 - Blade of the Lifetaker
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
100};
101
102// 305060 - Yel'Shir's Powerglove
104{
105 void CalculateDamage(SpellEffectInfo const& /*spellEffectInfo*/, 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
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
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).CalcValueAsInt())
201 {
203 script->KillCounter = 0;
204 }
205 }
206 else
207 {
208 if (++script->KillCounter >= uncontrolledDarkness->GetSpellInfo()->GetEffect(EFFECT_0).CalcValueAsInt())
209 {
210 caster->CastSpell(caster, SPELL_UNCONTROLLED_DARKNESS_BUFF, true);
211 script->KillCounter = 0;
212 }
213 }
214 }
215
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
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
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
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
285};
286
287// 354569 - Potent Potion
302
303// 354706 - Spiritual Rejuvenation Potion
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
342};
343
@ DIFFICULTY_NONE
Definition DBCEnums.h:933
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ TARGET_UNIT_DEST_AREA_ENEMY
@ SPELL_EFFECT_HEAL
@ SPELL_EFFECT_ENERGIZE
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_DUMMY
@ SPELLVALUE_BASE_POINT0
#define sSpellMgr
Definition SpellMgr.h:812
#define AuraEffectProcFn(F, I, N)
#define SpellEffectFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraCheckEffectProcFn(F, I, N)
#define SpellCalcDamageFn(F)
#define AuraCheckProcFn(F)
#define AuraEnterLeaveCombatFn(F)
SpellEffectInfo const & GetSpellEffectInfo() const
SpellEffectValue GetAmount() const
void PreventDefaultAction()
HookList< CheckEffectProcHandler > DoCheckEffectProc
Unit * GetCaster() const
HookList< EnterLeaveCombatHandler > OnEnterLeaveCombat
Unit * GetTarget() const
HookList< CheckProcHandler > DoCheckProc
HookList< EffectProcHandler > OnEffectProc
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:182
Script * GetScript() const
Definition SpellAuras.h:355
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
uint32 GetEntry() const
Definition Object.h:89
Spell const * GetProcSpell() const
Definition Unit.h:514
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:281
Unit * GetProcTarget() const
Definition Unit.h:501
Unit * GetActor() const
Definition Unit.h:499
SpellDestination const * GetDst() const
Definition Spell.cpp:331
uint32 TriggerSpell
Definition SpellInfo.h:234
int32 CalcValueAsInt(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
void RestoreCharge(uint32 chargeCategoryId)
uint32 const Id
Definition SpellInfo.h:328
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:588
bool HasLabel(uint32 labelId) const
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
static bool ValidateSpellEffect(std::initializer_list< std::pair< uint32, SpellEffIndex > > effects)
HookList< DamageAndHealingCalcHandler > CalcDamage
Unit * GetCaster() const
void SetEffectValue(SpellEffectValue value)
SpellInfo const * GetTriggeringSpell() const
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
HookList< EffectHandler > OnEffectLaunchTarget
Difficulty GetCastDifficulty() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition Spell.h:277
SpellCastTargets m_targets
Definition Spell.h:651
Definition Unit.h:635
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3828
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4700
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
SpellHistory * GetSpellHistory()
Definition Unit.h:1498
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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(SpellEffectInfo const &, Unit const *, int32 &, int32 &, float &pctMod) const
void AddSC_torghast_spell_scripts()
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition Spell.cpp:9707