Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
SpellAuraLifecycle.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "CellImpl.h"
7#include "Common.h"
8#include "DynamicObject.h"
9#include "GridNotifiers.h"
10#include "GridNotifiersImpl.h"
11#include "Log.h"
12#include "ObjectAccessor.h"
13#include "ObjectMgr.h"
14#include "Opcodes.h"
15#include "Player.h"
16#include "ScriptMgr.h"
17#include "Spell.h"
18#include "SpellAuraEffects.h"
19#include "SpellAuraMetadata.h"
20#include "SpellMgr.h"
21#include "SpellScript.h"
22#include "Unit.h"
23#include "Util.h"
24#include "Vehicle.h"
25#include "WorldPacket.h"
26
27uint32 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint32 avalibleEffectMask, WorldObject* owner)
28{
29 ASSERT(spellProto);
30 ASSERT(owner);
31 uint32 effMask = 0;
32 switch (owner->GetTypeId())
33 {
36 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
37 {
38 if (spellProto->Effects[i].IsUnitOwnedAuraEffect())
39 effMask |= 1 << i;
40 }
41 break;
43 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
44 {
46 effMask |= 1 << i;
47 }
48 break;
49 default:
50 break;
51 }
52 return effMask & avalibleEffectMask;
53}
54
55void Aura::_InitEffects(uint32 effMask, Unit* caster, int32* baseAmount)
56{
57 // shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism
58 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
59 {
60 if (effMask & (uint32(1) << i))
61 m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : NULL, caster);
62 else
63 m_effects[i] = NULL;
64 }
65}
66
67void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp)
68{
69 ASSERT(target);
70 ASSERT(auraApp);
71 // aura mustn't be already applied on target
72 ASSERT(!IsAppliedOnTarget(target->GetGUID()) && "Aura::_ApplyForTarget: aura musn't be already applied on target");
73
74 m_applications[target->GetGUID()] = auraApp;
75
76 // set infinity cooldown state for spells
77 if (caster && caster->GetTypeId() == TypeID::TYPEID_PLAYER)
78 {
79 if (m_spellInfo->IsCooldownStartedOnEvent())
80 {
81 Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
82 caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, NULL, true);
83 }
84 }
85}
86
87void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp)
88{
89 ASSERT(target);
90 ASSERT(auraApp->GetRemoveMode());
91 ASSERT(auraApp);
92
93 ApplicationMap::iterator itr = m_applications.find(target->GetGUID());
94
96 if (itr == m_applications.end())
97 {
98 SF_LOG_ERROR("spells", "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
99 target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id);
100 ASSERT(false);
101 }
102
103 // aura has to be already applied
104 ASSERT(itr->second == auraApp);
105 m_applications.erase(itr);
106
107 m_removedApplications.push_back(auraApp);
108
109 // reset cooldown state for spells
110 if (caster && caster->GetTypeId() == TypeID::TYPEID_PLAYER)
111 {
112 if (GetSpellInfo()->IsCooldownStartedOnEvent())
113 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
115 }
116}
117
118// removes aura from all targets
119// and marks aura as removed
120
122{
124 m_isRemoved = true;
125 ApplicationMap::iterator appItr = m_applications.begin();
126 for (appItr = m_applications.begin(); appItr != m_applications.end();)
127 {
128 AuraApplication* aurApp = appItr->second;
129 Unit* target = aurApp->GetTarget();
130 target->_UnapplyAura(aurApp, removeMode);
131 appItr = m_applications.begin();
132 }
133}
134
135void Aura::UpdateTargetMap(Unit* caster, bool apply)
136{
137 if (IsRemoved())
138 return;
139
141
142 // fill up to date target list
143 // target, effMask
144 std::map<Unit*, uint32> targets;
145
146 FillTargetMap(targets, caster);
147
148 UnitList targetsToRemove;
149
150 // mark all auras as ready to remove
151 for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
152 {
153 std::map<Unit*, uint32>::iterator existing = targets.find(appIter->second->GetTarget());
154 // not found in current area - remove the aura
155 if (existing == targets.end())
156 targetsToRemove.push_back(appIter->second->GetTarget());
157 else
158 {
159 // needs readding - remove now, will be applied in next update cycle
160 // (dbcs do not have auras which apply on same type of targets but have different radius, so this is not really needed)
161 if (appIter->second->GetEffectMask() != existing->second || !CanBeAppliedOn(existing->first))
162 targetsToRemove.push_back(appIter->second->GetTarget());
163 // nothing todo - aura already applied
164 // remove from auras to register list
165 targets.erase(existing);
166 }
167 }
168
169 // register auras for units
170 for (std::map<Unit*, uint32>::iterator itr = targets.begin(); itr != targets.end();)
171 {
172 // aura mustn't be already applied on target
173 if (AuraApplication* aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
174 {
175 // the core created 2 different units with same guid
176 // this is a major failue, which i can't fix right now
177 // let's remove one unit from aura list
178 // this may cause area aura "bouncing" between 2 units after each update
179 // but because we know the reason of a crash we can remove the assertion for now
180 if (aurApp->GetTarget() != itr->first)
181 {
182 // remove from auras to register list
183 targets.erase(itr++);
184 continue;
185 }
186 else
187 {
188 // ok, we have one unit twice in target map (impossible, but...)
189 ASSERT(false);
190 }
191 }
192
193 bool addUnit = true;
194 // check target immunities
195 for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
196 {
197 if (itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex))
198 itr->second &= ~(1 << effIndex);
199 }
200 if (!itr->second
201 || itr->first->IsImmunedToSpell(GetSpellInfo())
202 || !CanBeAppliedOn(itr->first))
203 addUnit = false;
204
205 if (addUnit)
206 {
207 // persistent area aura does not hit flying targets
208 if (GetType() == DYNOBJ_AURA_TYPE)
209 {
210 if (itr->first->IsInFlight())
211 addUnit = false;
212 }
213 // unit auras can not stack with each other
214 else // (GetType() == UNIT_AURA_TYPE)
215 {
216 // Allow to remove by stack when aura is going to be applied on owner
217 if (itr->first != GetOwner())
218 {
219 // check if not stacking aura already on target
220 // this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
221 for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
222 {
223 Aura const* aura = iter->second->GetBase();
224 if (!CanStackWith(aura))
225 {
226 addUnit = false;
227 break;
228 }
229 }
230 }
231 }
232 }
233 if (!addUnit)
234 targets.erase(itr++);
235 else
236 {
237 // owner has to be in world, or effect has to be applied to self
238 if (!GetOwner()->IsSelfOrInSameMap(itr->first))
239 {
241 SF_LOG_FATAL("spells", "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
242 GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
243 itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
244 ASSERT(false);
245 }
246 itr->first->_CreateAuraApplication(this, itr->second);
247 ++itr;
248 }
249 }
250
251 // remove auras from units no longer needing them
252 for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end(); ++itr)
253 if (AuraApplication* aurApp = GetApplicationOfTarget((*itr)->GetGUID()))
254 (*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
255
256 if (!apply)
257 return;
258
259 // apply aura effects for units
260 for (std::map<Unit*, uint32>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
261 {
262 if (AuraApplication* aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
263 {
264 // owner has to be in world, or effect has to be applied to self
265 ASSERT((!GetOwner()->IsInWorld() && GetOwner() == itr->first) || GetOwner()->IsInMap(itr->first));
266 itr->first->_ApplyAura(aurApp, itr->second);
267 }
268 }
269}
270
271// targets have to be registered and not have effect applied yet to use this function
272
274{
275 // prepare list of aura targets
276 UnitList targetList;
277 for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
278 {
279 if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
280 targetList.push_back(appIter->second->GetTarget());
281 }
282
283 // apply effect to targets
284 for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
285 {
286 if (GetApplicationOfTarget((*itr)->GetGUID()))
287 {
288 // owner has to be in world, or effect has to be applied to self
289 ASSERT((!GetOwner()->IsInWorld() && GetOwner() == *itr) || GetOwner()->IsInMap(*itr));
290 (*itr)->_ApplyAuraEffect(this, effIndex);
291 }
292 }
293}
294
296{
297 ASSERT(owner == m_owner);
298
299 Unit* caster = GetCaster();
300 // Apply spellmods for channeled auras
301 // used for example when triggered spell of spell:10 is modded
302 Spell* modSpell = NULL;
303 Player* modOwner = NULL;
304 if (caster)
305 {
306 modOwner = caster->GetSpellModOwner();
307 if (modOwner)
308 {
309 modSpell = modOwner->FindCurrentSpellBySpellId(GetId());
310 if (modSpell)
311 modOwner->SetSpellModTakingSpell(modSpell, true);
312 }
313 }
314
315 Update(diff, caster);
316
317 if (m_updateTargetMapInterval <= int32(diff))
318 UpdateTargetMap(caster);
319 else
321
322 // update aura effects
323 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
324 if (m_effects[i])
325 m_effects[i]->Update(diff, caster);
326
327 // remove spellmods after effects update
328 if (modSpell)
329 modOwner->SetSpellModTakingSpell(modSpell, false);
330
332}
333
334void Aura::Update(uint32 diff, Unit* caster)
335{
336 if (m_duration > 0)
337 {
338 m_duration -= diff;
339 if (m_duration < 0)
340 m_duration = 0;
341 }
342}
343
345{
346 Player* modOwner = NULL;
347 int32 maxDuration;
348
349 if (caster)
350 {
351 modOwner = caster->GetSpellModOwner();
352 maxDuration = caster->CalcSpellDuration(m_spellInfo);
353 }
354 else
355 maxDuration = m_spellInfo->GetDuration();
356
357 if (IsPassive() && !m_spellInfo->DurationEntry)
358 maxDuration = -1;
359
360 // IsPermanent() checks max duration (which we are supposed to calculate here)
361 if (maxDuration != -1 && modOwner)
362 modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
363 return maxDuration;
364}
365
366void Aura::SetDuration(int32 duration, bool withMods)
367{
368 if (withMods)
369 {
370 if (Unit* caster = GetCaster())
371 if (Player* modOwner = caster->GetSpellModOwner())
372 modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, duration);
373 }
374 m_duration = duration;
376}
377
382
384{
386 bool resetPeriodic = true;
388 {
389 int32 minAmplitude = m_maxDuration;
390 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
391 if (AuraEffect const* eff = GetEffect(i))
392 if (int32 ampl = eff->GetAmplitude())
393 minAmplitude = std::min(ampl, minAmplitude);
394
395 // If only one tick remaining, roll it over into new duration
396 if (GetDuration() <= minAmplitude)
397 {
399 resetPeriodic = false;
400 }
401 }
402
404 Unit* caster = GetCaster();
405 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
406 if (HasEffect(i))
407 GetEffect(i)->CalculatePeriodic(caster, resetPeriodic, false);
408}
409
411{
412 if (m_procCharges == charges)
413 return;
414 m_procCharges = charges;
417}
418
420{
421 uint32 maxProcCharges = m_spellInfo->ProcCharges;
422 if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
423 maxProcCharges = procEntry->charges;
424
425 if (caster)
426 if (Player* modOwner = caster->GetSpellModOwner())
427 modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
428 return uint8(maxProcCharges);
429}
430
432{
433 if (IsUsingCharges())
434 {
435 int32 charges = m_procCharges + num;
436 int32 maxCharges = CalcMaxCharges();
437
438 // limit charges (only on charges increase, charges may be changed manually)
439 if ((num > 0) && (charges > int32(maxCharges)))
440 charges = maxCharges;
441 // we're out of charges, remove
442 else if (charges <= 0)
443 {
444 Remove(removeMode);
445 return true;
446 }
447
448 SetCharges(charges);
449 }
450 return false;
451}
452
454{
455 m_stackAmount = stackAmount;
456 Unit* caster = GetCaster();
457
458 std::list<AuraApplication*> applications;
459 GetApplicationList(applications);
460
461 for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
462 if (!(*apptItr)->GetRemoveMode())
463 HandleAuraSpecificMods(*apptItr, caster, false, true);
464
465 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
466 if (HasEffect(i))
467 m_effects[i]->ChangeAmount(m_effects[i]->CalculateAmount(caster), false, true);
468
469 for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
470 if (!(*apptItr)->GetRemoveMode())
471 HandleAuraSpecificMods(*apptItr, caster, true, true);
472
474}
475
477{
478 int32 stackAmount = m_stackAmount + num;
479
480 // limit the stack amount (only on stack increase, stack amount may be changed manually)
481 if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
482 {
483 // not stackable aura - set stack amount to 1
484 if (!m_spellInfo->StackAmount)
485 stackAmount = 1;
486 else
487 stackAmount = m_spellInfo->StackAmount;
488 }
489 // we're out of stacks, remove
490 else if (stackAmount <= 0)
491 {
492 Remove(removeMode);
493 return true;
494 }
495
496 bool refresh = stackAmount >= GetStackAmount();
497
498 // Update stack amount
499 SetStackAmount(stackAmount);
500
501 if (refresh)
502 {
505
506 // reset charges
508 // FIXME: not a best way to synchronize charges, but works
509 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
510 if (AuraEffect* aurEff = GetEffect(i))
511 if (aurEff->GetAuraType() == SPELL_AURA_ADD_FLAT_MODIFIER || aurEff->GetAuraType() == SPELL_AURA_ADD_PCT_MODIFIER)
512 if (SpellModifier* mod = aurEff->GetSpellModifier())
513 mod->charges = GetCharges();
514 }
516 return false;
517}
518
520{
521 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
522 if (Player* player = appIter->second->GetTarget()->ToPlayer())
523 player->RestoreAllSpellMods(0, this);
524}
525
526bool Aura::IsArea() const
527{
528 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
529 {
530 if (HasEffect(i) && GetSpellInfo()->Effects[i].IsAreaAuraEffect())
531 return true;
532 }
533 return false;
534}
535
536bool Aura::IsPassive() const
537{
538 return GetSpellInfo()->IsPassive();
539}
540
542{
544}
545
547{
548 if (IsPassive())
549 return false;
550
551 if (GetCasterGUID() != GetOwner()->GetGUID())
553 return false;
554
555 // Can't be saved - aura handler relies on calculated amount and changes it
557 return false;
558
559 // Can't save vehicle auras, it requires both caster & target to be in world
561 return false;
562
563 // Incanter's Absorbtion - considering the minimal duration and problems with aura stacking
564 // we skip saving this aura
565 // Also for some reason other auras put as MultiSlot crash core on keeping them after restart,
566 // so put here only these for which you are sure they get removed
568 return false;
569
570 // When a druid logins, he doesnt have either eclipse power, nor the marker auras, nor the eclipse buffs. Dont save them.
572 return false;
573
574 // don't save auras removed by proc system
575 if (IsUsingCharges() && !GetCharges())
576 return false;
577
578 return true;
579}
580
585
586bool Aura::IsSingleTargetWith(Aura const* aura) const
587{
588 // Same spell?
589 if (GetSpellInfo()->IsRankOf(aura->GetSpellInfo()))
590 return true;
591
593 // spell with single target specific types
594 switch (spec)
595 {
598 if (aura->GetSpellInfo()->GetSpellSpecific() == spec)
599 return true;
600 break;
601 default:
602 break;
603 }
604
606 return true;
607
608 return false;
609}
610
612{
614 Unit* caster = GetCaster();
616 if (!caster)
618 ASSERT(caster);
619 caster->GetSingleCastAuras().remove(this);
620 SetIsSingleTarget(false);
621}
622
623int32 Aura::CalcDispelChance(Unit* auraTarget, bool offensive) const
624{
625 // we assume that aura dispel chance is 100% on start
626 // need formula for level difference based chance
627 int32 resistChance = 0;
628
629 // Apply dispel mod from aura caster
630 if (Unit* caster = GetCaster())
631 if (Player* modOwner = caster->GetSpellModOwner())
632 modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
633
634 // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
635 // Only affects offensive dispels
636 if (offensive && auraTarget)
637 resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
638
639 RoundToInterval(resistChance, 0, 100);
640 return 100 - resistChance;
641}
642
643void Aura::SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint32 recalculateMask, int32* amount)
644{
645 m_maxDuration = maxduration;
646 m_duration = duration;
647 m_procCharges = charges;
649 m_stackAmount = stackamount;
650 Unit* caster = GetCaster();
651 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
652 {
653 if (m_effects[i])
654 {
655 m_effects[i]->SetAmount(amount[i]);
656 m_effects[i]->SetCanBeRecalculated(recalculateMask & (1 << i));
657 m_effects[i]->CalculatePeriodic(caster, false, true);
658 m_effects[i]->CalculateSpellMod();
659 m_effects[i]->RecalculateAmount(caster);
660 }
661 }
662}
663
665{
666 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
667 {
668 if (HasEffect(i) && m_effects[i]->GetAuraType() == type)
669 return true;
670 }
671 return false;
672}
673
675{
676 ASSERT(!IsRemoved());
677 Unit* caster = GetCaster();
678 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
679 if (HasEffect(i))
680 m_effects[i]->RecalculateAmount(caster);
681}
682
683void Aura::HandleAllEffects(AuraApplication* aurApp, uint8 mode, bool apply)
684{
685 ASSERT(!IsRemoved());
686 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
687 if (m_effects[i] && !IsRemoved())
688 m_effects[i]->HandleEffect(aurApp, mode, apply);
689}
690
691void Aura::GetApplicationList(std::list<AuraApplication*>& applicationList) const
692{
693 for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
694 {
695 if (appIter->second->GetEffectMask())
696 applicationList.push_back(appIter->second);
697 }
698}
699
701{
702 for (ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
703 appIter->second->SetNeedClientUpdate();
704}
705
706// trigger effects on real aura apply/remove
707
708void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply)
709{
710 Unit* target = aurApp->GetTarget();
711 AuraRemoveMode removeMode = aurApp->GetRemoveMode();
712 // handle spell_area table
713 SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAuraMapBounds(GetId());
714 if (saBounds.first != saBounds.second)
715 {
716 uint32 zone, area;
717 target->GetZoneAndAreaId(zone, area);
718
719 for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
720 {
721 // some auras remove at aura remove
722 if (!itr->second->IsFitToRequirements(target->ToPlayer(), zone, area))
723 target->RemoveAurasDueToSpell(itr->second->spellId);
724 // some auras applied at aura apply
725 else if (itr->second->autocast)
726 {
727 if (!target->HasAura(itr->second->spellId))
728 target->CastSpell(target, itr->second->spellId, true);
729 }
730 }
731 }
732
733 // handle spell_linked_spell table
734 if (!onReapply)
735 {
736 // apply linked auras
737 if (apply)
738 {
739 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
740 {
741 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
742 {
743 if (*itr < 0)
744 target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), true);
745 else if (caster)
746 caster->AddAura(*itr, target);
747 }
748 }
749 }
750 else
751 {
752 // remove linked auras
753 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId()))
754 {
755 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
756 {
757 if (*itr < 0)
758 target->RemoveAurasDueToSpell(-(*itr));
759 else if (removeMode != AURA_REMOVE_BY_DEATH)
760 target->CastSpell(target, *itr, true, NULL, NULL, GetCasterGUID());
761 }
762 }
763 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
764 {
765 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
766 {
767 if (*itr < 0)
768 target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), false);
769 else
770 target->RemoveAura(*itr, GetCasterGUID(), 0, removeMode);
771 }
772 }
773 }
774 }
775 else if (apply)
776 {
777 // modify stack amount of linked auras
778 if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
779 {
780 for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
781 if (*itr > 0)
782 if (Aura* triggeredAura = target->GetAura(*itr, GetCasterGUID()))
783 triggeredAura->ModStackAmount(GetStackAmount() - triggeredAura->GetStackAmount());
784 }
785 }
786
787 // mods at aura apply
788 if (apply)
789 {
790 switch (GetSpellInfo()->SpellFamilyName)
791 {
793 switch (GetId())
794 {
795 case 32474: // Buffeting Winds of Susurrus
796 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
797 target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
798 break;
799 case 33572: // Gronn Lord's Grasp, becomes stoned
802 break;
803 case 50836: //Petrifying Grip, becomes stoned
806 break;
807 case 60970: // Heroic Fury (remove Intercept cooldown)
808 if (target->GetTypeId() == TypeID::TYPEID_PLAYER)
810 break;
811 }
812 break;
814 if (!caster)
815 break;
816 // Rejuvenation
817 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x10 && GetEffect(EFFECT_0))
818 {
819 // Druid T8 Restoration 4P Bonus
821 {
824 &heal, NULL, NULL, true, NULL, GetEffect(EFFECT_0));
825 }
826 }
827
828 switch (m_spellInfo->Id)
829 {
830 case 1850: // Dash
831 case 137452: // Displacer Beast
832 case 5215: // Prowl
833 {
834 // check for catform
835 if (caster->GetShapeshiftForm() != FORM_CAT)
836 caster->CastSpell(caster, Skyfire::Spells::GetDruidCatFormSpellId(), true);
837 break;
838 }
839 case 106898: // Stampeding Roar
840 {
841 // activates bear form
844 break;
845 }
846 case 77761: // Stampeding roar Bearform
847 case 77764: // Stampeding roar Catform
848 {
850 break;
851 }
852 case 102795: // Bear Hug
853 {
854 // check for bear form
855 if (caster->GetShapeshiftForm() != FORM_BEAR)
856 caster->CastSpell(caster, Skyfire::Spells::GetDruidBearFormSpellId(), true); // activate bear form
857 break;
858 }
859 break;
860 }
861 break;
862 case SPELLFAMILY_MAGE:
863 if (!caster)
864 break;
866 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
867 {
868 // Polymorph Sound - Sheep && Penguin
869 if (GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
870 {
871 // Glyph of the Penguin
874 else
876 }
877 }
878 switch (GetId())
879 {
880 case 12536: // Clearcasting
881 case 12043: // Presence of Mind
882 // Arcane Potency
883 if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_MAGE, 2120, 0))
884 {
885 uint32 spellId = 0;
886
887 spellId = Skyfire::Spells::GetArcanePotencyTriggerSpellId(aurEff->GetId());
888 if (!spellId)
889 SF_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
890 if (spellId)
891 caster->CastSpell(caster, spellId, true);
892 }
893 break;
894 default:
895 break;
896 }
897 break;
899 if (!caster)
900 break;
901 // Devouring Plague
902 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
903 {
904 // Improved Devouring Plague
905 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 0))
906 {
907 uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
908 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
909 int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
910 int32 heal = int32(CalculatePct(basepoints0, 15));
911
913 &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
915 &heal, NULL, NULL, true, NULL, GetEffect(0));
916 }
917 }
918 // Power Word: Shield
919 else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
920 {
921 // Glyph of Power Word: Shield
923 {
924 // instantly heal m_amount% of the absorb-value
925 int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount() / 100;
927 &heal, NULL, NULL, true, 0, GetEffect(0));
928 }
929 }
930 break;
932 // Sprint (skip non player casted spells by category)
933 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->GetCategory() == 44)
934 // in official maybe there is only one icon?
935 if (target->HasAura(Skyfire::Spells::GetGlyphOfBlurredSpeedAuraSpellId())) // Glyph of Blurred Speed
936 target->CastSpell(target, Skyfire::Spells::GetGlyphOfBlurredSpeedSprintSpellId(), true); // Sprint (waterwalk)
937 break;
938 }
939 }
940 // mods at aura remove
941 else
942 {
943 switch (GetSpellInfo()->SpellFamilyName)
944 {
946 switch (GetId())
947 {
948 case 61987: // Avenging Wrath
949 // Remove the immunity shield marker on Avenging Wrath removal if Forbearance is not present
953 break;
954 case 72368: // Shared Suffering
955 case 72369:
956 if (caster)
957 {
958 if (AuraEffect* aurEff = GetEffect(0))
959 {
960 int32 remainingDamage = aurEff->GetAmount() * (aurEff->GetTotalTicks() - aurEff->GetTickNumber());
961 if (remainingDamage > 0)
963 NULL, &remainingDamage, NULL, true);
964 }
965 }
966 break;
967 }
968 break;
969 case SPELLFAMILY_MAGE:
970 switch (GetId())
971 {
972 case 66: // Invisibility
973 if (removeMode != AURA_REMOVE_BY_EXPIRE)
974 break;
975 target->CastSpell(target, Skyfire::Spells::GetInvisibilityFadeSpellId(), true, NULL, GetEffect(1));
976 target->CombatStop();
977 break;
978 default:
979 break;
980 }
981 break;
983 if (!caster)
984 break;
985 // Improved Fear
986 if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
987 {
988 if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
989 {
990 uint32 spellId = 0;
991 spellId = Skyfire::Spells::GetImprovedFearTriggerSpellId(aurEff->GetId());
992 if (!spellId)
993 SF_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId());
994 if (spellId)
995 caster->CastSpell(target, spellId, true);
996 }
997 }
998 break;
1000 if (!caster)
1001 break;
1002 // Power word: shield
1003 if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
1004 {
1005 // Rapture
1007 {
1008 // check cooldown
1009 if (caster->GetTypeId() == TypeID::TYPEID_PLAYER)
1010 {
1011 if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
1012 {
1013 // This additional check is needed to add a minimal delay before cooldown in in effect
1014 // to allow all bubbles broken by a single damage source proc mana return
1015 if (caster->ToPlayer()->GetSpellCooldownDelay(aura->GetId()) <= 11)
1016 break;
1017 }
1018 else // and add if needed
1019 caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
1020 }
1021
1022 // effect on caster
1023 if (AuraEffect const* aurEff = aura->GetEffect(0))
1024 {
1025 float multiplier = float(aurEff->GetAmount());
1026 int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
1028 &basepoints0, NULL, NULL, true);
1029 }
1030 }
1031 }
1032 break;
1033 case SPELLFAMILY_ROGUE:
1034 // Remove Vanish on stealth remove
1036 target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, 0x0000800, 0, 0, target->GetGUID());
1037 break;
1039 // Remove the immunity shield marker on Forbearance removal if AW marker is not present
1044 break;
1046 // Blood of the North
1047 // Reaping
1048 // Death Rune Mastery
1049 if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
1050 {
1051 if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
1052 break;
1053 if (target->GetTypeId() != TypeID::TYPEID_PLAYER)
1054 break;
1055 if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
1056 break;
1057
1058 // aura removed - remove death runes
1060 }
1061 break;
1062 case SPELLFAMILY_HUNTER:
1063 // Glyph of Freezing Trap
1064 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000008)
1067 break;
1068 case SPELLFAMILY_DRUID:
1069 switch (m_spellInfo->Id)
1070 {
1071 case 768: // catform
1072 // remove prowl when leaving catform
1075 break;
1076 }
1077 break;
1078 }
1079 }
1080
1081 // mods at aura apply or remove
1082 switch (GetSpellInfo()->SpellFamilyName)
1083 {
1084 case SPELLFAMILY_DRUID:
1085 // Enrage
1086 if ((GetSpellInfo()->SpellFamilyFlags[0] & 0x80000) && GetSpellInfo()->SpellIconID == 961)
1087 {
1088 if (target->HasAura(Skyfire::Spells::GetDruidFeralTier10BonusAuraSpellId())) // Item - Druid T10 Feral 4P Bonus
1089 if (apply)
1091 break;
1092 }
1093 break;
1094 case SPELLFAMILY_HUNTER:
1095 switch (GetId())
1096 {
1097 case 19574: // Bestial Wrath
1098 // The Beast Within cast on owner if talent present
1099 if (Unit* owner = target->GetOwner())
1100 {
1101 // Search talent
1103 {
1104 if (apply)
1105 owner->CastSpell(owner, Skyfire::Spells::GetTheBeastWithinTriggerSpellId(), true, 0, GetEffect(0));
1106 else
1107 owner->RemoveAurasDueToSpell(Skyfire::Spells::GetTheBeastWithinTriggerSpellId());
1108 }
1109 }
1110 break;
1111 }
1112 break;
1114 switch (GetId())
1115 {
1116 case 31842: // Divine Favor
1117 // Item - Paladin T10 Holy 2P Bonus
1119 {
1120 if (apply)
1122 else
1124 }
1125 break;
1126 }
1127 break;
1129 // Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage
1130 if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)
1131 {
1132 if (!caster)
1133 break;
1134 if (apply)
1135 {
1136 if (target != caster && !target->HealthAbovePct(25))
1138 }
1139 else
1140 {
1141 if (target != caster)
1142 caster->RemoveAurasDueToSpell(GetId());
1143 else
1145 }
1146 }
1147 break;
1148 }
1149}
1150
1152{
1153 // unit not in world or during remove from world
1154 if (!target->IsInWorld() || target->IsDuringRemoveFromWorld())
1155 {
1156 // area auras mustn't be applied
1157 if (GetOwner() != target)
1158 return false;
1159 // not selfcasted single target auras mustn't be applied
1160 if (GetCasterGUID() != GetOwner()->GetGUID() && GetSpellInfo()->IsSingleTarget())
1161 return false;
1162 return true;
1163 }
1164 else
1165 return CheckAreaTarget(target);
1166}
1167
1169{
1170 return CallScriptCheckAreaTargetHandlers(target);
1171}
1172
1173bool Aura::CanStackWith(Aura const* existingAura) const
1174{
1175 // Can stack with self
1176 if (this == existingAura)
1177 return true;
1178
1179 // Dynobj auras always stack
1180 if (GetType() == DYNOBJ_AURA_TYPE || existingAura->GetType() == DYNOBJ_AURA_TYPE)
1181 return true;
1182
1183 SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
1184 bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
1185
1186 // passive auras don't stack with another rank of the spell cast by same caster
1187 if (IsPassive() && sameCaster && m_spellInfo->IsDifferentRankOf(existingSpellInfo))
1188 return false;
1189
1190 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1191 {
1192 // prevent remove triggering aura by triggered aura
1193 if (existingSpellInfo->Effects[i].TriggerSpell == GetId()
1194 // prevent remove triggered aura by triggering aura refresh
1195 || m_spellInfo->Effects[i].TriggerSpell == existingAura->GetId())
1196 return true;
1197 }
1198
1199 // check spell specific stack rules
1200 if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
1201 || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
1202 return false;
1203
1204 // check spell group stack rules
1205 SpellGroupStackRule stackRule = sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo);
1206 if (stackRule)
1207 {
1208 if (stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE)
1209 return false;
1210 if (sameCaster && stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER)
1211 return false;
1212 }
1213
1214 if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
1215 return true;
1216
1217 if (!sameCaster)
1218 {
1219 // Channeled auras can stack if not forbidden by db or aura type
1220 if (existingAura->GetSpellInfo()->IsChanneled())
1221 return true;
1222
1224 return true;
1225
1226 // check same periodic auras
1227 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1228 {
1229 switch (m_spellInfo->Effects[i].ApplyAuraName)
1230 {
1231 // DOT or HOT from different casters will stack
1243 // periodic auras which target areas are not allowed to stack this way (replenishment for example)
1244 if (m_spellInfo->Effects[i].IsTargetingArea() || existingSpellInfo->Effects[i].IsTargetingArea())
1245 break;
1246 return true;
1247 default:
1248 break;
1249 }
1250 }
1251 }
1252
1254 {
1255 Vehicle* veh = NULL;
1256 if (GetOwner()->ToUnit())
1257 veh = GetOwner()->ToUnit()->GetVehicleKit();
1258
1259 if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
1260 return true;
1261
1262 if (!veh->GetAvailableSeatCount())
1263 return false; // No empty seat available
1264
1265 return true; // Empty seat available (skip rest)
1266 }
1267
1268 // spell of same spell rank chain
1269 if (m_spellInfo->IsRankOf(existingSpellInfo))
1270 {
1271 // don't allow passive area auras to stack
1272 if (m_spellInfo->IsMultiSlotAura() && !IsArea())
1273 return true;
1274 if (GetCastItemGUID() && existingAura->GetCastItemGUID())
1275 if (GetCastItemGUID() != existingAura->GetCastItemGUID() && (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC))
1276 return true;
1277 // same spell with same caster should not stack
1278 return false;
1279 }
1280
1281 return true;
1282}
1283
1285{
1286 while (!m_removedApplications.empty())
1287 {
1288 delete m_removedApplications.front();
1289 m_removedApplications.pop_front();
1290 }
1291}
#define MAX_SPELL_EFFECTS
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define ASSERT
Definition Errors.h:29
#define SF_LOG_FATAL(filterType__,...)
Definition Log.h:146
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_DYNAMICOBJECT
Definition Object.h:57
@ TYPEID_UNIT
Definition Object.h:54
@ EFFECT_0
@ POWER_MANA
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ CLASS_DEATH_KNIGHT
@ SPELL_ATTR3_STACK_FOR_DIFF_CASTERS
@ IMMUNITY_ID
@ SPELLFAMILY_PRIEST
@ SPELLFAMILY_WARLOCK
@ SPELLFAMILY_MAGE
@ SPELLFAMILY_GENERIC
@ SPELLFAMILY_PALADIN
@ SPELLFAMILY_HUNTER
@ SPELLFAMILY_ROGUE
@ SPELLFAMILY_DRUID
@ SPELLFAMILY_DEATHKNIGHT
@ SPELL_ATTR8_DONT_RESET_PERIODIC_TIMER
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_ADD_PCT_MODIFIER
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_CONVERT_RUNE
@ SPELL_AURA_OBS_MOD_POWER
@ SPELL_AURA_CAST_WHILE_WALKING
@ SPELL_AURA_ADD_FLAT_MODIFIER
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_PERIODIC_ENERGIZE
@ SPELL_AURA_PERIODIC_LEECH
@ SPELL_AURA_POWER_BURN
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_DISPEL_RESIST
@ DYNOBJ_AURA_TYPE
#define UPDATE_TARGET_MAP_INTERVAL
Definition SpellAuras.h:26
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition SpellInfo.h:65
SpellSpecificType
Definition SpellInfo.h:35
@ SPELL_SPECIFIC_JUDGEMENT
Definition SpellInfo.h:47
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition SpellInfo.h:46
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
Definition SpellMgr.h:500
SpellGroupStackRule
Definition SpellMgr.h:334
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER
Definition SpellMgr.h:337
@ SPELL_GROUP_STACK_RULE_EXCLUSIVE
Definition SpellMgr.h:336
#define sSpellMgr
Definition SpellMgr.h:744
@ SPELL_LINK_AURA
Definition SpellMgr.h:88
@ SPELLMOD_DURATION
Definition Unit.h:74
@ SPELLMOD_CHARGES
Definition Unit.h:77
@ SPELLMOD_RESIST_DISPEL_CHANCE
Definition Unit.h:101
AuraRemoveMode
Definition Unit.h:405
@ AURA_REMOVE_BY_DEFAULT
Definition Unit.h:407
@ AURA_REMOVE_BY_DEATH
Definition Unit.h:411
@ AURA_REMOVE_BY_EXPIRE
Definition Unit.h:410
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition Unit.h:409
@ FORM_CAT
Definition Unit.h:208
@ FORM_BEAR
Definition Unit.h:212
std::list< Unit * > UnitList
Definition Unit.h:370
@ DOT
Definition Unit.h:616
T RoundToInterval(T &num, T floor, T ceil)
Definition Util.h:121
T CalculatePct(T base, U pct)
Definition Util.h:103
Unit * GetTarget() const
Definition SpellAuras.h:54
Aura * GetBase() const
Definition SpellAuras.h:55
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:66
int32 GetTotalTicks() const
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
int32 GetAmount() const
void HandleAllEffects(AuraApplication *aurApp, uint8 mode, bool apply)
Unit::AuraApplicationList m_removedApplications
Definition SpellAuras.h:254
void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint32 recalculateMask, int32 *amount)
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
void RefreshTimers()
uint64 GetCasterGUID() const
Definition SpellAuras.h:91
bool CanBeSaved() const
virtual void FillTargetMap(std::map< Unit *, uint32 > &targets, Unit *caster)=0
const AuraApplication * GetApplicationOfTarget(uint64 guid) const
Definition SpellAuras.h:176
bool CheckAreaTarget(Unit *target)
bool IsArea() const
int32 GetMaxDuration() const
Definition SpellAuras.h:115
uint64 GetCastItemGUID() const
Definition SpellAuras.h:90
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
AuraEffect * m_effects[MAX_SPELL_EFFECTS]
Definition SpellAuras.h:246
void SetStackAmount(uint8 num)
int32 m_maxDuration
Definition SpellAuras.h:238
Unit * GetUnitOwner() const
Definition SpellAuras.h:94
bool CanBeSentToClient() const
bool CallScriptCheckAreaTargetHandlers(Unit *target)
uint8 m_stackAmount
Definition SpellAuras.h:244
bool HasEffect(uint8 effIndex) const
Definition SpellAuras.h:166
int32 m_duration
Definition SpellAuras.h:239
bool IsRemoved() const
Definition SpellAuras.h:154
void GetApplicationList(Unit::AuraApplicationList &applicationList) const
void Update(uint32 diff, Unit *caster)
WorldObject * GetOwner() const
Definition SpellAuras.h:93
bool IsSingleTargetWith(Aura const *aura) const
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
bool CanStackWith(Aura const *existingAura) const
uint32 GetId() const
Definition SpellAuras.h:88
ApplicationMap m_applications
Definition SpellAuras.h:247
int32 GetDuration() const
Definition SpellAuras.h:119
bool IsUsingCharges() const
Definition SpellAuras.h:192
void UpdateOwner(uint32 diff, WorldObject *owner)
void UnregisterSingleTarget()
bool IsDeathPersistent() const
bool HasEffectType(AuraType type) const
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:168
Unit * GetCaster() const
int32 CalcDispelChance(Unit *auraTarget, bool offensive) const
void SetCharges(uint8 charges)
void UpdateTargetMap(Unit *caster, bool apply=true)
void _InitEffects(uint32 effMask, Unit *caster, int32 *baseAmount)
void SetNeedClientUpdateForTargets() const
int32 CalcMaxDuration() const
Definition SpellAuras.h:117
void SetDuration(int32 duration, bool withMods=false)
void RefreshDuration()
SpellInfo const *const m_spellInfo
Definition SpellAuras.h:232
AuraObjectType GetType() const
uint8 GetStackAmount() const
Definition SpellAuras.h:133
void _ApplyEffectForTargets(uint8 effIndex)
uint8 GetCharges() const
Definition SpellAuras.h:126
WorldObject *const m_owner
Definition SpellAuras.h:236
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:87
uint64 const m_castItemGuid
Definition SpellAuras.h:234
bool CanBeAppliedOn(Unit *target)
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:159
void _DeleteRemovedApplications()
Aura(SpellInfo const *spellproto, WorldObject *owner, Unit *caster, Item *castItem, uint64 casterGUID)
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
uint8 CalcMaxCharges() const
Definition SpellAuras.h:129
bool m_isUsingCharges
Definition SpellAuras.h:251
bool IsAppliedOnTarget(uint64 guid) const
Definition SpellAuras.h:178
void RecalculateAmountOfEffects()
static uint32 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint32 avalibleEffectMask, WorldObject *owner)
bool IsPassive() const
void RefreshSpellMods()
bool m_isRemoved
Definition SpellAuras.h:249
int32 m_updateTargetMapInterval
Definition SpellAuras.h:240
bool m_isSingleTarget
Definition SpellAuras.h:250
uint8 m_procCharges
Definition SpellAuras.h:243
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void _Remove(AuraRemoveMode removeMode)
bool IsSingleTarget() const
Definition SpellAuras.h:157
Definition Item.h:202
static T * GetObjectInOrOutOfWorld(uint64 guid, T *)
uint64 GetGUID() const
Definition Object.h:119
Player * ToPlayer()
Definition Object.h:204
bool IsInWorld() const
Definition Object.h:114
uint32 GetGUIDLow() const
Definition Object.h:120
TypeID GetTypeId() const
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:125
Unit * ToUnit()
Definition Object.h:210
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition Player.cpp:16426
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:20552
bool HasSpellCooldown(uint32 spell_id) const
Definition Player.cpp:17498
Item * GetItemByGuid(uint64 guid) const
T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=NULL)
Definition Player.h:3623
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=NULL, bool infinityCooldown=false)
Definition Player.cpp:17511
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=NULL, uint32 spellid=0)
Definition Player.cpp:16547
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time)
Definition Player.cpp:17633
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=NULL, bool setCooldown=true)
Definition Player.cpp:17720
uint32 GetSpellCooldownDelay(uint32 spell_id) const
Definition Player.cpp:17504
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:4284
bool IsUnitOwnedAuraEffect() const
uint32 TriggerSpell
Definition SpellInfo.h:108
bool IsTargetingArea() const
Definition SpellInfo.cpp:79
Definition Spell.h:289
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
Definition SpellInfo.h:255
bool IsDeathPersistent() const
bool IsPassive() const
uint32 Id
Definition SpellInfo.h:160
SpellSpecificType GetSpellSpecific() const
bool IsChanneled() const
bool HasAreaAuraEffect() const
uint32 SpellFamilyName
Definition SpellInfo.h:226
Definition Unit.h:1367
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
bool HealthAbovePct(int32 pct) const
Definition Unit.h:1621
Unit * GetOwner() const
Definition Unit.cpp:2339
void CombatStop(bool includingCast=false)
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID=0, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Player * GetSpellModOwner() const
Definition Unit.cpp:5818
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:1448
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:2377
Aura * GetAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
int32 CalcSpellDuration(SpellInfo const *spellProto)
Definition Unit.cpp:4714
Aura * AddAura(uint32 spellId, Unit *target)
uint8 getClass() const
Definition Unit.h:1543
uint64 GetTarget() const
Definition Unit.h:2830
int32 GetMaxPower(Powers power) const
Definition Unit.cpp:5246
bool HasAura(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
bool IsDuringRemoveFromWorld() const
Definition Unit.h:2798
void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID)
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1) const
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID=0) const
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:3580
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1) const
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
int32 GetTotalAuraModifier(AuraType auratype) const
AuraList & GetSingleCastAuras()
Definition Unit.h:2247
Vehicle * GetVehicleKit() const
Definition Unit.h:2739
Aura * GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID=0, uint64 itemCasterGUID=0, uint32 reqEffMask=0) const
void RemoveMovementImpairingAuras()
uint8 GetAvailableSeatCount() const
Gets the available seat count.
Definition Vehicle.cpp:657
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition Object.cpp:1607
uint32 GetDrainSoulExecuteAuraSpellId()
uint32 GetArcanePotencyTriggerSpellId(uint32 auraSpellId)
uint32 GetImprovedDevouringPlagueDamageSpellId()
uint32 GetImprovedDevouringPlagueHealSpellId()
uint32 GetTheBeastWithinTriggerSpellId()
uint32 GetPaladinTier10HolyBonusAuraSpellId()
uint32 GetGlyphOfBlurredSpeedSprintSpellId()
uint32 GetPolymorphPenguinSpellId()
uint32 GetAvengingWrathAuraSpellId()
uint32 GetHeroicFuryCooldownSpellId()
uint32 GetGlyphOfFreezingTrapAuraSpellId()
bool IsUnsavableSpecialAura(uint32 auraSpellId)
uint32 GetImprovedFearTriggerSpellId(uint32 auraSpellId)
uint32 GetPaladinTier10HolyBonusTriggerSpellId()
bool IsUnsavableDruidEclipseAura(uint32 auraSpellId)
uint32 GetDruidFeralTier10BonusTriggerSpellId()
uint32 GetDruidFeralTier10BonusAuraSpellId()
uint32 GetGlyphOfBlurredSpeedAuraSpellId()
uint32 GetGlyphOfPenguinAuraSpellId()
uint32 GetStonedAuraTriggerSpellId(uint32 auraSpellId)
uint32 GetInvisibilityFadeSpellId()
uint32 GetAvengingWrathMarkerAuraSpellId()
uint32 GetTheBeastWithinTalentSpellId()
uint32 GetDruidTier8RestorationAuraSpellId()
uint32 GetGlyphOfPowerWordShieldHealSpellId()
uint32 GetGlyphOfFreezingTrapTriggerSpellId()
uint32 GetSharedSufferingTriggerSpellId()
uint32 GetGlyphOfPowerWordShieldAuraSpellId()
uint32 GetDruidTier8RestorationTriggerSpellId()
Definition SpellMgr.h:277