TrinityCore
SpellAuraEffects.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "SpellAuraEffects.h"
19#include "Battlefield.h"
20#include "BattlefieldMgr.h"
21#include "Battleground.h"
22#include "BattlegroundPackets.h"
23#include "CellImpl.h"
24#include "CharmInfo.h"
25#include "Common.h"
26#include "Containers.h"
27#include "DB2Stores.h"
28#include "GridNotifiersImpl.h"
29#include "Item.h"
30#include "Log.h"
31#include "MiscPackets.h"
32#include "MotionMaster.h"
33#include "MovementPackets.h"
34#include "ObjectAccessor.h"
35#include "ObjectMgr.h"
36#include "OutdoorPvPMgr.h"
37#include "Pet.h"
38#include "PhasingHandler.h"
39#include "Player.h"
40#include "ReputationMgr.h"
41#include "ScriptMgr.h"
42#include "Spell.h"
43#include "SpellHistory.h"
44#include "SpellMgr.h"
45#include "ThreatManager.h"
46#include "Unit.h"
47#include "Util.h"
48#include "Vehicle.h"
49#include "Weather.h"
50#include "WorldPacket.h"
51#include "WorldSession.h"
52#include <G3D/g3dmath.h>
53#include <numeric>
54
55class Aura;
56//
57// EFFECT HANDLER NOTES
58//
59// in aura handler there should be check for modes:
60// AURA_EFFECT_HANDLE_REAL set
61// AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK set
62// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK set - aura is recalculated or is just applied/removed - need to redo all things related to m_amount
63// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK - logical or of above conditions
64// AURA_EFFECT_HANDLE_STAT - set when stats are reapplied
65// such checks will speedup trinity change amount/send for client operations
66// because for change amount operation packets will not be send
67// aura effect handlers shouldn't contain any AuraEffect or Aura object modifications
68
70{
71 &AuraEffect::HandleNULL, // 0 SPELL_AURA_NONE
72 &AuraEffect::HandleBindSight, // 1 SPELL_AURA_BIND_SIGHT
73 &AuraEffect::HandleModPossess, // 2 SPELL_AURA_MOD_POSSESS
74 &AuraEffect::HandleNoImmediateEffect, // 3 SPELL_AURA_PERIODIC_DAMAGE implemented in AuraEffect::PeriodicTick
75 &AuraEffect::HandleAuraDummy, // 4 SPELL_AURA_DUMMY
76 &AuraEffect::HandleModConfuse, // 5 SPELL_AURA_MOD_CONFUSE
77 &AuraEffect::HandleModCharm, // 6 SPELL_AURA_MOD_CHARM
78 &AuraEffect::HandleModFear, // 7 SPELL_AURA_MOD_FEAR
79 &AuraEffect::HandleNoImmediateEffect, // 8 SPELL_AURA_PERIODIC_HEAL implemented in AuraEffect::PeriodicTick
80 &AuraEffect::HandleModAttackSpeed, // 9 SPELL_AURA_MOD_ATTACKSPEED
81 &AuraEffect::HandleModThreat, // 10 SPELL_AURA_MOD_THREAT
82 &AuraEffect::HandleModTaunt, // 11 SPELL_AURA_MOD_TAUNT
83 &AuraEffect::HandleAuraModStun, // 12 SPELL_AURA_MOD_STUN
84 &AuraEffect::HandleModDamageDone, // 13 SPELL_AURA_MOD_DAMAGE_DONE
85 &AuraEffect::HandleNoImmediateEffect, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
86 &AuraEffect::HandleNoImmediateEffect, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
87 &AuraEffect::HandleModStealth, // 16 SPELL_AURA_MOD_STEALTH
88 &AuraEffect::HandleModStealthDetect, // 17 SPELL_AURA_MOD_DETECT
89 &AuraEffect::HandleModInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
90 &AuraEffect::HandleModInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECT
91 &AuraEffect::HandleNoImmediateEffect, // 20 SPELL_AURA_OBS_MOD_HEALTH implemented in AuraEffect::PeriodicTick
92 &AuraEffect::HandleNoImmediateEffect, // 21 SPELL_AURA_OBS_MOD_POWER implemented in AuraEffect::PeriodicTick
93 &AuraEffect::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE
94 &AuraEffect::HandleNoImmediateEffect, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL implemented in AuraEffect::PeriodicTick
95 &AuraEffect::HandleNoImmediateEffect, // 24 SPELL_AURA_PERIODIC_ENERGIZE implemented in AuraEffect::PeriodicTick
96 &AuraEffect::HandleAuraModPacify, // 25 SPELL_AURA_MOD_PACIFY
97 &AuraEffect::HandleAuraModRoot, // 26 SPELL_AURA_MOD_ROOT
98 &AuraEffect::HandleAuraModSilence, // 27 SPELL_AURA_MOD_SILENCE
99 &AuraEffect::HandleNoImmediateEffect, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
100 &AuraEffect::HandleAuraModStat, // 29 SPELL_AURA_MOD_STAT
101 &AuraEffect::HandleAuraModSkill, // 30 SPELL_AURA_MOD_SKILL
102 &AuraEffect::HandleAuraModIncreaseSpeed, // 31 SPELL_AURA_MOD_INCREASE_SPEED
103 &AuraEffect::HandleAuraModIncreaseMountedSpeed, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
104 &AuraEffect::HandleAuraModDecreaseSpeed, // 33 SPELL_AURA_MOD_DECREASE_SPEED
105 &AuraEffect::HandleAuraModIncreaseHealth, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
106 &AuraEffect::HandleAuraModIncreaseEnergy, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
107 &AuraEffect::HandleAuraModShapeshift, // 36 SPELL_AURA_MOD_SHAPESHIFT
108 &AuraEffect::HandleAuraModEffectImmunity, // 37 SPELL_AURA_EFFECT_IMMUNITY
109 &AuraEffect::HandleAuraModStateImmunity, // 38 SPELL_AURA_STATE_IMMUNITY
110 &AuraEffect::HandleAuraModSchoolImmunity, // 39 SPELL_AURA_SCHOOL_IMMUNITY
111 &AuraEffect::HandleAuraModDmgImmunity, // 40 SPELL_AURA_DAMAGE_IMMUNITY
112 &AuraEffect::HandleAuraModDispelImmunity, // 41 SPELL_AURA_DISPEL_IMMUNITY
113 &AuraEffect::HandleNoImmediateEffect, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in AuraEffect::HandleProc
114 &AuraEffect::HandleNoImmediateEffect, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in AuraEffect::HandleProc
115 &AuraEffect::HandleAuraTrackCreatures, // 44 SPELL_AURA_TRACK_CREATURES
116 &AuraEffect::HandleNULL, // 45 SPELL_AURA_TRACK_RESOURCES implemented clientside
117 &AuraEffect::HandleNULL, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
118 &AuraEffect::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT
119 &AuraEffect::HandleNoImmediateEffect, // 48 SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
120 &AuraEffect::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT
121 &AuraEffect::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT implemented in Unit::SpellCriticalHealingBonus
122 &AuraEffect::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
123 &AuraEffect::HandleAuraModWeaponCritPercent, // 52 SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
124 &AuraEffect::HandleNoImmediateEffect, // 53 SPELL_AURA_PERIODIC_LEECH implemented in AuraEffect::PeriodicTick
125 &AuraEffect::HandleNoImmediateEffect, // 54 SPELL_AURA_MOD_HIT_CHANCE implemented in Unit::MeleeSpellMissChance
126 &AuraEffect::HandleModSpellHitChance, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
127 &AuraEffect::HandleAuraTransform, // 56 SPELL_AURA_TRANSFORM
128 &AuraEffect::HandleModSpellCritChance, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
129 &AuraEffect::HandleAuraModIncreaseSwimSpeed, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
130 &AuraEffect::HandleNoImmediateEffect, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
131 &AuraEffect::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
132 &AuraEffect::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
133 &AuraEffect::HandleNoImmediateEffect, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL implemented in AuraEffect::PeriodicTick
134 &AuraEffect::HandleNoImmediateEffect, // 63 SPELL_AURA_MOD_ADDITIONAL_POWER_COST implemented in SpellInfo::CalcPowerCost
135 &AuraEffect::HandleNoImmediateEffect, // 64 SPELL_AURA_PERIODIC_MANA_LEECH implemented in AuraEffect::PeriodicTick
136 &AuraEffect::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
137 &AuraEffect::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
138 &AuraEffect::HandleAuraModDisarm, // 67 SPELL_AURA_MOD_DISARM
139 &AuraEffect::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
140 &AuraEffect::HandleNoImmediateEffect, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
141 &AuraEffect::HandleNoImmediateEffect, // 70 SPELL_AURA_PERIODIC_WEAPON_PERCENT_DAMAGE implemented in AuraEffect::PeriodicTick
142 &AuraEffect::HandleStoreTeleportReturnPoint, // 71 SPELL_AURA_STORE_TELEPORT_RETURN_POINT
143 &AuraEffect::HandleNoImmediateEffect, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
144 &AuraEffect::HandleModPowerCost, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
145 &AuraEffect::HandleNoImmediateEffect, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
146 &AuraEffect::HandleNoImmediateEffect, // 75 SPELL_AURA_MOD_LANGUAGE
147 &AuraEffect::HandleNoImmediateEffect, // 76 SPELL_AURA_FAR_SIGHT
148 &AuraEffect::HandleModMechanicImmunity, // 77 SPELL_AURA_MECHANIC_IMMUNITY
149 &AuraEffect::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED
150 &AuraEffect::HandleModDamagePercentDone, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
151 &AuraEffect::HandleModPercentStat, // 80 SPELL_AURA_MOD_PERCENT_STAT
152 &AuraEffect::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT implemented in Unit::CalcAbsorbResist
153 &AuraEffect::HandleWaterBreathing, // 82 SPELL_AURA_WATER_BREATHING
154 &AuraEffect::HandleModBaseResistance, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
155 &AuraEffect::HandleNoImmediateEffect, // 84 SPELL_AURA_MOD_REGEN implemented in Player::RegenerateHealth
156 &AuraEffect::HandleModPowerRegen, // 85 SPELL_AURA_MOD_POWER_REGEN implemented in Player::Regenerate
157 &AuraEffect::HandleChannelDeathItem, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
158 &AuraEffect::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
159 &AuraEffect::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT implemented in Player::RegenerateHealth
160 &AuraEffect::HandleNoImmediateEffect, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
161 &AuraEffect::HandleUnused, // 90 unused (4.3.4) old SPELL_AURA_MOD_RESIST_CHANCE
162 &AuraEffect::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
163 &AuraEffect::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
164 &AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
165 &AuraEffect::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::Regenerate
166 &AuraEffect::HandleAuraGhost, // 95 SPELL_AURA_GHOST
167 &AuraEffect::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::GetMagicHitRedirectTarget
168 &AuraEffect::HandleNoImmediateEffect, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
169 &AuraEffect::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT
170 &AuraEffect::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER
171 &AuraEffect::HandleUnused, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
172 &AuraEffect::HandleModResistancePercent, //101 SPELL_AURA_MOD_RESISTANCE_PCT
173 &AuraEffect::HandleNoImmediateEffect, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
174 &AuraEffect::HandleAuraModTotalThreat, //103 SPELL_AURA_MOD_TOTAL_THREAT
175 &AuraEffect::HandleAuraWaterWalk, //104 SPELL_AURA_WATER_WALK
176 &AuraEffect::HandleAuraFeatherFall, //105 SPELL_AURA_FEATHER_FALL
177 &AuraEffect::HandleAuraHover, //106 SPELL_AURA_HOVER
178 &AuraEffect::HandleNoImmediateEffect, //107 SPELL_AURA_ADD_FLAT_MODIFIER implemented in AuraEffect::CalculateSpellMod()
179 &AuraEffect::HandleNoImmediateEffect, //108 SPELL_AURA_ADD_PCT_MODIFIER implemented in AuraEffect::CalculateSpellMod()
180 &AuraEffect::HandleNoImmediateEffect, //109 SPELL_AURA_ADD_TARGET_TRIGGER
181 &AuraEffect::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT implemented in Player::Regenerate, Creature::Regenerate
182 &AuraEffect::HandleNoImmediateEffect, //111 SPELL_AURA_INTERCEPT_MELEE_RANGED_ATTACKS implemented in Unit::GetMeleeHitRedirectTarget
183 &AuraEffect::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
184 &AuraEffect::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
185 &AuraEffect::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
186 &AuraEffect::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
187 &AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
188 &AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
189 &AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
190 &AuraEffect::HandleAuraPvpTalents, //119 SPELL_AURA_PVP_TALENTS
191 &AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
192 &AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
193 &AuraEffect::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
194 &AuraEffect::HandleModTargetResistance, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
195 &AuraEffect::HandleAuraModRangedAttackPower, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
196 &AuraEffect::HandleNoImmediateEffect, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
197 &AuraEffect::HandleNoImmediateEffect, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
198 &AuraEffect::HandleNoImmediateEffect, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
199 &AuraEffect::HandleAuraModFixate, //128 SPELL_AURA_MOD_FIXATE
200 &AuraEffect::HandleAuraModIncreaseSpeed, //129 SPELL_AURA_MOD_SPEED_ALWAYS
201 &AuraEffect::HandleAuraModIncreaseMountedSpeed, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
202 &AuraEffect::HandleNoImmediateEffect, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
203 &AuraEffect::HandleAuraModIncreaseEnergyPercent, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
204 &AuraEffect::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
205 &AuraEffect::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
206 &AuraEffect::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE
207 &AuraEffect::HandleModHealingDonePct, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT
208 &AuraEffect::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
209 &AuraEffect::HandleModMeleeSpeedPct, //138 SPELL_AURA_MOD_MELEE_HASTE
210 &AuraEffect::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION
211 &AuraEffect::HandleAuraModRangedHaste, //140 SPELL_AURA_MOD_RANGED_HASTE
212 &AuraEffect::HandleUnused, //141 SPELL_AURA_141
213 &AuraEffect::HandleAuraModBaseResistancePCT, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
214 &AuraEffect::HandleNULL, //143 SPELL_AURA_MOD_RECOVERY_RATE_BY_SPELL_LABEL
215 &AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
216 &AuraEffect::HandleAuraModIncreaseHealthPercent, //145 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT2
217 &AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
218 &AuraEffect::HandleModMechanicImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
219 &AuraEffect::HandleNULL, //148 SPELL_AURA_MOD_CHARGE_RECOVERY_RATE
220 &AuraEffect::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
221 &AuraEffect::HandleShieldBlockValuePercent, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
222 &AuraEffect::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
223 &AuraEffect::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
224 &AuraEffect::HandleNoImmediateEffect, //153 SPELL_AURA_MOD_AUTOATTACK_RANGE implemented in Unit::IsWithinMeleeRange
225 &AuraEffect::HandleModStealthLevel, //154 SPELL_AURA_MOD_STEALTH_LEVEL
226 &AuraEffect::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING
227 &AuraEffect::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN
228 &AuraEffect::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI
229 &AuraEffect::HandleAuraAllowTalentSwapping, //158 SPELL_AURA_ALLOW_TALENT_SWAPPING
230 &AuraEffect::HandleNoImmediateEffect, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
231 &AuraEffect::HandleUnused, //160 Unused (4.3.4) old SPELL_AURA_MOD_AOE_AVOIDANCE
232 &AuraEffect::HandleNoImmediateEffect, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
233 &AuraEffect::HandleNoImmediateEffect, //162 SPELL_AURA_POWER_BURN implemented in AuraEffect::PeriodicTick
234 &AuraEffect::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
235 &AuraEffect::HandleForceBreathBar, //164 SPELL_AURA_FORCE_BREATH_BAR
236 &AuraEffect::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
237 &AuraEffect::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
238 &AuraEffect::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
239 &AuraEffect::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
240 &AuraEffect::HandleSetFFAPvP, //169 SPELL_AURA_SET_FFA_PVP implemented in Player::UpdatePvPState
241 &AuraEffect::HandleDetectAmore, //170 SPELL_AURA_DETECT_AMORE used to detect various spells that change visual of units for aura target
242 &AuraEffect::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
243 &AuraEffect::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
244 &AuraEffect::HandleUnused, //173 unused (4.3.4) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
245 &AuraEffect::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
246 &AuraEffect::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
247 &AuraEffect::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
248 &AuraEffect::HandleCharmConvert, //177 SPELL_AURA_AOE_CHARM
249 &AuraEffect::HandleAuraModMaxPowerPct, //178 SPELL_AURA_MOD_MAX_POWER_PCT
250 &AuraEffect::HandleAuraModPowerDisplay, //179 SPELL_AURA_MOD_POWER_DISPLAY
251 &AuraEffect::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
252 &AuraEffect::HandleNULL, //181 SPELL_AURA_MOD_SPELL_CURRENCY_REAGENTS_COUNT_PCT
253 &AuraEffect::HandleSuppressItemPassiveEffectBySpellLabel, //182 SPELL_AURA_SUPPRESS_ITEM_PASSIVE_EFFECT_BY_SPELL_LABEL
254 &AuraEffect::HandleNoImmediateEffect, //183 SPELL_AURA_MOD_CRIT_CHANCE_VERSUS_TARGET_HEALTH implemented in Unit::GetUnitCriticalChance, Unit::GetUnitSpellCriticalChance
255 &AuraEffect::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
256 &AuraEffect::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
257 &AuraEffect::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
258 &AuraEffect::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
259 &AuraEffect::HandleNULL, //188 SPELL_AURA_MOD_UI_HEALING_RANGE handled clientside - affects UnitInRange lua function only
260 &AuraEffect::HandleModRating, //189 SPELL_AURA_MOD_RATING
261 &AuraEffect::HandleNoImmediateEffect, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN implemented in Player::CalculateReputationGain
262 &AuraEffect::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
263 &AuraEffect::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_MOD_MELEE_RANGED_HASTE
264 &AuraEffect::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
265 &AuraEffect::HandleNoImmediateEffect, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
266 &AuraEffect::HandleLearnSpell, //195 SPELL_AURA_LEARN_SPELL
267 &AuraEffect::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN - flat mod of spell cooldowns
268 &AuraEffect::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
269 &AuraEffect::HandleNoImmediateEffect, //198 SPELL_AURA_MOD_COMBAT_RATING_FROM_COMBAT_RATING implemented in Player::UpdateRating
270 &AuraEffect::HandleUnused, //199 unused (4.3.4) old SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
271 &AuraEffect::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::RewardPlayerAndGroupAtKill
272 &AuraEffect::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
273 &AuraEffect::HandleNoImmediateEffect, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
274 &AuraEffect::HandleNULL, //203 SPELL_AURA_PREVENT_INTERRUPT
275 &AuraEffect::HandleNULL, //204 SPELL_AURA_PREVENT_CORPSE_RELEASE
276 &AuraEffect::HandleNULL, //205 SPELL_AURA_MOD_CHARGE_COOLDOWN
277 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //206 SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED
278 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //207 SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
279 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //208 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
280 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //209 SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
281 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //210 SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS
282 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
283 &AuraEffect::HandleNoImmediateEffect, //212 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor
284 &AuraEffect::HandleNoImmediateEffect, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
285 &AuraEffect::HandleNULL, //214 Tamed Pet Passive
286 &AuraEffect::HandleArenaPreparation, //215 SPELL_AURA_ARENA_PREPARATION
287 &AuraEffect::HandleModCastingSpeed, //216 SPELL_AURA_HASTE_SPELLS
288 &AuraEffect::HandleModMeleeSpeedPct, //217 SPELL_AURA_MOD_MELEE_HASTE_2
289 &AuraEffect::HandleNoImmediateEffect, //218 SPELL_AURA_ADD_PCT_MODIFIER_BY_SPELL_LABEL implemented in AuraEffect::CalculateSpellMod()
290 &AuraEffect::HandleNoImmediateEffect, //219 SPELL_AURA_ADD_FLAT_MODIFIER_BY_SPELL_LABEL implemented in AuraEffect::CalculateSpellMod()
291 &AuraEffect::HandleNULL, //220 SPELL_AURA_MOD_ABILITY_SCHOOL_MASK
292 &AuraEffect::HandleModDetaunt, //221 SPELL_AURA_MOD_DETAUNT
293 &AuraEffect::HandleNoImmediateEffect, //222 SPELL_AURA_REMOVE_TRANSMOG_COST implemented in WorldSession::HandleTransmogrifyItems
294 &AuraEffect::HandleNoImmediateEffect, //223 SPELL_AURA_REMOVE_BARBER_SHOP_COST implemented in Player::GetBarberShopCost
295 &AuraEffect::HandleNULL, //224 SPELL_AURA_LEARN_TALENT
296 &AuraEffect::HandleNULL, //225 SPELL_AURA_MOD_VISIBILITY_RANGE
297 &AuraEffect::HandleNoImmediateEffect, //226 SPELL_AURA_PERIODIC_DUMMY implemented in AuraEffect::PeriodicTick
298 &AuraEffect::HandleNoImmediateEffect, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE implemented in AuraEffect::PeriodicTick
299 &AuraEffect::HandleNoImmediateEffect, //228 SPELL_AURA_DETECT_STEALTH stealth detection
300 &AuraEffect::HandleNoImmediateEffect, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
301 &AuraEffect::HandleAuraModIncreaseHealth, //230 SPELL_AURA_MOD_INCREASE_HEALTH_2
302 &AuraEffect::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
303 &AuraEffect::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
304 &AuraEffect::HandleUnused, //233 set model id to the one of the creature with id GetMiscValue() - clientside
305 &AuraEffect::HandleNoImmediateEffect, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
306 &AuraEffect::HandleNULL, //235 SPELL_AURA_MOD_HOVER_NO_HEIGHT_OFFSET handled clientside
307 &AuraEffect::HandleAuraControlVehicle, //236 SPELL_AURA_CONTROL_VEHICLE
308 &AuraEffect::HandleNULL, //237 SPELL_AURA_237
309 &AuraEffect::HandleNULL, //238 SPELL_AURA_238
310 &AuraEffect::HandleAuraModScale, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
311 &AuraEffect::HandleAuraModExpertise, //240 SPELL_AURA_MOD_EXPERTISE
312 &AuraEffect::HandleForceMoveForward, //241 SPELL_AURA_FORCE_MOVE_FORWARD Forces the caster to move forward
313 &AuraEffect::HandleNULL, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING - 2 test spells: 44183 and 44182
314 &AuraEffect::HandleAuraModFaction, //243 SPELL_AURA_MOD_FACTION
315 &AuraEffect::HandleComprehendLanguage, //244 SPELL_AURA_COMPREHEND_LANGUAGE
316 &AuraEffect::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
317 &AuraEffect::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura
318 &AuraEffect::HandleAuraCloneCaster, //247 SPELL_AURA_CLONE_CASTER
319 &AuraEffect::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
320 &AuraEffect::HandleNoImmediateEffect, //249 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE_BY_TARGET_AURA_MECHANIC implemented in Unit::SpellDamagePctDone and Unit::MeleeDamagePctDone
321 &AuraEffect::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
322 &AuraEffect::HandleNoImmediateEffect, //251 SPELL_AURA_MOD_ENEMY_DODGE implemented in Unit::GetUnitDodgeChance
323 &AuraEffect::HandleModCombatSpeedPct, //252 SPELL_AURA_252 Is there any difference between this and SPELL_AURA_MELEE_SLOW ? maybe not stacking mod?
324 &AuraEffect::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical
325 &AuraEffect::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND
326 &AuraEffect::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
327 &AuraEffect::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
328 &AuraEffect::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
329 &AuraEffect::HandleNoImmediateEffect, //258 SPELL_AURA_OVERRIDE_SUMMONED_OBJECT implemented in Spell::EffectTransmitted
330 &AuraEffect::HandleNoImmediateEffect, //259 SPELL_AURA_MOD_HOT_PCT implemented in Unit::SpellHealingBonusTaken
331 &AuraEffect::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
332 &AuraEffect::HandlePhase, //261 SPELL_AURA_PHASE
333 &AuraEffect::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in Spell::CheckCast
334 &AuraEffect::HandleNoImmediateEffect, //263 SPELL_AURA_DISABLE_CASTING_EXCEPT_ABILITIES implemented in Spell::CheckCast
335 &AuraEffect::HandleNoImmediateEffect, //264 SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES implemented in Spell::CheckCast, Unit::AttackerStateUpdate
336 &AuraEffect::HandleUnused, //265 unused (4.3.4)
337 &AuraEffect::HandleSetVignette, //266 SPELL_AURA_SET_VIGNETTE
338 &AuraEffect::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
339 &AuraEffect::HandleModArmorPctFromStat, //268 SPELL_AURA_MOD_ARMOR_PCT_FROM_STAT also implemented in Player::UpdateArmor()
340 &AuraEffect::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
341 &AuraEffect::HandleNoImmediateEffect, //270 SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonusTaken and Unit::MeleeDamageBonusTaken
342 &AuraEffect::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonusTaken and Unit::MeleeDamageBonusTaken
343 &AuraEffect::HandleNULL, //272 SPELL_AURA_MOD_BLOCK_VALUE_PCT
344 &AuraEffect::HandleUnused, //273 clientside
345 &AuraEffect::HandleNULL, //274 SPELL_AURA_MOD_BLOCK_VALUE_FLAT
346 &AuraEffect::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
347 &AuraEffect::HandleNULL, //276 mod damage % mechanic?
348 &AuraEffect::HandleUnused, //277 unused (4.3.4) old SPELL_AURA_MOD_MAX_AFFECTED_TARGETS
349 &AuraEffect::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
350 &AuraEffect::HandleNoImmediateEffect, //279 SPELL_AURA_INITIALIZE_IMAGES
351 &AuraEffect::HandleUnused, //280 unused (4.3.4) old SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
352 &AuraEffect::HandleNoImmediateEffect, //281 SPELL_AURA_PROVIDE_SPELL_FOCUS implemented in Spell::CheckCast
353 &AuraEffect::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_MOD_BASE_HEALTH_PCT
354 &AuraEffect::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
355 &AuraEffect::HandleAuraLinked, //284 SPELL_AURA_LINKED
356 &AuraEffect::HandleAuraLinked, //285 SPELL_AURA_LINKED_2
357 &AuraEffect::HandleNULL, //286 SPELL_AURA_MOD_RECOVERY_RATE
358 &AuraEffect::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
359 &AuraEffect::HandleNoImmediateEffect, //288 SPELL_AURA_IGNORE_HIT_DIRECTION implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult Unit::RollMeleeOutcomeAgainst
360 &AuraEffect::HandleNoImmediateEffect, //289 SPELL_AURA_PREVENT_DURABILITY_LOSS implemented in Player::DurabilityPointsLoss
361 &AuraEffect::HandleAuraModCritPct, //290 SPELL_AURA_MOD_CRIT_PCT
362 &AuraEffect::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_XP_QUEST_PCT implemented in Player::RewardQuest
363 &AuraEffect::HandleAuraOpenStable, //292 SPELL_AURA_OPEN_STABLE
364 &AuraEffect::HandleAuraOverrideSpells, //293 SPELL_AURA_OVERRIDE_SPELLS auras which probably add set of abilities to their target based on it's miscvalue
365 &AuraEffect::HandleNoImmediateEffect, //294 SPELL_AURA_PREVENT_REGENERATE_POWER implemented in Player::Regenerate(Powers power)
366 &AuraEffect::HandleNoImmediateEffect, //295 SPELL_AURA_MOD_PERIODIC_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonusTaken, Unit::SpellDamageBonusTaken
367 &AuraEffect::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
368 &AuraEffect::HandleAuraModRootAndDisableGravity, //297 SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY
369 &AuraEffect::HandleAuraModStunAndDisableGravity, //298 SPELL_AURA_MOD_STUN_DISABLE_GRAVITY
370 &AuraEffect::HandleUnused, //299 unused (4.3.4)
371 &AuraEffect::HandleNoImmediateEffect, //300 SPELL_AURA_SHARE_DAMAGE_PCT implemented in Unit::DealDamage
372 &AuraEffect::HandleNoImmediateEffect, //301 SPELL_AURA_SCHOOL_HEAL_ABSORB implemented in Unit::CalcHealAbsorb
373 &AuraEffect::HandleUnused, //302 unused (4.3.4)
374 &AuraEffect::HandleNoImmediateEffect, //303 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
375 &AuraEffect::HandleAuraModFakeInebriation, //304 SPELL_AURA_MOD_DRUNK
376 &AuraEffect::HandleAuraModIncreaseSpeed, //305 SPELL_AURA_MOD_MINIMUM_SPEED
377 &AuraEffect::HandleNoImmediateEffect, //306 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER implemented in Unit::GetUnitCriticalChance and Unit::GetUnitSpellCriticalChance
378 &AuraEffect::HandleNoImmediateEffect, //307 SPELL_AURA_CAST_WHILE_WALKING_BY_SPELL_LABEL implemented in Unit::CanCastSpellWhileMoving
379 &AuraEffect::HandleNoImmediateEffect, //308 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER_WITH_ABILITIES implemented in Unit::GetUnitSpellCriticalChance
380 &AuraEffect::HandleNULL, //309 SPELL_AURA_MOD_RESILIENCE
381 &AuraEffect::HandleNoImmediateEffect, //310 SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE implemented in Spell::CalculateDamageDone
382 &AuraEffect::HandleNULL, //311 SPELL_AURA_IGNORE_COMBAT
383 &AuraEffect::HandleNULL, //312 SPELL_AURA_ANIM_REPLACEMENT_SET implemented clientside
384 &AuraEffect::HandleNULL, //313 SPELL_AURA_MOUNT_ANIM_REPLACEMENT_SET implemented clientside
385 &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
386 &AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
387 &AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_SCHOOL_ABSORB_OVERKILL implemented in Unit::DealDamage()
388 &AuraEffect::HandleNULL, //317 SPELL_AURA_MOD_SPELL_POWER_PCT
389 &AuraEffect::HandleMastery, //318 SPELL_AURA_MASTERY
390 &AuraEffect::HandleModMeleeSpeedPct, //319 SPELL_AURA_MOD_MELEE_HASTE_3
391 &AuraEffect::HandleNULL, //320 SPELL_AURA_320
392 &AuraEffect::HandleAuraModNoActions, //321 SPELL_AURA_MOD_NO_ACTIONS
393 &AuraEffect::HandleNoImmediateEffect, //322 SPELL_AURA_INTERFERE_TARGETTING implemented in Spell::CheckCast
394 &AuraEffect::HandleUnused, //323 unused (4.3.4)
395 &AuraEffect::HandleNULL, //324 SPELL_AURA_OVERRIDE_UNLOCKED_AZERITE_ESSENCE_RANK
396 &AuraEffect::HandleUnused, //325 SPELL_AURA_LEARN_PVP_TALENT
397 &AuraEffect::HandlePhaseGroup, //326 SPELL_AURA_PHASE_GROUP
398 &AuraEffect::HandlePhaseAlwaysVisible, //327 SPELL_AURA_PHASE_ALWAYS_VISIBLE
399 &AuraEffect::HandleTriggerSpellOnPowerPercent, //328 SPELL_AURA_TRIGGER_SPELL_ON_POWER_PCT
400 &AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_POWER_GAIN_PCT
401 &AuraEffect::HandleNoImmediateEffect, //330 SPELL_AURA_CAST_WHILE_WALKING implemented in Unit::CanCastSpellWhileMoving
402 &AuraEffect::HandleAuraForceWeather, //331 SPELL_AURA_FORCE_WEATHER
403 &AuraEffect::HandleNoImmediateEffect, //332 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS implemented in Unit::GetCastSpellInfo
404 &AuraEffect::HandleNoImmediateEffect, //333 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_TRIGGERED implemented in Unit::GetCastSpellInfo
405 &AuraEffect::HandleNoImmediateEffect, //334 SPELL_AURA_MOD_AUTOATTACK_CRIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
406 &AuraEffect::HandleNULL, //335 SPELL_AURA_335
407 &AuraEffect::HandleMountRestrictions, //336 SPELL_AURA_MOUNT_RESTRICTIONS implemented in Unit::GetMountCapability
408 &AuraEffect::HandleNoImmediateEffect, //337 SPELL_AURA_MOD_VENDOR_ITEMS_PRICES
409 &AuraEffect::HandleNoImmediateEffect, //338 SPELL_AURA_MOD_DURABILITY_LOSS
410 &AuraEffect::HandleNoImmediateEffect, //339 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER_PET implemented in Unit::GetUnitCriticalChance and Unit::GetUnitSpellCriticalChance
411 &AuraEffect::HandleNULL, //340 SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER
412 &AuraEffect::HandleModSpellCategoryCooldown, //341 SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN
413 &AuraEffect::HandleModMeleeRangedSpeedPct, //342 SPELL_AURA_MOD_MELEE_RANGED_HASTE_2
414 &AuraEffect::HandleNoImmediateEffect, //343 SPELL_AURA_MOD_MELEE_DAMAGE_FROM_CASTER - Implemented in Unit::MeleeDamageBonusTaken
415 &AuraEffect::HandleNoImmediateEffect, //344 SPELL_AURA_MOD_AUTOATTACK_DAMAGE - Implemented in Unit::MeleeDamageBonusDone
416 &AuraEffect::HandleNoImmediateEffect, //345 SPELL_AURA_BYPASS_ARMOR_FOR_CASTER
417 &AuraEffect::HandleEnableAltPower, //346 SPELL_AURA_ENABLE_ALT_POWER
418 &AuraEffect::HandleNoImmediateEffect, //347 SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE implemented in SpellHistory::StartCooldown
419 &AuraEffect::HandleNoImmediateEffect, //348 SPELL_AURA_MOD_MONEY_GAIN implemented in WorldSession::HandleLootMoneyOpcode
420 &AuraEffect::HandleNoImmediateEffect, //349 SPELL_AURA_MOD_CURRENCY_GAIN implemented in Player::ModifyCurrency
421 &AuraEffect::HandleNULL, //350 SPELL_AURA_350
422 &AuraEffect::HandleNULL, //351 SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT
423 &AuraEffect::HandleNULL, //352 SPELL_AURA_352
424 &AuraEffect::HandleNULL, //353 SPELL_AURA_MOD_CAMOUFLAGE
425 &AuraEffect::HandleNoImmediateEffect, //354 SPELL_AURA_MOD_HEALING_DONE_PCT_VERSUS_TARGET_HEALTH implemented in Unit::SpellHealingPctDone
426 &AuraEffect::HandleNULL, //355 SPELL_AURA_MOD_CASTING_SPEED
427 &AuraEffect::HandleNoImmediateEffect, //356 SPELL_AURA_PROVIDE_TOTEM_CATEGORY implemented in Player::HasItemTotemCategory
428 &AuraEffect::HandleNULL, //357 SPELL_AURA_ENABLE_BOSS1_UNIT_FRAME
429 &AuraEffect::HandleNULL, //358 SPELL_AURA_358
430 &AuraEffect::HandleNoImmediateEffect, //359 SPELL_AURA_MOD_HEALING_DONE_VERSUS_AURASTATE implemented in Unit::SpellHealingPctDone
431 &AuraEffect::HandleNULL, //360 SPELL_AURA_PROC_TRIGGER_SPELL_COPY
432 &AuraEffect::HandleNoImmediateEffect, //361 SPELL_AURA_OVERRIDE_AUTOATTACK_WITH_MELEE_SPELL implemented in Unit::AttackerStateUpdate
433 &AuraEffect::HandleUnused, //362 unused (4.3.4)
434 &AuraEffect::HandleNULL, //363 SPELL_AURA_MOD_NEXT_SPELL
435 &AuraEffect::HandleUnused, //364 unused (4.3.4)
436 &AuraEffect::HandleNULL, //365 SPELL_AURA_MAX_FAR_CLIP_PLANE
437 &AuraEffect::HandleOverrideSpellPowerByAttackPower, //366 SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT
438 &AuraEffect::HandleNULL, //367 SPELL_AURA_OVERRIDE_AUTOATTACK_WITH_RANGED_SPELL
439 &AuraEffect::HandleUnused, //368 unused (4.3.4)
440 &AuraEffect::HandleNULL, //369 SPELL_AURA_ENABLE_POWER_BAR_TIMER
441 &AuraEffect::HandleNULL, //370 SPELL_AURA_SPELL_OVERRIDE_NAME_GROUP
443 &AuraEffect::HandleNULL, //372 SPELL_AURA_OVERRIDE_MOUNT_FROM_SET
444 &AuraEffect::HandleNULL, //373 SPELL_AURA_MOD_SPEED_NO_CONTROL
445 &AuraEffect::HandleNoImmediateEffect, //374 SPELL_AURA_MODIFY_FALL_DAMAGE_PCT implemented in Player::HandleFall
446 &AuraEffect::HandleNULL, //375 SPELL_AURA_HIDE_MODEL_AND_EQUIPEMENT_SLOTS implemented clientside
447 &AuraEffect::HandleNULL, //376 SPELL_AURA_MOD_CURRENCY_GAIN_FROM_SOURCE
448 &AuraEffect::HandleNoImmediateEffect, //377 SPELL_AURA_CAST_WHILE_WALKING_ALL implemented in Unit::CanCastSpellWhileMoving
449 &AuraEffect::HandleModPossessPet, //378 SPELL_AURA_MOD_POSSESS_PET
450 &AuraEffect::HandleModManaRegenPct, //379 SPELL_AURA_MOD_MANA_REGEN_PCT implemented in Player::UpdateManaRegen
452 &AuraEffect::HandleNULL, //381 SPELL_AURA_MOD_DAMAGE_TAKEN_FROM_CASTER_PET
453 &AuraEffect::HandleNULL, //382 SPELL_AURA_MOD_PET_STAT_PCT
454 &AuraEffect::HandleNoImmediateEffect, //383 SPELL_AURA_IGNORE_SPELL_COOLDOWN implemented in SpellHistory::HasCooldown
459 &AuraEffect::HandleNULL, //388 SPELL_AURA_MOD_TAXI_FLIGHT_SPEED
464 &AuraEffect::HandleNULL, //393 SPELL_AURA_BLOCK_SPELLS_IN_FRONT
465 &AuraEffect::HandleShowConfirmationPrompt, //394 SPELL_AURA_SHOW_CONFIRMATION_PROMPT
466 &AuraEffect::HandleCreateAreaTrigger, //395 SPELL_AURA_AREA_TRIGGER
467 &AuraEffect::HandleTriggerSpellOnPowerAmount, //396 SPELL_AURA_TRIGGER_SPELL_ON_POWER_AMOUNT
468 &AuraEffect::HandleBattlegroundPlayerPosition, //397 SPELL_AURA_BATTLEGROUND_PLAYER_POSITION_FACTIONAL
469 &AuraEffect::HandleBattlegroundPlayerPosition, //398 SPELL_AURA_BATTLEGROUND_PLAYER_POSITION
470 &AuraEffect::HandleNULL, //399 SPELL_AURA_MOD_TIME_RATE
471 &AuraEffect::HandleAuraModSkill, //400 SPELL_AURA_MOD_SKILL_2
473 &AuraEffect::HandleAuraModOverridePowerDisplay, //402 SPELL_AURA_MOD_OVERRIDE_POWER_DISPLAY
474 &AuraEffect::HandleNoImmediateEffect, //403 SPELL_AURA_OVERRIDE_SPELL_VISUAL implemented in Unit::GetCastSpellXSpellVisualId
475 &AuraEffect::HandleOverrideAttackPowerBySpellPower, //404 SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT
476 &AuraEffect::HandleModRatingPct, //405 SPELL_AURA_MOD_RATING_PCT
477 &AuraEffect::HandleNoImmediateEffect, //406 SPELL_AURA_KEYBOUND_OVERRIDE implemented in WorldSession::HandleKeyboundOverride
478 &AuraEffect::HandleNULL, //407 SPELL_AURA_MOD_FEAR_2
479 &AuraEffect::HandleUnused, //408 SPELL_AURA_SET_ACTION_BUTTON_SPELL_COUNT clientside
480 &AuraEffect::HandleAuraCanTurnWhileFalling, //409 SPELL_AURA_CAN_TURN_WHILE_FALLING
482 &AuraEffect::HandleNoImmediateEffect, //411 SPELL_AURA_MOD_MAX_CHARGES implemented in SpellHistory::GetMaxCharges
484 &AuraEffect::HandleNULL, //413 SPELL_AURA_MOD_RANGED_ATTACK_DEFLECT_CHANCE
485 &AuraEffect::HandleNULL, //414 SPELL_AURA_MOD_RANGED_ATTACK_BLOCK_CHANCE_IN_FRONT
487 &AuraEffect::HandleNoImmediateEffect, //416 SPELL_AURA_MOD_COOLDOWN_BY_HASTE_REGEN implemented in SpellHistory::StartCooldown
488 &AuraEffect::HandleNoImmediateEffect, //417 SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN implemented in Spell::TriggerGlobalCooldown
489 &AuraEffect::HandleAuraModMaxPower, //418 SPELL_AURA_MOD_MAX_POWER
490 &AuraEffect::HandleAuraModIncreaseBaseManaPercent, //419 SPELL_AURA_MOD_BASE_MANA_PCT
491 &AuraEffect::HandleNoImmediateEffect, //420 SPELL_AURA_MOD_BATTLE_PET_XP_PCT - Implemented in BattlePetMgr::GrantBattlePetExperience
492 &AuraEffect::HandleNULL, //421 SPELL_AURA_MOD_ABSORB_EFFECTS_DONE_PCT
493 &AuraEffect::HandleNULL, //422 SPELL_AURA_MOD_ABSORB_EFFECTS_TAKEN_PCT
494 &AuraEffect::HandleModManaCostPct, //423 SPELL_AURA_MOD_MANA_COST_PCT
495 &AuraEffect::HandleNULL, //424 SPELL_AURA_CASTER_IGNORE_LOS
498 &AuraEffect::HandleNULL, //427 SPELL_AURA_SCALE_PLAYER_LEVEL
499 &AuraEffect::HandleLinkedSummon, //428 SPELL_AURA_LINKED_SUMMON
500 &AuraEffect::HandleNULL, //429 SPELL_AURA_MOD_SUMMON_DAMAGE
501 &AuraEffect::HandlePlayScene, //430 SPELL_AURA_PLAY_SCENE
502 &AuraEffect::HandleModOverrideZonePVPType, //431 SPELL_AURA_MOD_OVERRIDE_ZONE_PVP_TYPE
507 &AuraEffect::HandleNoImmediateEffect, //436 SPELL_AURA_MOD_ENVIRONMENTAL_DAMAGE_TAKEN implemented in Player::EnvironmentalDamage
508 &AuraEffect::HandleAuraModMinimumSpeedRate, //437 SPELL_AURA_MOD_MINIMUM_SPEED_RATE
509 &AuraEffect::HandleNULL, //438 SPELL_AURA_PRELOAD_PHASE
511 &AuraEffect::HandleNULL, //440 SPELL_AURA_MOD_MULTISTRIKE_DAMAGE
512 &AuraEffect::HandleNULL, //441 SPELL_AURA_MOD_MULTISTRIKE_CHANCE
513 &AuraEffect::HandleNULL, //442 SPELL_AURA_MOD_READINESS
514 &AuraEffect::HandleNULL, //443 SPELL_AURA_MOD_LEECH
518 &AuraEffect::HandleNoImmediateEffect, //447 SPELL_AURA_MOD_XP_FROM_CREATURE_TYPE implemented in KillRewarder::_RewardXP
522 &AuraEffect::HandleOverridePetSpecs, //451 SPELL_AURA_OVERRIDE_PET_SPECS
524 &AuraEffect::HandleNoImmediateEffect, //453 SPELL_AURA_CHARGE_RECOVERY_MOD implemented in SpellHistory::GetChargeRecoveryTime
525 &AuraEffect::HandleNoImmediateEffect, //454 SPELL_AURA_CHARGE_RECOVERY_MULTIPLIER implemented in SpellHistory::GetChargeRecoveryTime
526 &AuraEffect::HandleAuraModRoot, //455 SPELL_AURA_MOD_ROOT_2
527 &AuraEffect::HandleNoImmediateEffect, //456 SPELL_AURA_CHARGE_RECOVERY_AFFECTED_BY_HASTE implemented in SpellHistory::GetChargeRecoveryTime
528 &AuraEffect::HandleNoImmediateEffect, //457 SPELL_AURA_CHARGE_RECOVERY_AFFECTED_BY_HASTE_REGEN implemented in SpellHistory::GetChargeRecoveryTime
529 &AuraEffect::HandleNoImmediateEffect, //458 SPELL_AURA_IGNORE_DUAL_WIELD_HIT_PENALTY implemented in Unit::MeleeSpellMissChance
530 &AuraEffect::HandleIgnoreMovementForces, //459 SPELL_AURA_IGNORE_MOVEMENT_FORCES
531 &AuraEffect::HandleNULL, //460 SPELL_AURA_RESET_COOLDOWNS_ON_DUEL_START
533 &AuraEffect::HandleNULL, //462 SPELL_AURA_MOD_HEALING_AND_ABSORB_FROM_CASTER
534 &AuraEffect::HandleNULL, //463 SPELL_AURA_CONVERT_CRIT_RATING_PCT_TO_PARRY_RATING used by Riposte
535 &AuraEffect::HandleNULL, //464 SPELL_AURA_MOD_ATTACK_POWER_OF_BONUS_ARMOR
536 &AuraEffect::HandleModBonusArmor, //465 SPELL_AURA_MOD_BONUS_ARMOR
537 &AuraEffect::HandleModBonusArmorPercent, //466 SPELL_AURA_MOD_BONUS_ARMOR_PCT
538 &AuraEffect::HandleModStatBonusPercent, //467 SPELL_AURA_MOD_STAT_BONUS_PCT
539 &AuraEffect::HandleTriggerSpellOnHealthPercent, //468 SPELL_AURA_TRIGGER_SPELL_ON_HEALTH_PCT
540 &AuraEffect::HandleShowConfirmationPrompt, //469 SPELL_AURA_SHOW_CONFIRMATION_PROMPT_WITH_DIFFICULTY
541 &AuraEffect::HandleNULL, //470 SPELL_AURA_MOD_AURA_TIME_RATE_BY_SPELL_LABEL
542 &AuraEffect::HandleModVersatilityByPct, //471 SPELL_AURA_MOD_VERSATILITY
544 &AuraEffect::HandleNoImmediateEffect, //473 SPELL_AURA_PREVENT_DURABILITY_LOSS_FROM_COMBAT implemented in Player::DurabilityPointLossForEquipSlot
545 &AuraEffect::HandleNULL, //474 SPELL_AURA_REPLACE_ITEM_BONUS_TREE
546 &AuraEffect::HandleAllowUsingGameobjectsWhileMounted, //475 SPELL_AURA_ALLOW_USING_GAMEOBJECTS_WHILE_MOUNTED
547 &AuraEffect::HandleNULL, //476 SPELL_AURA_MOD_CURRENCY_GAIN_LOOTED
551 &AuraEffect::HandleNULL, //480 SPELL_AURA_MOD_ARTIFACT_ITEM_LEVEL
552 &AuraEffect::HandleNoImmediateEffect, //481 SPELL_AURA_CONVERT_CONSUMED_RUNE implemented in Spell::TakeRunePower
554 &AuraEffect::HandleNULL, //483 SPELL_AURA_SUPPRESS_TRANSFORMS
555 &AuraEffect::HandleNULL, //484 SPELL_AURA_ALLOW_INTERRUPT_SPELL
556 &AuraEffect::HandleModMovementForceMagnitude, //485 SPELL_AURA_MOD_MOVEMENT_FORCE_MAGNITUDE
558 &AuraEffect::HandleCosmeticMounted, //487 SPELL_AURA_COSMETIC_MOUNTED
560 &AuraEffect::HandleModAlternativeDefaultLanguage, //489 SPELL_AURA_MOD_ALTERNATIVE_DEFAULT_LANGUAGE
565 &AuraEffect::HandleNULL, //494 SPELL_AURA_SET_POWER_POINT_CHARGE
566 &AuraEffect::HandleTriggerSpellOnExpire, //495 SPELL_AURA_TRIGGER_SPELL_ON_EXPIRE
567 &AuraEffect::HandleNULL, //496 SPELL_AURA_ALLOW_CHANGING_EQUIPMENT_IN_TORGHAST
568 &AuraEffect::HandleNULL, //497 SPELL_AURA_MOD_ANIMA_GAIN
569 &AuraEffect::HandleNULL, //498 SPELL_AURA_CURRENCY_LOSS_PCT_ON_DEATH
570 &AuraEffect::HandleNULL, //499 SPELL_AURA_MOD_RESTED_XP_CONSUMPTION
571 &AuraEffect::HandleNULL, //500 SPELL_AURA_IGNORE_SPELL_CHARGE_COOLDOWN
572 &AuraEffect::HandleNULL, //501 SPELL_AURA_MOD_CRITICAL_DAMAGE_TAKEN_FROM_CASTER
573 &AuraEffect::HandleNULL, //502 SPELL_AURA_MOD_VERSATILITY_DAMAGE_DONE_BENEFIT
574 &AuraEffect::HandleNULL, //503 SPELL_AURA_MOD_VERSATILITY_HEALING_DONE_BENEFIT
575 &AuraEffect::HandleNoImmediateEffect, //504 SPELL_AURA_MOD_HEALING_TAKEN_FROM_CASTER implemented in Unit::SpellHealingBonusTaken
576 &AuraEffect::HandleNULL, //505 SPELL_AURA_MOD_PLAYER_CHOICE_REROLLS
577 &AuraEffect::HandleDisableInertia, //506 SPELL_AURA_DISABLE_INERTIA
578 &AuraEffect::HandleNoImmediateEffect, //507 SPELL_AURA_MOD_DAMAGE_TAKEN_FROM_CASTER_BY_LABEL implemented in Unit::SpellDamageBonusTaken
581 &AuraEffect::HandleNULL, //510 SPELL_AURA_MODIFIED_RAID_INSTANCE
582 &AuraEffect::HandleNULL, //511 SPELL_AURA_APPLY_PROFESSION_EFFECT
590 &AuraEffect::HandleNULL, //519 SPELL_AURA_MOD_COOLDOWN_RECOVERY_RATE_ALL
596 &AuraEffect::HandleNULL, //525 SPELL_AURA_DISPLAY_PROFESSION_EQUIPMENT
599 &AuraEffect::HandleNULL, //528 SPELL_AURA_ALLOW_BLOCKING_SPELLS
600 &AuraEffect::HandleNULL, //529 SPELL_AURA_MOD_SPELL_BLOCK_CHANCE
604 &AuraEffect::HandleNULL, //533 SPELL_AURA_DISABLE_NAVIGATION
607 &AuraEffect::HandleNoImmediateEffect, //536 SPELL_AURA_IGNORE_SPELL_CREATURE_TYPE_REQUIREMENTS implemented in SpellInfo::CheckTargetCreatureType
609 &AuraEffect::HandleUnused, //538 SPELL_AURA_MOD_FAKE_INEBRIATION_MOVEMENT_ONLY handled clientside
610 &AuraEffect::HandleNoImmediateEffect, //539 SPELL_AURA_ALLOW_MOUNT_IN_COMBAT implemented in SpellInfo::CanBeUsedInCombat
611 &AuraEffect::HandleNULL, //540 SPELL_AURA_MOD_SUPPORT_STAT
612 &AuraEffect::HandleModRequiredMountCapabilityFlags, //541 SPELL_AURA_MOD_REQUIRED_MOUNT_CAPABILITY_FLAGS
616};
617
618AuraEffect::AuraEffect(Aura* base, SpellEffectInfo const& spellEfffectInfo, int32 const* baseAmount, Unit* caster) :
619m_base(base), m_spellInfo(base->GetSpellInfo()), m_effectInfo(spellEfffectInfo), m_spellmod(nullptr),
620m_baseAmount(baseAmount ? *baseAmount : spellEfffectInfo.CalcBaseValue(caster, base->GetType() == UNIT_AURA_TYPE ? base->GetOwner()->ToUnit() : nullptr, base->GetCastItemId(), base->GetCastItemLevel())),
621_amount(), _periodicTimer(0), _period(0), _ticksDone(0),
622m_canBeRecalculated(true), m_isPeriodic(false)
623{
624 CalculatePeriodic(caster, true, false);
625
626 _amount = CalculateAmount(caster);
627
629}
630
632{
633 delete m_spellmod;
634}
635
636template <typename Container>
637void AuraEffect::GetTargetList(Container& targetContainer) const
638{
639 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
640 // remove all targets which were not added to new list - they no longer deserve area aura
641 for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
642 {
643 if (appIter->second->HasEffect(GetEffIndex()))
644 targetContainer.push_back(appIter->second->GetTarget());
645 }
646}
647
648template <typename Container>
649void AuraEffect::GetApplicationList(Container& applicationContainer) const
650{
651 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
652 for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
653 {
654 if (appIter->second->HasEffect(GetEffIndex()))
655 applicationContainer.push_back(appIter->second);
656 }
657}
658
660{
661 // default amount calculation
662 int32 amount = 0;
663
665 amount = GetSpellEffectInfo().CalcValue(caster, &m_baseAmount, GetBase()->GetOwner()->ToUnit(), nullptr, GetBase()->GetCastItemId(), GetBase()->GetCastItemLevel());
666 else if (caster && caster->GetTypeId() == TYPEID_PLAYER)
667 amount = int32(caster->ToPlayer()->m_activePlayerData->Mastery * GetSpellEffectInfo().BonusCoefficient);
668
669 // custom amount calculations go here
670 switch (GetAuraType())
671 {
672 // crowd control auras
679 m_canBeRecalculated = false;
681 break;
682 amount = int32(GetBase()->GetUnitOwner()->CountPctFromMaxHealth(10));
683 break;
686 m_canBeRecalculated = false;
687 break;
689 {
690 uint32 mountType = uint32(GetMiscValueB());
691 if (MountEntry const* mountEntry = sDB2Manager.GetMount(GetId()))
692 mountType = mountEntry->MountTypeID;
693
694 if (MountCapabilityEntry const* mountCapability = GetBase()->GetUnitOwner()->GetMountCapability(mountType))
695 amount = mountCapability->ID;
696 break;
697 }
699 if (caster)
700 amount = caster->GetMap()->GetDifficultyID();
701 m_canBeRecalculated = false;
702 break;
703 default:
704 break;
705 }
706
707 if (GetSpellInfo()->HasAttribute(SPELL_ATTR10_ROLLING_PERIODIC))
708 {
710 amount = std::accumulate(std::begin(periodicAuras), std::end(periodicAuras), amount, [this](int32 val, AuraEffect const* aurEff)
711 {
712 if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex() && aurEff->GetTotalTicks() > 0)
713 val += aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks()) / static_cast<int32>(aurEff->GetTotalTicks());
714 return val;
715 });
716 }
717
720 amount *= GetBase()->GetStackAmount();
721
723
724 return amount;
725}
726
727Optional<float> AuraEffect::CalculateEstimatedAmount(Unit const* caster, Unit* target, SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo,
728 int32 amount, uint8 stack, AuraEffect const* aurEff)
729{
730 uint32 stackAmountForBonuses = !spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes::SuppressPointsStacking) ? stack : 1;
731
732 switch (spellEffectInfo.ApplyAuraName)
733 {
736 return caster->SpellDamageBonusDone(target, spellInfo, amount, DOT, spellEffectInfo, stackAmountForBonuses, nullptr, aurEff);
738 return caster->SpellHealingBonusDone(target, spellInfo, amount, DOT, spellEffectInfo, stackAmountForBonuses, nullptr, aurEff);
739 default:
740 break;
741 }
742
743 return {};
744}
745
747{
748 if (!caster || GetBase()->GetType() != UNIT_AURA_TYPE)
749 return {};
750
752}
753
754float AuraEffect::CalculateEstimatedfTotalPeriodicAmount(Unit* caster, Unit* target, SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo,
755 float amount, uint8 stack)
756{
757 int32 maxDuration = Aura::CalcMaxDuration(spellInfo, caster, nullptr);
758 if (maxDuration <= 0)
759 return 0.0f;
760
761 int32 period = spellEffectInfo.ApplyAuraPeriod;
762 if (!period)
763 return 0.0f;
764
765 if (Player* modOwner = caster->GetSpellModOwner())
766 modOwner->ApplySpellMod(spellInfo, SpellModOp::Period, period);
767
768 // Haste modifies periodic time of channeled spells
769 if (spellInfo->IsChanneled())
770 caster->ModSpellDurationTime(spellInfo, period);
772 period = int32(period * caster->m_unitData->ModCastingSpeed);
774 period = int32(period * caster->m_unitData->ModHaste);
775
776 if (!period)
777 return 0.0f;
778
779 float totalTicks = float(maxDuration) / period;
781 totalTicks += 1.0f;
782
783 return totalTicks * CalculateEstimatedAmount(caster, target, spellInfo, spellEffectInfo, amount, stack, nullptr).value_or(amount);
784}
785
787{
788 uint32 totalTicks = 0;
789 if (_period && !GetBase()->IsPermanent())
790 {
791 totalTicks = static_cast<uint32>(GetBase()->GetMaxDuration() / _period);
793 ++totalTicks;
794 }
795
796 return totalTicks;
797}
798
799void AuraEffect::ResetPeriodic(bool resetPeriodicTimer /*= false*/)
800{
801 _ticksDone = 0;
802 if (resetPeriodicTimer)
803 {
804 _periodicTimer = 0;
805 // Start periodic on next tick or at aura apply
808 }
809}
810
811void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= true*/, bool load /*= false*/)
812{
814
815 // prepare periodics
816 switch (GetAuraType())
817 {
832 m_isPeriodic = true;
833 break;
834 default:
835 break;
836 }
837
839
840 if (!m_isPeriodic)
841 return;
842
843 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
844 // Apply casting time mods
845 if (_period)
846 {
847 // Apply periodic time mod
848 if (modOwner)
850
851 if (caster)
852 {
853 // Haste modifies periodic time of channeled spells
857 _period = int32(_period * caster->m_unitData->ModCastingSpeed);
859 _period = int32(_period * caster->m_unitData->ModHaste);
860 }
861 }
862 else // prevent infinite loop on Update
863 m_isPeriodic = false;
864
865 if (load) // aura loaded from db
866 {
867 if (_period && !GetBase()->IsPermanent())
868 {
869 uint32 elapsedTime = GetBase()->GetMaxDuration() - GetBase()->GetDuration();
870 _ticksDone = elapsedTime / uint32(_period);
871 _periodicTimer = elapsedTime % uint32(_period);
872 }
873
875 ++_ticksDone;
876 }
877 else // aura just created or reapplied
878 {
879 // reset periodic timer on aura create or reapply
880 // we don't reset periodic timers when aura is triggered by proc
881 ResetPeriodic(resetPeriodicTimer);
882 }
883}
884
886{
887 switch (GetAuraType())
888 {
891 if (!m_spellmod)
892 {
894 spellmod->op = SpellModOp(GetMiscValue());
895
897 spellmod->spellId = GetId();
899 m_spellmod = spellmod;
900 }
901 static_cast<SpellModifierByClassMask*>(m_spellmod)->value = GetAmount();
902 break;
904 if (!m_spellmod)
905 {
907 spellmod->op = SpellModOp(GetMiscValue());
908
909 spellmod->type = SPELLMOD_LABEL_FLAT;
910 spellmod->spellId = GetId();
911 spellmod->value.ModIndex = GetMiscValue();
912 spellmod->value.LabelID = GetMiscValueB();
913 m_spellmod = spellmod;
914 }
915 static_cast<SpellFlatModifierByLabel*>(m_spellmod)->value.ModifierValue = GetAmount();
916 break;
918 if (!m_spellmod)
919 {
921 spellmod->op = SpellModOp(GetMiscValue());
922
923 spellmod->type = SPELLMOD_LABEL_PCT;
924 spellmod->spellId = GetId();
925 spellmod->value.ModIndex = GetMiscValue();
926 spellmod->value.LabelID = GetMiscValueB();
927 m_spellmod = spellmod;
928 }
929 static_cast<SpellPctModifierByLabel*>(m_spellmod)->value.ModifierValue = 1.0f + CalculatePct(1.0f, GetAmount());
930 break;
931 default:
932 break;
933 }
935}
936
937void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply, AuraEffect const* triggeredBy /* = nullptr */)
938{
939 // Reapply if amount change
940 uint8 handleMask = 0;
941 if (newAmount != GetAmount())
943 if (onStackOrReapply)
944 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
945
946 if (!handleMask)
947 return;
948
949 std::vector<AuraApplication*> effectApplications;
950 GetApplicationList(effectApplications);
951
952 for (AuraApplication* aurApp : effectApplications)
953 {
954 aurApp->GetTarget()->_RegisterAuraEffect(this, false);
955 HandleEffect(aurApp, handleMask, false, triggeredBy);
956 }
957
958 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
959 {
960 if (!mark)
961 _amount = newAmount;
962 else
963 SetAmount(newAmount);
965 }
966
967 for (AuraApplication* aurApp : effectApplications)
968 {
969 if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
970 continue;
971
972 aurApp->GetTarget()->_RegisterAuraEffect(this, true);
973 HandleEffect(aurApp, handleMask, true, triggeredBy);
974 }
975
978}
979
980void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply, AuraEffect const* triggeredBy /*= nullptr*/)
981{
982 // check if call is correct, we really don't want using bitmasks here (with 1 exception)
986 || mode == AURA_EFFECT_HANDLE_STAT
987 || mode == AURA_EFFECT_HANDLE_SKILL
990
991 // register/unregister effect in lists in case of real AuraEffect apply/remove
992 // registration/unregistration is done always before real effect handling (some effect handlers code is depending on this)
993 if (mode & AURA_EFFECT_HANDLE_REAL)
994 aurApp->GetTarget()->_RegisterAuraEffect(this, apply);
995
996 // real aura apply/remove, handle modifier
998 ApplySpellMod(aurApp->GetTarget(), apply, triggeredBy);
999
1000 // call scripts helping/replacing effect handlers
1001 bool prevented = false;
1002 if (apply)
1003 prevented = GetBase()->CallScriptEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);
1004 else
1005 prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
1006
1007 // check if script events have removed the aura already
1008 if (apply && aurApp->GetRemoveMode())
1009 return;
1010
1011 // call default effect handler if it wasn't prevented
1012 if (!prevented)
1013 (*this.*AuraEffectHandler[GetAuraType()].Value)(aurApp, mode, apply);
1014
1015 // check if the default handler reemoved the aura
1016 if (apply && aurApp->GetRemoveMode())
1017 return;
1018
1019 // call scripts triggering additional events after apply/remove
1020 if (apply)
1022 else
1024}
1025
1026void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply, AuraEffect const* triggeredBy /*= nullptr*/)
1027{
1028 AuraApplication* aurApp = GetBase()->GetApplicationOfTarget(target->GetGUID());
1029 ASSERT(aurApp);
1030 HandleEffect(aurApp, mode, apply, triggeredBy);
1031}
1032
1033void AuraEffect::ApplySpellMod(Unit* target, bool apply, AuraEffect const* triggeredBy /*= nullptr*/)
1034{
1035 if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
1036 return;
1037
1038 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
1039
1040 // Auras with charges do not mod amount of passive auras
1041 if (GetBase()->IsUsingCharges())
1042 return;
1043
1044 // reapply some passive spells after add/remove related spellmods
1045 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
1046 std::bitset<MAX_SPELL_EFFECTS> recalculateEffectMask;
1047 switch (SpellModOp(GetMiscValue()))
1048 {
1049 case SpellModOp::Points:
1050 recalculateEffectMask.set();
1051 break;
1053 recalculateEffectMask.set(EFFECT_0);
1054 break;
1056 recalculateEffectMask.set(EFFECT_1);
1057 break;
1059 recalculateEffectMask.set(EFFECT_2);
1060 break;
1062 recalculateEffectMask.set(EFFECT_3);
1063 break;
1065 recalculateEffectMask.set(EFFECT_4);
1066 break;
1067 default:
1068 break;
1069 }
1070
1071 if (recalculateEffectMask.any())
1072 {
1073 if (!triggeredBy)
1074 triggeredBy = this;
1075
1076 ObjectGuid guid = target->GetGUID();
1077 Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
1078 for (auto iter = auras.begin(); iter != auras.end(); ++iter)
1079 {
1080 Aura* aura = iter->second->GetBase();
1081 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
1082 // if aura is cast by others, it will not be affected
1083 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
1084 for (size_t i = 0; i < recalculateEffectMask.size(); ++i)
1085 if (recalculateEffectMask[i])
1086 if (AuraEffect* aurEff = aura->GetEffect(i))
1087 if (aurEff != triggeredBy)
1088 aurEff->RecalculateAmount(triggeredBy);
1089 }
1090 }
1091}
1092
1093void AuraEffect::Update(uint32 diff, Unit* caster)
1094{
1095 if (!m_isPeriodic || (GetBase()->GetDuration() < 0 && !GetBase()->IsPassive() && !GetBase()->IsPermanent()))
1096 return;
1097
1098 uint32 totalTicks = GetTotalTicks();
1099
1100 _periodicTimer += diff;
1101 while (_periodicTimer >= _period)
1102 {
1104
1105 if (!GetBase()->IsPermanent() && (_ticksDone + 1) > totalTicks)
1106 break;
1107
1108 ++_ticksDone;
1109
1111
1112 std::vector<AuraApplication*> effectApplications;
1113 GetApplicationList(effectApplications);
1114
1115 // tick on targets of effects
1116 for (AuraApplication* aurApp : effectApplications)
1117 PeriodicTick(aurApp, caster);
1118 }
1119}
1120
1121float AuraEffect::GetCritChanceFor(Unit const* caster, Unit const* target) const
1122{
1123 return target->SpellCritChanceTaken(caster, nullptr, this, GetSpellInfo()->GetSchoolMask(), CalcPeriodicCritChance(caster), GetSpellInfo()->GetAttackType());
1124}
1125
1127{
1128 if (!spell)
1129 return false;
1130
1131 // Check family name and EffectClassMask
1132 if (!spell->IsAffected(m_spellInfo->SpellFamilyName, GetSpellEffectInfo().SpellClassMask))
1133 return false;
1134
1135 return true;
1136}
1137
1138void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const
1139{
1140 if (caster)
1141 caster->SendSpellDamageImmune(target, m_spellInfo->Id, true);
1142}
1143
1145{
1146 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1147 if (prevented)
1148 return;
1149
1150 Unit* target = aurApp->GetTarget();
1151
1152 // Update serverside orientation of tracking channeled auras on periodic update ticks
1153 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1154 if (caster && !caster->IsPlayer() && m_spellInfo->IsChanneled() && m_spellInfo->HasAttribute(SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL) && caster->m_unitData->ChannelObjects.size())
1155 {
1156 ObjectGuid const channelGuid = caster->m_unitData->ChannelObjects[0];
1157 if (channelGuid != caster->GetGUID())
1158 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1159 caster->SetInFront(objectTarget);
1160 }
1161
1162 switch (GetAuraType())
1163 {
1165 // handled via scripts
1166 break;
1168 HandlePeriodicTriggerSpellAuraTick(target, caster);
1169 break;
1171 // Don't actually do anything - client will trigger casts of these spells by itself
1172 break;
1175 break;
1179 HandlePeriodicDamageAurasTick(target, caster);
1180 break;
1182 HandlePeriodicHealthLeechAuraTick(target, caster);
1183 break;
1185 HandlePeriodicHealthFunnelAuraTick(target, caster);
1186 break;
1189 HandlePeriodicHealAurasTick(target, caster);
1190 break;
1192 HandlePeriodicManaLeechAuraTick(target, caster);
1193 break;
1195 HandleObsModPowerAuraTick(target, caster);
1196 break;
1198 HandlePeriodicEnergizeAuraTick(target, caster);
1199 break;
1201 HandlePeriodicPowerBurnAuraTick(target, caster);
1202 break;
1203 default:
1204 break;
1205 }
1206}
1207
1209{
1210 bool result = GetBase()->CallScriptCheckEffectProcHandlers(this, aurApp, eventInfo);
1211 if (!result)
1212 return false;
1213
1214 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1215 switch (GetAuraType())
1216 {
1222 {
1223 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1224 if (!damageInfo || !damageInfo->GetDamage())
1225 return false;
1226
1227 // Spell own damage at apply won't break CC
1228 if (spellInfo && spellInfo == GetSpellInfo())
1229 {
1230 Aura* aura = GetBase();
1231 // called from spellcast, should not have ticked yet
1232 if (aura->GetDuration() == aura->GetMaxDuration())
1233 return false;
1234 }
1235 break;
1236 }
1239 // compare mechanic
1240 if (!spellInfo || !(spellInfo->GetAllEffectsMechanicMask() & (UI64LIT(1) << GetMiscValue())))
1241 return false;
1242 break;
1244 // skip melee hits and instant cast spells
1245 if (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->GetCastTime())
1246 return false;
1247 break;
1250 // Compare casters
1251 if (GetCasterGUID() != eventInfo.GetActor()->GetGUID())
1252 return false;
1253 break;
1256 {
1257 // Skip melee hits and spells with wrong school or zero cost
1258 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()) // School Check
1259 || !eventInfo.GetProcSpell())
1260 return false;
1261
1262 // Costs Check
1263 std::vector<SpellPowerCost> const& costs = eventInfo.GetProcSpell()->GetPowerCost();
1264 auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Amount > 0; });
1265 if (m == costs.end())
1266 return false;
1267 break;
1268 }
1270 // Skip melee hits and spells with wrong school
1271 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()))
1272 return false;
1273 break;
1276 {
1277 // Don't proc extra attacks while already processing extra attack spell
1278 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
1279 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
1280 {
1281 if (triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
1282 {
1283 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
1284
1285 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
1286 if (lastExtraAttackSpell == triggerSpellId)
1287 return false;
1288 }
1289 }
1290 break;
1291 }
1293 // skip spells that can't crit
1294 if (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
1295 return false;
1296 break;
1297 default:
1298 break;
1299 }
1300
1301 return result;
1302}
1303
1305{
1306 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1307 if (prevented)
1308 return;
1309
1310 switch (GetAuraType())
1311 {
1312 // CC Auras which use their amount to drop
1313 // Are there any more auras which need this?
1320 HandleBreakableCCAuraProc(aurApp, eventInfo);
1321 break;
1322 case SPELL_AURA_DUMMY:
1324 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1325 break;
1327 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1328 break;
1330 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1331 break;
1332 default:
1333 break;
1334 }
1335
1336 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1337}
1338
1340{
1341 uint32 spellId = 0;
1342 uint32 spellId2 = 0;
1343 uint32 spellId3 = 0;
1344 uint32 spellId4 = 0;
1345
1346 switch (GetMiscValue())
1347 {
1348 case FORM_CAT_FORM:
1349 spellId = 3025;
1350 spellId2 = 48629;
1351 spellId3 = 106840;
1352 spellId4 = 113636;
1353 break;
1354 case FORM_TREE_OF_LIFE:
1355 spellId = 5420;
1356 spellId2 = 81097;
1357 break;
1358 case FORM_TRAVEL_FORM:
1359 spellId = 5419;
1360 break;
1361 case FORM_AQUATIC_FORM:
1362 spellId = 5421;
1363 break;
1364 case FORM_BEAR_FORM:
1365 spellId = 1178;
1366 spellId2 = 21178;
1367 spellId3 = 106829;
1368 spellId4 = 106899;
1369 break;
1370 case FORM_FLIGHT_FORM:
1371 spellId = 33948;
1372 spellId2 = 34764;
1373 break;
1375 spellId = 40122;
1376 spellId2 = 40121;
1377 break;
1379 spellId = 27792;
1380 spellId2 = 27795;
1381 spellId3 = 62371;
1382 break;
1383 case FORM_SHADOWFORM:
1384 if (target->HasAura(107906)) // Glyph of Shadow
1385 spellId = 107904;
1386 else if (target->HasAura(126745)) // Glyph of Shadowy Friends
1387 spellId = 142024;
1388 else
1389 spellId = 107903;
1390 break;
1391 case FORM_GHOST_WOLF:
1392 if (target->HasAura(58135)) // Glyph of Spectral Wolf
1393 spellId = 160942;
1394 break;
1395 case FORM_GHOUL:
1396 case FORM_AMBIENT:
1397 case FORM_STEALTH:
1398 case FORM_BATTLE_STANCE:
1401 case FORM_MOONKIN_FORM:
1402 case FORM_METAMORPHOSIS:
1403 break;
1404 default:
1405 break;
1406 }
1407
1408 if (apply)
1409 {
1410 if (spellId)
1411 target->CastSpell(target, spellId, this);
1412
1413 if (spellId2)
1414 target->CastSpell(target, spellId2, this);
1415
1416 if (spellId3)
1417 target->CastSpell(target, spellId3, this);
1418
1419 if (spellId4)
1420 target->CastSpell(target, spellId4, this);
1421
1422 if (target->GetTypeId() == TYPEID_PLAYER)
1423 {
1424 Player* plrTarget = target->ToPlayer();
1425
1426 PlayerSpellMap const& sp_list = plrTarget->GetSpellMap();
1427 for (auto itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1428 {
1429 if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled)
1430 continue;
1431
1432 if (itr->first == spellId || itr->first == spellId2 || itr->first == spellId3 || itr->first == spellId4)
1433 continue;
1434
1435 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first, DIFFICULTY_NONE);
1436 if (!spellInfo || !(spellInfo->IsPassive() || spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY_SPELLBOOK_AURA_ICON_COMBAT_LOG)))
1437 continue;
1438
1439 if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1440 target->CastSpell(target, itr->first, this);
1441 }
1442 }
1443 }
1444 else
1445 {
1446 if (spellId)
1447 target->RemoveOwnedAura(spellId, target->GetGUID());
1448 if (spellId2)
1449 target->RemoveOwnedAura(spellId2, target->GetGUID());
1450 if (spellId3)
1451 target->RemoveOwnedAura(spellId3, target->GetGUID());
1452 if (spellId4)
1453 target->RemoveOwnedAura(spellId4, target->GetGUID());
1454
1456 AuraEffect const* newAura = nullptr;
1457 // 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
1458 for (AuraEffect const* aurEff : shapeshifts)
1459 {
1460 if (aurEff != this)
1461 {
1462 newAura = aurEff;
1463 break;
1464 }
1465 }
1466
1467 Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1468 for (auto itr = tAuras.begin(); itr != tAuras.end();)
1469 {
1470 // Use the new aura to see on what stance the target will be
1471 uint64 newStance = newAura ? (UI64LIT(1) << (newAura->GetMiscValue() - 1)) : 0;
1472
1473 // If the stances are not compatible with the spell, remove it
1474 if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance))
1475 target->RemoveAura(itr);
1476 else
1477 ++itr;
1478 }
1479 }
1480}
1481
1482/*********************************************************/
1483/*** AURA EFFECT HANDLERS ***/
1484/*********************************************************/
1485
1486/**************************************/
1487/*** VISIBILITY & PHASES ***/
1488/**************************************/
1489
1491{
1493 return;
1494
1495 Unit* target = aurApp->GetTarget();
1497
1498 if (apply)
1499 {
1500 target->m_invisibilityDetect.AddFlag(type);
1501 target->m_invisibilityDetect.AddValue(type, GetAmount());
1502 }
1503 else
1504 {
1506 target->m_invisibilityDetect.DelFlag(type);
1507
1508 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1509 }
1510
1511 // call functions which may have additional effects after changing state of unit
1512 if (target->IsInWorld())
1513 target->UpdateObjectVisibility();
1514}
1515
1517{
1519 return;
1520
1521 Unit* target = aurApp->GetTarget();
1522 Player* playerTarget = target->ToPlayer();
1524
1525 if (apply)
1526 {
1527 // apply glow vision
1528 if (playerTarget && type == INVISIBILITY_GENERAL)
1530
1531 target->m_invisibility.AddFlag(type);
1532 target->m_invisibility.AddValue(type, GetAmount());
1533
1535 }
1536 else
1537 {
1539 {
1540 // if not have different invisibility auras.
1541 // always remove glow vision
1542 if (Player * playerTarget = target->ToPlayer())
1544
1545 target->m_invisibility.DelFlag(type);
1546
1548 }
1549 else
1550 {
1551 bool found = false;
1553 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1554 {
1555 if (GetMiscValue() == (*i)->GetMiscValue())
1556 {
1557 found = true;
1558 break;
1559 }
1560 }
1561 if (!found)
1562 {
1563 // if not have invisibility auras of type INVISIBILITY_GENERAL
1564 // remove glow vision
1565 if (playerTarget && type == INVISIBILITY_GENERAL)
1567
1568 target->m_invisibility.DelFlag(type);
1569 }
1570 }
1571
1572 target->m_invisibility.AddValue(type, -GetAmount());
1573 }
1574
1575 // call functions which may have additional effects after changing state of unit
1576 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1577 {
1578 // drop flag at invisibiliy in bg
1580 }
1581
1582 if (target->IsInWorld())
1583 target->UpdateObjectVisibility();
1584}
1585
1587{
1589 return;
1590
1591 Unit* target = aurApp->GetTarget();
1593
1594 if (apply)
1595 {
1596 target->m_stealthDetect.AddFlag(type);
1597 target->m_stealthDetect.AddValue(type, GetAmount());
1598 }
1599 else
1600 {
1602 target->m_stealthDetect.DelFlag(type);
1603
1604 target->m_stealthDetect.AddValue(type, -GetAmount());
1605 }
1606
1607 // call functions which may have additional effects after changing state of unit
1608 if (target->IsInWorld())
1609 target->UpdateObjectVisibility();
1610}
1611
1612void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
1613{
1615 return;
1616
1617 Unit* target = aurApp->GetTarget();
1619
1620 if (apply)
1621 {
1622 target->m_stealth.AddFlag(type);
1623 target->m_stealth.AddValue(type, GetAmount());
1624
1626 if (Player * playerTarget = target->ToPlayer())
1627 playerTarget->AddAuraVision(PLAYER_FIELD_BYTE2_STEALTH);
1628 }
1629 else
1630 {
1631 target->m_stealth.AddValue(type, -GetAmount());
1632
1633 if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
1634 {
1635 target->m_stealth.DelFlag(type);
1636
1638 if (Player * playerTarget = target->ToPlayer())
1639 playerTarget->RemoveAuraVision(PLAYER_FIELD_BYTE2_STEALTH);
1640 }
1641 }
1642
1643 // call functions which may have additional effects after changing state of unit
1644 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1645 {
1646 // drop flag at stealth in bg
1648 }
1649
1650 if (target->IsInWorld())
1651 target->UpdateObjectVisibility();
1652}
1653
1655{
1657 return;
1658
1659 Unit* target = aurApp->GetTarget();
1661
1662 if (apply)
1663 target->m_stealth.AddValue(type, GetAmount());
1664 else
1665 target->m_stealth.AddValue(type, -GetAmount());
1666
1667 // call functions which may have additional effects after changing state of unit
1668 if (target->IsInWorld())
1669 target->UpdateObjectVisibility();
1670}
1671
1672void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const
1673{
1675 return;
1676
1677 Unit* target = aurApp->GetTarget();
1678
1679 if (target->GetTypeId() != TYPEID_PLAYER)
1680 return;
1681
1682 if (apply)
1683 {
1684 if (Player* playerTarget = target->ToPlayer())
1685 {
1686 playerTarget->AddAuraVision(PlayerFieldByte2Flags(1 << (GetMiscValue() - 1)));
1687 }
1688 }
1689 else
1690 {
1692 {
1694 for (Unit::AuraEffectList::const_iterator i = amoreAuras.begin(); i != amoreAuras.end(); ++i)
1695 {
1696 if (GetMiscValue() == (*i)->GetMiscValue())
1697 return;
1698 }
1699 }
1700
1701 if (Player* playerTarget = target->ToPlayer())
1702 playerTarget->RemoveAuraVision(PlayerFieldByte2Flags(1 << (GetMiscValue() - 1)));
1703 }
1704}
1705
1707{
1708 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1709 return;
1710
1711 Unit* target = aurApp->GetTarget();
1712
1713 if (target->GetTypeId() != TYPEID_PLAYER)
1714 return;
1715
1716 // prepare spirit state
1717 if (apply)
1718 {
1719 if (target->GetTypeId() == TYPEID_PLAYER)
1720 {
1721 // set stand state (expected in this form)
1722 if (!target->IsStandState())
1724 }
1725 }
1726 // die at aura end
1727 else if (target->IsAlive())
1728 // call functions which may have additional effects after changing state of unit
1729 target->setDeathState(JUST_DIED);
1730}
1731
1732void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const
1733{
1735 return;
1736
1737 Player* target = aurApp->GetTarget()->ToPlayer();
1738 if (!target)
1739 return;
1740
1741 if (apply)
1742 {
1746 }
1747 else
1748 {
1749 if (target->HasAuraType(SPELL_AURA_GHOST))
1750 return;
1751
1755 }
1756}
1757
1758void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const
1759{
1760 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1761 return;
1762
1763 Unit* target = aurApp->GetTarget();
1764
1765 if (apply)
1767 else
1769}
1770
1771void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, bool apply) const
1772{
1773 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1774 return;
1775
1776 Unit* target = aurApp->GetTarget();
1777
1778 if (apply)
1780 else
1782}
1783
1785{
1786 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1787 return;
1788
1789 Unit* target = aurApp->GetTarget();
1790
1791 if (!apply)
1792 PhasingHandler::SetAlwaysVisible(target, true, true);
1793 else
1794 {
1795 if (target->HasAuraType(SPELL_AURA_PHASE_ALWAYS_VISIBLE) || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
1796 return;
1797
1798 PhasingHandler::SetAlwaysVisible(target, false, true);
1799 }
1800}
1801
1802/**********************/
1803/*** UNIT MODEL ***/
1804/**********************/
1805
1807{
1809 return;
1810
1811 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(GetMiscValue());
1812 ASSERT(shapeInfo, "Spell %u uses unknown ShapeshiftForm (%u).", GetId(), GetMiscValue());
1813
1814 Unit* target = aurApp->GetTarget();
1815
1817 uint32 modelid = target->GetModelForForm(form, GetId());
1818
1819 if (apply)
1820 {
1821 // remove polymorph before changing display id to keep new display id
1822 switch (form)
1823 {
1824 case FORM_CAT_FORM:
1825 case FORM_TREE_OF_LIFE:
1826 case FORM_TRAVEL_FORM:
1827 case FORM_AQUATIC_FORM:
1828 case FORM_BEAR_FORM:
1830 case FORM_FLIGHT_FORM:
1831 case FORM_MOONKIN_FORM:
1832 {
1833 // remove movement affects
1834 target->RemoveAurasByShapeShift();
1835
1836 // and polymorphic affects
1837 if (target->IsPolymorphed())
1838 target->RemoveAurasDueToSpell(target->GetTransformSpell());
1839 break;
1840 }
1841 default:
1842 break;
1843 }
1844
1845 // remove other shapeshift before applying a new one
1847
1848 // stop handling the effect if it was removed by linked event
1849 if (aurApp->GetRemoveMode())
1850 return;
1851
1852 ShapeshiftForm prevForm = target->GetShapeshiftForm();
1853 target->SetShapeshiftForm(form);
1854 // add the shapeshift aura's boosts
1855 if (prevForm != form)
1856 HandleShapeshiftBoosts(target, true);
1857
1858 if (modelid > 0)
1859 {
1860 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell(), GetBase()->GetCastDifficulty());
1861 if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
1862 target->SetDisplayId(modelid);
1863 }
1864
1865 if (!shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance))
1867 }
1868 else
1869 {
1870 // reset model id if no other auras present
1871 // may happen when aura is applied on linked event on aura removal
1873 {
1875 if (target->GetClass() == CLASS_DRUID)
1876 {
1877 // Remove movement impairing effects also when shifting out
1878 target->RemoveAurasByShapeShift();
1879 }
1880 }
1881
1882 if (modelid > 0)
1883 target->RestoreDisplayId(target->IsMounted());
1884
1885 switch (form)
1886 {
1887 // Nordrassil Harness - bonus
1888 case FORM_BEAR_FORM:
1889 case FORM_CAT_FORM:
1890 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
1891 target->CastSpell(target, 37316, dummy);
1892 break;
1893 // Nordrassil Regalia - bonus
1894 case FORM_MOONKIN_FORM:
1895 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
1896 target->CastSpell(target, 37325, dummy);
1897 break;
1898 default:
1899 break;
1900 }
1901
1902 // remove the shapeshift aura's boosts
1903 HandleShapeshiftBoosts(target, false);
1904 }
1905
1906 if (Player* playerTarget = target->ToPlayer())
1907 {
1908 playerTarget->SendMovementSetCollisionHeight(playerTarget->GetCollisionHeight(), WorldPackets::Movement::UpdateCollisionHeightReason::Force);
1909 playerTarget->InitDataForForm();
1910 }
1911 else
1912 target->UpdateDisplayPower();
1913
1914 if (target->GetClass() == CLASS_DRUID)
1915 {
1916 // Dash
1918 aurEff->RecalculateAmount();
1919
1920 // Disarm handling
1921 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
1922 // and also HandleAuraModDisarm is not triggered
1923 if (!target->CanUseAttackType(BASE_ATTACK))
1924 {
1927 }
1928 }
1929
1930 // stop handling the effect if it was removed by linked event
1931 if (apply && aurApp->GetRemoveMode())
1932 return;
1933
1934 if (target->GetTypeId() == TYPEID_PLAYER)
1935 {
1936 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
1937 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
1938 {
1939 if (!shapeInfo->PresetSpellID[i])
1940 continue;
1941 if (apply)
1942 target->ToPlayer()->AddTemporarySpell(shapeInfo->PresetSpellID[i]);
1943 else
1944 target->ToPlayer()->RemoveTemporarySpell(shapeInfo->PresetSpellID[i]);
1945 }
1946 }
1947}
1948
1949void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const
1950{
1952 return;
1953
1954 Unit* target = aurApp->GetTarget();
1955
1956 if (apply)
1957 {
1958 // update active transform spell only when transform not set or not overwriting negative by positive case
1959 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell(), GetBase()->GetCastDifficulty());
1960 if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
1961 {
1962 target->SetTransformSpell(GetId());
1963 // special case (spell specific functionality)
1964 if (GetMiscValue() == 0)
1965 {
1966 Gender gender = target->GetNativeGender();
1967 switch (GetId())
1968 {
1969 // Orb of Deception
1970 case 16739:
1971 {
1972 if (target->GetTypeId() != TYPEID_PLAYER)
1973 return;
1974
1975 switch (target->GetRace())
1976 {
1977 // Blood Elf
1978 case RACE_BLOODELF:
1979 target->SetDisplayId(gender == GENDER_FEMALE ? 17830 : 17829);
1980 break;
1981 // Orc
1982 case RACE_ORC:
1983 target->SetDisplayId(gender == GENDER_FEMALE ? 10140 : 10139);
1984 break;
1985 // Troll
1986 case RACE_TROLL:
1987 target->SetDisplayId(gender == GENDER_FEMALE ? 10134 : 10135);
1988 break;
1989 // Tauren
1990 case RACE_TAUREN:
1991 target->SetDisplayId(gender == GENDER_FEMALE ? 10147 : 10136);
1992 break;
1993 // Undead
1994 case RACE_UNDEAD_PLAYER:
1995 target->SetDisplayId(gender == GENDER_FEMALE ? 10145 : 10146);
1996 break;
1997 // Draenei
1998 case RACE_DRAENEI:
1999 target->SetDisplayId(gender == GENDER_FEMALE ? 17828 : 17827);
2000 break;
2001 // Dwarf
2002 case RACE_DWARF:
2003 target->SetDisplayId(gender == GENDER_FEMALE ? 10142 : 10141);
2004 break;
2005 // Gnome
2006 case RACE_GNOME:
2007 target->SetDisplayId(gender == GENDER_FEMALE ? 10149 : 10148);
2008 break;
2009 // Human
2010 case RACE_HUMAN:
2011 target->SetDisplayId(gender == GENDER_FEMALE ? 10138 : 10137);
2012 break;
2013 // Night Elf
2014 case RACE_NIGHTELF:
2015 target->SetDisplayId(gender == GENDER_FEMALE ? 10144 : 10143);
2016 break;
2017 default:
2018 break;
2019 }
2020 break;
2021 }
2022 // Murloc costume
2023 case 42365:
2024 target->SetDisplayId(21723);
2025 break;
2026 // Dread Corsair
2027 case 50517:
2028 // Corsair Costume
2029 case 51926:
2030 {
2031 if (target->GetTypeId() != TYPEID_PLAYER)
2032 return;
2033
2034 switch (target->GetRace())
2035 {
2036 // Blood Elf
2037 case RACE_BLOODELF:
2038 target->SetDisplayId(gender == GENDER_MALE ? 25032 : 25043);
2039 break;
2040 // Orc
2041 case RACE_ORC:
2042 target->SetDisplayId(gender == GENDER_MALE ? 25039 : 25050);
2043 break;
2044 // Troll
2045 case RACE_TROLL:
2046 target->SetDisplayId(gender == GENDER_MALE ? 25041 : 25052);
2047 break;
2048 // Tauren
2049 case RACE_TAUREN:
2050 target->SetDisplayId(gender == GENDER_MALE ? 25040 : 25051);
2051 break;
2052 // Undead
2053 case RACE_UNDEAD_PLAYER:
2054 target->SetDisplayId(gender == GENDER_MALE ? 25042 : 25053);
2055 break;
2056 // Draenei
2057 case RACE_DRAENEI:
2058 target->SetDisplayId(gender == GENDER_MALE ? 25033 : 25044);
2059 break;
2060 // Dwarf
2061 case RACE_DWARF:
2062 target->SetDisplayId(gender == GENDER_MALE ? 25034 : 25045);
2063 break;
2064 // Gnome
2065 case RACE_GNOME:
2066 target->SetDisplayId(gender == GENDER_MALE ? 25035 : 25046);
2067 break;
2068 // Human
2069 case RACE_HUMAN:
2070 target->SetDisplayId(gender == GENDER_MALE ? 25037 : 25048);
2071 break;
2072 // Night Elf
2073 case RACE_NIGHTELF:
2074 target->SetDisplayId(gender == GENDER_MALE ? 25038 : 25049);
2075 break;
2076 default:
2077 break;
2078 }
2079 break;
2080 }
2081 // Pygmy Oil
2082 case 53806:
2083 target->SetDisplayId(22512);
2084 break;
2085 // Honor the Dead
2086 case 65386:
2087 case 65495:
2088 target->SetDisplayId(gender == GENDER_MALE ? 29203 : 29204);
2089 break;
2090 // Darkspear Pride
2091 case 75532:
2092 target->SetDisplayId(gender == GENDER_MALE ? 31737 : 31738);
2093 break;
2094 // Gnomeregan Pride
2095 case 75531:
2096 target->SetDisplayId(gender == GENDER_MALE ? 31654 : 31655);
2097 break;
2098 default:
2099 break;
2100 }
2101 }
2102 else
2103 {
2104 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2105 if (!ci)
2106 {
2107 target->SetDisplayId(16358); // pig pink ^_^
2108 TC_LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2109 }
2110 else
2111 {
2112 uint32 model_id = 0;
2113
2114 // choose a model, based on trigger flag
2115 if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci)->CreatureDisplayID)
2116 model_id = modelid;
2117
2118 target->SetDisplayId(model_id);
2119
2120 // Dragonmaw Illusion (set mount model also)
2121 if (GetId() == 42016 && target->GetMountDisplayId() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2122 target->SetMountDisplayId(16314);
2123 }
2124 }
2125 }
2126
2127 // polymorph case
2128 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
2129 {
2130 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2131 // only if caster is Player (after patch 2.4.2)
2132 if (GetCasterGUID().IsPlayer())
2134
2135 //dismount polymorphed target (after patch 2.4.2)
2136 if (target->IsMounted())
2138 }
2139 }
2140 else
2141 {
2142 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2143 if (target->GetTransformSpell() == GetId())
2144 target->SetTransformSpell(0);
2145
2146 target->RestoreDisplayId(target->IsMounted());
2147
2148 // Dragonmaw Illusion (restore mount model)
2149 if (GetId() == 42016 && target->GetMountDisplayId() == 16314)
2150 {
2151 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2152 {
2153 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2154 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2155 {
2157 sObjectMgr->GetCreatureModelRandomGender(&model, ci);
2158
2159 target->SetMountDisplayId(model.CreatureDisplayID);
2160 }
2161 }
2162 }
2163 }
2164}
2165
2166void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2167{
2169 return;
2170
2171 aurApp->GetTarget()->RecalculateObjectScale();
2172}
2173
2175{
2177 return;
2178
2179 Unit* target = aurApp->GetTarget();
2180
2181 if (apply)
2182 {
2183 Unit* caster = GetCaster();
2184 if (!caster || caster == target)
2185 return;
2186
2187 // What must be cloned? at least display and scale
2188 target->SetDisplayId(caster->GetDisplayId());
2189 //target->SetObjectScale(caster->GetObjectScale()); // we need retail info about how scaling is handled (aura maybe?)
2191 }
2192 else
2193 {
2194 target->SetDisplayId(target->GetNativeDisplayId());
2196 }
2197}
2198
2199/************************/
2200/*** FIGHT ***/
2201/************************/
2202
2203void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, bool apply) const
2204{
2205 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2206 return;
2207
2208 Unit* target = aurApp->GetTarget();
2209
2210 if (apply)
2211 {
2212 auto isAffectedByFeignDeath = [](Unit const* attacker)
2213 {
2214 Creature const* attackerCreature = attacker->ToCreature();
2215 return !attackerCreature || !attackerCreature->IsIgnoringFeignDeath();
2216 };
2217
2218 std::vector<Unit*> targets;
2219 Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityRange());
2220 Trinity::UnitListSearcher searcher(target, targets, u_check);
2221 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2222 for (Unit* unit : targets)
2223 {
2224 if (!unit->HasUnitState(UNIT_STATE_CASTING))
2225 continue;
2226
2227 if (!isAffectedByFeignDeath(unit))
2228 continue;
2229
2231 {
2232 if (unit->GetCurrentSpell(i)
2233 && unit->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2234 {
2235 unit->InterruptSpell(CurrentSpellTypes(i), false);
2236 }
2237 }
2238 }
2239
2240 for (auto const& [guid, ref] : target->GetThreatManager().GetThreatenedByMeList())
2241 if (isAffectedByFeignDeath(ref->GetOwner()))
2242 ref->ScaleThreat(0.0f);
2243
2244 if (target->GetMap()->IsDungeon()) // feign death does not remove combat in dungeons
2245 {
2246 target->AttackStop();
2247 if (Player* targetPlayer = target->ToPlayer())
2248 targetPlayer->SendAttackSwingCancelAttack();
2249 }
2250 else
2251 target->CombatStop(false, false, isAffectedByFeignDeath);
2252
2253 // prevent interrupt message
2254 if (GetCasterGUID() == target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
2256 target->InterruptNonMeleeSpells(true);
2257
2258 // stop handling the effect if it was removed by linked event
2259 if (aurApp->GetRemoveMode())
2260 return;
2261
2266
2267 if (Creature* creature = target->ToCreature())
2268 creature->SetReactState(REACT_PASSIVE);
2269 }
2270 else
2271 {
2276
2277 if (Creature* creature = target->ToCreature())
2278 creature->InitializeReactState();
2279 }
2280}
2281
2283{
2285 return;
2286
2287 Unit* target = aurApp->GetTarget();
2288
2289 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2291 return;
2292
2293 if (apply)
2295 else
2297
2298 // call functions which may have additional effects after changing state of unit
2299 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2300 {
2301 if (target->GetMap()->IsDungeon())
2302 {
2303 target->AttackStop();
2304 if (Player* targetPlayer = target->ToPlayer())
2305 targetPlayer->SendAttackSwingCancelAttack();
2306 }
2307 else
2308 target->CombatStop();
2309 }
2310}
2311
2312void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, bool apply) const
2313{
2314 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2315 return;
2316
2317 Unit* target = aurApp->GetTarget();
2318
2319 AuraType type = GetAuraType();
2320
2321 bool(*flagChangeFunc)(Unit* u) = nullptr;
2322
2323 uint32 slot;
2324 WeaponAttackType attType;
2325 switch (type)
2326 {
2328 if (apply)
2329 flagChangeFunc = [](Unit* u) { if (u->HasUnitFlag(UNIT_FLAG_DISARMED)) { return false; } u->SetUnitFlag(UNIT_FLAG_DISARMED); return true; };
2330 else
2331 flagChangeFunc = [](Unit* u) { if (u->HasAuraType(SPELL_AURA_MOD_DISARM)) { return false; } u->RemoveUnitFlag(UNIT_FLAG_DISARMED); return true; };
2333 attType = BASE_ATTACK;
2334 break;
2336 if (apply)
2337 flagChangeFunc = [](Unit* u) { if (u->HasUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND)) { return false; } u->SetUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); return true; };
2338 else
2339 flagChangeFunc = [](Unit* u) { if (u->HasAuraType(SPELL_AURA_MOD_DISARM_OFFHAND)) { return false; } u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); return true; };
2341 attType = OFF_ATTACK;
2342 break;
2344 if (apply)
2345 flagChangeFunc = [](Unit* u) { if (u->HasUnitFlag2(UNIT_FLAG2_DISARM_RANGED)) { return false; } u->SetUnitFlag2(UNIT_FLAG2_DISARM_RANGED); return true; };
2346 else
2347 flagChangeFunc = [](Unit* u) { if (u->HasAuraType(SPELL_AURA_MOD_DISARM_RANGED)) { return false; } u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_RANGED); return true; };
2349 attType = RANGED_ATTACK;
2350 break;
2351 default:
2352 return;
2353 }
2354
2355 // set/remove flag before weapon bonuses so it's properly reflected in CanUseAttackType
2356 if (flagChangeFunc)
2357 if (!flagChangeFunc(target)) //Prevent handling aura twice
2358 return;
2359
2360 // Handle damage modification, shapeshifted druids are not affected
2361 if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
2362 {
2363 Player* player = target->ToPlayer();
2364 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2365 {
2366 WeaponAttackType const attackType = Player::GetAttackBySlot(slot, item->GetTemplate()->GetInventoryType());
2367
2368 player->ApplyItemDependentAuras(item, !apply);
2369 if (attackType != MAX_ATTACK)
2370 {
2371 player->_ApplyWeaponDamage(slot, item, !apply);
2372 if (!apply) // apply case already handled on item dependent aura removal (if any)
2373 player->UpdateWeaponDependentAuras(attackType);
2374 }
2375 }
2376 }
2377
2378 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
2379 target->UpdateDamagePhysical(attType);
2380}
2381
2383{
2384 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2385 return;
2386
2387 Unit* target = aurApp->GetTarget();
2388
2389 if (apply)
2390 {
2392
2393 // call functions which may have additional effects after changing state of unit
2394 // Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_SILENCE
2395 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2396 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2397 if (spell->m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_SILENCE)
2398 // Stop spells on prepare or casting state
2399 target->InterruptSpell(CurrentSpellTypes(i), false);
2400 }
2401 else
2402 {
2403 int32 silencedSchoolMask = 0;
2404 for (AuraEffect const* auraEffect : target->GetAuraEffectsByType(SPELL_AURA_MOD_SILENCE))
2405 silencedSchoolMask |= auraEffect->GetMiscValue();
2406
2407 for (AuraEffect const* auraEffect : target->GetAuraEffectsByType(SPELL_AURA_MOD_PACIFY_SILENCE))
2408 silencedSchoolMask |= auraEffect->GetMiscValue();
2409
2410 target->ReplaceAllSilencedSchoolMask(SpellSchoolMask(silencedSchoolMask));
2411 }
2412}
2413
2414void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const
2415{
2417 return;
2418
2419 Unit* target = aurApp->GetTarget();
2420
2421 if (apply)
2423 else
2424 {
2425 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2427 return;
2429 }
2430}
2431
2433{
2435 return;
2436
2437 Unit* target = aurApp->GetTarget();
2438
2439 // Vengeance of the Blue Flight (@todo REMOVE THIS!)
2441 if (m_spellInfo->Id == 45839)
2442 {
2443 if (apply)
2445 else
2447 }
2448 if (!(apply))
2449 {
2450 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2452 return;
2453 }
2454 HandleAuraModPacify(aurApp, mode, apply);
2455 HandleAuraModSilence(aurApp, mode, apply);
2456}
2457
2459{
2460 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2461 return;
2462
2463 Unit* target = aurApp->GetTarget();
2464
2465 if (apply)
2466 {
2468
2469 // call functions which may have additional effects after chainging state of unit
2470 // Stop cast only spells vs PreventionType & SPELL_PREVENTION_TYPE_SILENCE
2471 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2472 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2473 if (spell->m_spellInfo->PreventionType & SPELL_PREVENTION_TYPE_NO_ACTIONS)
2474 // Stop spells on prepare or casting state
2475 target->InterruptSpell(CurrentSpellTypes(i), false);
2476 }
2477 else
2478 {
2479 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2481 return;
2482
2484 }
2485}
2486
2487/****************************/
2488/*** TRACKING ***/
2489/****************************/
2490
2492{
2494 return;
2495
2496 Player* target = aurApp->GetTarget()->ToPlayer();
2497 if (!target)
2498 return;
2499
2500 if (apply)
2501 target->SetTrackCreatureFlag(uint32(1) << (GetMiscValue() - 1));
2502 else
2503 target->RemoveTrackCreatureFlag(uint32(1) << (GetMiscValue() - 1));
2504}
2505
2507{
2509 return;
2510
2511 Player* target = aurApp->GetTarget()->ToPlayer();
2512 if (!target)
2513 return;
2514
2515 if (!(apply))
2516 {
2517 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2518 if (target->HasAuraType(GetAuraType()))
2519 return;
2520 }
2521 if (apply)
2523 else
2525}
2526
2528{
2530 return;
2531
2532 Unit* target = aurApp->GetTarget();
2533
2534 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
2535 if (apply)
2537 else
2538 {
2539 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2540 if (!target->HasAuraType(GetAuraType()))
2542 }
2543
2544 // call functions which may have additional effects after changing state of unit
2545 if (target->IsInWorld())
2546 target->UpdateObjectVisibility();
2547}
2548
2550{
2552 return;
2553
2554 Unit* target = aurApp->GetTarget();
2555
2556 if (apply)
2558 else
2559 {
2560 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2561 if (target->HasAuraType(GetAuraType()))
2562 return;
2564 }
2565}
2566
2567/****************************/
2568/*** SKILLS & TALENTS ***/
2569/****************************/
2570
2571void AuraEffect::HandleAuraModSkill(AuraApplication const* aurApp, uint8 mode, bool apply) const
2572{
2574 return;
2575
2576 Player* target = aurApp->GetTarget()->ToPlayer();
2577 if (!target)
2578 return;
2579
2580 uint32 prot = GetMiscValue();
2581 int32 points = GetAmount();
2582
2583 if (prot == SKILL_DEFENSE)
2584 return;
2585
2586 target->ModifySkillBonus(prot, (apply ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
2587}
2588
2590{
2591 if (!(mode & (AURA_EFFECT_HANDLE_REAL)))
2592 return;
2593
2594 Player* target = aurApp->GetTarget()->ToPlayer();
2595 if (!target)
2596 return;
2597
2598 if (apply)
2600 else if (!target->HasAuraType(GetAuraType()))
2602}
2603
2604/****************************/
2605/*** MOVEMENT ***/
2606/****************************/
2607
2608void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bool apply) const
2609{
2611 return;
2612
2613 Unit* target = aurApp->GetTarget();
2614
2615 if (apply)
2616 {
2618 {
2619 uint32 creatureEntry = GetMiscValue();
2620 uint32 displayId = 0;
2621 uint32 vehicleId = 0;
2622
2623 if (MountEntry const* mountEntry = sDB2Manager.GetMount(GetId()))
2624 {
2625 if (DB2Manager::MountXDisplayContainer const* mountDisplays = sDB2Manager.GetMountDisplays(mountEntry->ID))
2626 {
2627 if (mountEntry->IsSelfMount())
2628 {
2629 displayId = DISPLAYID_HIDDEN_MOUNT;
2630 }
2631 else
2632 {
2634 std::copy_if(mountDisplays->begin(), mountDisplays->end(), std::back_inserter(usableDisplays), [target](MountXDisplayEntry const* mountDisplay)
2635 {
2636 if (Player* playerTarget = target->ToPlayer())
2637 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(mountDisplay->PlayerConditionID))
2638 return sConditionMgr->IsPlayerMeetingCondition(playerTarget, playerCondition);
2639
2640 return true;
2641 });
2642
2643 if (!usableDisplays.empty())
2644 displayId = Trinity::Containers::SelectRandomContainerElement(usableDisplays)->CreatureDisplayInfoID;
2645 }
2646 }
2647 // TODO: CREATE TABLE mount_vehicle (mountId, vehicleCreatureId) for future mounts that are vehicles (new mounts no longer have proper data in MiscValue)
2648 //if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
2649 // creatureEntry = mountVehicle->VehicleCreatureId;
2650 }
2651
2652 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
2653 {
2654 vehicleId = creatureInfo->VehicleId;
2655
2656 if (!displayId)
2657 {
2658 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
2659 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
2660 displayId = model.CreatureDisplayID;
2661 }
2662
2663 //some spell has one aura of mount and one of vehicle
2664 for (SpellEffectInfo const& effect : GetSpellInfo()->GetEffects())
2665 if (effect.IsEffect(SPELL_EFFECT_SUMMON) && effect.MiscValue == GetMiscValue())
2666 displayId = 0;
2667 }
2668
2669 target->Mount(displayId, vehicleId, creatureEntry);
2670 }
2671
2672 // cast speed aura
2674 if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmount()))
2675 target->CastSpell(target, mountCapability->ModSpellAuraID, this);
2676 }
2677 else
2678 {
2680 target->Dismount();
2681
2682 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
2683 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
2684 // and never endless flying after using Headless Horseman's Mount
2685 if (mode & AURA_EFFECT_HANDLE_REAL)
2687
2689 // remove speed aura
2690 if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmount()))
2691 target->RemoveAurasDueToSpell(mountCapability->ModSpellAuraID, target->GetGUID());
2692 }
2693}
2694
2696{
2698 return;
2699
2700 Unit* target = aurApp->GetTarget();
2701
2702 if (!apply)
2703 {
2704 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2706 return;
2707 }
2708
2710
2711 if (target->SetCanFly(apply))
2712 {
2713 if (!apply && !target->IsGravityDisabled())
2714 target->GetMotionMaster()->MoveFall();
2715 }
2716}
2717
2718void AuraEffect::HandleAuraWaterWalk(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
2728 if (target->HasAuraType(GetAuraType()))
2729 return;
2730 }
2731
2732 target->SetWaterWalking(apply);
2733}
2734
2736{
2738 return;
2739
2740 Unit* target = aurApp->GetTarget();
2741
2742 if (!apply)
2743 {
2744 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2745 if (target->HasAuraType(GetAuraType()))
2746 return;
2747 }
2748
2749 target->SetFeatherFall(apply);
2750
2751 // start fall from current height
2752 if (!apply && target->GetTypeId() == TYPEID_PLAYER)
2753 target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
2754}
2755
2756void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const
2757{
2759 return;
2760
2761 Unit* target = aurApp->GetTarget();
2762
2763 if (!apply)
2764 {
2765 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2766 if (target->HasAuraType(GetAuraType()))
2767 return;
2768 }
2769
2770 target->SetHover(apply);
2771}
2772
2773void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2774{
2776 return;
2777
2778 Unit* target = aurApp->GetTarget();
2779
2780 // update timers in client
2781 if (target->GetTypeId() == TYPEID_PLAYER)
2782 target->ToPlayer()->UpdateMirrorTimers();
2783}
2784
2786{
2788 return;
2789
2790 Unit* target = aurApp->GetTarget();
2791
2792 if (apply)
2794 else
2795 {
2796 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2797 if (target->HasAuraType(GetAuraType()))
2798 return;
2800 }
2801}
2802
2804{
2806 return;
2807
2808 Unit* target = aurApp->GetTarget();
2809
2810 if (!apply)
2811 {
2812 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2813 if (target->HasAuraType(GetAuraType()))
2814 return;
2815 }
2816
2818}
2819
2821{
2823 return;
2824
2825 Unit* target = aurApp->GetTarget();
2826
2827 if (!apply)
2828 {
2829 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2830 if (target->HasAuraType(GetAuraType()))
2831 return;
2832 }
2833
2835}
2836
2838{
2840 return;
2841
2842 Unit* target = aurApp->GetTarget();
2843
2844 if (!apply)
2845 {
2846 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2847 if (target->HasAuraType(GetAuraType()))
2848 return;
2849 }
2850
2851 target->SetDisableInertia(apply);
2852}
2853
2854/****************************/
2855/*** THREAT ***/
2856/****************************/
2857
2858void AuraEffect::HandleModThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2859{
2861 return;
2862
2864}
2865
2866void AuraEffect::HandleAuraModTotalThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2867{
2869 return;
2870
2871 Unit* target = aurApp->GetTarget();
2872
2873 if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
2874 return;
2875
2876 Unit* caster = GetCaster();
2877 if (caster && caster->IsAlive())
2879}
2880
2881void AuraEffect::HandleModTaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2882{
2883 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2884 return;
2885
2886 Unit* target = aurApp->GetTarget();
2887
2888 if (!target->IsAlive() || !target->CanHaveThreatList())
2889 return;
2890
2891 target->GetThreatManager().TauntUpdate();
2892}
2893
2894void AuraEffect::HandleModDetaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2895{
2896 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2897 return;
2898
2899 Unit* caster = GetCaster();
2900 Unit* target = aurApp->GetTarget();
2901
2902 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
2903 return;
2904
2905 caster->GetThreatManager().TauntUpdate();
2906}
2907
2908void AuraEffect::HandleAuraModFixate(AuraApplication const* aurApp, uint8 mode, bool apply) const
2909{
2910 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2911 return;
2912
2913 Unit* caster = GetCaster();
2914 Unit* target = aurApp->GetTarget();
2915
2916 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
2917 return;
2918
2919 if (apply)
2920 caster->GetThreatManager().FixateTarget(target);
2921 else
2922 caster->GetThreatManager().ClearFixate();
2923}
2924
2925/*****************************/
2926/*** CONTROL ***/
2927/*****************************/
2928
2929void AuraEffect::HandleModConfuse(AuraApplication const* aurApp, uint8 mode, bool apply) const
2930{
2931 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2932 return;
2933
2934 Unit* target = aurApp->GetTarget();
2935
2937 if (apply)
2939}
2940
2941void AuraEffect::HandleModFear(AuraApplication const* aurApp, uint8 mode, bool apply) const
2942{
2943 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2944 return;
2945
2946 Unit* target = aurApp->GetTarget();
2947
2949}
2950
2951void AuraEffect::HandleAuraModStun(AuraApplication const* aurApp, uint8 mode, bool apply) const
2952{
2953 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2954 return;
2955
2956 Unit* target = aurApp->GetTarget();
2957
2959 if (apply)
2961}
2962
2963void AuraEffect::HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bool apply) const
2964{
2965 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2966 return;
2967
2968 Unit* target = aurApp->GetTarget();
2969
2971}
2972
2974{
2975 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2976 return;
2977
2978 Unit* target = aurApp->GetTarget();
2979
2980 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
2981 if (!apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
2982 return;
2985 target->SetControlled(false, UNIT_STATE_FLEEING);
2986}
2987
2989{
2990 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2991 return;
2992
2993 Unit* target = aurApp->GetTarget();
2994
2996
2997 // Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template.
2998 if (!apply && (target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY) || (target->IsCreature() && target->ToCreature()->IsFloating())))
2999 return;
3000
3001 if (target->SetDisableGravity(apply))
3002 if (!apply && !target->IsFlying())
3003 target->GetMotionMaster()->MoveFall();
3004}
3005
3007{
3008 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3009 return;
3010
3011 Unit* target = aurApp->GetTarget();
3012
3014
3015 if (apply)
3017
3018 // Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template.
3019 if (!apply && (target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || (target->IsCreature() && target->ToCreature()->IsFloating())))
3020 return;
3021
3022 if (target->SetDisableGravity(apply))
3023 if (!apply && !target->IsFlying())
3024 target->GetMotionMaster()->MoveFall();
3025}
3026
3027/***************************/
3028/*** CHARM ***/
3029/***************************/
3030
3031void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const
3032{
3033 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3034 return;
3035
3036 Unit* target = aurApp->GetTarget();
3037
3038 Unit* caster = GetCaster();
3039
3040 // no support for posession AI yet
3041 if (caster && caster->GetTypeId() == TYPEID_UNIT)
3042 {
3043 HandleModCharm(aurApp, mode, apply);
3044 return;
3045 }
3046
3047 if (apply)
3048 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3049 else
3050 target->RemoveCharmedBy(caster);
3051}
3052
3053void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const
3054{
3055 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3056 return;
3057
3058 Unit* caster = GetCaster();
3059 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
3060 return;
3061
3062 // seems it may happen that when removing it is no longer owner's pet
3063 //if (caster->ToPlayer()->GetPet() != target)
3064 // return;
3065
3066 Unit* target = aurApp->GetTarget();
3067 if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
3068 return;
3069
3070 Pet* pet = target->ToPet();
3071 if (apply)
3072 {
3073 if (caster->ToPlayer()->GetPet() != pet)
3074 return;
3075
3076 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3077 }
3078 else
3079 {
3080 pet->RemoveCharmedBy(caster);
3081
3082 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3083 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3084 else
3085 {
3086 // Reinitialize the pet bar or it will appear greyed out
3087 caster->ToPlayer()->PetSpellInitialize();
3088
3089 // TODO: remove this
3090 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3092 }
3093 }
3094}
3095
3096void AuraEffect::HandleModCharm(AuraApplication const* aurApp, uint8 mode, bool apply) const
3097{
3098 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3099 return;
3100
3101 Unit* target = aurApp->GetTarget();
3102
3103 Unit* caster = GetCaster();
3104
3105 if (apply)
3106 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3107 else
3108 target->RemoveCharmedBy(caster);
3109}
3110
3111void AuraEffect::HandleCharmConvert(AuraApplication const* aurApp, uint8 mode, bool apply) const
3112{
3113 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3114 return;
3115
3116 Unit* target = aurApp->GetTarget();
3117
3118 Unit* caster = GetCaster();
3119
3120 if (apply)
3121 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3122 else
3123 target->RemoveCharmedBy(caster);
3124}
3125
3131{
3133 return;
3134
3135 Unit* target = aurApp->GetTarget();
3136 if (!target->IsVehicle())
3137 return;
3138
3139 Unit* caster = GetCaster();
3140 if (!caster || caster == target)
3141 return;
3142
3143 if (apply)
3144 {
3145 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3146 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3147 // so this break such spells or most of them.
3148 // Current formula about m_amount: effect base points + dieside - 1
3149 // TO DO: Reasearch more about 0/0 and fix it.
3150 caster->_EnterVehicle(target->GetVehicleKit(), GetAmount() - 1, aurApp);
3151 }
3152 else
3153 {
3154 // Remove pending passengers before exiting vehicle - might cause an Uninstall
3156
3157 if (GetId() == 53111) // Devour Humanoid
3158 {
3159 Unit::Kill(target, caster);
3160 if (caster->GetTypeId() == TYPEID_UNIT)
3161 caster->ToCreature()->DespawnOrUnsummon();
3162 }
3163
3164 bool seatChange = (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT) // Seat change on the same direct vehicle
3165 || target->HasAuraTypeWithCaster(SPELL_AURA_CONTROL_VEHICLE, caster->GetGUID()); // Seat change to a proxy vehicle (for example turret mounted on a siege engine)
3166
3167 if (!seatChange)
3168 caster->_ExitVehicle();
3169 else
3170 target->GetVehicleKit()->RemovePassenger(caster); // Only remove passenger from vehicle without launching exit movement or despawning the vehicle
3171
3172 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3173 caster->RemoveAurasDueToSpell(GetId());
3174 }
3175}
3176
3177/*********************************************************/
3178/*** MODIFY SPEED ***/
3179/*********************************************************/
3180void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3181{
3183 return;
3184
3185 Unit* target = aurApp->GetTarget();
3186
3187 target->UpdateSpeed(MOVE_RUN);
3188}
3189
3191{
3192 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3193}
3194
3196{
3198 return;
3199
3200 Unit* target = aurApp->GetTarget();
3202 target->UpdateSpeed(MOVE_FLIGHT);
3203
3206 {
3207 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3209 {
3211
3212 if (target->SetCanFly(apply))
3213 if (!apply && !target->IsGravityDisabled())
3214 target->GetMotionMaster()->MoveFall();
3215 }
3216
3218 if (mode & AURA_EFFECT_HANDLE_REAL)
3219 {
3220 //Players on flying mounts must be immune to polymorph
3221 if (target->GetTypeId() == TYPEID_PLAYER)
3223
3224 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3225 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountDisplayId())
3226 target->SetMountDisplayId(16314);
3227 }
3228 }
3229}
3230
3231void AuraEffect::HandleAuraModIncreaseSwimSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3232{
3234 return;
3235
3236 Unit* target = aurApp->GetTarget();
3237
3238 target->UpdateSpeed(MOVE_SWIM);
3239}
3240
3241void AuraEffect::HandleAuraModDecreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3242{
3244 return;
3245
3246 Unit* target = aurApp->GetTarget();
3247
3248 target->UpdateSpeed(MOVE_RUN);
3249 target->UpdateSpeed(MOVE_SWIM);
3250 target->UpdateSpeed(MOVE_FLIGHT);
3251 target->UpdateSpeed(MOVE_RUN_BACK);
3252 target->UpdateSpeed(MOVE_SWIM_BACK);
3254}
3255
3256void AuraEffect::HandleAuraModUseNormalSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3257{
3258 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3259 return;
3260
3261 Unit* target = aurApp->GetTarget();
3262
3263 target->UpdateSpeed(MOVE_RUN);
3264 target->UpdateSpeed(MOVE_SWIM);
3265 target->UpdateSpeed(MOVE_FLIGHT);
3266}
3267
3268void AuraEffect::HandleAuraModMinimumSpeedRate(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3269{
3270 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3271 return;
3272
3273 Unit* target = aurApp->GetTarget();
3274
3275 target->UpdateSpeed(MOVE_RUN);
3276}
3277
3278void AuraEffect::HandleModMovementForceMagnitude(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3279{
3281 return;
3282
3284}
3285
3286/*********************************************************/
3287/*** IMMUNITY ***/
3288/*********************************************************/
3289
3291{
3292 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3293 return;
3294
3295 Unit* target = aurApp->GetTarget();
3297}
3298
3300{
3301 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3302 return;
3303
3304 Unit* target = aurApp->GetTarget();
3306}
3307
3309{
3310 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3311 return;
3312
3313 Unit* target = aurApp->GetTarget();
3315
3316 // when removing flag aura, handle flag drop
3317 // TODO: this should be handled in aura script for flag spells using AfterEffectRemove hook
3318 Player* player = target->ToPlayer();
3319 if (!apply && player && GetSpellInfo()->HasAuraInterruptFlag(SpellAuraInterruptFlags::StealthOrInvis))
3320 {
3321 if (player->InBattleground())
3322 {
3323 if (Battleground* bg = player->GetBattleground())
3324 bg->EventPlayerDroppedFlag(player);
3325 }
3326 else
3327 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3328 }
3329}
3330
3332{
3333 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3334 return;
3335
3336 Unit* target = aurApp->GetTarget();
3338}
3339
3341{
3342 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3343 return;
3344
3345 Unit* target = aurApp->GetTarget();
3347
3348 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3349 {
3350 if (apply)
3352 else
3353 {
3354 bool banishFound = false;
3355 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
3356 for (AuraEffect const* aurEff : banishAuras)
3357 {
3358 if (aurEff->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3359 {
3360 banishFound = true;
3361 break;
3362 }
3363 }
3364
3365 if (!banishFound)
3367 }
3368 }
3369
3370 // TODO: should be changed to a proc script on flag spell (they have "Taken positive" proc flags in db2)
3371 {
3374
3375 // remove all flag auras (they are positive, but they must be removed when you are immune)
3379 }
3380
3381 if (apply)
3382 {
3385 }
3386 else
3387 {
3388 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3390 return;
3392 }
3393}
3394
3396{
3397 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3398 return;
3399
3400 Unit* target = aurApp->GetTarget();
3402
3403 if (apply)
3404 {
3407 }
3408 else
3409 {
3410 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3412 return;
3414 }
3415}
3416
3418{
3419 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3420 return;
3421
3422 Unit* target = aurApp->GetTarget();
3424}
3425
3426/*********************************************************/
3427/*** MODIFY STATS ***/
3428/*********************************************************/
3429
3430/********************************/
3431/*** RESISTANCE ***/
3432/********************************/
3433
3435{
3437 return;
3438
3439 Unit* target = aurApp->GetTarget();
3440
3441 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3442 if (GetMiscValue() & (1 << x))
3444}
3445
3447{
3449 return;
3450
3451 Unit* target = aurApp->GetTarget();
3452
3453 // only players have base stats
3454 if (target->GetTypeId() != TYPEID_PLAYER)
3455 {
3456 //pets only have base armor
3457 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3458 {
3459 if (apply)
3461 else
3462 {
3464 target->SetStatPctModifier(UNIT_MOD_ARMOR, BASE_PCT, amount);
3465 }
3466 }
3467 }
3468 else
3469 {
3470 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3471 {
3472 if (GetMiscValue() & (1 << x))
3473 {
3474 if (apply)
3476 else
3477 {
3480 }
3481 }
3482 }
3483 }
3484}
3485
3486void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3487{
3489 return;
3490
3491 Unit* target = aurApp->GetTarget();
3492
3493 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3494 {
3495 if (GetMiscValue() & (1 << i))
3496 {
3499 continue;
3500
3502 }
3503 }
3504}
3505
3507{
3509 return;
3510
3511 Unit* target = aurApp->GetTarget();
3512
3513 // only players have base stats
3514 if (target->GetTypeId() != TYPEID_PLAYER)
3515 {
3516 //pets only have base armor
3517 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3519 }
3520 else
3521 {
3522 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3523 if (GetMiscValue() & (1 << i))
3525 }
3526}
3527
3529{
3531 return;
3532
3533 Player* target = aurApp->GetTarget()->ToPlayer();
3534 if (!target)
3535 return;
3536
3537 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
3538
3539 // show armor penetration
3542
3543 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
3546}
3547
3548/********************************/
3549/*** STAT ***/
3550/********************************/
3551
3552void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3553{
3555 return;
3556
3557 if (GetMiscValue() < -2 || GetMiscValue() > 4)
3558 {
3559 TC_LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
3560 return;
3561 }
3562
3563 Unit* target = aurApp->GetTarget();
3565 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3566 return;
3567
3568 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3569 {
3570 // -1 or -2 is all stats (misc < -2 checked in function beginning)
3571 if (GetMiscValue() < 0 || GetMiscValue() == i)
3572 {
3573 if (spellGroupVal)
3574 {
3575 target->HandleStatFlatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
3576 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3577 target->UpdateStatBuffMod(Stats(i));
3578 }
3579
3581 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3582 target->UpdateStatBuffMod(Stats(i));
3583 }
3584 }
3585}
3586
3588{
3590 return;
3591
3592 Unit* target = aurApp->GetTarget();
3593
3594 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3595 {
3596 TC_LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3597 return;
3598 }
3599
3600 // only players have base stats
3601 if (target->GetTypeId() != TYPEID_PLAYER)
3602 return;
3603
3604 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3605 {
3606 if (GetMiscValue() == i || GetMiscValue() == -1)
3607 {
3608 if (apply)
3610 else
3611 {
3612 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff) -> bool
3613 {
3614 if (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1)
3615 return true;
3616 return false;
3617 });
3619 }
3620 }
3621 }
3622}
3623
3624void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3625{
3627 return;
3628
3629 Unit* target = aurApp->GetTarget();
3630
3631 if (target->GetTypeId() != TYPEID_PLAYER)
3632 return;
3633
3634 // Magic damage modifiers implemented in Unit::SpellDamageBonus
3635 // This information for client side use only
3636 // Recalculate bonus
3638}
3639
3640void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3641{
3643 return;
3644
3645 Unit* target = aurApp->GetTarget();
3646
3647 if (target->GetTypeId() != TYPEID_PLAYER)
3648 return;
3649
3650 // Recalculate bonus
3652}
3653
3654void AuraEffect::HandleModHealingDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3655{
3657 return;
3658
3659 Unit* target = aurApp->GetTarget();
3660
3661 if (target->GetTypeId() != TYPEID_PLAYER)
3662 return;
3663 // implemented in Unit::SpellHealingBonus
3664 // this information is for client side only
3666}
3667
3668void AuraEffect::HandleModHealingDonePct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3669{
3671 return;
3672
3673 if (Player* player = aurApp->GetTarget()->ToPlayer())
3674 player->UpdateHealingDonePercentMod();
3675}
3676
3677void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3678{
3680 return;
3681
3682 Unit* target = aurApp->GetTarget();
3683
3684 // save current health state
3685 float healthPct = target->GetHealthPct();
3686 bool zeroHealth = !target->IsAlive();
3687
3688 // players in corpse state may mean two different states:
3691 if (target->getDeathState() == CORPSE)
3692 zeroHealth = (target->GetHealth() == 0);
3693
3694 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3695 {
3696 if (GetMiscValueB() & 1 << i || !GetMiscValueB()) // 0 is also used for all stats
3697 {
3698 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff) -> bool
3699 {
3700 if (aurEff->GetMiscValueB() & 1 << i || !aurEff->GetMiscValueB())
3701 return true;
3702 return false;
3703 });
3704
3705 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
3706 continue;
3707
3709 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3710 target->UpdateStatBuffMod(Stats(i));
3711 }
3712 }
3713
3714 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_ABILITY 0x00000010 flag)
3715 // this check is total bullshit i think
3717 target->SetHealth(std::max<uint32>(CalculatePct(target->GetMaxHealth(), healthPct), (zeroHealth ? 0 : 1)));
3718}
3719
3720void AuraEffect::HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3721{
3723 return;
3724
3725 Unit* target = aurApp->GetTarget();
3726
3727 if (target->GetTypeId() != TYPEID_PLAYER)
3728 return;
3729
3732}
3733
3734// Increase armor by <AuraEffect.BasePoints> % of your <primary stat>
3735void AuraEffect::HandleModArmorPctFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3736{
3738 return;
3739
3740 // only players have primary stats
3741 Player* player = aurApp->GetTarget()->ToPlayer();
3742 if (!player)
3743 return;
3744
3745 player->UpdateArmor();
3746}
3747
3748void AuraEffect::HandleModBonusArmor(AuraApplication const* aurApp, uint8 mode, bool apply) const
3749{
3751 return;
3752
3754}
3755
3756void AuraEffect::HandleModBonusArmorPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3757{
3759 return;
3760
3761 aurApp->GetTarget()->UpdateArmor();
3762}
3763
3765{
3767 return;
3768
3769 Unit* target = aurApp->GetTarget();
3770
3771 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3772 {
3773 TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_STAT_BONUS_PCT not valid");
3774 return;
3775 }
3776
3777 // only players have base stats
3778 if (target->GetTypeId() != TYPEID_PLAYER)
3779 return;
3780
3781 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3782 {
3783 if (GetMiscValue() == i || GetMiscValue() == -1)
3784 {
3786 target->UpdateStatBuffMod(Stats(i));
3787 }
3788 }
3789}
3790
3792{
3794 return;
3795
3796 Player* target = aurApp->GetTarget()->ToPlayer();
3797 if (!target)
3798 return;
3799
3802}
3803
3805{
3807 return;
3808
3809 Player* target = aurApp->GetTarget()->ToPlayer();
3810 if (!target)
3811 return;
3812
3815 target->UpdateAttackPowerAndDamage(true);
3816}
3817
3818void AuraEffect::HandleModVersatilityByPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3819{
3821 return;
3822
3823 if (Player* target = aurApp->GetTarget()->ToPlayer())
3824 {
3825 target->SetVersatilityBonus(target->GetTotalAuraModifier(SPELL_AURA_MOD_VERSATILITY));
3826 target->UpdateHealingDonePercentMod();
3827 target->UpdateVersatilityDamageDone();
3828 }
3829}
3830
3832{
3834 return;
3835
3836 Unit* target = aurApp->GetTarget();
3837
3839
3840 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
3841}
3842
3843/********************************/
3844/*** HEAL & ENERGIZE ***/
3845/********************************/
3846void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3847{
3849 return;
3850
3851 Unit* target = aurApp->GetTarget();
3852
3853 if (target->GetTypeId() != TYPEID_PLAYER)
3854 return;
3855
3856 // Update manaregen value
3857 if (GetMiscValue() == POWER_MANA)
3858 target->ToPlayer()->UpdateManaRegen();
3859 else if (GetMiscValue() == POWER_RUNES)
3860 target->ToPlayer()->UpdateAllRunesRegen();
3861 // other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
3862}
3863
3865{
3866 HandleModPowerRegen(aurApp, mode, apply);
3867}
3868
3869void AuraEffect::HandleModManaRegenPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3870{
3872 return;
3873
3874 Unit* target = aurApp->GetTarget();
3875
3876 if (!target->IsPlayer())
3877 return;
3878
3879 target->ToPlayer()->UpdateManaRegen();
3880}
3881
3883{
3885 return;
3886
3887 Unit* target = aurApp->GetTarget();
3888
3889 int32 const amt = apply ? GetAmount() : -GetAmount();
3890 if (amt < 0)
3891 target->ModifyHealth(std::max<int32>(1 - target->GetHealth(), amt));
3892
3894
3895 if (amt > 0)
3896 target->ModifyHealth(amt);
3897}
3898
3900{
3902 return;
3903
3904 Unit* target = aurApp->GetTarget();
3905
3906 float percent = target->GetHealthPct();
3907
3909
3910 // refresh percentage
3911 if (target->GetHealth() > 0)
3912 {
3913 uint32 newHealth = std::max<uint32>(target->CountPctFromMaxHealth(int32(percent)), 1);
3914 target->SetHealth(newHealth);
3915 }
3916}
3917
3919{
3921 return;
3922
3923 Unit* target = aurApp->GetTarget();
3925
3926 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
3927}
3928
3930{
3932 return;
3933
3934 Unit* target = aurApp->GetTarget();
3935
3936 Powers powerType = Powers(GetMiscValue());
3938
3939 // Save old powers for further calculation
3940 int32 oldPower = target->GetPower(powerType);
3941 int32 oldMaxPower = target->GetMaxPower(powerType);
3942
3943 // Handle aura effect for max power
3944 if (apply)
3945 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, float(GetAmount()));
3946 else
3947 {
3948 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT, [powerType](AuraEffect const* aurEff) -> bool
3949 {
3950 if (aurEff->GetMiscValue() == powerType)
3951 return true;
3952 return false;
3953 });
3954
3955 amount *= target->GetTotalAuraMultiplier(SPELL_AURA_MOD_MAX_POWER_PCT, [powerType](AuraEffect const* aurEff) -> bool
3956 {
3957 if (aurEff->GetMiscValue() == powerType)
3958 return true;
3959 return false;
3960 });
3961
3962 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
3963 }
3964
3965 // Calculate the current power change
3966 int32 change = target->GetMaxPower(powerType) - oldMaxPower;
3967 change = (oldPower + change) - target->GetPower(powerType);
3968 target->ModifyPower(powerType, change);
3969}
3970
3972{
3974 return;
3975
3976 Unit* target = aurApp->GetTarget();
3977
3978 // Unit will keep hp% after MaxHealth being modified if unit is alive.
3979 float percent = target->GetHealthPct();
3980 if (apply)
3982 else
3983 {
3987 }
3988
3989 if (target->GetHealth() > 0)
3990 {
3991 uint32 newHealth = std::max<uint32>(CalculatePct(target->GetMaxHealth(), percent), 1);
3992 target->SetHealth(newHealth);
3993 }
3994}
3995
3997{
3999 return;
4000
4001 Unit* target = aurApp->GetTarget();
4002
4003 if (apply)
4005 else
4006 {
4009 }
4010}
4011
4013{
4015 return;
4016
4017 Unit* target = aurApp->GetTarget();
4018
4019 if (apply)
4021 else
4022 {
4024 target->SetStatPctModifier(UNIT_MOD_MANA, BASE_PCT, amount);
4025 }
4026}
4027
4029{
4031 return;
4032
4033 aurApp->GetTarget()->ApplyModManaCostMultiplier(GetAmount() / 100.0f, apply);
4034}
4035
4037{
4039 return;
4040
4041 if (GetMiscValue() >= MAX_POWERS)
4042 return;
4043
4044 if (apply)
4046
4047 aurApp->GetTarget()->UpdateDisplayPower();
4048}
4049
4051{
4052 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4053 return;
4054
4055 PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(GetMiscValue());
4056 if (!powerDisplay)
4057 return;
4058
4059 Unit* target = aurApp->GetTarget();
4060 if (target->GetPowerIndex(Powers(powerDisplay->ActualType)) == MAX_POWERS)
4061 return;
4062
4063 if (apply)
4064 {
4066 target->SetOverrideDisplayPowerId(powerDisplay->ID);
4067 }
4068 else
4069 target->SetOverrideDisplayPowerId(0);
4070}
4071
4073{
4075 return;
4076
4077 Unit * target = aurApp->GetTarget();
4078 if (!target->IsPlayer())
4079 return;
4080
4081 Powers powerType = Powers(GetMiscValue());
4083
4084 // Save old powers for further calculation
4085 int32 oldPower = target->GetPower(powerType);
4086 int32 oldMaxPower = target->GetMaxPower(powerType);
4087
4088 // Handle aura effect for max power
4089 if (apply)
4090 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, float(GetAmount()));
4091 else
4092 {
4093 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_MAX_POWER_PCT, [powerType](AuraEffect const* aurEff) -> bool
4094 {
4095 if (aurEff->GetMiscValue() == powerType)
4096 return true;
4097 return false;
4098 });
4099
4100 amount *= target->GetTotalAuraMultiplier(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT, [powerType](AuraEffect const* aurEff) -> bool
4101 {
4102 if (aurEff->GetMiscValue() == powerType)
4103 return true;
4104 return false;
4105 });
4106
4107 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4108 }
4109
4110 // Calculate the current power change
4111 int32 change = target->GetMaxPower(powerType) - oldMaxPower;
4112 change = (oldPower + change) - target->GetPower(powerType);
4113 target->ModifyPower(powerType, change);
4114}
4115
4117{
4118 if (!(mode & AURA_EFFECT_HANDLE_REAL) || !apply)
4119 return;
4120
4121 Unit* target = aurApp->GetTarget();
4122 int32 thresholdPct = GetAmount();
4123 uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell;
4124
4126 {
4128 if (!target->HealthAbovePct(thresholdPct))
4129 return;
4130 break;
4132 if (!target->HealthBelowPct(thresholdPct))
4133 return;
4134 break;
4135 default:
4136 break;
4137 }
4138
4139 target->CastSpell(target, triggerSpell, this);
4140}
4141
4142/********************************/
4143/*** FIGHT ***/
4144/********************************/
4145
4146void AuraEffect::HandleAuraModParryPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4147{
4149 return;
4150
4151 Unit* target = aurApp->GetTarget();
4152
4153 if (target->GetTypeId() != TYPEID_PLAYER)
4154 return;
4155
4156 target->ToPlayer()->UpdateParryPercentage();
4157}
4158
4159void AuraEffect::HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4160{
4162 return;
4163
4164 Unit* target = aurApp->GetTarget();
4165
4166 if (target->GetTypeId() != TYPEID_PLAYER)
4167 return;
4168
4169 target->ToPlayer()->UpdateDodgePercentage();
4170}
4171
4172void AuraEffect::HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4173{
4175 return;
4176
4177 Unit* target = aurApp->GetTarget();
4178
4179 if (target->GetTypeId() != TYPEID_PLAYER)
4180 return;
4181
4182 target->ToPlayer()->UpdateBlockPercentage();
4183}
4184
4185void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4186{
4188 return;
4189
4190 Unit* target = aurApp->GetTarget();
4191
4192 if (!target->IsPlayer())
4193 return;
4194
4195 target->ToPlayer()->UpdateManaRegen();
4196}
4197
4198void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4199{
4201 return;
4202
4203 Player* target = aurApp->GetTarget()->ToPlayer();
4204 if (!target)
4205 return;
4206
4208}
4209
4211{
4213 return;
4214
4215 Unit* target = aurApp->GetTarget();
4216
4217 if (target->GetTypeId() == TYPEID_PLAYER)
4218 target->ToPlayer()->UpdateSpellHitChances();
4219 else
4220 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4221}
4222
4224{
4226 return;
4227
4228 Unit* target = aurApp->GetTarget();
4229
4230 if (target->GetTypeId() == TYPEID_PLAYER)
4231 target->ToPlayer()->UpdateSpellCritChance();
4232 else
4233 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
4234}
4235
4237{
4239 return;
4240
4241 Unit* target = aurApp->GetTarget();
4242
4243 if (target->GetTypeId() != TYPEID_PLAYER)
4244 {
4245 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
4246 return;
4247 }
4248
4250
4251 // included in Player::UpdateSpellCritChance calculation
4252 target->ToPlayer()->UpdateSpellCritChance();
4253}
4254
4255/********************************/
4256/*** ATTACK SPEED ***/
4257/********************************/
4258
4260{
4262 return;
4263
4264 Unit* target = aurApp->GetTarget();
4265
4266 // Do not apply such auras in normal way
4267 if (GetAmount() >= 1000)
4268 {
4269 if (apply)
4270 target->SetInstantCast(true);
4271 else
4272 {
4273 // only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount
4274 // it's some rare case that you have 2 auras like that, but just in case ;)
4275
4276 bool remove = true;
4278 for (AuraEffect const* aurEff : castingSpeedNotStack)
4279 {
4280 if (aurEff != this && aurEff->GetAmount() >= 1000)
4281 {
4282 remove = false;
4283 break;
4284 }
4285 }
4286
4287 if (remove)
4288 target->SetInstantCast(false);
4289 }
4290
4291 return;
4292 }
4293
4294 int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
4295 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4296 return;
4297
4298 if (spellGroupVal)
4299 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4300
4301 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
4302}
4303
4305{
4307 return;
4308
4310 Unit* target = aurApp->GetTarget();
4311
4315}
4316
4318{
4320 return;
4321
4322 Unit* target = aurApp->GetTarget();
4324 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4325 return;
4326
4327 if (spellGroupVal)
4328 {
4329 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4330 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4331 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4332 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
4333 }
4334 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4338}
4339
4341{
4343 return;
4344
4345 Unit* target = aurApp->GetTarget();
4346
4349}
4350
4352{
4354 return;
4355
4357 Unit* target = aurApp->GetTarget();
4359 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4360 return;
4361
4362 if (spellGroupVal)
4363 {
4364 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4365 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4366 }
4369}
4370
4372{
4374 return;
4375
4377 Unit* target = aurApp->GetTarget();
4378
4380}
4381
4382/********************************/
4383/*** COMBAT RATING ***/
4384/********************************/
4385
4386void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool apply) const
4387{
4389 return;
4390
4391 Unit* target = aurApp->GetTarget();
4392
4393 if (target->GetTypeId() != TYPEID_PLAYER)
4394 return;
4395
4396 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4397 if (GetMiscValue() & (1 << rating))
4398 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4399}
4400
4401void AuraEffect::HandleModRatingPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4402{
4404 return;
4405
4406 Unit* target = aurApp->GetTarget();
4407
4408 if (target->GetTypeId() != TYPEID_PLAYER)
4409 return;
4410
4411 // Just recalculate ratings
4412 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4413 if (GetMiscValue() & (1 << rating))
4414 target->ToPlayer()->UpdateRating(CombatRating(rating));
4415}
4416
4417/********************************/
4418/*** ATTACK POWER ***/
4419/********************************/
4420
4422{
4424 return;
4425
4426 Unit* target = aurApp->GetTarget();
4427
4429}
4430
4432{
4434 return;
4435
4436 Unit* target = aurApp->GetTarget();
4437
4438 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4439 return;
4440
4442}
4443
4445{
4447 return;
4448
4449 Unit* target = aurApp->GetTarget();
4450
4451 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4452 if (apply)
4454 else
4455 {
4458 }
4459}
4460
4462{
4464 return;
4465
4466 Unit* target = aurApp->GetTarget();
4467
4468 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4469 return;
4470
4471 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4472 if (apply)
4474 else
4475 {
4478 }
4479}
4480
4481/********************************/
4482/*** DAMAGE BONUS ***/
4483/********************************/
4484void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const
4485{
4487 return;
4488
4489 Unit* target = aurApp->GetTarget();
4490
4492 target->UpdateAllDamageDoneMods();
4493
4494 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonusDone
4495 // This information for client side use only
4496 if (Player* playerTarget = target->ToPlayer())
4497 {
4498 for (uint16 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
4499 if (GetMiscValue() & (1 << i))
4500 {
4501 if (GetAmount() >= 0)
4502 playerTarget->ApplyModDamageDonePos(SpellSchools(i), GetAmount(), apply);
4503 else
4504 playerTarget->ApplyModDamageDoneNeg(SpellSchools(i), GetAmount(), apply);
4505 }
4506
4507 if (Guardian* pet = playerTarget->GetGuardianPet())
4508 pet->UpdateAttackPowerAndDamage();
4509 }
4510}
4511
4512void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4513{
4515 return;
4516
4517 Unit* target = aurApp->GetTarget();
4518
4519 // also handles spell group stacks
4522
4523 if (Player* thisPlayer = target->ToPlayer())
4524 {
4525 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
4526 {
4527 if (GetMiscValue() & (1 << i))
4528 {
4529 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
4530 float amount = thisPlayer->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, 1 << i);
4531 thisPlayer->SetModDamageDonePercent(i, amount);
4532 }
4533 }
4534 }
4535}
4536
4537void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4538{
4540 return;
4541
4542 Unit* target = aurApp->GetTarget();
4543
4544 // also handles spell group stacks
4546}
4547
4549{
4551 return;
4552
4553 if (Player* player = aurApp->GetTarget()->ToPlayer())
4554 player->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
4555}
4556
4558{
4560 return;
4561
4562 Player* target = aurApp->GetTarget()->ToPlayer();
4563 if (!target)
4564 return;
4565
4566 if (apply)
4568 else
4569 {
4571 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
4572 }
4573}
4574
4575/********************************/
4576/*** POWER COST ***/
4577/********************************/
4578
4579void AuraEffect::HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, bool apply) const
4580{
4582 return;
4583
4584 // handled in SpellInfo::CalcPowerCost, this is only for client UI
4585 if (!(GetMiscValueB() & (1 << POWER_MANA)))
4586 return;
4587
4588 Unit* target = aurApp->GetTarget();
4589
4590 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4591 if (GetMiscValue() & (1 << i))
4593}
4594
4596{
4597 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4598 return;
4599
4600 Unit* target = aurApp->GetTarget();
4601
4602 if (apply)
4604 else
4605 {
4606 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4607 if (target->HasAuraType(GetAuraType()))
4608 return;
4610 }
4611
4613}
4614
4615void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4616{
4617 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4618 return;
4619
4620 Unit* target = aurApp->GetTarget();
4621
4622 if (target->GetTypeId() != TYPEID_PLAYER)
4623 return;
4624
4625 flag128 mask;
4627 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
4628 mask |= (*i)->GetSpellEffectInfo().SpellClassMask;
4629
4630 target->ToPlayer()->SetNoRegentCostMask(mask);
4631}
4632
4633/*********************************************************/
4634/*** OTHERS ***/
4635/*********************************************************/
4636
4637void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4638{
4640 return;
4641
4642 Unit* target = aurApp->GetTarget();
4643
4644 Unit* caster = GetCaster();
4645
4646 // pet auras
4647 if (target->GetTypeId() == TYPEID_PLAYER && (mode & AURA_EFFECT_HANDLE_REAL))
4648 {
4649 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), GetEffIndex()))
4650 {
4651 if (apply)
4652 target->ToPlayer()->AddPetAura(petSpell);
4653 else
4654 target->ToPlayer()->RemovePetAura(petSpell);
4655 }
4656 }
4657
4659 {
4660 // AT APPLY
4661 if (apply)
4662 {
4663 switch (GetId())
4664 {
4665 case 1515: // Tame beast
4666 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
4667 if (caster && target->CanHaveThreatList())
4668 target->GetThreatManager().AddThreat(caster, 10.0f);
4669 break;
4670 case 13139: // net-o-matic
4671 // root to self part of (root_target->charge->root_self sequence
4672 if (caster)
4673 caster->CastSpell(caster, 13138, this);
4674 break;
4675 case 34026: // kill command
4676 {
4677 Unit* pet = target->GetGuardianPet();
4678 if (!pet)
4679 break;
4680
4681 target->CastSpell(target, 34027, this);
4682
4683 // set 3 stacks and 3 charges (to make all auras not disappear at once)
4684 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
4685 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
4686 if (owner_aura)
4687 {
4688 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4689 if (pet_aura)
4690 {
4691 pet_aura->SetCharges(0);
4692 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4693 }
4694 }
4695 break;
4696 }
4697 case 37096: // Blood Elf Illusion
4698 {
4699 if (caster)
4700 {
4701 if (caster->GetGender() == GENDER_FEMALE)
4702 caster->CastSpell(target, 37095, this); // Blood Elf Disguise
4703 else
4704 caster->CastSpell(target, 37093, this);
4705 }
4706 break;
4707 }
4708 case 39850: // Rocket Blast
4709 if (roll_chance_i(20)) // backfire stun
4710 target->CastSpell(target, 51581, this);
4711 break;
4712 case 43873: // Headless Horseman Laugh
4713 target->PlayDistanceSound(11965);
4714 break;
4715 case 46354: // Blood Elf Illusion
4716 if (caster)
4717 {
4718 if (caster->GetGender() == GENDER_FEMALE)
4719 caster->CastSpell(target, 46356, this);
4720 else
4721 caster->CastSpell(target, 46355, this);
4722 }
4723 break;
4724 case 46361: // Reinforced Net
4725 if (caster)
4726 target->GetMotionMaster()->MoveFall();
4727 break;
4728 }
4729 }
4730 // AT REMOVE
4731 else
4732 {
4734 {
4736 switch (GetId())
4737 {
4738 case 43681: // Inactive
4739 {
4740 if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
4741 return;
4742
4743 if (target->GetMap()->IsBattleground())
4744 target->ToPlayer()->LeaveBattleground();
4745 break;
4746 }
4747 case 46308: // Burning Winds cast only at creatures at spawn
4748 target->CastSpell(target, 47287, this);
4749 break;
4750 case 52172: // Coyote Spirit Despawn Aura
4751 case 60244: // Blood Parrot Despawn Aura
4752 target->CastSpell(nullptr, GetAmount(), this);
4753 break;
4754 case 91604: // Restricted Flight Area
4755 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
4756 target->CastSpell(target, 58601, this);
4757 break;
4758 }
4759 break;
4761 // Summon Gargoyle (Dismiss Gargoyle at remove)
4762 if (GetId() == 61777)
4763 target->CastSpell(target, GetAmount(), this);
4764 break;
4765 default:
4766 break;
4767 }
4768 }
4769 }
4770
4771 // AT APPLY & REMOVE
4772
4774 {
4776 {
4777 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4778 break;
4779 switch (GetId())
4780 {
4781 // Recently Bandaged
4782 case 11196:
4784 break;
4785 // Unstable Power
4786 case 24658:
4787 {
4788 uint32 spellId = 24659;
4789 if (apply && caster)
4790 {
4791 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId, GetBase()->GetCastDifficulty());
4792 CastSpellExtraArgs args;
4795 args.OriginalCastId = GetBase()->GetCastId();
4797
4798 for (uint32 i = 0; i < spell->StackAmount; ++i)
4799 caster->CastSpell(target, spell->Id, args);
4800 break;
4801 }
4802 target->RemoveAurasDueToSpell(spellId);
4803 break;
4804 }
4805 // Restless Strength
4806 case 24661:
4807 {
4808 uint32 spellId = 24662;
4809 if (apply && caster)
4810 {
4811 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId, GetBase()->GetCastDifficulty());
4812 CastSpellExtraArgs args;
4815 args.OriginalCastId = GetBase()->GetCastId();
4817
4818 for (uint32 i = 0; i < spell->StackAmount; ++i)
4819 caster->CastSpell(target, spell->Id, args);
4820 break;
4821 }
4822 target->RemoveAurasDueToSpell(spellId);
4823 break;
4824 }
4825 // Tag Murloc
4826 case 30877:
4827 {
4828 // Tag/untag Blacksilt Scout
4829 target->SetEntry(apply ? 17654 : 17326);
4830 break;
4831 }
4832 case 57819: // Argent Champion
4833 case 57820: // Ebon Champion
4834 case 57821: // Champion of the Kirin Tor
4835 case 57822: // Wyrmrest Champion
4836 {
4837 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4838 break;
4839
4840 uint32 FactionID = 0;
4841
4842 if (apply)
4843 {
4844 switch (m_spellInfo->Id)
4845 {
4846 case 57819: FactionID = 1106; break; // Argent Crusade
4847 case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
4848 case 57821: FactionID = 1090; break; // Kirin Tor
4849 case 57822: FactionID = 1091; break; // The Wyrmrest Accord
4850 }
4851 }
4852 caster->ToPlayer()->SetChampioningFaction(FactionID);
4853 break;
4854 }
4855 // LK Intro VO (1)
4856 case 58204:
4857 if (target->GetTypeId() == TYPEID_PLAYER)
4858 {
4859 // Play part 1
4860 if (apply)
4861 target->PlayDirectSound(14970, target->ToPlayer());
4862 // continue in 58205
4863 else
4864 target->CastSpell(target, 58205, this);
4865 }
4866 break;
4867 // LK Intro VO (2)
4868 case 58205:
4869 if (target->GetTypeId() == TYPEID_PLAYER)
4870 {
4871 // Play part 2
4872 if (apply)
4873 target->PlayDirectSound(14971, target->ToPlayer());
4874 // Play part 3
4875 else
4876 target->PlayDirectSound(14972, target->ToPlayer());
4877 }
4878 break;
4879 }
4880
4881 break;
4882 }
4883 case SPELLFAMILY_MAGE:
4884 {
4885 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4886 //break;
4887 break;
4888 }
4889 case SPELLFAMILY_PRIEST:
4890 {
4891 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4892 //break;
4893 break;
4894 }
4895 case SPELLFAMILY_DRUID:
4896 {
4897 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4898 //break;
4899 break;
4900 }
4901 case SPELLFAMILY_SHAMAN:
4902 {
4903 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4904 //break;
4905 break;
4906 }
4908 // if (!(mode & AURA_EFFECT_HANDLE_REAL))
4909 // break;
4910 break;
4912 {
4913 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4914 // break;
4915 break;
4916 }
4917 }
4918}
4919
4921{
4922 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4923 return;
4924
4925 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
4926 return;
4927
4928 Unit* caster = GetCaster();
4929
4930 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4931 return;
4932
4933 Player* plCaster = caster->ToPlayer();
4934 Unit* target = aurApp->GetTarget();
4935
4936 // Item amount
4937 if (GetAmount() <= 0)
4938 return;
4939
4940 if (GetSpellEffectInfo().ItemType == 0)
4941 return;
4942
4943 // Soul Shard
4944 if (GetSpellEffectInfo().ItemType == 6265)
4945 {
4946 // Soul Shard only from units that grant XP or honor
4947 if (!plCaster->isHonorOrXPTarget(target) ||
4948 (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
4949 return;
4950 }
4951
4952 //Adding items
4953 uint32 noSpaceForCount = 0;
4954 uint32 count = GetAmount();
4955
4956 ItemPosCountVec dest;
4957 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellEffectInfo().ItemType, count, &noSpaceForCount);
4958 if (msg != EQUIP_ERR_OK)
4959 {
4960 count -= noSpaceForCount;
4961 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellEffectInfo().ItemType);
4962 if (count == 0)
4963 return;
4964 }
4965
4966 if (Item* newitem = plCaster->StoreNewItem(dest, GetSpellEffectInfo().ItemType, true))
4967 plCaster->SendNewItem(newitem, count, true, true);
4968}
4969
4970void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
4971{
4972 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4973 return;
4974
4975 Unit* target = aurApp->GetTarget();
4976
4977 Unit* caster = GetCaster();
4978
4979 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4980 return;
4981
4982 caster->ToPlayer()->SetViewpoint(target, apply);
4983}
4984
4985void AuraEffect::HandleForceReaction(AuraApplication const* aurApp, uint8 mode, bool apply) const
4986{
4988 return;
4989
4990 Unit* target = aurApp->GetTarget();
4991
4992 Player* player = target->ToPlayer();
4993 if (!player)
4994 return;
4995
4996 uint32 factionId = GetMiscValue();
4997 ReputationRank factionRank = ReputationRank(GetAmount());
4998
4999 player->GetReputationMgr().ApplyForceReaction(factionId, factionRank, apply);
5001
5002 // stop fighting at apply (if forced rank friendly) or at remove (if real rank friendly)
5003 if ((apply && factionRank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(factionId) >= REP_FRIENDLY))
5004 player->StopAttackFaction(factionId);
5005}
5006
5007void AuraEffect::HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bool apply) const
5008{
5009 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5010 return;
5011
5012 Unit* target = aurApp->GetTarget();
5013 if (!apply)
5014 {
5015 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5016 if (target->HasAuraType(GetAuraType()))
5017 return;
5018 }
5019
5020 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5021 {
5022 if (apply)
5024 else
5026 }
5027}
5028
5030{
5031 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5032 return;
5033
5034 Unit* target = aurApp->GetTarget();
5035
5036 if (apply)
5037 {
5038 target->SetFaction(GetMiscValue());
5039 if (target->GetTypeId() == TYPEID_PLAYER)
5041 }
5042 else
5043 {
5044 target->RestoreFaction();
5045 if (target->GetTypeId() == TYPEID_PLAYER)
5047 }
5048}
5049
5050void AuraEffect::HandleLearnSpell(AuraApplication const* aurApp, uint8 mode, bool apply) const
5051{
5052 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5053 return;
5054
5055 Player* player = aurApp->GetTarget()->ToPlayer();
5056 if (!player)
5057 return;
5058
5059 if (apply)
5060 player->LearnSpell(GetMiscValue(), true, 0, true);
5061 else
5062 player->RemoveSpell(GetMiscValue(), false, false, true);
5063}
5064
5066{
5068 return;
5069
5070 Unit* target = aurApp->GetTarget();
5071
5072 if (apply)
5074 else
5075 {
5076 if (target->HasAuraType(GetAuraType()))
5077 return;
5078
5080 }
5081}
5082
5084{
5086 return;
5087
5088 Unit* target = aurApp->GetTarget();
5089
5090 if (apply)
5092 else
5093 {
5094 if (target->HasAuraType(GetAuraType()))
5095 return;
5096
5098 }
5099}
5100
5101void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const
5102{
5103 Unit* target = aurApp->GetTarget();
5104
5105 uint32 triggeredSpellId = GetSpellEffectInfo().TriggerSpell;
5106 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId, GetBase()->GetCastDifficulty());
5107 if (!triggeredSpellInfo)
5108 return;
5109
5110 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
5111 if (!caster)
5112 return;
5113
5114 if (mode & AURA_EFFECT_HANDLE_REAL)
5115 {
5116 if (apply)
5117 {
5118 CastSpellExtraArgs args(this);
5119 if (GetAmount()) // If amount avalible cast with basepoints (Crypt Fever for example)
5121
5122 caster->CastSpell(target, triggeredSpellId, args);
5123 }
5124 else
5125 {
5126 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
5127 target->RemoveAura(triggeredSpellId, casterGUID);
5128 }
5129 }
5130 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
5131 {
5132 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
5133 // change the stack amount to be equal to stack amount of our aura
5134 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
5135 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
5136 }
5137}
5138
5140{
5141 if (!(mode & AURA_EFFECT_HANDLE_REAL) || !apply)
5142 return;
5143
5144 Unit* target = aurApp->GetTarget();
5145
5146 int32 effectAmount = GetAmount();
5147 uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell;
5148 float powerAmountPct = GetPctOf(target->GetPower(Powers(GetMiscValue())), target->GetMaxPower(Powers(GetMiscValue())));
5149
5151 {
5153 if (powerAmountPct < effectAmount)
5154 return;
5155 break;
5157 if (powerAmountPct > effectAmount)
5158 return;
5159 break;
5160 default:
5161 break;
5162 }
5163
5164 target->CastSpell(target, triggerSpell, this);
5165}
5166
5168{
5169 if (!(mode & AURA_EFFECT_HANDLE_REAL) || !apply)
5170 return;
5171
5172 Unit* target = aurApp->GetTarget();
5173
5174 int32 effectAmount = GetAmount();
5175 uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell;
5176 float powerAmount = target->GetPower(Powers(GetMiscValue()));
5177
5179 {
5181 if (powerAmount < effectAmount)
5182 return;
5183 break;
5185 if (powerAmount > effectAmount)
5186 return;
5187 break;
5188 default:
5189 break;
5190 }
5191
5192 target->CastSpell(target, triggerSpell, this);
5193}
5194
5196{
5197 if (!(mode & AURA_EFFECT_HANDLE_REAL) || apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5198 return;
5199
5200 Unit* caster = aurApp->GetTarget();
5201
5202 // MiscValue (Caster):
5203 // 0 - Aura target
5204 // 1 - Aura caster
5205 // 2 - ? Aura target is always TARGET_UNIT_CASTER so we consider the same behavior as MiscValue 1
5206 uint32 casterType = uint32(GetMiscValue());
5207 if (casterType > 0)
5208 caster = GetCaster();
5209
5210 if (caster)
5211 caster->CastSpell(aurApp->GetTarget(), GetSpellEffectInfo().TriggerSpell, this);
5212}
5213
5215{
5216 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5217 return;
5218
5219 Unit* target = aurApp->GetTarget();
5220
5221 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
5222 return;
5223
5224 if (apply)
5225 target->ToPlayer()->SetStableMaster(target->GetGUID());
5226
5227 // client auto close stable dialog at !apply aura
5228}
5229
5231{
5233 return;
5234
5235 Unit* target = aurApp->GetTarget();
5236
5237 if (apply)
5238 {
5241
5242 if (Player* playerTarget = target->ToPlayer())
5243 playerTarget->ApplyModFakeInebriation(GetAmount(), true);
5244 }
5245 else
5246 {
5247 bool removeDetect = !target->HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE);
5248
5250
5251 if (Player* playerTarget = target->ToPlayer())
5252 {
5253 playerTarget->ApplyModFakeInebriation(GetAmount(), false);
5254
5255 if (removeDetect)
5256 removeDetect = !playerTarget->GetDrunkValue();
5257 }
5258
5259 if (removeDetect)
5261 }
5262
5263 // call functions which may have additional effects after changing state of unit
5264 if (target->IsInWorld())
5265 target->UpdateObjectVisibility();
5266}
5267
5269{
5270 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5271 return;
5272
5273 Player* target = aurApp->GetTarget()->ToPlayer();
5274
5275 if (!target || !target->IsInWorld())
5276 return;
5277
5278 uint32 overrideId = uint32(GetMiscValue());
5279
5280 if (apply)
5281 {
5282 target->SetOverrideSpellsId(overrideId);
5283 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5284 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5285 if (uint32 spellId = overrideSpells->Spells[i])
5286 target->AddTemporarySpell(spellId);
5287 }
5288 else
5289 {
5290 target->SetOverrideSpellsId(0);
5291 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5292 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5293 if (uint32 spellId = overrideSpells->Spells[i])
5294 target->RemoveTemporarySpell(spellId);
5295 }
5296}
5297
5299{
5300 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5301 return;
5302
5303 Unit* target = aurApp->GetTarget();
5304
5305 if (!target->IsInWorld())
5306 return;
5307
5308 uint32 vehicleId = GetMiscValue();
5309
5310 if (apply)
5311 {
5312 if (!target->CreateVehicleKit(vehicleId, 0))
5313 return;
5314 }
5315 else if (target->GetVehicleKit())
5316 target->RemoveVehicleKit();
5317
5318 if (target->GetTypeId() != TYPEID_PLAYER)
5319 return;
5320
5321 if (apply)
5323}
5324
5325void AuraEffect::HandleSetVignette(AuraApplication const* aurApp, uint8 mode, bool apply) const
5326{
5327 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5328 return;
5329
5330 aurApp->GetTarget()->SetVignette(apply ? GetMiscValue() : 0);
5331}
5332
5334{
5335 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5336 return;
5337
5338 Player* target = aurApp->GetTarget()->ToPlayer();
5339 if (!target)
5340 return;
5341
5342 if (apply)
5344 else if (!target->GetMap()->Instanceable())
5346}
5347
5348void AuraEffect::HandleMastery(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
5349{
5350 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5351 return;
5352
5353 Player* target = aurApp->GetTarget()->ToPlayer();
5354 if (!target)
5355 return;
5356
5357 target->UpdateMastery();
5358}
5359
5361{
5362 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5363 if (triggerSpellId == 0)
5364 {
5365 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5366 return;
5367 }
5368
5369 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
5370 {
5371 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5372 {
5373 triggerCaster->CastSpell(target, triggerSpellId, this);
5374 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5375 }
5376 }
5377 else
5378 TC_LOG_ERROR("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5379}
5380
5382{
5383 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5384 if (triggerSpellId == 0)
5385 {
5386 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5387 return;
5388 }
5389
5390 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
5391 {
5392 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5393 {
5394 CastSpellExtraArgs args(this);
5395 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5397 triggerCaster->CastSpell(target, triggerSpellId, args);
5398 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5399 }
5400 }
5401 else
5402 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5403}
5404
5406{
5407 if (!target->IsAlive())
5408 return;
5409
5411 {
5412 SendTickImmune(target, caster);
5413 return;
5414 }
5415
5416 // Consecrate ticks can miss and will not show up in the combat log
5417 // dynobj auras must always have a caster
5419 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5420 return;
5421
5423
5425
5426 // ignore negative values (can be result apply spellmods to aura damage
5427 uint32 damage = std::max(GetAmount(), 0);
5428
5429 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5430 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5431
5432 switch (GetAuraType())
5433 {
5435 {
5436 if (caster)
5437 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5438 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5439
5440 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
5441 {
5442 switch (GetId())
5443 {
5444 case 70911: // Unbound Plague
5445 case 72854: // Unbound Plague
5446 case 72855: // Unbound Plague
5447 case 72856: // Unbound Plague
5448 damage *= uint32(pow(1.25f, int32(_ticksDone)));
5449 break;
5450 default:
5451 break;
5452 }
5453 }
5454 break;
5455 }
5457 {
5459
5460 damage = CalculatePct(caster->CalculateDamage(attackType, false, true), GetAmount());
5461
5462 // Add melee damage bonuses (also check for negative)
5463 if (caster)
5464 damage = caster->MeleeDamageBonusDone(target, damage, attackType, DOT, GetSpellInfo(), GetSpellEffectInfo().Mechanic, GetSpellInfo()->GetSchoolMask(), nullptr, this);
5465
5466 damage = target->MeleeDamageBonusTaken(caster, damage, attackType, DOT, GetSpellInfo());
5467 break;
5468 }
5470 // ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
5471 damage = uint32(ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
5472 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5473 break;
5474 default:
5475 break;
5476 }
5477
5478 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5479 if (crit)
5480 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5481
5482 // Calculate armor mitigation
5483 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5484 {
5485 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5486 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5487 damage = damageReducedArmor;
5488 }
5489
5491 {
5493 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE));
5494 }
5495
5496 int32 dmg = damage;
5497 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS) && caster && caster->CanApplyResilience())
5498 Unit::ApplyResilience(target, &dmg);
5499 damage = dmg;
5500
5501 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, BASE_ATTACK);
5502 Unit::CalcAbsorbResist(damageInfo);
5503 damage = damageInfo.GetDamage();
5504
5505 uint32 absorb = damageInfo.GetAbsorb();
5506 uint32 resist = damageInfo.GetResist();
5507 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} absorb is {}",
5508 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5509
5510 Unit::DealDamageMods(caster, target, damage, &absorb);
5511
5512 // Set trigger flag
5515 ProcFlagsHit hitMask = damageInfo.GetHitMask();
5516 if (damage)
5517 {
5518 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5519 procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
5520 }
5521
5522 int32 overkill = damage - target->GetHealth();
5523 if (overkill < 0)
5524 overkill = 0;
5525
5526 SpellPeriodicAuraLogInfo pInfo(this, damage, dmg, overkill, absorb, resist, 0.0f, crit);
5527
5528 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
5529
5530 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5531
5532 target->SendPeriodicAuraLog(&pInfo);
5533}
5534
5536{
5538}
5539
5541{
5542 if (!target->IsAlive())
5543 return;
5544
5546 {
5547 SendTickImmune(target, caster);
5548 return;
5549 }
5550
5551 // dynobj auras must always have a caster
5553 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5554 return;
5555
5556 CleanDamage cleanDamage = CleanDamage(0, 0, GetSpellInfo()->GetAttackType(), MELEE_HIT_NORMAL);
5557
5559
5560 // ignore negative values (can be result apply spellmods to aura damage
5561 uint32 damage = std::max(GetAmount(), 0);
5562
5563 if (caster)
5564 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5565 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5566
5567 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5568 if (crit)
5569 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5570
5571 // Calculate armor mitigation
5572 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5573 {
5574 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5575 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5576 damage = damageReducedArmor;
5577 }
5578
5580 {
5582 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE));
5583 }
5584
5585 int32 dmg = damage;
5586 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS) && caster && caster->CanApplyResilience())
5587 Unit::ApplyResilience(target, &dmg);
5588 damage = dmg;
5589
5590 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, GetSpellInfo()->GetAttackType());
5591 Unit::CalcAbsorbResist(damageInfo);
5592
5593 uint32 absorb = damageInfo.GetAbsorb();
5594 uint32 resist = damageInfo.GetResist();
5595 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
5596 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5597
5598 // SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
5599 SpellNonMeleeDamage log(caster, target, GetSpellInfo(), GetBase()->GetSpellVisual(), GetSpellInfo()->GetSchoolMask(), GetBase()->GetCastId());
5600 log.damage = damage;
5601 log.originalDamage = dmg;
5602 log.absorb = absorb;
5603 log.resist = resist;
5604 log.periodicLog = true;
5605 if (crit)
5607
5608 // Set trigger flag
5611 ProcFlagsHit hitMask = damageInfo.GetHitMask();
5612 if (damage)
5613 {
5614 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5615 procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
5616 }
5617
5618 int32 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
5619 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5620
5621 // process caster heal from now on (must be in world)
5622 if (!caster || !caster->IsAlive())
5623 return;
5624
5625 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5626
5627 uint32 heal = caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5628 heal = caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
5629
5630 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5631 caster->HealBySpell(healInfo);
5632
5633 caster->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5635
5636 caster->SendSpellNonMeleeDamageLog(&log);
5637}
5638
5640{
5641 if (!caster || !caster->IsAlive() || !target->IsAlive())
5642 return;
5643
5644 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5645 {
5646 SendTickImmune(target, caster);
5647 return;
5648 }
5649
5650 uint32 damage = std::max(GetAmount(), 0);
5651 // do not kill health donator
5652 if (caster->GetHealth() < damage)
5653 damage = caster->GetHealth() - 1;
5654 if (!damage)
5655 return;
5656
5657 caster->ModifyHealth(-(int32)damage);
5658 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
5659
5660 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5661
5662 damage = int32(damage * gainMultiplier);
5663
5664 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5665 caster->HealBySpell(healInfo);
5667}
5668
5670{
5671 if (!target->IsAlive())
5672 return;
5673
5674 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5675 {
5676 SendTickImmune(target, caster);
5677 return;
5678 }
5679
5680 // don't regen when permanent aura target has full power
5681 if (GetBase()->IsPermanent() && target->IsFullHealth())
5682 return;
5683
5685
5686 // ignore negative values (can be result apply spellmods to aura damage
5687 uint32 damage = std::max(GetAmount(), 0);
5688
5690 damage = uint32(target->CountPctFromMaxHealth(damage));
5691 else if (caster)
5692 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5693
5694 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT);
5695
5696 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5697 if (crit)
5698 damage = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, damage, target);
5699
5700 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
5701 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
5702
5703 uint32 heal = damage;
5704
5705 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5706 Unit::CalcHealAbsorb(healInfo);
5707 Unit::DealHeal(healInfo);
5708
5709 SpellPeriodicAuraLogInfo pInfo(this, heal, damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
5710 target->SendPeriodicAuraLog(&pInfo);
5711
5712 if (caster)
5713 target->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5714
5715 // %-based heal - does not proc auras
5717 return;
5718
5722 // ignore item heals
5723 if (GetBase()->GetCastItemGUID().IsEmpty())
5724 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_HEAL, PROC_SPELL_PHASE_HIT, hitMask, nullptr, nullptr, &healInfo);
5725}
5726
5728{
5729 Powers powerType = Powers(GetMiscValue());
5730
5731 if (!caster || !caster->IsAlive() || !target->IsAlive() || target->GetPowerType() != powerType)
5732 return;
5733
5735 {
5736 SendTickImmune(target, caster);
5737 return;
5738 }
5739
5741 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5742 return;
5743
5744 // ignore negative values (can be result apply spellmods to aura damage
5745 int32 drainAmount = std::max(GetAmount(), 0);
5746
5747 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
5748 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
5749
5750 int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
5751
5752 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5753
5754 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, drainAmount, 0, 0, 0, gainMultiplier, false);
5755
5756 int32 gainAmount = int32(drainedAmount * gainMultiplier);
5757 int32 gainedAmount = 0;
5758 if (gainAmount)
5759 {
5760 gainedAmount = caster->ModifyPower(powerType, gainAmount);
5761 // energize is not modified by threat modifiers
5762 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_NO_HELPFUL_THREAT))
5763 target->GetThreatManager().AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo(), true);
5764 }
5765
5766 // Drain Mana - Mana Feed effect
5768 {
5769 int32 manaFeedVal = 0;
5770 if (AuraEffect const* aurEff = GetBase()->GetEffect(EFFECT_1))
5771 manaFeedVal = aurEff->GetAmount();
5772
5773 if (manaFeedVal > 0)
5774 {
5775 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
5776
5777 CastSpellExtraArgs args(this);
5778 args.AddSpellMod(SPELLVALUE_BASE_POINT0, feedAmount);
5779 caster->CastSpell(caster, 32554, args);
5780 }
5781 }
5782
5783 target->SendPeriodicAuraLog(&pInfo);
5784}
5785
5787{
5788 Powers powerType;
5789 if (GetMiscValue() == POWER_ALL)
5790 powerType = target->GetPowerType();
5791 else
5792 powerType = Powers(GetMiscValue());
5793
5794 if (!target->IsAlive() || !target->GetMaxPower(powerType))
5795 return;
5796
5797 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5798 {
5799 SendTickImmune(target, caster);
5800 return;
5801 }
5802
5803 // don't regen when permanent aura target has full power
5804 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
5805 return;
5806
5807 // ignore negative values (can be result apply spellmods to aura damage
5808 uint32 amount = std::max(GetAmount(), 0) * target->GetMaxPower(powerType) /100;
5809 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
5810 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
5811
5812 SpellPeriodicAuraLogInfo pInfo(this, amount, amount, 0, 0, 0, 0.0f, false);
5813 int32 gain = target->ModifyPower(powerType, amount);
5814
5815 if (caster)
5816 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
5817
5818 target->SendPeriodicAuraLog(&pInfo);
5819}
5820
5822{
5823 Powers powerType = Powers(GetMiscValue());
5824 if (!target->IsAlive() || !target->GetMaxPower(powerType))
5825 return;
5826
5827 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5828 {
5829 SendTickImmune(target, caster);
5830 return;
5831 }
5832
5833 // don't regen when permanent aura target has full power
5834 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
5835 return;
5836
5837 // ignore negative values (can be result apply spellmods to aura damage
5838 int32 amount = std::max(GetAmount(), 0);
5839
5840 SpellPeriodicAuraLogInfo pInfo(this, amount, amount, 0, 0, 0, 0.0f, false);
5841
5842 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
5843 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
5844
5845 int32 gain = target->ModifyPower(powerType, amount);
5846 target->SendPeriodicAuraLog(&pInfo);
5847
5848 if (caster)
5849 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
5850}
5851
5853{
5854 Powers powerType = Powers(GetMiscValue());
5855
5856 if (!caster || !target->IsAlive() || target->GetPowerType() != powerType)
5857 return;
5858
5860 {
5861 SendTickImmune(target, caster);
5862 return;
5863 }
5864
5865 // ignore negative values (can be result apply spellmods to aura damage
5866 int32 damage = std::max(GetAmount(), 0);
5867
5868 uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
5869
5870 float dmgMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5871
5872 SpellInfo const* spellProto = GetSpellInfo();
5873 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
5874 SpellNonMeleeDamage damageInfo(caster, target, spellProto, GetBase()->GetSpellVisual(), spellProto->SchoolMask, GetBase()->GetCastId());
5875 damageInfo.periodicLog = true;
5876 // no SpellDamageBonus for burn mana
5877 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
5878
5879 Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb);
5880
5881 // Set trigger flag
5884 ProcFlagsHit hitMask = createProcHitMask(&damageInfo, SPELL_MISS_NONE);
5886 if (damageInfo.damage)
5887 {
5888 procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
5889 spellTypeMask |= PROC_SPELL_TYPE_DAMAGE;
5890 }
5891
5892 caster->DealSpellDamage(&damageInfo, true);
5893
5894 DamageInfo dotDamageInfo(damageInfo, DOT, BASE_ATTACK, hitMask);
5895 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, spellTypeMask, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &dotDamageInfo, nullptr);
5896
5897 caster->SendSpellNonMeleeDamageLog(&damageInfo);
5898}
5899
5901{
5902 if (GetSpellInfo()->HasAttribute(SPELL_ATTR2_CANT_CRIT))
5903 return false;
5904
5905 if (GetSpellInfo()->HasAttribute(SPELL_ATTR8_PERIODIC_CAN_CRIT))
5906 return true;
5907
5908 return false;
5909}
5910
5912{
5913 if (!caster || !CanPeriodicTickCrit())
5914 return 0.0f;
5915
5916 Player* modOwner = caster->GetSpellModOwner();
5917 if (!modOwner)
5918 return 0.0f;
5919
5920 float critChance = modOwner->SpellCritChanceDone(nullptr, this, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()->GetAttackType());
5921 return std::max(0.0f, critChance);
5922}
5923
5925{
5926 int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
5927
5928 if (damageLeft <= 0)
5929 aurApp->GetTarget()->RemoveAura(aurApp);
5930 else
5931 ChangeAmount(damageLeft);
5932}
5933
5935{
5936 Unit* triggerCaster = aurApp->GetTarget();
5937 Unit* triggerTarget = eventInfo.GetProcTarget();
5939 triggerTarget = eventInfo.GetActor();
5940
5941 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5942 if (triggerSpellId == 0)
5943 {
5944 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5945 return;
5946 }
5947
5948 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
5949 {
5950 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
5951 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo->Id, CastSpellExtraArgs(this).SetTriggeringSpell(eventInfo.GetProcSpell()));
5952 }
5953 else if (triggerSpellId && GetAuraType() != SPELL_AURA_DUMMY)
5954 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5955}
5956
5958{
5959 Unit* triggerCaster = aurApp->GetTarget();
5960 Unit* triggerTarget = eventInfo.GetProcTarget();
5962 triggerTarget = eventInfo.GetActor();
5963
5964 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5965 if (triggerSpellId == 0)
5966 {
5967 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5968 return;
5969 }
5970
5971 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
5972 {
5973 CastSpellExtraArgs args(this);
5974 args.SetTriggeringSpell(eventInfo.GetProcSpell());
5976 triggerCaster->CastSpell(triggerTarget, triggerSpellId, args);
5977 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, GetAmount(), GetId());
5978 }
5979 else
5980 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5981}
5982
5984{
5985 Unit* target = aurApp->GetTarget();
5986 Unit* triggerTarget = eventInfo.GetProcTarget();
5987 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo(), &GetSpellEffectInfo()))
5988 {
5989 SendTickImmune(triggerTarget, target);
5990 return;
5991 }
5992
5993 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetBase()->GetSpellVisual(), GetSpellInfo()->SchoolMask, GetBase()->GetCastId());
5994 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetSpellEffectInfo(), 1, nullptr, this);
5995 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
5996 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
5997 Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb);
5998 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
5999 target->DealSpellDamage(&damageInfo, true);
6000 target->SendSpellNonMeleeDamageLog(&damageInfo);
6001}
6002
6004{
6005 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6006 return;
6007
6008 Player* target = aurApp->GetTarget()->ToPlayer();
6009
6010 if (!target)
6011 return;
6012
6013 if (apply)
6015 else
6016 target->GetMap()->SendZoneWeather(target->GetZoneId(), target);
6017}
6018
6020{
6021 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6022 return;
6023
6024 uint32 altPowerId = GetMiscValue();
6025 UnitPowerBarEntry const* powerEntry = sUnitPowerBarStore.LookupEntry(altPowerId);
6026 if (!powerEntry)
6027 return;
6028
6029 if (apply)
6030 aurApp->GetTarget()->SetMaxPower(POWER_ALTERNATE_POWER, powerEntry->MaxPower);
6031 else
6033}
6034
6036{
6037 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6038 return;
6039
6040 Player* target = aurApp->GetTarget()->ToPlayer();
6041 if (!target)
6042 return;
6043
6044 if (apply)
6046 else
6048}
6049
6051{
6052 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6053 return;
6054
6055 Player* player = aurApp->GetTarget()->ToPlayer();
6056 if (!player)
6057 return;
6058
6059 if (apply)
6060 player->AddTemporarySpell(GetSpellEffectInfo().TriggerSpell);
6061 else
6062 player->RemoveTemporarySpell(GetSpellEffectInfo().TriggerSpell);
6063}
6064
6066{
6067 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6068 return;
6069
6070 Player* player = aurApp->GetTarget()->ToPlayer();
6071 if (!player)
6072 return;
6073
6074 if (player->GetClass() != CLASS_HUNTER)
6075 return;
6076
6077 Pet* pet = player->GetPet();
6078 if (!pet)
6079 return;
6080
6081 ChrSpecializationEntry const* currSpec = sChrSpecializationStore.LookupEntry(pet->GetSpecialization());
6082 if (!currSpec)
6083 return;
6084
6085 pet->SetSpecialization(sDB2Manager.GetChrSpecializationByIndex(apply ? PET_SPEC_OVERRIDE_CLASS_INDEX : 0, currSpec->OrderIndex)->ID);
6086}
6087
6089{
6090 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6091 return;
6092
6093 Player* target = aurApp->GetTarget()->ToPlayer();
6094 if (!target)
6095 return;
6096
6097 if (apply)
6101}
6102
6103void AuraEffect::HandlePlayScene(AuraApplication const* aurApp, uint8 mode, bool apply) const
6104{
6105 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6106 return;
6107
6108 Player* player = aurApp->GetTarget()->ToPlayer();
6109 if (!player)
6110 return;
6111
6112 if (apply)
6113 player->GetSceneMgr().PlayScene(GetMiscValue());
6114 else
6116}
6117
6119{
6120 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6121 return;
6122
6123 Unit* target = aurApp->GetTarget();
6124
6125 if (apply)
6126 {
6127 AreaTriggerCreatePropertiesId createPropertiesId = { uint32(GetMiscValue()), false };
6128 AreaTrigger::CreateAreaTrigger(createPropertiesId, *target, GetBase()->GetDuration(), GetCaster(), target, GetBase()->GetSpellVisual(), GetSpellInfo(), nullptr, this);
6129 }
6130 else
6131 {
6132 if (Unit* caster = GetCaster())
6133 caster->RemoveAreaTrigger(this);
6134 }
6135}
6136
6137void AuraEffect::HandleAuraPvpTalents(AuraApplication const* auraApp, uint8 mode, bool apply) const
6138{
6139 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6140 return;
6141
6142 if (Player* target = auraApp->GetTarget()->ToPlayer())
6143 {
6144 if (apply)
6145 target->TogglePvpTalents(true);
6146 else if (!target->HasAuraType(SPELL_AURA_PVP_TALENTS))
6147 target->TogglePvpTalents(false);
6148 }
6149}
6150
6151void AuraEffect::HandleLinkedSummon(AuraApplication const* aurApp, uint8 mode, bool apply) const
6152{
6153 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6154 return;
6155
6156 Unit* target = aurApp->GetTarget();
6157 SpellInfo const* triggerSpellInfo = sSpellMgr->GetSpellInfo(GetSpellEffectInfo().TriggerSpell, GetBase()->GetCastDifficulty());
6158 if (!triggerSpellInfo)
6159 return;
6160
6161 // on apply cast summon spell
6162 if (apply)
6163 {
6164 CastSpellExtraArgs args(this);
6165 args.CastDifficulty = triggerSpellInfo->Difficulty;
6166 target->CastSpell(target, triggerSpellInfo->Id, args);
6167 }
6168 // on unapply we need to search for and remove the summoned creature
6169 else
6170 {
6171 std::vector<uint32> summonedEntries;
6172 for (SpellEffectInfo const& spellEffect : triggerSpellInfo->GetEffects())
6173 if (spellEffect.IsEffect(SPELL_EFFECT_SUMMON))
6174 if (uint32 summonEntry = spellEffect.MiscValue)
6175 summonedEntries.push_back(summonEntry);
6176
6177 // we don't know if there can be multiple summons for the same effect, so consider only 1 summon for each effect
6178 // most of the spells have multiple effects with the same summon spell id for multiple spawns, so right now it's safe to assume there's only 1 spawn per effect
6179 for (uint32 summonEntry : summonedEntries)
6180 {
6181 std::list<Creature*> nearbyEntries;
6182 target->GetCreatureListWithEntryInGrid(nearbyEntries, summonEntry);
6183 for (auto creature : nearbyEntries)
6184 {
6185 if (creature->GetOwnerGUID() == target->GetGUID())
6186 {
6187 creature->DespawnOrUnsummon();
6188 break;
6189 }
6190 else if (TempSummon* tempSummon = creature->ToTempSummon())
6191 {
6192 if (tempSummon->GetSummonerGUID() == target->GetGUID())
6193 {
6194 tempSummon->DespawnOrUnsummon();
6195 break;
6196 }
6197 }
6198 }
6199 }
6200 }
6201}
6202
6203void AuraEffect::HandleSetFFAPvP(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
6204{
6205 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6206 return;
6207
6208 Player* target = aurApp->GetTarget()->ToPlayer();
6209 if (!target)
6210 return;
6211
6212 target->UpdatePvPState(true);
6213}
6214
6216{
6217 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6218 return;
6219
6220 Player* target = aurApp->GetTarget()->ToPlayer();
6221 if (!target)
6222 return;
6223
6224 if (apply)
6228 else
6230
6231 target->UpdateHostileAreaState(sAreaTableStore.LookupEntry(target->GetZoneId()));
6232 target->UpdatePvPState();
6233}
6234
6236{
6237 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6238 return;
6239
6240 Player* target = aurApp->GetTarget()->ToPlayer();
6241 if (!target)
6242 return;
6243
6244 if (!apply && aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
6245 {
6246 if (GameObject* gameObjectCaster = target->GetMap()->GetGameObject(GetCasterGUID()))
6247 {
6248 if (gameObjectCaster->GetGoType() == GAMEOBJECT_TYPE_NEW_FLAG)
6249 {
6250 gameObjectCaster->HandleCustomTypeCommand(GameObjectType::SetNewFlagState(FlagState::Dropped, target));
6251 if (GameObject* droppedFlag = gameObjectCaster->SummonGameObject(gameObjectCaster->GetGOInfo()->newflag.FlagDrop, target->GetPosition(), QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.f, 0.f), Seconds(gameObjectCaster->GetGOInfo()->newflag.ExpireDuration / 1000), GO_SUMMON_TIMED_DESPAWN))
6252 droppedFlag->SetOwnerGUID(gameObjectCaster->GetGUID());
6253 }
6254 }
6255 }
6256
6257 BattlegroundMap* battlegroundMap = target->GetMap()->ToBattlegroundMap();
6258 if (!battlegroundMap)
6259 return;
6260
6261 Battleground* bg = battlegroundMap->GetBG();
6262 if (!bg)
6263 return;
6264
6265 if (apply)
6266 {
6268 playerPosition.Guid = target->GetGUID();
6269 playerPosition.ArenaSlot = static_cast<int8>(GetMiscValue());
6270 playerPosition.Pos = target->GetPosition();
6271
6276 else
6277 TC_LOG_WARN("spell.auras", "Unknown aura effect {} handled by HandleBattlegroundPlayerPosition.", GetAuraType());
6278
6279 bg->AddPlayerPosition(playerPosition);
6280 }
6281 else
6282 bg->RemovePlayerPosition(target->GetGUID());
6283}
6284
6286{
6287 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6288 return;
6289
6290 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6291 if (!playerTarget)
6292 return;
6293
6294 if (apply)
6295 playerTarget->AddStoredAuraTeleportLocation(GetSpellInfo()->Id);
6296 else if (!playerTarget->GetSession()->isLogingOut())
6298}
6299
6300void AuraEffect::HandleMountRestrictions(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
6301{
6302 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6303 return;
6304
6305 aurApp->GetTarget()->UpdateMountCapability();
6306}
6307
6309{
6310 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6311 return;
6312
6313 if (apply)
6315 else
6316 aurApp->GetTarget()->SetCosmeticMountDisplayId(0); // set cosmetic mount to 0, even if multiple auras are active; tested with zandalari racial + divine steed
6317
6318 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6319 if (!playerTarget)
6320 return;
6321
6323}
6324
6326{
6327 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6328 return;
6329
6330 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6331 if (!playerTarget)
6332 return;
6333
6334 if (apply)
6336 else
6337 {
6338 int32 mountCapabilityFlags = 0;
6339 for (AuraEffect* otherAura : playerTarget->GetAuraEffectsByType(GetAuraType()))
6340 mountCapabilityFlags |= otherAura->GetMiscValue();
6341
6342 playerTarget->ReplaceAllRequiredMountCapabilityFlags(mountCapabilityFlags);
6343 }
6344}
6345
6347{
6348 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6349 return;
6350
6351 std::vector<Aura*> suppressedAuras;
6352 for (Unit::AuraMap::value_type const& appliedAura : aurApp->GetTarget()->GetOwnedAuras())
6353 if (appliedAura.second->GetSpellInfo()->HasLabel(GetMiscValue()))
6354 suppressedAuras.push_back(appliedAura.second);
6355
6356 // Refresh applications
6357 for (Aura* aura : suppressedAuras)
6358 aura->ApplyForTargets();
6359}
6360
6361void AuraEffect::HandleForceBreathBar(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
6362{
6363 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6364 return;
6365
6366 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6367 if (!playerTarget)
6368 return;
6369
6370 playerTarget->UpdatePositionData();
6371}
6372
6373template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
6374template TC_GAME_API void AuraEffect::GetTargetList(std::deque<Unit*>&) const;
6375template TC_GAME_API void AuraEffect::GetTargetList(std::vector<Unit*>&) const;
6376
6377template TC_GAME_API void AuraEffect::GetApplicationList(std::list<AuraApplication*>&) const;
6378template TC_GAME_API void AuraEffect::GetApplicationList(std::deque<AuraApplication*>&) const;
6379template TC_GAME_API void AuraEffect::GetApplicationList(std::vector<AuraApplication*>&) const;
@ PLAYER_POSITION_ICON_ALLIANCE_FLAG
Definition: Battleground.h:220
@ PLAYER_POSITION_ICON_HORDE_FLAG
Definition: Battleground.h:219
@ CHARM_TYPE_CHARM
Definition: CharmInfo.h:70
@ CHARM_TYPE_POSSESS
Definition: CharmInfo.h:71
@ CHARM_TYPE_CONVERT
Definition: CharmInfo.h:73
@ IN_MILLISECONDS
Definition: Common.h:35
DB2Storage< OverrideSpellDataEntry > sOverrideSpellDataStore("OverrideSpellData.db2", &OverrideSpellDataLoadInfo::Instance)
DB2Storage< UnitPowerBarEntry > sUnitPowerBarStore("UnitPowerBar.db2", &UnitPowerBarLoadInfo::Instance)
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", &SpellShapeshiftFormLoadInfo::Instance)
DB2Storage< ChrSpecializationEntry > sChrSpecializationStore("ChrSpecialization.db2", &ChrSpecializationLoadInfo::Instance)
DB2Storage< PowerDisplayEntry > sPowerDisplayStore("PowerDisplay.db2", &PowerDisplayLoadInfo::Instance)
DB2Storage< MountCapabilityEntry > sMountCapabilityStore("MountCapability.db2", &MountCapabilityLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
#define sDB2Manager
Definition: DB2Stores.h:538
#define MAX_SHAPESHIFT_SPELLS
#define MAX_OVERRIDE_SPELL
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
#define MAX_SPELL_EFFECTS
Definition: DBCEnums.h:1953
#define TC_GAME_API
Definition: Define.h:123
uint8_t uint8
Definition: Define.h:144
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
#define UI64LIT(N)
Definition: Define.h:127
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:84
#define ASSERT
Definition: Errors.h:68
InventoryResult
Definition: ItemDefines.h:25
@ EQUIP_ERR_OK
Definition: ItemDefines.h:26
#define TC_LOG_WARN(filterType__,...)
Definition: Log.h:162
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
@ GO_SUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:84
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
#define sObjectMgr
Definition: ObjectMgr.h:1946
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
#define sOutdoorPvPMgr
#define PET_FOLLOW_DIST
Definition: PetDefines.h:97
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:48
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:646
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:647
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:750
PlayerFieldByte2Flags
Definition: Player.h:500
@ PLAYER_FIELD_BYTE2_STEALTH
Definition: Player.h:502
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition: Player.h:503
std::unordered_map< uint32, PlayerSpell > PlayerSpellMap
Definition: Player.h:276
@ PLAYER_FLAGS_GHOST
Definition: Player.h:432
SpellModifierByLabel< UF::SpellPctModByLabel > SpellPctModifierByLabel
Definition: Player.h:253
@ SPELLMOD_LABEL_PCT
Definition: Player.h:160
@ SPELLMOD_FLAT
Definition: Player.h:157
@ SPELLMOD_PCT
Definition: Player.h:158
@ SPELLMOD_LABEL_FLAT
Definition: Player.h:159
@ PLAYERSPELL_REMOVED
Definition: Player.h:189
@ PLAYER_LOCAL_FLAG_CAN_USE_OBJECTS_MOUNTED
Definition: Player.h:487
@ PLAYER_LOCAL_FLAG_TRACK_STEALTHED
Definition: Player.h:480
@ PLAYER_LOCAL_FLAG_RELEASE_TIMER
Definition: Player.h:481
SpellModifierByLabel< UF::SpellFlatModByLabel > SpellFlatModifierByLabel
Definition: Player.h:252
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:625
ZonePVPTypeOverride
Definition: Player.h:1100
@ RACE_TROLL
Definition: RaceMask.h:35
@ RACE_UNDEAD_PLAYER
Definition: RaceMask.h:32
@ RACE_ORC
Definition: RaceMask.h:29
@ RACE_DRAENEI
Definition: RaceMask.h:38
@ RACE_NIGHTELF
Definition: RaceMask.h:31
@ RACE_BLOODELF
Definition: RaceMask.h:37
@ RACE_DWARF
Definition: RaceMask.h:30
@ RACE_GNOME
Definition: RaceMask.h:34
@ RACE_HUMAN
Definition: RaceMask.h:28
@ RACE_TAUREN
Definition: RaceMask.h:33
bool roll_chance_f(float chance)
Definition: Random.h:53
bool roll_chance_i(int chance)
Definition: Random.h:59
#define sScriptMgr
Definition: ScriptMgr.h:1418
@ SERVERSIDE_VISIBILITY_GHOST
@ EFFECT_3
Definition: SharedDefines.h:33
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_4
Definition: SharedDefines.h:34
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_ATTR10_ROLLING_PERIODIC
#define MAX_STATS
@ SPELL_ATTR7_TREAT_AS_NPC_AOE
StealthType
@ CLASS_HUNTER
@ CLASS_DRUID
#define CLASSMASK_WAND_USERS
@ SPELL_PREVENTION_TYPE_SILENCE
@ SPELL_PREVENTION_TYPE_NO_ACTIONS
@ GAMEOBJECT_TYPE_NEW_FLAG
Gender
@ GENDER_MALE
@ GENDER_FEMALE
@ SPELL_ATTR5_EXTRA_INITIAL_PERIOD
@ SPELL_ATTR5_TREAT_AS_AREA_EFFECT
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
@ SPELL_MISS_NONE
SpellSchoolMask
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_SCHOOL_MASK_SPELL
@ SPELL_ATTR2_CANT_CRIT
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
@ CREATURE_TYPE_BEAST
InvisibilityType
@ INVISIBILITY_DRUNK
@ INVISIBILITY_GENERAL
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
@ UNIT_DYNFLAG_SPECIALINFO
@ UNIT_DYNFLAG_TRACK_UNIT
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ SPELL_EFFECT_SUMMON
WeaponAttackType
@ OFF_ATTACK
@ MAX_ATTACK
@ BASE_ATTACK
@ RANGED_ATTACK
@ MECHANIC_POLYMORPH
@ MECHANIC_BANISH
@ IMMUNITY_MECHANIC
#define PET_SPEC_OVERRIDE_CLASS_INDEX
@ ALLIANCE
Powers
@ MAX_POWERS
@ POWER_ALTERNATE_POWER
@ POWER_ALL
@ POWER_RUNES
@ POWER_MANA
@ SPELL_ATTR0_IS_ABILITY
@ SPELL_ATTR0_DO_NOT_DISPLAY_SPELLBOOK_AURA_ICON_COMBAT_LOG
ReputationRank
@ REP_FRIENDLY
@ SPELL_FAILED_INTERRUPTED
@ GHOST_VISIBILITY_ALIVE
@ GHOST_VISIBILITY_GHOST
@ SPELL_HIT_TYPE_CRIT
Stats
@ STAT_STRENGTH
@ STAT_STAMINA
@ AURA_STATE_ARENA_PREPARATION
@ SPELLFAMILY_PRIEST
@ SPELLFAMILY_WARLOCK
@ SPELLFAMILY_MAGE
@ SPELLFAMILY_GENERIC
@ SPELLFAMILY_PALADIN
@ SPELLFAMILY_SHAMAN
@ SPELLFAMILY_DRUID
@ SPELLFAMILY_DEATHKNIGHT
SpellSchools
@ SPELL_SCHOOL_NORMAL
@ MAX_SPELL_SCHOOL
@ SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS
@ SPELL_ATTR4_NO_HELPFUL_THREAT
@ SPELL_ATTR8_PERIODIC_CAN_CRIT
@ SPELL_ATTR8_AURA_POINTS_ON_CLIENT
@ SPELL_ATTR8_MELEE_HASTE_AFFECTS_PERIODIC
@ SPELL_ATTR8_TARGET_PROCS_ON_CASTER
@ SPELL_ATTR8_MASTERY_AFFECTS_POINTS
@ SKILL_DEFENSE
AuraTriggerOnHealthChangeDirection
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_STAT
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK
@ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK
@ AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK
@ AURA_EFFECT_HANDLE_REAPPLY
@ AURA_EFFECT_HANDLE_REAL
@ AURA_EFFECT_HANDLE_SKILL
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
@ AURA_REMOVE_NONE
@ AURA_REMOVE_BY_DEFAULT
@ AURA_REMOVE_BY_DEATH
@ AURA_REMOVE_BY_EXPIRE
AuraType
@ SPELL_AURA_MANA_SHIELD
@ SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
@ SPELL_AURA_MOD_DISARM_RANGED
@ SPELL_AURA_PERIODIC_WEAPON_PERCENT_DAMAGE
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_MOD_SHAPESHIFT
@ SPELL_AURA_MOD_DISARM
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
@ SPELL_AURA_MELEE_SLOW
@ SPELL_AURA_SHOW_CONFIRMATION_PROMPT_WITH_DIFFICULTY
@ SPELL_AURA_ADD_PCT_MODIFIER
@ TOTAL_AURAS
@ SPELL_AURA_PERIODIC_MANA_LEECH
@ SPELL_AURA_MOD_INCREASE_SPEED
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
@ SPELL_AURA_PROC_TRIGGER_SPELL
@ SPELL_AURA_MOD_FEAR
@ SPELL_AURA_MOD_NO_ACTIONS
@ SPELL_AURA_OBS_MOD_POWER
@ SPELL_AURA_ADD_FLAT_MODIFIER
@ SPELL_AURA_MOD_STEALTH_DETECT
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_MOD_MELEE_HASTE
@ SPELL_AURA_MOD_ROOT_2
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
@ SPELL_AURA_MOD_INVISIBILITY
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
@ SPELL_AURA_DUMMY
@ SPELL_AURA_MOD_STUN_DISABLE_GRAVITY
@ SPELL_AURA_FLY
@ SPELL_AURA_MOD_PACIFY
@ SPELL_AURA_MOD_SILENCE
@ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT2
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
@ SPELL_AURA_MOD_DISARM_OFFHAND
@ SPELL_AURA_MOD_STAT
@ SPELL_AURA_MOD_FAKE_INEBRIATE
@ SPELL_AURA_ADD_FLAT_MODIFIER_BY_SPELL_LABEL
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
@ SPELL_AURA_GHOST
@ SPELL_AURA_DETECT_AMORE
@ SPELL_AURA_MOD_ROOT
@ SPELL_AURA_SCHOOL_IMMUNITY
@ SPELL_AURA_MOUNTED
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
@ SPELL_AURA_MECHANIC_IMMUNITY
@ SPELL_AURA_MOD_BASE_MANA_PCT
@ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
@ SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER
@ SPELL_AURA_MOD_OVERRIDE_ZONE_PVP_TYPE
@ SPELL_AURA_MOD_PACIFY_SILENCE
@ SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY
@ SPELL_AURA_MOD_MAX_POWER_PCT
@ SPELL_AURA_MOD_VERSATILITY
@ SPELL_AURA_TRANSFORM
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_MOD_RESISTANCE_PCT
@ SPELL_AURA_BATTLEGROUND_PLAYER_POSITION_FACTIONAL
@ SPELL_AURA_PERIODIC_ENERGIZE
@ SPELL_AURA_MOD_INVISIBILITY_DETECT
@ SPELL_AURA_MOD_BASE_RESISTANCE_PCT
@ SPELL_AURA_PERIODIC_LEECH
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
@ SPELL_AURA_DAMAGE_IMMUNITY
@ SPELL_AURA_POWER_BURN
@ SPELL_AURA_MOD_PERCENT_STAT
@ SPELL_AURA_MOD_CONFUSE
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
@ SPELL_AURA_MOD_BASE_HEALTH_PCT
@ SPELL_AURA_PVP_TALENTS
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
@ SPELL_AURA_NO_REAGENT_USE
@ SPELL_AURA_MOD_UNATTACKABLE
@ SPELL_AURA_ADD_PCT_MODIFIER_BY_SPELL_LABEL
@ SPELL_AURA_MOD_STEALTH
@ SPELL_AURA_ALLOW_USING_GAMEOBJECTS_WHILE_MOUNTED
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
@ SPELL_AURA_BATTLEGROUND_PLAYER_POSITION
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_ATTACK_POWER_PCT
@ SPELL_AURA_MOD_SKILL_TALENT
@ SPELL_AURA_PHASE_ALWAYS_VISIBLE
@ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
@ SPELL_AURA_MOD_STUN
ShapeshiftForm
@ FORM_SHADOWFORM
@ FORM_BEAR_FORM
@ FORM_BERSERKER_STANCE
@ FORM_BATTLE_STANCE
@ FORM_MOONKIN_FORM
@ FORM_TREE_OF_LIFE
@ FORM_GHOST_WOLF
@ FORM_FLIGHT_FORM_EPIC
@ FORM_CAT_FORM
@ FORM_AQUATIC_FORM
@ FORM_NONE
@ FORM_TRAVEL_FORM
@ FORM_AMBIENT
@ FORM_STEALTH
@ FORM_FLIGHT_FORM
@ FORM_SPIRIT_OF_REDEMPTION
@ FORM_DEFENSIVE_STANCE
@ FORM_METAMORPHOSIS
@ FORM_GHOUL
@ UNIT_AURA_TYPE
AuraTriggerOnPowerChangeDirection
NonDefaultConstructible< pAuraEffectHandler > AuraEffectHandler[TOTAL_AURAS]
SpellModOp
Definition: SpellDefines.h:149
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
SpellValueMod
Definition: SpellDefines.h:195
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:196
@ SPELL_ATTR0_CU_CAN_CRIT
Definition: SpellInfo.h:155
@ PROC_SPELL_PHASE_HIT
Definition: SpellMgr.h:264
#define sSpellMgr
Definition: SpellMgr.h:849
ProcFlagsSpellType
Definition: SpellMgr.h:250
@ PROC_SPELL_TYPE_HEAL
Definition: SpellMgr.h:253
@ PROC_SPELL_TYPE_DAMAGE
Definition: SpellMgr.h:252
@ PROC_SPELL_TYPE_NO_DMG_HEAL
Definition: SpellMgr.h:254
@ PROC_FLAG_TAKE_HARMFUL_PERIODIC
Definition: SpellMgr.h:165
@ PROC_FLAG_TAKE_ANY_DAMAGE
Definition: SpellMgr.h:167
@ TAKEN_HIT_PROC_FLAG_MASK
Definition: SpellMgr.h:218
@ PROC_FLAG_DEAL_HARMFUL_PERIODIC
Definition: SpellMgr.h:164
@ PROC_FLAG_DEAL_HELPFUL_PERIODIC
Definition: SpellMgr.h:169
@ PROC_FLAG_TAKE_HELPFUL_PERIODIC
Definition: SpellMgr.h:188
ProcFlagsHit
Definition: SpellMgr.h:272
@ PROC_HIT_CRITICAL
Definition: SpellMgr.h:275
@ PROC_HIT_NORMAL
Definition: SpellMgr.h:274
@ MOVE_FLIGHT
Definition: UnitDefines.h:123
@ MOVE_SWIM
Definition: UnitDefines.h:120
@ MOVE_FLIGHT_BACK
Definition: UnitDefines.h:124
@ MOVE_SWIM_BACK
Definition: UnitDefines.h:121
@ MOVE_RUN
Definition: UnitDefines.h:118
@ MOVE_RUN_BACK
Definition: UnitDefines.h:119
@ UNIT_FLAG2_MIRROR_IMAGE
Definition: UnitDefines.h:198
@ UNIT_FLAG2_COMPREHEND_LANG
Definition: UnitDefines.h:197
@ UNIT_FLAG2_FORCE_MOVEMENT
Definition: UnitDefines.h:200
@ UNIT_FLAG2_FEIGN_DEATH
Definition: UnitDefines.h:194
@ UNIT_FLAG2_NO_ACTIONS
Definition: UnitDefines.h:217
@ UNIT_FLAG2_ALLOW_CHANGING_TALENTS
Definition: UnitDefines.h:203
@ UNIT_FLAG2_DISARM_OFFHAND
Definition: UnitDefines.h:201
@ UNIT_FLAG2_DISARM_RANGED
Definition: UnitDefines.h:204
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:42
@ DOT
Definition: UnitDefines.h:134
@ SPELL_DIRECT_DAMAGE
Definition: UnitDefines.h:133
@ UNIT_FLAG3_FAKE_DEAD
Definition: UnitDefines.h:259
@ UNIT_FLAG3_ALTERNATIVE_DEFAULT_LANGUAGE
Definition: UnitDefines.h:252
@ UNIT_VIS_FLAGS_UNTRACKABLE
Definition: UnitDefines.h:61
@ UNIT_VIS_FLAGS_STEALTHED
Definition: UnitDefines.h:60
@ UNIT_VIS_FLAGS_INVISIBLE
Definition: UnitDefines.h:59
@ COMMAND_STAY
Definition: UnitDefines.h:526
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition: UnitDefines.h:173
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:145
@ UNIT_FLAG_PREPARATION
Definition: UnitDefines.h:149
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition: UnitDefines.h:160
@ UNIT_FLAG_IMMUNE
Definition: UnitDefines.h:175
@ UNIT_FLAG_DISARMED
Definition: UnitDefines.h:165
@ UNIT_FLAG_PACIFIED
Definition: UnitDefines.h:161
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: UnitDefines.h:147
ProcFlagsHit createProcHitMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition: Unit.cpp:9776
@ BASE_VALUE
Definition: Unit.h:152
@ TOTAL_VALUE
Definition: Unit.h:154
@ BASE_PCT_EXCLUDE_CREATE
Definition: Unit.h:153
UnitMods
Definition: Unit.h:172
@ UNIT_MOD_ARMOR
Definition: Unit.h:204
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:211
@ UNIT_MOD_RESISTANCE_START
Definition: Unit.h:220
@ UNIT_MOD_HEALTH
Definition: Unit.h:177
@ UNIT_MOD_POWER_START
Definition: Unit.h:222
@ UNIT_MOD_MANA
Definition: Unit.h:178
@ UNIT_MOD_STAT_START
Definition: Unit.h:218
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:212
@ CORPSE
Definition: Unit.h:248
@ JUST_DIED
Definition: Unit.h:247
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition: Unit.h:595
CurrentSpellTypes
Definition: Unit.h:588
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:590
@ CURRENT_MELEE_SPELL
Definition: Unit.h:589
@ UNIT_STATE_DIED
Definition: Unit.h:255
@ UNIT_STATE_CONFUSED
Definition: Unit.h:266
@ UNIT_STATE_ROOT
Definition: Unit.h:265
@ UNIT_STATE_ISOLATED
Definition: Unit.h:268
@ UNIT_STATE_FLEEING
Definition: Unit.h:262
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ UNIT_STATE_STUNNED
Definition: Unit.h:258
@ MELEE_HIT_NORMAL
Definition: Unit.h:381
#define MAX_COMBAT_RATING
Definition: Unit.h:345
@ SHIELD_BLOCK_VALUE
Definition: Unit.h:233
#define CURRENT_MAX_SPELL
Definition: Unit.h:596
CombatRating
Definition: Unit.h:310
@ NULL_BAG
Definition: Unit.h:62
@ NULL_SLOT
Definition: Unit.h:63
#define DISPLAYID_HIDDEN_MOUNT
Definition: Unit.h:39
@ TOTAL_PCT
Definition: Unit.h:161
@ BASE_PCT
Definition: Unit.h:160
float GetPctOf(T value, T max)
Definition: Util.h:78
T CalculatePct(T base, U pct)
Definition: Util.h:72
static AreaTrigger * CreateAreaTrigger(AreaTriggerCreatePropertiesId areaTriggerCreatePropertiesId, Position const &pos, int32 duration, Unit *caster, Unit *target, SpellCastVisual spellVisual={ 0, 0 }, SpellInfo const *spellInfo=nullptr, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
Unit * GetTarget() const
Definition: SpellAuras.h:77
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:91
void HandleAuraModDecreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModBlockPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePreventFleeing(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModShapeshift(AuraApplication const *aurApp, uint8 mode, bool apply) const
void GetApplicationList(Container &applicationContainer) const
void HandleEnableAltPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModArmorPctFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModStun(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModHealingDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDispelImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
void HandleModMovementForceMagnitude(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellInfo const * GetSpellInfo() const
AuraType GetAuraType() const
SpellEffIndex GetEffIndex() const
void HandleTriggerSpellOnExpire(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModDamagePercentDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModEffectImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModThreat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraPvpTalents(AuraApplication const *auraApp, uint8 mode, bool apply) const
void HandleAuraEmpathy(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply, AuraEffect const *triggeredBy=nullptr)
void HandleAuraCloneCaster(AuraApplication const *aurApp, uint8 mode, bool apply) const
void Update(uint32 diff, Unit *caster)
void HandleAuraFeatherFall(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleOverrideAttackPowerBySpellPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
void HandleNULL(AuraApplication const *, uint8, bool) const
void HandleModCombatSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellModifier * m_spellmod
void HandleModFear(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModFaction(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRangedAttackPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellEffectInfo const & GetSpellEffectInfo() const
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
void HandleAuraSetVehicle(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRequiredMountCapabilityFlags(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRootAndDisableGravity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseHealthPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
bool m_canBeRecalculated
void HandleDetectAmore(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
void HandleAuraModRangedAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPossessPet(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleForceReaction(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDodgePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicHealAurasTick(Unit *target, Unit *caster) const
void HandleSetVignette(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModBonusArmorPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDmgImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModDamageDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModAttackPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleSpiritOfRedemption(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTaunt(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModManaRegenPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseMountedSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseHealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
static float CalculateEstimatedfTotalPeriodicAmount(Unit *caster, Unit *target, SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, float amount, uint8 stack)
void HandleArenaPreparation(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSchoolImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleUnused(AuraApplication const *, uint8, bool) const
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModInvisibilityDetect(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleLinkedSummon(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
void HandleNoImmediateEffect(AuraApplication const *, uint8, bool) const
void HandleAuraModMinimumSpeedRate(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModWeaponCritPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModTotalThreat(AuraApplication const *aurApp, uint8 mode, bool apply) const
bool IsAreaAuraEffect() const
void HandleModRating(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraIncreaseBaseHealthPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleCosmeticMounted(AuraApplication const *aurApp, uint8 mode, bool apply) const
Optional< float > _estimatedAmount
void HandleMountRestrictions(AuraApplication const *aurApp, uint8 mode, bool apply) const
void CalculateSpellMod()
void HandleAuraMounted(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModNoActions(AuraApplication const *aurApp, uint8 mode, bool apply) const
uint32 GetRemainingTicks() const
uint32 GetId() const
void HandleAuraModRangedHaste(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraControlVehicle(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModBaseResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleShapeshiftBoosts(Unit *target, bool apply) const
int32 CalculateAmount(Unit *caster)
void HandlePreventResurrection(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMechanicImmunityMask(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleTriggerSpellOnPowerAmount(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraAllowFlight(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModPowerDisplay(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPowerCost(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSkill(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModFakeInebriation(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePlayScene(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
void HandleAuraModStunAndDisableGravity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModFixate(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModMaxPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRatingPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
bool IsAffectingSpell(SpellInfo const *spell) const
void HandleAuraGhost(AuraApplication const *aurApp, uint8 mode, bool apply) const
void ApplySpellMod(Unit *target, bool apply, AuraEffect const *triggeredBy=nullptr)
void HandleModPercentStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false, AuraEffect const *triggeredBy=nullptr)
void HandleModOverrideZonePVPType(AuraApplication const *aurApp, uint8 mode, bool apply) const
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
void HandleAuraModStateImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMiscValueB() const
void HandleAuraModExpertise(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraTransform(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDisarm(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModOffhandDamagePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellCategoryCooldown(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
void HandleAuraTrackStealthed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModUnattackable(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeRangedSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModBonusArmor(AuraApplication const *aurApp, uint8 mode, bool apply) const
void SendTickImmune(Unit *target, Unit *caster) const
void HandleNoReagentUseAura(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleComprehendLanguage(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleOverrideSpellPowerByAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void SetAmount(int32 amount)
void HandleOverridePetSpecs(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleCharmConvert(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseSwimSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModCastingSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseMaxHealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAllowUsingGameobjectsWhileMounted(AuraApplication const *aurApp, uint8 mode, bool apply) const
static Optional< float > CalculateEstimatedAmount(Unit const *caster, Unit *target, SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, int32 amount, uint8 stack, AuraEffect const *aurEff)
void HandleLearnSpell(AuraApplication const *aurApp, uint8 mode, bool apply) const
Unit * GetCaster() const
void HandleModStatBonusPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModStealthLevel(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTargetResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMiscValue() const
void GetTargetList(Container &targetContainer) const
void HandleModConfuse(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTotalPercentStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleDisableInertia(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModStealthDetect(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellCritChance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModHealingDonePct(AuraApplication const *aurApp, uint8 mode, bool apply) const
uint32 GetTotalTicks() const
void HandleShowConfirmationPrompt(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModScale(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModOverridePowerDisplay(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseBaseManaPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 _periodicTimer
void HandleChannelDeathItem(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseEnergy(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleTriggerSpellOnHealthPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRoot(AuraApplication const *aurApp, uint8 mode, bool apply) const
Aura * GetBase() const
void HandleAuraAllowTalentSwapping(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModStalked(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraDummy(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleFeignDeath(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleBattlegroundPlayerPosition(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleSuppressItemPassiveEffectBySpellLabel(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleIgnoreMovementForces(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 const m_baseAmount
void HandleTriggerSpellOnPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePhaseAlwaysVisible(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModParryPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void HandleModSpellDamagePercentFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleShieldBlockValue(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellInfo const *const m_spellInfo
void HandleAuraModAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleForceBreathBar(AuraApplication const *aurApp, uint8 mode, bool apply) const
void ResetPeriodic(bool resetPeriodicTimer=false)
void HandleAuraModBaseResistancePCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleShieldBlockValuePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleCreateAreaTrigger(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellHealingPercentFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellHitChance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraCanTurnWhileFalling(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void HandleBreakableCCAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
ObjectGuid GetCasterGUID() const
void HandleAuraModStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleForceMoveForward(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRegenInterrupt(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraUntrackable(AuraApplication const *aurApp, uint8 mode, bool apply) const
bool CanPeriodicTickCrit() const
void HandleAuraModResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModManaCostPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleWaterBreathing(AuraApplication const *aurApp, uint8 mode, bool apply) const
bool CheckEffectProc(AuraApplication *aurApp, ProcEventInfo &eventInfo) const
void HandleAuraModUseNormalSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
float GetCritChanceFor(Unit const *caster, Unit const *target) const
void HandleModResistancePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModVersatilityByPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
float CalcPeriodicCritChance(Unit const *caster) const
void HandleAuraModPacifyAndSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePhase(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMechanicImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraOpenStable(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModStealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraForceWeather(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraHover(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleSetFFAPvP(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleBindSight(AuraApplication const *aurApp, uint8 mode, bool apply) const
AuraEffect(Aura *base, SpellEffectInfo const &spellEfffectInfo, int32 const *baseAmount, Unit *caster)
void HandleAuraModMaxPowerPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseFlightSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModAlternativeDefaultLanguage(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPowerRegenPCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModAttackSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModPacify(AuraApplication const *aurApp, uint8 mode, bool apply) const
void PeriodicTick(AuraApplication *aurApp, Unit *caster) const
void HandleStoreTeleportReturnPoint(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraOverrideSpells(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraWaterWalk(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraTrackCreatures(AuraApplication const *aurApp, uint8 mode, bool apply) const
bool IsEffect() const
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit *target, Unit *caster) const
void HandleAuraModCritPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraLinked(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void HandleMastery(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseEnergyPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModDetaunt(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetAmount() const
void HandlePhaseGroup(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModInvisibility(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPossess(AuraApplication const *aurApp, uint8 mode, bool apply) const
ObjectGuid GetCastId() const
Definition: SpellAuras.h:138
int32 GetMaxDuration() const
Definition: SpellAuras.h:168
ApplicationMap const & GetApplicationMap()
Definition: SpellAuras.h:234
void SetStackAmount(uint8 num)
int32 GetCastItemLevel() const
Definition: SpellAuras.h:142
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Unit * GetUnitOwner() const
Definition: SpellAuras.h:147
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:139
uint8 GetCasterLevel() const
Definition: SpellAuras.h:195
WorldObject * GetOwner() const
Definition: SpellAuras.h:146
void CallScriptAfterEffectProcHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
int32 GetDuration() const
Definition: SpellAuras.h:173
bool IsUsingCharges() const
Definition: SpellAuras.h:249
uint32 GetCastItemId() const
Definition: SpellAuras.h:141
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:529
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:950
bool CallScriptEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void CallScriptAfterEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void SetNeedClientUpdateForTargets() const
int32 CalcMaxDuration() const
Definition: SpellAuras.h:170
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:325
AuraObjectType GetType() const
Definition: SpellAuras.cpp:537
uint8 GetStackAmount() const
Definition: SpellAuras.h:189
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:134
bool CallScriptEffectProcHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:140
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
static bool EffectTypeNeedsSendingAmount(AuraType type)
Difficulty GetCastDifficulty() const
Definition: SpellAuras.h:136
bool CallScriptCheckEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect *aurEff)
bool IsPassive() const
std::unordered_map< ObjectGuid, AuraApplication * > ApplicationMap
Definition: SpellAuras.h:123
bool IsPermanent() const
Definition: SpellAuras.h:178
SpellCastVisual GetSpellVisual() const
Definition: SpellAuras.h:143
Battleground * GetBG() const
Definition: Map.h:914
void RemovePlayerPosition(ObjectGuid guid)
void AddPlayerPosition(WorldPackets::Battleground::BattlegroundPlayerPosition const &position)
bool IsIgnoringFeignDeath() const
Definition: Creature.h:322
bool IsFloating() const
Definition: Creature.h:128
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool isTappedBy(Player const *player) const
Definition: Creature.cpp:1381
uint8 GetCurrentEquipmentId() const
Definition: Creature.h:241
std::vector< MountXDisplayEntry const * > MountXDisplayContainer
Definition: DB2Stores.h:409
uint32 GetResist() const
Definition: Unit.h:449
ProcFlagsHit GetHitMask() const
Definition: Unit.cpp:244
uint32 GetDamage() const
Definition: Unit.h:446
uint32 GetAbsorb() const
Definition: Unit.h:448
constexpr bool HasFlag(T flag) const
Definition: EnumFlag.h:106
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:442
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:443
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:447
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:446
Definition: Unit.h:456
uint32 GetAbsorb() const
Definition: Unit.h:479
uint32 GetEffectiveHeal() const
Definition: Unit.h:478
Definition: Item.h:170
bool IsDungeon() const
Definition: Map.cpp:3238
void SendZoneWeather(uint32 zoneId, Player *player) const
Definition: Map.cpp:3886
bool IsBattleground() const
Definition: Map.cpp:3330
BattlegroundMap * ToBattlegroundMap()
Definition: Map.h:457
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3489
Difficulty GetDifficultyID() const
Definition: Map.h:324
bool Instanceable() const
Definition: Map.cpp:3233
float GetVisibilityRange() const
Definition: Map.h:219
float GetFollowAngle() const override
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
void MoveFall(uint32 id=0)
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
std::string ToString() const
Definition: ObjectGuid.cpp:554
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1616
void SetDynamicFlag(uint32 flag)
Definition: Object.h:169
static Creature * ToCreature(Object *o)
Definition: Object.h:219
bool IsPlayer() const
Definition: Object.h:212
bool IsInWorld() const
Definition: Object.h:154
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
bool IsCreature() const
Definition: Object.h:218
void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:170
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void SetEntry(uint32 entry)
Definition: Object.h:162
static Player * ToPlayer(Object *o)
Definition: Object.h:213
Definition: Pet.h:40
uint16 GetSpecialization() const
Definition: Pet.h:132
void SetSpecialization(uint16 spec)
Definition: Pet.cpp:1898
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:712
static void AddPhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
static void AddPhaseGroup(WorldObject *object, uint32 phaseGroupId, bool updateVisibility)
static void RemovePhaseGroup(WorldObject *object, uint32 phaseGroupId, bool updateVisibility)
static void RemovePhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
static void SetAlwaysVisible(WorldObject *object, bool apply, bool updateVisibility)
void ApplyModOverrideSpellPowerByAPPercent(float mod, bool apply)
Definition: Player.h:2828
void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill=0, bool suppressMessaging=false, Optional< int32 > traitDefinitionId={})
Definition: Player.cpp:3216
void UpdateParryPercentage()
Definition: StatSystem.cpp:655
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition: Player.cpp:13254
void UpdateMastery()
Definition: StatSystem.cpp:537
void RemoveSpellCategoryCooldownMod(int32 spellCategoryId, int32 mod)
Definition: Player.cpp:29791
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId=0, GuidSet const &allowedLooters=GuidSet(), ItemContext context=ItemContext::NONE, std::vector< int32 > const *bonusListIDs=nullptr, bool addToCollection=true)
Definition: Player.cpp:11537
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:2738
void UpdateDodgePercentage()
Definition: StatSystem.cpp:696
void ApplyModTargetResistance(int32 mod, bool apply)
Definition: Player.h:2034
void SetPlayerLocalFlag(PlayerLocalFlags flags)
Definition: Player.h:2833
void RemovePlayerFlag(PlayerFlags flags)
Definition: Player.h:2739
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition: Player.cpp:8292
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition: Player.cpp:5362
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6324
void AddTemporarySpell(uint32 spellId)
Definition: Player.cpp:3164
void ApplySpellMod(SpellInfo const *spellInfo, SpellModOp op, T &basevalue, Spell *spell=nullptr) const
Definition: Player.cpp:22261
void SetNoRegentCostMask(flag128 mask)
Definition: Player.h:1383
void UpdatePvPState(bool onlyFFA=false)
Definition: Player.cpp:23317
void UpdateBlockPercentage()
Definition: StatSystem.cpp:478
void _ApplyWeaponDamage(uint8 slot, Item *item, bool apply)
Definition: Player.cpp:8154
bool InBattleground() const
Definition: Player.h:2394
void UpdateArmor() override
Definition: StatSystem.cpp:249
void PetSpellInitialize()
Definition: Player.cpp:21879
SceneMgr & GetSceneMgr()
Definition: Player.h:2715
void LeaveBattleground(bool teleportToEntryPoint=true)
Definition: Player.cpp:23614
void SetFallInformation(uint32 time, float z)
Definition: Player.cpp:26672
void RemovePlayerLocalFlag(PlayerLocalFlags flags)
Definition: Player.h:2834
void setRegenTimerCount(uint32 time)
Definition: Player.h:1735
void UpdateManaRegen()
Definition: StatSystem.cpp:817
void SetStableMaster(ObjectGuid stableMaster)
Definition: Player.cpp:28842
Pet * GetPet() const
Definition: Player.cpp:21513
void RemoveTemporarySpell(uint32 spellId)
Definition: Player.cpp:3177
void ApplyItemDependentAuras(Item *item, bool apply)
Definition: Player.cpp:8299
void ReplaceAllRequiredMountCapabilityFlags(uint8 flags)
Definition: Player.h:2848
WorldSession * GetSession() const
Definition: Player.h:2101
void UpdateSpellHitChances()
Definition: StatSystem.cpp:771
Item * GetItemByPos(uint16 pos) const
Definition: Player.cpp:9582
void UpdateExpertise(WeaponAttackType attType)
Definition: StatSystem.cpp:777
void SetViewpoint(WorldObject *target, bool apply)
Definition: Player.cpp:26139
PlayerSpellMap const & GetSpellMap() const
Definition: Player.h:1901
void AddSpellCategoryCooldownMod(int32 spellCategoryId, int32 mod)
Definition: Player.cpp:29766
void RemoveTrackCreatureFlag(uint32 flags)
Definition: Player.h:2824
void ApplyModOverrideAPBySpellPowerPercent(float mod, bool apply)
Definition: Player.h:2830
void ApplyModTargetPhysicalResistance(int32 mod, bool apply)
Definition: Player.h:2035
void AddAuraVision(PlayerFieldByte2Flags flags)
Definition: Player.h:2842
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition: Player.cpp:5043
Battleground * GetBattleground() const
Definition: Player.cpp:24976
void UpdateAllWeaponDependentCritAuras()
Definition: Player.cpp:8286
void SetChampioningFaction(uint32 faction)
Definition: Player.h:2671
void UpdateSpellDamageAndHealingBonus()
Definition: StatSystem.cpp:169
bool IsGameMaster() const
Definition: Player.h:1178
void SetOverrideZonePVPType(ZonePVPTypeOverride type)
Definition: Player.h:1834
void AddStoredAuraTeleportLocation(uint32 spellId)
Definition: Player.cpp:2744
void UpdateMirrorTimers()
Definition: Player.cpp:717
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition: Player.cpp:5721
void UpdateAllRunesRegen()
Definition: StatSystem.cpp:840
static WeaponAttackType GetAttackBySlot(uint8 slot, InventoryType inventoryType)
Definition: Player.cpp:9710
void SendOnCancelExpectedVehicleRideAura() const
Definition: Player.cpp:21874
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition: Player.cpp:5021
void UpdateHostileAreaState(AreaTableEntry const *area)
Definition: Player.cpp:7649
void RemoveSpell(uint32 spell_id, bool disabled=false, bool learn_low_rank=true, bool suppressMessaging=false)
Definition: Player.cpp:3260
void SetTrackCreatureFlag(uint32 flags)
Definition: Player.h:2823
void SetOverrideSpellsId(int32 overrideSpellsId)
Definition: Player.h:1812
UF::UpdateField< UF::ActivePlayerData, 0, TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition: Player.h:2864
void UpdateRating(CombatRating cr)
Definition: Player.cpp:5368
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:6497
void RemovePetAura(PetAura const *petSpell)
Definition: Player.cpp:21643
bool isHonorOrXPTarget(Unit const *victim) const
Definition: Player.cpp:25587
Team GetEffectiveTeam() const
Definition: Player.h:2239
void AddSpellMod(SpellModifier *mod, bool apply)
Definition: Player.cpp:22276
void UpdateSpellCritChance()
Definition: StatSystem.cpp:714
void RemoveAuraVision(PlayerFieldByte2Flags flags)
Definition: Player.h:2843
void SetRequiredMountCapabilityFlag(uint8 flag)
Definition: Player.h:2847
void SendMovementSetCollisionHeight(float height, WorldPackets::Movement::UpdateCollisionHeightReason reason)
Definition: Player.cpp:29232
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.cpp:10032
void UpdateAttackPowerAndDamage(bool ranged=false) override
Definition: StatSystem.cpp:343
ReputationMgr & GetReputationMgr()
Definition: Player.h:2251
void RemoveStoredAuraTeleportLocation(uint32 spellId)
Definition: Player.cpp:2751
void AddPetAura(PetAura const *petSpell)
Definition: Player.cpp:21636
void SendNewItem(Item *item, uint32 quantity, bool received, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition: Player.cpp:13990
Spell const * GetProcSpell() const
Definition: Unit.h:508
SpellInfo const * GetSpellInfo() const
Definition: Unit.cpp:280
ProcFlagsInit GetTypeMask() const
Definition: Unit.h:497
DamageInfo * GetDamageInfo() const
Definition: Unit.h:505
Unit * GetProcTarget() const
Definition: Unit.h:495
Unit * GetActor() const
Definition: Unit.h:493
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
void SendForceReactions()
void CancelSceneBySceneId(uint32 sceneId)
Definition: SceneMgr.cpp:178
uint32 PlayScene(uint32 sceneId, Position const *position=nullptr)
Definition: SceneMgr.cpp:36
AuraType ApplyAuraName
Definition: SpellInfo.h:219
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
float CalcValueMultiplier(WorldObject *caster, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:644
uint32 TriggerSpell
Definition: SpellInfo.h:237
bool IsAreaAuraEffect() const
Definition: SpellInfo.cpp:476
flag128 SpellClassMask
Definition: SpellInfo.h:238
uint32 ApplyAuraPeriod
Definition: SpellInfo.h:220
EnumFlag< SpellEffectAttributes > EffectAttributes
Definition: SpellInfo.h:241
bool IsAffected(uint32 familyName, flag128 const &familyFlags) const
Definition: SpellInfo.cpp:1795
uint64 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2470
uint32 const Id
Definition: SpellInfo.h:325
uint64 Stances
Definition: SpellInfo.h:347
bool IsPassive() const
Definition: SpellInfo.cpp:1592
uint32 StackAmount
Definition: SpellInfo.h:390
::Difficulty const Difficulty
Definition: SpellInfo.h:326
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell) const
Definition: SpellInfo.cpp:1556
uint32 SchoolMask
Definition: SpellInfo.h:413
bool IsAffectedBySpellMod(SpellModifier const *mod) const
Definition: SpellInfo.cpp:1814
flag128 SpellFamilyFlags
Definition: SpellInfo.h:409
ProcFlagsInit ProcFlags
Definition: SpellInfo.h:376
WeaponAttackType GetAttackType() const
Definition: SpellInfo.cpp:1756
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2465
void ApplyAllSpellImmunitiesTo(Unit *target, SpellEffectInfo const &spellEffectInfo, bool apply) const
Definition: SpellInfo.cpp:3507
bool IsChanneled() const
Definition: SpellInfo.cpp:1719
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:576
bool IsPositive() const
Definition: SpellInfo.cpp:1709
uint32 SpellFamilyName
Definition: SpellInfo.h:408
Definition: Spell.h:255
int32 GetCastTime() const
Definition: Spell.h:612
std::vector< SpellPowerCost > const & GetPowerCost() const
Definition: Spell.h:652
void ClearFixate()
void EvaluateSuppressed(bool canExpire=false)
void ForwardThreatForAssistingMe(Unit *assistant, float baseAmount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false)
== AFFECT OTHERS' THREAT LISTS ==
void UpdateMySpellSchoolModifiers()
auto const & GetThreatenedByMeList() const
void FixateTarget(Unit *target)
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
void UpdateMyTempModifiers()
Definition: Unit.h:627
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true)
Definition: Unit.cpp:769
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition: Unit.cpp:9041
void ClearUnitState(uint32 f)
Definition: Unit.h:733
bool IsVehicle() const
Definition: Unit.h:743
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition: Unit.cpp:7845
void SetOverrideDisplayPowerId(uint32 powerDisplayId)
Definition: Unit.h:801
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:8280
int32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr) const
Definition: Unit.cpp:6626
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3608
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:782
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1321
void SetSilencedSchoolMask(SpellSchoolMask schoolMask)
Definition: Unit.h:1454
float GetHealthPct() const
Definition: Unit.h:784
float m_baseSpellCritChance
Definition: Unit.h:1474
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition: Unit.cpp:5827
int32 MeleeDamageBonusTaken(Unit *attacker, int32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition: Unit.cpp:7736
virtual void RecalculateObjectScale()
Definition: Unit.cpp:10140
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition: Unit.cpp:7120
int32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype) const
Definition: Unit.cpp:7285
Pet * ToPet()
Definition: Unit.h:1750
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition: Unit.h:1015
void RemoveAurasByShapeShift()
Definition: Unit.cpp:4194
void SetUnitFlag3(UnitFlags3 flags)
Definition: Unit.h:843
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition: Unit.cpp:9150
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:11836
int64 ModifyHealth(int64 val)
Definition: Unit.cpp:8182
void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting=false)
Definition: Unit.cpp:10172
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
void FinishSpell(CurrentSpellTypes spellType, SpellCastResult result=SPELL_CAST_OK)
Definition: Unit.cpp:3047
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
void ApplyModManaCostModifier(SpellSchools school, int32 mod, bool apply)
Definition: Unit.h:817
void RestoreFaction()
Definition: Unit.cpp:11417
void SetControlled(bool apply, UnitState state)
Definition: Unit.cpp:10911
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1814
uint8 GetClass() const
Definition: Unit.h:752
void SetVisFlag(UnitVisFlags flags)
Definition: Unit.h:891
bool CanUseAttackType(uint8 attacktype) const
Definition: Unit.cpp:2492
uint32 GetClassMask() const
Definition: Unit.h:754
bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster) const
Definition: Unit.cpp:4679
uint32 GetLastExtraAttackSpell() const
Definition: Unit.h:944
uint32 GetMountDisplayId() const
Definition: Unit.h:899
void UpdateAllDamageDoneMods()
Definition: Unit.cpp:9144
void UpdateDisplayPower()
Definition: Unit.cpp:5625
float GetCollisionHeight() const override
Definition: Unit.cpp:13733
static void DealHeal(HealInfo &healInfo)
Definition: Unit.cpp:6339
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:637
void UpdateSpeed(UnitMoveType mtype)
Definition: Unit.cpp:8361
static void DealDamageMods(Unit const *attacker, Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:748
bool IsPolymorphed() const
Definition: Unit.cpp:10127
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1463
void SetFaction(uint32 faction) override
Definition: Unit.h:859
void SetCosmeticMountDisplayId(uint32 mountDisplayId)
Definition: Unit.h:902
static void CalcHealAbsorb(HealInfo &healInfo)
Definition: Unit.cpp:2028
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false, bool blocked=false, Spell *spell=nullptr)
Definition: Unit.cpp:1142
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition: Unit.cpp:9021
std::forward_list< AuraEffect * > AuraEffectList
Definition: Unit.h:644
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition: Unit.cpp:8988
uint32 GetTransformSpell() const
Definition: Unit.h:1574
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1248
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct) const
Definition: Unit.cpp:2392
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition: Unit.cpp:1797
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool SetFeatherFall(bool enable)
Definition: Unit.cpp:12900
bool IsPet() const
Definition: Unit.h:740
Powers GetPowerType() const
Definition: Unit.h:799
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit *victim, uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK, uint8 attackerLevel=0)
Definition: Unit.cpp:1625
void Dismount()
Definition: Unit.cpp:7920
bool SetHover(bool enable, bool updateAnimTier=true)
Definition: Unit.cpp:12938
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4464
bool IsFullHealth() const
Definition: Unit.h:779
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:838
int32 MeleeDamageBonusDone(Unit *pVictim, int32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, Mechanics mechanic=MECHANIC_NONE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
Definition: Unit.cpp:7624
bool IsAlive() const
Definition: Unit.h:1164
virtual bool CanApplyResilience() const
Definition: Unit.cpp:11759
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition: Unit.cpp:10335
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:9410
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition: Unit.cpp:6591
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:12223
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:5378
bool IsStandState() const
Definition: Unit.cpp:10094
TempSummon * ToTempSummon()
Definition: Unit.h:1756
bool IsGravityDisabled() const
Definition: Unit.h:1135
CharmInfo * GetCharmInfo()
Definition: Unit.h:1221
bool SetCanTransitionBetweenSwimAndFly(bool enable)
Definition: Unit.cpp:13048
bool SetDisableInertia(bool disable)
Definition: Unit.cpp:13145
void RemoveVisFlag(UnitVisFlags flags)
Definition: Unit.h:892
void RemoveUnitFlag3(UnitFlags3 flags)
Definition: Unit.h:844
float SpellCritChanceDone(Spell *spell, AuraEffect const *aurEff, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
Definition: Unit.cpp:6931
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
void UpdateMountCapability()
Definition: Unit.cpp:8051
void AddUnitState(uint32 f)
Definition: Unit.h:731
static void ApplyResilience(Unit const *victim, int32 *damage)
Definition: Unit.cpp:11764
float GetTotalAuraMultiplier(AuraType auraType) const
Definition: Unit.cpp:4934
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition: Unit.cpp:7887
Gender GetGender() const
Definition: Unit.h:755
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:64
virtual Gender GetNativeGender() const
Definition: Unit.h:757
uint32 GetCreatureType() const
Definition: Unit.cpp:8880
void SetInstantCast(bool set)
Definition: Unit.h:1762
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition: Unit.cpp:13477
uint32 GetDisplayId() const
Definition: Unit.h:1567
void SendSpellDamageImmune(Unit *target, uint32 spellId, bool isPeriodic)
Definition: Unit.cpp:5478
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:5894
uint32 GetNativeDisplayId() const
Definition: Unit.h:1570
float SpellCritChanceTaken(Unit const *caster, Spell *spell, AuraEffect const *aurEff, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType=BASE_ATTACK) const
Definition: Unit.cpp:6985
virtual void UpdateArmor()=0
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:780
uint64 GetMaxHealth() const
Definition: Unit.h:777
int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, bool npcCaster) const
Definition: Unit.cpp:11786
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition: Unit.cpp:4634
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
bool SetCanFly(bool enable)
Definition: Unit.cpp:12820
uint64 GetHealth() const
Definition: Unit.h:776
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:839
bool SetCanTurnWhileFalling(bool enable)
Definition: Unit.cpp:13082
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4674
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition: Unit.cpp:4101
void StopAttackFaction(uint32 faction_id)
Definition: Unit.cpp:12475
void RemoveCharmedBy(Unit *charmer)
Definition: Unit.cpp:11315
bool IsMounted() const
Definition: Unit.h:898
virtual uint32 GetPowerIndex(Powers power) const =0
Unit * GetVictim() const
Definition: Unit.h:715
int32 GetPower(Powers power) const
Definition: Unit.cpp:9401
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:7376
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:5986
DeathState getDeathState() const
Definition: Unit.h:1167
bool SetIgnoreMovementForces(bool ignore)
Definition: Unit.cpp:13256
float GetTotalAuraMultiplierByMiscMask(AuraType auraType, uint32 misc_mask) const
Definition: Unit.cpp:4959
void ApplyCastTimePercentMod(float val, bool apply)
Definition: Unit.cpp:10361
bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading=false)
Definition: Unit.cpp:11443
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
int32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype) const
Definition: Unit.cpp:6809
bool IsInFeralForm() const
Definition: Unit.cpp:8909
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition: Unit.cpp:7090
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition: Unit.cpp:3592
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition: Unit.cpp:5439
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:12125
bool IsControlledByPlayer() const
Definition: Unit.h:1193
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:11142
bool SetWaterWalking(bool enable)
Definition: Unit.cpp:12863
void SetMaxPower(Powers power, int32 val)
Definition: Unit.cpp:9456
virtual void setDeathState(DeathState s)
Definition: Unit.cpp:8592
void RemoveVehicleKit(bool onRemoveFromWorld=false)
Definition: Unit.cpp:11459
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr)
Definition: Unit.cpp:1616
void HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
Definition: Unit.cpp:8963
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
void UpdateMovementForcesModMagnitude()
Definition: Unit.cpp:13287
bool IsFlying() const
Definition: Unit.h:1735
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1274
void SetVignette(uint32 vignetteId)
Definition: Unit.cpp:13759
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:12647
Vehicle * GetVehicleKit() const
Definition: Unit.h:1711
float m_modSpellHitChance
Definition: Unit.h:1473
Guardian * GetGuardianPet() const
Definition: Unit.cpp:6046
static void ProcSkillsAndAuras(Unit *actor, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
Definition: Unit.cpp:5407
void ReplaceAllSilencedSchoolMask(SpellSchoolMask schoolMask)
Definition: Unit.h:1455
AuraMap & GetOwnedAuras()
Definition: Unit.h:1264
void UpdateAllDamagePctDoneMods()
Definition: Unit.cpp:9191
bool AttackStop()
Definition: Unit.cpp:5781
void SetTransformSpell(uint32 spellid)
Definition: Unit.h:1573
void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply)
Definition: Unit.h:816
void SetShapeshiftForm(ShapeshiftForm form)
Definition: Unit.cpp:8904
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.cpp:10591
int32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr) const
Definition: Unit.cpp:7138
void SetMountDisplayId(uint32 mountDisplayId)
Definition: Unit.h:900
uint8 GetRace() const
Definition: Unit.h:749
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
Definition: Unit.cpp:10148
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3017
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition: Unit.cpp:11908
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
void UpdateStatBuffMod(Stats stat)
Definition: Unit.cpp:5079
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1442
Vehicle * RemovePassenger(WorldObject *passenger) override
Removes the passenger from the vehicle.
Definition: Vehicle.cpp:492
void RemovePendingEventsForPassenger(Unit *passenger)
Definition: Vehicle.cpp:762
void PlayDirectSound(uint32 soundId, Player const *target=nullptr, uint32 broadcastTextId=0) const
Definition: Object.cpp:3592
Map * GetMap() const
Definition: Object.h:624
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition: Object.cpp:3312
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:616
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:617
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition: Object.cpp:2065
void PlayDistanceSound(uint32 soundId, Player const *target=nullptr) const
Definition: Object.cpp:3576
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h:614
void UpdatePositionData()
Definition: Object.cpp:992
Player * GetSpellModOwner() const
Definition: Object.cpp:2272
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:613
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:620
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
Definition: Object.cpp:2621
uint32 GetZoneId() const
Definition: Object.h:545
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:619
void ModSpellDurationTime(SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
Definition: Object.cpp:2490
bool isLogingOut() const
Is the user engaged in a log out process?
WeatherState
Definition: Weather.h:46
void apply(T *val)
Definition: ByteConverter.h:41
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:109
std::string ToString(Type &&val, Params &&... params)
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition: Spell.cpp:9403
Difficulty CastDifficulty
Definition: SpellDefines.h:483
TriggerCastFlags TriggerFlags
Definition: SpellDefines.h:478
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
ObjectGuid OriginalCaster
Definition: SpellDefines.h:482
ObjectGuid OriginalCastId
Definition: SpellDefines.h:484
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:203
bool HasCommandState(CommandStates state) const
Definition: CharmInfo.h:99
uint32 mitigated_damage
Definition: Unit.h:406
uint32 CreatureDisplayID
Definition: CreatureData.h:432
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X)
Definition: GameObject.cpp:118
SpellModOp op
Definition: Player.h:229
SpellModType type
Definition: Player.h:230
uint32 spellId
Definition: Player.h:232
Unit * target
Definition: Unit.h:551
uint32 HitInfo
Definition: Unit.h:563
uint32 damage
Definition: Unit.h:556
uint32 absorb
Definition: Unit.h:559
Unit * attacker
Definition: Unit.h:552
bool periodicLog
Definition: Unit.h:561
uint32 originalDamage
Definition: Unit.h:557
uint32 resist
Definition: Unit.h:560
std::array< uint32, MAX_SHAPESHIFT_SPELLS > PresetSpellID
EnumFlag< SpellShapeshiftFormFlags > GetFlags() const