TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AuraEffect Class Reference

#include <SpellAuraEffects.h>

Public Member Functions

 ~AuraEffect ()
 
 AuraEffect (Aura *base, uint32 effIndex, int32 *baseAmount, Unit *caster)
 
UnitGetCaster () const
 
ObjectGuid GetCasterGUID () const
 
AuraGetBase () const
 
void GetTargetList (std::list< Unit * > &targetList) const
 
void GetApplicationList (std::list< AuraApplication * > &applicationList) const
 
SpellModifierGetSpellModifier () const
 
SpellInfo constGetSpellInfo () const
 
uint32 GetId () const
 
uint32 GetEffIndex () const
 
int32 GetBaseAmount () const
 
int32 GetPeriod () const
 
int32 GetMiscValueB () const
 
int32 GetMiscValue () const
 
AuraType GetAuraType () const
 
int32 GetAmount () const
 
void SetAmount (int32 amount)
 
int32 GetPeriodicTimer () const
 
void SetPeriodicTimer (int32 periodicTimer)
 
int32 CalculateAmount (Unit *caster)
 
void CalculatePeriodic (Unit *caster, bool resetPeriodicTimer=true, bool load=false)
 
void CalculateSpellMod ()
 
void ChangeAmount (int32 newAmount, bool mark=true, bool onStackOrReapply=false)
 
void RecalculateAmount ()
 
void RecalculateAmount (Unit *caster)
 
bool CanBeRecalculated () const
 
void SetCanBeRecalculated (bool val)
 
void HandleEffect (AuraApplication *aurApp, uint8 mode, bool apply)
 
void HandleEffect (Unit *target, uint8 mode, bool apply)
 
void ApplySpellMod (Unit *target, bool apply)
 
void SetDamage (int32 val)
 
int32 GetDamage () const
 
void SetCritChance (float val)
 
float GetCritChance () const
 
void SetDonePct (float val)
 
float GetDonePct () const
 
void Update (uint32 diff, Unit *caster)
 
void UpdatePeriodic (Unit *caster)
 
uint32 GetTickNumber () const
 
int32 GetTotalTicks () const
 
void ResetPeriodic (bool resetPeriodicTimer=false)
 
bool IsPeriodic () const
 
void SetPeriodic (bool isPeriodic)
 
bool IsAffectingSpell (SpellInfo const *spell) const
 
bool HasSpellClassMask () const
 
void SendTickImmune (Unit *target, Unit *caster) const
 
void PeriodicTick (AuraApplication *aurApp, Unit *caster) const
 
void HandleProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void CleanupTriggeredSpells (Unit *target)
 
void HandleShapeshiftBoosts (Unit *target, bool apply) const
 
SpellEffectInfo constGetSpellEffectInfo () const
 
bool IsEffect () const
 
bool IsEffect (SpellEffectName effectName) const
 
bool IsAreaAuraEffect () const
 
void HandleNULL (AuraApplication const *, uint8, bool) const
 
void HandleUnused (AuraApplication const *, uint8, bool) const
 
void HandleNoImmediateEffect (AuraApplication const *, uint8, bool) const
 
void HandleModInvisibilityDetect (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModInvisibility (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealthLevel (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStealthDetect (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleSpiritOfRedemption (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraGhost (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePhase (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePhaseGroup (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModShapeshift (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTransform (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModScale (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraCloneCaster (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleFeignDeath (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModUnattackable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDisarm (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSilence (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPacify (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPacifyAndSilence (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraAllowOnlyAbility (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackResources (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackCreatures (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraTrackStealthed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStalked (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraUntrackable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModPetTalentsPoints (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSkill (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraMounted (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraAllowFlight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraWaterWalk (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraFeatherFall (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraHover (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleWaterBreathing (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleForceMoveForward (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModThreat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModTotalThreat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTaunt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModConfuse (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModFear (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStun (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRoot (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePreventFleeing (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPossess (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPossessPet (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCharm (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleCharmConvert (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraControlVehicle (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseMountedSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseFlightSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseSwimSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDecreaseSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModUseNormalSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStateImmunityMask (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMechanicImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModEffectImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStateImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModSchoolImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDmgImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDispelImmunity (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistanceExclusive (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModBaseResistancePCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModResistancePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModBaseResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTargetResistance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPercentStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellDamagePercentFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHealingPercentFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellDamagePercentFromAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHealingPercentFromAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModHealingDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModTotalPercentStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModResistenceOfStatPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModExpertise (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModStatBonusPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleOverrideSpellPowerByAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleOverrideAttackPowerBySpellPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerRegen (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerRegenPCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModManaRegen (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseHealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseMaxHealth (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseEnergy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseEnergyPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseHealthPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraIncreaseBaseHealthPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModIncreaseBaseManaPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModParryPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModDodgePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModBlockPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRegenInterrupt (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModWeaponCritPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModHitChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellHitChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCritChance (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCritChanceShool (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModCritPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCastingSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMeleeRangedSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModCombatSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModAttackSpeed (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModMeleeSpeedPct (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedHaste (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModRating (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModRatingFromStat (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModRangedAttackPowerPercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModAttackPowerOfArmor (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDamageDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModDamagePercentDone (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModOffhandDamagePercent (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleShieldBlockValue (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerCostPCT (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModPowerCost (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleArenaPreparation (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleNoReagentUseAura (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraRetainComboPoints (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraDummy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleChannelDeathItem (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleBindSight (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleForceReaction (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraEmpathy (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModFaction (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleComprehendLanguage (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraConvertRune (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraLinked (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraOpenStable (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraModFakeInebriation (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraOverrideSpells (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraSetVehicle (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePreventResurrection (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleMastery (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleAuraForceWeather (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleEnableAltPower (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandleModSpellCategoryCooldown (AuraApplication const *aurApp, uint8 mode, bool apply) const
 
void HandlePeriodicDummyAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicTriggerSpellAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicTriggerSpellWithValueAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicDamageAurasTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealthLeechAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealthFunnelAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicHealAurasTick (Unit *target, Unit *caster) const
 
void HandlePeriodicManaLeechAuraTick (Unit *target, Unit *caster) const
 
void HandleObsModPowerAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicEnergizeAuraTick (Unit *target, Unit *caster) const
 
void HandlePeriodicPowerBurnAuraTick (Unit *target, Unit *caster) const
 
void HandleProcTriggerSpellAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerSpellWithValueAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerDamageAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleRaidProcFromChargeAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleRaidProcFromChargeWithValueAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void HandleProcTriggerSpellOnPowerAmountAuraProc (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 

Private Member Functions

friend Aura::~Aura ()
 
bool CanPeriodicTickCrit (Unit const *caster) const
 

Private Attributes

Aura *const m_base
 
SpellInfo const *const m_spellInfo
 
SpellEffectInfo const_effectInfo
 
int32 const m_baseAmount
 
int32 m_amount
 
int32 m_damage
 
float m_critChance
 
float m_donePct
 
SpellModifierm_spellmod
 
int32 m_periodicTimer
 
int32 m_period
 
uint32 m_tickNumber
 
uint8 const m_effIndex
 
bool m_canBeRecalculated
 
bool m_isPeriodic
 

Friends

void Aura::_InitEffects (uint32 effMask, Unit *caster, int32 *baseAmount)
 
AuraUnit::_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint32 effMask, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
 

Constructor & Destructor Documentation

AuraEffect::Aura::~Aura ( )
private
AuraEffect::~AuraEffect ( )
564 {
565  delete m_spellmod;
566 }
SpellModifier * m_spellmod
Definition: SpellAuraEffects.h:120
AuraEffect::AuraEffect ( Aura base,
uint32  effIndex,
int32 baseAmount,
Unit caster 
)
548  :
549 m_base(base), m_spellInfo(base->GetSpellInfo()),
550 _effectInfo(base->GetSpellEffectInfo(effIndex)),
551 m_baseAmount(baseAmount ? *baseAmount : base->GetSpellEffectInfo(effIndex)->BasePoints),
552 m_damage(0), m_critChance(0.0f), m_donePct(1.0f),
554 m_canBeRecalculated(true), m_isPeriodic(false)
555 {
556  CalculatePeriodic(caster, true, false);
557 
558  m_amount = CalculateAmount(caster);
559 
561 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
Definition: SpellAuraEffects.cpp:728
int32 m_amount
Definition: SpellAuraEffects.h:115
arena_t NULL
Definition: jemalloc_internal.h:624
SpellModifier * m_spellmod
Definition: SpellAuraEffects.h:120
int32 m_periodicTimer
Definition: SpellAuraEffects.h:122
SpellEffectInfo const * GetSpellEffectInfo(uint32 index) const
Definition: SpellAuras.cpp:396
SpellEffectInfo const * _effectInfo
Definition: SpellAuraEffects.h:112
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:127
int32 m_damage
Definition: SpellAuraEffects.h:116
bool m_isPeriodic
Definition: SpellAuraEffects.h:128
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
void CalculateSpellMod()
Definition: SpellAuraEffects.cpp:804
float m_critChance
Definition: SpellAuraEffects.h:117
Aura *const m_base
Definition: SpellAuraEffects.h:109
float m_donePct
Definition: SpellAuraEffects.h:118
uint8 const m_effIndex
Definition: SpellAuraEffects.h:126
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
int32 BasePoints
Definition: SpellInfo.h:248
int32 CalculateAmount(Unit *caster)
Definition: SpellAuraEffects.cpp:589
int32 const m_baseAmount
Definition: SpellAuraEffects.h:113

+ Here is the call graph for this function:

Member Function Documentation

void AuraEffect::ApplySpellMod ( Unit target,
bool  apply 
)
913 {
914  if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
915  return;
916 
917  target->ToPlayer()->AddSpellMod(m_spellmod, apply);
918 
919  // Auras with charges do not mod amount of passive auras
920  if (GetBase()->IsUsingCharges())
921  return;
922  // reapply some passive spells after add/remove related spellmods
923  // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
924  switch (GetMiscValue())
925  {
927  case SPELLMOD_EFFECT1:
928  case SPELLMOD_EFFECT2:
929  case SPELLMOD_EFFECT3:
930  case SPELLMOD_EFFECT4:
931  case SPELLMOD_EFFECT5:
932  {
933  ObjectGuid guid = target->GetGUID();
934  Unit::AuraApplicationMap & auras = target->GetAppliedAuras();
935  for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
936  {
937  Aura* aura = iter->second->GetBase();
938  // only passive and permament auras-active auras should have amount set on spellcast and not be affected
939  // if aura is cast by others, it will not be affected
940  if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
941  {
943  {
944  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
945  {
946  if (AuraEffect* aurEff = aura->GetEffect(i))
947  aurEff->RecalculateAmount();
948  }
949  }
950  else if (GetMiscValue() == SPELLMOD_EFFECT1)
951  {
952  if (AuraEffect* aurEff = aura->GetEffect(0))
953  aurEff->RecalculateAmount();
954  }
955  else if (GetMiscValue() == SPELLMOD_EFFECT2)
956  {
957  if (AuraEffect* aurEff = aura->GetEffect(1))
958  aurEff->RecalculateAmount();
959  }
960  else if (GetMiscValue() == SPELLMOD_EFFECT3)
961  {
962  if (AuraEffect* aurEff = aura->GetEffect(2))
963  aurEff->RecalculateAmount();
964  }
965  else if (GetMiscValue() == SPELLMOD_EFFECT4)
966  {
967  if (AuraEffect* aurEff = aura->GetEffect(3))
968  aurEff->RecalculateAmount();
969  }
970  else if (GetMiscValue() == SPELLMOD_EFFECT5)
971  {
972  if (AuraEffect* aurEff = aura->GetEffect(4))
973  aurEff->RecalculateAmount();
974  }
975  }
976  }
977  }
978  default:
979  break;
980  }
981 }
Definition: SpellAuraEffects.h:30
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool IsPassive() const
Definition: SpellAuras.cpp:1026
Definition: Unit.h:89
Definition: Unit.h:118
Definition: Unit.h:98
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: Unit.h:94
bool IsPermanent() const
Definition: SpellAuras.h:168
SpellModifier * m_spellmod
Definition: SpellAuraEffects.h:120
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
Definition: Unit.h:109
TypeID GetTypeId() const
Definition: Object.h:113
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1789
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
Definition: ObjectGuid.h:189
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1315
Definition: SpellAuras.h:116
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
Definition: Unit.h:119
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition: SpellInfo.cpp:1545

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 AuraEffect::CalculateAmount ( Unit caster)
590 {
591  // default amount calculation
592  int32 amount = 0;
593 
595  amount = GetSpellEffectInfo()->CalcValue(caster, &m_baseAmount, GetBase()->GetOwner()->ToUnit(), nullptr, GetBase()->GetCastItemLevel());
596  else if (caster && caster->GetTypeId() == TYPEID_PLAYER)
598 
599  // check item enchant aura cast
600  if (!amount && caster)
601  {
602  ObjectGuid itemGUID = GetBase()->GetCastItemGUID();
603  if (!itemGUID.IsEmpty())
604  {
605  if (Player* playerCaster = caster->ToPlayer())
606  {
607  if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
608  {
609  if (castItem->GetItemSuffixFactor())
610  {
611  ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
612  if (item_rand_suffix)
613  {
614  for (int k = 0; k < MAX_ITEM_RANDOM_PROPERTIES; k++)
615  {
616  SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->Enchantment[k]);
617  if (pEnchant)
618  {
619  for (int t = 0; t < MAX_ITEM_ENCHANTMENT_EFFECTS; t++)
620  {
621  if (pEnchant->EffectSpellID[t] == m_spellInfo->Id)
622  {
623  amount = uint32((item_rand_suffix->AllocationPct[k] * castItem->GetItemSuffixFactor()) / 10000);
624  break;
625  }
626  }
627  }
628 
629  if (amount)
630  break;
631  }
632  }
633  }
634  }
635  }
636  }
637  }
638 
639  // custom amount calculations go here
640  switch (GetAuraType())
641  {
642  // crowd control auras
644  case SPELL_AURA_MOD_FEAR:
645  case SPELL_AURA_MOD_STUN:
646  case SPELL_AURA_MOD_ROOT:
648  m_canBeRecalculated = false;
649  if (!m_spellInfo->ProcFlags)
650  break;
651  amount = int32(GetBase()->GetUnitOwner()->CountPctFromMaxHealth(10));
652  if (caster)
653  {
654  // Glyphs increasing damage cap
655  Unit::AuraEffectList const& overrideClassScripts = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
656  for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
657  {
658  if ((*itr)->IsAffectingSpell(m_spellInfo))
659  {
660  // Glyph of Frost nova and similar auras
661  if ((*itr)->GetMiscValue() == 7801)
662  {
663  AddPct(amount, (*itr)->GetAmount());
664  break;
665  }
666  }
667  }
668  }
669  break;
672  m_canBeRecalculated = false;
673  break;
674  case SPELL_AURA_MOUNTED:
675  {
676  uint32 mountType = uint32(GetMiscValueB());
677  if (MountEntry const* mountEntry = sDB2Manager.GetMount(GetId()))
678  mountType = mountEntry->MountTypeId;
679 
680  if (MountCapabilityEntry const* mountCapability = GetBase()->GetUnitOwner()->GetMountCapability(mountType))
681  {
682  amount = mountCapability->ID;
683  m_canBeRecalculated = false;
684  }
685  break;
686  }
688  {
689  if (caster)
690  {
691  // if Level <= 70 resist = player level
692  int32 resist = caster->getLevel();
693 
694  if (resist > 70 && resist < 81)
695  resist += (resist - 70) * 5;
696  else if (resist > 80)
697  resist += ((resist-70) * 5 + (resist - 80) * 7);
698 
699  switch (GetId())
700  {
701  case 20043: // Aspect of the Wild
702  case 8185: // Elemental Resistance
703  case 19891: // Resistance Aura
704  case 79106: // Shadow Protection
705  case 79107: // Shadow Protection
706  amount = resist;
707  break;
708  case 79060: // Mark of the Wild
709  case 79061: // Mark of the Wild
710  case 79062: // Blessing of Kings
711  case 79063: // Blessing of Kings
712  case 90363: // Embrace of the Shale Spider
713  amount = resist / 2;
714  break;
715  }
716  break;
717  }
718  }
719  default:
720  break;
721  }
722 
724  amount *= GetBase()->GetStackAmount();
725  return amount;
726 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
#define sDB2Manager
Definition: DB2Stores.h:224
uint32 Id
Definition: SpellInfo.h:329
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
Definition: SpellAuraDefines.h:72
DB2Storage< ItemRandomSuffixEntry > sItemRandomSuffixStore("ItemRandomSuffix.db2", ItemRandomSuffixFormat, HOTFIX_SEL_ITEM_RANDOM_SUFFIX)
uint32 GetId() const
Definition: SpellAuraEffects.h:47
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:133
Definition: SpellAuraDefines.h:203
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1212
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
Definition: SpellAuraDefines.h:67
Definition: SharedDefines.h:673
Unit * GetUnitOwner() const
Definition: SpellAuras.h:138
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
int32 GetMiscValueB() const
Definition: SpellAuraEffects.h:52
Definition: SpellAuraDefines.h:86
Definition: DBCStructure.h:1214
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:127
Player * ToPlayer()
Definition: Object.h:191
uint8 getLevel() const
Definition: Unit.h:1408
Definition: SpellAuraDefines.h:116
uint32 ProcFlags
Definition: SpellInfo.h:370
TypeID GetTypeId() const
Definition: Object.h:113
Definition: UpdateFields.h:235
Definition: SpellAuraDefines.h:172
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
uint32 Enchantment[MAX_ITEM_RANDOM_PROPERTIES]
Definition: DB2Structure.h:784
Definition: Item.h:259
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
int32_t int32
Definition: Define.h:146
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
Definition: DB2Structure.h:779
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
Definition: SpellAuras.cpp:2106
float BonusCoefficient
Definition: SpellInfo.h:252
Definition: SpellAuraDefines.h:157
MountCapabilityEntry const * GetMountCapability(uint32 mountType) const
Definition: Unit.cpp:9773
int32 CalcValue(Unit const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:455
Definition: ObjectGuid.h:33
uint32 EffectSpellID[MAX_ITEM_ENCHANTMENT_EFFECTS]
Definition: DBCStructure.h:1220
uint8 GetStackAmount() const
Definition: SpellAuras.h:179
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
T AddPct(T &base, U pct)
Definition: Util.h:98
int32_t int32
Definition: g3dmath.h:167
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
Definition: DB2Structure.h:927
#define MAX_ITEM_RANDOM_PROPERTIES
Definition: DB2Structure.h:769
int32 const m_baseAmount
Definition: SpellAuraEffects.h:113
Definition: SpellAuraDefines.h:65
Definition: SpellAuraDefines.h:129
bool fuzzyEq(double a, double b)
Definition: g3dmath.h:857
Definition: DB2Structure.h:913
uint32 AllocationPct[MAX_ITEM_RANDOM_PROPERTIES]
Definition: DB2Structure.h:785
bool IsEmpty() const
Definition: ObjectGuid.h:242
Definition: SpellAuraDefines.h:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::CalculatePeriodic ( Unit caster,
bool  resetPeriodicTimer = true,
bool  load = false 
)
729 {
731 
732  // prepare periodics
733  switch (GetAuraType())
734  {
736  // 3 spells have no amplitude set
737  if (!m_period)
751  m_isPeriodic = true;
752  break;
753  default:
754  break;
755  }
756 
758 
759  if (!m_isPeriodic)
760  return;
761 
762  Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
763 
764  // Apply casting time mods
765  if (m_period)
766  {
767  // Apply periodic time mod
768  if (modOwner)
769  modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_period);
770 
771  if (caster)
772  {
773  // Haste modifies periodic time of channeled spells
774  if (m_spellInfo->IsChanneled())
778  }
779  }
780 
781  if (load) // aura loaded from db
782  {
786  ++m_tickNumber;
787  }
788  else // aura just created or reapplied
789  {
790  m_tickNumber = 0;
791  // reset periodic timer on aura create or on reapply when aura isn't dot
792  // possibly we should not reset periodic timers only when aura is triggered by proc
793  // or maybe there's a spell attribute somewhere
794  if (resetPeriodicTimer)
795  {
796  m_periodicTimer = 0;
797  // Start periodic on next tick or at aura apply
800  }
801  }
802 }
Definition: SharedDefines.h:549
Definition: SpellAuraDefines.h:68
Definition: SpellAuraDefines.h:63
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
Definition: SpellAuraDefines.h:287
Definition: SpellAuraDefines.h:222
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
Definition: SpellAuras.cpp:2120
bool IsChanneled() const
Definition: SpellInfo.cpp:1514
void ModSpellDurationTime(SpellInfo const *spellProto, int32 &castTime, Spell *spell=NULL)
Definition: Unit.cpp:11067
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Definition: SpellAuraDefines.h:80
Definition: UpdateFields.h:129
arena_t NULL
Definition: jemalloc_internal.h:624
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
int32 m_periodicTimer
Definition: SpellAuraEffects.h:122
Definition: SharedDefines.h:545
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
bool m_isPeriodic
Definition: SpellAuraEffects.h:128
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
Definition: SpellAuraDefines.h:83
Definition: SpellAuraDefines.h:286
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
int32 m_period
Definition: SpellAuraEffects.h:123
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
int32 GetDuration() const
Definition: SpellAuras.h:163
Definition: SpellAuraDefines.h:124
Definition: SpellAuraDefines.h:81
Definition: Unit.h:105
Definition: SpellAuraDefines.h:84
Player * GetSpellModOwner() const
Definition: Unit.cpp:12691
Definition: Common.h:103
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
int32_t int32
Definition: g3dmath.h:167
Definition: SpellAuraDefines.h:113
Definition: SpellAuraDefines.h:149
Definition: SpellAuraDefines.h:122
uint32 ApplyAuraPeriod
Definition: SpellInfo.h:245

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::CalculateSpellMod ( )
805 {
806  switch (GetAuraType())
807  {
810  if (!m_spellmod)
811  {
814 
815  m_spellmod->type = SpellModType(uint32(GetAuraType())); // SpellModType value == spell aura types
816  m_spellmod->spellId = GetId();
819  }
821  break;
822  default:
823  break;
824  }
826 }
SpellModOp op
Definition: Player.h:170
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Definition: SpellAuras.cpp:2134
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
SpellModOp
Definition: Unit.h:84
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: Player.h:167
uint32 GetId() const
Definition: SpellAuraEffects.h:47
SpellModifier * m_spellmod
Definition: SpellAuraEffects.h:120
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
Definition: SpellAuraDefines.h:168
SpellModType type
Definition: Player.h:171
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32 spellId
Definition: Player.h:175
flag128 mask
Definition: Player.h:174
flag128 SpellClassMask
Definition: SpellInfo.h:264
Definition: SpellAuraDefines.h:167
uint8 GetCharges() const
Definition: SpellAuras.h:170
int32 value
Definition: Player.h:173
SpellModType
Definition: Player.h:75
uint32_t uint32
Definition: g3dmath.h:168
int16 charges
Definition: Player.h:172

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool AuraEffect::CanBeRecalculated ( ) const
inline
67 { return m_canBeRecalculated; }
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:127

+ Here is the caller graph for this function:

bool AuraEffect::CanPeriodicTickCrit ( Unit const caster) const
private
1141 {
1142  ASSERT(caster);
1143 
1144  return caster->HasAuraTypeWithAffectMask(SPELL_AURA_ABILITY_PERIODIC_CRIT, m_spellInfo);
1145 }
Definition: SpellAuraDefines.h:346
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::ChangeAmount ( int32  newAmount,
bool  mark = true,
bool  onStackOrReapply = false 
)
829 {
830  // Reapply if amount change
831  uint8 handleMask = 0;
832  if (newAmount != GetAmount())
833  handleMask |= AURA_EFFECT_HANDLE_CHANGE_AMOUNT;
834  if (onStackOrReapply)
835  handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
836 
837  if (!handleMask)
838  return;
839 
840  std::list<AuraApplication*> effectApplications;
841  GetApplicationList(effectApplications);
842 
843  for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
844  if ((*apptItr)->HasEffect(GetEffIndex()))
845  HandleEffect(*apptItr, handleMask, false);
846 
847  if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
848  {
849  if (!mark)
850  m_amount = newAmount;
851  else
852  SetAmount(newAmount);
854  }
855 
856  for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
857  if ((*apptItr)->HasEffect(GetEffIndex()))
858  HandleEffect(*apptItr, handleMask, true);
859 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
int32 m_amount
Definition: SpellAuraEffects.h:115
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition: SpellAuraEffects.cpp:861
void GetApplicationList(std::list< AuraApplication * > &applicationList) const
Definition: SpellAuraEffects.cpp:579
void CalculateSpellMod()
Definition: SpellAuraEffects.cpp:804
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: SpellAuraDefines.h:41
void SetAmount(int32 amount)
Definition: SpellAuraEffects.h:56
uint8_t uint8
Definition: Define.h:152
Definition: SpellAuraDefines.h:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::CleanupTriggeredSpells ( Unit target)
Todo:
is there a spell flag, which can solve this in a more sophisticated way?
1251 {
1252  uint32 tSpellId = GetSpellEffectInfo()->TriggerSpell;
1253  if (!tSpellId)
1254  return;
1255 
1256  SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1257  if (!tProto)
1258  return;
1259 
1260  if (tProto->GetDuration() != -1)
1261  return;
1262 
1263  // needed for spell 43680, maybe others
1267  return;
1268 
1269  target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1270 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
Definition: SpellInfo.h:326
uint32 ApplyAuraName
Definition: SpellInfo.h:244
int32 GetDuration() const
Definition: SpellInfo.cpp:2490
uint32 TriggerSpell
Definition: SpellInfo.h:263
Definition: SpellAuraDefines.h:83
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
uint32_t uint32
Definition: g3dmath.h:168
uint32 ApplyAuraPeriod
Definition: SpellInfo.h:245

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 AuraEffect::GetAmount ( ) const
inline
55 { return m_amount; }
int32 m_amount
Definition: SpellAuraEffects.h:115
void AuraEffect::GetApplicationList ( std::list< AuraApplication * > &  applicationList) const
580 {
581  Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap();
582  for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
583  {
584  if (appIter->second->HasEffect(GetEffIndex()))
585  applicationList.push_back(appIter->second);
586  }
587 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
ApplicationMap const & GetApplicationMap()
Definition: SpellAuras.h:231
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition: SpellAuras.h:120

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AuraType AuraEffect::GetAuraType ( ) const
inline
AuraType
Definition: SpellAuraDefines.h:58
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
uint32 ApplyAuraName
Definition: SpellInfo.h:244

+ Here is the caller graph for this function:

Aura* AuraEffect::GetBase ( ) const
inline
41 { return m_base; }
Aura *const m_base
Definition: SpellAuraEffects.h:109

+ Here is the caller graph for this function:

int32 AuraEffect::GetBaseAmount ( ) const
inline
49 { return m_baseAmount; }
int32 const m_baseAmount
Definition: SpellAuraEffects.h:113

+ Here is the caller graph for this function:

Unit* AuraEffect::GetCaster ( ) const
inline
39 { return GetBase()->GetCaster(); }
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
Aura * GetBase() const
Definition: SpellAuraEffects.h:41

+ Here is the caller graph for this function:

ObjectGuid AuraEffect::GetCasterGUID ( ) const
inline
40 { return GetBase()->GetCasterGUID(); }
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135

+ Here is the caller graph for this function:

float AuraEffect::GetCritChance ( ) const
inline
76 { return m_critChance; }
float m_critChance
Definition: SpellAuraEffects.h:117
int32 AuraEffect::GetDamage ( ) const
inline
74 { return m_damage; }
int32 m_damage
Definition: SpellAuraEffects.h:116
float AuraEffect::GetDonePct ( ) const
inline
78 { return m_donePct; }
float m_donePct
Definition: SpellAuraEffects.h:118
uint32 AuraEffect::GetEffIndex ( ) const
inline
48 { return m_effIndex; }
uint8 const m_effIndex
Definition: SpellAuraEffects.h:126

+ Here is the caller graph for this function:

uint32 AuraEffect::GetId ( void  ) const
inline
47 { return m_spellInfo->Id; }
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111

+ Here is the caller graph for this function:

int32 AuraEffect::GetMiscValue ( ) const
inline
53 { return GetSpellEffectInfo()->MiscValue; }
int32 MiscValue
Definition: SpellInfo.h:253
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
int32 AuraEffect::GetMiscValueB ( ) const
inline
52 { return GetSpellEffectInfo()->MiscValueB; }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
int32 MiscValueB
Definition: SpellInfo.h:254

+ Here is the caller graph for this function:

int32 AuraEffect::GetPeriod ( ) const
inline
50 { return m_period; }
int32 m_period
Definition: SpellAuraEffects.h:123

+ Here is the caller graph for this function:

int32 AuraEffect::GetPeriodicTimer ( ) const
inline
58 { return m_periodicTimer; }
int32 m_periodicTimer
Definition: SpellAuraEffects.h:122

+ Here is the caller graph for this function:

SpellEffectInfo const* AuraEffect::GetSpellEffectInfo ( ) const
inline
102 { return _effectInfo; }
SpellEffectInfo const * _effectInfo
Definition: SpellAuraEffects.h:112

+ Here is the caller graph for this function:

SpellInfo const* AuraEffect::GetSpellInfo ( ) const
inline
46 { return m_spellInfo; }
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111

+ Here is the caller graph for this function:

SpellModifier* AuraEffect::GetSpellModifier ( ) const
inline
44 { return m_spellmod; }
SpellModifier * m_spellmod
Definition: SpellAuraEffects.h:120
void AuraEffect::GetTargetList ( std::list< Unit * > &  targetList) const
569 {
570  Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap();
571  // remove all targets which were not added to new list - they no longer deserve area aura
572  for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
573  {
574  if (appIter->second->HasEffect(GetEffIndex()))
575  targetList.push_back(appIter->second->GetTarget());
576  }
577 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
ApplicationMap const & GetApplicationMap()
Definition: SpellAuras.h:231
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition: SpellAuras.h:120

+ Here is the call graph for this function:

uint32 AuraEffect::GetTickNumber ( ) const
inline
83 { return m_tickNumber; }
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124

+ Here is the caller graph for this function:

int32 AuraEffect::GetTotalTicks ( ) const
inline
84 { return m_period ? (GetBase()->GetMaxDuration() / m_period) : 1;}
int32 GetMaxDuration() const
Definition: SpellAuras.h:159
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
int32 m_period
Definition: SpellAuraEffects.h:123

+ Here is the caller graph for this function:

void AuraEffect::HandleArenaPreparation ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4729 {
4730  if (!(mode & AURA_EFFECT_HANDLE_REAL))
4731  return;
4732 
4733  Unit* target = aurApp->GetTarget();
4734 
4735  if (apply)
4737  else
4738  {
4739  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4740  if (target->HasAuraType(GetAuraType()))
4741  return;
4743  }
4744 }
Definition: Unit.h:678
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:39
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:109
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraAllowFlight ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2719 {
2721  return;
2722 
2723  Unit* target = aurApp->GetTarget();
2724 
2725  if (!apply)
2726  {
2727  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2729  return;
2730  }
2731 
2732  target->SetCanFly(apply);
2733 
2734  if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
2735  target->GetMotionMaster()->MoveFall();
2736 }
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: ObjectGuid.h:32
bool IsLevitating() const
Definition: Unit.h:1667
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
void MoveFall(uint32 id=0)
Definition: MotionMaster.cpp:440
TypeID GetTypeId() const
Definition: Object.h:113
bool SetCanFly(bool enable)
Definition: Unit.cpp:15899
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: SpellAuraDefines.h:267
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraAllowOnlyAbility ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2502 {
2504  return;
2505 
2506  Unit* target = aurApp->GetTarget();
2507 
2508  if (target->GetTypeId() == TYPEID_PLAYER)
2509  {
2510  if (apply)
2512  else
2513  {
2514  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2516  return;
2518  }
2519  }
2520 }
Definition: SpellAuraDefines.h:323
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Player.h:540
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: UpdateFields.h:191
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraCloneCaster ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2239 {
2241  return;
2242 
2243  Unit* target = aurApp->GetTarget();
2244 
2245  if (apply)
2246  {
2247  Unit* caster = GetCaster();
2248  if (!caster || caster == target)
2249  return;
2250 
2251  // What must be cloned? at least display and scale
2252  target->SetDisplayId(caster->GetDisplayId());
2253  //target->SetObjectScale(caster->GetObjectScale()); // we need retail info about how scaling is handled (aura maybe?)
2255  }
2256  else
2257  {
2258  target->SetDisplayId(target->GetNativeDisplayId());
2260  }
2261 }
uint32 GetDisplayId() const
Definition: Unit.h:2012
Definition: UpdateFields.h:110
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
Definition: Unit.h:715
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:12799
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
uint32 GetNativeDisplayId() const
Definition: Unit.h:2014
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraControlVehicle ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

Such auras are applied from a caster(=player) to a vehicle. This has been verified using spell #49256

3049 {
3051  return;
3052 
3053  Unit* target = aurApp->GetTarget();
3054  if (!target->IsVehicle())
3055  return;
3056 
3057  Unit* caster = GetCaster();
3058  if (!caster || caster == target)
3059  return;
3060 
3061  if (apply)
3062  {
3063  // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3064  // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3065  // so this break such spells or most of them.
3066  // Current formula about m_amount: effect base points + dieside - 1
3067  // TO DO: Reasearch more about 0/0 and fix it.
3068  caster->_EnterVehicle(target->GetVehicleKit(), m_amount - 1, aurApp);
3069  }
3070  else
3071  {
3072  // Remove pending passengers before exiting vehicle - might cause an Uninstall
3074 
3075  if (GetId() == 53111) // Devour Humanoid
3076  {
3077  target->Kill(caster);
3078  if (caster->GetTypeId() == TYPEID_UNIT)
3079  caster->ToCreature()->RemoveCorpse();
3080  }
3081 
3082  if (!(mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT))
3083  caster->_ExitVehicle();
3084  else
3085  target->GetVehicleKit()->RemovePassenger(caster); // Only remove passenger from vehicle without launching exit movement or despawning the vehicle
3086 
3087  // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3088  caster->RemoveAurasDueToSpell(GetId());
3089  }
3090 }
void Kill(Unit *victim, bool durabilityLoss=true)
Definition: Unit.cpp:13513
bool IsVehicle() const
Definition: Unit.h:1406
uint32 GetId() const
Definition: SpellAuraEffects.h:47
int32 m_amount
Definition: SpellAuraEffects.h:115
void _ExitVehicle(Position const *exitPosition=NULL)
Definition: Unit.cpp:15340
Definition: ObjectGuid.h:32
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
TypeID GetTypeId() const
Definition: Object.h:113
void RemovePendingEventsForPassenger(Unit *passenger)
Definition: Vehicle.cpp:713
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=NULL)
Definition: Unit.cpp:15254
Vehicle * RemovePassenger(Unit *passenger)
Removes the passenger from the vehicle.
Definition: Vehicle.cpp:466
Definition: SpellAuraDefines.h:41
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Creature * ToCreature()
Definition: Object.h:194
void RemoveCorpse(bool setSpawnTime=true)
Definition: Creature.cpp:280
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

void AuraEffect::HandleAuraConvertRune ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5270 {
5271  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5272  return;
5273 
5274  Unit* target = aurApp->GetTarget();
5275 
5276  Player* player = target->ToPlayer();
5277  if (!player)
5278  return;
5279 
5280  if (player->getClass() != CLASS_DEATH_KNIGHT)
5281  return;
5282 
5283  uint32 runes = m_amount;
5284  // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
5285  if (apply)
5286  {
5287  for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
5288  {
5289  if (GetMiscValue() != player->GetCurrentRune(i))
5290  continue;
5291  if (!player->GetRuneCooldown(i))
5292  {
5293  player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
5294  --runes;
5295  }
5296  }
5297  }
5298  else
5299  player->RemoveRunesByAuraEffect(this);
5300 }
Definition: SharedDefines.h:172
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
int32 m_amount
Definition: SpellAuraEffects.h:115
#define MAX_RUNES
Definition: Player.h:451
int32 GetMiscValueB() const
Definition: SpellAuraEffects.h:52
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
RuneType
Definition: Player.h:459
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraDummy ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4789 {
4791  return;
4792 
4793  Unit* target = aurApp->GetTarget();
4794 
4795  Unit* caster = GetCaster();
4796 
4797  if (mode & AURA_EFFECT_HANDLE_REAL)
4798  {
4799  // pet auras
4800  if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), m_effIndex))
4801  {
4802  if (apply)
4803  target->AddPetAura(petSpell);
4804  else
4805  target->RemovePetAura(petSpell);
4806  }
4807  }
4808 
4809  if (mode & (AURA_EFFECT_HANDLE_REAL | AURA_EFFECT_HANDLE_REAPPLY))
4810  {
4811  // AT APPLY
4812  if (apply)
4813  {
4814  switch (GetId())
4815  {
4816  case 1515: // Tame beast
4817  // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
4818  if (caster && target->CanHaveThreatList())
4819  target->AddThreat(caster, 10.0f);
4820  break;
4821  case 13139: // net-o-matic
4822  // root to self part of (root_target->charge->root_self sequence
4823  if (caster)
4824  caster->CastSpell(caster, 13138, true, NULL, this);
4825  break;
4826  case 34026: // kill command
4827  {
4828  Unit* pet = target->GetGuardianPet();
4829  if (!pet)
4830  break;
4831 
4832  target->CastSpell(target, 34027, true, NULL, this);
4833 
4834  // set 3 stacks and 3 charges (to make all auras not disappear at once)
4835  Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
4836  Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
4837  if (owner_aura)
4838  {
4839  owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4840  if (pet_aura)
4841  {
4842  pet_aura->SetCharges(0);
4843  pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4844  }
4845  }
4846  break;
4847  }
4848  case 37096: // Blood Elf Illusion
4849  {
4850  if (caster)
4851  {
4852  if (caster->getGender() == GENDER_FEMALE)
4853  caster->CastSpell(target, 37095, true, NULL, this); // Blood Elf Disguise
4854  else
4855  caster->CastSpell(target, 37093, true, NULL, this);
4856  }
4857  break;
4858  }
4859  case 39850: // Rocket Blast
4860  if (roll_chance_i(20)) // backfire stun
4861  target->CastSpell(target, 51581, true, NULL, this);
4862  break;
4863  case 43873: // Headless Horseman Laugh
4864  target->PlayDistanceSound(11965);
4865  break;
4866  case 46354: // Blood Elf Illusion
4867  if (caster)
4868  {
4869  if (caster->getGender() == GENDER_FEMALE)
4870  caster->CastSpell(target, 46356, true, NULL, this);
4871  else
4872  caster->CastSpell(target, 46355, true, NULL, this);
4873  }
4874  break;
4875  case 46361: // Reinforced Net
4876  if (caster)
4877  target->GetMotionMaster()->MoveFall();
4878  break;
4879  case 71563:
4880  if (Aura* newAura = target->AddAura(71564, target))
4881  newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount);
4882  break;
4883  }
4884  }
4885  // AT REMOVE
4886  else
4887  {
4888  if ((GetSpellInfo()->IsQuestTame()) && caster && caster->IsAlive() && target->IsAlive())
4889  {
4890  uint32 finalSpelId = 0;
4891  switch (GetId())
4892  {
4893  case 19548: finalSpelId = 19597; break;
4894  case 19674: finalSpelId = 19677; break;
4895  case 19687: finalSpelId = 19676; break;
4896  case 19688: finalSpelId = 19678; break;
4897  case 19689: finalSpelId = 19679; break;
4898  case 19692: finalSpelId = 19680; break;
4899  case 19693: finalSpelId = 19684; break;
4900  case 19694: finalSpelId = 19681; break;
4901  case 19696: finalSpelId = 19682; break;
4902  case 19697: finalSpelId = 19683; break;
4903  case 19699: finalSpelId = 19685; break;
4904  case 19700: finalSpelId = 19686; break;
4905  case 30646: finalSpelId = 30647; break;
4906  case 30653: finalSpelId = 30648; break;
4907  case 30654: finalSpelId = 30652; break;
4908  case 30099: finalSpelId = 30100; break;
4909  case 30102: finalSpelId = 30103; break;
4910  case 30105: finalSpelId = 30104; break;
4911  }
4912 
4913  if (finalSpelId)
4914  caster->CastSpell(target, finalSpelId, true, NULL, this);
4915  }
4916 
4917  switch (m_spellInfo->SpellFamilyName)
4918  {
4919  case SPELLFAMILY_GENERIC:
4920  switch (GetId())
4921  {
4922  case 2584: // Waiting to Resurrect
4923  // Waiting to resurrect spell cancel, we must remove player from resurrect queue
4924  if (target->GetTypeId() == TYPEID_PLAYER)
4925  {
4926  if (Battleground* bg = target->ToPlayer()->GetBattleground())
4927  bg->RemovePlayerFromResurrectQueue(target->GetGUID());
4928  if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
4929  bf->RemovePlayerFromResurrectQueue(target->GetGUID());
4930  }
4931  break;
4932  case 36730: // Flame Strike
4933  {
4934  target->CastSpell(target, 36731, true, NULL, this);
4935  break;
4936  }
4937  case 44191: // Flame Strike
4938  {
4939  if (target->GetMap()->IsDungeon())
4940  {
4941  uint32 spellId = target->GetMap()->IsHeroic() ? 46163 : 44190;
4942 
4943  target->CastSpell(target, spellId, true, NULL, this);
4944  }
4945  break;
4946  }
4947  case 43681: // Inactive
4948  {
4949  if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
4950  return;
4951 
4952  if (target->GetMap()->IsBattleground())
4953  target->ToPlayer()->LeaveBattleground();
4954  break;
4955  }
4956  case 42783: // Wrath of the Astromancer
4957  target->CastSpell(target, GetAmount(), true, NULL, this);
4958  break;
4959  case 46308: // Burning Winds cast only at creatures at spawn
4960  target->CastSpell(target, 47287, true, NULL, this);
4961  break;
4962  case 52172: // Coyote Spirit Despawn Aura
4963  case 60244: // Blood Parrot Despawn Aura
4964  target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this);
4965  break;
4966  case 91604: // Restricted Flight Area
4967  if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
4968  target->CastSpell(target, 58601, true);
4969  break;
4970  }
4971  break;
4973  // Summon Gargoyle (Dismiss Gargoyle at remove)
4974  if (GetId() == 61777)
4975  target->CastSpell(target, GetAmount(), true);
4976  break;
4977  default:
4978  break;
4979  }
4980  }
4981  }
4982 
4983  // AT APPLY & REMOVE
4984 
4985  switch (m_spellInfo->SpellFamilyName)
4986  {
4987  case SPELLFAMILY_GENERIC:
4988  {
4989  if (!(mode & AURA_EFFECT_HANDLE_REAL))
4990  break;
4991  switch (GetId())
4992  {
4993  // Recently Bandaged
4994  case 11196:
4996  break;
4997  // Unstable Power
4998  case 24658:
4999  {
5000  uint32 spellId = 24659;
5001  if (apply && caster)
5002  {
5003  SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5004 
5005  for (uint32 i = 0; i < spell->StackAmount; ++i)
5006  caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID());
5007  break;
5008  }
5009  target->RemoveAurasDueToSpell(spellId);
5010  break;
5011  }
5012  // Restless Strength
5013  case 24661:
5014  {
5015  uint32 spellId = 24662;
5016  if (apply && caster)
5017  {
5018  SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
5019  for (uint32 i = 0; i < spell->StackAmount; ++i)
5020  caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID());
5021  break;
5022  }
5023  target->RemoveAurasDueToSpell(spellId);
5024  break;
5025  }
5026  // Tag Murloc
5027  case 30877:
5028  {
5029  // Tag/untag Blacksilt Scout
5030  target->SetEntry(apply ? 17654 : 17326);
5031  break;
5032  }
5033  case 57819: // Argent Champion
5034  case 57820: // Ebon Champion
5035  case 57821: // Champion of the Kirin Tor
5036  case 57822: // Wyrmrest Champion
5037  {
5038  if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5039  break;
5040 
5041  uint32 FactionID = 0;
5042 
5043  if (apply)
5044  {
5045  switch (m_spellInfo->Id)
5046  {
5047  case 57819: FactionID = 1106; break; // Argent Crusade
5048  case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
5049  case 57821: FactionID = 1090; break; // Kirin Tor
5050  case 57822: FactionID = 1091; break; // The Wyrmrest Accord
5051  }
5052  }
5053  caster->ToPlayer()->SetChampioningFaction(FactionID);
5054  break;
5055  }
5056  // LK Intro VO (1)
5057  case 58204:
5058  if (target->GetTypeId() == TYPEID_PLAYER)
5059  {
5060  // Play part 1
5061  if (apply)
5062  target->PlayDirectSound(14970, target->ToPlayer());
5063  // continue in 58205
5064  else
5065  target->CastSpell(target, 58205, true);
5066  }
5067  break;
5068  // LK Intro VO (2)
5069  case 58205:
5070  if (target->GetTypeId() == TYPEID_PLAYER)
5071  {
5072  // Play part 2
5073  if (apply)
5074  target->PlayDirectSound(14971, target->ToPlayer());
5075  // Play part 3
5076  else
5077  target->PlayDirectSound(14972, target->ToPlayer());
5078  }
5079  break;
5080  }
5081 
5082  break;
5083  }
5084  case SPELLFAMILY_MAGE:
5085  {
5086  //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5087  //break;
5088  break;
5089  }
5090  case SPELLFAMILY_PRIEST:
5091  {
5092  //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5093  //break;
5094  break;
5095  }
5096  case SPELLFAMILY_DRUID:
5097  {
5098  //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5099  //break;
5100  break;
5101  }
5102  case SPELLFAMILY_SHAMAN:
5103  {
5104  //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5105  //break;
5106  break;
5107  }
5108  case SPELLFAMILY_PALADIN:
5109  // if (!(mode & AURA_EFFECT_HANDLE_REAL))
5110  // break;
5111  break;
5113  {
5114  //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5115  // break;
5116  break;
5117  }
5118  }
5119 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
Definition: SharedDefines.h:4633
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
bool IsBattleground() const
Definition: Map.h:401
Guardian * GetGuardianPet() const
Definition: Unit.cpp:7596
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
void SetStackAmount(uint8 num)
Definition: SpellAuras.cpp:930
void PlayDirectSound(uint32 sound_id, Player *target=NULL)
Definition: Object.cpp:2966
Map * GetMap() const
Definition: Object.h:543
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4151
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:14463
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
uint32 GetZoneId() const
Definition: Object.cpp:1525
Definition: SharedDefines.h:4638
arena_t NULL
Definition: jemalloc_internal.h:624
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
bool IsDungeon() const
Definition: Map.h:395
void SetEntry(uint32 entry)
Definition: Object.h:108
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition: Unit.cpp:10652
Player * ToPlayer()
Definition: Object.h:191
void MoveFall(uint32 id=0)
Definition: MotionMaster.cpp:440
void RemovePetAura(PetAura const *petSpell)
Definition: Unit.cpp:13171
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:94
Definition: SharedDefines.h:4626
Definition: SpellMgr.h:433
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:864
bool IsHeroic() const
Definition: Map.cpp:3420
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: SharedDefines.h:4634
Definition: SharedDefines.h:4629
bool IsAlive() const
Definition: Unit.h:1692
void AddPetAura(PetAura const *petSpell)
Definition: Unit.cpp:13161
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
bool roll_chance_i(int chance)
Definition: Random.h:53
Definition: Battlefield.h:196
Definition: SpellAuraDefines.h:39
Definition: SharedDefines.h:4630
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:454
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:4623
uint8 const m_effIndex
Definition: SpellAuraEffects.h:126
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
uint8 getGender() const
Definition: Unit.h:1415
Definition: Battleground.h:235
void PlayDistanceSound(uint32 sound_id, Player *target=NULL)
Definition: Object.cpp:2955
uint32 StackAmount
Definition: SpellInfo.h:381
Definition: SpellAuraDefines.h:42
Definition: SpellAuras.h:116
Definition: Unit.h:1305
Definition: SharedDefines.h:1865
Definition: SpellAuraDefines.h:46
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869

+ Here is the call graph for this function:

void AuraEffect::HandleAuraEmpathy ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5214 {
5215  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5216  return;
5217 
5218  Unit* target = aurApp->GetTarget();
5219  if (!apply)
5220  {
5221  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5222  if (target->HasAuraType(GetAuraType()))
5223  return;
5224  }
5225 
5226  if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5228 }
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:1151
uint32 GetCreatureType() const
Definition: Unit.cpp:11248
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: SharedDefines.h:4205
Definition: SharedDefines.h:3554
Definition: UpdateFields.h:30
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraFeatherFall ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2756 {
2758  return;
2759 
2760  Unit* target = aurApp->GetTarget();
2761 
2762  if (!apply)
2763  {
2764  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2765  if (target->HasAuraType(GetAuraType()))
2766  return;
2767  }
2768 
2769  target->SetFeatherFall(apply);
2770 
2771  // start fall from current height
2772  if (!apply && target->GetTypeId() == TYPEID_PLAYER)
2773  target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
2774 }
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
float GetPositionZ() const
Definition: Position.h:106
bool SetFeatherFall(bool enable, bool packetOnly=false)
Definition: Unit.cpp:15980
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraForceWeather ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
6631 {
6632  if (!(mode & AURA_EFFECT_HANDLE_REAL))
6633  return;
6634 
6635  Player* target = aurApp->GetTarget()->ToPlayer();
6636 
6637  if (!target)
6638  return;
6639 
6640  if (apply)
6641  {
6643  target->GetSession()->SendPacket(weather.Write());
6644  }
6645  else
6646  {
6647  // send weather for current zone
6648  if (Weather* weather = WeatherMgr::FindWeather(target->GetZoneId()))
6649  weather->SendWeatherUpdateToPlayer(target);
6650  else
6651  {
6652  if (!WeatherMgr::AddWeather(target->GetZoneId()))
6653  {
6654  // send fine weather packet to remove old weather
6656  }
6657  }
6658  }
6659 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void apply(T *val)
Definition: ByteConverter.h:41
Definition: MiscPackets.h:400
Weather * FindWeather(uint32 id)
Find a Weather object by the given zoneid.
Definition: WeatherMgr.cpp:50
Definition: SpellAuraDefines.h:39
Weather * AddWeather(uint32 zone_id)
Add a Weather object to the list.
Definition: WeatherMgr.cpp:67
void SendFineWeatherUpdateToPlayer(Player *player)
Definition: WeatherMgr.cpp:144
Weather for one zone.
Definition: Weather.h:65
WeatherState
Definition: Weather.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraGhost ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1683 {
1685  return;
1686 
1687  Unit* target = aurApp->GetTarget();
1688 
1689  if (target->GetTypeId() != TYPEID_PLAYER)
1690  return;
1691 
1692  if (apply)
1693  {
1697  }
1698  else
1699  {
1700  if (target->HasAuraType(SPELL_AURA_GHOST))
1701  return;
1702 
1706  }
1707 }
Definition: SpellAuraDefines.h:155
Definition: Player.h:521
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:538
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:383
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:1749
Definition: SharedDefines.h:1750
TypeID GetTypeId() const
Definition: Object.h:113
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:539
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:1742
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: UpdateFields.h:191
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraHover ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

Sets movementflags

2777 {
2779  return;
2780 
2781  Unit* target = aurApp->GetTarget();
2782 
2783  if (!apply)
2784  {
2785  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2786  if (target->HasAuraType(GetAuraType()))
2787  return;
2788  }
2789 
2790  target->SetHover(apply);
2791 }
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
bool SetHover(bool enable, bool packetOnly=false)
Definition: Unit.cpp:16018
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraIncreaseBaseHealthPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4177 {
4179  return;
4180 
4181  Unit* target = aurApp->GetTarget();
4182 
4184 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:489
Definition: Unit.h:436
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraLinked ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5303 {
5304  Unit* target = aurApp->GetTarget();
5305 
5306  uint32 triggeredSpellId = GetSpellEffectInfo()->TriggerSpell;
5307  SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
5308  if (!triggeredSpellInfo)
5309  return;
5310 
5311  Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, target->GetMap()->GetDifficultyID()) ? GetCaster() : target;
5312  if (!caster)
5313  return;
5314 
5315  if (mode & AURA_EFFECT_HANDLE_REAL)
5316  {
5317  if (apply)
5318  {
5319  // If amount avalible cast with basepoints (Crypt Fever for example)
5320  if (GetAmount())
5321  caster->CastCustomSpell(target, triggeredSpellId, &m_amount, NULL, NULL, true, NULL, this);
5322  else
5323  caster->CastSpell(target, triggeredSpellId, true, NULL, this);
5324  }
5325  else
5326  {
5327  ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, caster->GetMap()->GetDifficultyID()) ? GetCasterGUID() : target->GetGUID();
5328  target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
5329  }
5330  }
5331  else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
5332  {
5333  ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, caster->GetMap()->GetDifficultyID()) ? GetCasterGUID() : target->GetGUID();
5334  // change the stack amount to be equal to stack amount of our aura
5335  if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
5336  triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
5337  }
5338 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
Map * GetMap() const
Definition: Object.h:543
Definition: SpellInfo.h:326
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4151
int32 m_amount
Definition: SpellAuraEffects.h:115
Difficulty GetDifficultyID() const
Definition: Map.h:390
arena_t NULL
Definition: jemalloc_internal.h:624
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3442
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
uint32 TriggerSpell
Definition: SpellInfo.h:263
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint8 GetStackAmount() const
Definition: SpellAuras.h:179
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
Definition: ObjectGuid.h:189
Definition: SpellAuraDefines.h:42
Definition: SpellAuras.h:116
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell, uint32 difficulty) const
Definition: SpellInfo.cpp:1363

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModAttackPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4485 {
4487  return;
4488 
4489  Unit* target = aurApp->GetTarget();
4490 
4492 }
Definition: Unit.h:508
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModAttackPowerOfArmor ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4533 {
4535  return;
4536 
4537  Unit* target = aurApp->GetTarget();
4538 
4539  // Recalculate bonus
4540  if (target->GetTypeId() == TYPEID_PLAYER)
4541  target->ToPlayer()->UpdateAttackPowerAndDamage(false);
4542 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModAttackPowerPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4508 {
4510  return;
4511 
4512  Unit* target = aurApp->GetTarget();
4513 
4514  //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4516 }
Definition: Unit.h:508
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModBaseResistancePCT ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3649 {
3651  return;
3652 
3653  Unit* target = aurApp->GetTarget();
3654 
3655  // only players have base stats
3656  if (target->GetTypeId() != TYPEID_PLAYER)
3657  {
3658  //pets only have base armor
3659  if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3661  }
3662  else
3663  {
3665  {
3666  if (GetMiscValue() & int32(1<<x))
3668  }
3669  }
3670 }
int8_t int8
Definition: Define.h:148
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: Unit.h:517
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SharedDefines.h:288
Definition: SharedDefines.h:274
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
bool IsPet() const
Definition: Unit.h:1403
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
int32_t int32
Definition: g3dmath.h:167
Definition: Unit.h:436
G3D::int16 x
Definition: Vector2int16.h:37
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Unit.h:501

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModBlockPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4225 {
4227  return;
4228 
4229  Unit* target = aurApp->GetTarget();
4230 
4231  if (target->GetTypeId() != TYPEID_PLAYER)
4232  return;
4233 
4234  target->ToPlayer()->UpdateBlockPercentage();
4235 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModCritPct ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4333 {
4335  return;
4336 
4337  Unit* target = aurApp->GetTarget();
4338 
4339  if (target->GetTypeId() != TYPEID_PLAYER)
4340  {
4341  target->m_baseSpellCritChance += (apply) ? GetAmount():-GetAmount();
4342  return;
4343  }
4344 
4345  target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4346  target->ToPlayer()->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4347  target->ToPlayer()->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4348 
4349  // included in Player::UpdateSpellCritChance calculation
4350  target->ToPlayer()->UpdateAllSpellCritChances();
4351 }
Definition: Unit.h:525
int32 m_baseSpellCritChance
Definition: Unit.h:1942
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: Unit.h:527
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Unit.h:534
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:526
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModDecreaseSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3156 {
3158  return;
3159 
3160  Unit* target = aurApp->GetTarget();
3161 
3162  target->UpdateSpeed(MOVE_RUN, true);
3163  target->UpdateSpeed(MOVE_SWIM, true);
3164  target->UpdateSpeed(MOVE_FLIGHT, true);
3165  target->UpdateSpeed(MOVE_RUN_BACK, true);
3166  target->UpdateSpeed(MOVE_SWIM_BACK, true);
3167  target->UpdateSpeed(MOVE_FLIGHT_BACK, true);
3168 }
Definition: Unit.h:605
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
Definition: Unit.h:601
Definition: Unit.h:602
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:600
Definition: Unit.h:606
Definition: Unit.h:603
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModDisarm ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2359 {
2360  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2361  return;
2362 
2363  Unit* target = aurApp->GetTarget();
2364 
2365  AuraType type = GetAuraType();
2366 
2367  // Prevent handling aura twice
2368  if (apply ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2369  return;
2370 
2371  uint32 field, flag, slot;
2372  WeaponAttackType attType;
2373  switch (type)
2374  {
2375  case SPELL_AURA_MOD_DISARM:
2376  field = UNIT_FIELD_FLAGS;
2377  flag = UNIT_FLAG_DISARMED;
2378  slot = EQUIPMENT_SLOT_MAINHAND;
2379  attType = BASE_ATTACK;
2380  break;
2382  field = UNIT_FIELD_FLAGS_2;
2384  slot = EQUIPMENT_SLOT_OFFHAND;
2385  attType = OFF_ATTACK;
2386  break;
2388  field = UNIT_FIELD_FLAGS_2;
2389  flag = UNIT_FLAG2_DISARM_RANGED;
2390  slot = EQUIPMENT_SLOT_MAINHAND;
2391  attType = RANGED_ATTACK;
2392  break;
2393  default:
2394  return;
2395  }
2396 
2397  // if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
2398  if (!apply)
2399  target->RemoveFlag(field, flag);
2400 
2401  // Handle damage modification, shapeshifted druids are not affected
2402  if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
2403  {
2404  Player* player = target->ToPlayer();
2405  if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2406  {
2407  uint8 attacktype = Player::GetAttackBySlot(slot, item->GetTemplate()->GetInventoryType());
2408 
2409  if (attacktype < MAX_ATTACK)
2410  {
2411  player->_ApplyWeaponDamage(slot, item, !apply);
2412  player->_ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), !apply);
2413  }
2414  }
2415  }
2416 
2417  // if disarm effects should be applied, wait to set flag until damage mods are unapplied
2418  if (apply)
2419  target->SetFlag(field, flag);
2420 
2421  if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
2422  target->UpdateDamagePhysical(attType);
2423 }
AuraType
Definition: SpellAuraDefines.h:58
Definition: Unit.h:718
Definition: Unit.h:620
#define INVENTORY_SLOT_BAG_0
Definition: Unit.h:619
Definition: ObjectGuid.h:32
bool IsInFeralForm() const
Definition: Unit.cpp:11274
Definition: UpdateFields.h:110
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:127
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:338
Definition: Unit.h:618
Definition: Item.h:259
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: SpellAuraDefines.h:314
Definition: ObjectGuid.h:33
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
Definition: UpdateFields.h:109
Definition: Unit.h:720
Creature * ToCreature()
Definition: Object.h:194
uint8_t uint8
Definition: Define.h:152
uint8 GetCurrentEquipmentId() const
Definition: Creature.h:547
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
WeaponAttackType
Definition: Unit.h:615
Definition: Unit.h:1305
Definition: Unit.h:694
Definition: Unit.h:617

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModDispelImmunity ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3590 {
3591  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3592  return;
3593 
3594  Unit* target = aurApp->GetTarget();
3595 
3597 }
void ApplySpellDispelImmunity(const SpellInfo *spellProto, DispelType type, bool apply)
Definition: Unit.cpp:9646
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
DispelType
Definition: SharedDefines.h:1836
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModDmgImmunity ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3580 {
3581  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3582  return;
3583 
3584  Unit* target = aurApp->GetTarget();
3585 
3587 }
Definition: SharedDefines.h:1863
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
uint32 GetId() const
Definition: SpellAuraEffects.h:47
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModDodgePercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4212 {
4214  return;
4215 
4216  Unit* target = aurApp->GetTarget();
4217 
4218  if (target->GetTypeId() != TYPEID_PLAYER)
4219  return;
4220 
4221  target->ToPlayer()->UpdateDodgePercentage();
4222 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModEffectImmunity ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3485 {
3486  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3487  return;
3488 
3489  Unit* target = aurApp->GetTarget();
3490 
3492 
3493  // when removing flag aura, handle flag drop
3494  Player* player = target->ToPlayer();
3495  if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3496  {
3497  if (player->InBattleground())
3498  {
3499  if (Battleground* bg = player->GetBattleground())
3500  bg->EventPlayerDroppedFlag(player);
3501  }
3502  else
3503  sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3504  }
3505 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:105
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
uint32 GetId() const
Definition: SpellAuraEffects.h:47
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Battleground.h:235
Definition: SharedDefines.h:1860
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModExpertise ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3960 {
3962  return;
3963 
3964  Unit* target = aurApp->GetTarget();
3965 
3966  if (target->GetTypeId() != TYPEID_PLAYER)
3967  return;
3968 
3969  target->ToPlayer()->UpdateExpertise(BASE_ATTACK);
3970  target->ToPlayer()->UpdateExpertise(OFF_ATTACK);
3971 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Unit.h:618
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Unit.h:617

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModFaction ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5231 {
5232  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5233  return;
5234 
5235  Unit* target = aurApp->GetTarget();
5236 
5237  if (apply)
5238  {
5239  target->setFaction(GetMiscValue());
5240  if (target->GetTypeId() == TYPEID_PLAYER)
5242  }
5243  else
5244  {
5245  target->RestoreFaction();
5246  if (target->GetTypeId() == TYPEID_PLAYER)
5248  }
5249 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
void setFaction(uint32 faction)
Definition: Unit.h:1467
TypeID GetTypeId() const
Definition: Object.h:113
void RestoreFaction()
Definition: Unit.cpp:14277
Definition: SpellAuraDefines.h:39
Definition: Unit.h:676
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: UpdateFields.h:109
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModFakeInebriation ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5357 {
5359  return;
5360 
5361  Unit* target = aurApp->GetTarget();
5362 
5363  if (apply)
5364  {
5367 
5368  if (target->GetTypeId() == TYPEID_PLAYER)
5369  {
5370  int32 oldval = target->ToPlayer()->GetInt32Value(PLAYER_FAKE_INEBRIATION);
5371  target->ToPlayer()->SetInt32Value(PLAYER_FAKE_INEBRIATION, oldval + GetAmount());
5372  }
5373  }
5374  else
5375  {
5376  bool removeDetect = !target->HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE);
5377 
5379 
5380  if (target->GetTypeId() == TYPEID_PLAYER)
5381  {
5382  int32 oldval = target->ToPlayer()->GetInt32Value(PLAYER_FAKE_INEBRIATION);
5383  target->ToPlayer()->SetInt32Value(PLAYER_FAKE_INEBRIATION, oldval - GetAmount());
5384 
5385  if (removeDetect)
5386  removeDetect = !target->ToPlayer()->GetDrunkValue();
5387  }
5388 
5389  if (removeDetect)
5391  }
5392 
5393  // call functions which may have additional effects after chainging state of unit
5394  target->UpdateObjectVisibility();
5395 }
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:536
Definition: UpdateFields.h:204
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:379
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:380
Definition: ObjectGuid.h:33
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: SharedDefines.h:1703
Definition: SpellAuraDefines.h:364

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseBaseManaPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4187 {
4189  return;
4190 
4191  aurApp->GetTarget()->HandleStatModifier(UNIT_MOD_MANA, BASE_PCT, float(GetAmount()), apply);
4192 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:490
Definition: Unit.h:436
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseEnergy ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4109 {
4111  return;
4112 
4113  Unit* target = aurApp->GetTarget();
4114 
4115  Powers powerType = Powers(GetMiscValue());
4116  // do not check power type, we can always modify the maximum
4117  // as the client will not see any difference
4118  // also, placing conditions that may change during the aura duration
4119  // inside effect handlers is not a good idea
4120  //if (int32(powerType) != GetMiscValue())
4121  // return;
4122 
4123  UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
4124 
4125  target->HandleStatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4126 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Powers
Definition: SharedDefines.h:246
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:519
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseEnergyPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4129 {
4131  return;
4132 
4133  Unit* target = aurApp->GetTarget();
4134 
4135  Powers powerType = Powers(GetMiscValue());
4136  // do not check power type, we can always modify the maximum
4137  // as the client will not see any difference
4138  // also, placing conditions that may change during the aura duration
4139  // inside effect handlers is not a good idea
4140  //if (int32(powerType) != GetMiscValue())
4141  // return;
4142 
4143  UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
4144  float amount = float(GetAmount());
4145 
4146  if (apply)
4147  {
4148  target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
4149  target->ModifyPowerPct(powerType, amount, apply);
4150  }
4151  else
4152  {
4153  target->ModifyPowerPct(powerType, amount, apply);
4154  target->HandleStatModifier(unitMod, TOTAL_PCT, amount, apply);
4155  }
4156 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Powers
Definition: SharedDefines.h:246
int32 ModifyPowerPct(Powers power, float pct, bool apply=true)
Definition: Unit.cpp:10318
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:519
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseFlightSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

Update ability to fly

Someone should clean up these hacks and remove it from this function. It doesn't even belong here.

3111 {
3113  return;
3114 
3115  Unit* target = aurApp->GetTarget();
3117  target->UpdateSpeed(MOVE_FLIGHT, true);
3118 
3121  {
3122  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3124  {
3125  target->SetCanFly(apply);
3126 
3127  if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating())
3128  target->GetMotionMaster()->MoveFall();
3129  }
3130 
3132  if (mode & AURA_EFFECT_HANDLE_REAL)
3133  {
3134  //Players on flying mounts must be immune to polymorph
3135  if (target->GetTypeId() == TYPEID_PLAYER)
3137 
3138  // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3139  if (apply && target->HasAuraEffect(42016, 0) && target->GetMountID())
3140  target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 16314);
3141  }
3142  }
3143 }
Definition: Unit.h:605
uint32 GetId() const
Definition: SpellAuraEffects.h:47
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: ObjectGuid.h:32
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: SpellAuraDefines.h:261
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
bool IsLevitating() const
Definition: Unit.h:1667
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:4210
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
void MoveFall(uint32 id=0)
Definition: MotionMaster.cpp:440
TypeID GetTypeId() const
Definition: Object.h:113
bool SetCanFly(bool enable)
Definition: Unit.cpp:15899
Definition: SpellAuraDefines.h:39
uint32 GetMountID() const
Definition: Unit.h:1497
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: SpellAuraDefines.h:267
Definition: UpdateFields.h:119
Definition: Unit.h:1305
Definition: SharedDefines.h:1865
Definition: SpellAuraDefines.h:46
Definition: SharedDefines.h:1807

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseHealth ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4067 {
4069  return;
4070 
4071  Unit* target = aurApp->GetTarget();
4072 
4073  if (apply)
4074  {
4076  target->ModifyHealth(GetAmount());
4077  }
4078  else
4079  {
4080  if (target->GetHealth() > 0)
4081  {
4082  int32 value = std::min<int32>(target->GetHealth() - 1, GetAmount());
4083  target->ModifyHealth(-value);
4084  }
4086  }
4087 }
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:10216
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:489
const FieldDescriptor value
Definition: descriptor.h:1522
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseHealthPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4159 {
4161  return;
4162 
4163  Unit* target = aurApp->GetTarget();
4164 
4165  // Unit will keep hp% after MaxHealth being modified if unit is alive.
4166  float percent = target->GetHealthPct();
4168 
4169  if (target->GetHealth() > 0)
4170  {
4171  uint32 newHealth = std::max<uint32>(target->CountPctFromMaxHealth(int32(percent)), 1);
4172  target->SetHealth(newHealth);
4173  }
4174 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32_t uint32
Definition: Define.h:150
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:489
int32_t int32
Definition: g3dmath.h:167
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
float GetHealthPct() const
Definition: Unit.h:1434
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1435

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseMaxHealth ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4090 {
4092  return;
4093 
4094  Unit* target = aurApp->GetTarget();
4095 
4096  float percent = target->GetHealthPct();
4097 
4099 
4100  // refresh percentage
4101  if (target->GetHealth() > 0)
4102  {
4103  uint32 newHealth = std::max<uint32>(target->CountPctFromMaxHealth(int32(percent)), 1);
4104  target->SetHealth(newHealth);
4105  }
4106 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32_t uint32
Definition: Define.h:150
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:489
int32_t int32
Definition: g3dmath.h:167
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
float GetHealthPct() const
Definition: Unit.h:1434
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1435

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseMountedSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3106 {
3107  HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3108 }
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3095
void apply(T *val)
Definition: ByteConverter.h:41

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModIncreaseSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3096 {
3098  return;
3099 
3100  Unit* target = aurApp->GetTarget();
3101 
3102  target->UpdateSpeed(MOVE_RUN, true);
3103 }
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:600
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleAuraModIncreaseSwimSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3146 {
3148  return;
3149 
3150  Unit* target = aurApp->GetTarget();
3151 
3152  target->UpdateSpeed(MOVE_SWIM, true);
3153 }
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
Definition: Unit.h:602
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModPacify ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2455 {
2457  return;
2458 
2459  Unit* target = aurApp->GetTarget();
2460 
2461  if (apply)
2462  {
2464  target->AttackStop();
2465  }
2466  else
2467  {
2468  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2470  return;
2472  }
2473 }
bool AttackStop()
Definition: Unit.cpp:7337
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
Definition: Unit.h:690
Definition: SpellAuraDefines.h:85
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:109
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:120

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleAuraModPacifyAndSilence ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2476 {
2478  return;
2479 
2480  Unit* target = aurApp->GetTarget();
2481 
2482  // Vengeance of the Blue Flight (@todo REMOVE THIS!)
2484  if (m_spellInfo->Id == 45839)
2485  {
2486  if (apply)
2488  else
2490  }
2491  if (!(apply))
2492  {
2493  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2495  return;
2496  }
2497  HandleAuraModPacify(aurApp, mode, apply);
2498  HandleAuraModSilence(aurApp, mode, apply);
2499 }
uint32 Id
Definition: SpellInfo.h:329
Definition: Unit.h:674
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:2425
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:2454
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:109
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:120

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModParryPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4199 {
4201  return;
4202 
4203  Unit* target = aurApp->GetTarget();
4204 
4205  if (target->GetTypeId() != TYPEID_PLAYER)
4206  return;
4207 
4208  target->ToPlayer()->UpdateParryPercentage();
4209 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModPetTalentsPoints ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2621 {
2623  return;
2624 
2625  Unit* target = aurApp->GetTarget();
2626 
2627  if (target->GetTypeId() != TYPEID_PLAYER)
2628  return;
2629 
2630  // Recalculate pet talent points
2631  if (Pet* pet = target->ToPlayer()->GetPet())
2632  pet->InitTalentForLevel();
2633 }
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Pet.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModRangedAttackPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4495 {
4497  return;
4498 
4499  Unit* target = aurApp->GetTarget();
4500 
4501  if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4502  return;
4503 
4505 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
uint32 getClassMask() const
Definition: Unit.h:1414
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:207
Definition: Unit.h:509
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModRangedAttackPowerPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4519 {
4521  return;
4522 
4523  Unit* target = aurApp->GetTarget();
4524 
4525  if ((target->getClassMask() & CLASSMASK_WAND_USERS) != 0)
4526  return;
4527 
4528  //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4530 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
uint32 getClassMask() const
Definition: Unit.h:1414
#define CLASSMASK_WAND_USERS
Definition: SharedDefines.h:207
Definition: Unit.h:509
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModRangedHaste ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

ToDo: Haste auras with the same handler CAN'T stack together

4435 {
4437  return;
4438 
4440  Unit* target = aurApp->GetTarget();
4441 
4443 }
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:12921
Definition: Unit.h:619
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModRegenInterrupt ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4238 {
4239  HandleModManaRegen(aurApp, mode, apply);
4240 }
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4052
void apply(T *val)
Definition: ByteConverter.h:41

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModResistance ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3631 {
3633  return;
3634 
3635  Unit* target = aurApp->GetTarget();
3636 
3638  {
3639  if (GetMiscValue() & int32(1<<x))
3640  {
3642  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3643  target->ApplyResistanceBuffModsMod(SpellSchools(x), GetAmount() > 0, (float)GetAmount(), apply);
3644  }
3645  }
3646 }
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.cpp:4663
int8_t int8
Definition: Define.h:148
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: Unit.h:517
SpellSchools
Definition: SharedDefines.h:272
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SharedDefines.h:274
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
bool IsPet() const
Definition: Unit.h:1403
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
int32_t int32
Definition: g3dmath.h:167
G3D::int16 x
Definition: Vector2int16.h:37
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModResistanceExclusive ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3608 {
3610  return;
3611 
3612  Unit* target = aurApp->GetTarget();
3613 
3615  {
3616  if (GetMiscValue() & int32(1<<x))
3617  {
3619  if (amount < GetAmount())
3620  {
3621  float value = float(GetAmount() - amount);
3623  if (target->GetTypeId() == TYPEID_PLAYER)
3624  target->ApplyResistanceBuffModsMod(SpellSchools(x), aurApp->IsPositive(), value, apply);
3625  }
3626  }
3627  }
3628 }
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.cpp:4663
int8_t int8
Definition: Define.h:148
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: SpellAuraDefines.h:203
Definition: Unit.h:434
Definition: Unit.h:517
SpellSchools
Definition: SharedDefines.h:272
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SharedDefines.h:274
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
int32_t int32
Definition: g3dmath.h:167
const FieldDescriptor value
Definition: descriptor.h:1522
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=NULL) const
Definition: Unit.cpp:4493
G3D::int16 x
Definition: Vector2int16.h:37
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModResistenceOfStatPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3938 {
3940  return;
3941 
3942  Unit* target = aurApp->GetTarget();
3943 
3944  if (target->GetTypeId() != TYPEID_PLAYER)
3945  return;
3946 
3948  {
3949  // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
3950  // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
3951  TC_LOG_ERROR("spells", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
3952  return;
3953  }
3954 
3955  // Recalculate Armor
3956  target->UpdateArmor();
3957 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
virtual void UpdateArmor()=0
Definition: SpellAuraDefines.h:43
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:288
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModRoot ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2911 {
2912  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2913  return;
2914 
2915  Unit* target = aurApp->GetTarget();
2916 
2918 }
void apply(T *val)
Definition: ByteConverter.h:41
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:13808
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:560
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModScale ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2227 {
2229  return;
2230 
2231  Unit* target = aurApp->GetTarget();
2232 
2233  float scale = target->GetObjectScale();
2234  ApplyPercentModFloatVar(scale, float(GetAmount()), apply);
2235  target->SetObjectScale(scale);
2236 }
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:83
ObjectGuid GetTarget() const
Definition: Unit.h:2209
virtual void SetObjectScale(float scale)
Definition: Object.h:111
Definition: Unit.h:1305
float GetObjectScale() const
Definition: Object.h:110

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModSchoolImmunity ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
Todo:
optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
3521 {
3522  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3523  return;
3524 
3525  Unit* target = aurApp->GetTarget();
3526 
3528 
3529  if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3530  {
3531  if (apply)
3533  else
3534  {
3535  bool banishFound = false;
3536  Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
3537  for (Unit::AuraEffectList::const_iterator i = banishAuras.begin(); i != banishAuras.end(); ++i)
3538  if ((*i)->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3539  {
3540  banishFound = true;
3541  break;
3542  }
3543  if (!banishFound)
3545  }
3546  }
3547 
3550 
3551  // remove all flag auras (they are positive, but they must be removed when you are immune)
3553  && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_DAMAGE_REDUCED_SHIELD)
3555 
3557  if ((apply)
3559  && GetSpellInfo()->IsPositive()) //Only positive immunity removes auras
3560  {
3561  uint32 school_mask = GetMiscValue();
3562  Unit::AuraApplicationMap& Auras = target->GetAppliedAuras();
3563  for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
3564  {
3565  SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
3566  if ((spell->GetSchoolMask() & school_mask)//Check for school mask
3567  && GetSpellInfo()->CanDispelAura(spell)
3568  && !iter->second->IsPositive() //Don't remove positive spells
3569  && spell->Id != GetId()) //Don't remove self
3570  {
3571  target->RemoveAura(iter, AURA_REMOVE_BY_ENEMY_SPELL);
3572  }
3573  else
3574  ++iter;
3575  }
3576  }
3577 }
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SharedDefines.h:1808
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
void AddUnitState(uint32 f)
Definition: Unit.h:1394
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3442
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
Definition: SharedDefines.h:407
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1789
Definition: SharedDefines.h:288
Definition: SharedDefines.h:449
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:453
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2131
bool CanDispelAura(SpellInfo const *aura) const
Definition: SpellInfo.cpp:1575
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1315
Definition: SharedDefines.h:1862
Definition: Unit.h:1305
Definition: Unit.h:563

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModShapeshift ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1776 {
1777  if (!(mode & AURA_EFFECT_HANDLE_REAL))
1778  return;
1779 
1780  Unit* target = aurApp->GetTarget();
1781 
1782  uint32 modelid = 0;
1785 
1786  switch (form)
1787  {
1788  case FORM_CAT: // 0x01
1789  case FORM_GHOUL: // 0x07
1790  PowerType = POWER_ENERGY;
1791  break;
1792 
1793  case FORM_BEAR: // 0x05
1794 
1795  case FORM_BATTLESTANCE: // 0x11
1796  case FORM_DEFENSIVESTANCE: // 0x12
1797  case FORM_BERSERKERSTANCE: // 0x13
1798  PowerType = POWER_RAGE;
1799  break;
1800 
1801  case FORM_TREE: // 0x02
1802  case FORM_TRAVEL: // 0x03
1803  case FORM_AQUA: // 0x04
1804  case FORM_AMBIENT: // 0x06
1805 
1806  case FORM_STEVES_GHOUL: // 0x09
1807  case FORM_THARONJA_SKELETON: // 0x0A
1808  case FORM_TEST_OF_STRENGTH: // 0x0B
1809  case FORM_BLB_PLAYER: // 0x0C
1810  case FORM_SHADOW_DANCE: // 0x0D
1811  case FORM_CREATUREBEAR: // 0x0E
1812  case FORM_CREATURECAT: // 0x0F
1813  case FORM_GHOSTWOLF: // 0x10
1814 
1815  case FORM_TEST: // 0x14
1816  case FORM_ZOMBIE: // 0x15
1817  case FORM_METAMORPHOSIS: // 0x16
1818  case FORM_UNDEAD: // 0x19
1819  case FORM_MASTER_ANGLER: // 0x1A
1820  case FORM_FLIGHT_EPIC: // 0x1B
1821  case FORM_SHADOW: // 0x1C
1822  case FORM_FLIGHT: // 0x1D
1823  case FORM_STEALTH: // 0x1E
1824  case FORM_MOONKIN: // 0x1F
1825  case FORM_SPIRITOFREDEMPTION: // 0x20
1826  break;
1827  default:
1828  TC_LOG_ERROR("spells", "Auras: Unknown Shapeshift Type: %u", GetMiscValue());
1829  }
1830 
1831  modelid = target->GetModelForForm(form);
1832 
1833  if (apply)
1834  {
1835  // remove polymorph before changing display id to keep new display id
1836  switch (form)
1837  {
1838  case FORM_CAT:
1839  case FORM_TREE:
1840  case FORM_TRAVEL:
1841  case FORM_AQUA:
1842  case FORM_BEAR:
1843  case FORM_FLIGHT_EPIC:
1844  case FORM_FLIGHT:
1845  case FORM_MOONKIN:
1846  {
1847  // remove movement affects
1848  target->RemoveMovementImpairingAuras();
1849 
1850  // and polymorphic affects
1851  if (target->IsPolymorphed())
1852  target->RemoveAurasDueToSpell(target->getTransForm());
1853  break;
1854  }
1855  default:
1856  break;
1857  }
1858 
1859  // remove other shapeshift before applying a new one
1861 
1862  // stop handling the effect if it was removed by linked event
1863  if (aurApp->GetRemoveMode())
1864  return;
1865 
1866  if (PowerType != POWER_MANA)
1867  {
1868  int32 oldPower = target->GetPower(PowerType);
1869  // reset power to default values only at power change
1870  if (target->getPowerType() != PowerType)
1871  target->setPowerType(PowerType);
1872 
1873  if (form == FORM_CAT || form == FORM_BEAR)
1874  {
1875  // get furor proc chance
1876  int32 FurorChance = 0;
1877  if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
1878  FurorChance = std::max(dummy->GetAmount(), 0);
1879 
1880  if (form == FORM_CAT)
1881  {
1882  int32 basePoints = std::min<int32>(oldPower, FurorChance);
1883  target->SetPower(POWER_ENERGY, 0);
1884  target->CastCustomSpell(target, 17099, &basePoints, NULL, NULL, true, NULL, this);
1885  }
1886  else if (roll_chance_i(FurorChance))
1887  target->CastSpell(target, 17057, true);
1888  }
1889  }
1890  // stop handling the effect if it was removed by linked event
1891  if (aurApp->GetRemoveMode())
1892  return;
1893 
1894  target->SetShapeshiftForm(form);
1895  if (modelid > 0)
1896  {
1897  SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
1898  if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
1899  target->SetDisplayId(modelid);
1900  }
1901  }
1902  else
1903  {
1904  // reset model id if no other auras present
1905  // may happen when aura is applied on linked event on aura removal
1906  if (!target->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
1907  {
1908  target->SetShapeshiftForm(FORM_NONE);
1909  if (target->getClass() == CLASS_DRUID)
1910  {
1911  target->setPowerType(POWER_MANA);
1912  // Remove movement impairing effects also when shifting out
1913  target->RemoveMovementImpairingAuras();
1914  }
1915  }
1916 
1917  if (modelid > 0)
1918  target->RestoreDisplayId();
1919 
1920  switch (form)
1921  {
1922  // Nordrassil Harness - bonus
1923  case FORM_BEAR:
1924  case FORM_CAT:
1925  if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
1926  target->CastSpell(target, 37316, true, NULL, dummy);
1927  break;
1928  // Nordrassil Regalia - bonus
1929  case FORM_MOONKIN:
1930  if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
1931  target->CastSpell(target, 37325, true, NULL, dummy);
1932  break;
1933  case FORM_BATTLESTANCE:
1934  case FORM_DEFENSIVESTANCE:
1935  case FORM_BERSERKERSTANCE:
1936  {
1937  int32 Rage_val = 0;
1938  // Defensive Tactics
1939  if (form == FORM_DEFENSIVESTANCE)
1940  {
1941  if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
1942  Rage_val += aurEff->GetAmount() * 10;
1943  }
1944  // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
1945  if (target->GetTypeId() == TYPEID_PLAYER)
1946  {
1947  PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
1948  for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1949  {
1950  if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
1951  continue;
1952 
1953  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1954  if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
1955  Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
1956  }
1957  }
1958  if (target->GetPower(POWER_RAGE) > Rage_val)
1959  target->SetPower(POWER_RAGE, Rage_val);
1960  break;
1961  }
1962  default:
1963  break;
1964  }
1965  }
1966 
1967  // adding/removing linked auras
1968  // add/remove the shapeshift aura's boosts
1969  HandleShapeshiftBoosts(target, apply);
1970 
1971  if (target->GetTypeId() == TYPEID_PLAYER)
1972  target->ToPlayer()->InitDataForForm();
1973 
1974  if (target->getClass() == CLASS_DRUID)
1975  {
1976  // Dash
1978  aurEff->RecalculateAmount();
1979 
1980  // Disarm handling
1981  // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
1982  // and also HandleAuraModDisarm is not triggered
1983  if (!target->CanUseAttackType(BASE_ATTACK))
1984  {
1985  if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
1986  target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem, apply);
1987  }
1988  }
1989 
1990  // stop handling the effect if it was removed by linked event
1991  if (apply && aurApp->GetRemoveMode())
1992  return;
1993 
1994  if (target->GetTypeId() == TYPEID_PLAYER)
1995  {
1996  SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1997  ASSERT(shapeInfo);
1998  // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
1999  for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2000  {
2001  if (!shapeInfo->PresetSpellID[i])
2002  continue;
2003  if (apply)
2004  target->ToPlayer()->AddTemporarySpell(shapeInfo->PresetSpellID[i]);
2005  else
2006  target->ToPlayer()->RemoveTemporarySpell(shapeInfo->PresetSpellID[i]);
2007  }
2008  }
2009 }
Definition: SpellAuraEffects.h:30
void RestoreDisplayId()
Definition: Unit.cpp:12807
Definition: Unit.h:279
ShapeshiftForm
Definition: Unit.h:260
Definition: Unit.h:262
#define INVENTORY_SLOT_BAG_0
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
Definition: Unit.h:292
Definition: Unit.h:272
void HandleShapeshiftBoosts(Unit *target, bool apply) const
Definition: SpellAuraEffects.cpp:1272
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: Player.h:106
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: Unit.h:273
Definition: Unit.h:266
Definition: SpellInfo.h:326
Definition: Unit.h:282
Definition: Unit.h:271
Definition: Unit.h:289
Definition: Unit.h:281
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition: Unit.cpp:4328
void RemoveMovementImpairingAuras()
Definition: Unit.cpp:3865
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Unit.h:284
Definition: SharedDefines.h:249
Definition: Unit.h:286
#define MAX_SHAPESHIFT_SPELLS
Definition: DBCStructure.h:1158
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
Definition: Unit.h:285
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
void apply(T *val)
Definition: ByteConverter.h:41
void setPowerType(Powers power)
Definition: Unit.cpp:6977
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Player * ToPlayer()
Definition: Object.h:191
uint32 PresetSpellID[MAX_SHAPESHIFT_SPELLS]
Definition: DBCStructure.h:1170
uint32 getTransForm() const
Definition: Unit.h:2018
Powers getPowerType() const
Definition: Unit.h:1444
TypeID GetTypeId() const
Definition: Object.h:113
uint32 GetModelForForm(ShapeshiftForm form) const
Definition: Unit.cpp:14696
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.cpp:4127
Powers
Definition: SharedDefines.h:246
Definition: Unit.h:277
bool IsPositive() const
Definition: SpellInfo.cpp:1495
uint32 SpellFamilyName
Definition: SpellInfo.h:396
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:12799
Definition: Unit.h:263
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:197
Definition: Item.h:259
Definition: Util.h:362
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr, float *variance=nullptr, int32 itemLevel=-1) const
Definition: Unit.cpp:10930
uint32_t uint32
Definition: Define.h:150
bool roll_chance_i(int chance)
Definition: Random.h:53
Definition: SpellAuraDefines.h:39
Definition: SharedDefines.h:4630
Definition: Unit.h:291
Definition: Unit.h:268
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.cpp:2200
Definition: DBCStructure.h:1160
Definition: Unit.h:267
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void SetShapeshiftForm(ShapeshiftForm form)
Definition: Unit.cpp:11269
void SetPower(Powers power, int32 val)
Definition: Unit.cpp:11607
Definition: Unit.h:280
Definition: ObjectGuid.h:33
Definition: Unit.h:265
Definition: Unit.h:278
Definition: Unit.h:274
Definition: SharedDefines.h:251
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
Definition: SharedDefines.h:4627
bool IsPolymorphed() const
Definition: Unit.cpp:12786
uint8 getClass() const
Definition: Unit.h:1413
Definition: SpellAuraDefines.h:96
uint32 SpellIconID
Definition: SpellInfo.h:390
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4071
Definition: Unit.h:287
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:290
Definition: Unit.h:276
Definition: Unit.h:275
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3567
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:264
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormfmt)
Definition: SpellAuraDefines.h:91
Definition: SharedDefines.h:177
Definition: Unit.h:1305
Definition: Unit.h:283
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: Unit.h:269
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
Definition: Unit.h:288
PowerType
Definition: VehicleDefines.h:28
Definition: Unit.h:617
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModSilence ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2426 {
2427  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2428  return;
2429 
2430  Unit* target = aurApp->GetTarget();
2431 
2432  if (apply)
2433  {
2435 
2436  // call functions which may have additional effects after chainging state of unit
2437  // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
2438  for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2439  if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2440  if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
2441  // Stop spells on prepare or casting state
2442  target->InterruptSpell(CurrentSpellTypes(i), false);
2443  }
2444  else
2445  {
2446  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2448  return;
2449 
2451  }
2452 }
Definition: SharedDefines.h:2058
Definition: Unit.h:686
CurrentSpellTypes
Definition: Unit.h:1106
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:2849
Definition: Unit.h:1108
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1920
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:87
Definition: SpellAuraDefines.h:39
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
#define CURRENT_MAX_SPELL
Definition: Unit.h:1115
Definition: UpdateFields.h:109
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:120
Definition: Spell.h:294

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleAuraModSkill ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2636 {
2638  return;
2639 
2640  Player* target = aurApp->GetTarget()->ToPlayer();
2641  if (!target)
2642  return;
2643 
2644  uint32 prot = GetMiscValue();
2645  int32 points = GetAmount();
2646 
2647  if (prot == SKILL_DEFENSE)
2648  return;
2649 
2650  target->ModifySkillBonus(prot, (apply ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
2651 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:3900
Definition: SpellAuraDefines.h:158
Definition: SpellAuraDefines.h:46
Definition: SpellAuraDefines.h:44

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModStalked ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2578 {
2580  return;
2581 
2582  Unit* target = aurApp->GetTarget();
2583 
2584  // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
2585  if (apply)
2587  else
2588  {
2589  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2590  if (!target->HasAuraType(GetAuraType()))
2592  }
2593 
2594  // call functions which may have additional effects after chainging state of unit
2595  target->UpdateObjectVisibility();
2596 }
Definition: SharedDefines.h:4202
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:30
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModStat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3750 {
3752  return;
3753 
3754  if (GetMiscValue() < -2 || GetMiscValue() > 4)
3755  {
3756  TC_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
3757  return;
3758  }
3759 
3760  Unit* target = aurApp->GetTarget();
3762  if (abs(spellGroupVal) >= abs(GetAmount()))
3763  return;
3764 
3765  for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
3766  {
3767  // -1 or -2 is all stats (misc < -2 checked in function beginning)
3768  if (GetMiscValue() < 0 || GetMiscValue() == i)
3769  {
3770  if (spellGroupVal)
3771  {
3772  target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
3773  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3774  target->ApplyStatBuffMod(Stats(i), float(spellGroupVal), !apply);
3775  }
3776 
3777  //target->ApplyStatMod(Stats(i), m_amount, apply);
3779  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3780  target->ApplyStatBuffMod(Stats(i), (float)GetAmount(), apply);
3781  }
3782  }
3783 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Stats
Definition: SharedDefines.h:235
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:237
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:16316
#define MAX_STATS
Definition: SharedDefines.h:244
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
bool IsPet() const
Definition: Unit.h:1403
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void ApplyStatBuffMod(Stats stat, float val, bool apply)
Definition: Unit.cpp:4681
Definition: SpellAuraDefines.h:89
Definition: ObjectGuid.h:33
Definition: Unit.h:515
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModStateImmunity ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3508 {
3509  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3510  return;
3511 
3512  Unit* target = aurApp->GetTarget();
3513 
3515 
3516  if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
3518 }
AuraType
Definition: SpellAuraDefines.h:58
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Definition: SharedDefines.h:1861
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:407
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3567
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModStun ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2901 {
2902  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2903  return;
2904 
2905  Unit* target = aurApp->GetTarget();
2906 
2908 }
void apply(T *val)
Definition: ByteConverter.h:41
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:13808
Definition: Unit.h:553
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModTotalThreat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2839 {
2841  return;
2842 
2843  Unit* target = aurApp->GetTarget();
2844 
2845  if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
2846  return;
2847 
2848  Unit* caster = GetCaster();
2849  if (caster && caster->IsAlive())
2850  target->getHostileRefManager().addTempThreat((float)GetAmount(), apply);
2851 }
void addTempThreat(float threat, bool apply)
Definition: HostileRefManager.cpp:54
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
TypeID GetTypeId() const
Definition: Object.h:113
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
bool IsAlive() const
Definition: Unit.h:1692
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModUseNormalSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3171 {
3172  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3173  return;
3174 
3175  Unit* target = aurApp->GetTarget();
3176 
3177  target->UpdateSpeed(MOVE_RUN, true);
3178  target->UpdateSpeed(MOVE_SWIM, true);
3179  target->UpdateSpeed(MOVE_FLIGHT, true);
3180 }
Definition: Unit.h:605
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
Definition: Unit.h:602
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:600
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraModWeaponCritPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4243 {
4245  return;
4246 
4247  Unit* target = aurApp->GetTarget();
4248 
4249  if (target->GetTypeId() != TYPEID_PLAYER)
4250  return;
4251 
4252  for (int i = 0; i < MAX_ATTACK; ++i)
4253  if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
4254  target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply);
4255 
4256  // mods must be applied base at equipped weapon class and subclass comparison
4257  // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4258  // GetMiscValue() comparison with item generated damage types
4259 
4260  if (GetSpellInfo()->EquippedItemClass == -1)
4261  {
4262  target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4263  target->ToPlayer()->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4264  target->ToPlayer()->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
4265  }
4266  else
4267  {
4268  // done in Player::_ApplyWeaponDependentAuraMods
4269  }
4270 }
Definition: Unit.h:620
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
Definition: Unit.h:525
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: Unit.h:527
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Unit.h:534
Definition: Item.h:259
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:526
WeaponAttackType
Definition: Unit.h:615
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleAuraMounted ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2658 {
2660  return;
2661 
2662  Unit* target = aurApp->GetTarget();
2663 
2664  if (apply)
2665  {
2666  uint32 creatureEntry = GetMiscValue();
2667  uint32 displayId = 0;
2668  uint32 vehicleId = 0;
2669 
2670  if (MountEntry const* mountEntry = sDB2Manager.GetMount(GetId()))
2671  {
2672  displayId = mountEntry->DisplayId;
2673  // TODO: CREATE TABLE mount_vehicle (mountId, vehicleCreatureId) for future mounts that are vehicles (new mounts no longer have proper data in MiscValue)
2674  //if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
2675  // creatureEntry = mountVehicle->VehicleCreatureId;
2676  }
2677 
2678  if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
2679  {
2680  vehicleId = creatureInfo->VehicleId;
2681 
2682  if (!displayId || vehicleId)
2683  {
2684  displayId = ObjectMgr::ChooseDisplayId(creatureInfo);
2685  sObjectMgr->GetCreatureModelRandomGender(&displayId);
2686  }
2687 
2688  //some spell has one aura of mount and one of vehicle
2689  for (SpellEffectInfo const* effect : GetBase()->GetSpellEffectInfos())
2690  if (effect && effect->Effect == SPELL_EFFECT_SUMMON && effect->MiscValue == GetMiscValue())
2691  displayId = 0;
2692  }
2693 
2694  target->Mount(displayId, vehicleId, creatureEntry);
2695 
2696  // cast speed aura
2697  if (mode & AURA_EFFECT_HANDLE_REAL)
2698  if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmount()))
2699  target->CastSpell(target, mountCapability->SpeedModSpell, true);
2700  }
2701  else
2702  {
2703  target->Dismount();
2704  //some mounts like Headless Horseman's Mount or broom stick are skill based spell
2705  // need to remove ALL arura related to mounts, this will stop client crash with broom stick
2706  // and never endless flying after using Headless Horseman's Mount
2707  if (mode & AURA_EFFECT_HANDLE_REAL)
2708  {
2710 
2711  // remove speed aura
2712  if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmount()))
2713  target->RemoveAurasDueToSpell(mountCapability->SpeedModSpell, target->GetGUID());
2714  }
2715  }
2716 }
#define sDB2Manager
Definition: DB2Stores.h:224
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
uint32 GetId() const
Definition: SpellAuraEffects.h:47
void Dismount()
Definition: Unit.cpp:9734
Definition: SharedDefines.h:1038
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=NULL)
Definition: ObjectMgr.cpp:1265
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
void apply(T *val)
Definition: ByteConverter.h:41
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:9695
#define sObjectMgr
Definition: ObjectMgr.h:1567
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
Definition: SpellAuraDefines.h:45
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3567
Definition: DB2Structure.h:927
DB2Storage< MountCapabilityEntry > sMountCapabilityStore("MountCapability.db2", MountCapabilityFormat, HOTFIX_SEL_MOUNT_CAPABILITY)
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: Creature.h:79
Definition: DB2Structure.h:913
Definition: SpellAuraDefines.h:138

+ Here is the call graph for this function:

void AuraEffect::HandleAuraOpenStable ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5341 {
5342  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5343  return;
5344 
5345  Unit* target = aurApp->GetTarget();
5346 
5347  if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
5348  return;
5349 
5350  if (apply)
5351  target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
5352 
5353  // client auto close stable dialog at !apply aura
5354 }
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
bool IsInWorld() const
Definition: Object.h:100
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraOverrideSpells ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5398 {
5399  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5400  return;
5401 
5402  Player* target = aurApp->GetTarget()->ToPlayer();
5403 
5404  if (!target || !target->IsInWorld())
5405  return;
5406 
5407  uint32 overrideId = uint32(GetMiscValue());
5408 
5409  if (apply)
5410  {
5411  target->SetUInt16Value(PLAYER_FIELD_BYTES2, PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET, overrideId);
5412  if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5413  for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5414  if (uint32 spellId = overrideSpells->SpellID[i])
5415  target->AddTemporarySpell(spellId);
5416  }
5417  else
5418  {
5420  if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5421  for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5422  if (uint32 spellId = overrideSpells->SpellID[i])
5423  target->RemoveTemporarySpell(spellId);
5424  }
5425 }
#define MAX_OVERRIDE_SPELL
Definition: DB2Structure.h:975
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: UpdateFields.h:291
DB2Storage< OverrideSpellDataEntry > sOverrideSpellDataStore("OverrideSpellData.db2", OverrideSpellDataFormat, HOTFIX_SEL_OVERRIDE_SPELL_DATA)
void apply(T *val)
Definition: ByteConverter.h:41
Definition: DB2Structure.h:977
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

void AuraEffect::HandleAuraRetainComboPoints ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4769 {
4770  if (!(mode & AURA_EFFECT_HANDLE_REAL))
4771  return;
4772 
4773  Unit* target = aurApp->GetTarget();
4774 
4775  if (target->GetTypeId() != TYPEID_PLAYER)
4776  return;
4777 
4778  // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
4779  // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
4780  if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
4781  target->ToPlayer()->AddComboPoints(-GetAmount());
4782 }
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:454
Definition: ObjectGuid.h:33
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraSetVehicle ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5428 {
5429  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5430  return;
5431 
5432  Unit* target = aurApp->GetTarget();
5433 
5434  if (!target->IsInWorld())
5435  return;
5436 
5437  uint32 vehicleId = GetMiscValue();
5438 
5439  if (apply)
5440  {
5441  if (!target->CreateVehicleKit(vehicleId, 0))
5442  return;
5443  }
5444  else if (target->GetVehicleKit())
5445  target->RemoveVehicleKit();
5446 
5447  if (target->GetTypeId() != TYPEID_PLAYER)
5448  return;
5449 
5450  if (apply)
5451  target->ToPlayer()->SendOnCancelExpectedVehicleRideAura();
5452 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void RemoveVehicleKit(bool onRemoveFromWorld=false)
Definition: Unit.cpp:14318
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading=false)
Definition: Unit.cpp:14302
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
bool IsInWorld() const
Definition: Object.h:100
Definition: Unit.h:1305
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

void AuraEffect::HandleAuraTrackCreatures ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2527 {
2529  return;
2530 
2531  Unit* target = aurApp->GetTarget();
2532 
2533  if (target->GetTypeId() != TYPEID_PLAYER)
2534  return;
2535 
2536  if (apply)
2537  target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2538  else
2539  target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2540 }
Definition: UpdateFields.h:220
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
uint32_t uint32
Definition: g3dmath.h:168
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraTrackResources ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2543 {
2545  return;
2546 
2547  Unit* target = aurApp->GetTarget();
2548 
2549  if (target->GetTypeId() != TYPEID_PLAYER)
2550  return;
2551 
2552  if (apply)
2553  target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2554  else
2555  target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2556 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: UpdateFields.h:221
uint32_t uint32
Definition: g3dmath.h:168
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraTrackStealthed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2559 {
2561  return;
2562 
2563  Unit* target = aurApp->GetTarget();
2564 
2565  if (target->GetTypeId() != TYPEID_PLAYER)
2566  return;
2567 
2568  if (!(apply))
2569  {
2570  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2571  if (target->HasAuraType(GetAuraType()))
2572  return;
2573  }
2575 }
Definition: Player.h:559
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:45
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:1247
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:266
Definition: ObjectGuid.h:33
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraTransform ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2012 {
2014  return;
2015 
2016  Unit* target = aurApp->GetTarget();
2017 
2018  if (apply)
2019  {
2020  // update active transform spell only when transform not set or not overwriting negative by positive case
2021  SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->getTransForm());
2022  if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
2023  {
2024  target->setTransForm(GetId());
2025  // special case (spell specific functionality)
2026  if (GetMiscValue() == 0)
2027  {
2028  switch (GetId())
2029  {
2030  // Orb of Deception
2031  case 16739:
2032  {
2033  if (target->GetTypeId() != TYPEID_PLAYER)
2034  return;
2035 
2036  switch (target->getRace())
2037  {
2038  // Blood Elf
2039  case RACE_BLOODELF:
2040  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 17830 : 17829);
2041  break;
2042  // Orc
2043  case RACE_ORC:
2044  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10140 : 10139);
2045  break;
2046  // Troll
2047  case RACE_TROLL:
2048  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10134 : 10135);
2049  break;
2050  // Tauren
2051  case RACE_TAUREN:
2052  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10147 : 10136);
2053  break;
2054  // Undead
2055  case RACE_UNDEAD_PLAYER:
2056  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10145 : 10146);
2057  break;
2058  // Draenei
2059  case RACE_DRAENEI:
2060  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 17828 : 17827);
2061  break;
2062  // Dwarf
2063  case RACE_DWARF:
2064  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10142 : 10141);
2065  break;
2066  // Gnome
2067  case RACE_GNOME:
2068  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10149 : 10148);
2069  break;
2070  // Human
2071  case RACE_HUMAN:
2072  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10138 : 10137);
2073  break;
2074  // Night Elf
2075  case RACE_NIGHTELF:
2076  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 10144 : 10143);
2077  break;
2078  default:
2079  break;
2080  }
2081  break;
2082  }
2083  // Murloc costume
2084  case 42365:
2085  target->SetDisplayId(21723);
2086  break;
2087  // Dread Corsair
2088  case 50517:
2089  // Corsair Costume
2090  case 51926:
2091  {
2092  if (target->GetTypeId() != TYPEID_PLAYER)
2093  return;
2094 
2095  switch (target->getRace())
2096  {
2097  // Blood Elf
2098  case RACE_BLOODELF:
2099  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25043 : 25032);
2100  break;
2101  // Orc
2102  case RACE_ORC:
2103  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25050 : 25039);
2104  break;
2105  // Troll
2106  case RACE_TROLL:
2107  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25052 : 25041);
2108  break;
2109  // Tauren
2110  case RACE_TAUREN:
2111  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25051 : 25040);
2112  break;
2113  // Undead
2114  case RACE_UNDEAD_PLAYER:
2115  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25053 : 25042);
2116  break;
2117  // Draenei
2118  case RACE_DRAENEI:
2119  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25044 : 25033);
2120  break;
2121  // Dwarf
2122  case RACE_DWARF:
2123  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25045 : 25034);
2124  break;
2125  // Gnome
2126  case RACE_GNOME:
2127  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25035 : 25046);
2128  break;
2129  // Human
2130  case RACE_HUMAN:
2131  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25037 : 25048);
2132  break;
2133  // Night Elf
2134  case RACE_NIGHTELF:
2135  target->SetDisplayId(target->getGender() == GENDER_FEMALE ? 25038 : 25049);
2136  break;
2137  default:
2138  break;
2139  }
2140  break;
2141  }
2142  // Pygmy Oil
2143  case 53806:
2144  target->SetDisplayId(22512);
2145  break;
2146  // Honor the Dead
2147  case 65386:
2148  case 65495:
2149  target->SetDisplayId(target->getGender() == GENDER_MALE ? 29203 : 29204);
2150  break;
2151  // Darkspear Pride
2152  case 75532:
2153  target->SetDisplayId(target->getGender() == GENDER_MALE ? 31737 : 31738);
2154  break;
2155  // Gnomeregan Pride
2156  case 75531:
2157  target->SetDisplayId(target->getGender() == GENDER_MALE ? 31654 : 31655);
2158  break;
2159  default:
2160  break;
2161  }
2162  }
2163  else
2164  {
2165  CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2166  if (!ci)
2167  {
2168  target->SetDisplayId(16358); // pig pink ^_^
2169  TC_LOG_ERROR("spells", "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
2170  }
2171  else
2172  {
2173  uint32 model_id = 0;
2174 
2175  if (uint32 modelid = ci->GetRandomValidModelId())
2176  model_id = modelid; // Will use the default model here
2177 
2178  target->SetDisplayId(model_id);
2179 
2180  // Dragonmaw Illusion (set mount model also)
2181  if (GetId() == 42016 && target->GetMountID() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2182  target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 16314);
2183  }
2184  }
2185  }
2186 
2187  // polymorph case
2188  if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
2189  {
2190  // for players, start regeneration after 1s (in polymorph fast regeneration case)
2191  // only if caster is Player (after patch 2.4.2)
2192  if (GetCasterGUID().IsPlayer())
2193  target->ToPlayer()->setRegenTimerCount(1*IN_MILLISECONDS);
2194 
2195  //dismount polymorphed target (after patch 2.4.2)
2196  if (target->IsMounted())
2198  }
2199  }
2200  else
2201  {
2202  // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2203  if (target->getTransForm() == GetId())
2204  target->setTransForm(0);
2205 
2206  target->RestoreDisplayId();
2207 
2208  // Dragonmaw Illusion (restore mount model)
2209  if (GetId() == 42016 && target->GetMountID() == 16314)
2210  {
2211  if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2212  {
2213  uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2214  if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2215  {
2216  uint32 displayID = ObjectMgr::ChooseDisplayId(ci);
2217  sObjectMgr->GetCreatureModelRandomGender(&displayID);
2218 
2219  target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, displayID);
2220  }
2221  }
2222  }
2223  }
2224 }
void RestoreDisplayId()
Definition: Unit.cpp:12807
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
uint32 GetRandomValidModelId() const
Definition: Creature.cpp:86
bool IsPlayer() const
Definition: ObjectGuid.h:249
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
Definition: SharedDefines.h:105
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Definition: SharedDefines.h:112
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=NULL)
Definition: ObjectMgr.cpp:1265
Definition: SharedDefines.h:108
void apply(T *val)
Definition: ByteConverter.h:41
#define sObjectMgr
Definition: ObjectMgr.h:1567
Player * ToPlayer()
Definition: Object.h:191
Definition: SharedDefines.h:107
Definition: SharedDefines.h:93
uint32 getTransForm() const
Definition: Unit.h:2018
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:94
Definition: SharedDefines.h:106
Definition: SharedDefines.h:104
bool IsPositive() const
Definition: SpellInfo.cpp:1495
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:12799
#define sSpellMgr
Definition: SpellMgr.h:756
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:102
Definition: SpellAuraDefines.h:39
uint32 GetMountID() const
Definition: Unit.h:1497
Definition: SpellAuraDefines.h:45
Definition: SharedDefines.h:103
ObjectGuid GetTarget() const
Definition: Unit.h:2209
uint8 getRace() const
Definition: Unit.h:1411
Definition: ObjectGuid.h:33
Definition: Common.h:103
bool IsPolymorphed() const
Definition: Unit.cpp:12786
uint8 getGender() const
Definition: Unit.h:1415
Definition: SharedDefines.h:109
bool IsMounted() const
Definition: Unit.h:1496
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3567
Definition: SharedDefines.h:111
void setTransForm(uint32 spellid)
Definition: Unit.h:2017
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: SpellAuraDefines.h:267
Definition: UpdateFields.h:119
Definition: Unit.h:1305
Definition: Creature.h:79
Definition: SpellAuraDefines.h:138

+ Here is the call graph for this function:

void AuraEffect::HandleAuraUntrackable ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2599 {
2601  return;
2602 
2603  Unit* target = aurApp->GetTarget();
2604 
2605  if (apply)
2607  else
2608  {
2609  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2610  if (target->HasAuraType(GetAuraType()))
2611  return;
2613  }
2614 }
Definition: Unit.h:224
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1252
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1271
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:124
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleAuraWaterWalk ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2739 {
2741  return;
2742 
2743  Unit* target = aurApp->GetTarget();
2744 
2745  if (!apply)
2746  {
2747  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2748  if (target->HasAuraType(GetAuraType()))
2749  return;
2750  }
2751 
2752  target->SetWaterWalking(apply);
2753 }
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
bool SetWaterWalking(bool enable, bool packetOnly=false)
Definition: Unit.cpp:15942
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleBindSight ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5177 {
5178  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5179  return;
5180 
5181  Unit* target = aurApp->GetTarget();
5182 
5183  Unit* caster = GetCaster();
5184 
5185  if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5186  return;
5187 
5188  caster->ToPlayer()->SetViewpoint(target, apply);
5189 }
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleChannelDeathItem ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5122 {
5123  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5124  return;
5125 
5126  if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5127  return;
5128 
5129  Unit* caster = GetCaster();
5130 
5131  if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5132  return;
5133 
5134  Player* plCaster = caster->ToPlayer();
5135  Unit* target = aurApp->GetTarget();
5136 
5137  // Item amount
5138  if (GetAmount() <= 0)
5139  return;
5140 
5141  if (GetSpellEffectInfo()->ItemType == 0)
5142  return;
5143 
5144  // Soul Shard
5145  if (GetSpellEffectInfo()->ItemType == 6265)
5146  {
5147  // Soul Shard only from units that grant XP or honor
5148  if (!plCaster->isHonorOrXPTarget(target) ||
5149  (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
5150  return;
5151  }
5152 
5153  //Adding items
5154  uint32 noSpaceForCount = 0;
5155  uint32 count = m_amount;
5156 
5157  ItemPosCountVec dest;
5158  InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellEffectInfo()->ItemType, count, &noSpaceForCount);
5159  if (msg != EQUIP_ERR_OK)
5160  {
5161  count-=noSpaceForCount;
5162  plCaster->SendEquipError(msg, NULL, NULL, GetSpellEffectInfo()->ItemType);
5163  if (count == 0)
5164  return;
5165  }
5166 
5167  Item* newitem = plCaster->StoreNewItem(dest, GetSpellEffectInfo()->ItemType, true);
5168  if (!newitem)
5169  {
5170  plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
5171  return;
5172  }
5173  plCaster->SendNewItem(newitem, count, true, true);
5174 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
Definition: Unit.h:379
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: ObjectGuid.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Unit.h:455
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Item.h:48
Definition: Item.h:71
Definition: Unit.h:378
Definition: Item.h:259
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Creature * ToCreature()
Definition: Object.h:194
bool isTappedBy(Player const *player) const
Definition: Creature.cpp:1022
InventoryResult
Definition: Item.h:46
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleCharmConvert ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3030 {
3031  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3032  return;
3033 
3034  Unit* target = aurApp->GetTarget();
3035 
3036  Unit* caster = GetCaster();
3037 
3038  if (apply)
3039  target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3040  else
3041  target->RemoveCharmedBy(caster);
3042 }
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:14172
Definition: Unit.h:1186
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=NULL)
Definition: Unit.cpp:14024
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleComprehendLanguage ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5252 {
5254  return;
5255 
5256  Unit* target = aurApp->GetTarget();
5257 
5258  if (apply)
5260  else
5261  {
5262  if (target->HasAuraType(GetAuraType()))
5263  return;
5264 
5266  }
5267 }
Definition: UpdateFields.h:110
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: Unit.h:714
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleEffect ( AuraApplication aurApp,
uint8  mode,
bool  apply 
)
862 {
863  // check if call is correct, we really don't want using bitmasks here (with 1 exception)
867  || mode == AURA_EFFECT_HANDLE_STAT
868  || mode == AURA_EFFECT_HANDLE_SKILL
869  || mode == AURA_EFFECT_HANDLE_REAPPLY
871 
872  // register/unregister effect in lists in case of real AuraEffect apply/remove
873  // registration/unregistration is done always before real effect handling (some effect handlers code is depending on this)
874  if (mode & AURA_EFFECT_HANDLE_REAL)
875  aurApp->GetTarget()->_RegisterAuraEffect(this, apply);
876 
877  // real aura apply/remove, handle modifier
879  ApplySpellMod(aurApp->GetTarget(), apply);
880 
881  // call scripts helping/replacing effect handlers
882  bool prevented = false;
883  if (apply)
884  prevented = GetBase()->CallScriptEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);
885  else
886  prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
887 
888  // check if script events have removed the aura or if default effect prevention was requested
889  if ((apply && aurApp->GetRemoveMode()) || prevented)
890  return;
891 
892  (*this.*AuraEffectHandler[GetAuraType()])(aurApp, mode, apply);
893 
894  // check if script events have removed the aura or if default effect prevention was requested
895  if (apply && aurApp->GetRemoveMode())
896  return;
897 
898  // call scripts triggering additional events after apply/remove
899  if (apply)
901  else
903 }
bool CallScriptEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition: SpellAuras.cpp:2005
AuraEffectHandleModes
Definition: SpellAuraDefines.h:36
Unit * GetTarget() const
Definition: SpellAuras.h:74
void ApplySpellMod(Unit *target, bool apply)
Definition: SpellAuraEffects.cpp:912
Definition: SpellAuraDefines.h:40
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:39
void CallScriptAfterEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition: SpellAuras.cpp:2058
Definition: SpellAuraDefines.h:41
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition: SpellAuras.cpp:2044
pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]
Definition: SpellAuraEffects.cpp:60
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
Definition: SpellAuras.cpp:2025
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition: Unit.cpp:3356
#define ASSERT
Definition: Errors.h:55
Definition: SpellAuraDefines.h:42
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:86
Definition: SpellAuraDefines.h:46
Definition: SpellAuraDefines.h:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleEffect ( Unit target,
uint8  mode,
bool  apply 
)
906 {
907  AuraApplication* aurApp = GetBase()->GetApplicationOfTarget(target->GetGUID());
908  ASSERT(aurApp);
909  HandleEffect(aurApp, mode, apply);
910 }
Definition: SpellAuras.h:50
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition: SpellAuraEffects.cpp:861
void apply(T *val)
Definition: ByteConverter.h:41
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:233
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

void AuraEffect::HandleEnableAltPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
6662 {
6663  if (!(mode & AURA_EFFECT_HANDLE_REAL))
6664  return;
6665 
6666  uint32 altPowerId = GetMiscValue();
6667  UnitPowerBarEntry const* powerEntry = sUnitPowerBarStore.LookupEntry(altPowerId);
6668  if (!powerEntry)
6669  return;
6670 
6671  if (apply)
6672  aurApp->GetTarget()->SetMaxPower(POWER_ALTERNATE_POWER, powerEntry->MaxPower);
6673  else
6674  aurApp->GetTarget()->SetMaxPower(POWER_ALTERNATE_POWER, 0);
6675 }
DB2Storage< UnitPowerBarEntry > sUnitPowerBarStore("UnitPowerBar.db2", UnitPowerBarFormat, HOTFIX_SEL_UNIT_POWER_BAR)
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:258
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
Definition: DB2Structure.h:1395
uint32 MaxPower
Definition: DB2Structure.h:1399

+ Here is the call graph for this function:

void AuraEffect::HandleFeignDeath ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2268 {
2269  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2270  return;
2271 
2272  Unit* target = aurApp->GetTarget();
2273 
2274  if (apply)
2275  {
2276  /*
2277  WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 0);
2278  target->SendMessageToSet(&data, true);
2279  */
2280 
2281  UnitList targets;
2282  Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityRange());
2284  target->VisitNearbyObject(target->GetMap()->GetVisibilityRange(), searcher);
2285  for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2286  {
2287  if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2288  continue;
2289 
2291  {
2292  if ((*iter)->GetCurrentSpell(i)
2293  && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2294  {
2295  (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2296  }
2297  }
2298  }
2299  target->CombatStop();
2301 
2302  // prevent interrupt message
2303  if (GetCasterGUID() == target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
2304  target->FinishSpell(CURRENT_GENERIC_SPELL, false);
2305  target->InterruptNonMeleeSpells(true);
2307 
2308  // stop handling the effect if it was removed by linked event
2309  if (aurApp->GetRemoveMode())
2310  return;
2311 
2312  target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); // blizz like 2.0.x
2313  target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x
2314  target->SetFlag(OBJECT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); // blizz like 2.0.x
2315  target->AddUnitState(UNIT_STATE_DIED);
2316 
2317  if (Creature* creature = target->ToCreature())
2318  creature->SetReactState(REACT_PASSIVE);
2319  }
2320  else
2321  {
2322  /*
2323  WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 0);
2324  target->SendMessageToSet(&data, true);
2325  */
2326 
2327  target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); // blizz like 2.0.x
2328  target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x
2329  target->RemoveFlag(OBJECT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); // blizz like 2.0.x
2331 
2332  if (Creature* creature = target->ToCreature())
2333  creature->InitializeReactState();
2334  }
2335 }
Definition: Unit.h:1109
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
Map * GetMap() const
Definition: Object.h:543
CurrentSpellTypes
Definition: Unit.h:1106
Definition: Unit.h:565
void AddUnitState(uint32 f)
Definition: Unit.h:1394
Definition: Unit.h:1129
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
Definition: UpdateFields.h:110
Definition: Creature.h:467
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:4206
void VisitNearbyObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:587
Definition: GridNotifiers.h:410
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1920
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
Definition: Unit.h:711
float GetVisibilityRange() const
Definition: Map.h:290
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:550
#define CURRENT_MAX_SPELL
Definition: Unit.h:1115
Definition: UpdateFields.h:109
Creature * ToCreature()
Definition: Object.h:194
Definition: Unit.h:702
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:2916
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition: Unit.cpp:2874
std::list< Unit * > UnitList
Definition: Unit.h:421
Definition: UpdateFields.h:30
void deleteReferences()
Definition: HostileRefManager.cpp:114
Definition: GridNotifiers.h:797
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:7371
Definition: Unit.h:1305
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition: Unit.h:1114

+ Here is the call graph for this function:

void AuraEffect::HandleForceMoveForward ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2806 {
2808  return;
2809 
2810  Unit* target = aurApp->GetTarget();
2811 
2812  if (apply)
2814  else
2815  {
2816  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2817  if (target->HasAuraType(GetAuraType()))
2818  return;
2820  }
2821 }
Definition: UpdateFields.h:110
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: Unit.h:717
Definition: SpellAuraDefines.h:45
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid GetTarget() const
Definition: Unit.h:2209
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleForceReaction ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5192 {
5194  return;
5195 
5196  Unit* target = aurApp->GetTarget();
5197 
5198  Player* player = target->ToPlayer();
5199  if (!player)
5200  return;
5201 
5202  uint32 factionId = GetMiscValue();
5203  ReputationRank factionRank = ReputationRank(m_amount);
5204 
5205  player->GetReputationMgr().ApplyForceReaction(factionId, factionRank, apply);
5206  player->GetReputationMgr().SendForceReactions();
5207 
5208  // stop fighting if at apply forced rank friendly or at remove real rank friendly
5209  if ((apply && factionRank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(factionId) >= REP_FRIENDLY))
5210  player->StopAttackFaction(factionId);
5211 }
ReputationRank
Definition: SharedDefines.h:211
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
int32 m_amount
Definition: SpellAuraEffects.h:115
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
Definition: SharedDefines.h:217
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleMastery ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5469 {
5470  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5471  return;
5472 
5473  Player* target = aurApp->GetTarget()->ToPlayer();
5474  if (!target)
5475  return;
5476 
5477  target->UpdateMastery();
5478 }
Definition: SpellAuraDefines.h:39

+ Here is the call graph for this function:

void AuraEffect::HandleModAttackSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4404 {
4406  return;
4407 
4408  Unit* target = aurApp->GetTarget();
4409 
4412 }
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:12921
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Unit.h:617

+ Here is the call graph for this function:

void AuraEffect::HandleModBaseResistance ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3706 {
3708  return;
3709 
3710  Unit* target = aurApp->GetTarget();
3711 
3712  // only players have base stats
3713  if (target->GetTypeId() != TYPEID_PLAYER)
3714  {
3715  //only pets have base stats
3716  if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3718  }
3719  else
3720  {
3721  for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
3722  if (GetMiscValue() & (1<<i))
3724  }
3725 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: Unit.h:517
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SharedDefines.h:288
Definition: SharedDefines.h:274
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:437
bool IsPet() const
Definition: Unit.h:1403
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Unit.h:501

+ Here is the call graph for this function:

void AuraEffect::HandleModCastingSpeed ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4358 {
4360  return;
4361 
4362  Unit* target = aurApp->GetTarget();
4363 
4364  target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4365 }
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:12953
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModCharm ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3015 {
3016  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3017  return;
3018 
3019  Unit* target = aurApp->GetTarget();
3020 
3021  Unit* caster = GetCaster();
3022 
3023  if (apply)
3024  target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3025  else
3026  target->RemoveCharmedBy(caster);
3027 }
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1183
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:14172
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=NULL)
Definition: Unit.cpp:14024
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleModCombatSpeedPct ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4381 {
4383  return;
4384 
4385  Unit* target = aurApp->GetTarget();
4387  if (abs(spellGroupVal) >= abs(GetAmount()))
4388  return;
4389 
4390  if (spellGroupVal)
4391  {
4392  target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4393  target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4394  target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4395  target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
4396  }
4397  target->ApplyCastTimePercentMod(float(m_amount), apply);
4401 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:12921
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: Unit.h:619
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:12953
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:16316
Definition: Unit.h:618
Definition: SpellAuraDefines.h:253
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Unit.h:617

+ Here is the call graph for this function:

void AuraEffect::HandleModConfuse ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2881 {
2882  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2883  return;
2884 
2885  Unit* target = aurApp->GetTarget();
2886 
2888 }
Definition: Unit.h:561
void apply(T *val)
Definition: ByteConverter.h:41
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:13808
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleModDamageDone ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4547 {
4549  return;
4550 
4551  Unit* target = aurApp->GetTarget();
4552 
4553  // apply item specific bonuses for already equipped weapon
4554  if (target->GetTypeId() == TYPEID_PLAYER)
4555  {
4556  for (int i = 0; i < MAX_ATTACK; ++i)
4557  if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
4558  target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply);
4559  }
4560 
4561  // GetMiscValue() is bitmask of spell schools
4562  // 1 (0-bit) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
4563  // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
4564  // 127 - full bitmask any damages
4565  //
4566  // mods must be applied base at equipped weapon class and subclass comparison
4567  // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4568  // GetMiscValue() comparison with item generated damage types
4569 
4570  if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
4571  {
4572  // apply generic physical damage bonuses including wand case
4573  if (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER)
4574  {
4578 
4579  if (target->GetTypeId() == TYPEID_PLAYER)
4580  {
4581  if (GetAmount() > 0)
4583  else
4585  }
4586  }
4587  else
4588  {
4589  // done in Player::_ApplyWeaponDependentAuraMods
4590  }
4591  }
4592 
4593  // Skip non magic case for speedup
4594  if ((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
4595  return;
4596 
4597  if (GetSpellInfo()->EquippedItemClass != -1 || GetSpellInfo()->EquippedItemInventoryTypeMask != 0)
4598  {
4599  // wand magic case (skip generic to all item spell bonuses)
4600  // done in Player::_ApplyWeaponDependentAuraMods
4601 
4602  // Skip item specific requirements for not wand magic damage
4603  return;
4604  }
4605 
4606  // Magic damage modifiers implemented in Unit::SpellDamageBonus
4607  // This information for client side use only
4608  if (target->GetTypeId() == TYPEID_PLAYER)
4609  {
4610  if (GetAmount() > 0)
4611  {
4612  for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
4613  {
4614  if ((GetMiscValue() & (1<<i)) != 0)
4616  }
4617  }
4618  else
4619  {
4620  for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
4621  {
4622  if ((GetMiscValue() & (1<<i)) != 0)
4624  }
4625  }
4626  if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
4627  pet->UpdateAttackPowerAndDamage();
4628  }
4629 }
Definition: Unit.h:620
Definition: TemporarySummon.h:83
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
void ApplyModUInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:1151
Definition: SharedDefines.h:303
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: Unit.h:510
Definition: Unit.h:512
Definition: Unit.h:511
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
Definition: SharedDefines.h:275
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SharedDefines.h:288
Definition: Item.h:259
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: UpdateFields.h:252
Definition: Unit.h:437
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: UpdateFields.h:251
WeaponAttackType
Definition: Unit.h:615
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModDamagePercentDone ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4632 {
4634  return;
4635 
4636  Unit* target = aurApp->GetTarget();
4638  if (abs(spellGroupVal) >= abs(GetAmount()))
4639  return;
4640 
4641  if (target->GetTypeId() == TYPEID_PLAYER)
4642  {
4643  for (int i = 0; i < MAX_ATTACK; ++i)
4644  if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), false))
4645  target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
4646  }
4647 
4648  if ((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (GetSpellInfo()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER))
4649  {
4650  if (spellGroupVal)
4651  {
4652  target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(spellGroupVal), !apply);
4653  target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(spellGroupVal), !apply);
4654  target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(spellGroupVal), !apply);
4655  }
4659 
4660  if (Player* player = target->ToPlayer())
4661  {
4662  if (spellGroupVal)
4663  player->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float(spellGroupVal), !apply);
4664 
4665  player->ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float(GetAmount()), apply);
4666  }
4667  }
4668  else
4669  {
4670  // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case
4671  }
4672 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
Definition: Unit.h:620
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: Unit.h:510
Definition: UpdateFields.h:253
Definition: Unit.h:512
Definition: Unit.h:511
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:16316
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SpellAuraDefines.h:139
Definition: SharedDefines.h:288
Definition: Item.h:259
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
WeaponAttackType
Definition: Unit.h:615
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModFear ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2891 {
2892  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2893  return;
2894 
2895  Unit* target = aurApp->GetTarget();
2896 
2898 }
Definition: Unit.h:557
void apply(T *val)
Definition: ByteConverter.h:41
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:13808
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleModHealingDone ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3870 {
3872  return;
3873 
3874  Unit* target = aurApp->GetTarget();
3875 
3876  if (target->GetTypeId() != TYPEID_PLAYER)
3877  return;
3878  // implemented in Unit::SpellHealingBonus
3879  // this information is for client side only
3880  target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
3881 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModHitChance ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4273 {
4275  return;
4276 
4277  Unit* target = aurApp->GetTarget();
4278 
4279  if (target->GetTypeId() == TYPEID_PLAYER)
4280  {
4281  target->ToPlayer()->UpdateMeleeHitChances();
4282  target->ToPlayer()->UpdateRangedHitChances();
4283  }
4284  else
4285  {
4286  target->m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
4287  target->m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
4288  }
4289 }
float m_modMeleeHitChance
Definition: Unit.h:1939
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
float m_modRangedHitChance
Definition: Unit.h:1940
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModInvisibility ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1514 {
1516  return;
1517 
1518  Unit* target = aurApp->GetTarget();
1520 
1521  if (apply)
1522  {
1523  // apply glow vision
1524  if (target->GetTypeId() == TYPEID_PLAYER)
1525  target->SetByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
1526 
1527  target->m_invisibility.AddFlag(type);
1528  target->m_invisibility.AddValue(type, GetAmount());
1529  }
1530  else
1531  {
1533  {
1534  // if not have different invisibility auras.
1535  // remove glow vision
1536  if (target->GetTypeId() == TYPEID_PLAYER)
1537  target->RemoveByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
1538 
1539  target->m_invisibility.DelFlag(type);
1540  }
1541  else
1542  {
1543  bool found = false;
1545  for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1546  {
1547  if (GetMiscValue() == (*i)->GetMiscValue())
1548  {
1549  found = true;
1550  break;
1551  }
1552  }
1553  if (!found)
1554  target->m_invisibility.DelFlag(type);
1555  }
1556 
1557  target->m_invisibility.AddValue(type, -GetAmount());
1558  }
1559 
1560  // call functions which may have additional effects after chainging state of unit
1561  if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1562  {
1563  // drop flag at invisibiliy in bg
1565  }
1566  target->UpdateObjectVisibility();
1567 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: UpdateFields.h:291
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
void apply(T *val)
Definition: ByteConverter.h:41
InvisibilityType
Definition: SharedDefines.h:1695
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1252
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1271
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
Definition: SpellAuraDefines.h:39
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:379
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:380
Definition: ObjectGuid.h:33
Definition: SpellAuraDefines.h:78
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:535
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleModInvisibilityDetect ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1489 {
1491  return;
1492 
1493  Unit* target = aurApp->GetTarget();
1495 
1496  if (apply)
1497  {
1498  target->m_invisibilityDetect.AddFlag(type);
1499  target->m_invisibilityDetect.AddValue(type, GetAmount());
1500  }
1501  else
1502  {
1504  target->m_invisibilityDetect.DelFlag(type);
1505 
1506  target->m_invisibilityDetect.AddValue(type, -GetAmount());
1507  }
1508 
1509  // call functions which may have additional effects after chainging state of unit
1510  target->UpdateObjectVisibility();
1511 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:536
void apply(T *val)
Definition: ByteConverter.h:41
InvisibilityType
Definition: SharedDefines.h:1695
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:379
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:380
Definition: SpellAuraDefines.h:79
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModManaRegen ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4053 {
4055  return;
4056 
4057  Unit* target = aurApp->GetTarget();
4058 
4059  if (target->GetTypeId() != TYPEID_PLAYER)
4060  return;
4061 
4062  //Note: an increase in regen does NOT cause threat.
4063  target->ToPlayer()->UpdateManaRegen();
4064 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleModMechanicImmunity ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3432 {
3433  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3434  return;
3435 
3436  Unit* target = aurApp->GetTarget();
3437  uint32 mechanic;
3438 
3439  switch (GetId())
3440  {
3441  case 34471: // The Beast Within
3442  case 19574: // Bestial Wrath
3460  break;
3461  case 42292: // PvP trinket
3462  case 59752: // Every Man for Himself
3464  // Actually we should apply immunities here, too, but the aura has only 100 ms duration, so there is practically no point
3465  break;
3466  case 54508: // Demonic Empowerment
3467  mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
3471  break;
3472  default:
3473  if (GetMiscValue() < 1)
3474  return;
3475  mechanic = 1 << GetMiscValue();
3477  break;
3478  }
3479 
3480  if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
3482 }
Definition: SharedDefines.h:1810
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
Definition: SharedDefines.h:1791
Definition: SharedDefines.h:1817
Definition: SharedDefines.h:1802
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SharedDefines.h:1808
Definition: SharedDefines.h:1792
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Definition: SharedDefines.h:1820
#define IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
Definition: SharedDefines.h:1827
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
Definition: SharedDefines.h:1801
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:1814
Definition: SharedDefines.h:407
Definition: SharedDefines.h:1797
Definition: SharedDefines.h:1795
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:39
Definition: SharedDefines.h:1813
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: SharedDefines.h:1804
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:3870
Definition: SharedDefines.h:1800
Definition: Unit.h:1305
Definition: SharedDefines.h:1865
Definition: Unit.h:451
Definition: SharedDefines.h:1807
Definition: SharedDefines.h:1803

+ Here is the call graph for this function:

void AuraEffect::HandleModMeleeRangedSpeedPct ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

ToDo: Haste auras with the same handler CAN'T stack together

4368 {
4370  return;
4371 
4373  Unit* target = aurApp->GetTarget();
4374 
4378 }
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:12921
Definition: Unit.h:619
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: Unit.h:618
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: Unit.h:617

+ Here is the call graph for this function:

void AuraEffect::HandleModMeleeSpeedPct ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

ToDo: Haste auras with the same handler CAN'T stack together

4415 {
4417  return;
4418 
4420  Unit* target = aurApp->GetTarget();
4422  if (abs(spellGroupVal) >= abs(GetAmount()))
4423  return;
4424 
4425  if (spellGroupVal)
4426  {
4427  target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4428  target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4429  }
4432 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:12921
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:16316
Definition: Unit.h:618
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: SpellAuraDefines.h:198
Definition: Unit.h:617

+ Here is the call graph for this function:

void AuraEffect::HandleModOffhandDamagePercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4675 {
4677  return;
4678 
4679  Unit* target = aurApp->GetTarget();
4680 
4682 }
Definition: Unit.h:511
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModPercentStat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3786 {
3788  return;
3789 
3790  Unit* target = aurApp->GetTarget();
3791 
3792  if (GetMiscValue() < -1 || GetMiscValue() > 4)
3793  {
3794  TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3795  return;
3796  }
3797 
3798  // only players have base stats
3799  if (target->GetTypeId() != TYPEID_PLAYER)
3800  return;
3801 
3802  for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3803  {
3804  if (GetMiscValue() == i || GetMiscValue() == -1)
3806  }
3807 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:237
#define MAX_STATS
Definition: SharedDefines.h:244
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32_t int32
Definition: Define.h:146
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:515
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:436
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModPossess ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2940 {
2941  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2942  return;
2943 
2944  Unit* target = aurApp->GetTarget();
2945 
2946  Unit* caster = GetCaster();
2947 
2948  // no support for posession AI yet
2949  if (caster && caster->GetTypeId() == TYPEID_UNIT)
2950  {
2951  HandleModCharm(aurApp, mode, apply);
2952  return;
2953  }
2954 
2955  if (apply)
2956  target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
2957  else
2958  target->RemoveCharmedBy(caster);
2959 }
Definition: ObjectGuid.h:32
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1184
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:14172
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:3014
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=NULL)
Definition: Unit.cpp:14024
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleModPossessPet ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2962 {
2963  // Used by spell "Eyes of the Beast"
2964 
2965  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2966  return;
2967 
2968  Unit* caster = GetCaster();
2969  if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
2970  return;
2971 
2972  //seems it may happen that when removing it is no longer owner's pet
2973  //if (caster->ToPlayer()->GetPet() != target)
2974  // return;
2975 
2976  Unit* target = aurApp->GetTarget();
2977  if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
2978  return;
2979 
2980  Pet* pet = target->ToPet();
2981 
2982  if (apply)
2983  {
2984  if (caster->ToPlayer()->GetPet() != pet)
2985  return;
2986 
2987  // Must clear current motion or pet leashes back to owner after a few yards
2988  // when under spell 'Eyes of the Beast'
2989  pet->GetMotionMaster()->Clear();
2990  pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
2991  }
2992  else
2993  {
2994  pet->RemoveCharmedBy(caster);
2995 
2996  if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
2997  pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
2998  else
2999  {
3000  // Reinitialize the pet bar or it will appear greyed out
3001  caster->ToPlayer()->PetSpellInitialize();
3002 
3003  // Follow owner only if not fighting or owner didn't click "stay" at new location
3004  // This may be confusing because pet bar shows "stay" when under the spell but it retains
3005  // the "follow" flag. Player MUST click "stay" while under the spell.
3006  if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3007  {
3008  pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, pet->GetFollowAngle());
3009  }
3010  }
3011  }
3012 }
Map * GetMap() const
Definition: Object.h:543
void Clear(bool reset=true)
Definition: MotionMaster.h:138
Pet * ToPet()
Definition: Unit.h:2200
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: ObjectGuid.h:32
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
CharmInfo * GetCharmInfo()
Definition: Unit.h:1748
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Unit * GetVictim() const
Definition: Unit.h:1379
Definition: SpellAuraDefines.h:39
float GetVisibilityRange() const
Definition: Map.h:290
bool IsPet() const
Definition: Unit.h:1403
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1184
bool HasCommandState(CommandStates state) const
Definition: Unit.h:1212
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:14172
Definition: PetDefines.h:38
float GetFollowAngle() const override
Definition: TemporarySummon.h:73
#define PET_FOLLOW_DIST
Definition: PetDefines.h:77
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=NULL)
Definition: Unit.cpp:14024
Definition: Unit.h:1137
Definition: Unit.h:1305
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:672
Definition: Pet.h:46
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
Definition: MotionMaster.cpp:265

+ Here is the call graph for this function:

void AuraEffect::HandleModPowerCost ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4717 {
4719  return;
4720 
4721  Unit* target = aurApp->GetTarget();
4722 
4723  for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4724  if (GetMiscValue() & (1<<i))
4726 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:1160
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
Definition: UpdateFields.h:157
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModPowerCostPCT ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4704 {
4706  return;
4707 
4708  Unit* target = aurApp->GetTarget();
4709 
4710  float amount = CalculatePct(1.0f, GetAmount());
4711  for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4712  if (GetMiscValue() & (1 << i))
4714 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: UpdateFields.h:158
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition: Object.cpp:1176
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
T CalculatePct(T base, U pct)
Definition: Util.h:92
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModPowerRegen ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4030 {
4032  return;
4033 
4034  Unit* target = aurApp->GetTarget();
4035 
4036  if (target->GetTypeId() != TYPEID_PLAYER)
4037  return;
4038 
4039  // Update manaregen value
4040  if (GetMiscValue() == POWER_MANA)
4041  target->ToPlayer()->UpdateManaRegen();
4042  else if (GetMiscValue() == POWER_RUNES)
4043  target->ToPlayer()->UpdateRuneRegen(RuneType(GetMiscValueB()));
4044  // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
4045 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
int32 GetMiscValueB() const
Definition: SpellAuraEffects.h:52
Definition: SpellAuraDefines.h:43
Definition: SharedDefines.h:253
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
RuneType
Definition: Player.h:459
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
Definition: SharedDefines.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleModPowerRegenPCT ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4048 {
4049  HandleModPowerRegen(aurApp, mode, apply);
4050 }
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
Definition: SpellAuraEffects.cpp:4029
void apply(T *val)
Definition: ByteConverter.h:41

+ Here is the call graph for this function:

void AuraEffect::HandleModRating ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4450 {
4452  return;
4453 
4454  Unit* target = aurApp->GetTarget();
4455 
4456  if (target->GetTypeId() != TYPEID_PLAYER)
4457  return;
4458 
4459  for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4460  if (GetMiscValue() & (1 << rating))
4461  target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4462 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
#define MAX_COMBAT_RATING
Definition: Unit.h:658
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
CombatRating
Definition: Unit.h:623
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModRatingFromStat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4465 {
4467  return;
4468 
4469  Unit* target = aurApp->GetTarget();
4470 
4471  if (target->GetTypeId() != TYPEID_PLAYER)
4472  return;
4473 
4474  // Just recalculate ratings
4475  for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4476  if (GetMiscValue() & (1 << rating))
4477  target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
4478 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
#define MAX_COMBAT_RATING
Definition: Unit.h:658
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
CombatRating
Definition: Unit.h:623
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModResistancePercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3673 {
3675  return;
3676 
3677  Unit* target = aurApp->GetTarget();
3679  if (abs(spellGroupVal) >= abs(GetAmount()))
3680  return;
3681 
3682  for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
3683  {
3684  if (GetMiscValue() & int32(1<<i))
3685  {
3686  if (spellGroupVal)
3687  {
3688  target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, (float)spellGroupVal, !apply);
3689  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3690  {
3691  target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)spellGroupVal, !apply);
3692  target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)spellGroupVal, !apply);
3693  }
3694  }
3696  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3697  {
3698  target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, (float)GetAmount(), apply);
3699  target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, (float)GetAmount(), apply);
3700  }
3701  }
3702  }
3703 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
int8_t int8
Definition: Define.h:148
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: Unit.h:517
SpellSchools
Definition: SharedDefines.h:272
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:16316
void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply)
Definition: Unit.cpp:4668
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
Definition: SharedDefines.h:274
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
bool IsPet() const
Definition: Unit.h:1403
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
int32_t int32
Definition: g3dmath.h:167
Definition: SpellAuraDefines.h:161
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellCategoryCooldown ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
6678 {
6679  if (!(mode & AURA_EFFECT_HANDLE_REAL))
6680  return;
6681 
6682  if (Player* player = aurApp->GetTarget()->ToPlayer())
6683  player->SendSpellCategoryCooldowns();
6684 }
Definition: SpellAuraDefines.h:39

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellCritChance ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4305 {
4307  return;
4308 
4309  Unit* target = aurApp->GetTarget();
4310 
4311  if (target->GetTypeId() == TYPEID_PLAYER)
4312  target->ToPlayer()->UpdateAllSpellCritChances();
4313  else
4314  target->m_baseSpellCritChance += (apply) ? GetAmount():-GetAmount();
4315 }
int32 m_baseSpellCritChance
Definition: Unit.h:1942
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellCritChanceShool ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4318 {
4320  return;
4321 
4322  Unit* target = aurApp->GetTarget();
4323 
4324  if (target->GetTypeId() != TYPEID_PLAYER)
4325  return;
4326 
4327  for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
4328  if (GetMiscValue() & (1<<school))
4329  target->ToPlayer()->UpdateSpellCritChance(school);
4330 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SpellAuraDefines.h:43
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:274
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellDamagePercentFromAttackPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3840 {
3842  return;
3843 
3844  Unit* target = aurApp->GetTarget();
3845 
3846  if (target->GetTypeId() != TYPEID_PLAYER)
3847  return;
3848 
3849  // Magic damage modifiers implemented in Unit::SpellDamageBonus
3850  // This information for client side use only
3851  // Recalculate bonus
3852  target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
3853 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellDamagePercentFromStat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3810 {
3812  return;
3813 
3814  Unit* target = aurApp->GetTarget();
3815 
3816  if (target->GetTypeId() != TYPEID_PLAYER)
3817  return;
3818 
3819  // Magic damage modifiers implemented in Unit::SpellDamageBonus
3820  // This information for client side use only
3821  // Recalculate bonus
3822  target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
3823 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellHealingPercentFromAttackPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3856 {
3858  return;
3859 
3860  Unit* target = aurApp->GetTarget();
3861 
3862  if (target->GetTypeId() != TYPEID_PLAYER)
3863  return;
3864 
3865  // Recalculate bonus
3866  target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
3867 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellHealingPercentFromStat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3826 {
3828  return;
3829 
3830  Unit* target = aurApp->GetTarget();
3831 
3832  if (target->GetTypeId() != TYPEID_PLAYER)
3833  return;
3834 
3835  // Recalculate bonus
3836  target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
3837 }
Definition: SpellAuraDefines.h:43
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModSpellHitChance ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4292 {
4294  return;
4295 
4296  Unit* target = aurApp->GetTarget();
4297 
4298  if (target->GetTypeId() == TYPEID_PLAYER)
4299  target->ToPlayer()->UpdateSpellHitChances();
4300  else
4301  target->m_modSpellHitChance += (apply) ? GetAmount(): (-GetAmount());
4302 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
float m_modSpellHitChance
Definition: Unit.h:1941
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModStatBonusPercent ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3974 {
3976  return;
3977 
3978  Unit* target = aurApp->GetTarget();
3979 
3980  if (GetMiscValue() < -1 || GetMiscValue() > 4)
3981  {
3982  TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_STAT_BONUS_PCT not valid");
3983  return;
3984  }
3985 
3986  // only players have base stats
3987  if (target->GetTypeId() != TYPEID_PLAYER)
3988  return;
3989 
3990  for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3991  {
3992  if (GetMiscValue() == i || GetMiscValue() == -1)
3993  {
3995  target->ApplyStatPercentBuffMod(Stats(i), float(m_amount), apply);
3996  }
3997  }
3998 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
int32 m_amount
Definition: SpellAuraEffects.h:115
Stats
Definition: SharedDefines.h:235
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:237
#define MAX_STATS
Definition: SharedDefines.h:244
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
int32_t int32
Definition: Define.h:146
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:435
void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
Definition: Unit.cpp:4686
Definition: Unit.h:515
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModStateImmunityMask ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3187 {
3188  if (!(mode & AURA_EFFECT_HANDLE_REAL))
3189  return;
3190 
3191  Unit* target = aurApp->GetTarget();
3192  std::list <AuraType> aura_immunity_list;
3193  uint32 mechanic_immunity_list = 0;
3194  int32 miscVal = GetMiscValue();
3195 
3196  switch (miscVal)
3197  {
3198  case 27:
3200  aura_immunity_list.push_back(SPELL_AURA_MOD_SILENCE);
3201  break;
3202  case 96:
3203  case 1615:
3204  {
3205  if (GetAmount())
3206  {
3207  mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3208  | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3209  | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3210  | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3211  | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
3212  | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3213 
3226  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3227  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3228  aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3229  aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3230  aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3231  }
3232  break;
3233  }
3234  case 679:
3235  {
3236  if (GetId() == 57742)
3237  {
3238  mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3239  | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3240  | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3241  | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3242  | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
3243  | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3244 
3257  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3258  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3259  aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3260  aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3261  aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3262  }
3263  break;
3264  }
3265  case 1557:
3266  {
3267  if (GetId() == 64187)
3268  {
3269  mechanic_immunity_list = (1 << MECHANIC_STUN);
3271  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3272  }
3273  else
3274  {
3275  mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3276  | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3277  | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3278  | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3279  | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
3280  | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3281 
3294  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3295  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3296  aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3297  aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3298  aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3299  }
3300  break;
3301  }
3302  case 1614:
3303  case 1694:
3304  {
3306  aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3307  break;
3308  }
3309  case 1630:
3310  {
3311  if (!GetAmount())
3312  {
3314  aura_immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
3315  }
3316  else
3317  {
3318  mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3319  | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3320  | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3321  | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3322  | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
3323  | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3324 
3337  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3338  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3339  aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3340  aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3341  aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3342  }
3343  break;
3344  }
3345  case 477:
3346  case 1733:
3347  {
3348  if (!GetAmount())
3349  {
3350  mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
3351  | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
3352  | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
3353  | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
3354  | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
3355  | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
3356 
3371  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3372  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3373  aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3374  aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3375  aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3376  }
3377  break;
3378  }
3379  case 878:
3380  {
3381  if (GetAmount() == 1)
3382  {
3383  mechanic_immunity_list = (1 << MECHANIC_SNARE) | (1 << MECHANIC_STUN)
3384  | (1 << MECHANIC_DISORIENTED) | (1 << MECHANIC_FREEZE);
3385 
3390  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3391  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3392  }
3393  break;
3394  }
3395  default:
3396  break;
3397  }
3398 
3399  if (aura_immunity_list.empty())
3400  {
3401  if (miscVal & (1<<10))
3402  aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
3403  if (miscVal & (1<<1))
3404  aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
3405 
3406  // These flag can be recognized wrong:
3407  if (miscVal & (1<<6))
3408  aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
3409  if (miscVal & (1<<0))
3410  aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
3411  if (miscVal & (1<<2))
3412  aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
3413  if (miscVal & (1<<9))
3414  aura_immunity_list.push_back(SPELL_AURA_MOD_FEAR);
3415  if (miscVal & (1<<7))
3416  aura_immunity_list.push_back(SPELL_AURA_MOD_DISARM);
3417  }
3418 
3419  // apply immunities
3420  for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
3421  target->ApplySpellImmune(GetId(), IMMUNITY_STATE, *iter, apply);
3422 
3423  if (apply && GetSpellInfo()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
3424  {
3425  target->RemoveAurasWithMechanic(mechanic_immunity_list, AURA_REMOVE_BY_DEFAULT, GetId());
3426  for (std::list <AuraType>::iterator iter = aura_immunity_list.begin(); iter != aura_immunity_list.end(); ++iter)
3427  target->RemoveAurasByType(*iter);
3428  }
3429 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
Definition: SharedDefines.h:1791
Definition: SharedDefines.h:1802
Definition: SpellAuraDefines.h:72
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SharedDefines.h:1792
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Definition: SharedDefines.h:1820
Definition: SharedDefines.h:1861
Definition: SharedDefines.h:1124
Definition: SpellAuraDefines.h:67
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
Definition: SharedDefines.h:1801
Definition: SpellAuraDefines.h:86
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:1799
Definition: SpellAuraDefines.h:127
Definition: SpellAuraDefines.h:116
Definition: SharedDefines.h:1814
Definition: SharedDefines.h:407
Definition: SharedDefines.h:1797
Definition: SharedDefines.h:1795
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SpellAuraDefines.h:87
Definition: SpellAuraDefines.h:71
Definition: SpellAuraDefines.h:39
Definition: SharedDefines.h:1813
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: SharedDefines.h:1108
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:3870
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:3567
Definition: SpellAuraDefines.h:93
Definition: SharedDefines.h:1800
Definition: SharedDefines.h:1860
Definition: Unit.h:1305
Definition: SharedDefines.h:1865
Definition: SpellAuraDefines.h:65
Definition: SharedDefines.h:1154
Definition: Unit.h:451
Definition: SharedDefines.h:1807
Definition: SharedDefines.h:1803

+ Here is the call graph for this function:

void AuraEffect::HandleModStealth ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1595 {
1597  return;
1598 
1599  Unit* target = aurApp->GetTarget();
1601 
1602  if (apply)
1603  {
1604  target->m_stealth.AddFlag(type);
1605  target->m_stealth.AddValue(type, GetAmount());
1606 
1608  if (target->GetTypeId() == TYPEID_PLAYER)
1609  target->SetByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_STEALTH);
1610  }
1611  else
1612  {
1613  target->m_stealth.AddValue(type, -GetAmount());
1614 
1615  if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
1616  {
1617  target->m_stealth.DelFlag(type);
1618 
1620  if (target->GetTypeId() == TYPEID_PLAYER)
1621  target->RemoveByteFlag(PLAYER_FIELD_BYTES2, PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION, PLAYER_FIELD_BYTE2_STEALTH);
1622  }
1623  }
1624 
1625  // call functions which may have additional effects after chainging state of unit
1626  if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1627  {
1628  // drop flag at stealth in bg
1630  }
1631  target->UpdateObjectVisibility();
1632 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: SpellAuraDefines.h:76
void RemoveStandFlags(uint8 flags)
Definition: Unit.h:1494
Definition: UpdateFields.h:291
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
void apply(T *val)
Definition: ByteConverter.h:41
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1252
TypeID GetTypeId() const
Definition: Object.h:113
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:1271
void SetStandFlags(uint8 flags)
Definition: Unit.h:1493
Definition: SpellAuraDefines.h:39
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
StealthType
Definition: SharedDefines.h:1687
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:379
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:380
Definition: ObjectGuid.h:33
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:532
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: Unit.h:223

+ Here is the call graph for this function:

void AuraEffect::HandleModStealthDetect ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1570 {
1572  return;
1573 
1574  Unit* target = aurApp->GetTarget();
1576 
1577  if (apply)
1578  {
1579  target->m_stealthDetect.AddFlag(type);
1580  target->m_stealthDetect.AddValue(type, GetAmount());
1581  }
1582  else
1583  {
1585  target->m_stealthDetect.DelFlag(type);
1586 
1587  target->m_stealthDetect.AddValue(type, -GetAmount());
1588  }
1589 
1590  // call functions which may have additional effects after chainging state of unit
1591  target->UpdateObjectVisibility();
1592 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h:533
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:77
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
StealthType
Definition: SharedDefines.h:1687
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:379
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:380
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModStealthLevel ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1635 {
1637  return;
1638 
1639  Unit* target = aurApp->GetTarget();
1641 
1642  if (apply)
1643  target->m_stealth.AddValue(type, GetAmount());
1644  else
1645  target->m_stealth.AddValue(type, -GetAmount());
1646 
1647  // call functions which may have additional effects after chainging state of unit
1648  target->UpdateObjectVisibility();
1649 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:384
StealthType
Definition: SharedDefines.h:1687
ObjectGuid GetTarget() const
Definition: Unit.h:2209
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:532
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModTargetResistance ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3728 {
3730  return;
3731 
3732  Unit* target = aurApp->GetTarget();
3733 
3734  // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
3735 
3736  // show armor penetration
3739 
3740  // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
3743 }
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition: Object.cpp:1160
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: UpdateFields.h:265
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:288
Definition: UpdateFields.h:264
Definition: SharedDefines.h:299
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModTaunt ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2854 {
2855  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2856  return;
2857 
2858  Unit* target = aurApp->GetTarget();
2859 
2860  if (!target->IsAlive() || !target->CanHaveThreatList())
2861  return;
2862 
2863  Unit* caster = GetCaster();
2864  if (!caster || !caster->IsAlive())
2865  return;
2866 
2867  if (apply)
2868  target->TauntApply(caster);
2869  else
2870  {
2871  // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
2872  target->TauntFadeOut(caster);
2873  }
2874 }
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void apply(T *val)
Definition: ByteConverter.h:41
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition: Unit.cpp:10652
bool IsAlive() const
Definition: Unit.h:1692
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
void TauntApply(Unit *victim)
Definition: Unit.cpp:10709
Definition: Unit.h:1305
void TauntFadeOut(Unit *taunter)
Definition: Unit.cpp:10737

+ Here is the call graph for this function:

void AuraEffect::HandleModThreat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2828 {
2830  return;
2831 
2832  Unit* target = aurApp->GetTarget();
2833  for (int8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
2834  if (GetMiscValue() & (1 << i))
2836 }
int8_t int8
Definition: Define.h:148
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void apply(T *val)
Definition: ByteConverter.h:41
#define MAX_SPELL_SCHOOL
Definition: SharedDefines.h:283
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:83
ObjectGuid GetTarget() const
Definition: Unit.h:2209
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition: Unit.h:1944
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleModTotalPercentStat ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
3884 {
3886  return;
3887 
3888  Unit* target = aurApp->GetTarget();
3890  if (abs(spellGroupVal) >= abs(GetAmount()))
3891  return;
3892 
3893  if (spellGroupVal)
3894  {
3895  for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
3896  {
3897  if (GetMiscValue() == i || GetMiscValue() == -1) // affect the same stats
3898  {
3899  target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal), !apply);
3900  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3901  target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal), !apply);
3902  }
3903  }
3904  }
3905 
3906  // save current health state
3907  float healthPct = target->GetHealthPct();
3908  bool alive = target->IsAlive();
3909 
3910  for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
3911  {
3912  if (GetMiscValueB() & 1 << i || !GetMiscValueB()) // 0 is also used for all stats
3913  {
3915  if (abs(spellGroupVal2) >= abs(GetAmount()))
3916  continue;
3917 
3918  if (spellGroupVal2)
3919  {
3920  target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(spellGroupVal2), !apply);
3921  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3922  target->ApplyStatPercentBuffMod(Stats(i), float(spellGroupVal2), !apply);
3923  }
3924 
3926  if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3927  target->ApplyStatPercentBuffMod(Stats(i), float(GetAmount()), apply);
3928  }
3929  }
3930 
3931  // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_UNK4 0x00000010 flag)
3932  // this check is total bullshit i think
3934  target->SetHealth(std::max<uint32>(uint32(healthPct * target->GetMaxHealth() * 0.01f), (alive ? 1 : 0)));
3935 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
uint32 GetMaxHealth() const
Definition: Unit.h:1427
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
UnitMods
Definition: Unit.h:482
Definition: SharedDefines.h:239
Definition: SharedDefines.h:360
Stats
Definition: SharedDefines.h:235
int32 GetMiscValueB() const
Definition: SpellAuraEffects.h:52
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:237
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:16316
#define MAX_STATS
Definition: SharedDefines.h:244
TypeID GetTypeId() const
Definition: Object.h:113
bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
Definition: Unit.cpp:11323
bool IsAlive() const
Definition: Unit.h:1692
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
bool IsPet() const
Definition: Unit.h:1403
Definition: Unit.h:438
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
Definition: Unit.cpp:4686
Definition: SpellAuraDefines.h:197
Definition: Unit.h:515
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
uint32_t uint32
Definition: g3dmath.h:168
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46
float GetHealthPct() const
Definition: Unit.h:1434

+ Here is the call graph for this function:

void AuraEffect::HandleModUnattackable ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2338 {
2340  return;
2341 
2342  Unit* target = aurApp->GetTarget();
2343 
2344  // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2346  return;
2347 
2349 
2350  // call functions which may have additional effects after chainging state of unit
2351  if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2352  {
2353  target->CombatStop();
2355  }
2356 }
Definition: Unit.h:674
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:39
Definition: SpellAuraDefines.h:45
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:1247
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: UpdateFields.h:109
Definition: SpellAuraDefines.h:153
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:7371
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleNoImmediateEffect ( AuraApplication const ,
uint8  ,
bool   
) const
inline
143  {
144  // aura type not have immediate effect at add/remove and handled by ID in other code place
145  }
void AuraEffect::HandleNoReagentUseAura ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4747 {
4748  if (!(mode & AURA_EFFECT_HANDLE_REAL))
4749  return;
4750 
4751  Unit* target = aurApp->GetTarget();
4752 
4753  if (target->GetTypeId() != TYPEID_PLAYER)
4754  return;
4755 
4756  flag128 mask;
4758  for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
4759  if (SpellEffectInfo const* effect = (*i)->GetSpellEffectInfo())
4760  mask |= effect->SpellClassMask;
4761 
4762  target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]);
4763  target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]);
4764  target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask[2]);
4765  target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+3, mask[3]);
4766 }
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: SpellAuraDefines.h:316
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Util.h:362
Definition: UpdateFields.h:279
Definition: SpellInfo.h:238
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandleNULL ( AuraApplication const ,
uint8  ,
bool   
) const
inline
135  {
136  // not implemented
137  }
void AuraEffect::HandleObsModPowerAuraTick ( Unit target,
Unit caster 
) const
6357 {
6358  Powers powerType;
6359  if (GetMiscValue() == POWER_ALL)
6360  powerType = target->getPowerType();
6361  else
6362  powerType = Powers(GetMiscValue());
6363 
6364  if (!target->IsAlive() || !target->GetMaxPower(powerType))
6365  return;
6366 
6367  if (target->HasUnitState(UNIT_STATE_ISOLATED))
6368  {
6369  SendTickImmune(target, caster);
6370  return;
6371  }
6372 
6373  // don't regen when permanent aura target has full power
6374  if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
6375  return;
6376 
6377  // ignore negative values (can be result apply spellmods to aura damage
6378  uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100;
6379  TC_LOG_DEBUG("spells.periodic", "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
6380  GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId());
6381 
6382  SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6383  int32 gain = target->ModifyPower(powerType, amount);
6384 
6385  if (caster)
6386  target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
6387 
6388  target->SendPeriodicAuraLog(&pInfo);
6389 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=NULL)
Definition: HostileRefManager.cpp:35
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:4871
uint32 GetId() const
Definition: SpellAuraEffects.h:47
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: SharedDefines.h:266
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Powers getPowerType() const
Definition: Unit.h:1444
Powers
Definition: SharedDefines.h:246
string ToString(int i)
Definition: strutil.h:491
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
bool IsAlive() const
Definition: Unit.h:1692
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:1061
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
Definition: Unit.h:563
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleOverrideAttackPowerBySpellPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4014 {
4016  return;
4017 
4018  Player* target = aurApp->GetTarget()->ToPlayer();
4019  if (!target)
4020  return;
4021 
4022  target->ApplyModSignedFloatValue(PLAYER_FIELD_OVERRIDE_AP_BY_SPELL_POWER_PERCENT, float(m_amount), apply);
4023  target->UpdateAttackPowerAndDamage();
4024 }
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleOverrideSpellPowerByAttackPower ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4001 {
4003  return;
4004 
4005  Player* target = aurApp->GetTarget()->ToPlayer();
4006  if (!target)
4007  return;
4008 
4009  target->ApplyModSignedFloatValue(PLAYER_FIELD_OVERRIDE_SPELL_POWER_BY_AP_PCT, float(m_amount), apply);
4010  target->UpdateSpellDamageAndHealingBonus();
4011 }
Definition: UpdateFields.h:262
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandlePeriodicDamageAurasTick ( Unit target,
Unit caster 
) const
5912 {
5913  if (!caster || !target->IsAlive())
5914  return;
5915 
5917  {
5918  SendTickImmune(target, caster);
5919  return;
5920  }
5921 
5922  // Consecrate ticks can miss and will not show up in the combat log
5924  caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5925  return;
5926 
5927  // some auras remove at specific health level or more
5929  {
5930  switch (GetSpellInfo()->Id)
5931  {
5932  case 43093: case 31956: case 38801: // Grievous Wound
5933  case 35321: case 38363: case 39215: // Gushing Wound
5934  if (target->IsFullHealth())
5935  {
5936  target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
5937  return;
5938  }
5939  break;
5940  case 38772: // Grievous Wound
5941  {
5942  if (SpellEffectInfo const* effect = GetSpellInfo()->GetEffect(DIFFICULTY_NONE, EFFECT_1))
5943  {
5944  uint32 percent = effect->CalcValue(caster);
5945  if (!target->HealthBelowPct(percent))
5946  {
5947  target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
5948  return;
5949  }
5950  }
5951  break;
5952  }
5953  }
5954  }
5955 
5956  uint32 absorb = 0;
5957  uint32 resist = 0;
5958  CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
5959 
5960  // AOE spells are not affected by the new periodic system.
5962  // ignore negative values (can be result apply spellmods to aura damage
5963  uint32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage;
5964 
5965  // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5966  if (isAreaAura)
5967  sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5968 
5970  {
5971  if (isAreaAura)
5972  damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT);
5973  damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount());
5974 
5975  // Calculate armor mitigation
5976  if (caster->IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex()))
5977  {
5978  uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellInfo());
5979  cleanDamage.mitigated_damage += damage - damageReductedArmor;
5980  damage = damageReductedArmor;
5981  }
5982 
5983  // Curse of Agony damage-per-tick calculation
5984  if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x400) && GetSpellInfo()->SpellIconID == 544)
5985  {
5986  uint32 totalTick = GetTotalTicks();
5987  // 1..4 ticks, 1/2 from normal tick damage
5988  if (m_tickNumber <= totalTick / 3)
5989  damage = damage/2;
5990  // 9..12 ticks, 3/2 from normal tick damage
5991  else if (m_tickNumber > totalTick * 2 / 3)
5992  damage += (damage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
5993  // 5..8 ticks have normal tick damage
5994  }
5995  // There is a Chance to make a Soul Shard when Drain soul does damage
5997  {
5998  if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
5999  caster->CastSpell(caster, 95810, true, 0, this);
6000  }
6001  if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
6002  {
6003  switch (GetId())
6004  {
6005  case 70911: // Unbound Plague
6006  case 72854: // Unbound Plague
6007  case 72855: // Unbound Plague
6008  case 72856: // Unbound Plague
6009  damage *= uint32(pow(1.25f, int32(m_tickNumber)));
6010  break;
6011  default:
6012  break;
6013  }
6014  }
6015  }
6016  else
6017  damage = uint32(target->CountPctFromMaxHealth(damage));
6018 
6020  if (GetSpellEffectInfo()->IsTargetingArea() || isAreaAura)
6021  {
6023  if (caster->GetTypeId() != TYPEID_PLAYER)
6025  }
6026 
6027  bool crit = false;
6028 
6029  if (CanPeriodicTickCrit(caster))
6030  crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance);
6031 
6032  if (crit)
6033  damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
6034 
6035  int32 dmg = damage;
6036 
6037  if (!(GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
6038  caster->ApplyResilience(target, &dmg);
6039  damage = dmg;
6040 
6041  caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
6042 
6043  TC_LOG_DEBUG("spells.periodic", "PeriodicTick: %s attacked %s for %u dmg inflicted by %u absorb is %u",
6044  GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb);
6045 
6046  caster->DealDamageMods(target, damage, &absorb);
6047 
6048  // Set trigger flag
6049  uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6050  uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6052  damage = (damage <= absorb+resist) ? 0 : (damage-absorb-resist);
6053  if (damage)
6054  procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6055 
6056  int32 overkill = damage - target->GetHealth();
6057  if (overkill < 0)
6058  overkill = 0;
6059 
6060  SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
6061 
6062  caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
6063  caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
6064  target->SendPeriodicAuraLog(&pInfo);
6065 }
Definition: SpellMgr.h:200
Definition: SpellAuraDefines.h:63
Definition: DBCEnums.h:404
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
int32 GetTotalTicks() const
Definition: SpellAuraEffects.h:84
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
void ApplyResilience(Unit const *victim, int32 *damage) const
Definition: Unit.cpp:14521
Definition: SharedDefines.h:29
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:4871
Definition: SpellMgr.h:221
uint32 GetId() const
Definition: SpellAuraEffects.h:47
flag128 SpellFamilyFlags
Definition: SpellInfo.h:397
uint32 SchoolMask
Definition: SpellInfo.h:401
uint32 mitigated_damage
Definition: Unit.h:913
Definition: SpellAuraDefines.h:370
Definition: Unit.h:664
Definition: SharedDefines.h:2021
uint32 CalcArmorReducedDamage(Unit *victim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK)
Definition: Unit.cpp:1475
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 SpellCriticalDamageBonus(SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition: Unit.cpp:8837
float GetUnitSpellCriticalChance(Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
Definition: Unit.cpp:8648
Definition: SharedDefines.h:4628
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:289
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Player * ToPlayer()
Definition: Object.h:191
Definition: SpellMgr.h:138
Definition: SpellMgr.h:139
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8212
int32 m_damage
Definition: SpellAuraEffects.h:116
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:9214
Definition: Unit.h:885
TypeID GetTypeId() const
Definition: Object.h:113
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
Definition: Unit.cpp:2477
string ToString(int i)
Definition: strutil.h:491
bool roll_chance_f(float chance)
Definition: Random.h:47
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: SpellMgr.h:141
bool IsFullHealth() const
Definition: Unit.h:1429
bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=NULL, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition: Unit.cpp:1452
bool IsAlive() const
Definition: Unit.h:1692
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
float m_critChance
Definition: SpellAuraEffects.h:117
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1430
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8493
Definition: SpellInfo.h:238
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
bool IsAreaAuraEffect() const
Definition: SpellInfo.cpp:424
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:4470
void CalcAbsorbResist(Unit *victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo=NULL)
Definition: Unit.cpp:1608
Definition: SpellMgr.h:199
bool IsTargetingArea() const
Definition: SpellInfo.cpp:419
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
G3D::Quat pow(const G3D::Quat &q, double x)
Definition: Quat.h:761
void DealDamageMods(Unit *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:603
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:1061
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:4623
void ProcDamageAndSpell(Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpell=NULL, SpellInfo const *procAura=NULL)
Definition: Unit.cpp:4860
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2131
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
int32_t int32
Definition: g3dmath.h:167
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
#define sScriptMgr
Definition: ScriptMgr.h:837
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:508
Definition: SharedDefines.h:1037
Definition: Unit.h:907
uint32 GetHealth() const
Definition: Unit.h:1426
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
bool CanPeriodicTickCrit(Unit const *caster) const
Definition: SpellAuraEffects.cpp:1140
Definition: Unit.h:563
std::string ToString() const
Definition: ObjectGuid.cpp:99
uint32 DealDamage(Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
Definition: Unit.cpp:613
float SpellDamagePctDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
Definition: Unit.cpp:8301
Definition: Unit.h:617
bool IsEffect() const
Definition: SpellInfo.cpp:399
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1435

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicDummyAuraTick ( Unit target,
Unit caster 
) const
5481 {
5482  switch (GetSpellInfo()->SpellFamilyName)
5483  {
5484  case SPELLFAMILY_GENERIC:
5485  switch (GetId())
5486  {
5487  case 66149: // Bullet Controller Periodic - 10 Man
5488  case 68396: // Bullet Controller Periodic - 25 Man
5489  {
5490  if (!caster)
5491  break;
5492 
5493  caster->CastCustomSpell(66152, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true);
5494  caster->CastCustomSpell(66153, SPELLVALUE_MAX_TARGETS, urand(1, 6), target, true);
5495  break;
5496  }
5497  case 62292: // Blaze (Pool of Tar)
5498  // should we use custom damage?
5499  target->CastSpell((Unit*)NULL, GetSpellEffectInfo()->TriggerSpell, true);
5500  break;
5501  case 62399: // Overload Circuit
5502  if (target->GetMap()->IsDungeon() && int(target->GetAppliedAuras().count(62399)) >= (target->GetMap()->IsHeroic() ? 4 : 2))
5503  {
5504  target->CastSpell(target, 62475, true); // System Shutdown
5505  if (Unit* veh = target->GetVehicleBase())
5506  veh->CastSpell(target, 62475, true);
5507  }
5508  break;
5509  case 64821: // Fuse Armor (Razorscale)
5510  if (GetBase()->GetStackAmount() == GetSpellInfo()->StackAmount)
5511  {
5512  target->CastSpell(target, 64774, true, NULL, NULL, GetCasterGUID());
5513  target->RemoveAura(64821);
5514  }
5515  break;
5516  }
5517  break;
5518  case SPELLFAMILY_MAGE:
5519  {
5520  // Mirror Image
5521  if (GetId() == 55342)
5522  // Set name of summons to name of caster
5523  target->CastSpell((Unit*)NULL, GetSpellEffectInfo()->TriggerSpell, true);
5524  break;
5525  }
5526  case SPELLFAMILY_DRUID:
5527  {
5528  switch (GetSpellInfo()->Id)
5529  {
5530  // Frenzied Regeneration
5531  case 22842:
5532  {
5533  // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
5534  // Should be manauser
5535  if (target->getPowerType() != POWER_RAGE)
5536  break;
5537  uint32 rage = target->GetPower(POWER_RAGE);
5538  // Nothing todo
5539  if (rage == 0)
5540  break;
5541  int32 mod = (rage < 100) ? rage : 100;
5542  int32 points = target->CalculateSpellDamage(target, GetSpellInfo(), 1);
5543  int32 regen = target->GetMaxHealth() * (mod * points / 10) / 1000;
5544  target->CastCustomSpell(target, 22845, &regen, nullptr, nullptr, true, nullptr, this);
5545  target->SetPower(POWER_RAGE, rage-mod);
5546  break;
5547  }
5548  }
5549  break;
5550  }
5551  case SPELLFAMILY_HUNTER:
5552  {
5553  // Explosive Shot
5554  if (GetSpellInfo()->SpellFamilyFlags[1] & 0x80000000)
5555  {
5556  if (caster)
5557  caster->CastCustomSpell(53352, SPELLVALUE_BASE_POINT0, m_amount, target, true, NULL, this);
5558  break;
5559  }
5560  switch (GetSpellInfo()->Id)
5561  {
5562  // Feeding Frenzy Rank 1
5563  case 53511:
5564  if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35))
5565  target->CastSpell(target, 60096, true, nullptr, this);
5566  return;
5567  // Feeding Frenzy Rank 2
5568  case 53512:
5569  if (target->GetVictim() && target->EnsureVictim()->HealthBelowPct(35))
5570  target->CastSpell(target, 60097, true, nullptr, this);
5571  return;
5572  default:
5573  break;
5574  }
5575  break;
5576  }
5577  case SPELLFAMILY_SHAMAN:
5578  if (GetId() == 52179) // Astral Shift
5579  {
5580  // Periodic need for remove visual on stun/fear/silence lost
5582  target->RemoveAurasDueToSpell(52179);
5583  break;
5584  }
5585  break;
5587  switch (GetId())
5588  {
5589  case 49016: // Hysteria
5590  uint32 damage = uint32(target->CountPctFromMaxHealth(1));
5591  target->DealDamage(target, damage, NULL, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
5592  break;
5593  }
5594  // Blood of the North
5595  // Reaping
5596  // Death Rune Mastery
5597  if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
5598  {
5599  if (target->GetTypeId() != TYPEID_PLAYER)
5600  return;
5601  if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
5602  return;
5603 
5604  // timer expired - remove death runes
5605  target->ToPlayer()->RemoveRunesByAuraEffect(this);
5606  }
5607  break;
5608  default:
5609  break;
5610  }
5611 }
Unit * GetVehicleBase() const
Definition: Unit.cpp:14341
Unit * EnsureVictim() const
Definition: Unit.h:1381
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
uint32 GetMaxHealth() const
Definition: Unit.h:1427
Definition: Unit.h:686
Definition: SharedDefines.h:172
Map * GetMap() const
Definition: Object.h:543
Definition: Unit.h:163
uint32 GetId() const
Definition: SpellAuraEffects.h:47
int32 m_amount
Definition: SpellAuraEffects.h:115
Definition: SharedDefines.h:4638
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:249
bool IsDungeon() const
Definition: Map.h:395
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3442
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
Definition: Unit.h:696
Definition: SharedDefines.h:4632
Player * ToPlayer()
Definition: Object.h:191
Powers getPowerType() const
Definition: Unit.h:1444
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SharedDefines.h:4626
Definition: Unit.h:666
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1789
Definition: SharedDefines.h:288
bool IsHeroic() const
Definition: Map.cpp:3420
Definition: SharedDefines.h:4634
Unit * GetVictim() const
Definition: Unit.h:1379
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1430
int32_t int32
Definition: Define.h:146
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr, float *variance=nullptr, int32 itemLevel=-1) const
Definition: Unit.cpp:10930
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:4630
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
void SetPower(Powers power, int32 val)
Definition: Unit.cpp:11607
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:4623
Definition: UpdateFields.h:109
Definition: Unit.h:691
uint32_t uint32
Definition: g3dmath.h:168
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
uint32 DealDamage(Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
Definition: Unit.cpp:613
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
Definition: Unit.h:129
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1435

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicEnergizeAuraTick ( Unit target,
Unit caster 
) const
6392 {
6393  Powers powerType = Powers(GetMiscValue());
6394 
6396  return;
6397 
6398  if (!target->IsAlive() || !target->GetMaxPower(powerType))
6399  return;
6400 
6401  if (target->HasUnitState(UNIT_STATE_ISOLATED))
6402  {
6403  SendTickImmune(target, caster);
6404  return;
6405  }
6406 
6407  // don't regen when permanent aura target has full power
6408  if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
6409  return;
6410 
6411  // ignore negative values (can be result apply spellmods to aura damage
6412  int32 amount = std::max(m_amount, 0);
6413 
6414  SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
6415 
6416  TC_LOG_DEBUG("spells.periodic", "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
6417  GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId());
6418 
6419  int32 gain = target->ModifyPower(powerType, amount);
6420  target->SendPeriodicAuraLog(&pInfo);
6421 
6422  if (caster)
6423  target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
6424 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=NULL)
Definition: HostileRefManager.cpp:35
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:4871
uint32 GetId() const
Definition: SpellAuraEffects.h:47
int32 m_amount
Definition: SpellAuraEffects.h:115
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Powers getPowerType() const
Definition: Unit.h:1444
TypeID GetTypeId() const
Definition: Object.h:113
Powers
Definition: SharedDefines.h:246
string ToString(int i)
Definition: strutil.h:491
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
bool IsAlive() const
Definition: Unit.h:1692
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32_t int32
Definition: Define.h:146
Definition: SharedDefines.h:624
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:1061
Definition: ObjectGuid.h:33
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
Definition: Unit.h:563
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicHealAurasTick ( Unit target,
Unit caster 
) const
6208 {
6209  if (!caster || !target->IsAlive())
6210  return;
6211 
6212  if (target->HasUnitState(UNIT_STATE_ISOLATED))
6213  {
6214  SendTickImmune(target, caster);
6215  return;
6216  }
6217 
6218  // heal for caster damage (must be alive)
6219  if (target != caster && GetSpellInfo()->AttributesEx2 & SPELL_ATTR2_HEALTH_FUNNEL && !caster->IsAlive())
6220  return;
6221 
6222  // don't regen when permanent aura target has full power
6223  if (GetBase()->IsPermanent() && target->IsFullHealth())
6224  return;
6225 
6227  // ignore negative values (can be result apply spellmods to aura damage
6228  int32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage;
6229 
6231  {
6232  // Taken mods
6233  float TakenTotalMod = 1.0f;
6234 
6235  // Tenacity increase healing % taken
6236  if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
6237  AddPct(TakenTotalMod, Tenacity->GetAmount());
6238 
6239  // Healing taken percent
6240  float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6241  if (minval)
6242  AddPct(TakenTotalMod, minval);
6243 
6244  float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
6245  if (maxval)
6246  AddPct(TakenTotalMod, maxval);
6247 
6248  TakenTotalMod = std::max(TakenTotalMod, 0.0f);
6249 
6250  damage = uint32(target->CountPctFromMaxHealth(damage));
6251  damage = uint32(damage * TakenTotalMod);
6252  }
6253  else
6254  {
6255  // Wild Growth = amount + (6 - 2*doneTicks) * ticks* amount / 100
6257  {
6258  int32 addition = int32(float(damage * GetTotalTicks()) * ((6-float(2*(GetTickNumber()-1)))/100));
6259 
6260  // Item - Druid T10 Restoration 2P Bonus
6261  if (AuraEffect* aurEff = caster->GetAuraEffect(70658, 0))
6262  // divided by 50 instead of 100 because calculated as for every 2 tick
6263  addition += abs(int32((addition * aurEff->GetAmount()) / 50));
6264 
6265  damage += addition;
6266  }
6267  if (isAreaAura)
6268  damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()) * caster->SpellHealingPctDone(target, m_spellInfo);
6269  damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount());
6270  }
6271 
6272  bool crit = false;
6273 
6274  if (CanPeriodicTickCrit(caster))
6275  crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance);
6276 
6277  if (crit)
6278  damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target);
6279 
6280  TC_LOG_DEBUG("spells.periodic", "PeriodicTick: %s heal of %s for %u health inflicted by %u",
6281  GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId());
6282 
6283  uint32 absorb = 0;
6284  uint32 heal = uint32(damage);
6285  caster->CalcHealAbsorb(target, GetSpellInfo(), heal, absorb);
6286  int32 gain = caster->DealHeal(target, heal);
6287 
6288  SpellPeriodicAuraLogInfo pInfo(this, heal, heal - gain, absorb, 0, 0.0f, crit);
6289  target->SendPeriodicAuraLog(&pInfo);
6290 
6291  target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
6292 
6293  uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6294  uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6296  // ignore item heals
6297  if (GetBase()->GetCastItemGUID().IsEmpty())
6298  caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
6299 }
Definition: SpellMgr.h:200
Definition: SpellAuraEffects.h:30
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
int32 GetTotalTicks() const
Definition: SpellAuraEffects.h:84
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=NULL)
Definition: HostileRefManager.cpp:35
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
uint32 GetTickNumber() const
Definition: SpellAuraEffects.h:83
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
float SpellHealingPctDone(Unit *victim, SpellInfo const *spellProto) const
Definition: Unit.cpp:9001
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:4871
uint32 GetId() const
Definition: SpellAuraEffects.h:47
bool IsPermanent() const
Definition: SpellAuras.h:168
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:133
Definition: SpellAuraDefines.h:80
uint32 SpellCriticalHealingBonus(SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition: Unit.cpp:8874
Definition: Unit.h:664
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition: Unit.cpp:4440
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
float GetUnitSpellCriticalChance(Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
Definition: Unit.cpp:8648
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Definition: SpellMgr.h:138
Definition: SharedDefines.h:439
Definition: SpellMgr.h:139
int32 m_damage
Definition: SpellAuraEffects.h:116
Definition: SpellMgr.h:222
string ToString(int i)
Definition: strutil.h:491
bool roll_chance_f(float chance)
Definition: Random.h:47
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
uint32 SpellFamilyName
Definition: SpellInfo.h:396
bool IsFullHealth() const
Definition: Unit.h:1429
bool IsAlive() const
Definition: Unit.h:1692
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:9073
float m_critChance
Definition: SpellAuraEffects.h:117
int32 DealHeal(Unit *victim, uint32 addhealth)
Definition: Unit.cpp:7885
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
bool IsAreaAuraEffect() const
Definition: SpellInfo.cpp:424
Definition: SharedDefines.h:4630
Definition: SpellMgr.h:199
int32 GetMaxPositiveAuraModifier(AuraType auratype) const
Definition: Unit.cpp:4426
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:1061
void ProcDamageAndSpell(Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpell=NULL, SpellInfo const *procAura=NULL)
Definition: Unit.cpp:4860
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2131
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
T AddPct(T &base, U pct)
Definition: Util.h:98
int32_t int32
Definition: g3dmath.h:167
uint32 SpellIconID
Definition: SpellInfo.h:390
void CalcHealAbsorb(Unit *victim, SpellInfo const *spellInfo, uint32 &healAmount, uint32 &absorb)
Definition: Unit.cpp:1812
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4071
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:1037
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8886
Definition: SpellAuraDefines.h:178
bool CanPeriodicTickCrit(Unit const *caster) const
Definition: SpellAuraEffects.cpp:1140
Definition: Unit.h:563
std::string ToString() const
Definition: ObjectGuid.cpp:99
bool IsEmpty() const
Definition: ObjectGuid.h:242
Definition: Unit.h:617
bool IsEffect() const
Definition: SpellInfo.cpp:399
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1435

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicHealthFunnelAuraTick ( Unit target,
Unit caster 
) const
6180 {
6181  if (!caster || !caster->IsAlive() || !target->IsAlive())
6182  return;
6183 
6184  if (target->HasUnitState(UNIT_STATE_ISOLATED))
6185  {
6186  SendTickImmune(target, caster);
6187  return;
6188  }
6189 
6190  uint32 damage = std::max(GetAmount(), 0);
6191  // do not kill health donator
6192  if (caster->GetHealth() < damage)
6193  damage = caster->GetHealth() - 1;
6194  if (!damage)
6195  return;
6196 
6197  caster->ModifyHealth(-(int32)damage);
6198  TC_LOG_DEBUG("spells", "PeriodicTick: donator %u target %u damage %u.", caster->GetEntry(), target->GetEntry(), damage);
6199 
6200  float gainMultiplier = GetSpellEffectInfo()->CalcValueMultiplier(caster);
6201 
6202  damage = int32(damage * gainMultiplier);
6203 
6204  caster->HealBySpell(target, GetSpellInfo(), damage);
6205 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
int32 HealBySpell(Unit *victim, SpellInfo const *spellInfo, uint32 addHealth, bool critical=false)
Definition: Unit.cpp:8179
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:10216
float CalcValueMultiplier(Unit *caster, Spell *spell=NULL) const
Definition: SpellInfo.cpp:629
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
T max(const T &x, const T &y)
Definition: g3dmath.h:320
bool IsAlive() const
Definition: Unit.h:1692
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
int32_t int32
Definition: g3dmath.h:167
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint32 GetEntry() const
Definition: Object.h:107
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Unit.h:563

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicHealthLeechAuraTick ( Unit target,
Unit caster 
) const
6080 {
6081  if (!caster || !target->IsAlive())
6082  return;
6083 
6085  {
6086  SendTickImmune(target, caster);
6087  return;
6088  }
6089 
6091  caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6092  return;
6093 
6094  uint32 absorb = 0;
6095  uint32 resist = 0;
6096  CleanDamage cleanDamage = CleanDamage(0, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
6097 
6099  // ignore negative values (can be result apply spellmods to aura damage
6100  uint32 damage = isAreaAura ? std::max(GetAmount(), 0) : m_damage;
6101 
6102  if (isAreaAura)
6103  {
6104  // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
6105  sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
6106  damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()) * caster->SpellDamagePctDone(target, m_spellInfo, DOT);
6107  }
6108  damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount());
6109 
6110  // Calculate armor mitigation
6111  if (caster->IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), GetEffIndex()))
6112  {
6113  uint32 damageReductedArmor = caster->CalcArmorReducedDamage(target, damage, GetSpellInfo());
6114  cleanDamage.mitigated_damage += damage - damageReductedArmor;
6115  damage = damageReductedArmor;
6116  }
6117 
6119  if (GetSpellEffectInfo()->IsTargetingArea() || isAreaAura)
6120  {
6122  if (caster->GetTypeId() != TYPEID_PLAYER)
6124  }
6125 
6126  bool crit = false;
6127 
6128  if (CanPeriodicTickCrit(caster))
6129  crit = roll_chance_f(isAreaAura ? caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()) : m_critChance);
6130 
6131  if (crit)
6132  damage = caster->SpellCriticalDamageBonus(m_spellInfo, damage, target);
6133 
6134  int32 dmg = damage;
6135  if (!(GetSpellInfo()->AttributesEx4 & SPELL_ATTR4_FIXED_DAMAGE))
6136  caster->ApplyResilience(target, &dmg);
6137  damage = dmg;
6138 
6139  caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, m_spellInfo);
6140 
6141  if (target->GetHealth() < damage)
6142  damage = uint32(target->GetHealth());
6143 
6144  TC_LOG_DEBUG("spells.periodic", "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u",
6145  GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb);
6146 
6147  SpellNonMeleeDamage log(caster, target, GetId(), GetSpellInfo()->GetSchoolMask());
6148  log.damage = damage - absorb - resist;
6149  log.absorb = absorb;
6150  log.resist = resist;
6151  log.periodicLog = true;
6152  if (crit)
6153  log.HitInfo |= SPELL_HIT_TYPE_CRIT;
6154 
6155  // Set trigger flag
6156  uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6157  uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6159  damage = (damage <= absorb+resist) ? 0 : (damage-absorb-resist);
6160  if (damage)
6161  procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6162  if (caster->IsAlive())
6163  caster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo());
6164  int32 new_damage = caster->DealDamage(target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
6165  if (caster->IsAlive())
6166  {
6167  float gainMultiplier = GetSpellEffectInfo()->CalcValueMultiplier(caster);
6168 
6169  uint32 heal = uint32(caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()));
6170  heal = uint32(caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT, GetSpellEffectInfo(), GetBase()->GetStackAmount()));
6171 
6172  int32 gain = caster->HealBySpell(caster, GetSpellInfo(), heal);
6173  caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
6174  }
6175 
6176  caster->SendSpellNonMeleeDamageLog(&log);
6177 }
Definition: SpellMgr.h:200
Definition: SharedDefines.h:2038
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=NULL)
Definition: HostileRefManager.cpp:35
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
void ApplyResilience(Unit const *victim, int32 *damage) const
Definition: Unit.cpp:14521
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
int32 HealBySpell(Unit *victim, SpellInfo const *spellInfo, uint32 addHealth, bool critical=false)
Definition: Unit.cpp:8179
Definition: SpellMgr.h:221
uint32 GetId() const
Definition: SpellAuraEffects.h:47
uint32 SchoolMask
Definition: SpellInfo.h:401
TC_SHARED_API::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,::google::protobuf::internal::EnumTypeTraits< ::bgs::protocol::LogOption,::bgs::protocol::LogOption_IsValid >, 14, false > log
uint32 mitigated_damage
Definition: Unit.h:913
Definition: SpellAuraDefines.h:370
Definition: Unit.h:664
Definition: SharedDefines.h:2021
uint32 CalcArmorReducedDamage(Unit *victim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK)
Definition: Unit.cpp:1475
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
float CalcValueMultiplier(Unit *caster, Spell *spell=NULL) const
Definition: SpellInfo.cpp:629
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 SpellCriticalDamageBonus(SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition: Unit.cpp:8837
float GetUnitSpellCriticalChance(Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
Definition: Unit.cpp:8648
Definition: SpellAuraDefines.h:289
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Definition: SpellMgr.h:138
Definition: SpellMgr.h:139
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8212
int32 m_damage
Definition: SpellAuraEffects.h:116
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:9214
Definition: Unit.h:885
TypeID GetTypeId() const
Definition: Object.h:113
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
Definition: Unit.cpp:2477
Definition: Unit.h:1042
string ToString(int i)
Definition: strutil.h:491
bool roll_chance_f(float chance)
Definition: Random.h:47
HostileRefManager & getHostileRefManager()
Definition: Unit.h:2001
Definition: SpellMgr.h:141
bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=NULL, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition: Unit.cpp:1452
bool IsAlive() const
Definition: Unit.h:1692
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:9073
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
float m_critChance
Definition: SpellAuraEffects.h:117
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8493
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
bool IsAreaAuraEffect() const
Definition: SpellInfo.cpp:424
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:4470
void CalcAbsorbResist(Unit *victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo=NULL)
Definition: Unit.cpp:1608
Definition: SpellMgr.h:199
bool IsTargetingArea() const
Definition: SpellInfo.cpp:419
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:4839
void ProcDamageAndSpell(Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpell=NULL, SpellInfo const *procAura=NULL)
Definition: Unit.cpp:4860
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2131
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
int32_t int32
Definition: g3dmath.h:167
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
#define sScriptMgr
Definition: ScriptMgr.h:837
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:508
Definition: SharedDefines.h:1037
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8886
Definition: Unit.h:907
uint32 GetHealth() const
Definition: Unit.h:1426
bool CanPeriodicTickCrit(Unit const *caster) const
Definition: SpellAuraEffects.cpp:1140
Definition: Unit.h:563
std::string ToString() const
Definition: ObjectGuid.cpp:99
uint32 DealDamage(Unit *victim, uint32 damage, CleanDamage const *cleanDamage=NULL, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=NULL, bool durabilityLoss=true)
Definition: Unit.cpp:613
float SpellDamagePctDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
Definition: Unit.cpp:8301
Definition: Unit.h:617
bool IsEffect() const
Definition: SpellInfo.cpp:399

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicManaLeechAuraTick ( Unit target,
Unit caster 
) const
6302 {
6303  Powers powerType = Powers(GetMiscValue());
6304 
6305  if (!caster || !caster->IsAlive() || !target->IsAlive() || target->getPowerType() != powerType)
6306  return;
6307 
6309  {
6310  SendTickImmune(target, caster);
6311  return;
6312  }
6313 
6315  caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
6316  return;
6317 
6318  // ignore negative values (can be result apply spellmods to aura damage
6319  int32 drainAmount = std::max(m_amount, 0);
6320 
6321  TC_LOG_DEBUG("spells.periodic", "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u",
6322  GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), drainAmount, GetId());
6323 
6324  int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
6325 
6326  float gainMultiplier = GetSpellEffectInfo()->CalcValueMultiplier(caster);
6327 
6328  SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
6329 
6330  int32 gainAmount = int32(drainedAmount * gainMultiplier);
6331  int32 gainedAmount = 0;
6332  if (gainAmount)
6333  {
6334  gainedAmount = caster->ModifyPower(powerType, gainAmount);
6335  target->AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo()->GetSchoolMask(), GetSpellInfo());
6336  }
6337 
6338  // Drain Mana
6340  && m_spellInfo->SpellFamilyFlags[0] & 0x00000010)
6341  {
6342  int32 manaFeedVal = 0;
6343  if (AuraEffect const* aurEff = GetBase()->GetEffect(1))
6344  manaFeedVal = aurEff->GetAmount();
6345  // Mana Feed - Drain Mana
6346  if (manaFeedVal > 0)
6347  {
6348  int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
6349  caster->CastCustomSpell(caster, 32554, &feedAmount, NULL, NULL, true, NULL, this);
6350  }
6351  }
6352 
6353  target->SendPeriodicAuraLog(&pInfo);
6354 }
Definition: SpellAuraEffects.h:30
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:4871
uint32 GetId() const
Definition: SpellAuraEffects.h:47
int32 m_amount
Definition: SpellAuraEffects.h:115
flag128 SpellFamilyFlags
Definition: SpellInfo.h:397
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:2021
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
float CalcValueMultiplier(Unit *caster, Spell *spell=NULL) const
Definition: SpellInfo.cpp:629
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: SharedDefines.h:4628
T max(const T &x, const T &y)
Definition: g3dmath.h:320
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:9214
Powers getPowerType() const
Definition: Unit.h:1444
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false)
Definition: Unit.cpp:2477
Powers
Definition: SharedDefines.h:246
string ToString(int i)
Definition: strutil.h:491
uint32 SpellFamilyName
Definition: SpellInfo.h:396
bool IsAlive() const
Definition: Unit.h:1692
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32_t int32
Definition: Define.h:146
T CalculatePct(T base, U pct)
Definition: Util.h:92
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:1061
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
int32_t int32
Definition: g3dmath.h:167
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
Definition: SharedDefines.h:1037
Definition: Unit.h:563
std::string ToString() const
Definition: ObjectGuid.cpp:99
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicPowerBurnAuraTick ( Unit target,
Unit caster 
) const
6427 {
6428  Powers powerType = Powers(GetMiscValue());
6429 
6430  if (!caster || !target->IsAlive() || target->getPowerType() != powerType)
6431  return;
6432 
6434  {
6435  SendTickImmune(target, caster);
6436  return;
6437  }
6438 
6439  // ignore negative values (can be result apply spellmods to aura damage
6440  int32 damage = std::max(m_amount, 0);
6441 
6442  uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
6443 
6444  float dmgMultiplier = GetSpellEffectInfo()->CalcValueMultiplier(caster);
6445 
6446  SpellInfo const* spellProto = GetSpellInfo();
6447  // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6448  SpellNonMeleeDamage damageInfo(caster, target, spellProto->Id, spellProto->SchoolMask);
6449  // no SpellDamageBonus for burn mana
6450  caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
6451 
6452  caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6453 
6454  // Set trigger flag
6455  uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
6456  uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
6458  if (damageInfo.damage)
6459  procVictim |= PROC_FLAG_TAKEN_DAMAGE;
6460 
6461  caster->ProcDamageAndSpell(damageInfo.target, procAttacker, procVictim, procEx, damageInfo.damage, BASE_ATTACK, spellProto);
6462 
6463  caster->DealSpellDamage(&damageInfo, true);
6464  caster->SendSpellNonMeleeDamageLog(&damageInfo);
6465 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition: Unit.cpp:988
Definition: SpellInfo.h:326
Definition: SpellMgr.h:221
int32 m_amount
Definition: SpellAuraEffects.h:115
uint32 SchoolMask
Definition: SpellInfo.h:401
Definition: SharedDefines.h:2021
float CalcValueMultiplier(Unit *caster, Spell *spell=NULL) const
Definition: SpellInfo.cpp:629
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Definition: SpellMgr.h:138
uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition: Unit.cpp:12194
Definition: SpellMgr.h:139
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:9214
Powers getPowerType() const
Definition: Unit.h:1444
Powers
Definition: SharedDefines.h:246
Definition: Unit.h:1042
Definition: SpellMgr.h:141
bool IsAlive() const
Definition: Unit.h:1692
void SendTickImmune(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:1161
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1094
void DealDamageMods(Unit *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:603
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:4839
void ProcDamageAndSpell(Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpell=NULL, SpellInfo const *procAura=NULL)
Definition: Unit.cpp:4860
int32_t int32
Definition: g3dmath.h:167
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint32_t uint32
Definition: g3dmath.h:168
Definition: Unit.h:563
Definition: Unit.h:617

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicTriggerSpellAuraTick ( Unit target,
Unit caster 
) const
Todo:
effect trigger spell may be independant on spell targets, and executed in spell finish phase
5614 {
5615  // generic casting code with custom spells and target/caster customs
5616  uint32 triggerSpellId = GetSpellEffectInfo()->TriggerSpell;
5617 
5618  SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
5619  SpellInfo const* auraSpellInfo = GetSpellInfo();
5620  uint32 auraId = auraSpellInfo->Id;
5621 
5622  // specific code for cases with no trigger spell provided in field
5623  if (triggeredSpellInfo == NULL)
5624  {
5625  switch (auraSpellInfo->SpellFamilyName)
5626  {
5627  case SPELLFAMILY_GENERIC:
5628  {
5629  switch (auraId)
5630  {
5631  // Brood Affliction: Bronze
5632  case 23170:
5633  triggerSpellId = 23171;
5634  break;
5635  // Restoration
5636  case 24379:
5637  case 23493:
5638  {
5639  if (caster)
5640  {
5641  int32 heal = caster->CountPctFromMaxHealth(10);
5642  caster->HealBySpell(target, auraSpellInfo, heal);
5643 
5644  if (int32 mana = caster->GetMaxPower(POWER_MANA))
5645  {
5646  mana /= 10;
5647  caster->EnergizeBySpell(caster, 23493, mana, POWER_MANA);
5648  }
5649  }
5650  return;
5651  }
5652  // Nitrous Boost
5653  case 27746:
5654  if (caster && target->GetPower(POWER_MANA) >= 10)
5655  {
5656  target->ModifyPower(POWER_MANA, -10);
5657  target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
5658  }
5659  else
5660  target->RemoveAurasDueToSpell(27746);
5661  return;
5662  // Frost Blast
5663  case 27808:
5664  if (caster)
5665  caster->CastCustomSpell(29879, SPELLVALUE_BASE_POINT0, int32(target->CountPctFromMaxHealth(21)), target, true, NULL, this);
5666  return;
5667  // Inoculate Nestlewood Owlkin
5668  case 29528:
5669  if (target->GetTypeId() != TYPEID_UNIT) // prevent error reports in case ignored player target
5670  return;
5671  break;
5672  // Feed Captured Animal
5673  case 29917:
5674  triggerSpellId = 29916;
5675  break;
5676  // Extract Gas
5677  case 30427:
5678  {
5679  // move loot to player inventory and despawn target
5680  if (caster && caster->GetTypeId() == TYPEID_PLAYER &&
5681  target->GetTypeId() == TYPEID_UNIT &&
5683  {
5684  Player* player = caster->ToPlayer();
5685  Creature* creature = target->ToCreature();
5686  // missing lootid has been reported on startup - just return
5687  if (!creature->GetCreatureTemplate()->SkinLootId)
5688  return;
5689 
5690  player->AutoStoreLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, true);
5691 
5692  creature->DespawnOrUnsummon();
5693  }
5694  return;
5695  }
5696  // Quake
5697  case 30576:
5698  triggerSpellId = 30571;
5699  break;
5700  // Doom
5702  // so instakill will be naturally done before trigger spell
5703  case 31347:
5704  {
5705  target->CastSpell(target, 31350, true, NULL, this);
5706  target->KillSelf();
5707  return;
5708  }
5709  // Spellcloth
5710  case 31373:
5711  {
5712  // Summon Elemental after create item
5713  target->SummonCreature(17870, 0, 0, 0, target->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);
5714  return;
5715  }
5716  // Flame Quills
5717  case 34229:
5718  {
5719  // cast 24 spells 34269-34289, 34314-34316
5720  for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id)
5721  target->CastSpell(target, spell_id, true, NULL, this);
5722  for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id)
5723  target->CastSpell(target, spell_id, true, NULL, this);
5724  return;
5725  }
5726  // Remote Toy
5727  case 37027:
5728  triggerSpellId = 37029;
5729  break;
5730  // Eye of Grillok
5731  case 38495:
5732  triggerSpellId = 38530;
5733  break;
5734  // Absorb Eye of Grillok (Zezzak's Shard)
5735  case 38554:
5736  {
5737  if (!caster || target->GetTypeId() != TYPEID_UNIT)
5738  return;
5739 
5740  caster->CastSpell(caster, 38495, true, NULL, this);
5741 
5742  Creature* creatureTarget = target->ToCreature();
5743 
5744  creatureTarget->DespawnOrUnsummon();
5745  return;
5746  }
5747  // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam
5748  case 39857:
5749  triggerSpellId = 39856;
5750  break;
5751  // Personalized Weather
5752  case 46736:
5753  triggerSpellId = 46737;
5754  break;
5755  }
5756  break;
5757  }
5758  case SPELLFAMILY_SHAMAN:
5759  {
5760  switch (auraId)
5761  {
5762  // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
5763  case 28820:
5764  {
5765  // Need remove self if Lightning Shield not active
5767  target->RemoveAurasDueToSpell(28820);
5768  return;
5769  }
5770  // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus)
5771  case 38443:
5772  {
5773  bool all = true;
5774  for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
5775  {
5776  if (!target->m_SummonSlot[i])
5777  {
5778  all = false;
5779  break;
5780  }
5781  }
5782 
5783  if (all)
5784  target->CastSpell(target, 38437, true, NULL, this);
5785  else
5786  target->RemoveAurasDueToSpell(38437);
5787  return;
5788  }
5789  }
5790  break;
5791  }
5792  default:
5793  break;
5794  }
5795  }
5796  else
5797  {
5798  // Spell exist but require custom code
5799  switch (auraId)
5800  {
5801  // Pursuing Spikes (Anub'arak)
5802  case 65920:
5803  case 65922:
5804  case 65923:
5805  {
5806  Unit* permafrostCaster = NULL;
5807  Aura* permafrostAura = target->GetAura(66193);
5808  if (!permafrostAura)
5809  permafrostAura = target->GetAura(67855);
5810  if (!permafrostAura)
5811  permafrostAura = target->GetAura(67856);
5812  if (!permafrostAura)
5813  permafrostAura = target->GetAura(67857);
5814 
5815  if (permafrostAura)
5816  permafrostCaster = permafrostAura->GetCaster();
5817 
5818  if (permafrostCaster)
5819  {
5820  if (Creature* permafrostCasterCreature = permafrostCaster->ToCreature())
5821  permafrostCasterCreature->DespawnOrUnsummon(3000);
5822 
5823  target->CastSpell(target, 66181, false);
5824  target->RemoveAllAuras();
5825  if (Creature* targetCreature = target->ToCreature())
5826  targetCreature->DisappearAndDie();
5827  }
5828  break;
5829  }
5830  // Mana Tide
5831  case 16191:
5832  target->CastCustomSpell(target, triggerSpellId, &m_amount, NULL, NULL, true, NULL, this);
5833  return;
5834  // Negative Energy Periodic
5835  case 46284:
5836  target->CastCustomSpell(triggerSpellId, SPELLVALUE_MAX_TARGETS, m_tickNumber / 10 + 1, NULL, true, NULL, this);
5837  return;
5838  // Slime Pool (Dreadscale & Acidmaw)
5839  case 66882:
5840  target->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, (int32)((((float)m_tickNumber / 60) * 0.9f + 0.1f) * 10000 * 2 / 3), NULL, true, NULL, this);
5841  return;
5842  // Slime Spray - temporary here until preventing default effect works again
5843  // added on 9.10.2010
5844  case 69508:
5845  {
5846  if (caster)
5847  caster->CastSpell(target, triggerSpellId, true, NULL, NULL, caster->GetGUID());
5848  return;
5849  }
5850  case 24745: // Summon Templar, Trigger
5851  case 24747: // Summon Templar Fire, Trigger
5852  case 24757: // Summon Templar Air, Trigger
5853  case 24759: // Summon Templar Earth, Trigger
5854  case 24761: // Summon Templar Water, Trigger
5855  case 24762: // Summon Duke, Trigger
5856  case 24766: // Summon Duke Fire, Trigger
5857  case 24769: // Summon Duke Air, Trigger
5858  case 24771: // Summon Duke Earth, Trigger
5859  case 24773: // Summon Duke Water, Trigger
5860  case 24785: // Summon Royal, Trigger
5861  case 24787: // Summon Royal Fire, Trigger
5862  case 24791: // Summon Royal Air, Trigger
5863  case 24792: // Summon Royal Earth, Trigger
5864  case 24793: // Summon Royal Water, Trigger
5865  {
5866  // All this spells trigger a spell that requires reagents; if the
5867  // triggered spell is cast as "triggered", reagents are not consumed
5868  if (caster)
5869  caster->CastSpell(target, triggerSpellId, false);
5870  return;
5871  }
5872  }
5873  }
5874 
5875  // Reget trigger spell proto
5876  triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId);
5877 
5878  if (triggeredSpellInfo)
5879  {
5880  if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, target->GetMap()->GetDifficultyID()) ? caster : target)
5881  {
5882  triggerCaster->CastSpell(target, triggeredSpellInfo, true, NULL, this);
5883  TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
5884  }
5885  }
5886  else
5887  {
5888  Creature* c = target->ToCreature();
5889  if (!c || !caster || !sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature()) ||
5890  !c->AI()->sOnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex())))
5891  TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
5892  }
5893 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
void RemoveAllAuras()
Definition: Unit.cpp:3920
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
uint32 SkinLootId
Definition: Creature.h:121
void KillSelf(bool durabilityLoss=true)
Definition: Unit.h:1515
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
int32 HealBySpell(Unit *victim, SpellInfo const *spellInfo, uint32 addHealth, bool critical=false)
Definition: Unit.cpp:8179
Map * GetMap() const
Definition: Object.h:543
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
Definition: Unit.h:163
Definition: SpellInfo.h:326
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id", true)
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4151
int32 m_amount
Definition: SpellAuraEffects.h:115
Difficulty GetDifficultyID() const
Definition: Map.h:390
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition: Unit.h:1929
Definition: ObjectGuid.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: Creature.h:467
void SendEnergizeSpellLog(Unit *victim, uint32 spellID, int32 damage, Powers powertype)
Definition: Unit.cpp:8190
Definition: Object.h:60
void EnergizeBySpell(Unit *victim, uint32 SpellID, int32 Damage, Powers powertype)
Definition: Unit.cpp:8202
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
bool all(float x)
Definition: g3dmath.h:431
Player * ToPlayer()
Definition: Object.h:191
Definition: Unit.h:162
TypeID GetTypeId() const
Definition: Object.h:113
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:558
uint32 TriggerSpell
Definition: SpellInfo.h:263
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
float GetOrientation() const
Definition: Position.h:107
virtual bool sOnDummyEffect(Unit *, uint32, SpellEffIndex)
Definition: UnitAI.h:259
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: SharedDefines.h:4634
#define SUMMON_SLOT_TOTEM
Definition: Unit.h:1281
Definition: Util.h:362
CreatureAI * AI() const
Definition: Creature.h:525
SpellEffIndex
Definition: SharedDefines.h:26
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:3566
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
Definition: SpellAuraDefines.h:102
Definition: SharedDefines.h:4623
Creature * ToCreature()
Definition: Object.h:194
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
int32_t int32
Definition: g3dmath.h:167
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4071
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
#define sScriptMgr
Definition: ScriptMgr.h:837
Definition: SpellAuras.h:116
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
uint32 type
Definition: Creature.h:116
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell, uint32 difficulty) const
Definition: SpellInfo.cpp:1363
Definition: Unit.h:129
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
#define MAX_TOTEM_SLOT
Definition: Unit.h:1282
Definition: SharedDefines.h:248
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1435

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick ( Unit target,
Unit caster 
) const
5896 {
5897  uint32 triggerSpellId = GetSpellEffectInfo()->TriggerSpell;
5898  if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5899  {
5900  if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, target->GetMap()->GetDifficultyID()) ? caster : target)
5901  {
5902  int32 basepoints = GetAmount();
5903  triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints, &basepoints, &basepoints, true, nullptr, this);
5904  TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
5905  }
5906  }
5907  else
5908  TC_LOG_DEBUG("spells","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
5909 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
Map * GetMap() const
Definition: Object.h:543
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Difficulty GetDifficultyID() const
Definition: Map.h:390
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 TriggerSpell
Definition: SpellInfo.h:263
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandlePhase ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1710 {
1711  if (!(mode & AURA_EFFECT_HANDLE_REAL))
1712  return;
1713 
1714  Unit* target = aurApp->GetTarget();
1715 
1716  std::set<uint32> const& oldPhases = target->GetPhases();
1717  target->SetInPhase(GetMiscValueB(), false, apply);
1718 
1719  // call functions which may have additional effects after chainging state of unit
1720  // phase auras normally not expected at BG but anyway better check
1721  if (apply)
1722  {
1723  // drop flag at invisibiliy in bg
1725  }
1726 
1727  if (Player* player = target->ToPlayer())
1728  {
1729  if (player->IsInWorld())
1730  player->GetMap()->SendUpdateTransportVisibility(player, oldPhases);
1731  player->SendUpdatePhasing();
1732  }
1733 
1734  // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1735  if (target->IsVisible())
1736  target->UpdateObjectVisibility();
1737 }
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
int32 GetMiscValueB() const
Definition: SpellAuraEffects.h:52
void apply(T *val)
Definition: ByteConverter.h:41
bool SetInPhase(uint32 id, bool update, bool apply) override
Definition: Unit.cpp:14578
Player * ToPlayer()
Definition: Object.h:191
Definition: SpellAuraDefines.h:39
bool IsVisible() const
Definition: Unit.cpp:10363
ObjectGuid GetTarget() const
Definition: Unit.h:2209
std::set< uint32 > const & GetPhases() const
Definition: Object.h:465
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandlePhaseGroup ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1740 {
1741  if (!(mode & AURA_EFFECT_HANDLE_REAL))
1742  return;
1743 
1744  Unit* target = aurApp->GetTarget();
1745 
1746  std::set<uint32> const& oldPhases = target->GetPhases();
1747  std::set<uint32> phases = sDB2Manager.GetPhasesForGroup(GetMiscValueB());
1748  for (auto phase : phases)
1749  target->SetInPhase(phase, false, apply);
1750 
1751  // call functions which may have additional effects after chainging state of unit
1752  // phase auras normally not expected at BG but anyway better check
1753  if (apply)
1754  {
1755  // drop flag at invisibiliy in bg
1757  }
1758 
1759  if (Player* player = target->ToPlayer())
1760  {
1761  if (player->IsInWorld())
1762  player->GetMap()->SendUpdateTransportVisibility(player, oldPhases);
1763  player->SendUpdatePhasing();
1764  }
1765 
1766  // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1767  if (target->IsVisible())
1768  target->UpdateObjectVisibility();
1769 }
#define sDB2Manager
Definition: DB2Stores.h:224
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition: Unit.cpp:3816
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:14630
int32 GetMiscValueB() const
Definition: SpellAuraEffects.h:52
void apply(T *val)
Definition: ByteConverter.h:41
bool SetInPhase(uint32 id, bool update, bool apply) override
Definition: Unit.cpp:14578
Player * ToPlayer()
Definition: Object.h:191
Definition: SpellAuraDefines.h:39
bool IsVisible() const
Definition: Unit.cpp:10363
ObjectGuid GetTarget() const
Definition: Unit.h:2209
std::set< uint32 > const & GetPhases() const
Definition: Object.h:465
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandlePreventFleeing ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const

TODO: find a way to cancel fleeing for assistance. Currently this will only stop creatures fleeing due to low health that could not find nearby allies to flee towards.

2921 {
2922  if (!(mode & AURA_EFFECT_HANDLE_REAL))
2923  return;
2924 
2925  Unit* target = aurApp->GetTarget();
2926 
2927  // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
2928  if (!apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
2929  return;
2932  target->SetControlled(false, UNIT_STATE_FLEEING);
2933 }
Definition: SpellAuraDefines.h:67
Definition: Unit.h:557
void apply(T *val)
Definition: ByteConverter.h:41
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:13808
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: Unit.h:1305

+ Here is the call graph for this function:

void AuraEffect::HandlePreventResurrection ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
5455 {
5456  if (!(mode & AURA_EFFECT_HANDLE_REAL))
5457  return;
5458 
5459  if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
5460  return;
5461 
5462  if (apply)
5463  aurApp->GetTarget()->RemoveFlag(PLAYER_FIELD_LOCAL_FLAGS, PLAYER_LOCAL_FLAG_RELEASE_TIMER);
5464  else if (!aurApp->GetTarget()->GetBaseMap()->Instanceable())
5465  aurApp->GetTarget()->SetFlag(PLAYER_FIELD_LOCAL_FLAGS, PLAYER_LOCAL_FLAG_RELEASE_TIMER);
5466 }
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SpellAuraDefines.h:39
Definition: UpdateFields.h:266
Definition: ObjectGuid.h:33
Definition: Player.h:560

+ Here is the call graph for this function:

void AuraEffect::HandleProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
1218 {
1219  bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1220  if (prevented)
1221  return;
1222 
1223  switch (GetAuraType())
1224  {
1226  HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1227  break;
1229  HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1230  break;
1232  HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1233  break;
1235  HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1236  break;
1238  HandleRaidProcFromChargeWithValueAuraProc(aurApp, eventInfo);
1239  break;
1242  break;
1243  default:
1244  break;
1245  }
1246 
1247  GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1248 }
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6498
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2306
Definition: SpellAuraDefines.h:285
Definition: SpellAuraDefines.h:388
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
Definition: SpellAuraDefines.h:283
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6467
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Definition: SpellAuraDefines.h:291
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6482
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2287
Definition: SpellAuraDefines.h:102
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6561
void HandleProcTriggerSpellOnPowerAmountAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6601
void HandleRaidProcFromChargeAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6512
Definition: SpellAuraDefines.h:103

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleProcTriggerDamageAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6499 {
6500  Unit* target = aurApp->GetTarget();
6501  Unit* triggerTarget = eventInfo.GetProcTarget();
6502  SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask);
6503  uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetSpellEffectInfo());
6504  damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE, GetSpellEffectInfo());
6505  target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
6506  target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6507  TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId());
6508  target->DealSpellDamage(&damageInfo, true);
6509  target->SendSpellNonMeleeDamageLog(&damageInfo);
6510 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
Definition: Unit.cpp:988
Unit * GetTarget() const
Definition: SpellAuras.h:74
uint32 GetId() const
Definition: SpellAuraEffects.h:47
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8212
Definition: Unit.h:1042
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8493
uint32_t uint32
Definition: Define.h:150
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1094
Unit * GetProcTarget() const
Definition: Unit.h:993
void DealDamageMods(Unit *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:603
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:4839
Definition: Unit.h:663
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleProcTriggerSpellAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6468 {
6469  Unit* triggerCaster = aurApp->GetTarget();
6470  Unit* triggerTarget = eventInfo.GetProcTarget();
6471 
6472  uint32 triggerSpellId = GetSpellEffectInfo()->TriggerSpell;
6473  if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6474  {
6475  TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId());
6476  triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this);
6477  }
6478  else
6479  TC_LOG_DEBUG("spells","AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
6480 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
Unit * GetTarget() const
Definition: SpellAuras.h:74
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 TriggerSpell
Definition: SpellInfo.h:263
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Unit * GetProcTarget() const
Definition: Unit.h:993
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleProcTriggerSpellOnPowerAmountAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6602 {
6603  // Power amount required to proc the spell
6604  int32 powerAmountRequired = GetAmount();
6605  // Power type required to proc
6606  Powers powerRequired = Powers(_effectInfo->MiscValue);
6607 
6608  if (!powerRequired || !powerAmountRequired)
6609  {
6610  TC_LOG_ERROR("spells", "AuraEffect::HandleProcTriggerSpellOnPowerAmountAuraProc: Spell %u have 0 PowerAmountRequired in EffectAmount[%d] or 0 PowerRequired in EffectMiscValue", GetId(), GetEffIndex());
6611  return /*false*/;
6612  }
6613 
6614  Unit* triggerCaster = aurApp->GetTarget();
6615  Unit* triggerTarget = eventInfo.GetProcTarget();
6616 
6617  if (triggerCaster->GetPower(powerRequired) != powerAmountRequired)
6618  return /*false*/;
6619 
6620  uint32 triggerSpellId = _effectInfo->TriggerSpell;
6621  if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6622  {
6623  TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellOnPowerAmountAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId());
6624  triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this);
6625  }
6626  else
6627  TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellOnPowerAmountAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
6628 }
int32 MiscValue
Definition: SpellInfo.h:253
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
Unit * GetTarget() const
Definition: SpellAuras.h:74
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
SpellEffectInfo const * _effectInfo
Definition: SpellAuraEffects.h:112
uint32 TriggerSpell
Definition: SpellInfo.h:263
Powers
Definition: SharedDefines.h:246
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Unit * GetProcTarget() const
Definition: Unit.h:993
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleProcTriggerSpellWithValueAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6483 {
6484  Unit* triggerCaster = aurApp->GetTarget();
6485  Unit* triggerTarget = eventInfo.GetProcTarget();
6486 
6487  uint32 triggerSpellId = GetSpellEffectInfo()->TriggerSpell;
6488  if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
6489  {
6490  int32 basepoints0 = GetAmount();
6491  TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId());
6492  triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, NULL, NULL, true, NULL, this);
6493  }
6494  else
6495  TC_LOG_DEBUG("spells","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId());
6496 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
Unit * GetTarget() const
Definition: SpellAuras.h:74
Definition: SpellInfo.h:326
uint32 GetId() const
Definition: SpellAuraEffects.h:47
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint32 TriggerSpell
Definition: SpellInfo.h:263
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Unit * GetProcTarget() const
Definition: Unit.h:993
Definition: Unit.h:1305
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleRaidProcFromChargeAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6513 {
6514  Unit* target = aurApp->GetTarget();
6515 
6516  uint32 triggerSpellId;
6517  switch (GetId())
6518  {
6519  case 57949: // Shiver
6520  triggerSpellId = 57952;
6521  //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
6522  break;
6523  case 59978: // Shiver
6524  triggerSpellId = 59979;
6525  break;
6526  case 43593: // Cold Stare
6527  triggerSpellId = 43594;
6528  break;
6529  default:
6530  TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: %u", GetId());
6531  return;
6532  }
6533 
6534  int32 jumps = GetBase()->GetCharges();
6535 
6536  // current aura expire on proc finish
6537  GetBase()->SetCharges(0);
6538  GetBase()->SetUsingCharges(true);
6539 
6540  // next target selection
6541  if (jumps > 0)
6542  {
6543  if (Unit* caster = GetCaster())
6544  {
6545  float radius = GetSpellEffectInfo()->CalcRadius(caster);
6546 
6547  if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
6548  {
6549  target->CastSpell(triggerTarget, GetSpellInfo(), true, NULL, this, GetCasterGUID());
6550  if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
6551  aura->SetCharges(jumps);
6552  }
6553  }
6554  }
6555 
6556  TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId());
6557  target->CastSpell(target, triggerSpellId, true, NULL, this, GetCasterGUID());
6558 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
Unit * GetTarget() const
Definition: SpellAuras.h:74
uint32 GetId() const
Definition: SpellAuraEffects.h:47
arena_t NULL
Definition: jemalloc_internal.h:624
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
float CalcRadius(Unit *caster=NULL, Spell *=NULL) const
Definition: SpellInfo.cpp:655
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:864
void SetUsingCharges(bool val)
Definition: SpellAuras.h:251
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint8 GetCharges() const
Definition: SpellAuras.h:170
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition: Unit.cpp:8041
Definition: SpellAuras.h:116
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
6562 {
6563  Unit* target = aurApp->GetTarget();
6564 
6565  // Currently only Prayer of Mending
6566  if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
6567  {
6568  TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: %u", GetId());
6569  return;
6570  }
6571  uint32 triggerSpellId = 33110;
6572 
6573  int32 value = GetAmount();
6574 
6575  int32 jumps = GetBase()->GetCharges();
6576 
6577  // current aura expire on proc finish
6578  GetBase()->SetCharges(0);
6579  GetBase()->SetUsingCharges(true);
6580 
6581  // next target selection
6582  if (jumps > 0)
6583  {
6584  if (Unit* caster = GetCaster())
6585  {
6586  float radius = GetSpellEffectInfo()->CalcRadius(caster);
6587 
6588  if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
6589  {
6590  target->CastCustomSpell(triggerTarget, GetId(), &value, NULL, NULL, true, NULL, this, GetCasterGUID());
6591  if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
6592  aura->SetCharges(jumps);
6593  }
6594  }
6595  }
6596 
6597  TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId());
6598  target->CastCustomSpell(target, triggerSpellId, &value, NULL, NULL, true, NULL, this, GetCasterGUID());
6599 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:40
Unit * GetTarget() const
Definition: SpellAuras.h:74
uint32 GetId() const
Definition: SpellAuraEffects.h:47
arena_t NULL
Definition: jemalloc_internal.h:624
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
float CalcRadius(Unit *caster=NULL, Spell *=NULL) const
Definition: SpellInfo.cpp:655
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:864
void SetUsingCharges(bool val)
Definition: SpellAuras.h:251
Definition: SharedDefines.h:4629
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint8 GetCharges() const
Definition: SpellAuras.h:170
const FieldDescriptor value
Definition: descriptor.h:1522
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition: Unit.cpp:8041
Definition: SpellAuras.h:116
Definition: Unit.h:1305
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleShapeshiftBoosts ( Unit target,
bool  apply 
) const
1273 {
1274  uint32 spellId = 0;
1275  uint32 spellId2 = 0;
1276 
1277  switch (GetMiscValue())
1278  {
1279  case FORM_CAT:
1280  spellId = 3025;
1281  break;
1282  case FORM_TREE:
1283  spellId = 34123;
1284  break;
1285  case FORM_TRAVEL:
1286  spellId = 5419;
1287  break;
1288  case FORM_AQUA:
1289  spellId = 5421;
1290  break;
1291  case FORM_BEAR:
1292  spellId = 1178;
1293  spellId2 = 21178;
1294  break;
1295  case FORM_BATTLESTANCE:
1296  spellId = 21156;
1297  break;
1298  case FORM_DEFENSIVESTANCE:
1299  spellId = 7376;
1300  break;
1301  case FORM_BERSERKERSTANCE:
1302  spellId = 7381;
1303  break;
1304  case FORM_MOONKIN:
1305  spellId = 24905;
1306  spellId2 = 24907;
1307  break;
1308  case FORM_FLIGHT:
1309  spellId = 33948;
1310  spellId2 = 34764;
1311  break;
1312  case FORM_FLIGHT_EPIC:
1313  spellId = 40122;
1314  spellId2 = 40121;
1315  break;
1316  case FORM_METAMORPHOSIS:
1317  spellId = 54817;
1318  spellId2 = 54879;
1319  break;
1321  spellId = 27792;
1322  spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
1323  break;
1324  case FORM_SHADOW:
1325  spellId = 49868;
1326  break;
1327  case FORM_GHOSTWOLF:
1328  spellId = 67116;
1329  break;
1330  case FORM_GHOUL:
1331  case FORM_AMBIENT:
1332  case FORM_STEALTH:
1333  case FORM_CREATURECAT:
1334  case FORM_CREATUREBEAR:
1335  break;
1336  default:
1337  break;
1338  }
1339 
1340  if (apply)
1341  {
1342  if (spellId)
1343  target->CastSpell(target, spellId, true, NULL, this);
1344 
1345  if (spellId2)
1346  target->CastSpell(target, spellId2, true, NULL, this);
1347 
1348  if (target->GetTypeId() == TYPEID_PLAYER)
1349  {
1350  Player* plrTarget = target->ToPlayer();
1351 
1352  PlayerSpellMap const& sp_list = plrTarget->GetSpellMap();
1353  for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1354  {
1355  if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
1356  continue;
1357 
1358  if (itr->first == spellId || itr->first == spellId2)
1359  continue;
1360 
1361  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1362  if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
1363  continue;
1364 
1365  if ((spellInfo->HasAttribute(SPELL_ATTR8_MASTERY_SPECIALIZATION)) && !plrTarget->IsCurrentSpecMasterySpell(spellInfo))
1366  continue;
1367 
1368  if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1369  target->CastSpell(target, itr->first, true, NULL, this);
1370  }
1371 
1372  // Also do it for Glyphs
1373  for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
1374  {
1375  if (uint32 glyphId = plrTarget->GetGlyph(plrTarget->GetActiveTalentGroup(), i))
1376  {
1377  if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId))
1378  {
1379  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellID);
1380  if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
1381  continue;
1382 
1383  if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1384  target->CastSpell(target, glyph->SpellID, true, NULL, this);
1385  }
1386  }
1387  }
1388 
1389  // Leader of the Pack
1390  if (plrTarget->HasSpell(17007))
1391  {
1392  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
1393  if (spellInfo && spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() -1)))
1394  target->CastSpell(target, 24932, true, NULL, this);
1395  }
1396 
1397  switch (GetMiscValue())
1398  {
1399  case FORM_CAT:
1400  // Savage Roar
1401  if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, flag128(0, 0x10000000, 0)))
1402  target->CastSpell(target, 62071, true);
1403  // Nurturing Instinct
1405  {
1406  uint32 spellId3 = 0;
1407  switch (aurEff->GetId())
1408  {
1409  case 33872:
1410  spellId3 = 47179;
1411  break;
1412  case 33873:
1413  spellId3 = 47180;
1414  break;
1415  }
1416  target->CastSpell(target, spellId3, true, NULL, this);
1417  }
1418  // Master Shapeshifter - Cat
1420  {
1421  int32 bp = aurEff->GetAmount();
1422  target->CastCustomSpell(target, 48420, &bp, NULL, NULL, true);
1423  }
1424  break;
1425  case FORM_BEAR:
1426  // Master Shapeshifter - Bear
1428  {
1429  int32 bp = aurEff->GetAmount();
1430  target->CastCustomSpell(target, 48418, &bp, NULL, NULL, true);
1431  }
1432  break;
1433  case FORM_MOONKIN:
1434  // Master Shapeshifter - Moonkin
1436  {
1437  int32 bp = aurEff->GetAmount();
1438  target->CastCustomSpell(target, 48421, &bp, NULL, NULL, true);
1439  }
1440  break;
1441  default:
1442  break;
1443  }
1444  }
1445  }
1446  else
1447  {
1448  if (spellId)
1449  target->RemoveOwnedAura(spellId, target->GetGUID());
1450  if (spellId2)
1451  target->RemoveOwnedAura(spellId2, target->GetGUID());
1452 
1454  AuraEffect* newAura = NULL;
1455  // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied
1456  for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr)
1457  {
1458  if ((*itr) != this)
1459  {
1460  newAura = *itr;
1461  break;
1462  }
1463  }
1464 
1465  Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1466  for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
1467  {
1468  // Use the new aura to see on what stance the target will be
1469  uint64 newStance = newAura ? (UI64LIT(1) << (newAura->GetMiscValue() - 1)) : 0;
1470 
1471  // If the stances are not compatible with the spell, remove it
1472  if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance))
1473  target->RemoveAura(itr);
1474  else
1475  ++itr;
1476  }
1477  }
1478 }
Definition: SpellAuraEffects.h:30
Definition: Unit.h:279
Definition: Unit.h:292
Definition: Player.h:106
int32 GetMiscValue() const
Definition: SpellAuraEffects.h:53
Definition: Unit.h:266
Definition: SpellInfo.h:326
Definition: SharedDefines.h:28
Definition: Unit.h:289
Definition: Unit.h:281
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
#define UI64LIT(N)
Definition: Define.h:138
Definition: SharedDefines.h:673
Definition: SharedDefines.h:363
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Unit.h:284
Definition: SharedDefines.h:362
uint32 Attributes
Definition: SpellInfo.h:333
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3442
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
#define MAX_GLYPH_SLOT_INDEX
Definition: SharedDefines.h:854
Definition: Unit.h:277
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1789
Definition: Unit.h:263
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:197
Definition: Util.h:362
uint64 Stances
Definition: SpellInfo.h:348
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1832
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
Definition: SharedDefines.h:4630
Definition: Unit.h:291
Definition: Unit.h:268
Definition: DBCStructure.h:509
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3365
Definition: Unit.h:267
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:280
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:4623
Definition: Unit.h:265
Definition: Unit.h:278
Definition: SpellAuraDefines.h:96
Definition: SpellAuraDefines.h:64
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4071
Definition: Unit.h:287
Definition: Unit.h:290
Definition: Unit.h:276
Definition: SpellAuraDefines.h:196
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1315
Definition: Unit.h:264
Definition: SpellAuraDefines.h:235
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: Unit.h:269
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
Definition: Unit.h:288

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::HandleShieldBlockValue ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
4685 {
4687  return;
4688 
4689  Unit* target = aurApp->GetTarget();
4690 
4691  BaseModType modType = FLAT_MOD;
4693  modType = PCT_MOD;
4694 
4695  if (target->GetTypeId() == TYPEID_PLAYER)
4696  target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
4697 }
Definition: SpellAuraDefines.h:43
void apply(T *val)
Definition: ByteConverter.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Unit.h:534
BaseModType
Definition: Unit.h:532
Definition: Unit.h:528
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:535
Definition: SpellAuraDefines.h:210
Definition: Unit.h:1305
Definition: SpellAuraDefines.h:46

+ Here is the call graph for this function:

void AuraEffect::HandleSpiritOfRedemption ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
1652 {
1653  if (!(mode & AURA_EFFECT_HANDLE_REAL))
1654  return;
1655 
1656  Unit* target = aurApp->GetTarget();
1657 
1658  if (target->GetTypeId() != TYPEID_PLAYER)
1659  return;
1660 
1661  // prepare spirit state
1662  if (apply)
1663  {
1664  if (target->GetTypeId() == TYPEID_PLAYER)
1665  {
1666  // disable breath/etc timers
1667  target->ToPlayer()->StopMirrorTimers();
1668 
1669  // set stand state (expected in this form)
1670  if (!target->IsStandState())
1672  }
1673 
1674  target->SetHealth(1);
1675  }
1676  // die at aura end
1677  else if (target->IsAlive())
1678  // call functions which may have additional effects after chainging state of unit
1679  target->setDeathState(JUST_DIED);
1680 }
Definition: Unit.h:207
Definition: Unit.h:542
void apply(T *val)
Definition: ByteConverter.h:41
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
bool IsAlive() const
Definition: Unit.h:1692
Definition: SpellAuraDefines.h:39
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:10593
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:12772
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
Definition: Unit.h:1305
bool IsStandState() const
Definition: Unit.cpp:12766

+ Here is the call graph for this function:

void AuraEffect::HandleUnused ( AuraApplication const ,
uint8  ,
bool   
) const
inline
139  {
140  // useless
141  }
void AuraEffect::HandleWaterBreathing ( AuraApplication const aurApp,
uint8  mode,
bool  apply 
) const
2794 {
2796  return;
2797 
2798  Unit* target = aurApp->GetTarget();
2799 
2800  // update timers in client
2801  if (target->GetTypeId() == TYPEID_PLAYER)
2802  target->ToPlayer()->UpdateMirrorTimers();
2803 }
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellAuraDefines.h:45
ObjectGuid GetTarget() const
Definition: Unit.h:2209
Definition: ObjectGuid.h:33
Definition: Unit.h:1305

+ Here is the call graph for this function:

bool AuraEffect::HasSpellClassMask ( ) const
inline
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
flag128 SpellClassMask
Definition: SpellInfo.h:264
bool AuraEffect::IsAffectingSpell ( SpellInfo const spell) const
1148 {
1149  if (!spell)
1150  return false;
1151  // Check family name
1152  if (spell->SpellFamilyName != m_spellInfo->SpellFamilyName)
1153  return false;
1154 
1155  // Check EffectClassMask
1156  if (GetSpellEffectInfo()->SpellClassMask & spell->SpellFamilyFlags)
1157  return true;
1158  return false;
1159 }
SpellEffectInfo const * GetSpellEffectInfo() const
Definition: SpellAuraEffects.h:102
uint32 SpellFamilyName
Definition: SpellInfo.h:396
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111

+ Here is the call graph for this function:

bool AuraEffect::IsAreaAuraEffect ( ) const
6068 {
6075  return true;
6076  return false;
6077 }
Definition: SharedDefines.h:1153
Definition: SharedDefines.h:1139
SpellEffectInfo const * _effectInfo
Definition: SpellAuraEffects.h:112
Definition: SharedDefines.h:1138
Definition: SharedDefines.h:1075
Definition: SharedDefines.h:1045
uint32 Effect
Definition: SpellInfo.h:243
Definition: SharedDefines.h:1129
bool AuraEffect::IsEffect ( ) const
inline
104 { return _effectInfo->Effect != 0; }
SpellEffectInfo const * _effectInfo
Definition: SpellAuraEffects.h:112
uint32 Effect
Definition: SpellInfo.h:243
bool AuraEffect::IsEffect ( SpellEffectName  effectName) const
inline
105 { return _effectInfo->Effect == uint32(effectName); }
SpellEffectInfo const * _effectInfo
Definition: SpellAuraEffects.h:112
uint32_t uint32
Definition: g3dmath.h:168
uint32 Effect
Definition: SpellInfo.h:243
bool AuraEffect::IsPeriodic ( ) const
inline
87 { return m_isPeriodic; }
bool m_isPeriodic
Definition: SpellAuraEffects.h:128

+ Here is the caller graph for this function:

void AuraEffect::PeriodicTick ( AuraApplication aurApp,
Unit caster 
) const
1168 {
1169  bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1170  if (prevented)
1171  return;
1172 
1173  Unit* target = aurApp->GetTarget();
1174 
1175  switch (GetAuraType())
1176  {
1178  HandlePeriodicDummyAuraTick(target, caster);
1179  break;
1181  HandlePeriodicTriggerSpellAuraTick(target, caster);
1182  break;
1185  break;
1188  HandlePeriodicDamageAurasTick(target, caster);
1189  break;
1191  HandlePeriodicHealthLeechAuraTick(target, caster);
1192  break;
1194  HandlePeriodicHealthFunnelAuraTick(target, caster);
1195  break;
1198  HandlePeriodicHealAurasTick(target, caster);
1199  break;
1201  HandlePeriodicManaLeechAuraTick(target, caster);
1202  break;
1204  HandleObsModPowerAuraTick(target, caster);
1205  break;
1207  HandlePeriodicEnergizeAuraTick(target, caster);
1208  break;
1209  case SPELL_AURA_POWER_BURN:
1210  HandlePeriodicPowerBurnAuraTick(target, caster);
1211  break;
1212  default:
1213  break;
1214  }
1215 }
Definition: SpellAuraDefines.h:68
Definition: SpellAuraDefines.h:63
Definition: SpellAuraDefines.h:287
Definition: SpellAuraDefines.h:222
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6179
Unit * GetTarget() const
Definition: SpellAuras.h:74
Definition: SpellAuraDefines.h:80
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6391
Definition: SpellAuraDefines.h:83
Definition: SpellAuraDefines.h:286
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6301
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:5895
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
Definition: SpellAuras.cpp:2072
Definition: SpellAuraDefines.h:124
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:5613
Definition: SpellAuraDefines.h:81
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6079
Definition: SpellAuraDefines.h:84
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:5911
void HandlePeriodicDummyAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:5480
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6426
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6356
Definition: SpellAuraDefines.h:113
Definition: SpellAuraDefines.h:149
Definition: Unit.h:1305
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
Definition: SpellAuraEffects.cpp:6207
Definition: SpellAuraDefines.h:122

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::RecalculateAmount ( )
inline
65 { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); }
bool CanBeRecalculated() const
Definition: SpellAuraEffects.h:67
Unit * GetCaster() const
Definition: SpellAuraEffects.h:39
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false)
Definition: SpellAuraEffects.cpp:828
int32 CalculateAmount(Unit *caster)
Definition: SpellAuraEffects.cpp:589
void AuraEffect::RecalculateAmount ( Unit caster)
inline
66 { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }
bool CanBeRecalculated() const
Definition: SpellAuraEffects.h:67
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false)
Definition: SpellAuraEffects.cpp:828
int32 CalculateAmount(Unit *caster)
Definition: SpellAuraEffects.cpp:589
void AuraEffect::ResetPeriodic ( bool  resetPeriodicTimer = false)
inline
85 { if (resetPeriodicTimer) m_periodicTimer = m_period; m_tickNumber = 0;}
int32 m_periodicTimer
Definition: SpellAuraEffects.h:122
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
int32 m_period
Definition: SpellAuraEffects.h:123

+ Here is the caller graph for this function:

void AuraEffect::SendTickImmune ( Unit target,
Unit caster 
) const
1162 {
1163  if (caster)
1164  caster->SendSpellDamageImmune(target, m_spellInfo->Id, true);
1165 }
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const *const m_spellInfo
Definition: SpellAuraEffects.h:111
void SendSpellDamageImmune(Unit *target, uint32 spellId, bool isPeriodic)
Definition: Unit.cpp:4915

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AuraEffect::SetAmount ( int32  amount)
inline
56 { m_amount = amount; m_canBeRecalculated = false;}
int32 m_amount
Definition: SpellAuraEffects.h:115
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:127

+ Here is the caller graph for this function:

void AuraEffect::SetCanBeRecalculated ( bool  val)
inline
68 { m_canBeRecalculated = val; }
bool m_canBeRecalculated
Definition: SpellAuraEffects.h:127
void AuraEffect::SetCritChance ( float  val)
inline
75 { m_critChance = val; }
float m_critChance
Definition: SpellAuraEffects.h:117
void AuraEffect::SetDamage ( int32  val)
inline
73 { m_damage = val; }
int32 m_damage
Definition: SpellAuraEffects.h:116
void AuraEffect::SetDonePct ( float  val)
inline
77 { m_donePct = val; }
float m_donePct
Definition: SpellAuraEffects.h:118
void AuraEffect::SetPeriodic ( bool  isPeriodic)
inline
88 { m_isPeriodic = isPeriodic; }
bool m_isPeriodic
Definition: SpellAuraEffects.h:128
void AuraEffect::SetPeriodicTimer ( int32  periodicTimer)
inline
59 { m_periodicTimer = periodicTimer; }
int32 m_periodicTimer
Definition: SpellAuraEffects.h:122

+ Here is the caller graph for this function:

void AuraEffect::Update ( uint32  diff,
Unit caster 
)
984 {
985  if (m_isPeriodic && (GetBase()->GetDuration() >=0 || GetBase()->IsPassive() || GetBase()->IsPermanent()))
986  {
987  if (m_periodicTimer > int32(diff))
988  m_periodicTimer -= diff;
989  else // tick also at m_periodicTimer == 0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
990  {
991  ++m_tickNumber;
992 
993  // update before tick (aura can be removed in TriggerSpell or PeriodicTick calls)
994  m_periodicTimer += m_period - diff;
995  UpdatePeriodic(caster);
996 
997  std::list<AuraApplication*> effectApplications;
998  GetApplicationList(effectApplications);
999  // tick on targets of effects
1000  for (std::list<AuraApplication*>::const_iterator apptItr = effectApplications.begin(); apptItr != effectApplications.end(); ++apptItr)
1001  if ((*apptItr)->HasEffect(GetEffIndex()))
1002  PeriodicTick(*apptItr, caster);
1003  }
1004  }
1005 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
int32 m_periodicTimer
Definition: SpellAuraEffects.h:122
bool m_isPeriodic
Definition: SpellAuraEffects.h:128
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
void GetApplicationList(std::list< AuraApplication * > &applicationList) const
Definition: SpellAuraEffects.cpp:579
int32 m_period
Definition: SpellAuraEffects.h:123
void PeriodicTick(AuraApplication *aurApp, Unit *caster) const
Definition: SpellAuraEffects.cpp:1167
int32_t int32
Definition: g3dmath.h:167
void UpdatePeriodic(Unit *caster)
Definition: SpellAuraEffects.cpp:1007

+ Here is the call graph for this function:

void AuraEffect::UpdatePeriodic ( Unit caster)
1008 {
1009  switch (GetAuraType())
1010  {
1012  switch (GetSpellInfo()->SpellFamilyName)
1013  {
1014  case SPELLFAMILY_GENERIC:
1015  switch (GetId())
1016  {
1017  // Drink
1018  case 430:
1019  case 431:
1020  case 432:
1021  case 1133:
1022  case 1135:
1023  case 1137:
1024  case 10250:
1025  case 22734:
1026  case 27089:
1027  case 34291:
1028  case 43182:
1029  case 43183:
1030  case 46755:
1031  case 49472: // Drink Coffee
1032  case 57073:
1033  case 61830:
1034  case 69176:
1035  case 72623:
1036  case 80166:
1037  case 80167:
1038  case 87958:
1039  case 87959:
1040  case 92736:
1041  case 92797:
1042  case 92800:
1043  case 92803:
1044  if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
1045  return;
1046  // Get SPELL_AURA_MOD_POWER_REGEN aura from spell
1047  if (AuraEffect* aurEff = GetBase()->GetEffect(0))
1048  {
1049  if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
1050  {
1051  m_isPeriodic = false;
1052  TC_LOG_ERROR("spells", "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
1053  }
1054  else
1055  {
1056  // default case - not in arena
1057  if (!caster->ToPlayer()->InArena())
1058  {
1059  aurEff->ChangeAmount(GetAmount());
1060  m_isPeriodic = false;
1061  }
1062  else
1063  {
1064  // **********************************************
1065  // This feature uses only in arenas
1066  // **********************************************
1067  // Here need increase mana regen per tick (6 second rule)
1068  // on 0 tick - 0 (handled in 2 second)
1069  // on 1 tick - 166% (handled in 4 second)
1070  // on 2 tick - 133% (handled in 6 second)
1071 
1072  // Apply bonus for 1 - 4 tick
1073  switch (m_tickNumber)
1074  {
1075  case 1: // 0%
1076  aurEff->ChangeAmount(0);
1077  break;
1078  case 2: // 166%
1079  aurEff->ChangeAmount(GetAmount() * 5 / 3);
1080  break;
1081  case 3: // 133%
1082  aurEff->ChangeAmount(GetAmount() * 4 / 3);
1083  break;
1084  default: // 100% - normal regen
1085  aurEff->ChangeAmount(GetAmount());
1086  // No need to update after 4th tick
1087  m_isPeriodic = false;
1088  break;
1089  }
1090  }
1091  }
1092  }
1093  break;
1094  case 58549: // Tenacity
1095  case 59911: // Tenacity (vehicle)
1096  GetBase()->RefreshDuration();
1097  break;
1098  case 66823: case 67618: case 67619: case 67620: // Paralytic Toxin
1099  // Get 0 effect aura
1100  if (AuraEffect* slow = GetBase()->GetEffect(0))
1101  {
1102  int32 newAmount = slow->GetAmount() - 10;
1103  if (newAmount < -100)
1104  newAmount = -100;
1105  slow->ChangeAmount(newAmount);
1106  }
1107  break;
1108  default:
1109  break;
1110  }
1111  break;
1112  case SPELLFAMILY_MAGE:
1113  if (GetId() == 55342)// Mirror Image
1114  m_isPeriodic = false;
1115  break;
1117  // Chains of Ice
1118  if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00004000)
1119  {
1120  // Get 0 effect aura
1121  if (AuraEffect* slow = GetBase()->GetEffect(0))
1122  {
1123  int32 newAmount = slow->GetAmount() + GetAmount();
1124  if (newAmount > 0)
1125  newAmount = 0;
1126  slow->ChangeAmount(newAmount);
1127  }
1128  return;
1129  }
1130  break;
1131  default:
1132  break;
1133  }
1134  default:
1135  break;
1136  }
1138 }
Definition: SpellAuraEffects.h:30
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:46
uint32 GetId() const
Definition: SpellAuraEffects.h:47
Definition: SharedDefines.h:4638
void RefreshDuration(bool withMods=false)
Definition: SpellAuras.cpp:817
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
AuraType GetAuraType() const
Definition: SpellAuraEffects.h:54
Player * ToPlayer()
Definition: Object.h:191
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect *aurEff)
Definition: SpellAuras.cpp:2092
TypeID GetTypeId() const
Definition: Object.h:113
bool m_isPeriodic
Definition: SpellAuraEffects.h:128
Definition: SharedDefines.h:4626
uint32 m_tickNumber
Definition: SpellAuraEffects.h:124
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
Definition: SpellAuraDefines.h:286
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
int32_t int32
Definition: Define.h:146
Definition: SpellAuraDefines.h:145
Definition: ObjectGuid.h:33
Definition: SharedDefines.h:4623
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

void Aura::_InitEffects ( uint32  effMask,
Unit caster,
int32 baseAmount 
)
friend
Aura* Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const newAura,
uint32  effMask,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
int32  castItemLevel 
)
friend

Member Data Documentation

SpellEffectInfo const* AuraEffect::_effectInfo
private
int32 AuraEffect::m_amount
private
Aura* const AuraEffect::m_base
private
int32 const AuraEffect::m_baseAmount
private
bool AuraEffect::m_canBeRecalculated
private
float AuraEffect::m_critChance
private
int32 AuraEffect::m_damage
private
float AuraEffect::m_donePct
private
uint8 const AuraEffect::m_effIndex
private
bool AuraEffect::m_isPeriodic
private
int32 AuraEffect::m_period
private
int32 AuraEffect::m_periodicTimer
private
SpellInfo const* const AuraEffect::m_spellInfo
private
SpellModifier* AuraEffect::m_spellmod
private
uint32 AuraEffect::m_tickNumber
private

The documentation for this class was generated from the following files: