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
577{
578 AuraApplication* best = nullptr;
579 for (uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId); rankSpell; rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell))
580 {
581 Unit::AuraApplicationMapBoundsNonConst bounds = target->GetAppliedAuras().equal_range(rankSpell);
582 for (Unit::AuraApplicationMap::iterator it = bounds.first; it != bounds.second; ++it)
583 {
584 AuraApplication* app = it->second;
585 if (app->GetBase()->GetCasterGUID() == casterGUID)
586 continue;
587 if (!best || IsPaladinAuraDominant(app->GetBase(), best->GetBase(), target))
588 best = app;
589 }
590 }
591 return best;
592}
std::uint32_t uint32
Definition Define.h:107
static bool IsPaladinAuraDominant(Aura const *aura, Aura const *other, Unit const *target)
Definition SpellAuras.cpp:551
#define sSpellMgr
Definition SpellMgr.h:851
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:681
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1400

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
552{
553 auto primaryAmount = [](Aura const* a) -> int32
554 {
555 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
556 if (AuraEffect* eff = a->GetEffect(i))
557 return eff->GetAmount();
558 return 0;
559 };
560
561 int32 auraAmount = std::abs(primaryAmount(aura));
562 int32 otherAmount = std::abs(primaryAmount(other));
563 if (auraAmount != otherAmount)
564 return auraAmount > otherAmount;
565
566 bool auraSelf = aura->GetCasterGUID() == target->GetGUID();
567 bool otherSelf = other->GetCasterGUID() == target->GetGUID();
568 if (auraSelf != otherSelf)
569 return auraSelf;
570
571 return aura->GetCasterGUID() < other->GetCasterGUID();
572}
#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().