TrinityCore
Loading...
Searching...
No Matches
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 "SpellScript.h"
46#include "ThreatManager.h"
47#include "Unit.h"
48#include "Util.h"
49#include "Vehicle.h"
50#include "Weather.h"
51#include "WorldPacket.h"
52#include "WorldSession.h"
53#include <G3D/g3dmath.h>
54#include <numeric>
55
56class Aura;
57//
58// EFFECT HANDLER NOTES
59//
60// in aura handler there should be check for modes:
61// AURA_EFFECT_HANDLE_REAL set
62// AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK set
63// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK set - aura is recalculated or is just applied/removed - need to redo all things related to m_amount
64// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK - logical or of above conditions
65// AURA_EFFECT_HANDLE_STAT - set when stats are reapplied
66// such checks will speedup trinity change amount/send for client operations
67// because for change amount operation packets will not be send
68// aura effect handlers shouldn't contain any AuraEffect or Aura object modifications
69
71{
72 &AuraEffect::HandleNULL, // 0 SPELL_AURA_NONE
73 &AuraEffect::HandleBindSight, // 1 SPELL_AURA_BIND_SIGHT
74 &AuraEffect::HandleModPossess, // 2 SPELL_AURA_MOD_POSSESS
75 &AuraEffect::HandleNoImmediateEffect, // 3 SPELL_AURA_PERIODIC_DAMAGE implemented in AuraEffect::PeriodicTick
76 &AuraEffect::HandleAuraDummy, // 4 SPELL_AURA_DUMMY
77 &AuraEffect::HandleModConfuse, // 5 SPELL_AURA_MOD_CONFUSE
78 &AuraEffect::HandleModCharm, // 6 SPELL_AURA_MOD_CHARM
79 &AuraEffect::HandleModFear, // 7 SPELL_AURA_MOD_FEAR
80 &AuraEffect::HandleNoImmediateEffect, // 8 SPELL_AURA_PERIODIC_HEAL implemented in AuraEffect::PeriodicTick
81 &AuraEffect::HandleModAttackSpeed, // 9 SPELL_AURA_MOD_ATTACKSPEED
82 &AuraEffect::HandleModThreat, // 10 SPELL_AURA_MOD_THREAT
83 &AuraEffect::HandleModTaunt, // 11 SPELL_AURA_MOD_TAUNT
84 &AuraEffect::HandleAuraModStun, // 12 SPELL_AURA_MOD_STUN
85 &AuraEffect::HandleModDamageDone, // 13 SPELL_AURA_MOD_DAMAGE_DONE
86 &AuraEffect::HandleNoImmediateEffect, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
87 &AuraEffect::HandleNoImmediateEffect, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
88 &AuraEffect::HandleModStealth, // 16 SPELL_AURA_MOD_STEALTH
89 &AuraEffect::HandleModStealthDetect, // 17 SPELL_AURA_MOD_DETECT
90 &AuraEffect::HandleModInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
91 &AuraEffect::HandleModInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECT
92 &AuraEffect::HandleNoImmediateEffect, // 20 SPELL_AURA_OBS_MOD_HEALTH implemented in AuraEffect::PeriodicTick
93 &AuraEffect::HandleNoImmediateEffect, // 21 SPELL_AURA_OBS_MOD_POWER implemented in AuraEffect::PeriodicTick
94 &AuraEffect::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE
95 &AuraEffect::HandleNoImmediateEffect, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL implemented in AuraEffect::PeriodicTick
96 &AuraEffect::HandleNoImmediateEffect, // 24 SPELL_AURA_PERIODIC_ENERGIZE implemented in AuraEffect::PeriodicTick
97 &AuraEffect::HandleAuraModPacify, // 25 SPELL_AURA_MOD_PACIFY
98 &AuraEffect::HandleAuraModRoot, // 26 SPELL_AURA_MOD_ROOT
99 &AuraEffect::HandleAuraModSilence, // 27 SPELL_AURA_MOD_SILENCE
100 &AuraEffect::HandleNoImmediateEffect, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
101 &AuraEffect::HandleAuraModStat, // 29 SPELL_AURA_MOD_STAT
102 &AuraEffect::HandleAuraModSkill, // 30 SPELL_AURA_MOD_SKILL
103 &AuraEffect::HandleAuraModIncreaseSpeed, // 31 SPELL_AURA_MOD_INCREASE_SPEED
104 &AuraEffect::HandleAuraModIncreaseMountedSpeed, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
105 &AuraEffect::HandleAuraModDecreaseSpeed, // 33 SPELL_AURA_MOD_DECREASE_SPEED
106 &AuraEffect::HandleAuraModIncreaseHealth, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
107 &AuraEffect::HandleAuraModIncreaseEnergy, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
108 &AuraEffect::HandleAuraModShapeshift, // 36 SPELL_AURA_MOD_SHAPESHIFT
109 &AuraEffect::HandleAuraModEffectImmunity, // 37 SPELL_AURA_EFFECT_IMMUNITY
110 &AuraEffect::HandleAuraModStateImmunity, // 38 SPELL_AURA_STATE_IMMUNITY
111 &AuraEffect::HandleAuraModSchoolImmunity, // 39 SPELL_AURA_SCHOOL_IMMUNITY
112 &AuraEffect::HandleAuraModDmgImmunity, // 40 SPELL_AURA_DAMAGE_IMMUNITY
113 &AuraEffect::HandleAuraModDispelImmunity, // 41 SPELL_AURA_DISPEL_IMMUNITY
114 &AuraEffect::HandleNoImmediateEffect, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in AuraEffect::HandleProc
115 &AuraEffect::HandleNoImmediateEffect, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in AuraEffect::HandleProc
116 &AuraEffect::HandleAuraTrackCreatures, // 44 SPELL_AURA_TRACK_CREATURES
117 &AuraEffect::HandleNULL, // 45 SPELL_AURA_TRACK_RESOURCES implemented clientside
118 &AuraEffect::HandleNULL, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
119 &AuraEffect::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT
120 &AuraEffect::HandleNoImmediateEffect, // 48 SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
121 &AuraEffect::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT
122 &AuraEffect::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT implemented in Unit::SpellCriticalHealingBonus
123 &AuraEffect::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
124 &AuraEffect::HandleAuraModWeaponCritPercent, // 52 SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
125 &AuraEffect::HandleNoImmediateEffect, // 53 SPELL_AURA_PERIODIC_LEECH implemented in AuraEffect::PeriodicTick
126 &AuraEffect::HandleNoImmediateEffect, // 54 SPELL_AURA_MOD_HIT_CHANCE implemented in Unit::MeleeSpellMissChance
127 &AuraEffect::HandleModSpellHitChance, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
128 &AuraEffect::HandleAuraTransform, // 56 SPELL_AURA_TRANSFORM
129 &AuraEffect::HandleModSpellCritChance, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
130 &AuraEffect::HandleAuraModIncreaseSwimSpeed, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
131 &AuraEffect::HandleNoImmediateEffect, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
132 &AuraEffect::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
133 &AuraEffect::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
134 &AuraEffect::HandleNoImmediateEffect, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL implemented in AuraEffect::PeriodicTick
135 &AuraEffect::HandleNoImmediateEffect, // 63 SPELL_AURA_MOD_ADDITIONAL_POWER_COST implemented in SpellInfo::CalcPowerCost
136 &AuraEffect::HandleNoImmediateEffect, // 64 SPELL_AURA_PERIODIC_MANA_LEECH implemented in AuraEffect::PeriodicTick
137 &AuraEffect::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED
138 &AuraEffect::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
139 &AuraEffect::HandleAuraModDisarm, // 67 SPELL_AURA_MOD_DISARM
140 &AuraEffect::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
141 &AuraEffect::HandleNoImmediateEffect, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
142 &AuraEffect::HandleNoImmediateEffect, // 70 SPELL_AURA_PERIODIC_WEAPON_PERCENT_DAMAGE implemented in AuraEffect::PeriodicTick
143 &AuraEffect::HandleStoreTeleportReturnPoint, // 71 SPELL_AURA_STORE_TELEPORT_RETURN_POINT
144 &AuraEffect::HandleNoImmediateEffect, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
145 &AuraEffect::HandleModPowerCost, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
146 &AuraEffect::HandleNoImmediateEffect, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
147 &AuraEffect::HandleNoImmediateEffect, // 75 SPELL_AURA_MOD_LANGUAGE
148 &AuraEffect::HandleNoImmediateEffect, // 76 SPELL_AURA_FAR_SIGHT
149 &AuraEffect::HandleModMechanicImmunity, // 77 SPELL_AURA_MECHANIC_IMMUNITY
150 &AuraEffect::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED
151 &AuraEffect::HandleModDamagePercentDone, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
152 &AuraEffect::HandleModPercentStat, // 80 SPELL_AURA_MOD_PERCENT_STAT
153 &AuraEffect::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT implemented in Unit::CalcAbsorbResist
154 &AuraEffect::HandleWaterBreathing, // 82 SPELL_AURA_WATER_BREATHING
155 &AuraEffect::HandleModBaseResistance, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
156 &AuraEffect::HandleNoImmediateEffect, // 84 SPELL_AURA_MOD_REGEN implemented in Player::RegenerateHealth
157 &AuraEffect::HandleModPowerRegen, // 85 SPELL_AURA_MOD_POWER_REGEN
158 &AuraEffect::HandleChannelDeathItem, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
159 &AuraEffect::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
160 &AuraEffect::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT implemented in Player::RegenerateHealth
161 &AuraEffect::HandleNoImmediateEffect, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
162 &AuraEffect::HandleUnused, // 90 unused (4.3.4) old SPELL_AURA_MOD_RESIST_CHANCE
163 &AuraEffect::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
164 &AuraEffect::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
165 &AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
166 &AuraEffect::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::GetPowerRegen
167 &AuraEffect::HandleAuraGhost, // 95 SPELL_AURA_GHOST
168 &AuraEffect::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::GetMagicHitRedirectTarget
169 &AuraEffect::HandleNoImmediateEffect, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
170 &AuraEffect::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT
171 &AuraEffect::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER
172 &AuraEffect::HandleUnused, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
173 &AuraEffect::HandleModResistancePercent, //101 SPELL_AURA_MOD_RESISTANCE_PCT
174 &AuraEffect::HandleNoImmediateEffect, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
175 &AuraEffect::HandleAuraModTotalThreat, //103 SPELL_AURA_MOD_TOTAL_THREAT
176 &AuraEffect::HandleAuraWaterWalk, //104 SPELL_AURA_WATER_WALK
177 &AuraEffect::HandleAuraFeatherFall, //105 SPELL_AURA_FEATHER_FALL
178 &AuraEffect::HandleAuraHover, //106 SPELL_AURA_HOVER
179 &AuraEffect::HandleNoImmediateEffect, //107 SPELL_AURA_ADD_FLAT_MODIFIER implemented in AuraEffect::CalculateSpellMod()
180 &AuraEffect::HandleNoImmediateEffect, //108 SPELL_AURA_ADD_PCT_MODIFIER implemented in AuraEffect::CalculateSpellMod()
181 &AuraEffect::HandleNoImmediateEffect, //109 SPELL_AURA_ADD_TARGET_TRIGGER
182 &AuraEffect::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT implemented in Player::UpdatePowerRegen, Creature::Regenerate
183 &AuraEffect::HandleNoImmediateEffect, //111 SPELL_AURA_INTERCEPT_MELEE_RANGED_ATTACKS implemented in Unit::GetMeleeHitRedirectTarget
184 &AuraEffect::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
185 &AuraEffect::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
186 &AuraEffect::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
187 &AuraEffect::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
188 &AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
189 &AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
190 &AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
191 &AuraEffect::HandleAuraPvpTalents, //119 SPELL_AURA_PVP_TALENTS
192 &AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
193 &AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
194 &AuraEffect::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
195 &AuraEffect::HandleModTargetResistance, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
196 &AuraEffect::HandleAuraModRangedAttackPower, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
197 &AuraEffect::HandleNoImmediateEffect, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
198 &AuraEffect::HandleNoImmediateEffect, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
199 &AuraEffect::HandleNoImmediateEffect, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
200 &AuraEffect::HandleAuraModFixate, //128 SPELL_AURA_MOD_FIXATE
201 &AuraEffect::HandleAuraModIncreaseSpeed, //129 SPELL_AURA_MOD_SPEED_ALWAYS
202 &AuraEffect::HandleAuraModIncreaseMountedSpeed, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
203 &AuraEffect::HandleNoImmediateEffect, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
204 &AuraEffect::HandleAuraModIncreaseEnergyPercent, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
205 &AuraEffect::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
206 &AuraEffect::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
207 &AuraEffect::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE
208 &AuraEffect::HandleModHealingDonePct, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT
209 &AuraEffect::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
210 &AuraEffect::HandleModMeleeHaste, //138 SPELL_AURA_MOD_MELEE_HASTE
211 &AuraEffect::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION
212 &AuraEffect::HandleModRangedHaste, //140 SPELL_AURA_MOD_RANGED_HASTE
213 &AuraEffect::HandleUnused, //141 SPELL_AURA_141
214 &AuraEffect::HandleAuraModBaseResistancePCT, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
215 &AuraEffect::HandleModRecoveryRateBySpellLabel, //143 SPELL_AURA_MOD_RECOVERY_RATE_BY_SPELL_LABEL also implemented in SpellHistory::StartCooldown
216 &AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
217 &AuraEffect::HandleAuraModIncreaseHealthPercent, //145 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT2
218 &AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
219 &AuraEffect::HandleModMechanicImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
220 &AuraEffect::HandleModChargeRecoveryRate, //148 SPELL_AURA_MOD_CHARGE_RECOVERY_RATE also implemented in SpellHistory::GetChargeRecoveryTime
221 &AuraEffect::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
222 &AuraEffect::HandleShieldBlockValuePercent, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
223 &AuraEffect::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
224 &AuraEffect::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
225 &AuraEffect::HandleNoImmediateEffect, //153 SPELL_AURA_MOD_AUTOATTACK_RANGE implemented in Unit::IsWithinMeleeRange
226 &AuraEffect::HandleModStealthLevel, //154 SPELL_AURA_MOD_STEALTH_LEVEL
227 &AuraEffect::HandleModWaterBreathing, //155 SPELL_AURA_MOD_WATER_BREATHING
228 &AuraEffect::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN
229 &AuraEffect::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI
230 &AuraEffect::HandleAuraAllowTalentSwapping, //158 SPELL_AURA_ALLOW_TALENT_SWAPPING
231 &AuraEffect::HandleNoImmediateEffect, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
232 &AuraEffect::HandleUnused, //160 Unused (4.3.4) old SPELL_AURA_MOD_AOE_AVOIDANCE
233 &AuraEffect::HandleNoImmediateEffect, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
234 &AuraEffect::HandleNoImmediateEffect, //162 SPELL_AURA_POWER_BURN implemented in AuraEffect::PeriodicTick
235 &AuraEffect::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
236 &AuraEffect::HandleForceBreathBar, //164 SPELL_AURA_FORCE_BREATH_BAR
237 &AuraEffect::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
238 &AuraEffect::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
239 &AuraEffect::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
240 &AuraEffect::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
241 &AuraEffect::HandleSetFFAPvP, //169 SPELL_AURA_SET_FFA_PVP implemented in Player::UpdatePvPState
242 &AuraEffect::HandleDetectAmore, //170 SPELL_AURA_DETECT_AMORE used to detect various spells that change visual of units for aura target
243 &AuraEffect::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
244 &AuraEffect::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
245 &AuraEffect::HandleNoImmediateEffect, //173 SPELL_AURA_MOD_CHARGE_RECOVERY_RATE_BY_TYPE_MASK implemented in SpellHistory::GetChargeRecoveryTime
246 &AuraEffect::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
247 &AuraEffect::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
248 &AuraEffect::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
249 &AuraEffect::HandleCharmConvert, //177 SPELL_AURA_AOE_CHARM
250 &AuraEffect::HandleAuraModMaxPowerPct, //178 SPELL_AURA_MOD_MAX_POWER_PCT
251 &AuraEffect::HandleAuraModPowerDisplay, //179 SPELL_AURA_MOD_POWER_DISPLAY
252 &AuraEffect::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
253 &AuraEffect::HandleNULL, //181 SPELL_AURA_MOD_SPELL_CURRENCY_REAGENTS_COUNT_PCT
254 &AuraEffect::HandleSuppressItemPassiveEffectBySpellLabel, //182 SPELL_AURA_SUPPRESS_ITEM_PASSIVE_EFFECT_BY_SPELL_LABEL
255 &AuraEffect::HandleNoImmediateEffect, //183 SPELL_AURA_MOD_CRIT_CHANCE_VERSUS_TARGET_HEALTH implemented in Unit::GetUnitCriticalChance, Unit::GetUnitSpellCriticalChance
256 &AuraEffect::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
257 &AuraEffect::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
258 &AuraEffect::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
259 &AuraEffect::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
260 &AuraEffect::HandleNULL, //188 SPELL_AURA_MOD_UI_HEALING_RANGE handled clientside - affects UnitInRange lua function only
261 &AuraEffect::HandleModRating, //189 SPELL_AURA_MOD_RATING
262 &AuraEffect::HandleNoImmediateEffect, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN implemented in Player::CalculateReputationGain
263 &AuraEffect::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
264 &AuraEffect::HandleModMeleeRangedHaste, //192 SPELL_AURA_MOD_MELEE_RANGED_HASTE
265 &AuraEffect::HandleModMeleeRangedCastingHaste, //193 SPELL_AURA_MOD_MELEE_RANGED_CASTING_HASTE
266 &AuraEffect::HandleNoImmediateEffect, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
267 &AuraEffect::HandleLearnSpell, //195 SPELL_AURA_LEARN_SPELL
268 &AuraEffect::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN - flat mod of spell cooldowns
269 &AuraEffect::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
270 &AuraEffect::HandleNoImmediateEffect, //198 SPELL_AURA_MOD_COMBAT_RATING_FROM_COMBAT_RATING implemented in Player::UpdateRating
271 &AuraEffect::HandleUnused, //199 unused (4.3.4) old SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
272 &AuraEffect::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::RewardPlayerAndGroupAtKill
273 &AuraEffect::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
274 &AuraEffect::HandleNoImmediateEffect, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
275 &AuraEffect::HandleNoImmediateEffect, //203 SPELL_AURA_PREVENT_INTERRUPT implemented in SpellInfo::CanBeInterrupted
276 &AuraEffect::HandleNULL, //204 SPELL_AURA_PREVENT_CORPSE_RELEASE
277 &AuraEffect::HandleNoImmediateEffect, //205 SPELL_AURA_MOD_CHARGE_RECOVERY_BY_TYPE_MASK implemented in SpellHistory::GetChargeRecoveryTime
278 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //206 SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED
279 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //207 SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
280 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //208 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
281 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //209 SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
282 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //210 SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS
283 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
284 &AuraEffect::HandleNoImmediateEffect, //212 SPELL_AURA_MOD_HONOR_GAIN_PCT_FROM_SOURCE implemented in Player::RewardHonor
285 &AuraEffect::HandleNoImmediateEffect, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
286 &AuraEffect::HandleNULL, //214 Tamed Pet Passive
287 &AuraEffect::HandleArenaPreparation, //215 SPELL_AURA_ARENA_PREPARATION
288 &AuraEffect::HandleModSpellSlowNoStack, //216 SPELL_AURA_MOD_SPELL_SLOW_NO_STACK
289 &AuraEffect::HandleModMeleeSlowNoStack, //217 SPELL_AURA_MOD_MELEE_SLOW_NO_STACK
290 &AuraEffect::HandleNoImmediateEffect, //218 SPELL_AURA_ADD_PCT_MODIFIER_BY_SPELL_LABEL implemented in AuraEffect::CalculateSpellMod()
291 &AuraEffect::HandleNoImmediateEffect, //219 SPELL_AURA_ADD_FLAT_MODIFIER_BY_SPELL_LABEL implemented in AuraEffect::CalculateSpellMod()
292 &AuraEffect::HandleNULL, //220 SPELL_AURA_MOD_ABILITY_SCHOOL_MASK
293 &AuraEffect::HandleModDetaunt, //221 SPELL_AURA_MOD_DETAUNT
294 &AuraEffect::HandleNoImmediateEffect, //222 SPELL_AURA_REMOVE_TRANSMOG_COST implemented in WorldSession::HandleTransmogrifyItems
295 &AuraEffect::HandleNoImmediateEffect, //223 SPELL_AURA_REMOVE_BARBER_SHOP_COST implemented in Player::GetBarberShopCost
296 &AuraEffect::HandleNULL, //224 SPELL_AURA_MOD_TRAIT_NODE_ENTRY_RANK
297 &AuraEffect::HandleNULL, //225 SPELL_AURA_MOD_VISIBILITY_RANGE
298 &AuraEffect::HandleNoImmediateEffect, //226 SPELL_AURA_PERIODIC_DUMMY implemented in AuraEffect::PeriodicTick
299 &AuraEffect::HandleNoImmediateEffect, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE implemented in AuraEffect::PeriodicTick
300 &AuraEffect::HandleNoImmediateEffect, //228 SPELL_AURA_DETECT_STEALTH stealth detection
301 &AuraEffect::HandleNoImmediateEffect, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
302 &AuraEffect::HandleAuraModIncreaseHealth, //230 SPELL_AURA_MOD_INCREASE_HEALTH_2
303 &AuraEffect::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
304 &AuraEffect::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
305 &AuraEffect::HandleUnused, //233 set model id to the one of the creature with id GetMiscValue() - clientside
306 &AuraEffect::HandleNoImmediateEffect, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
307 &AuraEffect::HandleNULL, //235 SPELL_AURA_MOD_HOVER_NO_HEIGHT_OFFSET handled clientside
308 &AuraEffect::HandleAuraControlVehicle, //236 SPELL_AURA_CONTROL_VEHICLE
309 &AuraEffect::HandleNULL, //237 SPELL_AURA_237
310 &AuraEffect::HandleNULL, //238 SPELL_AURA_238
311 &AuraEffect::HandleAuraModScale, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
312 &AuraEffect::HandleAuraModExpertise, //240 SPELL_AURA_MOD_EXPERTISE
313 &AuraEffect::HandleForceMoveForward, //241 SPELL_AURA_FORCE_MOVE_FORWARD Forces the caster to move forward
314 &AuraEffect::HandleNULL, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING - 2 test spells: 44183 and 44182
315 &AuraEffect::HandleAuraModFaction, //243 SPELL_AURA_MOD_FACTION
316 &AuraEffect::HandleComprehendLanguage, //244 SPELL_AURA_COMPREHEND_LANGUAGE
317 &AuraEffect::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
318 &AuraEffect::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura
319 &AuraEffect::HandleAuraCloneCaster, //247 SPELL_AURA_CLONE_CASTER
320 &AuraEffect::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
321 &AuraEffect::HandleNoImmediateEffect, //249 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE_BY_TARGET_AURA_MECHANIC implemented in Unit::SpellDamagePctDone and Unit::MeleeDamagePctDone
322 &AuraEffect::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
323 &AuraEffect::HandleNoImmediateEffect, //251 SPELL_AURA_MOD_ENEMY_DODGE implemented in Unit::GetUnitDodgeChance
324 &AuraEffect::HandleModMeleeRangedCastingSlowNoStack, //252 SPELL_AURA_MOD_MELEE_RANGED_CASTING_SLOW_NO_STACK
325 &AuraEffect::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical
326 &AuraEffect::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND
327 &AuraEffect::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
328 &AuraEffect::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
329 &AuraEffect::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
330 &AuraEffect::HandleNoImmediateEffect, //258 SPELL_AURA_OVERRIDE_SUMMONED_OBJECT implemented in Spell::EffectTransmitted
331 &AuraEffect::HandleNoImmediateEffect, //259 SPELL_AURA_MOD_HOT_PCT implemented in Unit::SpellHealingBonusTaken
332 &AuraEffect::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
333 &AuraEffect::HandlePhase, //261 SPELL_AURA_PHASE
334 &AuraEffect::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in Spell::CheckCast
335 &AuraEffect::HandleNoImmediateEffect, //263 SPELL_AURA_DISABLE_CASTING_EXCEPT_ABILITIES implemented in Spell::CheckCast
336 &AuraEffect::HandleNoImmediateEffect, //264 SPELL_AURA_DISABLE_ATTACKING_EXCEPT_ABILITIES implemented in Spell::CheckCast, Unit::AttackerStateUpdate
337 &AuraEffect::HandleUnused, //265 unused (4.3.4)
338 &AuraEffect::HandleSetVignette, //266 SPELL_AURA_SET_VIGNETTE
339 &AuraEffect::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
340 &AuraEffect::HandleModArmorPctFromStat, //268 SPELL_AURA_MOD_ARMOR_PCT_FROM_STAT also implemented in Player::UpdateArmor()
341 &AuraEffect::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
342 &AuraEffect::HandleNoImmediateEffect, //270 SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonusTaken and Unit::MeleeDamageBonusTaken
343 &AuraEffect::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonusTaken and Unit::MeleeDamageBonusTaken
344 &AuraEffect::HandleNULL, //272 SPELL_AURA_MOD_BLOCK_VALUE_PCT
345 &AuraEffect::HandleUnused, //273 clientside
346 &AuraEffect::HandleNULL, //274 SPELL_AURA_MOD_BLOCK_VALUE_FLAT
347 &AuraEffect::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
348 &AuraEffect::HandleNULL, //276 mod damage % mechanic?
349 &AuraEffect::HandleUnused, //277 unused (4.3.4) old SPELL_AURA_MOD_MAX_AFFECTED_TARGETS
350 &AuraEffect::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
351 &AuraEffect::HandleNoImmediateEffect, //279 SPELL_AURA_INITIALIZE_IMAGES
352 &AuraEffect::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT implemented in Unit::CalcArmorReducedDamage
353 &AuraEffect::HandleNoImmediateEffect, //281 SPELL_AURA_PROVIDE_SPELL_FOCUS implemented in Spell::CheckCast
354 &AuraEffect::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_MOD_BASE_HEALTH_PCT
355 &AuraEffect::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
356 &AuraEffect::HandleAuraLinked, //284 SPELL_AURA_LINKED
357 &AuraEffect::HandleAuraLinked, //285 SPELL_AURA_LINKED_2
358 &AuraEffect::HandleModRecoveryRate, //286 SPELL_AURA_MOD_RECOVERY_RATE also implemented in SpellHistory::StartCooldown
359 &AuraEffect::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
360 &AuraEffect::HandleNoImmediateEffect, //288 SPELL_AURA_IGNORE_HIT_DIRECTION implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult Unit::RollMeleeOutcomeAgainst
361 &AuraEffect::HandleNoImmediateEffect, //289 SPELL_AURA_PREVENT_DURABILITY_LOSS implemented in Player::DurabilityPointsLoss
362 &AuraEffect::HandleAuraModCritPct, //290 SPELL_AURA_MOD_CRIT_PCT
363 &AuraEffect::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_XP_QUEST_PCT implemented in Player::RewardQuest
364 &AuraEffect::HandleAuraOpenStable, //292 SPELL_AURA_OPEN_STABLE
365 &AuraEffect::HandleAuraOverrideSpells, //293 SPELL_AURA_OVERRIDE_SPELLS auras which probably add set of abilities to their target based on it's miscvalue
366 &AuraEffect::HandleAuraPreventRegeneratePower, //294 SPELL_AURA_PREVENT_REGENERATE_POWER
367 &AuraEffect::HandleNoImmediateEffect, //295 SPELL_AURA_MOD_PERIODIC_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonusTaken, Unit::SpellDamageBonusTaken
368 &AuraEffect::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
369 &AuraEffect::HandleAuraModRootAndDisableGravity, //297 SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY
370 &AuraEffect::HandleAuraModStunAndDisableGravity, //298 SPELL_AURA_MOD_STUN_DISABLE_GRAVITY
371 &AuraEffect::HandleUnused, //299 unused (4.3.4)
372 &AuraEffect::HandleNoImmediateEffect, //300 SPELL_AURA_SHARE_DAMAGE_PCT implemented in Unit::DealDamage
373 &AuraEffect::HandleNoImmediateEffect, //301 SPELL_AURA_SCHOOL_HEAL_ABSORB implemented in Unit::CalcHealAbsorb
374 &AuraEffect::HandleUnused, //302 unused (4.3.4)
375 &AuraEffect::HandleNoImmediateEffect, //303 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
376 &AuraEffect::HandleAuraModFakeInebriation, //304 SPELL_AURA_MOD_FAKE_INEBRIATE
377 &AuraEffect::HandleAuraModIncreaseSpeed, //305 SPELL_AURA_MOD_MINIMUM_SPEED
378 &AuraEffect::HandleNoImmediateEffect, //306 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER implemented in Unit::GetUnitCriticalChance and Unit::GetUnitSpellCriticalChance
379 &AuraEffect::HandleNoImmediateEffect, //307 SPELL_AURA_CAST_WHILE_WALKING_BY_SPELL_LABEL implemented in Unit::CanCastSpellWhileMoving
380 &AuraEffect::HandleNoImmediateEffect, //308 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER_WITH_ABILITIES implemented in Unit::GetUnitSpellCriticalChance
381 &AuraEffect::HandleNULL, //309 SPELL_AURA_MOD_RESILIENCE
382 &AuraEffect::HandleNoImmediateEffect, //310 SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE implemented in Spell::CalculateDamageDone
383 &AuraEffect::HandleNULL, //311 SPELL_AURA_IGNORE_COMBAT
384 &AuraEffect::HandleNULL, //312 SPELL_AURA_ANIM_REPLACEMENT_SET implemented clientside
385 &AuraEffect::HandleNULL, //313 SPELL_AURA_MOUNT_ANIM_REPLACEMENT_SET implemented clientside
386 &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
387 &AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
388 &AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_SCHOOL_ABSORB_OVERKILL implemented in Unit::DealDamage()
389 &AuraEffect::HandleNULL, //317 SPELL_AURA_MOD_SPELL_POWER_PCT
390 &AuraEffect::HandleMastery, //318 SPELL_AURA_MASTERY
391 &AuraEffect::HandleModMeleeHasteNoRegen, //319 SPELL_AURA_MOD_MELEE_HASTE_NO_REGEN
392 &AuraEffect::HandleNULL, //320 SPELL_AURA_320
393 &AuraEffect::HandleAuraModNoActions, //321 SPELL_AURA_MOD_NO_ACTIONS
394 &AuraEffect::HandleNoImmediateEffect, //322 SPELL_AURA_INTERFERE_ENEMY_TARGETING implemented in Spell::CheckCast
395 &AuraEffect::HandleUnused, //323 unused (4.3.4)
396 &AuraEffect::HandleNULL, //324 SPELL_AURA_OVERRIDE_UNLOCKED_AZERITE_ESSENCE_RANK
397 &AuraEffect::HandleUnused, //325 SPELL_AURA_LEARN_PVP_TALENT
398 &AuraEffect::HandlePhaseGroup, //326 SPELL_AURA_PHASE_GROUP
399 &AuraEffect::HandlePhaseAlwaysVisible, //327 SPELL_AURA_PHASE_ALWAYS_VISIBLE
400 &AuraEffect::HandleTriggerSpellOnPowerPercent, //328 SPELL_AURA_TRIGGER_SPELL_ON_POWER_PCT
401 &AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_POWER_GAIN_PCT
402 &AuraEffect::HandleNoImmediateEffect, //330 SPELL_AURA_CAST_WHILE_WALKING implemented in Unit::CanCastSpellWhileMoving
403 &AuraEffect::HandleAuraForceWeather, //331 SPELL_AURA_FORCE_WEATHER
404 &AuraEffect::HandleNoImmediateEffect, //332 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS implemented in Unit::GetCastSpellInfo
405 &AuraEffect::HandleNoImmediateEffect, //333 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_TRIGGERED implemented in Unit::GetCastSpellInfo
406 &AuraEffect::HandleNoImmediateEffect, //334 SPELL_AURA_MOD_AUTOATTACK_CRIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
407 &AuraEffect::HandleNoImmediateEffect, //335 SPELL_AURA_DETECT_VISIBLE_WHILE_INVISIBLE implemented in WorldObject::CanDetectInvisibilityOf
408 &AuraEffect::HandleMountRestrictions, //336 SPELL_AURA_MOUNT_RESTRICTIONS implemented in Unit::GetMountCapability
409 &AuraEffect::HandleNoImmediateEffect, //337 SPELL_AURA_MOD_VENDOR_ITEMS_PRICES
410 &AuraEffect::HandleNoImmediateEffect, //338 SPELL_AURA_MOD_DURABILITY_LOSS
411 &AuraEffect::HandleNoImmediateEffect, //339 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER_PET implemented in Unit::GetUnitCriticalChance and Unit::GetUnitSpellCriticalChance
412 &AuraEffect::HandleNULL, //340 SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER
413 &AuraEffect::HandleModSpellCategoryCooldown, //341 SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN
414 &AuraEffect::HandleModMeleeRangedHasteNoRegen, //342 SPELL_AURA_MOD_MELEE_RANGED_HASTE_NO_REGEN
415 &AuraEffect::HandleNoImmediateEffect, //343 SPELL_AURA_MOD_MELEE_DAMAGE_FROM_CASTER - Implemented in Unit::MeleeDamageBonusTaken
416 &AuraEffect::HandleNoImmediateEffect, //344 SPELL_AURA_MOD_AUTOATTACK_DAMAGE - Implemented in Unit::MeleeDamageBonusDone
417 &AuraEffect::HandleNoImmediateEffect, //345 SPELL_AURA_BYPASS_ARMOR_FOR_CASTER
418 &AuraEffect::HandleEnableAltPower, //346 SPELL_AURA_ENABLE_ALT_POWER
419 &AuraEffect::HandleNoImmediateEffect, //347 SPELL_AURA_MOD_SPELL_COOLDOWN_BY_HASTE implemented in SpellHistory::StartCooldown
420 &AuraEffect::HandleNoImmediateEffect, //348 SPELL_AURA_MOD_MONEY_GAIN implemented in WorldSession::HandleLootMoneyOpcode
421 &AuraEffect::HandleNoImmediateEffect, //349 SPELL_AURA_MOD_CURRENCY_GAIN implemented in Player::ModifyCurrency
422 &AuraEffect::HandleNULL, //350 SPELL_AURA_350
423 &AuraEffect::HandleNULL, //351 SPELL_AURA_MOD_CURRENCY_CATEGORY_GAIN_PCT
424 &AuraEffect::HandleNULL, //352 SPELL_AURA_352
425 &AuraEffect::HandleNULL, //353 SPELL_AURA_MOD_CAMOUFLAGE
426 &AuraEffect::HandleNoImmediateEffect, //354 SPELL_AURA_MOD_HEALING_DONE_PCT_VERSUS_TARGET_HEALTH implemented in Unit::SpellHealingPctDone
427 &AuraEffect::HandleModCastingSlowNoStack, //355 SPELL_AURA_MOD_CASTING_SLOW_NO_STACK
428 &AuraEffect::HandleNoImmediateEffect, //356 SPELL_AURA_PROVIDE_TOTEM_CATEGORY implemented in Player::HasItemTotemCategory
429 &AuraEffect::HandleNULL, //357 SPELL_AURA_ENABLE_BOSS1_UNIT_FRAME
430 &AuraEffect::HandleNULL, //358 SPELL_AURA_358
431 &AuraEffect::HandleNoImmediateEffect, //359 SPELL_AURA_MOD_HEALING_DONE_VERSUS_AURASTATE implemented in Unit::SpellHealingPctDone
432 &AuraEffect::HandleNULL, //360 SPELL_AURA_PROC_TRIGGER_SPELL_COPY
433 &AuraEffect::HandleNoImmediateEffect, //361 SPELL_AURA_OVERRIDE_AUTOATTACK_WITH_MELEE_SPELL implemented in Unit::AttackerStateUpdate
434 &AuraEffect::HandleUnused, //362 unused (4.3.4)
435 &AuraEffect::HandleNULL, //363 SPELL_AURA_MOD_NEXT_SPELL
436 &AuraEffect::HandleUnused, //364 unused (4.3.4)
437 &AuraEffect::HandleNULL, //365 SPELL_AURA_MAX_FAR_CLIP_PLANE
438 &AuraEffect::HandleOverrideSpellPowerByAttackPower, //366 SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT
439 &AuraEffect::HandleNULL, //367 SPELL_AURA_OVERRIDE_AUTOATTACK_WITH_RANGED_SPELL
440 &AuraEffect::HandleUnused, //368 unused (4.3.4)
441 &AuraEffect::HandleNULL, //369 SPELL_AURA_ENABLE_POWER_BAR_TIMER
442 &AuraEffect::HandleNULL, //370 SPELL_AURA_SPELL_OVERRIDE_NAME_GROUP
443 &AuraEffect::HandleNoImmediateEffect, //371 SPELL_AURA_DISABLE_AUTOATTACK implemented in Unit::_UpdateAutoRepeatSpell and Unit::AttackerStateUpdate
444 &AuraEffect::HandleNULL, //372 SPELL_AURA_OVERRIDE_MOUNT_FROM_SET
445 &AuraEffect::HandleNULL, //373 SPELL_AURA_MOD_SPEED_NO_CONTROL
446 &AuraEffect::HandleNoImmediateEffect, //374 SPELL_AURA_MODIFY_FALL_DAMAGE_PCT implemented in Player::HandleFall
447 &AuraEffect::HandleNULL, //375 SPELL_AURA_HIDE_MODEL_AND_EQUIPEMENT_SLOTS implemented clientside
448 &AuraEffect::HandleNULL, //376 SPELL_AURA_MOD_CURRENCY_GAIN_FROM_SOURCE
449 &AuraEffect::HandleNoImmediateEffect, //377 SPELL_AURA_CAST_WHILE_WALKING_ALL implemented in Unit::CanCastSpellWhileMoving
450 &AuraEffect::HandleModPossessPet, //378 SPELL_AURA_MOD_POSSESS_PET
451 &AuraEffect::HandleModManaRegenPct, //379 SPELL_AURA_MOD_MANA_REGEN_PCT implemented in Player::UpdateManaRegen
453 &AuraEffect::HandleNULL, //381 SPELL_AURA_MOD_DAMAGE_TAKEN_FROM_CASTER_PET
454 &AuraEffect::HandleNULL, //382 SPELL_AURA_MOD_PET_STAT_PCT
455 &AuraEffect::HandleNoImmediateEffect, //383 SPELL_AURA_IGNORE_SPELL_COOLDOWN implemented in SpellHistory::HasCooldown
460 &AuraEffect::HandleNULL, //388 SPELL_AURA_MOD_TAXI_FLIGHT_SPEED
465 &AuraEffect::HandleNULL, //393 SPELL_AURA_BLOCK_SPELLS_IN_FRONT
466 &AuraEffect::HandleShowConfirmationPrompt, //394 SPELL_AURA_SHOW_CONFIRMATION_PROMPT
467 &AuraEffect::HandleCreateAreaTrigger, //395 SPELL_AURA_AREA_TRIGGER
468 &AuraEffect::HandleTriggerSpellOnPowerAmount, //396 SPELL_AURA_TRIGGER_SPELL_ON_POWER_AMOUNT
469 &AuraEffect::HandleBattlegroundPlayerPosition, //397 SPELL_AURA_BATTLEGROUND_PLAYER_POSITION_FACTIONAL
470 &AuraEffect::HandleBattlegroundPlayerPosition, //398 SPELL_AURA_BATTLEGROUND_PLAYER_POSITION
471 &AuraEffect::HandleNULL, //399 SPELL_AURA_MOD_TIME_RATE
472 &AuraEffect::HandleAuraModSkill, //400 SPELL_AURA_MOD_SKILL_2
473 &AuraEffect::HandleAuraActAsControlZone, //401 SPELL_AURA_ACT_AS_CONTROL_ZONE
474 &AuraEffect::HandleAuraModOverridePowerDisplay, //402 SPELL_AURA_MOD_OVERRIDE_POWER_DISPLAY
475 &AuraEffect::HandleNoImmediateEffect, //403 SPELL_AURA_OVERRIDE_SPELL_VISUAL implemented in Unit::GetCastSpellXSpellVisualId
476 &AuraEffect::HandleOverrideAttackPowerBySpellPower, //404 SPELL_AURA_OVERRIDE_ATTACK_POWER_BY_SP_PCT
477 &AuraEffect::HandleModRatingPct, //405 SPELL_AURA_MOD_RATING_PCT
478 &AuraEffect::HandleNoImmediateEffect, //406 SPELL_AURA_KEYBOUND_OVERRIDE implemented in WorldSession::HandleKeyboundOverride
479 &AuraEffect::HandleNULL, //407 SPELL_AURA_MOD_FEAR_2
480 &AuraEffect::HandleUnused, //408 SPELL_AURA_SET_ACTION_BUTTON_SPELL_COUNT clientside
481 &AuraEffect::HandleAuraCanTurnWhileFalling, //409 SPELL_AURA_CAN_TURN_WHILE_FALLING
483 &AuraEffect::HandleNoImmediateEffect, //411 SPELL_AURA_MOD_MAX_CHARGES implemented in SpellHistory::GetMaxCharges
485 &AuraEffect::HandleNULL, //413 SPELL_AURA_MOD_RANGED_ATTACK_DEFLECT_CHANCE
486 &AuraEffect::HandleNULL, //414 SPELL_AURA_MOD_RANGED_ATTACK_BLOCK_CHANCE_IN_FRONT
488 &AuraEffect::HandleNoImmediateEffect, //416 SPELL_AURA_MOD_COOLDOWN_BY_HASTE_REGEN implemented in SpellHistory::StartCooldown
489 &AuraEffect::HandleNoImmediateEffect, //417 SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN implemented in Spell::TriggerGlobalCooldown
490 &AuraEffect::HandleAuraModMaxPower, //418 SPELL_AURA_MOD_MAX_POWER
491 &AuraEffect::HandleAuraModIncreaseBaseManaPercent, //419 SPELL_AURA_MOD_BASE_MANA_PCT
492 &AuraEffect::HandleNoImmediateEffect, //420 SPELL_AURA_MOD_BATTLE_PET_XP_PCT - Implemented in BattlePetMgr::GrantBattlePetExperience
493 &AuraEffect::HandleNoImmediateEffect, //421 SPELL_AURA_MOD_ABSORB_DONE_PCT implemented in Unit::SpellAbsorbPctDone
494 &AuraEffect::HandleNoImmediateEffect, //422 SPELL_AURA_MOD_ABSORB_TAKEN_PCT implemented in Unit::SpellAbsorbBonusTaken
495 &AuraEffect::HandleModManaCostPct, //423 SPELL_AURA_MOD_MANA_COST_PCT
496 &AuraEffect::HandleNULL, //424 SPELL_AURA_CASTER_IGNORE_LOS
499 &AuraEffect::HandleNULL, //427 SPELL_AURA_SCALE_PLAYER_LEVEL
500 &AuraEffect::HandleLinkedSummon, //428 SPELL_AURA_LINKED_SUMMON
501 &AuraEffect::HandleNULL, //429 SPELL_AURA_MOD_SUMMON_DAMAGE
502 &AuraEffect::HandlePlayScene, //430 SPELL_AURA_PLAY_SCENE
503 &AuraEffect::HandleModOverrideZonePVPType, //431 SPELL_AURA_MOD_OVERRIDE_ZONE_PVP_TYPE
508 &AuraEffect::HandleNoImmediateEffect, //436 SPELL_AURA_MOD_ENVIRONMENTAL_DAMAGE_TAKEN implemented in Player::EnvironmentalDamage
509 &AuraEffect::HandleAuraModMinimumSpeedRate, //437 SPELL_AURA_MOD_MINIMUM_SPEED_RATE
510 &AuraEffect::HandleNULL, //438 SPELL_AURA_PRELOAD_PHASE
512 &AuraEffect::HandleNULL, //440 SPELL_AURA_MOD_MULTISTRIKE_DAMAGE
513 &AuraEffect::HandleNULL, //441 SPELL_AURA_MOD_MULTISTRIKE_CHANCE
514 &AuraEffect::HandleNULL, //442 SPELL_AURA_MOD_READINESS
515 &AuraEffect::HandleNULL, //443 SPELL_AURA_MOD_LEECH
518 &AuraEffect::HandleModAdvFlying, //446 SPELL_AURA_ADV_FLYING
519 &AuraEffect::HandleNoImmediateEffect, //447 SPELL_AURA_MOD_XP_FROM_CREATURE_TYPE implemented in KillRewarder::_RewardXP
523 &AuraEffect::HandleOverridePetSpecs, //451 SPELL_AURA_OVERRIDE_PET_SPECS
525 &AuraEffect::HandleNoImmediateEffect, //453 SPELL_AURA_CHARGE_RECOVERY_MOD implemented in SpellHistory::GetChargeRecoveryTime
526 &AuraEffect::HandleNoImmediateEffect, //454 SPELL_AURA_CHARGE_RECOVERY_MULTIPLIER implemented in SpellHistory::GetChargeRecoveryTime
527 &AuraEffect::HandleAuraModRoot, //455 SPELL_AURA_MOD_ROOT_2
528 &AuraEffect::HandleNoImmediateEffect, //456 SPELL_AURA_CHARGE_RECOVERY_AFFECTED_BY_HASTE implemented in SpellHistory::GetChargeRecoveryTime
529 &AuraEffect::HandleNoImmediateEffect, //457 SPELL_AURA_CHARGE_RECOVERY_AFFECTED_BY_HASTE_REGEN implemented in SpellHistory::GetChargeRecoveryTime
530 &AuraEffect::HandleNoImmediateEffect, //458 SPELL_AURA_IGNORE_DUAL_WIELD_HIT_PENALTY implemented in Unit::MeleeSpellMissChance
531 &AuraEffect::HandleIgnoreMovementForces, //459 SPELL_AURA_IGNORE_MOVEMENT_FORCES
532 &AuraEffect::HandleNULL, //460 SPELL_AURA_RESET_COOLDOWNS_ON_DUEL_START
534 &AuraEffect::HandleNULL, //462 SPELL_AURA_MOD_HEALING_AND_ABSORB_FROM_CASTER
535 &AuraEffect::HandleConvertCritToParry, //463 SPELL_AURA_CONVERT_CRIT_RATING_PCT_TO_PARRY_RATING used by Riposte
536 &AuraEffect::HandleNULL, //464 SPELL_AURA_MOD_ATTACK_POWER_OF_BONUS_ARMOR
537 &AuraEffect::HandleModBonusArmor, //465 SPELL_AURA_MOD_BONUS_ARMOR
538 &AuraEffect::HandleModBonusArmorPercent, //466 SPELL_AURA_MOD_BONUS_ARMOR_PCT
539 &AuraEffect::HandleModStatBonusPercent, //467 SPELL_AURA_MOD_STAT_BONUS_PCT
540 &AuraEffect::HandleTriggerSpellOnHealthPercent, //468 SPELL_AURA_TRIGGER_SPELL_ON_HEALTH_PCT
541 &AuraEffect::HandleShowConfirmationPrompt, //469 SPELL_AURA_SHOW_CONFIRMATION_PROMPT_WITH_DIFFICULTY
542 &AuraEffect::HandleNULL, //470 SPELL_AURA_MOD_AURA_TIME_RATE_BY_SPELL_LABEL
543 &AuraEffect::HandleModVersatilityByPct, //471 SPELL_AURA_MOD_VERSATILITY
545 &AuraEffect::HandleNoImmediateEffect, //473 SPELL_AURA_PREVENT_DURABILITY_LOSS_FROM_COMBAT implemented in Player::DurabilityPointLossForEquipSlot
546 &AuraEffect::HandleNULL, //474 SPELL_AURA_REPLACE_ITEM_BONUS_TREE
547 &AuraEffect::HandleAllowUsingGameobjectsWhileMounted, //475 SPELL_AURA_ALLOW_USING_GAMEOBJECTS_WHILE_MOUNTED
548 &AuraEffect::HandleNULL, //476 SPELL_AURA_MOD_CURRENCY_GAIN_LOOTED
552 &AuraEffect::HandleNULL, //480 SPELL_AURA_MOD_ARTIFACT_ITEM_LEVEL
553 &AuraEffect::HandleNoImmediateEffect, //481 SPELL_AURA_CONVERT_CONSUMED_RUNE implemented in Spell::TakeRunePower
555 &AuraEffect::HandleNULL, //483 SPELL_AURA_SUPPRESS_TRANSFORMS
556 &AuraEffect::HandleNoImmediateEffect, //484 SPELL_AURA_ALLOW_INTERRUPT_SPELL implemented in SpellInfo::CanBeInterrupted
557 &AuraEffect::HandleModMovementForceMagnitude, //485 SPELL_AURA_MOD_MOVEMENT_FORCE_MAGNITUDE
558 &AuraEffect::HandleNoImmediateEffect, //486 SPELL_AURA_INTERFERE_ALL_TARGETING implemented in Spell::CheckCast
559 &AuraEffect::HandleCosmeticMounted, //487 SPELL_AURA_COSMETIC_MOUNTED
560 &AuraEffect::HandleAuraDisableGravity, //488 SPELL_AURA_DISABLE_GRAVITY
561 &AuraEffect::HandleModAlternativeDefaultLanguage, //489 SPELL_AURA_MOD_ALTERNATIVE_DEFAULT_LANGUAGE
563 &AuraEffect::HandleNoImmediateEffect, //491 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor
566 &AuraEffect::HandleNULL, //494 SPELL_AURA_SET_POWER_POINT_CHARGE
567 &AuraEffect::HandleTriggerSpellOnExpire, //495 SPELL_AURA_TRIGGER_SPELL_ON_EXPIRE
568 &AuraEffect::HandleNULL, //496 SPELL_AURA_ALLOW_CHANGING_EQUIPMENT_IN_TORGHAST
569 &AuraEffect::HandleNULL, //497 SPELL_AURA_MOD_ANIMA_GAIN
570 &AuraEffect::HandleNULL, //498 SPELL_AURA_CURRENCY_LOSS_PCT_ON_DEATH
571 &AuraEffect::HandleNULL, //499 SPELL_AURA_MOD_RESTED_XP_CONSUMPTION
572 &AuraEffect::HandleNoImmediateEffect, //500 SPELL_AURA_IGNORE_SPELL_CHARGE_COOLDOWN implemented in SpellHistory::ConsumeCharge
573 &AuraEffect::HandleNULL, //501 SPELL_AURA_MOD_CRITICAL_DAMAGE_TAKEN_FROM_CASTER
574 &AuraEffect::HandleNULL, //502 SPELL_AURA_MOD_VERSATILITY_DAMAGE_DONE_BENEFIT
575 &AuraEffect::HandleNULL, //503 SPELL_AURA_MOD_VERSATILITY_HEALING_DONE_BENEFIT
576 &AuraEffect::HandleNoImmediateEffect, //504 SPELL_AURA_MOD_HEALING_TAKEN_FROM_CASTER implemented in Unit::SpellHealingBonusTaken
577 &AuraEffect::HandleNULL, //505 SPELL_AURA_MOD_PLAYER_CHOICE_REROLLS
578 &AuraEffect::HandleDisableInertia, //506 SPELL_AURA_DISABLE_INERTIA
579 &AuraEffect::HandleNoImmediateEffect, //507 SPELL_AURA_MOD_DAMAGE_TAKEN_BY_LABEL implemented in Unit::SpellDamageBonusTaken
582 &AuraEffect::HandleNULL, //510 SPELL_AURA_MODIFIED_RAID_INSTANCE
583 &AuraEffect::HandleNULL, //511 SPELL_AURA_APPLY_PROFESSION_EFFECT
585 &AuraEffect::HandleAuraModAdvFlyingSpeed, //513 SPELL_AURA_MOD_ADV_FLYING_AIR_FRICTION
586 &AuraEffect::HandleAuraModAdvFlyingSpeed, //514 SPELL_AURA_MOD_ADV_FLYING_MAX_VEL
587 &AuraEffect::HandleAuraModAdvFlyingSpeed, //515 SPELL_AURA_MOD_ADV_FLYING_LIFT_COEF
590 &AuraEffect::HandleAuraModAdvFlyingSpeed, //518 SPELL_AURA_MOD_ADV_FLYING_ADD_IMPULSE_MAX_SPEED
591 &AuraEffect::HandleNULL, //519 SPELL_AURA_MOD_COOLDOWN_RECOVERY_RATE_ALL
592 &AuraEffect::HandleAuraModAdvFlyingSpeed, //520 SPELL_AURA_MOD_ADV_FLYING_BANKING_RATE
593 &AuraEffect::HandleAuraModAdvFlyingSpeed, //521 SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_DOWN
594 &AuraEffect::HandleAuraModAdvFlyingSpeed, //522 SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_UP
596 &AuraEffect::HandleAuraModAdvFlyingSpeed, //524 SPELL_AURA_MOD_ADV_FLYING_OVER_MAX_DECELERATION
597 &AuraEffect::HandleNULL, //525 SPELL_AURA_DISPLAY_PROFESSION_EQUIPMENT
600 &AuraEffect::HandleNULL, //528 SPELL_AURA_ALLOW_BLOCKING_SPELLS
601 &AuraEffect::HandleNULL, //529 SPELL_AURA_MOD_SPELL_BLOCK_CHANCE
605 &AuraEffect::HandleNULL, //533 SPELL_AURA_DISABLE_NAVIGATION
608 &AuraEffect::HandleNoImmediateEffect, //536 SPELL_AURA_IGNORE_SPELL_CREATURE_TYPE_REQUIREMENTS implemented in SpellInfo::CheckTargetCreatureType
609 &AuraEffect::HandleNoImmediateEffect, //537 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER_BY_LABEL implemented in Unit::SpellDamageBonusTaken
610 &AuraEffect::HandleUnused, //538 SPELL_AURA_MOD_FAKE_INEBRIATION_MOVEMENT_ONLY handled clientside
611 &AuraEffect::HandleNoImmediateEffect, //539 SPELL_AURA_ALLOW_MOUNT_IN_COMBAT implemented in SpellInfo::CanBeUsedInCombat
612 &AuraEffect::HandleNULL, //540 SPELL_AURA_MOD_SUPPORT_STAT
613 &AuraEffect::HandleModRequiredMountCapabilityFlags, //541 SPELL_AURA_MOD_REQUIRED_MOUNT_CAPABILITY_FLAGS
614 &AuraEffect::HandleNULL, //542 SPELL_AURA_TRIGGER_SPELL_ON_STACK_AMOUNT
617 &AuraEffect::HandleSetCantSwim, //545 SPELL_AURA_MOVE_SET_CANT_SWIM
653 &AuraEffect::HandleModRangedSlowNoStack, //581 SPELL_AURA_MOD_RANGED_SLOW_NO_STACK
687 &AuraEffect::HandleModRangedHasteNoRegen, //615 SPELL_AURA_MOD_RANGED_HASTE_NO_REGEN
709 &AuraEffect::HandleNoImmediateEffect, //637 SPELL_AURA_MOD_EXPLORATION_EXPERIENCE implemented in Player::CheckAreaExplore
710 &AuraEffect::HandleNoImmediateEffect, //638 SPELL_AURA_MOD_CRITICAL_BLOCK_AMOUNT implemented in Unit::CalculateMeleeDamage andUnit::CalculateSpellDamageTaken
715 &AuraEffect::HandleNULL, //643 SPELL_AURA_MOD_RANGED_ATTACK_SPEED_FLAT
716 &AuraEffect::HandleModGravity, //644 SPELL_AURA_MOD_GRAVITY
718 &AuraEffect::HandleNULL, //646 SPELL_AURA_ADD_FLAT_PVP_MODIFIER
719 &AuraEffect::HandleNULL, //647 SPELL_AURA_ADD_PCT_PVP_MODIFIER
720 &AuraEffect::HandleNULL, //648 SPELL_AURA_ADD_FLAT_PVP_MODIFIER_BY_SPELL_LABEL
721 &AuraEffect::HandleNULL, //649 SPELL_AURA_ADD_PCT_PVP_MODIFIER_BY_SPELL_LABEL
723 &AuraEffect::HandleNULL, //651 SPELL_AURA_ENABLE_EVENT_TRANSMOG_OUTFIT
727 &AuraEffect::HandleNULL, //655 SPELL_AURA_MOD_TRANSMOG_OUTFIT_UPDATE_COST
733 &AuraEffect::HandleNULL, //661 SPELL_AURA_ALTERED_FORM_IN_COMBAT
737};
738
739AuraEffect::AuraEffect(Aura* base, SpellEffectInfo const& spellEfffectInfo, SpellEffectValue const* baseAmount, Unit* caster) :
740m_base(base), m_spellInfo(base->GetSpellInfo()), m_effectInfo(spellEfffectInfo), m_spellmod(nullptr),
741m_baseAmount(baseAmount ? *baseAmount : spellEfffectInfo.CalcBaseValue(caster, base->GetType() == UNIT_AURA_TYPE ? base->GetOwner()->ToUnit() : nullptr, base->GetCastItemId(), base->GetCastItemLevel())),
742_amount(), _periodicTimer(0), _period(0), _ticksDone(0),
743m_canBeRecalculated(true), m_isPeriodic(false)
744{
745 CalculatePeriodic(caster, true, false);
746
747 _amount = CalculateAmount(caster);
748
750}
751
753{
754 delete m_spellmod;
755}
756
757template <typename Container>
758void AuraEffect::GetTargetList(Container& targetContainer) const
759{
760 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
761 // remove all targets which were not added to new list - they no longer deserve area aura
762 for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
763 {
764 if (appIter->second->HasEffect(GetEffIndex()))
765 targetContainer.push_back(appIter->second->GetTarget());
766 }
767}
768
769template <typename Container>
770void AuraEffect::GetApplicationList(Container& applicationContainer) const
771{
772 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
773 for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
774 {
775 if (appIter->second->HasEffect(GetEffIndex()))
776 applicationContainer.push_back(appIter->second);
777 }
778}
779
781{
782 Unit* unitOwner = GetBase()->GetOwner()->ToUnit();
783
784 // default amount calculation
785 SpellEffectValue amount = GetSpellEffectInfo().CalcValue(caster, &m_baseAmount, unitOwner, nullptr, GetBase()->GetCastItemId(), GetBase()->GetCastItemLevel());
786
787 // custom amount calculations go here
788 switch (GetAuraType())
789 {
790 // crowd control auras
797 m_canBeRecalculated = false;
799 break;
800 amount = int32(unitOwner->CountPctFromMaxHealth(10));
801 break;
803 m_canBeRecalculated = false;
804 if (!caster || !unitOwner)
805 break;
806
807 amount = caster->SpellAbsorbBonusDone(unitOwner, m_spellInfo, amount, m_effectInfo, 1, this);
808 amount = unitOwner->SpellAbsorbBonusTaken(caster, m_spellInfo, amount);
809 break;
811 m_canBeRecalculated = false;
812 break;
814 {
815 uint32 mountType = uint32(GetMiscValueB());
816 if (MountEntry const* mountEntry = sDB2Manager.GetMount(GetId()))
817 mountType = mountEntry->MountTypeID;
818
819 if (MountCapabilityEntry const* mountCapability = unitOwner->GetMountCapability(mountType))
820 amount = mountCapability->ID;
821 break;
822 }
824 if (caster)
825 amount = caster->GetMap()->GetDifficultyID();
826 m_canBeRecalculated = false;
827 break;
828 default:
829 break;
830 }
831
832 if (GetSpellInfo()->HasAttribute(SPELL_ATTR10_ROLLING_PERIODIC))
833 {
834 Unit::AuraEffectList const& periodicAuras = unitOwner->GetAuraEffectsByType(GetAuraType());
835 if (uint32 totalTicks = GetTotalTicks())
836 {
837 amount = std::accumulate(std::begin(periodicAuras), std::end(periodicAuras), amount, [&](SpellEffectValue val, AuraEffect const* aurEff)
838 {
839 if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex())
840 val += aurEff->GetEstimatedAmount().value_or(aurEff->GetAmount()) * static_cast<float>(aurEff->GetRemainingTicks()) / static_cast<float>(totalTicks);
841 return val;
842 });
843 }
844 }
845
848 amount *= GetBase()->GetStackAmount();
849
850 switch (GetAuraType())
851 {
865 amount = std::round(amount);
866 break;
867 default:
868 break;
869 }
870
871 amount = std::clamp(amount, SpellEffectInfo::MinValue, SpellEffectInfo::MaxValue);
872
876
877 return amount;
878}
879
880Optional<SpellEffectValue> AuraEffect::CalculateEstimatedAmount(Unit const* caster, Unit* target, SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo,
881 SpellEffectValue amount, uint8 stack, AuraEffect const* aurEff)
882{
883 uint32 stackAmountForBonuses = !spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes::SuppressPointsStacking) ? stack : 1;
884
885 switch (spellEffectInfo.ApplyAuraName)
886 {
889 return caster->SpellDamageBonusDone(target, spellInfo, amount, DOT, spellEffectInfo, stackAmountForBonuses, nullptr, aurEff);
891 return caster->SpellHealingBonusDone(target, spellInfo, amount, DOT, spellEffectInfo, stackAmountForBonuses, nullptr, aurEff);
892 default:
893 break;
894 }
895
896 return {};
897}
898
900{
901 if (!caster || GetBase()->GetType() != UNIT_AURA_TYPE)
902 return {};
903
904 return CalculateEstimatedAmount(caster, GetBase()->GetUnitOwner(), GetSpellInfo(), GetSpellEffectInfo(), amount, GetBase()->GetStackAmount(), this);
905}
906
907SpellEffectValue AuraEffect::CalculateEstimatedfTotalPeriodicAmount(Unit const* caster, Unit* target, SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo,
908 SpellEffectValue amount, uint8 stack)
909{
910 int32 maxDuration = Aura::CalcMaxDuration(spellInfo, caster, nullptr);
911 if (maxDuration <= 0)
912 return 0.0;
913
914 int32 period = spellEffectInfo.ApplyAuraPeriod;
915 if (!period)
916 return 0.0;
917
918 if (Player* modOwner = caster->GetSpellModOwner())
919 modOwner->ApplySpellMod(spellInfo, SpellModOp::Period, period);
920
921 // Haste modifies periodic time of channeled spells
922 if (spellInfo->IsChanneled())
923 caster->ModSpellDurationTime(spellInfo, period);
925 period = int32(period * caster->m_unitData->ModCastingSpeed);
927 period = int32(period * caster->m_unitData->ModHaste);
928
929 if (!period)
930 return 0.0;
931
932 float totalTicks = float(maxDuration) / period;
934 totalTicks += 1.0f;
935
936 return totalTicks * CalculateEstimatedAmount(caster, target, spellInfo, spellEffectInfo, amount, stack, nullptr).value_or(amount);
937}
938
940{
941 uint32 totalTicks = 0;
942 if (_period && !GetBase()->IsPermanent())
943 {
944 totalTicks = static_cast<uint32>(GetBase()->GetMaxDuration() / _period);
946 ++totalTicks;
947 }
948
949 return totalTicks;
950}
951
952void AuraEffect::ResetPeriodic(bool resetPeriodicTimer /*= false*/)
953{
954 _ticksDone = 0;
955 if (resetPeriodicTimer)
956 {
957 _periodicTimer = 0;
958 // Start periodic on next tick or at aura apply
961 }
962}
963
964void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= true*/, bool load /*= false*/)
965{
967
968 // prepare periodics
969 switch (GetAuraType())
970 {
985 m_isPeriodic = true;
986 break;
987 default:
988 break;
989 }
990
992
993 if (!m_isPeriodic)
994 return;
995
996 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
997 // Apply casting time mods
998 if (_period)
999 {
1000 // Apply periodic time mod
1001 if (modOwner)
1003
1004 if (caster)
1005 {
1006 // Haste modifies periodic time of channeled spells
1007 if (m_spellInfo->IsChanneled())
1010 _period = int32(_period * caster->m_unitData->ModCastingSpeed);
1012 _period = int32(_period * caster->m_unitData->ModHaste);
1013 }
1014 }
1015 else // prevent infinite loop on Update
1016 m_isPeriodic = false;
1017
1018 if (load) // aura loaded from db
1019 {
1020 if (_period && !GetBase()->IsPermanent())
1021 {
1022 uint32 elapsedTime = GetBase()->GetMaxDuration() - GetBase()->GetDuration();
1023 _ticksDone = elapsedTime / uint32(_period);
1024 _periodicTimer = elapsedTime % uint32(_period);
1025 }
1026
1028 ++_ticksDone;
1029 }
1030 else // aura just created or reapplied
1031 {
1032 // reset periodic timer on aura create or reapply
1033 // we don't reset periodic timers when aura is triggered by proc
1034 ResetPeriodic(resetPeriodicTimer);
1035 }
1036}
1037
1039{
1040 switch (GetAuraType())
1041 {
1043 if (!m_spellmod)
1045 static_cast<SpellFlatModifierByClassMask*>(m_spellmod)->value = GetAmountAsInt();
1046 break;
1048 if (!m_spellmod)
1050 static_cast<SpellPctModifierByClassMask*>(m_spellmod)->value = GetAmount();
1051 break;
1053 if (!m_spellmod)
1055 static_cast<SpellFlatModifierByLabel*>(m_spellmod)->value.ModifierValue = GetAmountAsInt();
1056 break;
1058 if (!m_spellmod)
1060 static_cast<SpellPctModifierByLabel*>(m_spellmod)->value.ModifierValue = 1.0f + CalculatePct(1.0f, GetAmount());
1061 break;
1062 default:
1063 break;
1064 }
1066
1067 // validate modifier
1068 if (m_spellmod)
1069 {
1070 bool isValid = true;
1071 auto logErrors = [&] { return std::ranges::any_of(GetBase()->m_loadedScripts, [](AuraScript const* script) { return script->DoEffectCalcSpellMod.size() > 0; }); };
1073 {
1074 isValid = false;
1075 if (logErrors())
1076 TC_LOG_ERROR("spells.aura.effect", "Aura script for spell id {} created invalid spell modifier op {}", GetId(), AsUnderlyingType(m_spellmod->op));
1077 }
1078
1080 {
1081 isValid = false;
1082 if (logErrors())
1083 TC_LOG_ERROR("spells.aura.effect", "Aura script for spell id {} created invalid spell modifier type {}", GetId(), AsUnderlyingType(m_spellmod->type));
1084 }
1085
1086 if (!isValid)
1087 {
1088 delete m_spellmod;
1089 m_spellmod = nullptr;
1090 }
1091 }
1092}
1093
1094void AuraEffect::ChangeAmount(SpellEffectValue newAmount, bool mark, bool onStackOrReapply, AuraEffect const* triggeredBy /* = nullptr */)
1095{
1096 // Reapply if amount change
1097 uint8 handleMask = 0;
1098 if (newAmount != GetAmount())
1100 if (onStackOrReapply)
1101 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
1102
1103 if (!handleMask)
1104 return;
1105
1106 std::vector<AuraApplication*> effectApplications;
1107 GetApplicationList(effectApplications);
1108
1109 for (AuraApplication* aurApp : effectApplications)
1110 {
1111 aurApp->GetTarget()->_RegisterAuraEffect(this, false);
1112 HandleEffect(aurApp, handleMask, false, triggeredBy);
1113 }
1114
1115 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
1116 {
1117 if (!mark)
1118 _amount = newAmount;
1119 else
1120 SetAmount(newAmount);
1122 }
1123
1124 for (AuraApplication* aurApp : effectApplications)
1125 {
1126 if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
1127 continue;
1128
1129 aurApp->GetTarget()->_RegisterAuraEffect(this, true);
1130 HandleEffect(aurApp, handleMask, true, triggeredBy);
1131 }
1132
1135}
1136
1137void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply, AuraEffect const* triggeredBy /*= nullptr*/)
1138{
1139 // check if call is correct, we really don't want using bitmasks here (with 1 exception)
1143 || mode == AURA_EFFECT_HANDLE_STAT
1144 || mode == AURA_EFFECT_HANDLE_SKILL
1147
1148 // register/unregister effect in lists in case of real AuraEffect apply/remove
1149 // registration/unregistration is done always before real effect handling (some effect handlers code is depending on this)
1150 if (mode & AURA_EFFECT_HANDLE_REAL)
1151 aurApp->GetTarget()->_RegisterAuraEffect(this, apply);
1152
1153 // real aura apply/remove, handle modifier
1155 ApplySpellMod(aurApp->GetTarget(), apply, triggeredBy);
1156
1157 // call scripts helping/replacing effect handlers
1158 bool prevented = false;
1159 if (apply)
1160 prevented = GetBase()->CallScriptEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);
1161 else
1162 prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
1163
1164 // check if script events have removed the aura already
1165 if (apply && aurApp->GetRemoveMode())
1166 return;
1167
1168 // call default effect handler if it wasn't prevented
1169 if (!prevented)
1170 (*this.*AuraEffectHandler[GetAuraType()].Value)(aurApp, mode, apply);
1171
1172 // check if the default handler reemoved the aura
1173 if (apply && aurApp->GetRemoveMode())
1174 return;
1175
1176 // call scripts triggering additional events after apply/remove
1177 if (apply)
1179 else
1181}
1182
1183void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply, AuraEffect const* triggeredBy /*= nullptr*/)
1184{
1185 AuraApplication* aurApp = GetBase()->GetApplicationOfTarget(target->GetGUID());
1186 ASSERT(aurApp);
1187 HandleEffect(aurApp, mode, apply, triggeredBy);
1188}
1189
1190void AuraEffect::ApplySpellMod(Unit* target, bool apply, AuraEffect const* triggeredBy /*= nullptr*/)
1191{
1192 if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
1193 return;
1194
1195 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
1196
1197 // Auras with charges do not mod amount of passive auras
1198 if (GetBase()->IsUsingCharges())
1199 return;
1200
1201 // reapply some passive spells after add/remove related spellmods
1202 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
1203 Optional<SpellEffIndex> recalculateEffectIndex;
1204 switch (SpellModOp(GetMiscValue()))
1205 {
1206 case SpellModOp::Points:
1207 break;
1209 recalculateEffectIndex = EFFECT_0;
1210 break;
1212 recalculateEffectIndex = EFFECT_1;
1213 break;
1215 recalculateEffectIndex = EFFECT_2;
1216 break;
1218 recalculateEffectIndex = EFFECT_3;
1219 break;
1221 recalculateEffectIndex = EFFECT_4;
1222 break;
1223 default:
1224 return;
1225 }
1226
1227 if (!triggeredBy)
1228 triggeredBy = this;
1229
1230 ObjectGuid guid = target->GetGUID();
1231 for (auto& [_, aurApp] : target->GetAppliedAuras())
1232 {
1233 Aura* aura = aurApp->GetBase();
1234 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
1235 // if aura is cast by others, it will not be affected
1236 if ((!aura->IsPassive() && !aura->IsPermanent() && !GetSpellInfo()->IsUpdatingTemporaryAuraValuesBySpellMod())
1237 || aura->GetCasterGUID() != guid || !aura->GetSpellInfo()->IsAffectedBySpellMods() || !aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
1238 continue;
1239
1240 if (recalculateEffectIndex)
1241 {
1242 if (AuraEffect* aurEff = aura->GetEffect(*recalculateEffectIndex))
1243 if (aurEff != triggeredBy)
1244 aurEff->RecalculateAmount(triggeredBy);
1245 }
1246 else
1247 for (AuraEffect* aurEff : aura->GetAuraEffects())
1248 if (aurEff != triggeredBy)
1249 aurEff->RecalculateAmount(triggeredBy);
1250 }
1251}
1252
1253void AuraEffect::Update(uint32 diff, Unit* caster)
1254{
1255 if (!m_isPeriodic || (GetBase()->GetDuration() < 0 && !GetBase()->IsPassive() && !GetBase()->IsPermanent()))
1256 return;
1257
1258 uint32 totalTicks = GetTotalTicks();
1259
1260 _periodicTimer += diff;
1261 while (_periodicTimer >= _period)
1262 {
1264
1265 if (!GetBase()->IsPermanent() && (_ticksDone + 1) > totalTicks)
1266 break;
1267
1268 ++_ticksDone;
1269
1271
1272 std::vector<AuraApplication*> effectApplications;
1273 GetApplicationList(effectApplications);
1274
1275 // tick on targets of effects
1276 for (AuraApplication* aurApp : effectApplications)
1277 PeriodicTick(aurApp, caster);
1278 }
1279}
1280
1281float AuraEffect::GetCritChanceFor(Unit const* caster, Unit const* target) const
1282{
1283 return target->SpellCritChanceTaken(caster, nullptr, this, GetSpellInfo()->GetSchoolMask(), CalcPeriodicCritChance(caster), GetSpellInfo()->GetAttackType());
1284}
1285
1287{
1288 if (!spell)
1289 return false;
1290
1291 // Check family name and EffectClassMask
1292 if (!spell->IsAffected(m_spellInfo->SpellFamilyName, GetSpellEffectInfo().SpellClassMask))
1293 return false;
1294
1295 return true;
1296}
1297
1298void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const
1299{
1300 if (caster)
1301 caster->SendSpellDamageImmune(target, m_spellInfo->Id, true);
1302}
1303
1305{
1306 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
1307 if (prevented)
1308 return;
1309
1310 Unit* target = aurApp->GetTarget();
1311
1312 // Update serverside orientation of tracking channeled auras on periodic update ticks
1313 // exclude players because can turn during channeling and shouldn't desync orientation client/server
1314 if (caster && !caster->IsPlayer() && m_spellInfo->IsChanneled() && m_spellInfo->HasAttribute(SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL) && caster->m_unitData->ChannelObjects.size())
1315 {
1316 ObjectGuid const channelGuid = caster->m_unitData->ChannelObjects[0];
1317 if (channelGuid != caster->GetGUID())
1318 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
1319 caster->SetInFront(objectTarget);
1320 }
1321
1322 switch (GetAuraType())
1323 {
1325 // handled via scripts
1326 break;
1328 HandlePeriodicTriggerSpellAuraTick(target, caster);
1329 break;
1331 // Don't actually do anything - client will trigger casts of these spells by itself
1332 break;
1335 break;
1339 HandlePeriodicDamageAurasTick(target, caster);
1340 break;
1342 HandlePeriodicHealthLeechAuraTick(target, caster);
1343 break;
1345 HandlePeriodicHealthFunnelAuraTick(target, caster);
1346 break;
1349 HandlePeriodicHealAurasTick(target, caster);
1350 break;
1352 HandlePeriodicManaLeechAuraTick(target, caster);
1353 break;
1355 HandleObsModPowerAuraTick(target, caster);
1356 break;
1358 HandlePeriodicEnergizeAuraTick(target, caster);
1359 break;
1361 HandlePeriodicPowerBurnAuraTick(target, caster);
1362 break;
1363 default:
1364 break;
1365 }
1366}
1367
1369{
1370 bool result = GetBase()->CallScriptCheckEffectProcHandlers(this, aurApp, eventInfo);
1371 if (!result)
1372 return false;
1373
1374 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1375 switch (GetAuraType())
1376 {
1382 {
1383 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
1384 if (!damageInfo || !damageInfo->GetDamage())
1385 return false;
1386
1387 // Spell own damage at apply won't break CC
1388 if (spellInfo && spellInfo == GetSpellInfo())
1389 {
1390 Aura* aura = GetBase();
1391 // called from spellcast, should not have ticked yet
1392 if (aura->GetDuration() == aura->GetMaxDuration())
1393 return false;
1394 }
1395 break;
1396 }
1399 // compare mechanic
1400 if (!spellInfo || !(spellInfo->GetAllEffectsMechanicMask() & (UI64LIT(1) << GetMiscValue())))
1401 return false;
1402 break;
1404 // skip melee hits and instant cast spells
1405 if (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->GetCastTime())
1406 return false;
1407 break;
1410 // Compare casters
1411 if (GetCasterGUID() != eventInfo.GetActor()->GetGUID())
1412 return false;
1413 break;
1416 {
1417 // Skip melee hits and spells with wrong school or zero cost
1418 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()) // School Check
1419 || !eventInfo.GetProcSpell())
1420 return false;
1421
1422 // Costs Check
1423 std::vector<SpellPowerCost> const& costs = eventInfo.GetProcSpell()->GetPowerCost();
1424 if (std::ranges::none_of(costs, [](SpellPowerCost const& cost) { return cost.Amount > 0; }))
1425 return false;
1426 break;
1427 }
1429 // Skip melee hits and spells with wrong school
1430 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()))
1431 return false;
1432 break;
1435 {
1436 // Don't proc extra attacks while already processing extra attack spell
1437 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
1438 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
1439 {
1440 if (triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
1441 {
1442 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
1443
1444 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
1445 if (lastExtraAttackSpell == triggerSpellId)
1446 return false;
1447 }
1448 }
1449 break;
1450 }
1452 // skip spells that can't crit
1453 if (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
1454 return false;
1455 break;
1456 default:
1457 break;
1458 }
1459
1460 return result;
1461}
1462
1464{
1465 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1466 if (prevented)
1467 return;
1468
1469 switch (GetAuraType())
1470 {
1471 // CC Auras which use their amount to drop
1472 // Are there any more auras which need this?
1479 HandleBreakableCCAuraProc(aurApp, eventInfo);
1480 break;
1481 case SPELL_AURA_DUMMY:
1483 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1484 break;
1486 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1487 break;
1489 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1490 break;
1491 default:
1492 break;
1493 }
1494
1495 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1496}
1497
1498void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
1499{
1500 uint32 spellId = 0;
1501 uint32 spellId2 = 0;
1502 uint32 spellId3 = 0;
1503 uint32 spellId4 = 0;
1504
1505 switch (GetMiscValue())
1506 {
1507 case FORM_CAT_FORM:
1508 spellId = 3025;
1509 spellId2 = 48629;
1510 spellId3 = 106840;
1511 spellId4 = 113636;
1512 break;
1513 case FORM_TREE_OF_LIFE:
1514 spellId = 5420;
1515 spellId2 = 81097;
1516 break;
1517 case FORM_TRAVEL_FORM:
1518 spellId = 5419;
1519 break;
1520 case FORM_AQUATIC_FORM:
1521 spellId = 5421;
1522 break;
1523 case FORM_BEAR_FORM:
1525 spellId = 1178;
1526 spellId2 = 21178;
1527 spellId3 = 106829;
1528 spellId4 = 106899;
1529 break;
1530 case FORM_FLIGHT_FORM:
1531 spellId = 33948;
1532 spellId2 = 34764;
1533 break;
1535 spellId = 40122;
1536 spellId2 = 40121;
1537 break;
1539 spellId = 27792;
1540 spellId2 = 27795;
1541 spellId3 = 62371;
1542 break;
1543 case FORM_SHADOWFORM:
1544 if (target->HasAura(107906)) // Glyph of Shadow
1545 spellId = 107904;
1546 else if (target->HasAura(126745)) // Glyph of Shadowy Friends
1547 spellId = 142024;
1548 else
1549 spellId = 107903;
1550 break;
1551 case FORM_GHOST_WOLF:
1552 if (target->HasAura(58135)) // Glyph of Spectral Wolf
1553 spellId = 160942;
1554 break;
1555 case FORM_GHOUL:
1556 case FORM_AMBIENT:
1557 case FORM_STEALTH:
1558 case FORM_BATTLE_STANCE:
1561 case FORM_MOONKIN_FORM:
1562 case FORM_METAMORPHOSIS:
1563 break;
1564 default:
1565 break;
1566 }
1567
1568 if (apply)
1569 {
1570 if (spellId)
1571 target->CastSpell(target, spellId, this);
1572
1573 if (spellId2)
1574 target->CastSpell(target, spellId2, this);
1575
1576 if (spellId3)
1577 target->CastSpell(target, spellId3, this);
1578
1579 if (spellId4)
1580 target->CastSpell(target, spellId4, this);
1581
1582 if (target->GetTypeId() == TYPEID_PLAYER)
1583 {
1584 Player* plrTarget = target->ToPlayer();
1585
1586 PlayerSpellMap const& sp_list = plrTarget->GetSpellMap();
1587 for (auto itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1588 {
1589 if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled)
1590 continue;
1591
1592 if (itr->first == spellId || itr->first == spellId2 || itr->first == spellId3 || itr->first == spellId4)
1593 continue;
1594
1595 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first, DIFFICULTY_NONE);
1596 if (!spellInfo || !(spellInfo->IsPassive() || spellInfo->HasAttribute(SPELL_ATTR0_DO_NOT_DISPLAY_SPELLBOOK_AURA_ICON_COMBAT_LOG)))
1597 continue;
1598
1599 if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1600 target->CastSpell(target, itr->first, this);
1601 }
1602 }
1603 }
1604 else
1605 {
1606 if (spellId)
1607 target->RemoveOwnedAura(spellId, target->GetGUID());
1608 if (spellId2)
1609 target->RemoveOwnedAura(spellId2, target->GetGUID());
1610 if (spellId3)
1611 target->RemoveOwnedAura(spellId3, target->GetGUID());
1612 if (spellId4)
1613 target->RemoveOwnedAura(spellId4, target->GetGUID());
1614
1616 AuraEffect const* newAura = nullptr;
1617 // 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
1618 for (AuraEffect const* aurEff : shapeshifts)
1619 {
1620 if (aurEff != this)
1621 {
1622 newAura = aurEff;
1623 break;
1624 }
1625 }
1626
1627 Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1628 for (auto itr = tAuras.begin(); itr != tAuras.end();)
1629 {
1630 // Use the new aura to see on what stance the target will be
1631 uint64 newStance = newAura ? (UI64LIT(1) << (newAura->GetMiscValue() - 1)) : 0;
1632
1633 // If the stances are not compatible with the spell, remove it
1634 if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance))
1635 target->RemoveAura(itr);
1636 else
1637 ++itr;
1638 }
1639 }
1640}
1641
1642/*********************************************************/
1643/*** AURA EFFECT HANDLERS ***/
1644/*********************************************************/
1645
1646/**************************************/
1647/*** VISIBILITY & PHASES ***/
1648/**************************************/
1649
1650void AuraEffect::HandleModInvisibilityDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
1651{
1653 return;
1654
1655 Unit* target = aurApp->GetTarget();
1657
1658 if (apply)
1659 {
1660 target->m_invisibilityDetect.AddFlag(type);
1662 }
1663 else
1664 {
1666 target->m_invisibilityDetect.DelFlag(type);
1667
1669 }
1670
1671 // call functions which may have additional effects after changing state of unit
1672 if (target->IsInWorld())
1673 target->UpdateObjectVisibility();
1674}
1675
1676void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const
1677{
1679 return;
1680
1681 Unit* target = aurApp->GetTarget();
1683
1684 if (apply)
1685 {
1686 // apply glow vision
1687 if (type == INVISIBILITY_GENERAL)
1688 if (Player* playerTarget = target->ToPlayer())
1689 playerTarget->AddAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
1690
1691 target->m_invisibility.AddFlag(type);
1692 target->m_invisibility.AddValue(type, GetAmountAsInt());
1693
1695 }
1696 else
1697 {
1699 target->m_invisibility.DelFlag(type);
1700
1701 // if not have invisibility auras of type INVISIBILITY_GENERAL
1702 // remove glow vision
1704 if (Player* playerTarget = target->ToPlayer())
1705 playerTarget->RemoveAuraVision(PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
1706
1709
1710 target->m_invisibility.AddValue(type, -GetAmountAsInt());
1711 }
1712
1713 // call functions which may have additional effects after changing state of unit
1714 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1715 {
1716 // drop flag at invisibiliy in bg
1718 }
1719
1720 if (target->IsInWorld())
1721 target->UpdateObjectVisibility();
1722}
1723
1724void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
1725{
1727 return;
1728
1729 Unit* target = aurApp->GetTarget();
1731
1732 if (apply)
1733 {
1734 target->m_stealthDetect.AddFlag(type);
1735 target->m_stealthDetect.AddValue(type, GetAmountAsInt());
1736 }
1737 else
1738 {
1740 target->m_stealthDetect.DelFlag(type);
1741
1742 target->m_stealthDetect.AddValue(type, -GetAmountAsInt());
1743 }
1744
1745 // call functions which may have additional effects after changing state of unit
1746 if (target->IsInWorld())
1747 target->UpdateObjectVisibility();
1748}
1749
1750void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
1751{
1753 return;
1754
1755 Unit* target = aurApp->GetTarget();
1757
1758 if (apply)
1759 {
1760 target->m_stealth.AddFlag(type);
1761 target->m_stealth.AddValue(type, GetAmountAsInt());
1762
1764 if (Player * playerTarget = target->ToPlayer())
1765 playerTarget->AddAuraVision(PLAYER_FIELD_BYTE2_STEALTH);
1766 }
1767 else
1768 {
1769 target->m_stealth.AddValue(type, -GetAmountAsInt());
1770
1772 target->m_stealth.DelFlag(type);
1773
1774 if (!target->m_stealth.GetFlags())
1775 {
1777 if (Player * playerTarget = target->ToPlayer())
1778 playerTarget->RemoveAuraVision(PLAYER_FIELD_BYTE2_STEALTH);
1779 }
1780 }
1781
1782 // call functions which may have additional effects after changing state of unit
1783 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1784 {
1785 // drop flag at stealth in bg
1787 }
1788
1789 if (target->IsInWorld())
1790 target->UpdateObjectVisibility();
1791}
1792
1793void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const
1794{
1796 return;
1797
1798 Unit* target = aurApp->GetTarget();
1800
1801 if (apply)
1802 target->m_stealth.AddValue(type, GetAmountAsInt());
1803 else
1804 target->m_stealth.AddValue(type, -GetAmountAsInt());
1805
1806 // call functions which may have additional effects after changing state of unit
1807 if (target->IsInWorld())
1808 target->UpdateObjectVisibility();
1809}
1810
1811void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const
1812{
1814 return;
1815
1816 Unit* target = aurApp->GetTarget();
1817
1818 if (target->GetTypeId() != TYPEID_PLAYER)
1819 return;
1820
1821 if (apply)
1822 {
1823 if (Player* playerTarget = target->ToPlayer())
1824 {
1825 playerTarget->AddAuraVision(PlayerFieldByte2Flags(1 << (GetMiscValue() - 1)));
1826 }
1827 }
1828 else
1829 {
1831 {
1833 for (Unit::AuraEffectList::const_iterator i = amoreAuras.begin(); i != amoreAuras.end(); ++i)
1834 {
1835 if (GetMiscValue() == (*i)->GetMiscValue())
1836 return;
1837 }
1838 }
1839
1840 if (Player* playerTarget = target->ToPlayer())
1841 playerTarget->RemoveAuraVision(PlayerFieldByte2Flags(1 << (GetMiscValue() - 1)));
1842 }
1843}
1844
1845void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 mode, bool apply) const
1846{
1847 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1848 return;
1849
1850 Unit* target = aurApp->GetTarget();
1851
1852 if (target->GetTypeId() != TYPEID_PLAYER)
1853 return;
1854
1855 // prepare spirit state
1856 if (apply)
1857 {
1858 if (target->GetTypeId() == TYPEID_PLAYER)
1859 {
1860 // set stand state (expected in this form)
1861 if (!target->IsStandState())
1863 }
1864 }
1865 // die at aura end
1866 else if (target->IsAlive())
1867 // call functions which may have additional effects after changing state of unit
1868 target->setDeathState(JUST_DIED);
1869}
1870
1871void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const
1872{
1874 return;
1875
1876 Player* target = aurApp->GetTarget()->ToPlayer();
1877 if (!target)
1878 return;
1879
1880 if (apply)
1881 {
1885 }
1886 else
1887 {
1888 if (target->HasAuraType(SPELL_AURA_GHOST))
1889 return;
1890
1894 }
1895}
1896
1897void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const
1898{
1899 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1900 return;
1901
1902 Unit* target = aurApp->GetTarget();
1903
1904 if (apply)
1906 else
1908}
1909
1910void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, bool apply) const
1911{
1912 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1913 return;
1914
1915 Unit* target = aurApp->GetTarget();
1916
1917 if (apply)
1919 else
1921}
1922
1923void AuraEffect::HandlePhaseAlwaysVisible(AuraApplication const* aurApp, uint8 mode, bool apply) const
1924{
1925 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1926 return;
1927
1928 Unit* target = aurApp->GetTarget();
1929
1930 if (!apply)
1931 PhasingHandler::SetAlwaysVisible(target, true, true);
1932 else
1933 {
1934 if (target->HasAuraType(SPELL_AURA_PHASE_ALWAYS_VISIBLE) || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
1935 return;
1936
1937 PhasingHandler::SetAlwaysVisible(target, false, true);
1938 }
1939}
1940
1941/**********************/
1942/*** UNIT MODEL ***/
1943/**********************/
1944
1945void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mode, bool apply) const
1946{
1948 return;
1949
1950 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(GetMiscValue());
1951 ASSERT(shapeInfo, "Spell %u uses unknown ShapeshiftForm (%u).", GetId(), GetMiscValue());
1952
1953 Unit* target = aurApp->GetTarget();
1954
1956 uint32 modelid = target->GetModelForForm(form, GetId());
1957
1958 if (apply)
1959 {
1960 // remove polymorph before changing display id to keep new display id
1961 switch (form)
1962 {
1963 case FORM_CAT_FORM:
1964 case FORM_TREE_OF_LIFE:
1965 case FORM_TRAVEL_FORM:
1966 case FORM_AQUATIC_FORM:
1967 case FORM_BEAR_FORM:
1970 case FORM_FLIGHT_FORM:
1971 case FORM_MOONKIN_FORM:
1972 {
1973 // remove movement affects
1974 target->RemoveAurasByShapeShift();
1975
1976 // and polymorphic affects
1977 if (target->IsPolymorphed())
1978 target->RemoveAurasDueToSpell(target->GetTransformSpell());
1979 break;
1980 }
1981 default:
1982 break;
1983 }
1984
1985 // remove other shapeshift before applying a new one
1987
1988 // stop handling the effect if it was removed by linked event
1989 if (aurApp->GetRemoveMode())
1990 return;
1991
1992 ShapeshiftForm prevForm = target->GetShapeshiftForm();
1993 target->SetShapeshiftForm(form);
1994 // add the shapeshift aura's boosts
1995 if (prevForm != form)
1996 HandleShapeshiftBoosts(target, true);
1997
1998 if (modelid > 0)
1999 {
2000 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell(), GetBase()->GetCastDifficulty());
2001 if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
2002 target->SetDisplayId(modelid);
2003 }
2004
2005 if (!shapeInfo->GetFlags().HasFlag(SpellShapeshiftFormFlags::Stance))
2007 }
2008 else
2009 {
2010 // reset model id if no other auras present
2011 // may happen when aura is applied on linked event on aura removal
2013 {
2015 if (target->GetClass() == CLASS_DRUID)
2016 {
2017 // Remove movement impairing effects also when shifting out
2018 target->RemoveAurasByShapeShift();
2019 }
2020 }
2021
2022 if (modelid > 0)
2023 target->RestoreDisplayId(target->IsMounted());
2024
2025 switch (form)
2026 {
2027 // Nordrassil Harness - bonus
2028 case FORM_BEAR_FORM:
2030 case FORM_CAT_FORM:
2031 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
2032 target->CastSpell(target, 37316, dummy);
2033 break;
2034 // Nordrassil Regalia - bonus
2035 case FORM_MOONKIN_FORM:
2036 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
2037 target->CastSpell(target, 37325, dummy);
2038 break;
2039 default:
2040 break;
2041 }
2042
2043 // remove the shapeshift aura's boosts
2044 HandleShapeshiftBoosts(target, false);
2045 }
2046
2047 if (Player* playerTarget = target->ToPlayer())
2048 {
2049 playerTarget->SendMovementSetCollisionHeight(playerTarget->GetCollisionHeight(), WorldPackets::Movement::UpdateCollisionHeightReason::Force);
2050 playerTarget->InitDataForForm();
2051 }
2052 else
2053 target->UpdateDisplayPower();
2054
2055 if (target->GetClass() == CLASS_DRUID)
2056 {
2057 // Dash
2059 aurEff->RecalculateAmount();
2060
2061 // Disarm handling
2062 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
2063 // and also HandleAuraModDisarm is not triggered
2064 if (!target->CanUseAttackType(BASE_ATTACK))
2065 {
2067 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem, apply);
2068 }
2069 }
2070
2071 // stop handling the effect if it was removed by linked event
2072 if (apply && aurApp->GetRemoveMode())
2073 return;
2074
2075 if (target->GetTypeId() == TYPEID_PLAYER)
2076 {
2077 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
2078 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
2079 {
2080 if (!shapeInfo->PresetSpellID[i])
2081 continue;
2082 if (apply)
2083 target->ToPlayer()->AddTemporarySpell(shapeInfo->PresetSpellID[i]);
2084 else
2085 target->ToPlayer()->RemoveTemporarySpell(shapeInfo->PresetSpellID[i]);
2086 }
2087 }
2088}
2089
2090void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const
2091{
2093 return;
2094
2095 Unit* target = aurApp->GetTarget();
2096
2097 if (apply)
2098 {
2099 // update active transform spell only when transform not set or not overwriting negative by positive case
2100 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell(), GetBase()->GetCastDifficulty());
2101 if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
2102 {
2103 target->SetTransformSpell(GetId());
2104 // special case (spell specific functionality)
2105 if (GetMiscValue() == 0)
2106 {
2107 Gender gender = target->GetNativeGender();
2108 switch (GetId())
2109 {
2110 // Orb of Deception
2111 case 16739:
2112 {
2113 if (target->GetTypeId() != TYPEID_PLAYER)
2114 return;
2115
2116 switch (target->GetRace())
2117 {
2118 // Blood Elf
2119 case RACE_BLOODELF:
2120 target->SetDisplayId(gender == GENDER_FEMALE ? 17830 : 17829);
2121 break;
2122 // Orc
2123 case RACE_ORC:
2124 target->SetDisplayId(gender == GENDER_FEMALE ? 10140 : 10139);
2125 break;
2126 // Troll
2127 case RACE_TROLL:
2128 target->SetDisplayId(gender == GENDER_FEMALE ? 10134 : 10135);
2129 break;
2130 // Tauren
2131 case RACE_TAUREN:
2132 target->SetDisplayId(gender == GENDER_FEMALE ? 10147 : 10136);
2133 break;
2134 // Undead
2135 case RACE_UNDEAD_PLAYER:
2136 target->SetDisplayId(gender == GENDER_FEMALE ? 10145 : 10146);
2137 break;
2138 // Draenei
2139 case RACE_DRAENEI:
2140 target->SetDisplayId(gender == GENDER_FEMALE ? 17828 : 17827);
2141 break;
2142 // Dwarf
2143 case RACE_DWARF:
2144 target->SetDisplayId(gender == GENDER_FEMALE ? 10142 : 10141);
2145 break;
2146 // Gnome
2147 case RACE_GNOME:
2148 target->SetDisplayId(gender == GENDER_FEMALE ? 10149 : 10148);
2149 break;
2150 // Human
2151 case RACE_HUMAN:
2152 target->SetDisplayId(gender == GENDER_FEMALE ? 10138 : 10137);
2153 break;
2154 // Night Elf
2155 case RACE_NIGHTELF:
2156 target->SetDisplayId(gender == GENDER_FEMALE ? 10144 : 10143);
2157 break;
2158 default:
2159 break;
2160 }
2161 break;
2162 }
2163 // Murloc costume
2164 case 42365:
2165 target->SetDisplayId(21723);
2166 break;
2167 // Dread Corsair
2168 case 50517:
2169 // Corsair Costume
2170 case 51926:
2171 {
2172 if (target->GetTypeId() != TYPEID_PLAYER)
2173 return;
2174
2175 switch (target->GetRace())
2176 {
2177 // Blood Elf
2178 case RACE_BLOODELF:
2179 target->SetDisplayId(gender == GENDER_MALE ? 25032 : 25043);
2180 break;
2181 // Orc
2182 case RACE_ORC:
2183 target->SetDisplayId(gender == GENDER_MALE ? 25039 : 25050);
2184 break;
2185 // Troll
2186 case RACE_TROLL:
2187 target->SetDisplayId(gender == GENDER_MALE ? 25041 : 25052);
2188 break;
2189 // Tauren
2190 case RACE_TAUREN:
2191 target->SetDisplayId(gender == GENDER_MALE ? 25040 : 25051);
2192 break;
2193 // Undead
2194 case RACE_UNDEAD_PLAYER:
2195 target->SetDisplayId(gender == GENDER_MALE ? 25042 : 25053);
2196 break;
2197 // Draenei
2198 case RACE_DRAENEI:
2199 target->SetDisplayId(gender == GENDER_MALE ? 25033 : 25044);
2200 break;
2201 // Dwarf
2202 case RACE_DWARF:
2203 target->SetDisplayId(gender == GENDER_MALE ? 25034 : 25045);
2204 break;
2205 // Gnome
2206 case RACE_GNOME:
2207 target->SetDisplayId(gender == GENDER_MALE ? 25035 : 25046);
2208 break;
2209 // Human
2210 case RACE_HUMAN:
2211 target->SetDisplayId(gender == GENDER_MALE ? 25037 : 25048);
2212 break;
2213 // Night Elf
2214 case RACE_NIGHTELF:
2215 target->SetDisplayId(gender == GENDER_MALE ? 25038 : 25049);
2216 break;
2217 default:
2218 break;
2219 }
2220 break;
2221 }
2222 // Pygmy Oil
2223 case 53806:
2224 target->SetDisplayId(22512);
2225 break;
2226 // Honor the Dead
2227 case 65386:
2228 case 65495:
2229 target->SetDisplayId(gender == GENDER_MALE ? 29203 : 29204);
2230 break;
2231 // Darkspear Pride
2232 case 75532:
2233 target->SetDisplayId(gender == GENDER_MALE ? 31737 : 31738);
2234 break;
2235 // Gnomeregan Pride
2236 case 75531:
2237 target->SetDisplayId(gender == GENDER_MALE ? 31654 : 31655);
2238 break;
2239 default:
2240 break;
2241 }
2242 }
2243 else
2244 {
2245 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2246 if (!ci)
2247 {
2248 target->SetDisplayId(16358); // pig pink ^_^
2249 TC_LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2250 }
2251 else
2252 {
2253 uint32 model_id = 0;
2254
2255 // choose a model, based on trigger flag
2256 if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci)->CreatureDisplayID)
2257 model_id = modelid;
2258
2259 target->SetDisplayId(model_id);
2260
2261 // Dragonmaw Illusion (set mount model also)
2262 if (GetId() == 42016 && target->GetMountDisplayId() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2263 target->SetMountDisplayId(16314);
2264 }
2265 }
2266 }
2267
2268 // polymorph case
2269 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
2270 {
2271 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2272 // only if caster is Player (after patch 2.4.2)
2273 if (GetCasterGUID().IsPlayer())
2275
2276 //dismount polymorphed target (after patch 2.4.2)
2277 if (target->IsMounted())
2279 }
2280
2282 }
2283 else
2284 {
2285 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2286 if (target->GetTransformSpell() == GetId())
2287 target->SetTransformSpell(0);
2288
2289 target->RestoreDisplayId(target->IsMounted());
2290
2291 // Dragonmaw Illusion (restore mount model)
2292 if (GetId() == 42016 && target->GetMountDisplayId() == 16314)
2293 {
2294 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2295 {
2296 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2297 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2298 {
2300 sObjectMgr->GetCreatureModelRandomGender(&model, ci);
2301
2302 target->SetMountDisplayId(model.CreatureDisplayID);
2303 }
2304 }
2305 }
2306 }
2307}
2308
2309void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2310{
2312 return;
2313
2314 aurApp->GetTarget()->RecalculateObjectScale();
2315}
2316
2317void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode, bool apply) const
2318{
2320 return;
2321
2322 Unit* target = aurApp->GetTarget();
2323
2324 if (apply)
2325 {
2326 Unit* caster = GetCaster();
2327 if (!caster || caster == target)
2328 return;
2329
2330 // What must be cloned? at least display and scale
2331 target->SetDisplayId(caster->GetDisplayId());
2332 //target->SetObjectScale(caster->GetObjectScale()); // we need retail info about how scaling is handled (aura maybe?)
2334 }
2335 else
2336 {
2337 target->SetDisplayId(target->GetNativeDisplayId());
2339 }
2340}
2341
2342/************************/
2343/*** FIGHT ***/
2344/************************/
2345
2346void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, bool apply) const
2347{
2348 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2349 return;
2350
2351 Unit* target = aurApp->GetTarget();
2352
2353 if (apply)
2354 {
2355 auto isAffectedByFeignDeath = [](Unit const* attacker)
2356 {
2357 Creature const* attackerCreature = attacker->ToCreature();
2358 return !attackerCreature || !attackerCreature->IsIgnoringFeignDeath();
2359 };
2360
2361 std::vector<Unit*> targets;
2362 Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityRange());
2363 Trinity::UnitListSearcher searcher(target, targets, u_check);
2364 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2365 for (Unit* unit : targets)
2366 {
2367 if (!unit->HasUnitState(UNIT_STATE_CASTING))
2368 continue;
2369
2370 if (!isAffectedByFeignDeath(unit))
2371 continue;
2372
2374 if (Spell* currentSpell = unit->GetCurrentSpell(i))
2375 if (currentSpell->m_targets.GetUnitTargetGUID() == target->GetGUID())
2376 unit->InterruptSpell(i, false);
2377 }
2378
2379 for (auto const& [guid, ref] : target->GetThreatManager().GetThreatenedByMeList())
2380 if (isAffectedByFeignDeath(ref->GetOwner()))
2381 ref->ScaleThreat(0.0f);
2382
2383 if (target->GetMap()->IsDungeon()) // feign death does not remove combat in dungeons
2384 {
2385 target->AttackStop();
2386 if (Player* targetPlayer = target->ToPlayer())
2387 targetPlayer->SendAttackSwingCancelAttack();
2388 }
2389 else
2390 target->CombatStop(false, false, isAffectedByFeignDeath);
2391
2392 // prevent interrupt message
2393 if (GetCasterGUID() == target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
2395 target->InterruptNonMeleeSpells(true);
2396
2397 // stop handling the effect if it was removed by linked event
2398 if (aurApp->GetRemoveMode())
2399 return;
2400
2405
2406 if (Creature* creature = target->ToCreature())
2407 creature->SetReactState(REACT_PASSIVE);
2408 }
2409 else
2410 {
2415
2416 if (Creature* creature = target->ToCreature())
2417 creature->InitializeReactState();
2418 }
2419}
2420
2421void AuraEffect::HandleModUnattackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
2422{
2424 return;
2425
2426 Unit* target = aurApp->GetTarget();
2427
2428 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2429 if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
2430 return;
2431
2432 if (apply)
2434 else
2436
2437 // call functions which may have additional effects after changing state of unit
2438 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2439 {
2440 if (target->GetMap()->IsDungeon())
2441 {
2442 target->AttackStop();
2443 if (Player* targetPlayer = target->ToPlayer())
2444 targetPlayer->SendAttackSwingCancelAttack();
2445 }
2446 else
2447 target->CombatStop();
2448 }
2449}
2450
2451void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, bool apply) const
2452{
2453 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2454 return;
2455
2456 Unit* target = aurApp->GetTarget();
2457
2458 AuraType type = GetAuraType();
2459
2460 bool(*flagChangeFunc)(Unit* u) = nullptr;
2461
2462 uint32 slot;
2463 WeaponAttackType attType;
2464 switch (type)
2465 {
2467 if (apply)
2468 flagChangeFunc = [](Unit* u) { if (u->HasUnitFlag(UNIT_FLAG_DISARMED)) { return false; } u->SetUnitFlag(UNIT_FLAG_DISARMED); return true; };
2469 else
2470 flagChangeFunc = [](Unit* u) { if (u->HasAuraType(SPELL_AURA_MOD_DISARM)) { return false; } u->RemoveUnitFlag(UNIT_FLAG_DISARMED); return true; };
2472 attType = BASE_ATTACK;
2473 break;
2475 if (apply)
2476 flagChangeFunc = [](Unit* u) { if (u->HasUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND)) { return false; } u->SetUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); return true; };
2477 else
2478 flagChangeFunc = [](Unit* u) { if (u->HasAuraType(SPELL_AURA_MOD_DISARM_OFFHAND)) { return false; } u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); return true; };
2480 attType = OFF_ATTACK;
2481 break;
2483 if (apply)
2484 flagChangeFunc = [](Unit* u) { if (u->HasUnitFlag2(UNIT_FLAG2_DISARM_RANGED)) { return false; } u->SetUnitFlag2(UNIT_FLAG2_DISARM_RANGED); return true; };
2485 else
2486 flagChangeFunc = [](Unit* u) { if (u->HasAuraType(SPELL_AURA_MOD_DISARM_RANGED)) { return false; } u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_RANGED); return true; };
2488 attType = RANGED_ATTACK;
2489 break;
2490 default:
2491 return;
2492 }
2493
2494 // set/remove flag before weapon bonuses so it's properly reflected in CanUseAttackType
2495 if (flagChangeFunc)
2496 if (!flagChangeFunc(target)) //Prevent handling aura twice
2497 return;
2498
2499 // Handle damage modification, shapeshifted druids are not affected
2500 if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
2501 {
2502 Player* player = target->ToPlayer();
2503 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2504 {
2505 WeaponAttackType const attackType = Player::GetAttackBySlot(slot, item->GetTemplate()->GetInventoryType());
2506
2507 player->ApplyItemDependentAuras(item, !apply);
2508 if (attackType != MAX_ATTACK)
2509 {
2510 player->_ApplyWeaponDamage(slot, item, !apply);
2511 if (!apply) // apply case already handled on item dependent aura removal (if any)
2512 player->UpdateWeaponDependentAuras(attackType);
2513 }
2514 }
2515 }
2516
2517 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
2518 target->UpdateDamagePhysical(attType);
2519}
2520
2522{
2523 // Stop cast only spells vs PreventionType
2524 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2525 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2526 if (spell->m_spellInfo->PreventionType & preventionType)
2527 // Stop spells on prepare or casting state
2528 target->InterruptSpell(CurrentSpellTypes(i), false);
2529}
2530
2531void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const
2532{
2533 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2534 return;
2535
2536 Unit* target = aurApp->GetTarget();
2537
2538 if (apply)
2539 {
2541
2542 // call functions which may have additional effects after changing state of unit
2544 }
2545 else
2546 {
2547 int32 silencedSchoolMask = 0;
2548 for (AuraEffect const* auraEffect : target->GetAuraEffectsByType(SPELL_AURA_MOD_SILENCE))
2549 silencedSchoolMask |= auraEffect->GetMiscValue();
2550
2551 for (AuraEffect const* auraEffect : target->GetAuraEffectsByType(SPELL_AURA_MOD_PACIFY_SILENCE))
2552 silencedSchoolMask |= auraEffect->GetMiscValue();
2553
2554 target->ReplaceAllSilencedSchoolMask(SpellSchoolMask(silencedSchoolMask));
2555 }
2556}
2557
2558void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const
2559{
2561 return;
2562
2563 Unit* target = aurApp->GetTarget();
2564
2565 if (apply)
2566 {
2568
2569 // call functions which may have additional effects after changing state of unit
2571 }
2572 else
2573 {
2574 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2576 return;
2578 }
2579}
2580
2581void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const
2582{
2584 return;
2585
2586 Unit* target = aurApp->GetTarget();
2587
2588 // Vengeance of the Blue Flight (@todo REMOVE THIS!)
2590 if (m_spellInfo->Id == 45839)
2591 {
2592 if (apply)
2594 else
2596 }
2597 if (!(apply))
2598 {
2599 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2601 return;
2602 }
2603 HandleAuraModPacify(aurApp, mode, apply);
2604 HandleAuraModSilence(aurApp, mode, apply);
2605}
2606
2607void AuraEffect::HandleAuraModNoActions(AuraApplication const* aurApp, uint8 mode, bool apply) const
2608{
2609 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2610 return;
2611
2612 Unit* target = aurApp->GetTarget();
2613
2614 if (apply)
2615 {
2617
2618 // call functions which may have additional effects after chainging state of unit
2620 }
2621 else
2622 {
2623 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2625 return;
2626
2628 }
2629}
2630
2631/****************************/
2632/*** TRACKING ***/
2633/****************************/
2634
2635void AuraEffect::HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 mode, bool apply) const
2636{
2638 return;
2639
2640 Player* target = aurApp->GetTarget()->ToPlayer();
2641 if (!target)
2642 return;
2643
2644 if (apply)
2645 target->SetTrackCreatureFlag(uint32(1) << (GetMiscValue() - 1));
2646 else
2647 target->RemoveTrackCreatureFlag(uint32(1) << (GetMiscValue() - 1));
2648}
2649
2650void AuraEffect::HandleAuraTrackStealthed(AuraApplication const* aurApp, uint8 mode, bool apply) const
2651{
2653 return;
2654
2655 Player* target = aurApp->GetTarget()->ToPlayer();
2656 if (!target)
2657 return;
2658
2659 if (!(apply))
2660 {
2661 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2662 if (target->HasAuraType(GetAuraType()))
2663 return;
2664 }
2665 if (apply)
2667 else
2669}
2670
2671void AuraEffect::HandleAuraModStalked(AuraApplication const* aurApp, uint8 mode, bool apply) const
2672{
2674 return;
2675
2676 Unit* target = aurApp->GetTarget();
2677
2678 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
2679 if (apply)
2681 else
2682 {
2683 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2684 if (!target->HasAuraType(GetAuraType()))
2686 }
2687
2688 // call functions which may have additional effects after changing state of unit
2689 if (target->IsInWorld())
2690 target->UpdateObjectVisibility();
2691}
2692
2693void AuraEffect::HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
2694{
2696 return;
2697
2698 Unit* target = aurApp->GetTarget();
2699
2700 if (apply)
2702 else
2703 {
2704 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2705 if (target->HasAuraType(GetAuraType()))
2706 return;
2708 }
2709}
2710
2711/****************************/
2712/*** SKILLS & TALENTS ***/
2713/****************************/
2714
2715void AuraEffect::HandleAuraModSkill(AuraApplication const* aurApp, uint8 mode, bool apply) const
2716{
2718 return;
2719
2720 Player* target = aurApp->GetTarget()->ToPlayer();
2721 if (!target)
2722 return;
2723
2724 uint32 prot = GetMiscValue();
2725 int32 points = GetAmountAsInt();
2726
2727 if (prot == SKILL_DEFENSE)
2728 return;
2729
2730 target->ModifySkillBonus(prot, (apply ? points : -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
2731}
2732
2733void AuraEffect::HandleAuraAllowTalentSwapping(AuraApplication const* aurApp, uint8 mode, bool apply) const
2734{
2735 if (!(mode & (AURA_EFFECT_HANDLE_REAL)))
2736 return;
2737
2738 Player* target = aurApp->GetTarget()->ToPlayer();
2739 if (!target)
2740 return;
2741
2742 if (apply)
2744 else if (!target->HasAuraType(GetAuraType()))
2746}
2747
2748/****************************/
2749/*** MOVEMENT ***/
2750/****************************/
2751
2752void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bool apply) const
2753{
2755 return;
2756
2757 Unit* target = aurApp->GetTarget();
2758
2759 if (apply)
2760 {
2762 {
2763 uint32 creatureEntry = GetMiscValue();
2764 uint32 displayId = 0;
2765 uint32 vehicleId = 0;
2766
2767 if (MountEntry const* mountEntry = sDB2Manager.GetMount(GetId()))
2768 {
2769 if (DB2Manager::MountXDisplayContainer const* mountDisplays = sDB2Manager.GetMountDisplays(mountEntry->ID))
2770 {
2771 if (mountEntry->GetFlags().HasFlag(MountFlags::IsSelfMount))
2772 {
2773 displayId = DISPLAYID_HIDDEN_MOUNT;
2774 }
2775 else
2776 {
2778 std::copy_if(mountDisplays->begin(), mountDisplays->end(), std::back_inserter(usableDisplays), [target](MountXDisplayEntry const* mountDisplay)
2779 {
2780 if (Player* playerTarget = target->ToPlayer())
2781 return ConditionMgr::IsPlayerMeetingCondition(playerTarget, mountDisplay->PlayerConditionID);
2782
2783 return true;
2784 });
2785
2786 if (!usableDisplays.empty())
2787 displayId = Trinity::Containers::SelectRandomContainerElement(usableDisplays)->CreatureDisplayInfoID;
2788 }
2789 }
2790 // TODO: CREATE TABLE mount_vehicle (mountId, vehicleCreatureId) for future mounts that are vehicles (new mounts no longer have proper data in MiscValue)
2791 //if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
2792 // creatureEntry = mountVehicle->VehicleCreatureId;
2793
2794 if (mode & AURA_EFFECT_HANDLE_REAL && !mountEntry->GetFlags().HasFlag(MountFlags::MountEquipmentEffectsSuppressed))
2795 {
2796 if (Player* playerTarget = target->ToPlayer())
2797 {
2798 auto mountEquipmentItr = std::ranges::find_if(sMountEquipmentStore,
2799 [&](int32 equipmentSpell) { return playerTarget->HasSpell(equipmentSpell); },
2801 if (mountEquipmentItr != sMountEquipmentStore.end())
2802 playerTarget->CastSpell(playerTarget, mountEquipmentItr->BuffSpell, this);
2803 }
2804 }
2805 }
2806
2807 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
2808 {
2809 vehicleId = creatureInfo->VehicleId;
2810
2811 if (!displayId)
2812 {
2813 CreatureModel model = *ObjectMgr::ChooseDisplayId(creatureInfo);
2814 sObjectMgr->GetCreatureModelRandomGender(&model, creatureInfo);
2815 displayId = model.CreatureDisplayID;
2816 }
2817
2818 //some spell has one aura of mount and one of vehicle
2819 for (SpellEffectInfo const& effect : GetSpellInfo()->GetEffects())
2820 if (effect.IsEffect(SPELL_EFFECT_SUMMON) && effect.MiscValue == GetMiscValue())
2821 displayId = 0;
2822 }
2823
2824 target->Mount(displayId, vehicleId, creatureEntry);
2825 }
2826
2827 // cast speed aura
2829 {
2830 if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmountAsInt()))
2831 {
2832 target->SetFlightCapabilityID(mountCapability->FlightCapabilityID, true);
2833 target->CastSpell(target, mountCapability->ModSpellAuraID, this);
2834 }
2835 }
2836 }
2837 else
2838 {
2840 target->Dismount();
2841
2842 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
2843 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
2844 // and never endless flying after using Headless Horseman's Mount
2845 if (mode & AURA_EFFECT_HANDLE_REAL)
2846 {
2848 for (MountEquipmentEntry const* mountEquipmentStore : sMountEquipmentStore)
2849 target->RemoveOwnedAura(mountEquipmentStore->BuffSpell);
2850 }
2851
2853 // remove speed aura
2854 if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmountAsInt()))
2855 target->RemoveAurasDueToSpell(mountCapability->ModSpellAuraID, target->GetGUID());
2856
2857 target->SetFlightCapabilityID(0, true);
2858 }
2859}
2860
2861void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode, bool apply) const
2862{
2864 return;
2865
2866 Unit* target = aurApp->GetTarget();
2867
2868 if (!apply)
2869 {
2870 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2872 return;
2873 }
2874
2875 target->SetCanTransitionBetweenSwimAndFly(apply);
2876
2877 if (target->SetCanFly(apply))
2878 {
2879 if (!apply && !target->IsGravityDisabled())
2880 target->GetMotionMaster()->MoveFall();
2881 }
2882}
2883
2884void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
2885{
2887 return;
2888
2889 Unit* target = aurApp->GetTarget();
2890
2891 if (!apply)
2892 {
2893 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2894 if (target->HasAuraType(GetAuraType()))
2895 return;
2896 }
2897
2898 target->SetWaterWalking(apply);
2899}
2900
2901void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode, bool apply) const
2902{
2904 return;
2905
2906 Unit* target = aurApp->GetTarget();
2907
2908 if (!apply)
2909 {
2910 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2911 if (target->HasAuraType(GetAuraType()))
2912 return;
2913 }
2914
2915 target->SetFeatherFall(apply);
2916
2917 // start fall from current height
2918 if (!apply && target->GetTypeId() == TYPEID_PLAYER)
2919 target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
2920}
2921
2922void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const
2923{
2925 return;
2926
2927 Unit* target = aurApp->GetTarget();
2928
2929 if (!apply)
2930 {
2931 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2932 if (target->HasAuraType(GetAuraType()))
2933 return;
2934 }
2935
2936 target->SetHover(apply);
2937}
2938
2939void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2940{
2942 return;
2943
2944 Unit* target = aurApp->GetTarget();
2945
2946 // update timers in client
2947 target->UpdatePositionData();
2948}
2949
2950void AuraEffect::HandleModWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2951{
2953 return;
2954
2955 Player* target = aurApp->GetTarget()->ToPlayer();
2956 if (!target)
2957 return;
2958
2960}
2961
2962void AuraEffect::HandleForceBreathBar(AuraApplication const* aurApp, uint8 mode, bool apply) const
2963{
2964 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2965 return;
2966
2967 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
2968 if (!playerTarget)
2969 return;
2970
2971 playerTarget->UpdatePositionData();
2972 if (!apply)
2974}
2975
2976void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mode, bool apply) const
2977{
2979 return;
2980
2981 Unit* target = aurApp->GetTarget();
2982
2983 if (apply)
2985 else
2986 {
2987 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2988 if (target->HasAuraType(GetAuraType()))
2989 return;
2991 }
2992}
2993
2994void AuraEffect::HandleAuraCanTurnWhileFalling(AuraApplication const* aurApp, uint8 mode, bool apply) const
2995{
2997 return;
2998
2999 Unit* target = aurApp->GetTarget();
3000
3001 if (!apply)
3002 {
3003 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3004 if (target->HasAuraType(GetAuraType()))
3005 return;
3006 }
3007
3008 target->SetCanTurnWhileFalling(apply);
3009}
3010
3011void AuraEffect::HandleModAdvFlying(AuraApplication const* aurApp, uint8 mode, bool apply) const
3012{
3014 return;
3015
3016 Unit* target = aurApp->GetTarget();
3017 target->SetCanDoubleJump(apply || target->HasAura(SPELL_DH_DOUBLE_JUMP));
3018 target->SetCanFly(apply);
3019 target->SetCanAdvFly(apply);
3020}
3021
3022void AuraEffect::HandleIgnoreMovementForces(AuraApplication const* aurApp, uint8 mode, bool apply) const
3023{
3025 return;
3026
3027 Unit* target = aurApp->GetTarget();
3028
3029 if (!apply)
3030 {
3031 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3032 if (target->HasAuraType(GetAuraType()))
3033 return;
3034 }
3035
3036 target->SetIgnoreMovementForces(apply);
3037}
3038
3039void AuraEffect::HandleDisableInertia(AuraApplication const* aurApp, uint8 mode, bool apply) const
3040{
3042 return;
3043
3044 Unit* target = aurApp->GetTarget();
3045
3046 if (!apply)
3047 {
3048 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3049 if (target->HasAuraType(GetAuraType()))
3050 return;
3051 }
3052
3053 target->SetDisableInertia(apply);
3054}
3055
3056void AuraEffect::HandleSetCantSwim(AuraApplication const* aurApp, uint8 mode, bool apply) const
3057{
3059 return;
3060
3061 Unit* target = aurApp->GetTarget();
3062
3063 if (!apply)
3064 {
3065 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3066 if (target->HasAuraType(GetAuraType()))
3067 return;
3068 }
3069
3070 target->SetMoveCantSwim(apply);
3071}
3072
3073/****************************/
3074/*** THREAT ***/
3075/****************************/
3076
3077void AuraEffect::HandleModThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3078{
3080 return;
3081
3083}
3084
3085void AuraEffect::HandleAuraModTotalThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3086{
3088 return;
3089
3090 Unit* target = aurApp->GetTarget();
3091
3092 if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
3093 return;
3094
3095 Unit* caster = GetCaster();
3096 if (caster && caster->IsAlive())
3098}
3099
3100void AuraEffect::HandleModTaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3101{
3102 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3103 return;
3104
3105 Unit* target = aurApp->GetTarget();
3106
3107 if (!target->IsAlive() || !target->CanHaveThreatList())
3108 return;
3109
3110 target->GetThreatManager().TauntUpdate();
3111}
3112
3113void AuraEffect::HandleModDetaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3114{
3115 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3116 return;
3117
3118 Unit* caster = GetCaster();
3119 Unit* target = aurApp->GetTarget();
3120
3121 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
3122 return;
3123
3124 caster->GetThreatManager().TauntUpdate();
3125}
3126
3127void AuraEffect::HandleAuraModFixate(AuraApplication const* aurApp, uint8 mode, bool apply) const
3128{
3129 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3130 return;
3131
3132 Unit* caster = GetCaster();
3133 Unit* target = aurApp->GetTarget();
3134
3135 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
3136 return;
3137
3138 if (apply)
3139 caster->GetThreatManager().FixateTarget(target);
3140 else
3141 caster->GetThreatManager().ClearFixate();
3142}
3143
3144/*****************************/
3145/*** CONTROL ***/
3146/*****************************/
3147
3148void AuraEffect::HandleModConfuse(AuraApplication const* aurApp, uint8 mode, bool apply) const
3149{
3150 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3151 return;
3152
3153 Unit* target = aurApp->GetTarget();
3154
3155 target->SetControlled(apply, UNIT_STATE_CONFUSED);
3156 if (apply)
3158}
3159
3160void AuraEffect::HandleModFear(AuraApplication const* aurApp, uint8 mode, bool apply) const
3161{
3162 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3163 return;
3164
3165 Unit* target = aurApp->GetTarget();
3166
3167 target->SetControlled(apply, UNIT_STATE_FLEEING);
3168}
3169
3170void AuraEffect::HandleAuraModStun(AuraApplication const* aurApp, uint8 mode, bool apply) const
3171{
3172 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3173 return;
3174
3175 Unit* target = aurApp->GetTarget();
3176
3177 target->SetControlled(apply, UNIT_STATE_STUNNED);
3178 if (apply)
3180}
3181
3182void AuraEffect::HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bool apply) const
3183{
3184 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3185 return;
3186
3187 Unit* target = aurApp->GetTarget();
3188
3189 target->SetControlled(apply, UNIT_STATE_ROOT);
3190}
3191
3192void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const
3193{
3194 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3195 return;
3196
3197 Unit* target = aurApp->GetTarget();
3198
3199 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
3200 if (!apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
3201 return;
3204 target->SetControlled(false, UNIT_STATE_FLEEING);
3205}
3206
3207static void HandleAuraDisableGravity(Unit* target, bool apply)
3208{
3209 // 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.
3210 if (!apply)
3214 || (target->IsCreature() && target->ToCreature()->IsFloating()))
3215 return;
3216
3217 if (target->SetDisableGravity(apply))
3218 if (!apply && !target->IsFlying())
3219 target->GetMotionMaster()->MoveFall();
3220}
3221
3223{
3224 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3225 return;
3226
3227 Unit* target = aurApp->GetTarget();
3228
3229 target->SetControlled(apply, UNIT_STATE_ROOT);
3230
3231 ::HandleAuraDisableGravity(target, apply);
3232}
3233
3235{
3236 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3237 return;
3238
3239 Unit* target = aurApp->GetTarget();
3240
3241 target->SetControlled(apply, UNIT_STATE_STUNNED);
3242
3243 if (apply)
3245
3246 ::HandleAuraDisableGravity(target, apply);
3247}
3248
3249void AuraEffect::HandleAuraDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3250{
3251 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3252 return;
3253
3254 Unit* target = aurApp->GetTarget();
3255
3256 ::HandleAuraDisableGravity(target, apply);
3257}
3258
3259/***************************/
3260/*** CHARM ***/
3261/***************************/
3262
3263void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const
3264{
3265 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3266 return;
3267
3268 Unit* target = aurApp->GetTarget();
3269
3270 Unit* caster = GetCaster();
3271
3272 // no support for posession AI yet
3273 if (caster && caster->GetTypeId() == TYPEID_UNIT)
3274 {
3275 HandleModCharm(aurApp, mode, apply);
3276 return;
3277 }
3278
3279 if (apply)
3280 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3281 else
3282 target->RemoveCharmedBy(caster);
3283}
3284
3285void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const
3286{
3287 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3288 return;
3289
3290 Unit* caster = GetCaster();
3291 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
3292 return;
3293
3294 // seems it may happen that when removing it is no longer owner's pet
3295 //if (caster->ToPlayer()->GetPet() != target)
3296 // return;
3297
3298 Unit* target = aurApp->GetTarget();
3299 if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
3300 return;
3301
3302 Pet* pet = target->ToPet();
3303 if (apply)
3304 {
3305 if (caster->ToPlayer()->GetPet() != pet)
3306 return;
3307
3308 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
3309 }
3310 else
3311 {
3312 pet->RemoveCharmedBy(caster);
3313
3314 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
3315 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
3316 else
3317 {
3318 // Reinitialize the pet bar or it will appear greyed out
3319 caster->ToPlayer()->PetSpellInitialize();
3320
3321 // TODO: remove this
3322 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
3324 }
3325 }
3326}
3327
3328void AuraEffect::HandleModCharm(AuraApplication const* aurApp, uint8 mode, bool apply) const
3329{
3330 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3331 return;
3332
3333 Unit* target = aurApp->GetTarget();
3334
3335 Unit* caster = GetCaster();
3336
3337 if (apply)
3338 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
3339 else
3340 target->RemoveCharmedBy(caster);
3341}
3342
3343void AuraEffect::HandleCharmConvert(AuraApplication const* aurApp, uint8 mode, bool apply) const
3344{
3345 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3346 return;
3347
3348 Unit* target = aurApp->GetTarget();
3349
3350 Unit* caster = GetCaster();
3351
3352 if (apply)
3353 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
3354 else
3355 target->RemoveCharmedBy(caster);
3356}
3357
3362void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const
3363{
3365 return;
3366
3367 Unit* target = aurApp->GetTarget();
3368 if (!target->IsVehicle())
3369 return;
3370
3371 Unit* caster = GetCaster();
3372 if (!caster || caster == target)
3373 return;
3374
3375 if (apply)
3376 {
3377 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
3378 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
3379 // so this break such spells or most of them.
3380 // Current formula about m_amount: effect base points + dieside - 1
3381 // TO DO: Reasearch more about 0/0 and fix it.
3382 caster->_EnterVehicle(target->GetVehicleKit(), GetAmountAsInt() - 1, aurApp);
3383 }
3384 else
3385 {
3386 // Remove pending passengers before exiting vehicle - might cause an Uninstall
3388
3389 if (GetId() == 53111) // Devour Humanoid
3390 {
3391 Unit::Kill(target, caster);
3392 if (caster->GetTypeId() == TYPEID_UNIT)
3393 caster->ToCreature()->DespawnOrUnsummon();
3394 }
3395
3396 bool seatChange = (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT) // Seat change on the same direct vehicle
3397 || target->HasAuraTypeWithCaster(SPELL_AURA_CONTROL_VEHICLE, caster->GetGUID()); // Seat change to a proxy vehicle (for example turret mounted on a siege engine)
3398
3399 if (!seatChange)
3400 caster->_ExitVehicle();
3401 else
3402 target->GetVehicleKit()->RemovePassenger(caster); // Only remove passenger from vehicle without launching exit movement or despawning the vehicle
3403
3404 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3405 caster->RemoveAurasDueToSpell(GetId());
3406 }
3407}
3408
3409/*********************************************************/
3410/*** MODIFY SPEED ***/
3411/*********************************************************/
3412void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3413{
3415 return;
3416
3417 Unit* target = aurApp->GetTarget();
3418
3419 target->UpdateSpeed(MOVE_RUN);
3420}
3421
3423{
3424 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3425}
3426
3427void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
3428{
3430 return;
3431
3432 Unit* target = aurApp->GetTarget();
3434 target->UpdateSpeed(MOVE_FLIGHT);
3435
3438 {
3439 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3441 {
3442 target->SetCanTransitionBetweenSwimAndFly(apply);
3443
3444 if (target->SetCanFly(apply))
3445 if (!apply && !target->IsGravityDisabled())
3446 target->GetMotionMaster()->MoveFall();
3447 }
3448
3450 if (mode & AURA_EFFECT_HANDLE_REAL)
3451 {
3452 //Players on flying mounts must be immune to polymorph
3453 if (target->GetTypeId() == TYPEID_PLAYER)
3455
3456 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3457 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountDisplayId())
3458 target->SetMountDisplayId(16314);
3459 }
3460 }
3461}
3462
3463void AuraEffect::HandleAuraModIncreaseSwimSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3464{
3466 return;
3467
3468 Unit* target = aurApp->GetTarget();
3469
3470 target->UpdateSpeed(MOVE_SWIM);
3471}
3472
3473void AuraEffect::HandleAuraModDecreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3474{
3476 return;
3477
3478 Unit* target = aurApp->GetTarget();
3479
3480 target->UpdateSpeed(MOVE_RUN);
3481 target->UpdateSpeed(MOVE_SWIM);
3482 target->UpdateSpeed(MOVE_FLIGHT);
3483 target->UpdateSpeed(MOVE_RUN_BACK);
3484 target->UpdateSpeed(MOVE_SWIM_BACK);
3486}
3487
3488void AuraEffect::HandleAuraModUseNormalSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3489{
3490 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3491 return;
3492
3493 Unit* target = aurApp->GetTarget();
3494
3495 target->UpdateSpeed(MOVE_RUN);
3496 target->UpdateSpeed(MOVE_SWIM);
3497 target->UpdateSpeed(MOVE_FLIGHT);
3498}
3499
3500void AuraEffect::HandleAuraModMinimumSpeedRate(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3501{
3502 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3503 return;
3504
3505 Unit* target = aurApp->GetTarget();
3506
3507 target->UpdateSpeed(MOVE_RUN);
3508}
3509
3510void AuraEffect::HandleModMovementForceMagnitude(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3511{
3513 return;
3514
3516}
3517
3518void AuraEffect::HandleAuraModAdvFlyingSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3519{
3521 return;
3522
3523 Unit* target = aurApp->GetTarget();
3524 switch (GetAuraType())
3525 {
3528 break;
3531 break;
3534 break;
3537 break;
3540 break;
3543 break;
3546 break;
3549 break;
3550 default:
3551 break;
3552 }
3553}
3554
3555/*********************************************************/
3556/*** IMMUNITY ***/
3557/*********************************************************/
3558
3559void AuraEffect::HandleModMechanicImmunityMask(AuraApplication const* aurApp, uint8 mode, bool apply) const
3560{
3561 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3562 return;
3563
3564 Unit* target = aurApp->GetTarget();
3566}
3567
3568void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3569{
3570 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3571 return;
3572
3573 Unit* target = aurApp->GetTarget();
3575}
3576
3577void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3578{
3579 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3580 return;
3581
3582 Unit* target = aurApp->GetTarget();
3584
3585 // when removing flag aura, handle flag drop
3586 // TODO: this should be handled in aura script for flag spells using AfterEffectRemove hook
3587 Player* player = target->ToPlayer();
3588 if (!apply && player && GetSpellInfo()->HasAuraInterruptFlag(SpellAuraInterruptFlags::StealthOrInvis))
3589 {
3590 if (!player->InBattleground())
3591 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3592 }
3593}
3594
3595void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3596{
3597 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3598 return;
3599
3600 Unit* target = aurApp->GetTarget();
3602}
3603
3604void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3605{
3606 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3607 return;
3608
3609 Unit* target = aurApp->GetTarget();
3611
3612 // TODO: should be changed to a proc script on flag spell (they have "Taken positive" proc flags in db2)
3613 {
3614 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
3616
3617 // remove all flag auras (they are positive, but they must be removed when you are immune)
3621 }
3622
3623 if (apply)
3624 {
3627 }
3628 else
3629 {
3630 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3632 return;
3634 }
3635}
3636
3637void AuraEffect::HandleAuraModDmgImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3638{
3639 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3640 return;
3641
3642 Unit* target = aurApp->GetTarget();
3644
3645 if (apply)
3646 {
3649 }
3650 else
3651 {
3652 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3654 return;
3656 }
3657}
3658
3659void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3660{
3661 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3662 return;
3663
3664 Unit* target = aurApp->GetTarget();
3666}
3667
3668/*********************************************************/
3669/*** MODIFY STATS ***/
3670/*********************************************************/
3671
3672/********************************/
3673/*** RESISTANCE ***/
3674/********************************/
3675
3676void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3677{
3679 return;
3680
3681 Unit* target = aurApp->GetTarget();
3682
3683 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3684 if (GetMiscValue() & (1 << x))
3686}
3687
3688void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
3689{
3691 return;
3692
3693 Unit* target = aurApp->GetTarget();
3694
3695 // only players have base stats
3696 if (target->GetTypeId() != TYPEID_PLAYER)
3697 {
3698 //pets only have base armor
3699 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3700 {
3701 if (apply)
3703 else
3704 {
3706 target->SetStatPctModifier(UNIT_MOD_ARMOR, BASE_PCT, amount);
3707 }
3708 }
3709 }
3710 else
3711 {
3712 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3713 {
3714 if (GetMiscValue() & (1 << x))
3715 {
3716 if (apply)
3718 else
3719 {
3722 }
3723 }
3724 }
3725 }
3726}
3727
3728void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3729{
3731 return;
3732
3733 Unit* target = aurApp->GetTarget();
3734
3735 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3736 {
3737 if (GetMiscValue() & (1 << i))
3738 {
3741 continue;
3742
3744 }
3745 }
3746}
3747
3748void AuraEffect::HandleModBaseResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3749{
3751 return;
3752
3753 Unit* target = aurApp->GetTarget();
3754
3755 // only players have base stats
3756 if (target->GetTypeId() != TYPEID_PLAYER)
3757 {
3758 //pets only have base armor
3759 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3761 }
3762 else
3763 {
3764 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3765 if (GetMiscValue() & (1 << i))
3767 }
3768}
3769
3770void AuraEffect::HandleModTargetResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3771{
3773 return;
3774
3775 Player* target = aurApp->GetTarget()->ToPlayer();
3776 if (!target)
3777 return;
3778
3779 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
3780
3781 // show armor penetration
3784
3785 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
3787 target->ApplyModTargetResistance(GetAmountAsInt(), apply);
3788}
3789
3790/********************************/
3791/*** STAT ***/
3792/********************************/
3793
3794void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3795{
3797 return;
3798
3799 if (GetMiscValue() < -2 || GetMiscValue() > 4)
3800 {
3801 TC_LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
3802 return;
3803 }
3804
3805 Unit* target = aurApp->GetTarget();
3807 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3808 return;
3809
3810 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3811 {
3812 // -1 or -2 is all stats (misc < -2 checked in function beginning)
3813 if (GetMiscValue() < 0 || GetMiscValue() == i)
3814 {
3815 if (spellGroupVal)
3816 {
3817 target->HandleStatFlatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
3818 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3819 target->UpdateStatBuffMod(Stats(i));
3820 }
3821
3823 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3824 target->UpdateStatBuffMod(Stats(i));
3825 }
3826 }
3827}
3828
3829void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3830{
3832 return;
3833
3834 Unit* target = aurApp->GetTarget();
3835
3836 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3837 {
3838 TC_LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3839 return;
3840 }
3841
3842 // only players have base stats
3843 if (target->GetTypeId() != TYPEID_PLAYER)
3844 return;
3845
3846 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3847 {
3848 if (GetMiscValue() == i || GetMiscValue() == -1)
3849 {
3850 if (apply)
3852 else
3853 {
3854 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff) -> bool
3855 {
3856 if (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1)
3857 return true;
3858 return false;
3859 });
3861 }
3862 }
3863 }
3864}
3865
3866void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3867{
3869 return;
3870
3871 Unit* target = aurApp->GetTarget();
3872
3873 if (target->GetTypeId() != TYPEID_PLAYER)
3874 return;
3875
3876 // Magic damage modifiers implemented in Unit::SpellDamageBonus
3877 // This information for client side use only
3878 // Recalculate bonus
3880}
3881
3882void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3883{
3885 return;
3886
3887 Unit* target = aurApp->GetTarget();
3888
3889 if (target->GetTypeId() != TYPEID_PLAYER)
3890 return;
3891
3892 // Recalculate bonus
3894}
3895
3896void AuraEffect::HandleModHealingDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3897{
3899 return;
3900
3901 Unit* target = aurApp->GetTarget();
3902
3903 if (target->GetTypeId() != TYPEID_PLAYER)
3904 return;
3905 // implemented in Unit::SpellHealingBonus
3906 // this information is for client side only
3908}
3909
3910void AuraEffect::HandleModHealingDonePct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3911{
3913 return;
3914
3915 if (Player* player = aurApp->GetTarget()->ToPlayer())
3916 player->UpdateHealingDonePercentMod();
3917}
3918
3919void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3920{
3922 return;
3923
3924 Unit* target = aurApp->GetTarget();
3925
3926 // save current health state
3927 float healthPct = target->GetHealthPct();
3928 bool zeroHealth = !target->IsAlive();
3929
3930 // players in corpse state may mean two different states:
3933 if (target->getDeathState() == CORPSE)
3934 zeroHealth = (target->GetHealth() == 0);
3935
3936 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3937 {
3938 if (GetMiscValueB() & 1 << i || !GetMiscValueB()) // 0 is also used for all stats
3939 {
3940 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff) -> bool
3941 {
3942 if (aurEff->GetMiscValueB() & 1 << i || !aurEff->GetMiscValueB())
3943 return true;
3944 return false;
3945 });
3946
3947 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
3948 continue;
3949
3951 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3952 target->UpdateStatBuffMod(Stats(i));
3953 }
3954 }
3955
3956 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_ABILITY 0x00000010 flag)
3957 // this check is total bullshit i think
3959 target->SetHealth(std::max<uint32>(CalculatePct(target->GetMaxHealth(), healthPct), (zeroHealth ? 0 : 1)));
3960}
3961
3962void AuraEffect::HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3963{
3965 return;
3966
3967 Unit* target = aurApp->GetTarget();
3968
3969 if (target->GetTypeId() != TYPEID_PLAYER)
3970 return;
3971
3974}
3975
3976// Increase armor by <AuraEffect.BasePoints> % of your <primary stat>
3977void AuraEffect::HandleModArmorPctFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3978{
3980 return;
3981
3982 // only players have primary stats
3983 Player* player = aurApp->GetTarget()->ToPlayer();
3984 if (!player)
3985 return;
3986
3987 player->UpdateArmor();
3988}
3989
3990void AuraEffect::HandleModBonusArmor(AuraApplication const* aurApp, uint8 mode, bool apply) const
3991{
3993 return;
3994
3996}
3997
3998void AuraEffect::HandleModBonusArmorPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3999{
4001 return;
4002
4003 aurApp->GetTarget()->UpdateArmor();
4004}
4005
4006void AuraEffect::HandleModStatBonusPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4007{
4009 return;
4010
4011 Unit* target = aurApp->GetTarget();
4012
4013 if (GetMiscValue() < 0 || GetMiscValue() >= MAX_STATS)
4014 {
4015 TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_STAT_BONUS_PCT not valid");
4016 return;
4017 }
4018
4019 target->UpdateStats(Stats(GetMiscValue()));
4020}
4021
4023{
4025 return;
4026
4027 Player* target = aurApp->GetTarget()->ToPlayer();
4028 if (!target)
4029 return;
4030
4031 target->ApplyModOverrideSpellPowerByAPPercent(float(GetAmount()), apply);
4033}
4034
4036{
4038 return;
4039
4040 Player* target = aurApp->GetTarget()->ToPlayer();
4041 if (!target)
4042 return;
4043
4044 target->ApplyModOverrideAPBySpellPowerPercent(float(GetAmount()), apply);
4046 target->UpdateAttackPowerAndDamage(true);
4047}
4048
4049void AuraEffect::HandleModVersatilityByPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4050{
4052 return;
4053
4054 if (Player* target = aurApp->GetTarget()->ToPlayer())
4055 {
4056 target->SetVersatilityBonus(target->GetTotalAuraModifier(SPELL_AURA_MOD_VERSATILITY));
4057 target->UpdateHealingDonePercentMod();
4058 target->UpdateVersatilityDamageDone();
4059 }
4060}
4061
4062void AuraEffect::HandleAuraModMaxPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4063{
4065 return;
4066
4067 Unit* target = aurApp->GetTarget();
4068
4070
4071 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4072}
4073
4074void AuraEffect::HandleConvertCritToParry(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4075{
4077 return;
4078
4079 Player* target = aurApp->GetTarget()->ToPlayer();
4080 if (!target)
4081 return;
4082
4083 target->UpdateRating(CR_PARRY);
4084}
4085
4086/********************************/
4087/*** HEAL & ENERGIZE ***/
4088/********************************/
4089void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4090{
4092 return;
4093
4094 Unit* target = aurApp->GetTarget();
4095
4096 if (target->GetTypeId() != TYPEID_PLAYER)
4097 return;
4098
4099 target->ToPlayer()->UpdatePowerRegen(static_cast<Powers>(GetMiscValue()));
4100}
4101
4102void AuraEffect::HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
4103{
4104 HandleModPowerRegen(aurApp, mode, apply);
4105}
4106
4107void AuraEffect::HandleModManaRegenPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4108{
4110 return;
4111
4112 Unit* target = aurApp->GetTarget();
4113
4114 if (!target->IsPlayer())
4115 return;
4116
4118}
4119
4120void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
4121{
4123 return;
4124
4125 Unit* target = aurApp->GetTarget();
4126
4127 int32 const amt = apply ? GetAmountAsInt() : -GetAmountAsInt();
4128 if (amt < 0)
4129 target->ModifyHealth(std::max<int32>(1 - target->GetHealth(), amt));
4130
4132
4133 if (amt > 0)
4134 target->ModifyHealth(amt);
4135}
4136
4137void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
4138{
4140 return;
4141
4142 Unit* target = aurApp->GetTarget();
4143
4144 float percent = target->GetHealthPct();
4145
4147
4148 // refresh percentage
4149 if (target->GetHealth() > 0)
4150 {
4151 uint32 newHealth = std::max<uint32>(target->CountPctFromMaxHealth(int32(percent)), 1);
4152 target->SetHealth(newHealth);
4153 }
4154}
4155
4156void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4157{
4159 return;
4160
4161 Unit* target = aurApp->GetTarget();
4163
4164 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
4165}
4166
4168{
4170 return;
4171
4172 Unit* target = aurApp->GetTarget();
4173
4174 Powers powerType = Powers(GetMiscValue());
4176
4177 // Save old powers for further calculation
4178 int32 oldPower = target->GetPower(powerType);
4179 int32 oldMaxPower = target->GetMaxPower(powerType);
4180
4181 // Handle aura effect for max power
4182 if (apply)
4183 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, float(GetAmount()));
4184 else
4185 {
4186 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT, [powerType](AuraEffect const* aurEff) -> bool
4187 {
4188 if (aurEff->GetMiscValue() == powerType)
4189 return true;
4190 return false;
4191 });
4192
4193 amount *= target->GetTotalAuraMultiplier(SPELL_AURA_MOD_MAX_POWER_PCT, [powerType](AuraEffect const* aurEff) -> bool
4194 {
4195 if (aurEff->GetMiscValue() == powerType)
4196 return true;
4197 return false;
4198 });
4199
4200 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4201 }
4202
4203 // Calculate the current power change
4204 int32 change = target->GetMaxPower(powerType) - oldMaxPower;
4205 change = (oldPower + change) - target->GetPower(powerType);
4206 target->ModifyPower(powerType, change);
4207}
4208
4210{
4212 return;
4213
4214 Unit* target = aurApp->GetTarget();
4215
4216 // Unit will keep hp% after MaxHealth being modified if unit is alive.
4217 float percent = target->GetHealthPct();
4218 if (apply)
4220 else
4221 {
4225 }
4226
4227 if (target->GetHealth() > 0)
4228 {
4229 uint32 newHealth = std::max<uint32>(CalculatePct(target->GetMaxHealth(), percent), 1);
4230 target->SetHealth(newHealth);
4231 }
4232}
4233
4235{
4237 return;
4238
4239 Unit* target = aurApp->GetTarget();
4240
4241 if (apply)
4243 else
4244 {
4247 }
4248}
4249
4251{
4253 return;
4254
4255 Unit* target = aurApp->GetTarget();
4256
4257 if (apply)
4259 else
4260 {
4262 target->SetStatPctModifier(UNIT_MOD_MANA, BASE_PCT, amount);
4263 }
4264}
4265
4266void AuraEffect::HandleModManaCostPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
4267{
4269 return;
4270
4271 aurApp->GetTarget()->ApplyModManaCostMultiplier(GetAmount() / 100.0f, apply);
4272}
4273
4274void AuraEffect::HandleAuraModPowerDisplay(AuraApplication const* aurApp, uint8 mode, bool apply) const
4275{
4277 return;
4278
4279 if (GetMiscValue() >= MAX_POWERS)
4280 return;
4281
4282 if (apply)
4284
4285 aurApp->GetTarget()->UpdateDisplayPower();
4286}
4287
4289{
4290 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4291 return;
4292
4293 PowerDisplayEntry const* powerDisplay = sPowerDisplayStore.LookupEntry(GetMiscValue());
4294 if (!powerDisplay)
4295 return;
4296
4297 Unit* target = aurApp->GetTarget();
4298 if (target->GetPowerIndex(Powers(powerDisplay->ActualType)) >= MAX_POWERS_PER_CLASS)
4299 return;
4300
4301 if (apply)
4302 {
4304 target->SetOverrideDisplayPowerId(powerDisplay->ID);
4305 }
4306 else
4307 target->SetOverrideDisplayPowerId(0);
4308}
4309
4310void AuraEffect::HandleAuraModMaxPowerPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
4311{
4313 return;
4314
4315 Unit * target = aurApp->GetTarget();
4316 if (!target->IsPlayer())
4317 return;
4318
4319 Powers powerType = Powers(GetMiscValue());
4321
4322 // Save old powers for further calculation
4323 int32 oldPower = target->GetPower(powerType);
4324 int32 oldMaxPower = target->GetMaxPower(powerType);
4325
4326 // Handle aura effect for max power
4327 if (apply)
4328 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, float(GetAmount()));
4329 else
4330 {
4331 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_MAX_POWER_PCT, [powerType](AuraEffect const* aurEff) -> bool
4332 {
4333 if (aurEff->GetMiscValue() == powerType)
4334 return true;
4335 return false;
4336 });
4337
4338 amount *= target->GetTotalAuraMultiplier(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT, [powerType](AuraEffect const* aurEff) -> bool
4339 {
4340 if (aurEff->GetMiscValue() == powerType)
4341 return true;
4342 return false;
4343 });
4344
4345 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
4346 }
4347
4348 // Calculate the current power change
4349 int32 change = target->GetMaxPower(powerType) - oldMaxPower;
4350 change = (oldPower + change) - target->GetPower(powerType);
4351 target->ModifyPower(powerType, change);
4352}
4353
4355{
4356 if (!(mode & AURA_EFFECT_HANDLE_REAL) || !apply)
4357 return;
4358
4359 Unit* target = aurApp->GetTarget();
4360 SpellEffectValue thresholdPct = GetAmount();
4361 uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell;
4362
4364 {
4366 if (!target->HealthAbovePct(thresholdPct))
4367 return;
4368 break;
4370 if (!target->HealthBelowPct(thresholdPct))
4371 return;
4372 break;
4373 default:
4374 break;
4375 }
4376
4377 target->CastSpell(target, triggerSpell, this);
4378}
4379
4380/********************************/
4381/*** FIGHT ***/
4382/********************************/
4383
4384void AuraEffect::HandleAuraModParryPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4385{
4387 return;
4388
4389 Unit* target = aurApp->GetTarget();
4390
4391 if (target->GetTypeId() != TYPEID_PLAYER)
4392 return;
4393
4394 target->ToPlayer()->UpdateParryPercentage();
4395}
4396
4397void AuraEffect::HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4398{
4400 return;
4401
4402 Unit* target = aurApp->GetTarget();
4403
4404 if (target->GetTypeId() != TYPEID_PLAYER)
4405 return;
4406
4407 target->ToPlayer()->UpdateDodgePercentage();
4408}
4409
4410void AuraEffect::HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4411{
4413 return;
4414
4415 Unit* target = aurApp->GetTarget();
4416
4417 if (target->GetTypeId() != TYPEID_PLAYER)
4418 return;
4419
4420 target->ToPlayer()->UpdateBlockPercentage();
4421}
4422
4423void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4424{
4426 return;
4427
4428 Unit* target = aurApp->GetTarget();
4429
4430 if (!target->IsPlayer())
4431 return;
4432
4434}
4435
4436void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4437{
4439 return;
4440
4441 Player* target = aurApp->GetTarget()->ToPlayer();
4442 if (!target)
4443 return;
4444
4446}
4447
4448void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
4449{
4451 return;
4452
4453 Unit* target = aurApp->GetTarget();
4454
4455 if (target->GetTypeId() == TYPEID_PLAYER)
4456 target->ToPlayer()->UpdateSpellHitChances();
4457 else
4458 target->m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
4459}
4460
4461void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
4462{
4464 return;
4465
4466 Unit* target = aurApp->GetTarget();
4467
4468 if (target->GetTypeId() == TYPEID_PLAYER)
4469 target->ToPlayer()->UpdateSpellCritChance();
4470 else
4471 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
4472}
4473
4474void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
4475{
4477 return;
4478
4479 Unit* target = aurApp->GetTarget();
4480
4481 if (target->GetTypeId() != TYPEID_PLAYER)
4482 {
4483 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
4484 return;
4485 }
4486
4488
4489 // included in Player::UpdateSpellCritChance calculation
4490 target->ToPlayer()->UpdateSpellCritChance();
4491}
4492
4493/********************************/
4494/*** ATTACK SPEED ***/
4495/********************************/
4496
4497void AuraEffect::HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
4498{
4500 return;
4501
4502 Unit* target = aurApp->GetTarget();
4503
4504 // Do not apply such auras in normal way
4505 if (GetAmount() >= 1000)
4506 {
4507 if (apply)
4508 target->SetInstantCast(true);
4509 else
4510 {
4511 // only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount
4512 // it's some rare case that you have 2 auras like that, but just in case ;)
4513
4514 bool remove = true;
4515 Unit::AuraEffectList const& castingSpeedNotStack = target->GetAuraEffectsByType(SPELL_AURA_MOD_CASTING_SPEED);
4516 for (AuraEffect const* aurEff : castingSpeedNotStack)
4517 {
4518 if (aurEff != this && aurEff->GetAmount() >= 1000)
4519 {
4520 remove = false;
4521 break;
4522 }
4523 }
4524
4525 if (remove)
4526 target->SetInstantCast(false);
4527 }
4528
4529 return;
4530 }
4531
4533 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4534 return;
4535
4536 if (spellGroupVal)
4537 {
4538 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4539 target->ApplySpellHastePercentMod(float(spellGroupVal), !apply);
4540 }
4541
4542 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4543 target->ApplySpellHastePercentMod(float(GetAmount()), apply);
4544}
4545
4546void AuraEffect::HandleModMeleeHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4547{
4549 return;
4550
4551 Unit* target = aurApp->GetTarget();
4553 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4554 return;
4555
4556 if (spellGroupVal)
4557 {
4558 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4559 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4560 target->ApplyHasteRegenPercentMod(float(spellGroupVal), !apply);
4561 }
4562 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4563 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4564 target->ApplyHasteRegenPercentMod(float(GetAmount()), apply);
4565}
4566
4567void AuraEffect::HandleModRangedHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4568{
4570 return;
4571
4572 Unit* target = aurApp->GetTarget();
4573
4574 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4575 target->ApplyHasteRegenPercentMod(float(GetAmount()), apply);
4576}
4577
4578void AuraEffect::HandleModMeleeRangedHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4579{
4581 return;
4582
4583 Unit* target = aurApp->GetTarget();
4584
4585 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4586 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4587 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4588 target->ApplyHasteRegenPercentMod(float(GetAmount()), apply);
4589}
4590
4591void AuraEffect::HandleModMeleeRangedCastingHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4592{
4594 return;
4595
4596 Unit* target = aurApp->GetTarget();
4598 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4599 return;
4600
4601 if (spellGroupVal)
4602 {
4603 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
4604 target->ApplySpellHastePercentMod(float(spellGroupVal), !apply);
4605 target->ApplyHasteRegenPercentMod(float(spellGroupVal), !apply);
4606 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4607 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4608 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
4609 }
4610 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4611 target->ApplySpellHastePercentMod(float(GetAmount()), apply);
4612 target->ApplyHasteRegenPercentMod(float(GetAmount()), apply);
4613 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4614 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4615 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4616}
4617
4618void AuraEffect::HandleModMeleeSlowNoStack(AuraApplication const* aurApp, uint8 mode, bool apply) const
4619{
4621 return;
4622
4623 Unit* target = aurApp->GetTarget();
4624 float minOtherValue = target->GetMaxNegativeAuraModifier(GetAuraType(), [this](AuraEffect const* aurEff) { return aurEff != this; });
4625 if (GetAmount() >= minOtherValue)
4626 return;
4627
4628 if (minOtherValue)
4629 {
4630 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(minOtherValue), !apply);
4631 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(minOtherValue), !apply);
4632 }
4633
4634 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4635 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4636}
4637
4638void AuraEffect::HandleModRangedSlowNoStack(AuraApplication const* aurApp, uint8 mode, bool apply) const
4639{
4641 return;
4642
4643 Unit* target = aurApp->GetTarget();
4644 float minOtherValue = target->GetMaxNegativeAuraModifier(GetAuraType(), [this](AuraEffect const* aurEff) { return aurEff != this; });
4645 if (GetAmount() >= minOtherValue)
4646 return;
4647
4648 if (minOtherValue)
4649 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(minOtherValue), !apply);
4650
4651 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4652}
4653
4654void AuraEffect::HandleModSpellSlowNoStack(AuraApplication const* aurApp, uint8 mode, bool apply) const
4655{
4657 return;
4658
4659 Unit* target = aurApp->GetTarget();
4660 float minOtherValue = target->GetMaxNegativeAuraModifier(GetAuraType(), [this](AuraEffect const* aurEff) { return aurEff != this; });
4661 if (GetAmount() >= minOtherValue)
4662 return;
4663
4664 if (minOtherValue)
4665 {
4666 target->ApplyCastTimePercentMod(float(minOtherValue), !apply);
4667 target->ApplySpellHastePercentMod(float(minOtherValue), !apply);
4668 }
4669
4670 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4671 target->ApplySpellHastePercentMod(float(GetAmount()), apply);
4672}
4673
4674void AuraEffect::HandleModCastingSlowNoStack(AuraApplication const* aurApp, uint8 mode, bool apply) const
4675{
4677 return;
4678
4679 Unit* target = aurApp->GetTarget();
4680 float minOtherValue = target->GetMaxNegativeAuraModifier(GetAuraType(), [this](AuraEffect const* aurEff) { return aurEff != this; });
4681 if (GetAmount() >= minOtherValue)
4682 return;
4683
4684 if (minOtherValue)
4685 target->ApplyCastTimePercentMod(float(minOtherValue), !apply);
4686
4687 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4688}
4689
4691{
4693 return;
4694
4695 Unit* target = aurApp->GetTarget();
4696 float minOtherValue = target->GetMaxNegativeAuraModifier(GetAuraType(), [this](AuraEffect const* aurEff) { return aurEff != this; });
4697 if (GetAmount() >= minOtherValue)
4698 return;
4699
4700 if (minOtherValue)
4701 {
4702 target->ApplyCastTimePercentMod(float(minOtherValue), !apply);
4703 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(minOtherValue), !apply);
4704 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(minOtherValue), !apply);
4705 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(minOtherValue), !apply);
4706 }
4707
4708 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
4709 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4710 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4711 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4712}
4713
4714void AuraEffect::HandleModMeleeHasteNoRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const
4715{
4717 return;
4718
4719 Unit* target = aurApp->GetTarget();
4720 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4721 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4722}
4723
4724void AuraEffect::HandleModRangedHasteNoRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const
4725{
4727 return;
4728
4729 Unit* target = aurApp->GetTarget();
4730 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4731}
4732
4733void AuraEffect::HandleModMeleeRangedHasteNoRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const
4734{
4736 return;
4737
4738 Unit* target = aurApp->GetTarget();
4739 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4740 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4741 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
4742}
4743
4744void AuraEffect::HandleModAttackSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
4745{
4747 return;
4748
4749 Unit* target = aurApp->GetTarget();
4750
4751 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4753}
4754
4755/********************************/
4756/*** COMBAT RATING ***/
4757/********************************/
4758
4759void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool apply) const
4760{
4762 return;
4763
4764 Unit* target = aurApp->GetTarget();
4765
4766 if (target->GetTypeId() != TYPEID_PLAYER)
4767 return;
4768
4769 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4770 if (GetMiscValue() & (1 << rating))
4771 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmountAsInt(), apply);
4772}
4773
4774void AuraEffect::HandleModRatingPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4775{
4777 return;
4778
4779 Unit* target = aurApp->GetTarget();
4780
4781 if (target->GetTypeId() != TYPEID_PLAYER)
4782 return;
4783
4784 // Just recalculate ratings
4785 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4786 if (GetMiscValue() & (1 << rating))
4787 target->ToPlayer()->UpdateRating(CombatRating(rating));
4788}
4789
4790/********************************/
4791/*** ATTACK POWER ***/
4792/********************************/
4793
4794void AuraEffect::HandleAuraModAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4795{
4797 return;
4798
4799 Unit* target = aurApp->GetTarget();
4800
4802}
4803
4804void AuraEffect::HandleAuraModRangedAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4805{
4807 return;
4808
4809 Unit* target = aurApp->GetTarget();
4810
4811 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4812 return;
4813
4815}
4816
4817void AuraEffect::HandleAuraModAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
4818{
4820 return;
4821
4822 Unit* target = aurApp->GetTarget();
4823
4825}
4826
4828{
4830 return;
4831
4832 Unit* target = aurApp->GetTarget();
4833
4834 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4835 return;
4836
4838}
4839
4840/********************************/
4841/*** DAMAGE BONUS ***/
4842/********************************/
4843void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const
4844{
4846 return;
4847
4848 Unit* target = aurApp->GetTarget();
4849
4851 target->UpdateAllDamageDoneMods();
4852
4853 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonusDone
4854 // This information for client side use only
4855 if (Player* playerTarget = target->ToPlayer())
4856 {
4857 for (uint16 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
4858 if (GetMiscValue() & (1 << i))
4859 {
4860 if (GetAmountAsInt() >= 0)
4861 playerTarget->ApplyModDamageDonePos(SpellSchools(i), GetAmountAsInt(), apply);
4862 else
4863 playerTarget->ApplyModDamageDoneNeg(SpellSchools(i), GetAmountAsInt(), apply);
4864 }
4865
4866 if (Guardian* pet = playerTarget->GetGuardianPet())
4867 pet->UpdateAttackPowerAndDamage();
4868 }
4869}
4870
4871void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4872{
4874 return;
4875
4876 Unit* target = aurApp->GetTarget();
4877
4878 // also handles spell group stacks
4881
4882 if (Player* thisPlayer = target->ToPlayer())
4883 {
4884 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
4885 {
4886 if (GetMiscValue() & (1 << i))
4887 {
4888 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
4889 float amount = thisPlayer->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, 1 << i);
4890 thisPlayer->SetModDamageDonePercent(i, amount);
4891 }
4892 }
4893 }
4894}
4895
4896void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4897{
4899 return;
4900
4901 Unit* target = aurApp->GetTarget();
4902
4903 // also handles spell group stacks
4905}
4906
4907void AuraEffect::HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mode, bool apply) const
4908{
4910 return;
4911
4912 if (Player* player = aurApp->GetTarget()->ToPlayer())
4913 player->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
4914}
4915
4916void AuraEffect::HandleShieldBlockValuePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
4917{
4919 return;
4920
4921 Player* target = aurApp->GetTarget()->ToPlayer();
4922 if (!target)
4923 return;
4924
4925 if (apply)
4927 else
4928 {
4930 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
4931 }
4932}
4933
4934/********************************/
4935/*** POWER COST ***/
4936/********************************/
4937
4938void AuraEffect::HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, bool apply) const
4939{
4941 return;
4942
4943 // handled in SpellInfo::CalcPowerCost, this is only for client UI
4944 if (!(GetMiscValueB() & (1 << POWER_MANA)))
4945 return;
4946
4947 Unit* target = aurApp->GetTarget();
4948
4949 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4950 if (GetMiscValue() & (1 << i))
4952}
4953
4954void AuraEffect::HandleArenaPreparation(AuraApplication const* aurApp, uint8 mode, bool apply) const
4955{
4956 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4957 return;
4958
4959 Unit* target = aurApp->GetTarget();
4960
4961 if (apply)
4963 else
4964 {
4965 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4966 if (target->HasAuraType(GetAuraType()))
4967 return;
4969 }
4970
4972}
4973
4974void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4975{
4976 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4977 return;
4978
4979 Unit* target = aurApp->GetTarget();
4980
4981 if (target->GetTypeId() != TYPEID_PLAYER)
4982 return;
4983
4984 flag128 mask;
4986 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
4987 mask |= (*i)->GetSpellEffectInfo().SpellClassMask;
4988
4989 target->ToPlayer()->SetNoRegentCostMask(mask);
4990}
4991
4992/*********************************************************/
4993/*** OTHERS ***/
4994/*********************************************************/
4995
4996void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4997{
4999 return;
5000
5001 Unit* target = aurApp->GetTarget();
5002
5003 Unit* caster = GetCaster();
5004
5005 // pet auras
5006 if (target->GetTypeId() == TYPEID_PLAYER && (mode & AURA_EFFECT_HANDLE_REAL))
5007 {
5008 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), GetEffIndex()))
5009 {
5010 if (apply)
5011 target->ToPlayer()->AddPetAura(petSpell);
5012 else
5013 target->ToPlayer()->RemovePetAura(petSpell);
5014 }
5015 }
5016
5018 {
5019 // AT APPLY
5020 if (apply)
5021 {
5022 switch (GetId())
5023 {
5024 case 1515: // Tame beast
5025 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
5026 if (caster && target->CanHaveThreatList())
5027 target->GetThreatManager().AddThreat(caster, 10.0f);
5028 break;
5029 case 13139: // net-o-matic
5030 // root to self part of (root_target->charge->root_self sequence
5031 if (caster)
5032 caster->CastSpell(caster, 13138, this);
5033 break;
5034 case 34026: // kill command
5035 {
5036 Unit* pet = target->GetGuardianPet();
5037 if (!pet)
5038 break;
5039
5040 target->CastSpell(target, 34027, this);
5041
5042 // set 3 stacks and 3 charges (to make all auras not disappear at once)
5043 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
5044 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
5045 if (owner_aura)
5046 {
5047 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5048 if (pet_aura)
5049 {
5050 pet_aura->SetCharges(0);
5051 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
5052 }
5053 }
5054 break;
5055 }
5056 case 37096: // Blood Elf Illusion
5057 {
5058 if (caster)
5059 {
5060 if (caster->GetGender() == GENDER_FEMALE)
5061 caster->CastSpell(target, 37095, this); // Blood Elf Disguise
5062 else
5063 caster->CastSpell(target, 37093, this);
5064 }
5065 break;
5066 }
5067 case 39850: // Rocket Blast
5068 if (roll_chance(20)) // backfire stun
5069 target->CastSpell(target, 51581, this);
5070 break;
5071 case 43873: // Headless Horseman Laugh
5072 target->PlayDistanceSound(11965);
5073 break;
5074 case 46354: // Blood Elf Illusion
5075 if (caster)
5076 {
5077 if (caster->GetGender() == GENDER_FEMALE)
5078 caster->CastSpell(target, 46356, this);
5079 else
5080 caster->CastSpell(target, 46355, this);
5081 }
5082 break;
5083 case 46361: // Reinforced Net
5084 if (caster)
5085 target->GetMotionMaster()->MoveFall();
5086 break;
5087 }
5088 }
5089 // AT REMOVE
5090 else
5091 {
5093 {
5095 switch (GetId())
5096 {
5097 case 43681: // Inactive
5098 {
5099 if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5100 return;
5101
5102 if (target->GetMap()->IsBattleground())
5103 target->ToPlayer()->LeaveBattleground();
5104 break;
5105 }
5106 case 46308: // Burning Winds cast only at creatures at spawn
5107 target->CastSpell(target, 47287, this);
5108 break;
5109 case 52172: // Coyote Spirit Despawn Aura
5110 case 60244: // Blood Parrot Despawn Aura
5111 target->CastSpell(nullptr, GetAmountAsInt(), this);
5112 break;
5113 case 91604: // Restricted Flight Area
5114 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
5115 target->CastSpell(target, 58601, this);
5116 break;
5117 }
5118 break;
5120 // Summon Gargoyle (Dismiss Gargoyle at remove)
5121 if (GetId() == 61777)
5122 target->CastSpell(target, GetAmountAsInt(), this);
5123 break;
5124 default:
5125 break;
5126 }
5127 }
5128 }
5129
5130 // AT APPLY & REMOVE
5131
5133 {
5135 {
5136 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5137 break;
5138 switch (GetId())
5139 {
5140 // Recently Bandaged
5141 case 11196:
5143 break;
5144 // Unstable Power
5145 case 24658:
5146 {
5147 uint32 spellId = 24659;
5148 if (apply && caster)
5149 {
5150 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId, GetBase()->GetCastDifficulty());
5151 CastSpellExtraArgs args;
5154 args.OriginalCastId = GetBase()->GetCastId();
5156
5157 for (uint32 i = 0; i < spell->StackAmount; ++i)
5158 caster->CastSpell(target, spell->Id, args);
5159 break;
5160 }
5161 target->RemoveAurasDueToSpell(spellId);
5162 break;
5163 }
5164 // Restless Strength
5165 case 24661:
5166 {
5167 uint32 spellId = 24662;
5168 if (apply && caster)
5169 {
5170 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId, GetBase()->GetCastDifficulty());
5171 CastSpellExtraArgs args;
5174 args.OriginalCastId = GetBase()->GetCastId();
5176
5177 for (uint32 i = 0; i < spell->StackAmount; ++i)
5178 caster->CastSpell(target, spell->Id, args);
5179 break;
5180 }
5181 target->RemoveAurasDueToSpell(spellId);
5182 break;
5183 }
5184 // Tag Murloc
5185 case 30877:
5186 {
5187 // Tag/untag Blacksilt Scout
5188 target->SetEntry(apply ? 17654 : 17326);
5189 break;
5190 }
5191 case 57819: // Argent Champion
5192 case 57820: // Ebon Champion
5193 case 57821: // Champion of the Kirin Tor
5194 case 57822: // Wyrmrest Champion
5195 {
5196 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5197 break;
5198
5199 uint32 FactionID = 0;
5200
5201 if (apply)
5202 {
5203 switch (m_spellInfo->Id)
5204 {
5205 case 57819: FactionID = 1106; break; // Argent Crusade
5206 case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
5207 case 57821: FactionID = 1090; break; // Kirin Tor
5208 case 57822: FactionID = 1091; break; // The Wyrmrest Accord
5209 }
5210 }
5211 caster->ToPlayer()->SetChampioningFaction(FactionID);
5212 break;
5213 }
5214 // LK Intro VO (1)
5215 case 58204:
5216 if (target->GetTypeId() == TYPEID_PLAYER)
5217 {
5218 // Play part 1
5219 if (apply)
5220 target->PlayDirectSound(14970, target->ToPlayer());
5221 // continue in 58205
5222 else
5223 target->CastSpell(target, 58205, this);
5224 }
5225 break;
5226 // LK Intro VO (2)
5227 case 58205:
5228 if (target->GetTypeId() == TYPEID_PLAYER)
5229 {
5230 // Play part 2
5231 if (apply)
5232 target->PlayDirectSound(14971, target->ToPlayer());
5233 // Play part 3
5234 else
5235 target->PlayDirectSound(14972, target->ToPlayer());
5236 }
5237 break;
5238 }
5239
5240 break;
5241 }
5242 case SPELLFAMILY_MAGE:
5243 {
5244 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5245 //break;
5246 break;
5247 }
5248 case SPELLFAMILY_PRIEST:
5249 {
5250 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5251 //break;
5252 break;
5253 }
5254 case SPELLFAMILY_DRUID:
5255 {
5256 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5257 //break;
5258 break;
5259 }
5260 case SPELLFAMILY_SHAMAN:
5261 {
5262 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5263 //break;
5264 break;
5265 }
5267 // if (!(mode & AURA_EFFECT_HANDLE_REAL))
5268 // break;
5269 break;
5271 {
5272 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
5273 // break;
5274 break;
5275 }
5276 }
5277}
5278
5279void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mode, bool apply) const
5280{
5281 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5282 return;
5283
5284 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
5285 return;
5286
5287 Unit* caster = GetCaster();
5288
5289 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5290 return;
5291
5292 Player* plCaster = caster->ToPlayer();
5293 Unit* target = aurApp->GetTarget();
5294
5295 // Item amount
5296 if (GetAmountAsInt() <= 0)
5297 return;
5298
5299 if (GetSpellEffectInfo().ItemType == 0)
5300 return;
5301
5302 // Soul Shard
5303 if (GetSpellEffectInfo().ItemType == 6265)
5304 {
5305 // Soul Shard only from units that grant XP or honor
5306 if (!plCaster->isHonorOrXPTarget(target) ||
5307 (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
5308 return;
5309 }
5310
5311 //Adding items
5312 uint32 noSpaceForCount = 0;
5313 uint32 count = GetAmountAsInt();
5314
5315 ItemPosCountVec dest;
5316 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellEffectInfo().ItemType, count, &noSpaceForCount);
5317 if (msg != EQUIP_ERR_OK)
5318 {
5319 count -= noSpaceForCount;
5320 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellEffectInfo().ItemType);
5321 if (count == 0)
5322 return;
5323 }
5324
5325 if (Item* newitem = plCaster->StoreNewItem(dest, GetSpellEffectInfo().ItemType, true))
5326 plCaster->SendNewItem(newitem, count, true, true);
5327}
5328
5329void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
5330{
5331 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5332 return;
5333
5334 Unit* target = aurApp->GetTarget();
5335
5336 Unit* caster = GetCaster();
5337
5338 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
5339 return;
5340
5341 caster->ToPlayer()->SetViewpoint(target, apply);
5342}
5343
5344void AuraEffect::HandleForceReaction(AuraApplication const* aurApp, uint8 mode, bool apply) const
5345{
5347 return;
5348
5349 Unit* target = aurApp->GetTarget();
5350
5351 Player* player = target->ToPlayer();
5352 if (!player)
5353 return;
5354
5355 uint32 factionId = GetMiscValue();
5357
5358 player->GetReputationMgr().ApplyForceReaction(factionId, factionRank, apply);
5359
5360 // stop fighting at apply (if forced rank friendly) or at remove (if real rank friendly)
5361 if ((apply && factionRank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(factionId) >= REP_FRIENDLY))
5362 player->StopAttackFaction(factionId);
5363}
5364
5365void AuraEffect::HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bool apply) const
5366{
5367 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5368 return;
5369
5370 Unit* target = aurApp->GetTarget();
5371 if (!apply)
5372 {
5373 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
5374 if (target->HasAuraType(GetAuraType()))
5375 return;
5376 }
5377
5378 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
5379 {
5380 if (apply)
5382 else
5384 }
5385}
5386
5387void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode, bool apply) const
5388{
5389 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5390 return;
5391
5392 Unit* target = aurApp->GetTarget();
5393
5394 if (apply)
5395 {
5396 target->SetFaction(GetMiscValue());
5397 if (target->GetTypeId() == TYPEID_PLAYER)
5399 }
5400 else
5401 {
5402 target->RestoreFaction();
5403 if (target->GetTypeId() == TYPEID_PLAYER)
5405 }
5406}
5407
5408void AuraEffect::HandleLearnSpell(AuraApplication const* aurApp, uint8 mode, bool apply) const
5409{
5410 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5411 return;
5412
5413 Player* player = aurApp->GetTarget()->ToPlayer();
5414 if (!player)
5415 return;
5416
5417 if (apply)
5418 player->LearnSpell(GetMiscValue(), true, 0, true);
5419 else
5420 player->RemoveSpell(GetMiscValue(), false, false, true);
5421}
5422
5423void AuraEffect::HandleComprehendLanguage(AuraApplication const* aurApp, uint8 mode, bool apply) const
5424{
5426 return;
5427
5428 Unit* target = aurApp->GetTarget();
5429
5430 if (apply)
5432 else
5433 {
5434 if (target->HasAuraType(GetAuraType()))
5435 return;
5436
5438 }
5439}
5440
5442{
5444 return;
5445
5446 Unit* target = aurApp->GetTarget();
5447
5448 if (apply)
5450 else
5451 {
5452 if (target->HasAuraType(GetAuraType()))
5453 return;
5454
5456 }
5457}
5458
5459void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const
5460{
5461 Unit* target = aurApp->GetTarget();
5462
5463 uint32 triggeredSpellId = GetSpellEffectInfo().TriggerSpell;
5464 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId, GetBase()->GetCastDifficulty());
5465 if (!triggeredSpellInfo)
5466 return;
5467
5468 if (mode & AURA_EFFECT_HANDLE_REAL)
5469 {
5470 if (apply)
5471 {
5472 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
5473 if (!caster)
5474 return;
5475
5476 CastSpellExtraArgs args(this);
5477 if (GetAmount()) // If amount avalible cast with basepoints (Crypt Fever for example)
5479
5480 caster->CastSpell(target, triggeredSpellId, args);
5481 }
5482 else
5483 {
5484 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
5485 target->RemoveAura(triggeredSpellId, casterGUID);
5486 }
5487 }
5488 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
5489 {
5490 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
5491 // change the stack amount to be equal to stack amount of our aura
5492 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
5493 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
5494 }
5495}
5496
5497void AuraEffect::HandleTriggerSpellOnPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
5498{
5499 if (!(mode & AURA_EFFECT_HANDLE_REAL) || !apply)
5500 return;
5501
5502 Unit* target = aurApp->GetTarget();
5503
5504 SpellEffectValue effectAmount = GetAmount();
5505 uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell;
5506 int32 maxPower = target->GetMaxPower(Powers(GetMiscValue()));
5507 if (!maxPower)
5508 return;
5509
5510 float powerAmountPct = GetPctOf(target->GetPower(Powers(GetMiscValue())), maxPower);
5511
5513 {
5515 if (powerAmountPct < effectAmount)
5516 return;
5517 break;
5519 if (powerAmountPct > effectAmount)
5520 return;
5521 break;
5522 default:
5523 break;
5524 }
5525
5526 target->CastSpell(target, triggerSpell, this);
5527}
5528
5529void AuraEffect::HandleTriggerSpellOnPowerAmount(AuraApplication const* aurApp, uint8 mode, bool apply) const
5530{
5531 if (!(mode & AURA_EFFECT_HANDLE_REAL) || !apply)
5532 return;
5533
5534 Unit* target = aurApp->GetTarget();
5535
5536 SpellEffectValue effectAmount = GetAmount();
5537 uint32 triggerSpell = GetSpellEffectInfo().TriggerSpell;
5538 float powerAmount = target->GetPower(Powers(GetMiscValue()));
5539
5541 {
5543 if (powerAmount < effectAmount)
5544 return;
5545 break;
5547 if (powerAmount > effectAmount)
5548 return;
5549 break;
5550 default:
5551 break;
5552 }
5553
5554 target->CastSpell(target, triggerSpell, this);
5555}
5556
5557void AuraEffect::HandleTriggerSpellOnExpire(AuraApplication const* aurApp, uint8 mode, bool apply) const
5558{
5559 if (!(mode & AURA_EFFECT_HANDLE_REAL) || apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
5560 return;
5561
5562 Unit* caster = aurApp->GetTarget();
5563
5564 // MiscValue (Caster):
5565 // 0 - Aura target
5566 // 1 - Aura caster
5567 // 2 - ? Aura target is always TARGET_UNIT_CASTER so we consider the same behavior as MiscValue 1
5568 uint32 casterType = uint32(GetMiscValue());
5569 if (casterType > 0)
5570 caster = GetCaster();
5571
5572 if (caster)
5573 caster->CastSpell(aurApp->GetTarget(), GetSpellEffectInfo().TriggerSpell, this);
5574}
5575
5576void AuraEffect::HandleAuraOpenStable(AuraApplication const* aurApp, uint8 mode, bool apply) const
5577{
5578 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5579 return;
5580
5581 Unit* target = aurApp->GetTarget();
5582
5583 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
5584 return;
5585
5586 if (apply)
5587 target->ToPlayer()->SetStableMaster(target->GetGUID());
5588
5589 // client auto close stable dialog at !apply aura
5590}
5591
5592void AuraEffect::HandleAuraModFakeInebriation(AuraApplication const* aurApp, uint8 mode, bool apply) const
5593{
5595 return;
5596
5597 Player* target = aurApp->GetTarget()->ToPlayer();
5598 if (!target)
5599 return;
5600
5601 target->ApplyModFakeDrunkValue(GetAmountAsInt(), apply);
5603}
5604
5605void AuraEffect::HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 mode, bool apply) const
5606{
5607 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5608 return;
5609
5610 Player* target = aurApp->GetTarget()->ToPlayer();
5611
5612 if (!target || !target->IsInWorld())
5613 return;
5614
5615 uint32 overrideId = uint32(GetMiscValue());
5616
5617 if (apply)
5618 {
5619 target->SetOverrideSpellsId(overrideId);
5620 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5621 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5622 if (uint32 spellId = overrideSpells->Spells[i])
5623 target->AddTemporarySpell(spellId);
5624 }
5625 else
5626 {
5627 target->SetOverrideSpellsId(0);
5628 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
5629 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
5630 if (uint32 spellId = overrideSpells->Spells[i])
5631 target->RemoveTemporarySpell(spellId);
5632 }
5633}
5634
5635void AuraEffect::HandleAuraPreventRegeneratePower(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
5636{
5638 return;
5639
5640 Unit* target = aurApp->GetTarget();
5641
5642 if (target->GetTypeId() != TYPEID_PLAYER)
5643 return;
5644
5645 for (Powers power : target->GetPowerTypes())
5646 if (GetMiscValue() & (1 << power))
5647 target->ToPlayer()->UpdatePowerRegen(power);
5648}
5649
5650void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const
5651{
5652 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5653 return;
5654
5655 Unit* target = aurApp->GetTarget();
5656
5657 if (!target->IsInWorld())
5658 return;
5659
5660 uint32 vehicleId = GetMiscValue();
5661
5662 target->RemoveVehicleKit();
5663
5664 if (apply)
5665 {
5666 if (!target->CreateVehicleKit(vehicleId, 0))
5667 return;
5668 }
5669 else
5670 {
5671 if (Creature* creature = target->ToCreature())
5672 if (uint32 originalVehicleId = creature->GetCreatureTemplate()->VehicleId)
5673 creature->CreateVehicleKit(originalVehicleId, creature->GetEntry());
5674 }
5675
5676 if (target->GetTypeId() != TYPEID_PLAYER)
5677 return;
5678
5679 if (apply)
5681}
5682
5683void AuraEffect::HandleSetVignette(AuraApplication const* aurApp, uint8 mode, bool apply) const
5684{
5685 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5686 return;
5687
5688 aurApp->GetTarget()->SetVignette(apply ? GetMiscValue() : 0);
5689}
5690
5691void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const
5692{
5693 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5694 return;
5695
5696 Player* target = aurApp->GetTarget()->ToPlayer();
5697 if (!target)
5698 return;
5699
5700 if (apply)
5702 else if (!target->GetMap()->Instanceable())
5704}
5705
5706void AuraEffect::HandleMastery(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
5707{
5708 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5709 return;
5710
5711 Player* target = aurApp->GetTarget()->ToPlayer();
5712 if (!target)
5713 return;
5714
5715 target->UpdateMastery();
5716}
5717
5719{
5720 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5721 if (triggerSpellId == 0)
5722 {
5723 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5724 return;
5725 }
5726
5727 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
5728 {
5729 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5730 {
5731 triggerCaster->CastSpell(target, triggerSpellId, CastSpellExtraArgsInit{
5733 .TriggeringAura = this
5734 });
5735 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5736 }
5737 }
5738 else
5739 TC_LOG_ERROR("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5740}
5741
5743{
5744 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5745 if (triggerSpellId == 0)
5746 {
5747 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5748 return;
5749 }
5750
5751 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
5752 {
5753 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5754 {
5755 CastSpellExtraArgs args(this);
5757 for (std::size_t i = 0; i < triggeredSpellInfo->GetEffects().size(); ++i)
5759 triggerCaster->CastSpell(target, triggerSpellId, args);
5760 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5761 }
5762 }
5763 else
5764 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5765}
5766
5768{
5769 if (!target->IsAlive())
5770 return;
5771
5772 if (target->IsImmunedToDamage(caster, GetSpellInfo(), &GetSpellEffectInfo()))
5773 {
5774 SendTickImmune(target, caster);
5775 return;
5776 }
5777
5778 // Consecrate ticks can miss and will not show up in the combat log
5779 // dynobj auras must always have a caster
5781 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false, true) != SPELL_MISS_NONE)
5782 return;
5783
5785
5787
5788 // ignore negative values (can be result apply spellmods to aura damage
5789 uint32 damage = std::max(GetAmountAsInt(), 0);
5790
5791 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5792 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5793
5794 switch (GetAuraType())
5795 {
5797 {
5798 if (caster)
5799 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5800 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5801
5802 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
5803 {
5804 switch (GetId())
5805 {
5806 case 70911: // Unbound Plague
5807 case 72854: // Unbound Plague
5808 case 72855: // Unbound Plague
5809 case 72856: // Unbound Plague
5810 damage *= uint32(pow(1.25f, int32(_ticksDone)));
5811 break;
5812 default:
5813 break;
5814 }
5815 }
5816 break;
5817 }
5819 {
5821
5822 damage = CalculatePct(caster->CalculateDamage(attackType, false, true), GetAmount());
5823
5824 // Add melee damage bonuses (also check for negative)
5825 if (caster)
5826 damage = caster->MeleeDamageBonusDone(target, damage, attackType, DOT, GetSpellInfo(), &GetSpellEffectInfo(), GetSpellEffectInfo().Mechanic, GetSpellInfo()->GetSchoolMask(), nullptr, this);
5827
5828 damage = target->MeleeDamageBonusTaken(caster, damage, attackType, DOT, GetSpellInfo());
5829 break;
5830 }
5832 // ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
5833 damage = uint32(ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
5834 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5835 break;
5836 default:
5837 break;
5838 }
5839
5840 bool crit = roll_chance(GetCritChanceFor(caster, target));
5841 if (crit)
5842 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5843
5844 // Calculate armor mitigation
5845 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5846 {
5847 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5848 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5849 damage = damageReducedArmor;
5850 }
5851
5853 {
5854 if (GetSpellEffectInfo().IsTargetingArea() || GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA) || GetSpellInfo()->HasAttribute(SPELL_ATTR5_TREAT_AS_AREA_EFFECT) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE))
5855 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE));
5856 }
5857
5858 int32 dmg = damage;
5859 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS) && caster && caster->CanApplyResilience())
5860 Unit::ApplyResilience(target, &dmg);
5861 damage = dmg;
5862
5863 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, BASE_ATTACK);
5864 Unit::CalcAbsorbResist(damageInfo);
5865 damage = damageInfo.GetDamage();
5866
5867 uint32 absorb = damageInfo.GetAbsorb();
5868 uint32 resist = damageInfo.GetResist();
5869 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} absorb is {}",
5870 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5871
5872 Unit::DealDamageMods(caster, target, damage, &absorb);
5873
5874 // Set trigger flag
5877 ProcFlagsHit hitMask = damageInfo.GetHitMask();
5878 if (damage)
5879 {
5880 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5881 procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
5882 }
5883
5884 int32 overkill = damage - target->GetHealth();
5885 if (overkill < 0)
5886 overkill = 0;
5887
5888 SpellPeriodicAuraLogInfo pInfo(this, damage, dmg, overkill, absorb, resist, 0.0f, crit);
5889
5890 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
5891
5892 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5893
5894 target->SendPeriodicAuraLog(&pInfo);
5895}
5896
5898{
5899 if (!target->IsAlive())
5900 return;
5901
5902 if (target->IsImmunedToDamage(caster, GetSpellInfo(), &GetSpellEffectInfo()))
5903 {
5904 SendTickImmune(target, caster);
5905 return;
5906 }
5907
5908 // dynobj auras must always have a caster
5910 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false, true) != SPELL_MISS_NONE)
5911 return;
5912
5913 CleanDamage cleanDamage = CleanDamage(0, 0, GetSpellInfo()->GetAttackType(), MELEE_HIT_NORMAL);
5914
5916
5917 // ignore negative values (can be result apply spellmods to aura damage
5918 uint32 damage = std::max(GetAmountAsInt(), 0);
5919
5920 if (caster)
5921 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5922 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5923
5924 bool crit = roll_chance(GetCritChanceFor(caster, target));
5925 if (crit)
5926 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5927
5928 // Calculate armor mitigation
5929 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5930 {
5931 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5932 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5933 damage = damageReducedArmor;
5934 }
5935
5937 {
5938 if (GetSpellEffectInfo().IsTargetingArea() || GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA) || GetSpellInfo()->HasAttribute(SPELL_ATTR5_TREAT_AS_AREA_EFFECT) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE))
5939 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, (caster && !caster->IsControlledByPlayer()) || GetSpellInfo()->HasAttribute(SPELL_ATTR7_TREAT_AS_NPC_AOE));
5940 }
5941
5942 int32 dmg = damage;
5943 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_IGNORE_DAMAGE_TAKEN_MODIFIERS) && caster && caster->CanApplyResilience())
5944 Unit::ApplyResilience(target, &dmg);
5945 damage = dmg;
5946
5947 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, GetSpellInfo()->GetAttackType());
5948 Unit::CalcAbsorbResist(damageInfo);
5949
5950 uint32 absorb = damageInfo.GetAbsorb();
5951 uint32 resist = damageInfo.GetResist();
5952 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
5953 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5954
5955 Unit::DealDamageMods(caster, target, damage, &absorb);
5956
5957 // SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
5958 SpellNonMeleeDamage log(caster, target, GetSpellInfo(), GetBase()->GetSpellVisual(), GetSpellInfo()->GetSchoolMask(), GetBase()->GetCastId());
5959 log.damage = damage;
5960 log.originalDamage = dmg;
5961 log.absorb = absorb;
5962 log.resist = resist;
5963 log.periodicLog = true;
5964 if (crit)
5966
5967 // Set trigger flag
5970 ProcFlagsHit hitMask = damageInfo.GetHitMask();
5971 if (damage)
5972 {
5973 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5974 procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
5975 }
5976
5977 int32 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
5978 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5979
5980 // process caster heal from now on (must be in world)
5981 if (!caster || !caster->IsAlive())
5982 return;
5983
5984 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5985
5986 uint32 heal = caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
5987 heal = caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
5988
5989 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5990 caster->HealBySpell(healInfo);
5991
5992 caster->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5994
5995 caster->SendSpellNonMeleeDamageLog(&log);
5996}
5997
5999{
6000 if (!caster || !caster->IsAlive() || !target->IsAlive())
6001 return;
6002
6003 if (target->IsImmunedToAuraPeriodicTick(caster, this))
6004 {
6005 SendTickImmune(target, caster);
6006 return;
6007 }
6008
6009 uint32 damage = std::max(GetAmountAsInt(), 0);
6010 // do not kill health donator
6011 if (caster->GetHealth() < damage)
6012 damage = caster->GetHealth() - 1;
6013 if (!damage)
6014 return;
6015
6016 caster->ModifyHealth(-(int32)damage);
6017 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
6018
6019 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
6020
6021 damage = int32(damage * gainMultiplier);
6022
6023 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6024 caster->HealBySpell(healInfo);
6026}
6027
6029{
6030 if (!target->IsAlive())
6031 return;
6032
6033 if (target->IsImmunedToAuraPeriodicTick(caster, this))
6034 {
6035 SendTickImmune(target, caster);
6036 return;
6037 }
6038
6039 // don't regen when permanent aura target has full power
6040 if (GetBase()->IsPermanent() && target->IsFullHealth())
6041 return;
6042
6044
6045 // ignore negative values (can be result apply spellmods to aura damage
6046 uint32 damage = std::max(GetAmountAsInt(), 0);
6047
6049 damage = uint32(target->CountPctFromMaxHealth(damage));
6050 else if (caster)
6051 damage = caster->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), stackAmountForBonuses, nullptr, this);
6052
6053 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT);
6054
6055 bool crit = roll_chance(GetCritChanceFor(caster, target));
6056 if (crit)
6057 damage = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, damage, target);
6058
6059 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
6060 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
6061
6062 uint32 heal = damage;
6063
6064 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
6065 Unit::CalcHealAbsorb(healInfo);
6066 Unit::DealHeal(healInfo);
6067
6068 SpellPeriodicAuraLogInfo pInfo(this, heal, damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
6069 target->SendPeriodicAuraLog(&pInfo);
6070
6071 if (caster)
6072 target->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
6073
6074 // %-based heal - does not proc auras
6076 return;
6077
6081 // ignore item heals
6082 if (GetBase()->GetCastItemGUID().IsEmpty())
6083 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_HEAL, PROC_SPELL_PHASE_HIT, hitMask, nullptr, nullptr, &healInfo);
6084}
6085
6087{
6088 Powers powerType = Powers(GetMiscValue());
6089
6090 if (!caster || !caster->IsAlive() || !target->IsAlive() || target->GetPowerType() != powerType)
6091 return;
6092
6093 if (target->IsImmunedToAuraPeriodicTick(caster, this))
6094 {
6095 SendTickImmune(target, caster);
6096 return;
6097 }
6098
6100 caster->SpellHitResult(target, GetSpellInfo(), false, true) != SPELL_MISS_NONE)
6101 return;
6102
6103 // ignore negative values (can be result apply spellmods to aura damage
6104 int32 drainAmount = std::max(GetAmountAsInt(), 0);
6105
6106 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
6107 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
6108
6109 int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
6110
6111 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
6112
6113 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, drainAmount, 0, 0, 0, gainMultiplier, false);
6114
6115 int32 gainAmount = int32(drainedAmount * gainMultiplier);
6116 int32 gainedAmount = 0;
6117 if (gainAmount)
6118 {
6119 gainedAmount = caster->ModifyPower(powerType, gainAmount);
6120 // energize is not modified by threat modifiers
6121 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_NO_HELPFUL_THREAT))
6122 target->GetThreatManager().AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo(), true);
6123 }
6124
6125 // Drain Mana - Mana Feed effect
6127 {
6128 SpellEffectValue manaFeedVal = 0;
6129 if (AuraEffect const* aurEff = GetBase()->GetEffect(EFFECT_1))
6130 manaFeedVal = aurEff->GetAmount();
6131
6132 if (manaFeedVal > 0)
6133 {
6134 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
6135
6136 CastSpellExtraArgs args(this);
6137 args.AddSpellMod(SPELLVALUE_BASE_POINT0, feedAmount);
6138 caster->CastSpell(caster, 32554, args);
6139 }
6140 }
6141
6142 target->SendPeriodicAuraLog(&pInfo);
6143}
6144
6146{
6147 Powers powerType = Powers(GetMiscValue());
6148
6149 if (!target->IsAlive() || !target->GetMaxPower(powerType))
6150 return;
6151
6152 if (target->IsImmunedToAuraPeriodicTick(caster, this))
6153 {
6154 SendTickImmune(target, caster);
6155 return;
6156 }
6157
6158 // don't regen when permanent aura and limit is already reached
6159 if (GetBase()->IsPermanent())
6160 {
6161 if (GetAmount() >= 0)
6162 {
6163 if (target->GetPower(powerType) >= target->GetMaxPower(powerType))
6164 return;
6165 }
6166 else
6167 if (target->GetPower(powerType) <= target->GetMinPower(powerType))
6168 return;
6169 }
6170
6171 int32 amount = CalculatePct(target->GetMaxPower(powerType), GetAmount());
6172 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6173 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6174
6175 SpellPeriodicAuraLogInfo pInfo(this, amount, amount, 0, 0, 0, 0.0f, false);
6176 int32 gain = target->ModifyPower(powerType, amount);
6177
6178 if (caster)
6179 target->GetThreatManager().ForwardThreatForAssistingMe(caster, std::abs(float(gain) * 0.5f), GetSpellInfo(), true);
6180
6181 target->SendPeriodicAuraLog(&pInfo);
6182}
6183
6185{
6186 Powers powerType = Powers(GetMiscValue());
6187 if (!target->IsAlive() || !target->GetMaxPower(powerType))
6188 return;
6189
6190 if (target->IsImmunedToAuraPeriodicTick(caster, this))
6191 {
6192 SendTickImmune(target, caster);
6193 return;
6194 }
6195
6196 // don't regen when permanent aura target has full power
6197 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
6198 return;
6199
6200 // ignore negative values (can be result apply spellmods to aura damage
6201 int32 amount = std::max(GetAmountAsInt(), 0);
6202
6203 SpellPeriodicAuraLogInfo pInfo(this, amount, amount, 0, 0, 0, 0.0f, false);
6204
6205 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
6206 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
6207
6208 int32 gain = target->ModifyPower(powerType, amount);
6209 target->SendPeriodicAuraLog(&pInfo);
6210
6211 if (caster)
6212 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
6213}
6214
6216{
6217 Powers powerType = Powers(GetMiscValue());
6218
6219 if (!caster || !target->IsAlive() || target->GetPowerType() != powerType)
6220 return;
6221
6222 if (target->IsImmunedToDamage(caster, GetSpellInfo(), &GetSpellEffectInfo()))
6223 {
6224 SendTickImmune(target, caster);
6225 return;
6226 }
6227
6228 // ignore negative values (can be result apply spellmods to aura damage
6229 int32 damage = std::max(GetAmountAsInt(), 0);
6230
6231 uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
6232
6233 float dmgMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
6234
6235 SpellInfo const* spellProto = GetSpellInfo();
6236 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6237 SpellNonMeleeDamage damageInfo(caster, target, spellProto, GetBase()->GetSpellVisual(), spellProto->SchoolMask, GetBase()->GetCastId());
6238 damageInfo.periodicLog = true;
6239 // no SpellDamageBonus for burn mana
6240 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
6241
6242 Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6243
6244 // Set trigger flag
6247 ProcFlagsHit hitMask = createProcHitMask(&damageInfo, SPELL_MISS_NONE);
6249 if (damageInfo.damage)
6250 {
6251 procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
6252 spellTypeMask |= PROC_SPELL_TYPE_DAMAGE;
6253 }
6254
6255 caster->DealSpellDamage(&damageInfo, true);
6256
6257 DamageInfo dotDamageInfo(damageInfo, DOT, BASE_ATTACK, hitMask);
6258 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, spellTypeMask, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &dotDamageInfo, nullptr);
6259
6260 caster->SendSpellNonMeleeDamageLog(&damageInfo);
6261}
6262
6264{
6265 if (!caster || !GetBase()->CanPeriodicTickCrit())
6266 return 0.0f;
6267
6268 Player* modOwner = caster->GetSpellModOwner();
6269 if (!modOwner)
6270 return 0.0f;
6271
6272 float critChance = modOwner->SpellCritChanceDone(nullptr, this, GetSpellInfo()->GetSchoolMask(), GetSpellInfo()->GetAttackType());
6273 return std::max(0.0f, critChance);
6274}
6275
6277{
6278 SpellEffectValue const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
6279
6280 if (damageLeft <= 0)
6281 aurApp->GetTarget()->RemoveAura(aurApp);
6282 else
6283 ChangeAmount(damageLeft);
6284}
6285
6287{
6288 Unit* triggerCaster = aurApp->GetTarget();
6289 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6291 triggerTarget = eventInfo.GetActor();
6292
6293 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
6294 if (triggerSpellId == 0)
6295 {
6296 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
6297 return;
6298 }
6299
6300 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
6301 {
6302 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
6303 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo->Id, CastSpellExtraArgs(this)
6304 .SetTriggeringSpell(eventInfo.GetProcSpell())
6306 }
6307 else if (triggerSpellId && GetAuraType() != SPELL_AURA_DUMMY)
6308 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
6309}
6310
6312{
6313 Unit* triggerCaster = aurApp->GetTarget();
6314 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6316 triggerTarget = eventInfo.GetActor();
6317
6318 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
6319 if (triggerSpellId == 0)
6320 {
6321 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
6322 return;
6323 }
6324
6325 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId, GetBase()->GetCastDifficulty()))
6326 {
6327 CastSpellExtraArgs args(this);
6329 args.SetTriggeringSpell(eventInfo.GetProcSpell());
6331 triggerCaster->CastSpell(triggerTarget, triggerSpellId, args);
6332 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, GetAmount(), GetId());
6333 }
6334 else
6335 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
6336}
6337
6339{
6340 Unit* target = aurApp->GetTarget();
6341 Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
6342 if (triggerTarget->IsImmunedToDamage(target, GetSpellInfo(), &GetSpellEffectInfo()))
6343 {
6344 SendTickImmune(triggerTarget, target);
6345 return;
6346 }
6347
6348 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetSpellInfo(), GetBase()->GetSpellVisual(), GetSpellInfo()->SchoolMask, GetBase()->GetCastId());
6349 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmountAsInt(), SPELL_DIRECT_DAMAGE, GetSpellEffectInfo(), 1, nullptr, this);
6350 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
6351 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
6352 Unit::DealDamageMods(damageInfo.attacker, damageInfo.target, damageInfo.damage, &damageInfo.absorb);
6353 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
6354 target->DealSpellDamage(&damageInfo, true);
6355 target->SendSpellNonMeleeDamageLog(&damageInfo);
6356}
6357
6358void AuraEffect::HandleAuraForceWeather(AuraApplication const* aurApp, uint8 mode, bool apply) const
6359{
6360 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6361 return;
6362
6363 Player* target = aurApp->GetTarget()->ToPlayer();
6364
6365 if (!target)
6366 return;
6367
6368 if (apply)
6370 else
6371 target->GetMap()->SendZoneWeather(target->GetZoneId(), target);
6372}
6373
6374void AuraEffect::HandleEnableAltPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
6375{
6376 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6377 return;
6378
6379 uint32 altPowerId = GetMiscValue();
6380 UnitPowerBarEntry const* powerEntry = sUnitPowerBarStore.LookupEntry(altPowerId);
6381 if (!powerEntry)
6382 return;
6383
6384 if (apply)
6385 aurApp->GetTarget()->SetMaxPower(POWER_ALTERNATE_POWER, powerEntry->MaxPower);
6386 else
6388}
6389
6390void AuraEffect::HandleModGravity(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
6391{
6392 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6393 return;
6394
6395 Unit* target = aurApp->GetTarget();
6397 float amount = std::transform_reduce(gravityAuras.begin(), gravityAuras.end(), 1.0f, std::multiplies(),
6398 [](AuraEffect const* aurEff) { return aurEff->GetAmount(); });
6399
6400 target->SetGravityModifier(std::max(amount, 0.01f));
6401}
6402
6403void AuraEffect::HandleModSpellCategoryCooldown(AuraApplication const* aurApp, uint8 mode, bool apply) const
6404{
6405 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6406 return;
6407
6408 Player* target = aurApp->GetTarget()->ToPlayer();
6409 if (!target)
6410 return;
6411
6412 if (apply)
6414 else
6416}
6417
6418void AuraEffect::HandleModRecoveryRate(AuraApplication const* aurApp, uint8 mode, bool apply) const
6419{
6421 return;
6422
6423 float rate = 100.0f / (std::max<float>(GetAmount(), -99.0f) + 100.0f);
6424
6426 {
6427 return IsAffectingSpell(sSpellMgr->GetSpellInfo(cooldown.SpellId, DIFFICULTY_NONE));
6428 }, rate, apply);
6429}
6430
6432{
6434 return;
6435
6436 float rate = 100.0f / (std::max<float>(GetAmount(), -99.0f) + 100.0f);
6437
6439 {
6440 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(cooldown.SpellId, DIFFICULTY_NONE);
6441 return spellInfo->HasLabel(GetMiscValue()) || (GetMiscValueB() && spellInfo->HasLabel(GetMiscValueB()));
6442 }, rate, apply);
6443}
6444
6445void AuraEffect::HandleModChargeRecoveryRate(AuraApplication const* aurApp, uint8 mode, bool apply) const
6446{
6448 return;
6449
6450 float rate = 100.0f / (std::max<float>(GetAmount(), -99.0f) + 100.0f);
6451 aurApp->GetTarget()->GetSpellHistory()->UpdateChargeRecoveryRate(GetMiscValue(), rate, apply);
6452}
6453
6454void AuraEffect::HandleShowConfirmationPrompt(AuraApplication const* aurApp, uint8 mode, bool apply) const
6455{
6456 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6457 return;
6458
6459 Player* player = aurApp->GetTarget()->ToPlayer();
6460 if (!player)
6461 return;
6462
6463 if (apply)
6464 player->AddTemporarySpell(GetSpellEffectInfo().TriggerSpell);
6465 else
6466 player->RemoveTemporarySpell(GetSpellEffectInfo().TriggerSpell);
6467}
6468
6469void AuraEffect::HandleOverridePetSpecs(AuraApplication const* aurApp, uint8 mode, bool apply) const
6470{
6471 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6472 return;
6473
6474 Player* player = aurApp->GetTarget()->ToPlayer();
6475 if (!player)
6476 return;
6477
6478 if (player->GetClass() != CLASS_HUNTER)
6479 return;
6480
6481 Pet* pet = player->GetPet();
6482 if (!pet)
6483 return;
6484
6485 ChrSpecializationEntry const* currSpec = sChrSpecializationStore.LookupEntry(pet->GetSpecialization());
6486 if (!currSpec)
6487 return;
6488
6489 pet->SetSpecialization(sDB2Manager.GetChrSpecializationByIndex(apply ? PET_SPEC_OVERRIDE_CLASS_INDEX : 0, currSpec->OrderIndex)->ID);
6490}
6491
6493{
6494 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6495 return;
6496
6497 Player* target = aurApp->GetTarget()->ToPlayer();
6498 if (!target)
6499 return;
6500
6501 if (apply)
6505}
6506
6507void AuraEffect::HandlePlayScene(AuraApplication const* aurApp, uint8 mode, bool apply) const
6508{
6509 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6510 return;
6511
6512 Player* player = aurApp->GetTarget()->ToPlayer();
6513 if (!player)
6514 return;
6515
6516 if (apply)
6517 player->GetSceneMgr().PlayScene(GetMiscValue());
6518 else
6519 {
6520 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
6521 {
6522 if (Optional<uint32> sceneInstanceId = player->GetSceneMgr().GetInstanceIdBySceneId(GetMiscValue()))
6523 player->GetSceneMgr().OnSceneComplete(*sceneInstanceId);
6524 }
6526 }
6527}
6528
6529void AuraEffect::HandleCreateAreaTrigger(AuraApplication const* aurApp, uint8 mode, bool apply) const
6530{
6531 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6532 return;
6533
6534 Unit* target = aurApp->GetTarget();
6535
6536 if (apply)
6537 {
6538 AreaTriggerCreatePropertiesId createPropertiesId = { uint32(GetMiscValue()), false };
6539 Position pos = { target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() }; // drop orientation for attached areatrigger
6540 AreaTrigger::CreateAreaTrigger(createPropertiesId, pos, GetBase()->GetDuration(), GetCaster(), target, GetBase()->GetSpellVisual(), GetSpellInfo(), nullptr, this);
6541 }
6542 else
6543 {
6544 if (Unit* caster = GetCaster())
6545 caster->RemoveAreaTrigger(this);
6546 }
6547}
6548
6549void AuraEffect::HandleAuraPvpTalents(AuraApplication const* auraApp, uint8 mode, bool apply) const
6550{
6551 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6552 return;
6553
6554 if (Player* target = auraApp->GetTarget()->ToPlayer())
6555 {
6556 if (apply)
6557 target->TogglePvpTalents(true);
6558 else if (!target->HasAuraType(SPELL_AURA_PVP_TALENTS))
6559 target->TogglePvpTalents(false);
6560 }
6561}
6562
6563void AuraEffect::HandleLinkedSummon(AuraApplication const* aurApp, uint8 mode, bool apply) const
6564{
6565 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6566 return;
6567
6568 Unit* target = aurApp->GetTarget();
6569 SpellInfo const* triggerSpellInfo = sSpellMgr->GetSpellInfo(GetSpellEffectInfo().TriggerSpell, GetBase()->GetCastDifficulty());
6570 if (!triggerSpellInfo)
6571 return;
6572
6573 // on apply cast summon spell
6574 if (apply)
6575 {
6576 CastSpellExtraArgs args(this);
6577 args.CastDifficulty = triggerSpellInfo->Difficulty;
6578 target->CastSpell(target, triggerSpellInfo->Id, args);
6579 }
6580 // on unapply we need to search for and remove the summoned creature
6581 else
6582 {
6583 std::vector<uint32> summonedEntries;
6584 for (SpellEffectInfo const& spellEffect : triggerSpellInfo->GetEffects())
6585 if (spellEffect.IsEffect(SPELL_EFFECT_SUMMON))
6586 if (uint32 summonEntry = spellEffect.MiscValue)
6587 summonedEntries.push_back(summonEntry);
6588
6589 // we don't know if there can be multiple summons for the same effect, so consider only 1 summon for each effect
6590 // 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
6591 for (uint32 summonEntry : summonedEntries)
6592 {
6593 std::list<Creature*> nearbyEntries;
6594 target->GetCreatureListWithEntryInGrid(nearbyEntries, summonEntry);
6595 for (auto creature : nearbyEntries)
6596 {
6597 if (creature->GetOwnerGUID() == target->GetGUID())
6598 {
6599 creature->DespawnOrUnsummon();
6600 break;
6601 }
6602 else if (TempSummon* tempSummon = creature->ToTempSummon())
6603 {
6604 if (tempSummon->GetSummonerGUID() == target->GetGUID())
6605 {
6606 tempSummon->DespawnOrUnsummon();
6607 break;
6608 }
6609 }
6610 }
6611 }
6612 }
6613}
6614
6615void AuraEffect::HandleSetFFAPvP(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
6616{
6617 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6618 return;
6619
6620 Player* target = aurApp->GetTarget()->ToPlayer();
6621 if (!target)
6622 return;
6623
6624 target->UpdatePvPState(true);
6625}
6626
6627void AuraEffect::HandleModOverrideZonePVPType(AuraApplication const* aurApp, uint8 mode, bool apply) const
6628{
6629 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6630 return;
6631
6632 Player* target = aurApp->GetTarget()->ToPlayer();
6633 if (!target)
6634 return;
6635
6636 if (apply)
6640 else
6642
6643 target->UpdateHostileAreaState(sAreaTableStore.LookupEntry(target->GetZoneId()));
6644 target->UpdatePvPState();
6645}
6646
6647void AuraEffect::HandleBattlegroundPlayerPosition(AuraApplication const* aurApp, uint8 mode, bool apply) const
6648{
6649 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6650 return;
6651
6652 Player* target = aurApp->GetTarget()->ToPlayer();
6653 if (!target)
6654 return;
6655
6656 if (!apply && aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
6657 {
6658 if (GetCasterGUID().IsGameObject())
6659 {
6660 if (GameObjectTemplate const* gobTemplate = sObjectMgr->GetGameObjectTemplate(GetCasterGUID().GetEntry()))
6661 {
6662 if (gobTemplate->type == GAMEOBJECT_TYPE_NEW_FLAG)
6663 {
6664 if (GameObject* gameObjectCaster = target->GetMap()->GetGameObject(GetCasterGUID()))
6665 {
6666 gameObjectCaster->HandleCustomTypeCommand(GameObjectType::SetNewFlagState(FlagState::Dropped, target));
6667 if (GameObject* droppedFlag = gameObjectCaster->SummonGameObject(gameObjectCaster->GetGOInfo()->newflag.FlagDrop, target->GetPosition(), QuaternionData::fromOrientation(target->GetOrientation()), Seconds(gameObjectCaster->GetGOInfo()->newflag.ExpireDuration / 1000), GO_SUMMON_TIMED_DESPAWN))
6668 droppedFlag->SetOwnerGUID(gameObjectCaster->GetGUID());
6669 }
6670 }
6671 else if (gobTemplate->type == GAMEOBJECT_TYPE_FLAGSTAND)
6672 {
6673 if (ZoneScript* zonescript = target->FindZoneScript())
6674 zonescript->OnFlagDropped(GetCasterGUID(), target);
6675 }
6676 }
6677 }
6678 }
6679
6680 BattlegroundMap* battlegroundMap = target->GetMap()->ToBattlegroundMap();
6681 if (!battlegroundMap)
6682 return;
6683
6684 Battleground* bg = battlegroundMap->GetBG();
6685 if (!bg)
6686 return;
6687
6688 if (apply)
6689 {
6691 playerPosition.Guid = target->GetGUID();
6692 playerPosition.ArenaSlot = static_cast<int8>(GetMiscValue());
6693 playerPosition.Pos = target->GetPosition();
6694
6699 else
6700 TC_LOG_WARN("spell.auras", "Unknown aura effect {} handled by HandleBattlegroundPlayerPosition.", GetAuraType());
6701
6702 bg->AddPlayerPosition(playerPosition);
6703 }
6704 else
6705 bg->RemovePlayerPosition(target->GetGUID());
6706}
6707
6708void AuraEffect::HandleStoreTeleportReturnPoint(AuraApplication const* aurApp, uint8 mode, bool apply) const
6709{
6710 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6711 return;
6712
6713 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6714 if (!playerTarget)
6715 return;
6716
6717 if (apply)
6718 playerTarget->AddStoredAuraTeleportLocation(GetSpellInfo()->Id);
6719 else if (!playerTarget->GetSession()->isLogingOut())
6721}
6722
6723void AuraEffect::HandleMountRestrictions(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
6724{
6725 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6726 return;
6727
6728 aurApp->GetTarget()->UpdateMountCapability();
6729}
6730
6731void AuraEffect::HandleCosmeticMounted(AuraApplication const* aurApp, uint8 mode, bool apply) const
6732{
6733 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6734 return;
6735
6736 if (apply)
6738 else
6739 aurApp->GetTarget()->SetCosmeticMountDisplayId(0); // set cosmetic mount to 0, even if multiple auras are active; tested with zandalari racial + divine steed
6740
6741 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6742 if (!playerTarget)
6743 return;
6744
6746}
6747
6749{
6750 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6751 return;
6752
6753 Player* playerTarget = aurApp->GetTarget()->ToPlayer();
6754 if (!playerTarget)
6755 return;
6756
6757 if (apply)
6759 else
6760 {
6761 int32 mountCapabilityFlags = 0;
6762 for (AuraEffect* otherAura : playerTarget->GetAuraEffectsByType(GetAuraType()))
6763 mountCapabilityFlags |= otherAura->GetMiscValue();
6764
6765 playerTarget->ReplaceAllRequiredMountCapabilityFlags(mountCapabilityFlags);
6766 }
6767}
6768
6770{
6771 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6772 return;
6773
6774 std::vector<Aura*> suppressedAuras;
6775 for (Unit::AuraMap::value_type const& appliedAura : aurApp->GetTarget()->GetOwnedAuras())
6776 if (appliedAura.second->GetSpellInfo()->HasLabel(GetMiscValue()))
6777 suppressedAuras.push_back(appliedAura.second);
6778
6779 // Refresh applications
6780 for (Aura* aura : suppressedAuras)
6781 aura->ApplyForTargets();
6782}
6783
6784void AuraEffect::HandleAuraActAsControlZone(AuraApplication const* aurApp, uint8 mode, bool apply) const
6785{
6786 if (!(mode & AURA_EFFECT_HANDLE_REAL))
6787 return;
6788
6789 Unit* auraOwner = aurApp->GetTarget();
6790 if (!apply)
6791 {
6792 auraOwner->RemoveGameObject(GetSpellInfo()->Id, true);
6793 return;
6794 }
6795
6796 GameObjectTemplate const* gameobjectTemplate = sObjectMgr->GetGameObjectTemplate(GetMiscValue());
6797 if (!gameobjectTemplate)
6798 {
6799 TC_LOG_WARN("spells.aura.effect", "AuraEffect::HanldeAuraActAsControlZone: Spell {} [EffectIndex: {}] does not have an existing gameobject template.", GetId(), GetEffIndex());
6800 return;
6801 }
6802
6803 if (gameobjectTemplate->type != GAMEOBJECT_TYPE_CONTROL_ZONE)
6804 {
6805 TC_LOG_WARN("spells.aura.effect", "AuraEffect::HanldeAuraActAsControlZone: Spell {} [EffectIndex: {}] has a gameobject template ({}) that is not a control zone.", GetId(), GetEffIndex(), gameobjectTemplate->entry);
6806 return;
6807 }
6808
6809 if (gameobjectTemplate->displayId)
6810 {
6811 TC_LOG_WARN("spell.aura.effect", "AuraEffect::HanldeAuraActAsControlZone: Spell {} [EffectIndex: {}] has a gameobject template ({}) that has a display id. Only invisible gameobjects are supported.", GetId(), GetEffIndex(), gameobjectTemplate->entry);
6812 return;
6813 }
6814
6815 if (GameObject* controlZone = auraOwner->SummonGameObject(gameobjectTemplate->entry, auraOwner->GetPosition(), QuaternionData::fromOrientation(aurApp->GetTarget()->GetOrientation()), 24h, GO_SUMMON_TIMED_OR_CORPSE_DESPAWN))
6816 controlZone->SetSpellId(GetSpellInfo()->Id);
6817}
6818
6819template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
6820template TC_GAME_API void AuraEffect::GetTargetList(std::deque<Unit*>&) const;
6821template TC_GAME_API void AuraEffect::GetTargetList(std::vector<Unit*>&) const;
6822
6823template TC_GAME_API void AuraEffect::GetApplicationList(std::list<AuraApplication*>&) const;
6824template TC_GAME_API void AuraEffect::GetApplicationList(std::deque<AuraApplication*>&) const;
6825template TC_GAME_API void AuraEffect::GetApplicationList(std::vector<AuraApplication*>&) const;
@ PLAYER_POSITION_ICON_ALLIANCE_FLAG
@ PLAYER_POSITION_ICON_HORDE_FLAG
@ CHARM_TYPE_CHARM
Definition CharmInfo.h:69
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:70
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:72
@ IN_MILLISECONDS
Definition Common.h:38
T GetEntry(std::unordered_map< uint32, T > const &map, CriteriaTreeEntry const *tree)
DB2Storage< OverrideSpellDataEntry > sOverrideSpellDataStore("OverrideSpellData.db2", &OverrideSpellDataLoadInfo::Instance)
DB2Storage< UnitPowerBarEntry > sUnitPowerBarStore("UnitPowerBar.db2", &UnitPowerBarLoadInfo::Instance)
DB2Storage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore("SpellShapeshiftForm.db2", &SpellShapeshiftFormLoadInfo::Instance)
DB2Storage< MountEquipmentEntry > sMountEquipmentStore("MountEquipment.db2", &MountEquipmentLoadInfo::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:579
#define MAX_SHAPESHIFT_SPELLS
#define MAX_OVERRIDE_SPELL
@ MountEquipmentEffectsSuppressed
@ DIFFICULTY_NONE
Definition DBCEnums.h:936
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
#define UI64LIT(N)
Definition Define.h:139
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
#define ASSERT_NOTNULL(pointer)
Definition Errors.h:74
#define ASSERT
Definition Errors.h:72
InventoryResult
Definition ItemDefines.h:25
@ EQUIP_ERR_OK
Definition ItemDefines.h:26
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:173
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:182
#define TC_LOG_WARN(filterType__, message__,...)
Definition Log.h:179
@ GO_SUMMON_TIMED_DESPAWN
@ GO_SUMMON_TIMED_OR_CORPSE_DESPAWN
@ TYPEID_UNIT
Definition ObjectGuid.h:43
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define sObjectMgr
Definition ObjectMgr.h:1873
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:98
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:48
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:730
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:731
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:827
PlayerFieldByte2Flags
Definition Player.h:590
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:592
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:593
std::unordered_map< uint32, PlayerSpell > PlayerSpellMap
Definition Player.h:351
constexpr uint8 INVENTORY_SLOT_BAG_0
Definition Player.h:706
@ PLAYER_FLAGS_GHOST
Definition Player.h:516
@ SPELLMOD_END
Definition Player.h:182
@ PLAYERSPELL_REMOVED
Definition Player.h:208
@ PLAYER_LOCAL_FLAG_CAN_USE_OBJECTS_MOUNTED
Definition Player.h:573
@ PLAYER_LOCAL_FLAG_TRACK_STEALTHED
Definition Player.h:566
@ PLAYER_LOCAL_FLAG_RELEASE_TIMER
Definition Player.h:567
ZonePVPTypeOverride
Definition Player.h:1198
@ RACE_TROLL
Definition RaceMask.h:37
@ RACE_UNDEAD_PLAYER
Definition RaceMask.h:34
@ RACE_ORC
Definition RaceMask.h:31
@ RACE_DRAENEI
Definition RaceMask.h:40
@ RACE_NIGHTELF
Definition RaceMask.h:33
@ RACE_BLOODELF
Definition RaceMask.h:39
@ RACE_DWARF
Definition RaceMask.h:32
@ RACE_GNOME
Definition RaceMask.h:36
@ RACE_HUMAN
Definition RaceMask.h:30
@ RACE_TAUREN
Definition RaceMask.h:35
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define sScriptMgr
Definition ScriptMgr.h:1449
@ SERVERSIDE_VISIBILITY_GHOST
@ EFFECT_3
@ EFFECT_1
@ EFFECT_0
@ EFFECT_4
@ EFFECT_2
@ SPELL_ATTR10_ROLLING_PERIODIC
#define MAX_STATS
#define MAX_POWERS_PER_CLASS
@ SPELL_ATTR7_TREAT_AS_NPC_AOE
StealthType
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ SPELL_EFFECT_SUMMON
@ CLASS_HUNTER
@ CLASS_DRUID
#define CLASSMASK_WAND_USERS
SpellPreventionType
@ SPELL_PREVENTION_TYPE_SILENCE
@ SPELL_PREVENTION_TYPE_NO_ACTIONS
@ SPELL_PREVENTION_TYPE_PACIFY
@ GAMEOBJECT_TYPE_CONTROL_ZONE
@ GAMEOBJECT_TYPE_FLAGSTAND
@ 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_FAIL_ON_ALL_TARGETS_IMMUNE
@ CREATURE_TYPE_BEAST
InvisibilityType
@ INVISIBILITY_GENERAL
@ SPELL_ATTR1_TRACK_TARGET_IN_CHANNEL
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
@ UNIT_DYNFLAG_SPECIALINFO
@ UNIT_DYNFLAG_TRACK_UNIT
WeaponAttackType
@ OFF_ATTACK
@ MAX_ATTACK
@ BASE_ATTACK
@ RANGED_ATTACK
@ MECHANIC_POLYMORPH
@ IMMUNITY_MECHANIC
#define PET_SPEC_OVERRIDE_CLASS_INDEX
@ ALLIANCE
Powers
@ MAX_POWERS
@ POWER_ALTERNATE_POWER
@ 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_AURA_POINTS_ON_CLIENT
@ SPELL_ATTR8_MELEE_HASTE_AFFECTS_PERIODIC
@ SPELL_ATTR8_TARGET_PROCS_ON_CASTER
@ 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
@ SPELL_AURA_MANA_SHIELD
@ SPELL_AURA_MOD_SCHOOL_MASK_DAMAGE_FROM_CASTER
@ SPELL_AURA_MOD_ADV_FLYING_LIFT_COEF
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
@ SPELL_AURA_MOD_DISARM_RANGED
@ SPELL_AURA_PERIODIC_WEAPON_PERCENT_DAMAGE
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_MOD_CASTING_SPEED
@ SPELL_AURA_MOD_ADV_FLYING_ADD_IMPULSE_MAX_SPEED
@ SPELL_AURA_MOD_SHAPESHIFT
@ SPELL_AURA_MOD_GRAVITY
@ SPELL_AURA_MOD_DISARM
@ SPELL_AURA_DAMAGE_SHIELD
@ SPELL_AURA_MOD_ADV_FLYING_MAX_VEL
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
@ 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_PROC_TRIGGER_SPELL
@ SPELL_AURA_MOD_FEAR
@ SPELL_AURA_MOD_NO_ACTIONS
@ SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_DOWN
@ 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_ROOT_2
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
@ SPELL_AURA_MOD_INVISIBILITY
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_DISABLE_GRAVITY
@ 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_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_MOD_ADV_FLYING_AIR_FRICTION
@ SPELL_AURA_MOD_ADV_FLYING_OVER_MAX_DECELERATION
@ 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_ADV_FLYING_BANKING_RATE
@ SPELL_AURA_MOD_CONFUSE
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
@ SPELL_AURA_MOD_ADV_FLYING_PITCHING_RATE_UP
@ 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_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_SKILL_TALENT
@ SPELL_AURA_PHASE_ALWAYS_VISIBLE
@ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
@ SPELL_AURA_MOD_MELEE_RANGED_CASTING_HASTE
@ SPELL_AURA_MOD_STUN
ShapeshiftForm
@ FORM_SHADOWFORM
@ FORM_BEAR_FORM
@ FORM_BERSERKER_STANCE
@ FORM_BATTLE_STANCE
@ FORM_DIRE_BEAR_FORM
@ 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]
static void InterruptSpellsWithPreventionTypeOnAuraApply(Unit *target, SpellPreventionType preventionType)
static void HandleAuraDisableGravity(Unit *target, bool apply)
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
SpellModOp
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_IGNORE_POWER_COST
Will ignore power and reagent cost.
@ TRIGGERED_IGNORE_REAGENT_COST
Will ignore reagent cost.
SpellValueModFloat
@ SPELLVALUE_BASE_POINT0
#define MAX_SPELLMOD
@ SPELL_ATTR0_CU_CAN_CRIT
Definition SpellInfo.h:151
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:225
#define sSpellMgr
Definition SpellMgr.h:812
ProcFlagsSpellType
Definition SpellMgr.h:211
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:214
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:213
@ PROC_SPELL_TYPE_NO_DMG_HEAL
Definition SpellMgr.h:215
@ PROC_FLAG_TAKE_HARMFUL_PERIODIC
Definition SpellMgr.h:122
@ PROC_FLAG_TAKE_ANY_DAMAGE
Definition SpellMgr.h:124
@ TAKEN_HIT_PROC_FLAG_MASK
Definition SpellMgr.h:175
@ PROC_FLAG_DEAL_HARMFUL_PERIODIC
Definition SpellMgr.h:121
@ PROC_FLAG_DEAL_HELPFUL_PERIODIC
Definition SpellMgr.h:126
@ PROC_FLAG_TAKE_HELPFUL_PERIODIC
Definition SpellMgr.h:145
ProcFlagsHit
Definition SpellMgr.h:233
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:236
@ PROC_HIT_NORMAL
Definition SpellMgr.h:235
@ MOVE_FLIGHT
@ MOVE_SWIM
@ MOVE_FLIGHT_BACK
@ MOVE_SWIM_BACK
@ MOVE_RUN
@ MOVE_RUN_BACK
@ UNIT_FLAG2_MIRROR_IMAGE
@ UNIT_FLAG2_COMPREHEND_LANG
@ UNIT_FLAG2_FORCE_MOVEMENT
@ UNIT_FLAG2_FEIGN_DEATH
@ UNIT_FLAG2_NO_ACTIONS
@ UNIT_FLAG2_ALLOW_CHANGING_TALENTS
@ UNIT_FLAG2_DISARM_OFFHAND
@ UNIT_FLAG2_DISARM_RANGED
@ REACT_PASSIVE
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:42
@ ADV_FLYING_OVER_MAX_DECELERATION
@ ADV_FLYING_LIFT_COEFFICIENT
@ ADV_FLYING_ADD_IMPULSE_MAX_SPEED
@ ADV_FLYING_AIR_FRICTION
@ ADV_FLYING_MAX_VEL
@ ADV_FLYING_PITCHING_RATE_DOWN
@ ADV_FLYING_PITCHING_RATE_UP
@ ADV_FLYING_BANKING_RATE
@ DOT
@ SPELL_DIRECT_DAMAGE
@ UNIT_FLAG3_FAKE_DEAD
@ UNIT_FLAG3_ALTERNATIVE_DEFAULT_LANGUAGE
@ 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
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
@ UNIT_FLAG_NON_ATTACKABLE
@ UNIT_FLAG_PREPARATION
@ UNIT_FLAG_NON_ATTACKABLE_2
@ UNIT_FLAG_IMMUNE
@ UNIT_FLAG_DISARMED
@ UNIT_FLAG_PACIFIED
@ UNIT_FLAG_PLAYER_CONTROLLED
ProcFlagsHit createProcHitMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition Unit.cpp:10475
@ BASE_VALUE
Definition Unit.h:158
@ TOTAL_VALUE
Definition Unit.h:159
UnitMods
Definition Unit.h:177
@ UNIT_MOD_ARMOR
Definition Unit.h:210
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:224
@ UNIT_MOD_HEALTH
Definition Unit.h:183
@ UNIT_MOD_POWER_START
Definition Unit.h:226
@ UNIT_MOD_MANA
Definition Unit.h:184
@ UNIT_MOD_STAT_START
Definition Unit.h:222
@ CORPSE
Definition Unit.h:268
@ JUST_DIED
Definition Unit.h:267
CurrentSpellTypes
Definition Unit.h:608
@ CURRENT_GENERIC_SPELL
Definition Unit.h:610
@ CURRENT_MELEE_SPELL
Definition Unit.h:609
@ UNIT_STATE_DIED
Definition Unit.h:275
@ UNIT_STATE_CONFUSED
Definition Unit.h:286
@ UNIT_STATE_ROOT
Definition Unit.h:285
@ UNIT_STATE_FLEEING
Definition Unit.h:282
@ UNIT_STATE_CASTING
Definition Unit.h:290
@ UNIT_STATE_STUNNED
Definition Unit.h:278
@ MELEE_HIT_NORMAL
Definition Unit.h:401
#define MAX_COMBAT_RATING
Definition Unit.h:365
@ SHIELD_BLOCK_VALUE
Definition Unit.h:238
#define CURRENT_MAX_SPELL
Definition Unit.h:616
CombatRating
Definition Unit.h:330
@ CR_PARRY
Definition Unit.h:334
@ NULL_BAG
Definition Unit.h:63
@ NULL_SLOT
Definition Unit.h:64
#define DISPLAYID_HIDDEN_MOUNT
Definition Unit.h:40
#define SPELL_DH_DOUBLE_JUMP
Definition Unit.h:39
@ TOTAL_PCT
Definition Unit.h:166
@ BASE_PCT
Definition Unit.h:165
float GetPctOf(T value, T max)
Definition Util.h:78
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:565
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:81
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:96
void HandleAuraModDecreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRangedHaste(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModBlockPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeHaste(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 ChangeAmount(SpellEffectValue newAmount, bool mark=true, bool onStackOrReapply=false, AuraEffect const *triggeredBy=nullptr)
void HandleModRecoveryRateBySpellLabel(AuraApplication const *aurApp, uint8 mode, bool apply) 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 HandleModChargeRecoveryRate(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 HandleModMeleeRangedHasteNoRegen(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
void HandleModMeleeRangedCastingSlowNoStack(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 HandleAuraActAsControlZone(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
void HandleDetectAmore(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicHealthFunnelAuraTick(Unit *target, Unit *caster) const
void HandleAuraPreventRegeneratePower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRangedAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRangedHasteNoRegen(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 HandleModCastingSlowNoStack(AuraApplication const *aurApp, uint8 mode, bool apply) 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 HandleModAdvFlying(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
void SetAmount(SpellEffectValue amount)
void HandleArenaPreparation(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSchoolImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleUnused(AuraApplication const *, uint8, bool) const
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
void HandleSetCantSwim(AuraApplication const *aurApp, uint8 mode, bool apply) 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
int32 GetAmountAsInt() 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
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
void HandleMountRestrictions(AuraApplication const *aurApp, uint8 mode, bool apply) const
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 HandleConvertCritToParry(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
void HandleModGravity(AuraApplication const *aurApp, uint8 mode, bool apply) const
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 HandleModRangedSlowNoStack(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 HandleModMeleeRangedHaste(AuraApplication const *aurApp, uint8 mode, bool apply) 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
Optional< SpellEffectValue > GetEstimatedAmount() const
bool IsAffectingSpell(SpellInfo const *spell) const
static Optional< SpellEffectValue > CalculateEstimatedAmount(Unit const *caster, Unit *target, SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, SpellEffectValue amount, uint8 stack, AuraEffect const *aurEff)
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)
SpellEffectValue _amount
void HandleModOverrideZonePVPType(AuraApplication const *aurApp, uint8 mode, bool apply) const
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
Optional< SpellEffectValue > _estimatedAmount
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
static SpellEffectValue CalculateEstimatedfTotalPeriodicAmount(Unit const *caster, Unit *target, SpellInfo const *spellInfo, SpellEffectInfo const &spellEffectInfo, SpellEffectValue amount, uint8 stack)
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 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 HandleOverridePetSpecs(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleCharmConvert(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModWaterBreathing(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
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
SpellEffectInfo const & m_effectInfo
SpellEffectValue const m_baseAmount
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
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
SpellEffectValue CalculateAmount(Unit *caster)
void HandleTriggerSpellOnPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePhaseAlwaysVisible(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRecoveryRate(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 HandleAuraModAdvFlyingSpeed(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 HandleModMeleeSlowNoStack(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeRangedCastingHaste(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellSlowNoStack(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
SpellEffectValue GetAmount() 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 HandleAuraDisableGravity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeHasteNoRegen(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
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
AuraEffect(Aura *base, SpellEffectInfo const &spellEfffectInfo, SpellEffectValue const *baseAmount, Unit *caster)
void HandleSetFFAPvP(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleBindSight(AuraApplication const *aurApp, uint8 mode, bool apply) const
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
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
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
HookList< EffectCalcSpellModHandler > DoEffectCalcSpellMod
ObjectGuid GetCastId() const
Definition SpellAuras.h:186
int32 GetMaxDuration() const
Definition SpellAuras.h:217
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:286
void SetStackAmount(uint8 num)
int32 GetCastItemLevel() const
Definition SpellAuras.h:190
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Trinity::IteratorPair< DBStorageIterator< AuraEffect * > > GetAuraEffects()
Definition SpellAuras.h:362
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:187
WorldObject * GetOwner() const
Definition SpellAuras.h:195
void CallScriptAfterEffectProcHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
int32 GetDuration() const
Definition SpellAuras.h:222
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, SpellEffectValue &amount, bool &canBeRecalculated)
uint32 GetCastItemId() const
Definition SpellAuras.h:189
AuraEffect * GetEffect(uint32 index) const
void CallScriptAfterEffectApplyHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void SetCharges(uint8 charges)
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:219
SpellInfo const *const m_spellInfo
Definition SpellAuras.h:392
AuraObjectType GetType() const
uint8 GetStackAmount() const
Definition SpellAuras.h:238
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:182
bool CallScriptEffectProcHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
static bool EffectTypeNeedsSendingAmount(AuraType type)
Difficulty GetCastDifficulty() const
Definition SpellAuras.h:184
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:172
bool IsPermanent() const
Definition SpellAuras.h:227
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsInWorld() const
Definition BaseEntity.h:158
bool IsCreature() const
Definition BaseEntity.h:172
bool IsPlayer() const
Definition BaseEntity.h:173
TypeID GetTypeId() const
Definition BaseEntity.h:166
Battleground * GetBG() const
Definition Map.h:942
void RemovePlayerPosition(ObjectGuid guid)
void AddPlayerPosition(WorldPackets::Battleground::BattlegroundPlayerPosition const &position)
bool IsIgnoringFeignDeath() const
Definition Creature.h:352
bool IsFloating() const
Definition Creature.h:142
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool isTappedBy(Player const *player) const
uint8 GetCurrentEquipmentId() const
Definition Creature.h:263
std::vector< MountXDisplayEntry const * > MountXDisplayContainer
Definition DB2Stores.h:451
uint32 GetResist() const
Definition Unit.h:469
ProcFlagsHit GetHitMask() const
Definition Unit.cpp:245
uint32 GetDamage() const
Definition Unit.h:466
uint32 GetAbsorb() const
Definition Unit.h:468
constexpr bool HasFlag(T flag) const
Definition EnumFlag.h:106
bool HasFlag(FLAG_TYPE flag) const
Definition Object.h:208
void AddFlag(FLAG_TYPE flag)
Definition Object.h:209
T_FLAGS GetFlags() const
Definition Object.h:207
void DelFlag(FLAG_TYPE flag)
Definition Object.h:210
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:214
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:213
uint32 GetAbsorb() const
Definition Unit.h:499
uint32 GetEffectiveHeal() const
Definition Unit.h:498
Definition Item.h:185
bool IsDungeon() const
Definition Map.cpp:3303
void SendZoneWeather(uint32 zoneId, Player *player) const
Definition Map.cpp:3986
bool IsBattleground() const
Definition Map.cpp:3395
BattlegroundMap * ToBattlegroundMap()
Definition Map.h:498
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3588
Difficulty GetDifficultyID() const
Definition Map.h:363
bool Instanceable() const
Definition Map.cpp:3293
float GetVisibilityRange() const
Definition Map.h:257
float GetFollowAngle() const override
void MoveFall(uint32 id=0, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void MoveFollow(Unit *target, float dist, Optional< ChaseAngle > angle={}, Optional< Milliseconds > duration={}, bool ignoreTargetWalk=false, MovementSlot slot=MOTION_SLOT_ACTIVE, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
static ObjectGuid const Empty
Definition ObjectGuid.h:314
std::string ToString() const
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
void SetDynamicFlag(uint32 flag)
Definition Object.h:97
Player * ToPlayer()
Definition Object.h:126
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
void RemoveDynamicFlag(uint32 flag)
Definition Object.h:98
void SetEntry(uint32 entry)
Definition Object.h:90
Unit * ToUnit()
Definition Object.h:116
Definition Pet.h:40
uint16 GetSpecialization() const
Definition Pet.h:133
void SetSpecialization(uint16 spec)
Definition Pet.cpp:1913
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:711
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:2987
void UpdateParryPercentage()
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition Player.cpp:13048
void UpdateMastery()
void ApplyModFakeDrunkValue(int32 mod, bool apply)
Definition Player.h:2463
void RemoveSpellCategoryCooldownMod(int32 spellCategoryId, int32 mod)
Definition Player.cpp:30700
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:11288
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:2896
void UpdateDodgePercentage()
void ApplyModTargetResistance(int32 mod, bool apply)
Definition Player.h:2188
void SetPlayerLocalFlag(PlayerLocalFlags flags)
Definition Player.h:2992
void RemovePlayerFlag(PlayerFlags flags)
Definition Player.h:2897
void LeaveBattleground(bool teleportToEntryPoint=true, bool withoutDeserterDebuff=false)
Definition Player.cpp:24282
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition Player.cpp:8268
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5215
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6193
void UpdatePowerRegen(Powers power)
void AddTemporarySpell(uint32 spellId)
Definition Player.cpp:3031
void ApplySpellMod(SpellInfo const *spellInfo, SpellModOp op, T &basevalue, Spell *spell=nullptr) const
Definition Player.cpp:22840
void SetNoRegentCostMask(flag128 mask)
Definition Player.h:1522
void UpdatePvPState(bool onlyFFA=false)
Definition Player.cpp:24013
void UpdateBlockPercentage()
void _ApplyWeaponDamage(uint8 slot, Item *item, bool apply)
Definition Player.cpp:8130
bool InBattleground() const
Definition Player.h:2570
void UpdateArmor() override
void PetSpellInitialize()
Definition Player.cpp:22418
SceneMgr & GetSceneMgr()
Definition Player.h:2873
void SetFallInformation(uint32 time, float z)
Definition Player.cpp:27437
void RemovePlayerLocalFlag(PlayerLocalFlags flags)
Definition Player.h:2993
void setRegenTimerCount(uint32 time)
Definition Player.h:1887
void SetStableMaster(ObjectGuid stableMaster)
Definition Player.cpp:29799
Pet * GetPet() const
Definition Player.cpp:22007
void RemoveTemporarySpell(uint32 spellId)
Definition Player.cpp:3044
void ApplyItemDependentAuras(Item *item, bool apply)
Definition Player.cpp:8275
void ReplaceAllRequiredMountCapabilityFlags(uint8 flags)
Definition Player.h:3007
WorldSession * GetSession() const
Definition Player.h:2256
void UpdateSpellHitChances()
void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill=0, bool suppressMessaging=false, Optional< PlayerSpellTrait > trait={})
Definition Player.cpp:3083
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9538
void UpdateExpertise(WeaponAttackType attType)
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:26877
void SendNewItem(Item *item, uint32 quantity, bool pushed, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition Player.cpp:13835
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:2056
void AddSpellCategoryCooldownMod(int32 spellCategoryId, int32 mod)
Definition Player.cpp:30675
void RemoveTrackCreatureFlag(uint32 flags)
Definition Player.h:2983
void ApplyModOverrideAPBySpellPowerPercent(float mod, bool apply)
Definition Player.h:2989
void ApplyModTargetPhysicalResistance(int32 mod, bool apply)
Definition Player.h:2189
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:4896
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:8262
void UpdateLiquidMirrorTimerValuesOnAura()
Definition Player.cpp:26805
void SetChampioningFaction(uint32 faction)
Definition Player.h:2846
void UpdateSpellDamageAndHealingBonus()
bool IsGameMaster() const
Definition Player.h:1293
void SetOverrideZonePVPType(ZonePVPTypeOverride type)
Definition Player.h:1986
void AddStoredAuraTeleportLocation(uint32 spellId)
Definition Player.cpp:2646
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition Player.cpp:5589
static WeaponAttackType GetAttackBySlot(uint8 slot, InventoryType inventoryType)
Definition Player.cpp:9644
void SendOnCancelExpectedVehicleRideAura() const
Definition Player.cpp:22413
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:4874
void UpdateHostileAreaState(AreaTableEntry const *area)
Definition Player.cpp:7591
void RemoveSpell(uint32 spell_id, bool disabled=false, bool learn_low_rank=true, bool suppressMessaging=false)
Definition Player.cpp:3128
void SetTrackCreatureFlag(uint32 flags)
Definition Player.h:2982
void SetOverrideSpellsId(int32 overrideSpellsId)
Definition Player.h:1964
void UpdateRating(CombatRating cr)
Definition Player.cpp:5221
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6415
void RemovePetAura(PetAura const *petSpell)
Definition Player.cpp:22182
bool isHonorOrXPTarget(Unit const *victim) const
Definition Player.cpp:26295
void UpdateInvisibilityDrunkDetect()
Definition Player.cpp:867
Team GetEffectiveTeam() const
Definition Player.h:2410
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:22855
void UpdateSpellCritChance()
void SetRequiredMountCapabilityFlag(uint8 flag)
Definition Player.h:3006
void SendMovementSetCollisionHeight(float height, WorldPackets::Movement::UpdateCollisionHeightReason reason)
Definition Player.cpp:30078
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:9970
void UpdateAttackPowerAndDamage(bool ranged=false) override
ReputationMgr & GetReputationMgr()
Definition Player.h:2422
void RemoveStoredAuraTeleportLocation(uint32 spellId)
Definition Player.cpp:2653
void AddPetAura(PetAura const *petSpell)
Definition Player.cpp:22175
Unit * GetActionTarget() const
Definition Unit.h:514
Spell const * GetProcSpell() const
Definition Unit.h:527
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:281
ProcFlagsInit GetTypeMask() const
Definition Unit.h:516
DamageInfo * GetDamageInfo() const
Definition Unit.h:524
Unit * GetActor() const
Definition Unit.h:513
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
void CancelSceneBySceneId(uint32 sceneId)
Definition SceneMgr.cpp:178
Optional< uint32 > GetInstanceIdBySceneId(uint32 sceneId) const
Definition SceneMgr.cpp:241
void OnSceneComplete(uint32 sceneInstanceID)
Definition SceneMgr.cpp:141
uint32 PlayScene(uint32 sceneId, Position const *position=nullptr)
Definition SceneMgr.cpp:36
SpellEffectValue CalcValue(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
AuraType ApplyAuraName
Definition SpellInfo.h:216
float CalcValueMultiplier(WorldObject *caster, Spell *spell=nullptr) const
uint32 TriggerSpell
Definition SpellInfo.h:234
static constexpr SpellEffectValue MaxValue
Definition SpellInfo.h:267
uint32 ApplyAuraPeriod
Definition SpellInfo.h:217
static constexpr SpellEffectValue MinValue
Definition SpellInfo.h:266
EnumFlag< SpellEffectAttributes > EffectAttributes
Definition SpellInfo.h:238
void UpdateCooldownRecoveryRate(Predicate &&predicate, float modChange, bool apply)
void UpdateChargeRecoveryRate(uint32 chargeCategoryId, float modChange, bool apply)
bool IsAffected(uint32 familyName, flag128 const &familyFlags) const
uint64 GetAllEffectsMechanicMask() const
uint32 const Id
Definition SpellInfo.h:328
int32 IsAffectedBySpellMod(SpellModifier const *mod) const
uint64 Stances
Definition SpellInfo.h:352
bool IsPassive() const
uint32 StackAmount
Definition SpellInfo.h:396
::Difficulty const Difficulty
Definition SpellInfo.h:329
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell) const
uint32 SchoolMask
Definition SpellInfo.h:419
flag128 SpellFamilyFlags
Definition SpellInfo.h:415
ProcFlagsInit ProcFlags
Definition SpellInfo.h:381
WeaponAttackType GetAttackType() const
SpellSchoolMask GetSchoolMask() const
void ApplyAllSpellImmunitiesTo(Unit *target, SpellEffectInfo const &spellEffectInfo, bool apply) const
bool IsChanneled() const
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:456
bool IsAffectedBySpellMods() const
std::vector< SpellEffectInfo > const & GetEffects() const
Definition SpellInfo.h:589
bool IsPositive() const
bool HasLabel(uint32 labelId) const
uint32 SpellFamilyName
Definition SpellInfo.h:414
Definition Spell.h:277
int32 GetCastTime() const
Definition Spell.h:659
std::vector< SpellPowerCost > const & GetPowerCost() const
Definition Spell.h:704
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:647
bool SetCanDoubleJump(bool enable)
Definition Unit.cpp:13987
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:825
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:9695
void ClearUnitState(uint32 f)
Definition Unit.h:756
void SetFlightCapabilityID(int32 flightCapabilityId, bool clientUpdate)
Definition Unit.cpp:9022
bool IsVehicle() const
Definition Unit.h:766
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition Unit.cpp:8261
void SetOverrideDisplayPowerId(uint32 powerDisplayId)
Definition Unit.h:826
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8716
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:6830
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3973
int32 SpellAbsorbBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 absorbamount) const
Definition Unit.cpp:7727
void RemoveGameObject(GameObject *gameObj, bool del)
Definition Unit.cpp:5436
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1362
void SetSilencedSchoolMask(SpellSchoolMask schoolMask)
Definition Unit.h:1518
float GetHealthPct() const
Definition Unit.h:808
float m_baseSpellCritChance
Definition Unit.h:1540
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition Unit.cpp:6031
int32 MeleeDamageBonusTaken(Unit *attacker, int32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:8152
virtual void RecalculateObjectScale()
Definition Unit.cpp:10844
void SetHealth(uint64 val)
Definition Unit.cpp:10041
void HandleAttackPowerModifier(AttackPowerModIndex index, AttackPowerModType modifierType, float amount, bool apply)
Definition Unit.cpp:9766
bool SetCanAdvFly(bool enable)
Definition Unit.cpp:14049
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition Unit.cpp:7329
uint64 CountPctFromMaxHealth(float pct) const
Definition Unit.h:809
int32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype) const
Definition Unit.cpp:7514
Pet * ToPet()
Definition Unit.h:1838
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition Unit.h:1045
void RemoveAurasByShapeShift()
Definition Unit.cpp:4352
void SetUnitFlag3(UnitFlags3 flags)
Definition Unit.h:871
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:9837
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3846
void UpdateObjectVisibility(bool forced=true) override
Definition Unit.cpp:12563
int64 ModifyHealth(int64 val)
Definition Unit.cpp:8618
void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting=false)
Definition Unit.cpp:10876
void SetGravityModifier(float gravityModifier)
Definition Unit.cpp:14303
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10804
void FinishSpell(CurrentSpellTypes spellType, SpellCastResult result=SPELL_CAST_OK)
Definition Unit.cpp:3189
ThreatManager & GetThreatManager()
Definition Unit.h:1093
void ApplyModManaCostModifier(SpellSchools school, int32 mod, bool apply)
Definition Unit.h:842
void RestoreFaction()
Definition Unit.cpp:12143
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
Definition Unit.cpp:4845
virtual ClassPowerTypes GetPowerTypes() const =0
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11631
uint8 GetClass() const
Definition Unit.h:776
void ApplySpellHastePercentMod(float val, bool apply)
Definition Unit.cpp:11073
void SetVisFlag(UnitVisFlags flags)
Definition Unit.h:920
bool CanUseAttackType(uint8 attacktype) const
Definition Unit.cpp:2594
uint32 GetClassMask() const
Definition Unit.h:778
bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster) const
Definition Unit.cpp:4837
uint32 GetLastExtraAttackSpell() const
Definition Unit.h:974
uint32 GetMountDisplayId() const
Definition Unit.h:928
void UpdateAllDamageDoneMods()
Definition Unit.cpp:9831
void UpdateDisplayPower()
Definition Unit.cpp:5827
float GetCollisionHeight() const override
Definition Unit.cpp:14680
static void DealHeal(HealInfo &healInfo)
Definition Unit.cpp:6543
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:657
void UpdateSpeed(UnitMoveType mtype)
Definition Unit.cpp:8797
static void DealDamageMods(Unit const *attacker, Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:804
bool IsPolymorphed() const
Definition Unit.cpp:10831
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1527
void SetFaction(uint32 faction) override
Definition Unit.h:887
SpellEffectValue GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition Unit.cpp:14397
void SetCosmeticMountDisplayId(uint32 mountDisplayId)
Definition Unit.h:931
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2099
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:1198
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:9675
std::forward_list< AuraEffect * > AuraEffectList
Definition Unit.h:664
void UpdateAdvFlyingSpeed(AdvFlyingRateTypeSingle speedType, bool clientUpdate)
Definition Unit.cpp:9044
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:9642
uint32 GetTransformSpell() const
Definition Unit.h:1644
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition Unit.cpp:1308
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct) const
Definition Unit.cpp:2490
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition Unit.cpp:1866
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3253
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool SetFeatherFall(bool enable)
Definition Unit.cpp:13618
bool IsPet() const
Definition Unit.h:763
Powers GetPowerType() const
Definition Unit.h:823
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit *victim, uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK, uint8 attackerLevel=0)
Definition Unit.cpp:1689
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={}, ObjectGuid const &interrupter=ObjectGuid::Empty)
Definition Unit.cpp:3158
void Dismount()
Definition Unit.cpp:8336
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13656
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4622
bool IsFullHealth() const
Definition Unit.h:803
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:866
void ApplyHasteRegenPercentMod(float val, bool apply)
Definition Unit.cpp:11081
bool IsAlive() const
Definition Unit.h:1205
virtual bool CanApplyResilience() const
Definition Unit.cpp:12485
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:11034
int32 GetMaxPower(Powers power) const
Definition Unit.cpp:10105
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:6795
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:12950
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition Unit.cpp:5559
bool IsStandState() const
Definition Unit.cpp:10798
TempSummon * ToTempSummon()
Definition Unit.h:1844
bool IsGravityDisabled() const
Definition Unit.h:1164
CharmInfo * GetCharmInfo()
Definition Unit.h:1262
bool SetCanTransitionBetweenSwimAndFly(bool enable)
Definition Unit.cpp:13921
bool SetDisableInertia(bool disable)
Definition Unit.cpp:14018
void RemoveVisFlag(UnitVisFlags flags)
Definition Unit.h:921
void RemoveUnitFlag3(UnitFlags3 flags)
Definition Unit.h:872
float SpellCritChanceDone(Spell *spell, AuraEffect const *aurEff, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
Definition Unit.cpp:7140
void UpdateMountCapability()
Definition Unit.cpp:8478
void AddUnitState(uint32 f)
Definition Unit.h:754
static void ApplyResilience(Unit const *victim, int32 *damage)
Definition Unit.cpp:12490
float GetTotalAuraMultiplier(AuraType auraType) const
Definition Unit.cpp:5092
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:8303
Gender GetGender() const
Definition Unit.h:779
int32 GetMinPower(Powers power) const
Definition Unit.h:830
virtual void UpdateDamagePhysical(WeaponAttackType attType)
virtual Gender GetNativeGender() const
Definition Unit.h:781
bool SetMoveCantSwim(bool cantSwim)
Definition Unit.cpp:14080
uint32 GetCreatureType() const
Definition Unit.cpp:9478
void SetInstantCast(bool set)
Definition Unit.h:1850
uint32 GetDisplayId() const
Definition Unit.h:1637
void SendSpellDamageImmune(Unit *target, uint32 spellId, bool isPeriodic)
Definition Unit.cpp:5658
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:6098
uint32 GetNativeDisplayId() const
Definition Unit.h:1640
float SpellCritChanceTaken(Unit const *caster, Spell *spell, AuraEffect const *aurEff, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType=BASE_ATTACK) const
Definition Unit.cpp:7194
virtual void UpdateArmor()=0
uint64 GetMaxHealth() const
Definition Unit.h:801
int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, bool npcCaster) const
Definition Unit.cpp:12512
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:4792
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4718
bool SetCanFly(bool enable)
Definition Unit.cpp:13538
uint64 GetHealth() const
Definition Unit.h:800
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:867
bool SetCanTurnWhileFalling(bool enable)
Definition Unit.cpp:13955
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4832
virtual bool UpdateStats(Stats stat)=0
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition Unit.cpp:4259
void StopAttackFaction(uint32 faction_id)
Definition Unit.cpp:13207
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:12033
bool IsMounted() const
Definition Unit.h:927
float GetMaxNegativeAuraModifier(AuraType auraType) const
Definition Unit.cpp:5102
virtual uint32 GetPowerIndex(Powers power) const =0
Unit * GetVictim() const
Definition Unit.h:738
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
Definition Unit.h:1897
int32 GetPower(Powers power) const
Definition Unit.cpp:10096
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:7874
bool IsImmunedToAuraPeriodicTick(WorldObject const *caster, AuraEffect const *auraEffect) const
Definition Unit.cpp:8005
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:6190
DeathState getDeathState() const
Definition Unit.h:1208
bool SetIgnoreMovementForces(bool ignore)
Definition Unit.cpp:14191
float GetTotalAuraMultiplierByMiscMask(AuraType auraType, uint32 misc_mask) const
Definition Unit.cpp:5117
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:11060
bool HealthAbovePct(float pct) const
Definition Unit.h:806
bool HealthBelowPct(float pct) const
Definition Unit.h:804
bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading=false)
Definition Unit.cpp:12169
int32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype) const
Definition Unit.cpp:7013
bool IsInFeralForm() const
Definition Unit.cpp:9559
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition Unit.cpp:7299
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition Unit.cpp:3753
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:5621
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:12852
int32 SpellAbsorbBonusDone(Unit *victim, SpellInfo const *spellProto, int32 absorbamount, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, AuraEffect const *aurEff=nullptr) const
Definition Unit.cpp:7645
int32 MeleeDamageBonusDone(Unit *pVictim, int32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellEffectInfo const *spellEffectInfo=nullptr, Mechanics mechanic=MECHANIC_NONE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
Definition Unit.cpp:8040
SpellHistory * GetSpellHistory()
Definition Unit.h:1521
bool IsControlledByPlayer() const
Definition Unit.h:1234
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:11859
bool SetWaterWalking(bool enable)
Definition Unit.cpp:13581
void SetMaxPower(Powers power, int32 val)
Definition Unit.cpp:10151
virtual void setDeathState(DeathState s)
Definition Unit.cpp:9180
void RemoveVehicleKit(bool onRemoveFromWorld=false)
Definition Unit.cpp:12185
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:1680
void HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
Definition Unit.cpp:9618
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:861
void UpdateMovementForcesModMagnitude()
Definition Unit.cpp:14222
bool IsFlying() const
Definition Unit.h:1823
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1315
void SetVignette(uint32 vignetteId)
Definition Unit.cpp:14723
MountCapabilityEntry const * GetMountCapability(uint32 mountType) const
Definition Unit.cpp:8381
void SetInFront(WorldObject const *target)
Definition Unit.cpp:13379
Vehicle * GetVehicleKit() const
Definition Unit.h:1798
float m_modSpellHitChance
Definition Unit.h:1539
Guardian * GetGuardianPet() const
Definition Unit.cpp:6250
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:5589
bool SetDisableGravity(bool disable, bool updateAnimTier=true, bool updatePlayHoverAnim=true)
Definition Unit.cpp:13440
void ReplaceAllSilencedSchoolMask(SpellSchoolMask schoolMask)
Definition Unit.h:1519
AuraMap & GetOwnedAuras()
Definition Unit.h:1305
void UpdateAllDamagePctDoneMods()
Definition Unit.cpp:9878
bool AttackStop()
Definition Unit.cpp:5984
void SetTransformSpell(uint32 spellid)
Definition Unit.h:1643
void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply)
Definition Unit.h:841
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:9521
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.cpp:11311
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:7347
void SetMountDisplayId(uint32 mountDisplayId)
Definition Unit.h:929
uint8 GetRace() const
Definition Unit.h:773
virtual void SetDisplayId(uint32 displayId, bool setNative=false)
Definition Unit.cpp:10852
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition Unit.cpp:12635
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:862
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:5237
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1490
Vehicle * RemovePassenger(WorldObject *passenger) override
Removes the passenger from the vehicle.
Definition Vehicle.cpp:513
void RemovePendingEventsForPassenger(Unit *passenger)
Definition Vehicle.cpp:784
void PlayDirectSound(uint32 soundId, Player const *target=nullptr, uint32 broadcastTextId=0) const
Definition Object.cpp:2941
Map * GetMap() const
Definition Object.h:411
ZoneScript * FindZoneScript() const
Definition Object.cpp:1370
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition Object.cpp:2663
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:403
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:404
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect, bool canImmune) const
Definition Object.cpp:1947
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition Object.cpp:1446
void PlayDistanceSound(uint32 soundId, Player const *target=nullptr) const
Definition Object.cpp:2925
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:401
void UpdatePositionData()
Definition Object.cpp:344
Player * GetSpellModOwner() const
Definition Object.cpp:1646
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:499
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:400
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:407
uint32 GetZoneId() const
Definition Object.h:332
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:406
void ModSpellDurationTime(SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
Definition Object.cpp:1816
bool isLogingOut() const
Is the user engaged in a log out process?
WeatherState
Definition Weather.h:47
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
TriggerCastFlags TriggerFlags
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition Spell.cpp:9646
CastSpellExtraArgs & SetTriggerFlags(TriggerCastFlags flag)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:160
bool HasCommandState(CommandStates state) const
Definition CharmInfo.h:98
uint32 mitigated_damage
Definition Unit.h:426
uint32 CreatureDisplayID
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
static QuaternionData fromOrientation(float orientation)
SpellModOp op
Definition Player.h:257
SpellModType type
Definition Player.h:258
Unit * attacker
Definition Unit.h:571
uint32 originalDamage
Definition Unit.h:576
std::array< uint32, MAX_SHAPESHIFT_SPELLS > PresetSpellID
EnumFlag< SpellShapeshiftFormFlags > GetFlags() const