AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SpellAuras.cpp File Reference
#include "ArenaSpectator.h"
#include "CellImpl.h"
#include "Common.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Unit.h"
#include "Util.h"
#include "Vehicle.h"
#include "WorldPacket.h"
#include "GridNotifiersImpl.h"

Go to the source code of this file.

Functions

static bool IsPaladinAuraDominant (Aura const *aura, Aura const *other, Unit const *target)
 
static AuraApplication * GetDominantOtherSameSpellApp (Unit *target, uint32 spellId, ObjectGuid casterGUID)
 

Variables

static constexpr int32 UPDATE_TARGET_MAP_INTERVAL = 500
 

Function Documentation

◆ GetDominantOtherSameSpellApp()

static AuraApplication * GetDominantOtherSameSpellApp ( Unit *  target,
uint32  spellId,
ObjectGuid  casterGUID 
)
static
561{
562 AuraApplication* best = nullptr;
563 for (uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId); rankSpell; rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell))
564 {
565 Unit::AuraApplicationMapBoundsNonConst bounds = target->GetAppliedAuras().equal_range(rankSpell);
566 for (Unit::AuraApplicationMap::iterator it = bounds.first; it != bounds.second; ++it)
567 {
568 AuraApplication* app = it->second;
569 if (app->GetBase()->GetCasterGUID() == casterGUID)
570 continue;
571 if (!best || IsPaladinAuraDominant(app->GetBase(), best->GetBase(), target))
572 best = app;
573 }
574 }
575 return best;
576}
std::uint32_t uint32
Definition Define.h:107
static bool IsPaladinAuraDominant(Aura const *aura, Aura const *other, Unit const *target)
Definition SpellAuras.cpp:535
#define sSpellMgr
Definition SpellMgr.h:847
Definition SpellAuras.h:37
Aura * GetBase() const
Definition SpellAuras.h:63
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:106
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition Unit.h:676
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1388

References Unit::GetAppliedAuras(), AuraApplication::GetBase(), Aura::GetCasterGUID(), IsPaladinAuraDominant(), and sSpellMgr.

Referenced by Aura::UpdateTargetMap().

◆ IsPaladinAuraDominant()

static bool IsPaladinAuraDominant ( Aura const *  aura,
Aura const *  other,
Unit const *  target 
)
static
536{
537 auto primaryAmount = [](Aura const* a) -> int32
538 {
539 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
540 if (AuraEffect* eff = a->GetEffect(i))
541 return eff->GetAmount();
542 return 0;
543 };
544
545 int32 auraAmount = std::abs(primaryAmount(aura));
546 int32 otherAmount = std::abs(primaryAmount(other));
547 if (auraAmount != otherAmount)
548 return auraAmount > otherAmount;
549
550 bool auraSelf = aura->GetCasterGUID() == target->GetGUID();
551 bool otherSelf = other->GetCasterGUID() == target->GetGUID();
552 if (auraSelf != otherSelf)
553 return auraSelf;
554
555 return aura->GetCasterGUID() < other->GetCasterGUID();
556}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1673
std::int32_t int32
Definition Define.h:103
std::uint8_t uint8
Definition Define.h:109
Definition SpellAuraEffects.h:39
Definition SpellAuras.h:88

References Aura::GetCasterGUID(), Object::GetGUID(), and MAX_SPELL_EFFECTS.

Referenced by GetDominantOtherSameSpellApp(), and Aura::UpdateTargetMap().

Variable Documentation

◆ UPDATE_TARGET_MAP_INTERVAL

constexpr int32 UPDATE_TARGET_MAP_INTERVAL = 500
staticconstexpr
Todo:
: this import is not necessary for compilation and marked as unused by the IDE

Referenced by Aura::UpdateTargetMap().