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 "CellImpl.h"
23#include "Common.h"
24#include "DBCStores.h"
25#include "GridNotifiersImpl.h"
26#include "Item.h"
27#include "Log.h"
28#include "MotionMaster.h"
29#include "ObjectAccessor.h"
30#include "ObjectMgr.h"
31#include "Opcodes.h"
32#include "OutdoorPvPMgr.h"
33#include "Pet.h"
34#include "Player.h"
35#include "ReputationMgr.h"
36#include "ScriptMgr.h"
37#include "Spell.h"
38#include "SpellHistory.h"
39#include "SpellMgr.h"
40#include "ThreatManager.h"
41#include "Unit.h"
42#include "Util.h"
43#include "Vehicle.h"
44#include "WorldPacket.h"
45#include <numeric>
46
47//
48// EFFECT HANDLER NOTES
49//
50// in aura handler there should be check for modes:
51// AURA_EFFECT_HANDLE_REAL set
52// AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK set
53// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK set - aura is recalculated or is just applied/removed - need to redo all things related to m_amount
54// AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK - logical or of above conditions
55// AURA_EFFECT_HANDLE_STAT - set when stats are reapplied
56// such checks will speedup trinity change amount/send for client operations
57// because for change amount operation packets will not be send
58// aura effect handlers shouldn't contain any AuraEffect or Aura object modifications
59
61{
62 &AuraEffect::HandleNULL, // 0 SPELL_AURA_NONE
63 &AuraEffect::HandleBindSight, // 1 SPELL_AURA_BIND_SIGHT
64 &AuraEffect::HandleModPossess, // 2 SPELL_AURA_MOD_POSSESS
65 &AuraEffect::HandleNoImmediateEffect, // 3 SPELL_AURA_PERIODIC_DAMAGE implemented in AuraEffect::PeriodicTick
66 &AuraEffect::HandleAuraDummy, // 4 SPELL_AURA_DUMMY
67 &AuraEffect::HandleModConfuse, // 5 SPELL_AURA_MOD_CONFUSE
68 &AuraEffect::HandleModCharm, // 6 SPELL_AURA_MOD_CHARM
69 &AuraEffect::HandleModFear, // 7 SPELL_AURA_MOD_FEAR
70 &AuraEffect::HandleNoImmediateEffect, // 8 SPELL_AURA_PERIODIC_HEAL implemented in AuraEffect::PeriodicTick
71 &AuraEffect::HandleModAttackSpeed, // 9 SPELL_AURA_MOD_ATTACKSPEED
72 &AuraEffect::HandleModThreat, // 10 SPELL_AURA_MOD_THREAT
73 &AuraEffect::HandleModTaunt, // 11 SPELL_AURA_MOD_TAUNT
74 &AuraEffect::HandleAuraModStun, // 12 SPELL_AURA_MOD_STUN
75 &AuraEffect::HandleModDamageDone, // 13 SPELL_AURA_MOD_DAMAGE_DONE
76 &AuraEffect::HandleNoImmediateEffect, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
77 &AuraEffect::HandleNoImmediateEffect, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
78 &AuraEffect::HandleModStealth, // 16 SPELL_AURA_MOD_STEALTH
79 &AuraEffect::HandleModStealthDetect, // 17 SPELL_AURA_MOD_DETECT
80 &AuraEffect::HandleModInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
81 &AuraEffect::HandleModInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECT
82 &AuraEffect::HandleNoImmediateEffect, // 20 SPELL_AURA_OBS_MOD_HEALTH implemented in AuraEffect::PeriodicTick
83 &AuraEffect::HandleNoImmediateEffect, // 21 SPELL_AURA_OBS_MOD_POWER implemented in AuraEffect::PeriodicTick
84 &AuraEffect::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE
85 &AuraEffect::HandleNoImmediateEffect, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL implemented in AuraEffect::PeriodicTick
86 &AuraEffect::HandleNoImmediateEffect, // 24 SPELL_AURA_PERIODIC_ENERGIZE implemented in AuraEffect::PeriodicTick
87 &AuraEffect::HandleAuraModPacify, // 25 SPELL_AURA_MOD_PACIFY
88 &AuraEffect::HandleAuraModRoot, // 26 SPELL_AURA_MOD_ROOT
89 &AuraEffect::HandleAuraModSilence, // 27 SPELL_AURA_MOD_SILENCE
90 &AuraEffect::HandleNoImmediateEffect, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
91 &AuraEffect::HandleAuraModStat, // 29 SPELL_AURA_MOD_STAT
92 &AuraEffect::HandleAuraModSkill, // 30 SPELL_AURA_MOD_SKILL
93 &AuraEffect::HandleAuraModIncreaseSpeed, // 31 SPELL_AURA_MOD_INCREASE_SPEED
94 &AuraEffect::HandleAuraModIncreaseMountedSpeed, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
95 &AuraEffect::HandleAuraModDecreaseSpeed, // 33 SPELL_AURA_MOD_DECREASE_SPEED
96 &AuraEffect::HandleAuraModIncreaseHealth, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
97 &AuraEffect::HandleAuraModIncreaseEnergy, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
98 &AuraEffect::HandleAuraModShapeshift, // 36 SPELL_AURA_MOD_SHAPESHIFT
99 &AuraEffect::HandleAuraModEffectImmunity, // 37 SPELL_AURA_EFFECT_IMMUNITY
100 &AuraEffect::HandleAuraModStateImmunity, // 38 SPELL_AURA_STATE_IMMUNITY
101 &AuraEffect::HandleAuraModSchoolImmunity, // 39 SPELL_AURA_SCHOOL_IMMUNITY
102 &AuraEffect::HandleAuraModDmgImmunity, // 40 SPELL_AURA_DAMAGE_IMMUNITY
103 &AuraEffect::HandleAuraModDispelImmunity, // 41 SPELL_AURA_DISPEL_IMMUNITY
104 &AuraEffect::HandleNoImmediateEffect, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in AuraEffect::HandleProc
105 &AuraEffect::HandleNoImmediateEffect, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in AuraEffect::HandleProc
106 &AuraEffect::HandleAuraTrackCreatures, // 44 SPELL_AURA_TRACK_CREATURES
107 &AuraEffect::HandleAuraTrackResources, // 45 SPELL_AURA_TRACK_RESOURCES
108 &AuraEffect::HandleNULL, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
109 &AuraEffect::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT
110 &AuraEffect::HandleNoImmediateEffect, // 48 SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
111 &AuraEffect::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT
112 &AuraEffect::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT implemented in Unit::SpellCriticalHealingBonus
113 &AuraEffect::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
114 &AuraEffect::HandleAuraModWeaponCritPercent, // 52 SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
115 &AuraEffect::HandleNoImmediateEffect, // 53 SPELL_AURA_PERIODIC_LEECH implemented in AuraEffect::PeriodicTick
116 &AuraEffect::HandleNoImmediateEffect, // 54 SPELL_AURA_MOD_HIT_CHANCE implemented in Unit::MeleeSpellMissChance
117 &AuraEffect::HandleModSpellHitChance, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
118 &AuraEffect::HandleAuraTransform, // 56 SPELL_AURA_TRANSFORM
119 &AuraEffect::HandleModSpellCritChance, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
120 &AuraEffect::HandleAuraModIncreaseSwimSpeed, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
121 &AuraEffect::HandleNoImmediateEffect, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
122 &AuraEffect::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
123 &AuraEffect::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
124 &AuraEffect::HandleNoImmediateEffect, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL implemented in AuraEffect::PeriodicTick
125 &AuraEffect::HandleUnused, // 63 unused (3.2.0) old SPELL_AURA_PERIODIC_MANA_FUNNEL
126 &AuraEffect::HandleNoImmediateEffect, // 64 SPELL_AURA_PERIODIC_MANA_LEECH implemented in AuraEffect::PeriodicTick
127 &AuraEffect::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
128 &AuraEffect::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
129 &AuraEffect::HandleAuraModDisarm, // 67 SPELL_AURA_MOD_DISARM
130 &AuraEffect::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
131 &AuraEffect::HandleNoImmediateEffect, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
132 &AuraEffect::HandleUnused, // 70 SPELL_AURA_EXTRA_ATTACKS clientside
133 &AuraEffect::HandleModSpellCritChanceShool, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
134 &AuraEffect::HandleModPowerCostPCT, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
135 &AuraEffect::HandleModPowerCost, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
136 &AuraEffect::HandleNoImmediateEffect, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
137 &AuraEffect::HandleNoImmediateEffect, // 75 SPELL_AURA_MOD_LANGUAGE
138 &AuraEffect::HandleNoImmediateEffect, // 76 SPELL_AURA_FAR_SIGHT
139 &AuraEffect::HandleModMechanicImmunity, // 77 SPELL_AURA_MECHANIC_IMMUNITY
140 &AuraEffect::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED
141 &AuraEffect::HandleModDamagePercentDone, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
142 &AuraEffect::HandleModPercentStat, // 80 SPELL_AURA_MOD_PERCENT_STAT
143 &AuraEffect::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT implemented in Unit::CalcAbsorbResist
144 &AuraEffect::HandleWaterBreathing, // 82 SPELL_AURA_WATER_BREATHING
145 &AuraEffect::HandleModBaseResistance, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
146 &AuraEffect::HandleNoImmediateEffect, // 84 SPELL_AURA_MOD_REGEN implemented in Player::RegenerateHealth
147 &AuraEffect::HandleModPowerRegen, // 85 SPELL_AURA_MOD_POWER_REGEN
148 &AuraEffect::HandleChannelDeathItem, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
149 &AuraEffect::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
150 &AuraEffect::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT implemented in Player::RegenerateHealth
151 &AuraEffect::HandleNoImmediateEffect, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
152 &AuraEffect::HandleUnused, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
153 &AuraEffect::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
154 &AuraEffect::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
155 &AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
156 &AuraEffect::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::GetPowerRegen
157 &AuraEffect::HandleAuraGhost, // 95 SPELL_AURA_GHOST
158 &AuraEffect::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::SelectMagnetTarget
159 &AuraEffect::HandleNoImmediateEffect, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
160 &AuraEffect::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT
161 &AuraEffect::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER
162 &AuraEffect::HandleUnused, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
163 &AuraEffect::HandleModResistancePercent, //101 SPELL_AURA_MOD_RESISTANCE_PCT
164 &AuraEffect::HandleNoImmediateEffect, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
165 &AuraEffect::HandleAuraModTotalThreat, //103 SPELL_AURA_MOD_TOTAL_THREAT
166 &AuraEffect::HandleAuraWaterWalk, //104 SPELL_AURA_WATER_WALK
167 &AuraEffect::HandleAuraFeatherFall, //105 SPELL_AURA_FEATHER_FALL
168 &AuraEffect::HandleAuraHover, //106 SPELL_AURA_HOVER
169 &AuraEffect::HandleNoImmediateEffect, //107 SPELL_AURA_ADD_FLAT_MODIFIER implemented in AuraEffect::CalculateSpellMod()
170 &AuraEffect::HandleNoImmediateEffect, //108 SPELL_AURA_ADD_PCT_MODIFIER implemented in AuraEffect::CalculateSpellMod()
171 &AuraEffect::HandleNoImmediateEffect, //109 SPELL_AURA_ADD_TARGET_TRIGGER
172 &AuraEffect::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT implemented in Player::UpdatePowerRegen, Creature::Regenerate
173 &AuraEffect::HandleNoImmediateEffect, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER implemented in Unit::SelectMagnetTarget
174 &AuraEffect::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
175 &AuraEffect::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
176 &AuraEffect::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
177 &AuraEffect::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
178 &AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
179 &AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
180 &AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
181 &AuraEffect::HandleUnused, //119 unused (3.2.0) old SPELL_AURA_SHARE_PET_TRACKING
182 &AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
183 &AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
184 &AuraEffect::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
185 &AuraEffect::HandleModTargetResistance, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
186 &AuraEffect::HandleAuraModRangedAttackPower, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
187 &AuraEffect::HandleNoImmediateEffect, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
188 &AuraEffect::HandleNoImmediateEffect, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
189 &AuraEffect::HandleNoImmediateEffect, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
190 &AuraEffect::HandleModPossessPet, //128 SPELL_AURA_MOD_POSSESS_PET
191 &AuraEffect::HandleAuraModIncreaseSpeed, //129 SPELL_AURA_MOD_SPEED_ALWAYS
192 &AuraEffect::HandleAuraModIncreaseMountedSpeed, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
193 &AuraEffect::HandleNoImmediateEffect, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
194 &AuraEffect::HandleAuraModIncreaseEnergyPercent, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
195 &AuraEffect::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
196 &AuraEffect::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
197 &AuraEffect::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE
198 &AuraEffect::HandleNoImmediateEffect, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus
199 &AuraEffect::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
200 &AuraEffect::HandleModMeleeSpeedPct, //138 SPELL_AURA_MOD_MELEE_HASTE
201 &AuraEffect::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION
202 &AuraEffect::HandleAuraModRangedHaste, //140 SPELL_AURA_MOD_RANGED_HASTE
203 &AuraEffect::HandleRangedAmmoHaste, //141 SPELL_AURA_MOD_RANGED_AMMO_HASTE
204 &AuraEffect::HandleAuraModBaseResistancePCT, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
205 &AuraEffect::HandleAuraModResistanceExclusive, //143 SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
206 &AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
207 &AuraEffect::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
208 &AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
209 &AuraEffect::HandleModMechanicImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
210 &AuraEffect::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS
211 &AuraEffect::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
212 &AuraEffect::HandleShieldBlockValuePercent, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
213 &AuraEffect::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
214 &AuraEffect::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
215 &AuraEffect::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT
216 &AuraEffect::HandleModStealthLevel, //154 SPELL_AURA_MOD_STEALTH_LEVEL
217 &AuraEffect::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING
218 &AuraEffect::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN
219 &AuraEffect::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI
220 &AuraEffect::HandleShieldBlockValue, //158 SPELL_AURA_MOD_SHIELD_BLOCKVALUE
221 &AuraEffect::HandleNoImmediateEffect, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
222 &AuraEffect::HandleNoImmediateEffect, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemented in Unit::MagicSpellHitResult
223 &AuraEffect::HandleNoImmediateEffect, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
224 &AuraEffect::HandleNoImmediateEffect, //162 SPELL_AURA_POWER_BURN implemented in AuraEffect::PeriodicTick
225 &AuraEffect::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
226 &AuraEffect::HandleUnused, //164 unused (3.2.0), only one test spell
227 &AuraEffect::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
228 &AuraEffect::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
229 &AuraEffect::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
230 &AuraEffect::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
231 &AuraEffect::HandleNoImmediateEffect, //169 SPELL_AURA_MOD_CRIT_PERCENT_VERSUS implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus
232 &AuraEffect::HandleDetectAmore, //170 SPELL_AURA_DETECT_AMORE used to detect various spells that change visual of units for aura target
233 &AuraEffect::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
234 &AuraEffect::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
235 &AuraEffect::HandleUnused, //173 unused (3.2.0) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
236 &AuraEffect::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
237 &AuraEffect::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
238 &AuraEffect::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
239 &AuraEffect::HandleCharmConvert, //177 SPELL_AURA_AOE_CHARM
240 &AuraEffect::HandleNoImmediateEffect, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
241 &AuraEffect::HandleNoImmediateEffect, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
242 &AuraEffect::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
243 &AuraEffect::HandleUnused, //181 unused (3.2.0) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
244 &AuraEffect::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
245 &AuraEffect::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746 - miscvalue - spell school
246 &AuraEffect::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
247 &AuraEffect::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
248 &AuraEffect::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
249 &AuraEffect::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
250 &AuraEffect::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
251 &AuraEffect::HandleModRating, //189 SPELL_AURA_MOD_RATING
252 &AuraEffect::HandleNoImmediateEffect, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN implemented in Player::CalculateReputationGain
253 &AuraEffect::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
254 &AuraEffect::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_MOD_MELEE_RANGED_HASTE
255 &AuraEffect::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
256 &AuraEffect::HandleNoImmediateEffect, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
257 &AuraEffect::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
258 &AuraEffect::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN - flat mod of spell cooldowns
259 &AuraEffect::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
260 &AuraEffect::HandleUnused, //198 unused (3.2.0) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
261 &AuraEffect::HandleNoImmediateEffect, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
262 &AuraEffect::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::RewardPlayerAndGroupAtKill
263 &AuraEffect::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
264 &AuraEffect::HandleNoImmediateEffect, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
265 &AuraEffect::HandleNoImmediateEffect, //203 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
266 &AuraEffect::HandleNoImmediateEffect, //204 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
267 &AuraEffect::HandleNULL, //205 SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN
268 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //206 SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED
269 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //207 SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
270 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //208 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
271 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //209 SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
272 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //210 SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS
273 &AuraEffect::HandleAuraModIncreaseFlightSpeed, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
274 &AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent, //212 SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
275 &AuraEffect::HandleNoImmediateEffect, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
276 &AuraEffect::HandleNULL, //214 Tamed Pet Passive
277 &AuraEffect::HandleArenaPreparation, //215 SPELL_AURA_ARENA_PREPARATION
278 &AuraEffect::HandleModCastingSpeed, //216 SPELL_AURA_HASTE_SPELLS
279 &AuraEffect::HandleNULL, //217 69106 - killing spree helper - unknown use
280 &AuraEffect::HandleAuraModRangedHaste, //218 SPELL_AURA_HASTE_RANGED
281 &AuraEffect::HandleModManaRegen, //219 SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
282 &AuraEffect::HandleModRatingFromStat, //220 SPELL_AURA_MOD_RATING_FROM_STAT
283 &AuraEffect::HandleModDetaunt, //221 SPELL_AURA_MOD_DETAUNT
284 &AuraEffect::HandleUnused, //222 unused (3.2.0) only for spell 44586 that not used in real spell cast
285 &AuraEffect::HandleNoImmediateEffect, //223 SPELL_AURA_RAID_PROC_FROM_CHARGE
286 &AuraEffect::HandleUnused, //224 unused (3.0.8a)
287 &AuraEffect::HandleNoImmediateEffect, //225 SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
288 &AuraEffect::HandleNoImmediateEffect, //226 SPELL_AURA_PERIODIC_DUMMY implemented in AuraEffect::PeriodicTick
289 &AuraEffect::HandleNoImmediateEffect, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE implemented in AuraEffect::PeriodicTick
290 &AuraEffect::HandleNoImmediateEffect, //228 SPELL_AURA_DETECT_STEALTH stealth detection
291 &AuraEffect::HandleNoImmediateEffect, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
292 &AuraEffect::HandleAuraModIncreaseHealth, //230 SPELL_AURA_MOD_INCREASE_HEALTH_2
293 &AuraEffect::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
294 &AuraEffect::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
295 &AuraEffect::HandleUnused, //233 set model id to the one of the creature with id GetMiscValue() - clientside
296 &AuraEffect::HandleNoImmediateEffect, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
297 &AuraEffect::HandleNoImmediateEffect, //235 SPELL_AURA_MOD_DISPEL_RESIST implement in Unit::MagicSpellHitResult
298 &AuraEffect::HandleAuraControlVehicle, //236 SPELL_AURA_CONTROL_VEHICLE
299 &AuraEffect::HandleModSpellDamagePercentFromAttackPower, //237 SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER implemented in Unit::SpellBaseDamageBonus
300 &AuraEffect::HandleModSpellHealingPercentFromAttackPower, //238 SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER implemented in Unit::SpellBaseHealingBonus
301 &AuraEffect::HandleAuraModScale, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
302 &AuraEffect::HandleAuraModExpertise, //240 SPELL_AURA_MOD_EXPERTISE
303 &AuraEffect::HandleForceMoveForward, //241 SPELL_AURA_FORCE_MOVE_FORWARD Forces the caster to move forward
304 &AuraEffect::HandleNULL, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING - 2 test spells: 44183 and 44182
305 &AuraEffect::HandleAuraModFaction, //243 SPELL_AURA_MOD_FACTION
306 &AuraEffect::HandleComprehendLanguage, //244 SPELL_AURA_COMPREHEND_LANGUAGE
307 &AuraEffect::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
308 &AuraEffect::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura
309 &AuraEffect::HandleAuraCloneCaster, //247 SPELL_AURA_CLONE_CASTER
310 &AuraEffect::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
311 &AuraEffect::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
312 &AuraEffect::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
313 &AuraEffect::HandleNoImmediateEffect, //251 SPELL_AURA_MOD_ENEMY_DODGE implemented in Unit::GetUnitDodgeChance
314 &AuraEffect::HandleModCombatSpeedPct, //252 SPELL_AURA_252 Is there any difference between this and SPELL_AURA_MELEE_SLOW ? maybe not stacking mod?
315 &AuraEffect::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical
316 &AuraEffect::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND
317 &AuraEffect::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
318 &AuraEffect::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
319 &AuraEffect::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
320 &AuraEffect::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL
321 &AuraEffect::HandleNoImmediateEffect, //259 SPELL_AURA_MOD_HOT_PCT implemented in Unit::SpellHealingBonus
322 &AuraEffect::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
323 &AuraEffect::HandlePhase, //261 SPELL_AURA_PHASE
324 &AuraEffect::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in Spell::CheckCast
325 &AuraEffect::HandleAuraAllowOnlyAbility, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
326 &AuraEffect::HandleUnused, //264 unused (3.2.0)
327 &AuraEffect::HandleUnused, //265 unused (3.2.0)
328 &AuraEffect::HandleUnused, //266 unused (3.2.0)
329 &AuraEffect::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
330 &AuraEffect::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
331 &AuraEffect::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
332 &AuraEffect::HandleNoImmediateEffect, //270 SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
333 &AuraEffect::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonusTaken and Unit::MeleeDamageBonusTaken
334 &AuraEffect::HandleNoImmediateEffect, //272 SPELL_AURA_IGNORE_MELEE_RESET
335 &AuraEffect::HandleUnused, //273 clientside
336 &AuraEffect::HandleNoImmediateEffect, //274 SPELL_AURA_CONSUME_NO_AMMO implemented in spell::CalculateDamageDoneForAllTargets
337 &AuraEffect::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
338 &AuraEffect::HandleNULL, //276 mod damage % mechanic?
339 &AuraEffect::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap
340 &AuraEffect::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
341 &AuraEffect::HandleNoImmediateEffect, //279 SPELL_AURA_INITIALIZE_IMAGES
342 &AuraEffect::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
343 &AuraEffect::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor
344 &AuraEffect::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_MOD_BASE_HEALTH_PCT
345 &AuraEffect::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
346 &AuraEffect::HandleAuraLinked, //284 SPELL_AURA_LINKED
347 &AuraEffect::HandleNoImmediateEffect, //285 SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR implemented in AuraEffect::PeriodicTick and Player::UpdateAttackPowerAndDamage
348 &AuraEffect::HandleNoImmediateEffect, //286 SPELL_AURA_ABILITY_PERIODIC_CRIT implemented in AuraEffect::PeriodicTick
349 &AuraEffect::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
350 &AuraEffect::HandleNoImmediateEffect, //288 SPELL_AURA_IGNORE_HIT_DIRECTION implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult Unit::RollMeleeOutcomeAgainst
351 &AuraEffect::HandleNoImmediateEffect, //289 SPELL_AURA_PREVENT_DURABILITY_LOSS implemented in Player::DurabilityPointsLoss
352 &AuraEffect::HandleAuraModCritPct, //290 SPELL_AURA_MOD_CRIT_PCT
353 &AuraEffect::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_XP_QUEST_PCT implemented in Player::RewardQuest
354 &AuraEffect::HandleAuraOpenStable, //292 SPELL_AURA_OPEN_STABLE
355 &AuraEffect::HandleAuraOverrideSpells, //293 SPELL_AURA_OVERRIDE_SPELLS auras which probably add set of abilities to their target based on it's miscvalue
356 &AuraEffect::HandleAuraPreventRegeneratePower, //294 SPELL_AURA_PREVENT_REGENERATE_POWER
357 &AuraEffect::HandleUnused, //295 0 spells in 3.3.5
358 &AuraEffect::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
359 &AuraEffect::HandleNULL, //297 Spirit Burst spells
360 &AuraEffect::HandleNULL, //298 70569 - Strangulating, maybe prevents talk or cast
361 &AuraEffect::HandleUnused, //299 unused
362 &AuraEffect::HandleNoImmediateEffect, //300 SPELL_AURA_SHARE_DAMAGE_PCT implemented in Unit::DealDamage
363 &AuraEffect::HandleNoImmediateEffect, //301 SPELL_AURA_SCHOOL_HEAL_ABSORB implemented in Unit::CalcHealAbsorb
364 &AuraEffect::HandleUnused, //302 0 spells in 3.3.5
365 &AuraEffect::HandleNoImmediateEffect, //303 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
366 &AuraEffect::HandleAuraModFakeInebriation, //304 SPELL_AURA_MOD_FAKE_INEBRIATE
367 &AuraEffect::HandleAuraModIncreaseSpeed, //305 SPELL_AURA_MOD_MINIMUM_SPEED
368 &AuraEffect::HandleUnused, //306 0 spells in 3.3.5
369 &AuraEffect::HandleUnused, //307 0 spells in 3.3.5
370 &AuraEffect::HandleNoImmediateEffect, //308 SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER implemented in Unit::GetUnitCriticalChance and Unit::GetUnitSpellCriticalChance
371 &AuraEffect::HandleUnused, //309 0 spells in 3.3.5
372 &AuraEffect::HandleNoImmediateEffect, //310 SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE implemented in Spell::CalculateDamageDone
373 &AuraEffect::HandleNULL, //311 0 spells in 3.3.5
374 &AuraEffect::HandleNULL, //312 0 spells in 3.3.5
375 &AuraEffect::HandleUnused, //313 0 spells in 3.3.5
376 &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
377 &AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
378 &AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_PERIODIC_HASTE implemented in AuraEffect::CalculatePeriodic
379};
380
381AuraEffect::AuraEffect(Aura* base, SpellEffectInfo const& spellEfffectInfo, int32 const* baseAmount, Unit* caster) :
382m_base(base), m_spellInfo(base->GetSpellInfo()), m_effectInfo(spellEfffectInfo), m_spellmod(nullptr),
383m_baseAmount(baseAmount ? *baseAmount : spellEfffectInfo.BasePoints),
384_amount(), _periodicTimer(0), _period(0), _ticksDone(0),
385m_canBeRecalculated(true), m_isPeriodic(false)
386{
387 CalculatePeriodic(caster, true, false);
388
389 _amount = CalculateAmount(caster);
390
392}
393
395{
396 delete m_spellmod;
397}
398
399template <typename Container>
400void AuraEffect::GetTargetList(Container& targetContainer) const
401{
402 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
403 // remove all targets which were not added to new list - they no longer deserve area aura
404 for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
405 {
406 if (appIter->second->HasEffect(GetEffIndex()))
407 targetContainer.push_back(appIter->second->GetTarget());
408 }
409}
410
411template <typename Container>
412void AuraEffect::GetApplicationList(Container& applicationContainer) const
413{
414 Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap();
415 for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter)
416 {
417 if (appIter->second->HasEffect(GetEffIndex()))
418 applicationContainer.push_back(appIter->second);
419 }
420}
421
423{
424 // default amount calculation
425 int32 amount = GetSpellEffectInfo().CalcValue(caster, &m_baseAmount);
426
427 // check item enchant aura cast
428 if (!amount && caster)
429 {
430 ObjectGuid itemGUID = GetBase()->GetCastItemGUID();
431 if (!itemGUID.IsEmpty())
432 {
433 if (Player* playerCaster = caster->ToPlayer())
434 {
435 if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
436 {
437 if (castItem->GetItemSuffixFactor())
438 {
439 if (ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(castItem->GetItemRandomPropertyId())))
440 {
441 for (uint8 k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
442 {
443 if (SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->Enchantment[k]))
444 {
445 for (uint8 t = 0; t < MAX_ITEM_ENCHANTMENT_EFFECTS; ++t)
446 {
447 if (pEnchant->EffectArg[t] == m_spellInfo->Id)
448 {
449 amount = uint32((item_rand_suffix->AllocationPct[k] * castItem->GetItemSuffixFactor()) / 10000);
450 break;
451 }
452 }
453 }
454
455 if (amount)
456 break;
457 }
458 }
459 }
460 }
461 }
462 }
463 }
464
465 // custom amount calculations go here
466 switch (GetAuraType())
467 {
468 // crowd control auras
474 m_canBeRecalculated = false;
476 break;
477 amount = int32(GetBase()->GetUnitOwner()->CountPctFromMaxHealth(10));
478 if (caster)
479 {
480 // Glyphs increasing damage cap
482 for (Unit::AuraEffectList::const_iterator itr = overrideClassScripts.begin(); itr != overrideClassScripts.end(); ++itr)
483 {
484 if ((*itr)->IsAffectingSpell(m_spellInfo))
485 {
486 // Glyph of Fear, Glyph of Frost nova and similar auras
487 if ((*itr)->GetMiscValue() == 7801)
488 {
489 AddPct(amount, (*itr)->GetAmount());
490 break;
491 }
492 }
493 }
494 }
495 break;
498 m_canBeRecalculated = false;
499 break;
500 default:
501 break;
502 }
503
504 if (caster)
505 {
506 switch (GetAuraType())
507 {
510 if (GetBase()->GetType() == UNIT_AURA_TYPE)
511 amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetSpellEffectInfo(), GetBase()->GetDonePct());
512 break;
514 if (GetBase()->GetType() == UNIT_AURA_TYPE)
515 amount = caster->SpellHealingBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetSpellEffectInfo(), GetBase()->GetDonePct());
516 break;
517 default:
518 break;
519 }
520 }
521
523 {
525 amount = std::accumulate(std::begin(periodicAuras), std::end(periodicAuras), amount, [this](int32 val, AuraEffect const* aurEff)
526 {
527 if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex() && aurEff->GetTotalTicks() > 0)
528 val += aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks()) / static_cast<int32>(aurEff->GetTotalTicks());
529 return val;
530 });
531 }
532
534 amount *= GetBase()->GetStackAmount();
535 return amount;
536}
537
539{
540 uint32 totalTicks = 0;
541 if (_period && !GetBase()->IsPermanent())
542 {
543 totalTicks = static_cast<uint32>(GetBase()->GetMaxDuration() / _period);
545 ++totalTicks;
546 }
547
548 return totalTicks;
549}
550
551void AuraEffect::ResetPeriodic(bool resetPeriodicTimer /*= false*/)
552{
553 _ticksDone = 0;
554 if (resetPeriodicTimer)
555 {
556 _periodicTimer = 0;
557 // Start periodic on next tick or at aura apply
560 }
561}
562
563void AuraEffect::CalculatePeriodic(Unit* caster, bool resetPeriodicTimer /*= true*/, bool load /*= false*/)
564{
566
567 // prepare periodics
568 switch (GetAuraType())
569 {
585 m_isPeriodic = true;
586 break;
587 default:
588 break;
589 }
590
592
593 if (!m_isPeriodic)
594 return;
595
596 Player* modOwner = caster ? caster->GetSpellModOwner() : nullptr;
597 // Apply casting time mods
598 if (_period)
599 {
600 // Apply periodic time mod
601 if (modOwner)
603
604 if (caster)
605 {
606 // Haste modifies periodic time of channeled spells
609 // and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE
612 }
613 }
614 else // prevent infinite loop on Update
615 m_isPeriodic = false;
616
617 if (load) // aura loaded from db
618 {
619 if (_period && !GetBase()->IsPermanent())
620 {
621 uint32 elapsedTime = GetBase()->GetMaxDuration() - GetBase()->GetDuration();
622 _ticksDone = elapsedTime / uint32(_period);
623 _periodicTimer = elapsedTime % uint32(_period);
624 }
625
627 ++_ticksDone;
628 }
629 else // aura just created or reapplied
630 {
631 // reset periodic timer on aura create or reapply
632 // we don't reset periodic timers when aura is triggered by proc
633 ResetPeriodic(resetPeriodicTimer);
634 }
635}
636
638{
639 switch (GetAuraType())
640 {
643 if (!m_spellmod)
644 {
647
648 m_spellmod->type = SpellModType(uint32(GetAuraType())); // SpellModType value == spell aura types
651 }
653 break;
654 default:
655 break;
656 }
658}
659
660void AuraEffect::ChangeAmount(int32 newAmount, bool mark, bool onStackOrReapply)
661{
662 // Reapply if amount change
663 uint8 handleMask = 0;
664 if (newAmount != GetAmount())
666 if (onStackOrReapply)
667 handleMask |= AURA_EFFECT_HANDLE_REAPPLY;
668
669 if (!handleMask)
670 return;
671
672 std::vector<AuraApplication*> effectApplications;
673 GetApplicationList(effectApplications);
674
675 for (AuraApplication* aurApp : effectApplications)
676 {
677 aurApp->GetTarget()->_RegisterAuraEffect(this, false);
678 HandleEffect(aurApp, handleMask, false);
679 }
680
681 if (handleMask & AURA_EFFECT_HANDLE_CHANGE_AMOUNT)
682 {
683 if (!mark)
684 _amount = newAmount;
685 else
686 SetAmount(newAmount);
688 }
689
690 for (AuraApplication* aurApp : effectApplications)
691 {
692 if (aurApp->GetRemoveMode() != AURA_REMOVE_NONE)
693 continue;
694
695 aurApp->GetTarget()->_RegisterAuraEffect(this, true);
696 HandleEffect(aurApp, handleMask, true);
697 }
698}
699
700void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)
701{
702 // check if call is correct, we really don't want using bitmasks here (with 1 exception)
706 || mode == AURA_EFFECT_HANDLE_STAT
707 || mode == AURA_EFFECT_HANDLE_SKILL
710
711 // register/unregister effect in lists in case of real AuraEffect apply/remove
712 // registration/unregistration is done always before real effect handling (some effect handlers code is depending on this)
713 if (mode & AURA_EFFECT_HANDLE_REAL)
714 aurApp->GetTarget()->_RegisterAuraEffect(this, apply);
715
716 // real aura apply/remove, handle modifier
718 ApplySpellMod(aurApp->GetTarget(), apply);
719
720 // call scripts helping/replacing effect handlers
721 bool prevented = false;
722 if (apply)
723 prevented = GetBase()->CallScriptEffectApplyHandlers(this, aurApp, (AuraEffectHandleModes)mode);
724 else
725 prevented = GetBase()->CallScriptEffectRemoveHandlers(this, aurApp, (AuraEffectHandleModes)mode);
726
727 // check if script events have removed the aura already
728 if (apply && aurApp->GetRemoveMode())
729 return;
730
731 // call default effect handler if it wasn't prevented
732 if (!prevented)
733 (*this.*AuraEffectHandler[GetAuraType()])(aurApp, mode, apply);
734
735 // check if the default handler reemoved the aura
736 if (apply && aurApp->GetRemoveMode())
737 return;
738
739 // call scripts triggering additional events after apply/remove
740 if (apply)
742 else
744}
745
746void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply)
747{
749 ASSERT(aurApp);
750 HandleEffect(aurApp, mode, apply);
751}
752
753void AuraEffect::ApplySpellMod(Unit* target, bool apply)
754{
755 if (!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
756 return;
757
758 target->ToPlayer()->AddSpellMod(m_spellmod, apply);
759
760 // Auras with charges do not mod amount of passive auras
761 if (GetBase()->IsUsingCharges())
762 return;
763 // reapply some passive spells after add/remove related spellmods
764 // Warning: it is a dead loop if 2 auras each other amount-shouldn't happen
765 switch (GetMiscValue())
766 {
768 case SPELLMOD_EFFECT1:
769 case SPELLMOD_EFFECT2:
770 case SPELLMOD_EFFECT3:
771 {
772 ObjectGuid guid = target->GetGUID();
773 Unit::AuraApplicationMap & auras = target->GetAppliedAuras();
774 for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
775 {
776 Aura* aura = iter->second->GetBase();
777 // only passive and permament auras-active auras should have amount set on spellcast and not be affected
778 // if aura is cast by others, it will not be affected
779 if ((aura->IsPassive() || aura->IsPermanent()) && aura->GetCasterGUID() == guid && aura->GetSpellInfo()->IsAffectedBySpellMod(m_spellmod))
780 {
782 {
783 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
784 {
785 if (AuraEffect* aurEff = aura->GetEffect(i))
786 aurEff->RecalculateAmount();
787 }
788 }
789 else if (GetMiscValue() == SPELLMOD_EFFECT1)
790 {
791 if (AuraEffect* aurEff = aura->GetEffect(0))
792 aurEff->RecalculateAmount();
793 }
794 else if (GetMiscValue() == SPELLMOD_EFFECT2)
795 {
796 if (AuraEffect* aurEff = aura->GetEffect(1))
797 aurEff->RecalculateAmount();
798 }
799 else //if (modOp == SPELLMOD_EFFECT3)
800 {
801 if (AuraEffect* aurEff = aura->GetEffect(2))
802 aurEff->RecalculateAmount();
803 }
804 }
805 }
806 break;
807 }
808 default:
809 break;
810 }
811}
812
813void AuraEffect::Update(uint32 diff, Unit* caster)
814{
815 if (!m_isPeriodic || (GetBase()->GetDuration() < 0 && !GetBase()->IsPassive() && !GetBase()->IsPermanent()))
816 return;
817
818 uint32 totalTicks = GetTotalTicks();
819
820 _periodicTimer += diff;
821 while (_periodicTimer >= _period)
822 {
824
825 if (!GetBase()->IsPermanent() && (_ticksDone + 1) > totalTicks)
826 break;
827
828 ++_ticksDone;
829
831
832 std::vector<AuraApplication*> effectApplications;
833 GetApplicationList(effectApplications);
834
835 // tick on targets of effects
836 for (AuraApplication* aurApp : effectApplications)
837 PeriodicTick(aurApp, caster);
838 }
839}
840
841float AuraEffect::GetCritChanceFor(Unit const* caster, Unit const* target) const
842{
843 return target->SpellCritChanceTaken(caster, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), GetBase()->GetCritChance(), GetSpellInfo()->GetAttackType(), true);
844}
845
847{
848 if (!spell)
849 return false;
850
851 // Check family name and EffectClassMask
852 if (!spell->IsAffected(m_spellInfo->SpellFamilyName, GetSpellEffectInfo().SpellClassMask))
853 return false;
854
855 return true;
856}
857
858void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const
859{
860 if (caster)
861 caster->SendSpellDamageImmune(target, m_spellInfo->Id);
862}
863
865{
866 bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(this, aurApp);
867 if (prevented)
868 return;
869
870 Unit* target = aurApp->GetTarget();
871
872 // Update serverside orientation of tracking channeled auras on periodic update ticks
873 // exclude players because can turn during channeling and shouldn't desync orientation client/server
875 {
876 ObjectGuid const channelGuid = caster->GetChannelObjectGuid();
877 if (!channelGuid.IsEmpty() && channelGuid != caster->GetGUID())
878 if (WorldObject const* objectTarget = ObjectAccessor::GetWorldObject(*caster, channelGuid))
879 caster->SetInFront(objectTarget);
880 }
881
882 switch (GetAuraType())
883 {
885 // handled via scripts
886 break;
889 break;
891 // Don't actually do anything - client will trigger casts of these spells by itself
892 break;
895 break;
898 HandlePeriodicDamageAurasTick(target, caster);
899 break;
901 HandlePeriodicHealthLeechAuraTick(target, caster);
902 break;
905 break;
908 HandlePeriodicHealAurasTick(target, caster);
909 break;
911 HandlePeriodicManaLeechAuraTick(target, caster);
912 break;
914 HandleObsModPowerAuraTick(target, caster);
915 break;
917 HandlePeriodicEnergizeAuraTick(target, caster);
918 break;
920 HandlePeriodicPowerBurnAuraTick(target, caster);
921 break;
924 break;
925 default:
926 break;
927 }
928}
929
931{
932 bool result = GetBase()->CallScriptCheckEffectProcHandlers(this, aurApp, eventInfo);
933 if (!result)
934 return false;
935
936 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
937 switch (GetAuraType())
938 {
944 {
945 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
946 if (!damageInfo || !damageInfo->GetDamage())
947 return false;
948
949 // Spell own damage at apply won't break CC
950 if (spellInfo && spellInfo == GetSpellInfo())
951 {
952 Aura* aura = GetBase();
953 // called from spellcast, should not have ticked yet
954 if (aura->GetDuration() == aura->GetMaxDuration())
955 return false;
956 }
957 break;
958 }
961 // compare mechanic
962 if (!spellInfo || static_cast<int32>(spellInfo->Mechanic) != GetMiscValue())
963 return false;
964 break;
966 // skip melee hits and instant cast spells
967 if (!spellInfo || !spellInfo->CalcCastTime())
968 return false;
969 break;
971 // Compare casters
972 if (GetCasterGUID() != eventInfo.GetActor()->GetGUID())
973 return false;
974 break;
977 // Skip melee hits and spells with wrong school or zero cost
978 if (!spellInfo || (!spellInfo->ManaCost && !spellInfo->ManaCostPercentage) || // Cost Check
979 !(spellInfo->GetSchoolMask() & GetMiscValue())) // School Check
980 return false;
981 break;
983 // Skip melee hits and spells with wrong school
984 if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()))
985 return false;
986 break;
989 {
990 // Don't proc extra attacks while already processing extra attack spell
991 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
992 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
993 {
994 if (triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
995 {
996 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
997
998 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
999 if (lastExtraAttackSpell == triggerSpellId)
1000 return false;
1001
1002 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
1003 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
1004 if (lastExtraAttackSpell == 16459 || lastExtraAttackSpell == 66923)
1005 return false;
1006 }
1007 }
1008 break;
1009 }
1011 // skip spells that can't crit
1012 if (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR0_CU_CAN_CRIT))
1013 return false;
1014 break;
1015 default:
1016 break;
1017 }
1018
1019 return result;
1020}
1021
1023{
1024 bool prevented = GetBase()->CallScriptEffectProcHandlers(this, aurApp, eventInfo);
1025 if (prevented)
1026 return;
1027
1028 switch (GetAuraType())
1029 {
1030 // CC Auras which use their amount to drop
1031 // Are there any more auras which need this?
1037 HandleBreakableCCAuraProc(aurApp, eventInfo);
1038 break;
1039 case SPELL_AURA_DUMMY:
1041 HandleProcTriggerSpellAuraProc(aurApp, eventInfo);
1042 break;
1044 HandleProcTriggerSpellWithValueAuraProc(aurApp, eventInfo);
1045 break;
1047 HandleProcTriggerDamageAuraProc(aurApp, eventInfo);
1048 break;
1050 HandleRaidProcFromChargeAuraProc(aurApp, eventInfo);
1051 break;
1054 break;
1055 default:
1056 break;
1057 }
1058
1059 GetBase()->CallScriptAfterEffectProcHandlers(this, aurApp, eventInfo);
1060}
1061
1063{
1065 if (!tSpellId)
1066 return;
1067
1068 SpellInfo const* tProto = sSpellMgr->GetSpellInfo(tSpellId);
1069 if (!tProto)
1070 return;
1071
1072 if (tProto->GetDuration() != -1)
1073 return;
1074
1075 // needed for spell 43680, maybe others
1078 uint32(m_spellInfo->GetDuration()) == GetSpellEffectInfo().ApplyAuraPeriod)
1079 return;
1080
1081 target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
1082}
1083
1084void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
1085{
1086 uint32 spellId = 0;
1087 uint32 spellId2 = 0;
1088 uint32 HotWSpellId = 0;
1089
1090 switch (GetMiscValue())
1091 {
1092 case FORM_CAT:
1093 spellId = 3025;
1094 HotWSpellId = 24900;
1095 break;
1096 case FORM_TREE:
1097 spellId = 34123;
1098 break;
1099 case FORM_TRAVEL:
1100 spellId = 5419;
1101 break;
1102 case FORM_AQUA:
1103 spellId = 5421;
1104 break;
1105 case FORM_BEAR:
1106 spellId = 1178;
1107 spellId2 = 21178;
1108 HotWSpellId = 24899;
1109 break;
1110 case FORM_DIREBEAR:
1111 spellId = 9635;
1112 spellId2 = 21178;
1113 HotWSpellId = 24899;
1114 break;
1115 case FORM_BATTLESTANCE:
1116 spellId = 21156;
1117 break;
1119 spellId = 7376;
1120 break;
1122 spellId = 7381;
1123 break;
1124 case FORM_MOONKIN:
1125 spellId = 24905;
1126 spellId2 = 69366;
1127 break;
1128 case FORM_FLIGHT:
1129 spellId = 33948;
1130 spellId2 = 34764;
1131 break;
1132 case FORM_FLIGHT_EPIC:
1133 spellId = 40122;
1134 spellId2 = 40121;
1135 break;
1136 case FORM_METAMORPHOSIS:
1137 spellId = 54817;
1138 spellId2 = 54879;
1139 break;
1141 spellId = 27792;
1142 spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
1143 break;
1144 case FORM_SHADOW:
1145 spellId = 49868;
1146 spellId2 = 71167;
1147 break;
1148 case FORM_GHOSTWOLF:
1149 spellId = 67116;
1150 break;
1151 case FORM_GHOUL:
1152 case FORM_AMBIENT:
1153 case FORM_STEALTH:
1154 case FORM_CREATURECAT:
1155 case FORM_CREATUREBEAR:
1156 break;
1157 default:
1158 break;
1159 }
1160
1161 if (apply)
1162 {
1163 if (spellId)
1164 target->CastSpell(target, spellId, this);
1165
1166 if (spellId2)
1167 target->CastSpell(target, spellId2, this);
1168
1169 if (target->GetTypeId() == TYPEID_PLAYER)
1170 {
1171 Player* plrTarget = target->ToPlayer();
1172
1173 PlayerSpellMap const& sp_list = plrTarget->GetSpellMap();
1174 for (auto itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1175 {
1176 if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled)
1177 continue;
1178
1179 if (itr->first == spellId || itr->first == spellId2)
1180 continue;
1181
1182 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1183 if (!spellInfo || !(spellInfo->IsPassive() || spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
1184 continue;
1185
1186 if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1187 target->CastSpell(target, itr->first, this);
1188 }
1189
1190 // Also do it for Glyphs
1191 for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
1192 {
1193 if (uint32 glyphId = plrTarget->GetGlyph(plrTarget->GetActiveTalentGroup(), i))
1194 {
1195 if (GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId))
1196 {
1197 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(glyph->SpellID);
1198 if (!spellInfo || !(spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) || spellInfo->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
1199 continue;
1200
1201 if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1202 target->CastSpell(target, glyph->SpellID, this);
1203 }
1204 }
1205 }
1206
1207 // Leader of the Pack
1208 if (plrTarget->HasSpell(17007))
1209 {
1210 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932);
1211 if (spellInfo && spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
1212 target->CastSpell(target, 24932, this);
1213 }
1214
1215 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1216 if (plrTarget->HasSpell(63410) || plrTarget->HasSpell(63411))
1217 {
1218 target->RemoveAurasDueToSpell(66530);
1219 if (GetMiscValue() == FORM_TRAVEL || GetMiscValue() == FORM_NONE) // "while in Travel Form or while not shapeshifted"
1220 target->CastSpell(target, 66530, true);
1221 }
1222
1223 // Heart of the Wild
1224 if (HotWSpellId)
1225 {
1226 // hacky, but the only way as spell family is not SPELLFAMILY_DRUID
1228 for (AuraEffect const* aurEff : mModTotalStatPct)
1229 {
1230 // Heart of the Wild
1231 if (aurEff->GetSpellInfo()->SpellIconID == 240 && aurEff->GetMiscValue() == 3)
1232 {
1233 CastSpellExtraArgs args(this);
1234 args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount() / 2); // For each 2% Intelligence, you get 1% stamina and 1% attack power.
1235
1236 target->CastSpell(target, HotWSpellId, args);
1237 break;
1238 }
1239 }
1240 }
1241
1242 switch (GetMiscValue())
1243 {
1244 case FORM_CAT:
1245 // Savage Roar
1246 if (target->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_DRUID, 0, 0x10000000, 0))
1247 target->CastSpell(target, 62071, true);
1248 // Master Shapeshifter - Cat
1249 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1250 {
1252 args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
1253 target->CastSpell(target, 48420, args);
1254 }
1255 break;
1256 case FORM_DIREBEAR:
1257 case FORM_BEAR:
1258 // Master Shapeshifter - Bear
1259 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1260 {
1262 args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
1263 target->CastSpell(target, 48418, args);
1264 }
1265 // Survival of the Fittest
1267 {
1268 CastSpellExtraArgs args(this);
1269 args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetSpellInfo()->GetEffect(EFFECT_2).CalcValue());
1270 target->CastSpell(target, 62069, args);
1271 }
1272 break;
1273 case FORM_MOONKIN:
1274 // Master Shapeshifter - Moonkin
1275 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1276 {
1278 args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
1279 target->CastSpell(target, 48421, args);
1280 }
1281 break;
1282 case FORM_TREE:
1283 // Master Shapeshifter - Tree of Life
1284 if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0))
1285 {
1287 args.AddSpellMod(SPELLVALUE_BASE_POINT0, aurEff->GetAmount());
1288 target->CastSpell(target, 48422, args);
1289 }
1290 break;
1291 }
1292 }
1293 }
1294 else
1295 {
1296 if (spellId)
1297 target->RemoveOwnedAura(spellId, target->GetGUID());
1298 if (spellId2)
1299 target->RemoveOwnedAura(spellId2, target->GetGUID());
1300
1301 // Improved Barkskin - apply/remove armor bonus due to shapeshift
1302 if (Player* player = target->ToPlayer())
1303 {
1304 if (player->HasSpell(63410) || player->HasSpell(63411))
1305 {
1306 target->RemoveAurasDueToSpell(66530);
1307 target->CastSpell(target, 66530, true);
1308 }
1309 }
1310
1312 AuraEffect const* newAura = nullptr;
1313 // 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
1314 for (AuraEffect const* aurEff : shapeshifts)
1315 {
1316 if (aurEff != this)
1317 {
1318 newAura = aurEff;
1319 break;
1320 }
1321 }
1322
1323 Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
1324 for (auto itr = tAuras.begin(); itr != tAuras.end();)
1325 {
1326 // Use the new aura to see on what stance the target will be
1327 uint64 newStance = newAura ? (UI64LIT(1) << (newAura->GetMiscValue() - 1)) : 0;
1328
1329 // If the stances are not compatible with the spell, remove it
1330 if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance))
1331 target->RemoveAura(itr);
1332 else
1333 ++itr;
1334 }
1335 }
1336}
1337
1338/*********************************************************/
1339/*** AURA EFFECT HANDLERS ***/
1340/*********************************************************/
1341
1342/**************************************/
1343/*** VISIBILITY & PHASES ***/
1344/**************************************/
1345
1346void AuraEffect::HandleModInvisibilityDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
1347{
1349 return;
1350
1351 Unit* target = aurApp->GetTarget();
1353
1354 if (apply)
1355 {
1356 target->m_invisibilityDetect.AddFlag(type);
1357 target->m_invisibilityDetect.AddValue(type, GetAmount());
1358 }
1359 else
1360 {
1362 target->m_invisibilityDetect.DelFlag(type);
1363
1364 target->m_invisibilityDetect.AddValue(type, -GetAmount());
1365 }
1366
1367 // call functions which may have additional effects after changing state of unit
1368 if (target->IsInWorld())
1369 target->UpdateObjectVisibility();
1370}
1371
1372void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const
1373{
1375 return;
1376
1377 Unit* target = aurApp->GetTarget();
1379
1380 if (apply)
1381 {
1382 // apply glow vision
1383 if (target->GetTypeId() == TYPEID_PLAYER && (type == INVISIBILITY_GENERAL || type == INVISIBILITY_UNK10))
1385
1386 target->m_invisibility.AddFlag(type);
1387 target->m_invisibility.AddValue(type, GetAmount());
1388 }
1389 else
1390 {
1392 target->m_invisibility.DelFlag(type);
1393
1394 // if not have invisibility auras of type INVISIBILITY_GENERAL or INVISIBILITY_UNK10
1395 // remove glow vision
1397 if (Player* playerTarget = target->ToPlayer())
1399
1400 target->m_invisibility.AddValue(type, -GetAmount());
1401 }
1402
1403 // call functions which may have additional effects after changing state of unit
1404 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1405 {
1406 // drop flag at invisibiliy in bg
1408 }
1409
1410 if (target->IsInWorld())
1411 target->UpdateObjectVisibility();
1412}
1413
1414void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
1415{
1417 return;
1418
1419 Unit* target = aurApp->GetTarget();
1421
1422 if (apply)
1423 {
1424 target->m_stealthDetect.AddFlag(type);
1425 target->m_stealthDetect.AddValue(type, GetAmount());
1426 }
1427 else
1428 {
1430 target->m_stealthDetect.DelFlag(type);
1431
1432 target->m_stealthDetect.AddValue(type, -GetAmount());
1433 }
1434
1435 // call functions which may have additional effects after changing state of unit
1436 if (target->IsInWorld())
1437 target->UpdateObjectVisibility();
1438}
1439
1440void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
1441{
1443 return;
1444
1445 Unit* target = aurApp->GetTarget();
1447
1448 if (apply)
1449 {
1450 target->m_stealth.AddFlag(type);
1451 target->m_stealth.AddValue(type, GetAmount());
1452
1454 if (target->GetTypeId() == TYPEID_PLAYER)
1456 }
1457 else
1458 {
1459 target->m_stealth.AddValue(type, -GetAmount());
1460
1462 target->m_stealth.DelFlag(type);
1463
1464 if (!target->m_stealth.GetFlags())
1465 {
1467 if (target->GetTypeId() == TYPEID_PLAYER)
1469 }
1470 }
1471
1472 // call functions which may have additional effects after changing state of unit
1473 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1474 {
1475 // drop flag at stealth in bg
1477 }
1478
1479 if (target->IsInWorld())
1480 target->UpdateObjectVisibility();
1481}
1482
1483void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const
1484{
1486 return;
1487
1488 Unit* target = aurApp->GetTarget();
1490
1491 if (apply)
1492 target->m_stealth.AddValue(type, GetAmount());
1493 else
1494 target->m_stealth.AddValue(type, -GetAmount());
1495
1496 // call functions which may have additional effects after changing state of unit
1497 if (target->IsInWorld())
1498 target->UpdateObjectVisibility();
1499}
1500
1501void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const
1502{
1504 return;
1505
1506 Unit* target = aurApp->GetTarget();
1507
1508 if (target->GetTypeId() != TYPEID_PLAYER)
1509 return;
1510
1511 if (apply)
1513 else
1514 {
1516 {
1518 for (Unit::AuraEffectList::const_iterator i = amoreAuras.begin(); i != amoreAuras.end(); ++i)
1519 {
1520 if (GetMiscValue() == (*i)->GetMiscValue())
1521 return;
1522 }
1523 }
1524
1526 }
1527}
1528
1529void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 mode, bool apply) const
1530{
1531 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1532 return;
1533
1534 Unit* target = aurApp->GetTarget();
1535
1536 if (target->GetTypeId() != TYPEID_PLAYER)
1537 return;
1538
1539 // prepare spirit state
1540 if (apply)
1541 {
1542 if (target->GetTypeId() == TYPEID_PLAYER)
1543 {
1544 // set stand state (expected in this form)
1545 if (!target->IsStandState())
1547 }
1548
1549 target->SetHealth(1);
1550 }
1551 // die at aura end
1552 else if (target->IsAlive())
1553 // call functions which may have additional effects after changing state of unit
1554 target->setDeathState(JUST_DIED);
1555}
1556
1557void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const
1558{
1560 return;
1561
1562 Unit* target = aurApp->GetTarget();
1563 if (target->GetTypeId() != TYPEID_PLAYER)
1564 return;
1565
1566 if (apply)
1567 {
1571 }
1572 else
1573 {
1574 if (target->HasAuraType(SPELL_AURA_GHOST))
1575 return;
1576
1580 }
1581}
1582
1583void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const
1584{
1585 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1586 return;
1587
1588 Unit* target = aurApp->GetTarget();
1589
1590 // no-phase is also phase state so same code for apply and remove
1591 uint32 newPhase = 0;
1593 if (!phases.empty())
1594 for (Unit::AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
1595 newPhase |= (*itr)->GetMiscValue();
1596
1597 if (Player* player = target->ToPlayer())
1598 {
1599 if (!newPhase)
1600 newPhase = PHASEMASK_NORMAL;
1601
1602 // GM-mode have mask 0xFFFFFFFF
1603 if (player->IsGameMaster())
1604 newPhase = 0xFFFFFFFF;
1605
1606 player->SetPhaseMask(newPhase, false);
1607 player->GetSession()->SendSetPhaseShift(newPhase);
1608 }
1609 else
1610 {
1611 if (!newPhase)
1612 {
1613 newPhase = PHASEMASK_NORMAL;
1614 if (Creature* creature = target->ToCreature())
1615 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1616 newPhase = data->phaseMask;
1617 }
1618
1619 target->SetPhaseMask(newPhase, false);
1620 }
1621
1622 // call functions which may have additional effects after changing state of unit
1623 // phase auras normally not expected at BG but anyway better check
1624 if (apply)
1625 {
1626 // drop flag at invisibiliy in bg
1628 }
1629
1630 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1631 if (target->IsVisible())
1632 target->UpdateObjectVisibility();
1633}
1634
1635/**********************/
1636/*** UNIT MODEL ***/
1637/**********************/
1638
1639void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mode, bool apply) const
1640{
1642 return;
1643
1644 Unit* target = aurApp->GetTarget();
1645
1646 uint32 modelid = 0;
1649
1650 switch (form)
1651 {
1652 case FORM_CAT: // 0x01
1653 case FORM_GHOUL: // 0x07
1655 break;
1656
1657 case FORM_BEAR: // 0x05
1658 case FORM_DIREBEAR: // 0x08
1659
1660 case FORM_BATTLESTANCE: // 0x11
1661 case FORM_DEFENSIVESTANCE: // 0x12
1662 case FORM_BERSERKERSTANCE: // 0x13
1664 break;
1665
1666 case FORM_TREE: // 0x02
1667 case FORM_TRAVEL: // 0x03
1668 case FORM_AQUA: // 0x04
1669 case FORM_AMBIENT: // 0x06
1670
1671 case FORM_STEVES_GHOUL: // 0x09
1672 case FORM_THARONJA_SKELETON: // 0x0A
1673 case FORM_TEST_OF_STRENGTH: // 0x0B
1674 case FORM_BLB_PLAYER: // 0x0C
1675 case FORM_SHADOW_DANCE: // 0x0D
1676 case FORM_CREATUREBEAR: // 0x0E
1677 case FORM_CREATURECAT: // 0x0F
1678 case FORM_GHOSTWOLF: // 0x10
1679
1680 case FORM_TEST: // 0x14
1681 case FORM_ZOMBIE: // 0x15
1682 case FORM_METAMORPHOSIS: // 0x16
1683 case FORM_UNDEAD: // 0x19
1684 case FORM_MASTER_ANGLER: // 0x1A
1685 case FORM_FLIGHT_EPIC: // 0x1B
1686 case FORM_SHADOW: // 0x1C
1687 case FORM_FLIGHT: // 0x1D
1688 case FORM_STEALTH: // 0x1E
1689 case FORM_MOONKIN: // 0x1F
1690 case FORM_SPIRITOFREDEMPTION: // 0x20
1691 break;
1692 default:
1693 TC_LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
1694 }
1695
1696 modelid = target->GetModelForForm(form, GetId());
1697
1698 if (apply)
1699 {
1700 // remove polymorph before changing display id to keep new display id
1701 switch (form)
1702 {
1703 case FORM_CAT:
1704 case FORM_TREE:
1705 case FORM_TRAVEL:
1706 case FORM_AQUA:
1707 case FORM_BEAR:
1708 case FORM_DIREBEAR:
1709 case FORM_FLIGHT_EPIC:
1710 case FORM_FLIGHT:
1711 case FORM_MOONKIN:
1712 {
1713 // remove movement affects
1714 target->RemoveAurasByShapeShift();
1715
1716 // and polymorphic affects
1717 if (target->IsPolymorphed())
1718 target->RemoveAurasDueToSpell(target->GetTransformSpell());
1719 break;
1720 }
1721 default:
1722 break;
1723 }
1724
1725 // remove other shapeshift before applying a new one
1727
1728 // stop handling the effect if it was removed by linked event
1729 if (aurApp->GetRemoveMode())
1730 return;
1731
1732 if (PowerType != POWER_MANA)
1733 {
1734 uint32 oldPower = target->GetPower(PowerType);
1735 // reset power to default values only at power change
1736 if (target->GetPowerType() != PowerType)
1737 target->SetPowerType(PowerType);
1738
1739 switch (form)
1740 {
1741 case FORM_CAT:
1742 case FORM_BEAR:
1743 case FORM_DIREBEAR:
1744 {
1745 // get furor proc chance
1746 int32 FurorChance = 0;
1747 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
1748 FurorChance = std::max(dummy->GetAmount(), 0);
1749
1750 switch (GetMiscValue())
1751 {
1752 case FORM_CAT:
1753 {
1754 CastSpellExtraArgs args(this);
1755 args.AddSpellMod(SPELLVALUE_BASE_POINT0, std::min<int32>(oldPower, FurorChance));
1756 target->SetPower(POWER_ENERGY, 0);
1757 target->CastSpell(target, 17099, args);
1758 break;
1759 }
1760 case FORM_BEAR:
1761 case FORM_DIREBEAR:
1762 if (roll_chance_i(FurorChance))
1763 target->CastSpell(target, 17057, true);
1764 break;
1765 default:
1766 {
1767 uint32 newEnergy = std::min<int32>(target->GetPower(POWER_ENERGY), FurorChance);
1768 target->SetPower(POWER_ENERGY, newEnergy);
1769 break;
1770 }
1771 }
1772 break;
1773 }
1774 default:
1775 break;
1776 }
1777 }
1778 // stop handling the effect if it was removed by linked event
1779 if (aurApp->GetRemoveMode())
1780 return;
1781
1782 ShapeshiftForm prevForm = target->GetShapeshiftForm();
1783 target->SetShapeshiftForm(form);
1784 // add the shapeshift aura's boosts
1785 if (prevForm != form)
1786 HandleShapeshiftBoosts(target, true);
1787
1788 if (modelid > 0)
1789 {
1790 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell());
1791 if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
1792 target->SetDisplayId(modelid);
1793 }
1794 }
1795 else
1796 {
1797 // reset model id if no other auras present
1798 // may happen when aura is applied on linked event on aura removal
1800 {
1802 if (target->GetClass() == CLASS_DRUID)
1803 {
1804 // Remove movement impairing effects also when shifting out
1805 target->RemoveAurasByShapeShift();
1806 }
1807 }
1808
1809 if (modelid > 0)
1810 target->RestoreDisplayId();
1811
1812 switch (form)
1813 {
1814 // Nordrassil Harness - bonus
1815 case FORM_BEAR:
1816 case FORM_DIREBEAR:
1817 case FORM_CAT:
1818 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
1819 target->CastSpell(target, 37316, dummy);
1820 break;
1821 // Nordrassil Regalia - bonus
1822 case FORM_MOONKIN:
1823 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
1824 target->CastSpell(target, 37325, dummy);
1825 break;
1826 case FORM_BATTLESTANCE:
1829 {
1830 uint32 Rage_val = 0;
1831 // Defensive Tactics
1832 if (form == FORM_DEFENSIVESTANCE)
1833 {
1834 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
1835 Rage_val += aurEff->GetAmount() * 10;
1836 }
1837 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
1838 if (target->GetTypeId() == TYPEID_PLAYER)
1839 {
1840 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
1841 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1842 {
1843 if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled)
1844 continue;
1845
1846 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1847 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
1848 Rage_val += target->CalculateSpellDamage(spellInfo->GetEffect(EFFECT_0)) * 10;
1849 }
1850 }
1851 if (target->GetPower(POWER_RAGE) > Rage_val)
1852 target->SetPower(POWER_RAGE, Rage_val);
1853 break;
1854 }
1855 default:
1856 break;
1857 }
1858
1859 // remove the shapeshift aura's boosts
1860 HandleShapeshiftBoosts(target, false);
1861 }
1862
1863 if (target->GetTypeId() == TYPEID_PLAYER)
1864 target->ToPlayer()->InitDataForForm();
1865 else
1866 target->UpdateDisplayPower();
1867
1868 if (target->GetClass() == CLASS_DRUID)
1869 {
1870 // Dash
1872 aurEff->RecalculateAmount();
1873
1874 // Disarm handling
1875 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
1876 // and also HandleAuraModDisarm is not triggered
1877 if (!target->CanUseAttackType(BASE_ATTACK))
1878 {
1880 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), apply);
1881 }
1882 }
1883
1884 // stop handling the effect if it was removed by linked event
1885 if (apply && aurApp->GetRemoveMode())
1886 return;
1887
1888 if (target->GetTypeId() == TYPEID_PLAYER)
1889 {
1890 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1891 ASSERT(shapeInfo);
1892 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
1893 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
1894 {
1895 if (!shapeInfo->PresetSpellID[i])
1896 continue;
1897 if (apply)
1898 target->ToPlayer()->AddTemporarySpell(shapeInfo->PresetSpellID[i]);
1899 else
1900 target->ToPlayer()->RemoveTemporarySpell(shapeInfo->PresetSpellID[i]);
1901 }
1902 }
1903}
1904
1905void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const
1906{
1908 return;
1909
1910 Unit* target = aurApp->GetTarget();
1911
1912 if (apply)
1913 {
1914 // update active transform spell only when transform not set or not overwriting negative by positive case
1915 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell());
1916 if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
1917 {
1918 target->SetTransformSpell(GetId());
1919 // special case (spell specific functionality)
1920 if (GetMiscValue() == 0)
1921 {
1922 uint8 gender = target->GetNativeGender();
1923 switch (GetId())
1924 {
1925 // Orb of Deception
1926 case 16739:
1927 {
1928 if (target->GetTypeId() != TYPEID_PLAYER)
1929 return;
1930
1931 switch (target->GetRace())
1932 {
1933 // Blood Elf
1934 case RACE_BLOODELF:
1935 target->SetDisplayId(gender == GENDER_FEMALE ? 17830 : 17829);
1936 break;
1937 // Orc
1938 case RACE_ORC:
1939 target->SetDisplayId(gender == GENDER_FEMALE ? 10140 : 10139);
1940 break;
1941 // Troll
1942 case RACE_TROLL:
1943 target->SetDisplayId(gender == GENDER_FEMALE ? 10134 : 10135);
1944 break;
1945 // Tauren
1946 case RACE_TAUREN:
1947 target->SetDisplayId(gender == GENDER_FEMALE ? 10147 : 10136);
1948 break;
1949 // Undead
1950 case RACE_UNDEAD_PLAYER:
1951 target->SetDisplayId(gender == GENDER_FEMALE ? 10145 : 10146);
1952 break;
1953 // Draenei
1954 case RACE_DRAENEI:
1955 target->SetDisplayId(gender == GENDER_FEMALE ? 17828 : 17827);
1956 break;
1957 // Dwarf
1958 case RACE_DWARF:
1959 target->SetDisplayId(gender == GENDER_FEMALE ? 10142 : 10141);
1960 break;
1961 // Gnome
1962 case RACE_GNOME:
1963 target->SetDisplayId(gender == GENDER_FEMALE ? 10149 : 10148);
1964 break;
1965 // Human
1966 case RACE_HUMAN:
1967 target->SetDisplayId(gender == GENDER_FEMALE ? 10138 : 10137);
1968 break;
1969 // Night Elf
1970 case RACE_NIGHTELF:
1971 target->SetDisplayId(gender == GENDER_FEMALE ? 10144 : 10143);
1972 break;
1973 default:
1974 break;
1975 }
1976 break;
1977 }
1978 // Murloc costume
1979 case 42365:
1980 target->SetDisplayId(21723);
1981 break;
1982 // Dread Corsair
1983 case 50517:
1984 // Corsair Costume
1985 case 51926:
1986 {
1987 if (target->GetTypeId() != TYPEID_PLAYER)
1988 return;
1989
1990 switch (target->GetRace())
1991 {
1992 // Blood Elf
1993 case RACE_BLOODELF:
1994 target->SetDisplayId(gender == GENDER_MALE ? 25032 : 25043);
1995 break;
1996 // Orc
1997 case RACE_ORC:
1998 target->SetDisplayId(gender == GENDER_MALE ? 25039 : 25050);
1999 break;
2000 // Troll
2001 case RACE_TROLL:
2002 target->SetDisplayId(gender == GENDER_MALE ? 25041 : 25052);
2003 break;
2004 // Tauren
2005 case RACE_TAUREN:
2006 target->SetDisplayId(gender == GENDER_MALE ? 25040 : 25051);
2007 break;
2008 // Undead
2009 case RACE_UNDEAD_PLAYER:
2010 target->SetDisplayId(gender == GENDER_MALE ? 25042 : 25053);
2011 break;
2012 // Draenei
2013 case RACE_DRAENEI:
2014 target->SetDisplayId(gender == GENDER_MALE ? 25033 : 25044);
2015 break;
2016 // Dwarf
2017 case RACE_DWARF:
2018 target->SetDisplayId(gender == GENDER_MALE ? 25034 : 25045);
2019 break;
2020 // Gnome
2021 case RACE_GNOME:
2022 target->SetDisplayId(gender == GENDER_MALE ? 25035 : 25046);
2023 break;
2024 // Human
2025 case RACE_HUMAN:
2026 target->SetDisplayId(gender == GENDER_MALE ? 25037 : 25048);
2027 break;
2028 // Night Elf
2029 case RACE_NIGHTELF:
2030 target->SetDisplayId(gender == GENDER_MALE ? 25038 : 25049);
2031 break;
2032 default:
2033 break;
2034 }
2035 break;
2036 }
2037 // Pygmy Oil
2038 case 53806:
2039 target->SetDisplayId(22512);
2040 break;
2041 // Honor the Dead
2042 case 65386:
2043 case 65495:
2044 target->SetDisplayId(gender == GENDER_MALE ? 29203 : 29204);
2045 break;
2046 // Darkspear Pride
2047 case 75532:
2048 target->SetDisplayId(gender == GENDER_MALE ? 31737 : 31738);
2049 break;
2050 // Gnomeregan Pride
2051 case 75531:
2052 target->SetDisplayId(gender == GENDER_MALE ? 31654 : 31655);
2053 break;
2054 default:
2055 break;
2056 }
2057 }
2058 else
2059 {
2060 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2061 if (!ci)
2062 {
2063 target->SetDisplayId(16358); // pig pink ^_^
2064 TC_LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2065 }
2066 else
2067 {
2068 uint32 model_id = 0;
2069
2070 // choose a model, based on trigger flag
2071 if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci))
2072 model_id = modelid;
2073
2074 // Polymorph (sheep)
2075 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
2076 if (Unit* caster = GetCaster())
2077 if (caster->HasAura(52648)) // Glyph of the Penguin
2078 model_id = 26452;
2079
2080 target->SetDisplayId(model_id);
2081
2082 // Dragonmaw Illusion (set mount model also)
2083 if (GetId() == 42016 && target->GetMountDisplayId() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2084 target->SetMountDisplayId(16314);
2085 }
2086 }
2087 }
2088
2089 // polymorph case
2090 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
2091 {
2092 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2093 // only if caster is Player (after patch 2.4.2)
2094 if (GetCasterGUID().IsPlayer())
2096
2097 //dismount polymorphed target (after patch 2.4.2)
2098 if (target->IsMounted())
2100 }
2101 }
2102 else
2103 {
2104 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2105 if (target->GetTransformSpell() == GetId())
2106 target->SetTransformSpell(0);
2107
2108 target->RestoreDisplayId();
2109
2110 // Dragonmaw Illusion (restore mount model)
2111 if (GetId() == 42016 && target->GetMountDisplayId() == 16314)
2112 {
2113 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2114 {
2115 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2116 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2117 {
2118 uint32 displayID = ObjectMgr::ChooseDisplayId(ci);
2119 sObjectMgr->GetCreatureModelRandomGender(&displayID);
2120
2121 target->SetMountDisplayId(displayID);
2122 }
2123 }
2124 }
2125 }
2126}
2127
2128void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2129{
2131 return;
2132
2133 aurApp->GetTarget()->RecalculateObjectScale();
2134}
2135
2136void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode, bool apply) const
2137{
2139 return;
2140
2141 Unit* target = aurApp->GetTarget();
2142
2143 if (apply)
2144 {
2145 Unit* caster = GetCaster();
2146 if (!caster || caster == target)
2147 return;
2148
2149 // What must be cloned? at least display and scale
2150 target->SetDisplayId(caster->GetDisplayId());
2151 //target->SetObjectScale(caster->GetObjectScale()); // we need retail info about how scaling is handled (aura maybe?)
2153 }
2154 else
2155 {
2156 target->SetDisplayId(target->GetNativeDisplayId());
2158 }
2159}
2160
2161/************************/
2162/*** FIGHT ***/
2163/************************/
2164
2165void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, bool apply) const
2166{
2167 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2168 return;
2169
2170 Unit* target = aurApp->GetTarget();
2171
2172 if (apply)
2173 {
2174 /*
2175 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2176 data << target->GetGUID();
2177 data << uint8(0);
2178 target->SendMessageToSet(&data, true);
2179 */
2180
2181 UnitList targets;
2182 Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityRange());
2184 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2185 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2186 {
2187 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2188 continue;
2189
2191 {
2192 if ((*iter)->GetCurrentSpell(i)
2193 && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2194 {
2195 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2196 }
2197 }
2198 }
2199
2200 for (auto& pair : target->GetThreatManager().GetThreatenedByMeList())
2201 pair.second->ScaleThreat(0.0f);
2202
2203 if (target->GetMap()->IsDungeon()) // feign death does not remove combat in dungeons
2204 {
2205 target->AttackStop();
2206 if (Player* targetPlayer = target->ToPlayer())
2207 targetPlayer->SendAttackSwingCancelAttack();
2208 }
2209 else
2210 target->CombatStop(false, false);
2211
2213
2214 // prevent interrupt message
2215 if (GetCasterGUID() == target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
2216 target->FinishSpell(CURRENT_GENERIC_SPELL, false);
2217 target->InterruptNonMeleeSpells(true);
2218
2219 // stop handling the effect if it was removed by linked event
2220 if (aurApp->GetRemoveMode())
2221 return;
2222
2223 target->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); // blizz like 2.0.x
2224 target->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x
2225 target->SetDynamicFlag(UNIT_DYNFLAG_DEAD); // blizz like 2.0.x
2227
2228 if (Creature* creature = target->ToCreature())
2229 creature->SetReactState(REACT_PASSIVE);
2230 }
2231 else
2232 {
2233 /*
2234 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2235 data << target->GetGUID();
2236 data << uint8(1);
2237 target->SendMessageToSet(&data, true);
2238 */
2239
2240 target->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); // blizz like 2.0.x
2241 target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x
2242 target->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); // blizz like 2.0.x
2244
2245 if (Creature* creature = target->ToCreature())
2246 creature->InitializeReactState();
2247 }
2248}
2249
2250void AuraEffect::HandleModUnattackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
2251{
2253 return;
2254
2255 Unit* target = aurApp->GetTarget();
2256
2257 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2258 if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
2259 return;
2260
2261 if (apply)
2263 else
2265
2266 // call functions which may have additional effects after changing state of unit
2267 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2268 {
2269 if (target->GetMap()->IsDungeon())
2270 {
2271 target->AttackStop();
2272 if (Player* targetPlayer = target->ToPlayer())
2273 targetPlayer->SendAttackSwingCancelAttack();
2274 }
2275 else
2276 target->CombatStop();
2278 }
2279}
2280
2281void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, bool apply) const
2282{
2283 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2284 return;
2285
2286 Unit* target = aurApp->GetTarget();
2287
2288 // Prevent handling aura twice
2289 AuraType type = GetAuraType();
2290 if (apply ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2291 return;
2292
2293 void(*flagChangeFunc)(Unit* u) = nullptr;
2294
2295 uint32 slot;
2296 WeaponAttackType attType;
2297 switch (type)
2298 {
2300 if (apply)
2301 flagChangeFunc = [](Unit* u) { u->SetUnitFlag(UNIT_FLAG_DISARMED); };
2302 else
2303 flagChangeFunc = [](Unit* u) { u->RemoveUnitFlag(UNIT_FLAG_DISARMED); };
2305 attType = BASE_ATTACK;
2306 break;
2308 if (apply)
2309 flagChangeFunc = [](Unit* u) { u->SetUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); };
2310 else
2311 flagChangeFunc = [](Unit* u) { u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); };
2313 attType = OFF_ATTACK;
2314 break;
2316 if (apply)
2317 flagChangeFunc = [](Unit* u) { u->SetUnitFlag2(UNIT_FLAG2_DISARM_RANGED); };
2318 else
2319 flagChangeFunc = [](Unit* u) { u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_RANGED); };
2321 attType = RANGED_ATTACK;
2322 break;
2323 default:
2324 return;
2325 }
2326
2327 // set/remove flag before weapon bonuses so it's properly reflected in CanUseAttackType
2328 if (flagChangeFunc)
2329 flagChangeFunc(target);
2330
2331 // Handle damage modification, shapeshifted druids are not affected
2332 if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
2333 {
2334 Player* player = target->ToPlayer();
2335 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2336 {
2337 WeaponAttackType const attackType = Player::GetAttackBySlot(slot);
2338
2339 player->ApplyItemDependentAuras(item, !apply);
2340 if (attackType != MAX_ATTACK)
2341 {
2342 player->_ApplyWeaponDamage(slot, item->GetTemplate(), !apply);
2343 if (!apply) // apply case already handled on item dependent aura removal (if any)
2344 player->UpdateWeaponDependentAuras(attackType);
2345 }
2346 }
2347 }
2348
2349 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
2350 target->UpdateDamagePhysical(attType);
2351}
2352
2353void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const
2354{
2355 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2356 return;
2357
2358 Unit* target = aurApp->GetTarget();
2359
2360 if (apply)
2361 {
2363
2364 // call functions which may have additional effects after changing state of unit
2365 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
2366 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2367 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2368 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
2369 // Stop spells on prepare or casting state
2370 target->InterruptSpell(CurrentSpellTypes(i), false);
2371 }
2372 else
2373 {
2374 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2376 return;
2377
2379 }
2380}
2381
2382void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const
2383{
2385 return;
2386
2387 Unit* target = aurApp->GetTarget();
2388
2389 if (apply)
2391 else
2392 {
2393 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2395 return;
2397 }
2398}
2399
2400void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const
2401{
2403 return;
2404
2405 Unit* target = aurApp->GetTarget();
2406
2407 // Vengeance of the Blue Flight (@todo REMOVE THIS!)
2409 if (m_spellInfo->Id == 45839)
2410 {
2411 if (apply)
2413 else
2415 }
2416 if (!(apply))
2417 {
2418 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2420 return;
2421 }
2422 HandleAuraModPacify(aurApp, mode, apply);
2423 HandleAuraModSilence(aurApp, mode, apply);
2424}
2425
2426void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8 mode, bool apply) const
2427{
2429 return;
2430
2431 Unit* target = aurApp->GetTarget();
2432
2433 if (target->GetTypeId() == TYPEID_PLAYER)
2434 {
2435 if (apply)
2437 else
2438 {
2439 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2441 return;
2443 }
2444 }
2445}
2446
2447/****************************/
2448/*** TRACKING ***/
2449/****************************/
2450
2451void AuraEffect::HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 mode, bool apply) const
2452{
2454 return;
2455
2456 Unit* target = aurApp->GetTarget();
2457
2458 if (target->GetTypeId() != TYPEID_PLAYER)
2459 return;
2460
2461 if (apply)
2462 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2463 else
2464 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2465}
2466
2467void AuraEffect::HandleAuraTrackResources(AuraApplication const* aurApp, uint8 mode, bool apply) const
2468{
2470 return;
2471
2472 Unit* target = aurApp->GetTarget();
2473
2474 if (target->GetTypeId() != TYPEID_PLAYER)
2475 return;
2476
2477 if (apply)
2478 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2479 else
2480 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2481}
2482
2483void AuraEffect::HandleAuraTrackStealthed(AuraApplication const* aurApp, uint8 mode, bool apply) const
2484{
2486 return;
2487
2488 Unit* target = aurApp->GetTarget();
2489
2490 if (target->GetTypeId() != TYPEID_PLAYER)
2491 return;
2492
2493 if (!(apply))
2494 {
2495 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2496 if (target->HasAuraType(GetAuraType()))
2497 return;
2498 }
2500}
2501
2502void AuraEffect::HandleAuraModStalked(AuraApplication const* aurApp, uint8 mode, bool apply) const
2503{
2505 return;
2506
2507 Unit* target = aurApp->GetTarget();
2508
2509 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
2510 if (apply)
2512 else
2513 {
2514 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2515 if (!target->HasAuraType(GetAuraType()))
2517 }
2518
2519 // call functions which may have additional effects after changing state of unit
2520 if (target->IsInWorld())
2521 target->UpdateObjectVisibility();
2522}
2523
2524void AuraEffect::HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
2525{
2527 return;
2528
2529 Unit* target = aurApp->GetTarget();
2530
2531 if (apply)
2533 else
2534 {
2535 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2536 if (target->HasAuraType(GetAuraType()))
2537 return;
2539 }
2540}
2541
2542/****************************/
2543/*** SKILLS & TALENTS ***/
2544/****************************/
2545
2546void AuraEffect::HandleAuraModPetTalentsPoints(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2547{
2549 return;
2550
2551 Unit* target = aurApp->GetTarget();
2552
2553 if (target->GetTypeId() != TYPEID_PLAYER)
2554 return;
2555
2556 // Recalculate pet talent points
2557 if (Pet* pet = target->ToPlayer()->GetPet())
2558 pet->InitTalentForLevel();
2559}
2560
2561void AuraEffect::HandleAuraModSkill(AuraApplication const* aurApp, uint8 mode, bool apply) const
2562{
2564 return;
2565
2566 Player* target = aurApp->GetTarget()->ToPlayer();
2567 if (!target)
2568 return;
2569
2570 uint32 prot = GetMiscValue();
2571 int32 points = GetAmount();
2572
2573 target->ModifySkillBonus(prot, ((apply) ? points: -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
2574 if (prot == SKILL_DEFENSE)
2575 target->UpdateDefenseBonusesMod();
2576}
2577
2578/****************************/
2579/*** MOVEMENT ***/
2580/****************************/
2581
2582void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bool apply) const
2583{
2585 return;
2586
2587 Unit* target = aurApp->GetTarget();
2588
2589 if (apply)
2590 {
2591 uint32 creatureEntry = GetMiscValue();
2592 uint32 displayId = 0;
2593 uint32 vehicleId = 0;
2594
2595 // Festive Holiday Mount
2596 if (target->HasAura(62061))
2597 {
2599 creatureEntry = 24906;
2600 else
2601 creatureEntry = 15665;
2602 }
2603
2604 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
2605 {
2606 if (GetMiscValueB() > 0) // Choose proper modelid
2607 displayId = GetMiscValueB() == 2 && creatureInfo->Modelid2 > 0 ? creatureInfo->Modelid2 : creatureInfo->Modelid1;
2608 else // Should we choose random modelid in this case?
2609 displayId = ObjectMgr::ChooseDisplayId(creatureInfo);
2610 sObjectMgr->GetCreatureModelRandomGender(&displayId);
2611
2612 vehicleId = creatureInfo->VehicleId;
2613
2614 //some spell has one aura of mount and one of vehicle
2615 for (SpellEffectInfo const& effect : GetSpellInfo()->GetEffects())
2616 if (effect.IsEffect(SPELL_EFFECT_SUMMON) && effect.MiscValue == GetMiscValue())
2617 displayId = 0;
2618 }
2619
2620 target->Mount(displayId, vehicleId, creatureEntry);
2621 }
2622 else
2623 {
2624 target->Dismount();
2625 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
2626 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
2627 // and never endless flying after using Headless Horseman's Mount
2628 if (mode & AURA_EFFECT_HANDLE_REAL)
2630 }
2631}
2632
2633void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode, bool apply) const
2634{
2636 return;
2637
2638 Unit* target = aurApp->GetTarget();
2639
2640 if (!apply)
2641 {
2642 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2644 return;
2645 }
2646
2647 if (target->SetCanFly(apply))
2648 {
2649 if (!apply && !target->IsGravityDisabled() && !target->CanFly())
2650 target->GetMotionMaster()->MoveFall();
2651 }
2652}
2653
2654void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
2655{
2657 return;
2658
2659 Unit* target = aurApp->GetTarget();
2660
2661 if (!apply)
2662 {
2663 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2664 if (target->HasAuraType(GetAuraType()))
2665 return;
2666 }
2667
2668 target->SetWaterWalking(apply);
2669}
2670
2671void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode, bool apply) const
2672{
2674 return;
2675
2676 Unit* target = aurApp->GetTarget();
2677
2678 if (!apply)
2679 {
2680 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2681 if (target->HasAuraType(GetAuraType()))
2682 return;
2683 }
2684
2685 target->SetFeatherFall(apply);
2686
2687 // start fall from current height
2688 if (!apply && target->GetTypeId() == TYPEID_PLAYER)
2689 target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
2690}
2691
2692void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const
2693{
2695 return;
2696
2697 Unit* target = aurApp->GetTarget();
2698
2699 if (!apply)
2700 {
2701 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2702 if (target->HasAuraType(GetAuraType()))
2703 return;
2704 }
2705
2706 target->SetHover(apply);
2707}
2708
2709void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2710{
2712 return;
2713
2714 Unit* target = aurApp->GetTarget();
2715
2716 // update timers in client
2717 if (target->GetTypeId() == TYPEID_PLAYER)
2718 target->ToPlayer()->UpdateMirrorTimers();
2719}
2720
2721void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mode, bool apply) const
2722{
2724 return;
2725
2726 Unit* target = aurApp->GetTarget();
2727
2728 if (apply)
2730 else
2731 {
2732 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2733 if (target->HasAuraType(GetAuraType()))
2734 return;
2736 }
2737}
2738
2739/****************************/
2740/*** THREAT ***/
2741/****************************/
2742
2743void AuraEffect::HandleModThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2744{
2746 return;
2747
2749}
2750
2751void AuraEffect::HandleAuraModTotalThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2752{
2754 return;
2755
2756 Unit* target = aurApp->GetTarget();
2757
2758 if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
2759 return;
2760
2761 Unit* caster = GetCaster();
2762 if (caster && caster->IsAlive())
2764}
2765
2766void AuraEffect::HandleModTaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2767{
2768 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2769 return;
2770
2771 Unit* target = aurApp->GetTarget();
2772
2773 if (!target->IsAlive() || !target->CanHaveThreatList())
2774 return;
2775
2776 target->GetThreatManager().TauntUpdate();
2777}
2778
2779void AuraEffect::HandleModDetaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2780{
2781 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2782 return;
2783
2784 Unit* caster = GetCaster();
2785 Unit* target = aurApp->GetTarget();
2786
2787 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
2788 return;
2789
2790 caster->GetThreatManager().TauntUpdate();
2791}
2792
2793/*****************************/
2794/*** CONTROL ***/
2795/*****************************/
2796
2797void AuraEffect::HandleModConfuse(AuraApplication const* aurApp, uint8 mode, bool apply) const
2798{
2799 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2800 return;
2801
2802 Unit* target = aurApp->GetTarget();
2803
2804 target->SetControlled(apply, UNIT_STATE_CONFUSED);
2805 if (apply)
2807}
2808
2809void AuraEffect::HandleModFear(AuraApplication const* aurApp, uint8 mode, bool apply) const
2810{
2811 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2812 return;
2813
2814 Unit* target = aurApp->GetTarget();
2815
2816 target->SetControlled(apply, UNIT_STATE_FLEEING);
2817}
2818
2819void AuraEffect::HandleAuraModStun(AuraApplication const* aurApp, uint8 mode, bool apply) const
2820{
2821 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2822 return;
2823
2824 Unit* target = aurApp->GetTarget();
2825
2826 target->SetControlled(apply, UNIT_STATE_STUNNED);
2827 if (apply)
2829}
2830
2831void AuraEffect::HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bool apply) const
2832{
2833 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2834 return;
2835
2836 Unit* target = aurApp->GetTarget();
2837
2838 target->SetControlled(apply, UNIT_STATE_ROOT);
2839}
2840
2841void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const
2842{
2843 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2844 return;
2845
2846 Unit* target = aurApp->GetTarget();
2847
2848 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
2849 if (!apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
2850 return;
2853 target->SetControlled(false, UNIT_STATE_FLEEING);
2854}
2855
2856/***************************/
2857/*** CHARM ***/
2858/***************************/
2859
2860void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const
2861{
2862 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2863 return;
2864
2865 Unit* target = aurApp->GetTarget();
2866
2867 Unit* caster = GetCaster();
2868
2869 // no support for posession AI yet
2870 if (caster && caster->GetTypeId() == TYPEID_UNIT)
2871 {
2872 HandleModCharm(aurApp, mode, apply);
2873 return;
2874 }
2875
2876 if (apply)
2877 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
2878 else
2879 target->RemoveCharmedBy(caster);
2880}
2881
2882void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const
2883{
2884 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2885 return;
2886
2887 Unit* caster = GetCaster();
2888 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
2889 return;
2890
2891 // seems it may happen that when removing it is no longer owner's pet
2892 //if (caster->ToPlayer()->GetPet() != target)
2893 // return;
2894
2895 Unit* target = aurApp->GetTarget();
2896 if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
2897 return;
2898
2899 Pet* pet = target->ToPet();
2900 if (apply)
2901 {
2902 if (caster->ToPlayer()->GetPet() != pet)
2903 return;
2904
2905 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
2906 }
2907 else
2908 {
2909 pet->RemoveCharmedBy(caster);
2910
2911 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
2912 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
2913 else
2914 {
2915 // Reinitialize the pet bar or it will appear greyed out
2916 caster->ToPlayer()->PetSpellInitialize();
2917
2918 // TODO: remove this
2919 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
2921 }
2922 }
2923}
2924
2925void AuraEffect::HandleModCharm(AuraApplication const* aurApp, uint8 mode, bool apply) const
2926{
2927 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2928 return;
2929
2930 Unit* target = aurApp->GetTarget();
2931
2932 Unit* caster = GetCaster();
2933
2934 if (apply)
2935 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
2936 else
2937 target->RemoveCharmedBy(caster);
2938}
2939
2940void AuraEffect::HandleCharmConvert(AuraApplication const* aurApp, uint8 mode, bool apply) const
2941{
2942 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2943 return;
2944
2945 Unit* target = aurApp->GetTarget();
2946
2947 Unit* caster = GetCaster();
2948
2949 if (apply)
2950 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
2951 else
2952 target->RemoveCharmedBy(caster);
2953}
2954
2959void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const
2960{
2962 return;
2963
2964 Unit* target = aurApp->GetTarget();
2965 if (!target->IsVehicle())
2966 return;
2967
2968 Unit* caster = GetCaster();
2969 if (!caster || caster == target)
2970 return;
2971
2972 if (apply)
2973 {
2974 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
2975 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
2976 // so this break such spells or most of them.
2977 // Current formula about m_amount: effect base points + dieside - 1
2978 // TO DO: Reasearch more about 0/0 and fix it.
2979 caster->_EnterVehicle(target->GetVehicleKit(), GetAmount() - 1, aurApp);
2980 }
2981 else
2982 {
2983 // Remove pending passengers before exiting vehicle - might cause an Uninstall
2985
2986 if (GetId() == 53111) // Devour Humanoid
2987 {
2988 Unit::Kill(target, caster);
2989 if (caster->GetTypeId() == TYPEID_UNIT)
2990 caster->ToCreature()->DespawnOrUnsummon();
2991 }
2992
2993 bool seatChange = (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT) // Seat change on the same direct vehicle
2994 || target->HasAuraTypeWithCaster(SPELL_AURA_CONTROL_VEHICLE, caster->GetGUID()); // Seat change to a proxy vehicle (for example turret mounted on a siege engine)
2995
2996 if (!seatChange)
2997 caster->_ExitVehicle();
2998 else
2999 target->GetVehicleKit()->RemovePassenger(caster); // Only remove passenger from vehicle without launching exit movement or despawning the vehicle
3000
3001 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3002 caster->RemoveAurasDueToSpell(GetId());
3003 }
3004}
3005
3006/*********************************************************/
3007/*** MODIFY SPEED ***/
3008/*********************************************************/
3009void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3010{
3012 return;
3013
3014 Unit* target = aurApp->GetTarget();
3015
3016 target->UpdateSpeed(MOVE_RUN);
3017}
3018
3020{
3021 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3022}
3023
3024void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
3025{
3027 return;
3028
3029 Unit* target = aurApp->GetTarget();
3031 target->UpdateSpeed(MOVE_FLIGHT);
3032
3035 {
3036 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3038 {
3039 if (target->SetCanFly(apply))
3040 if (!apply && !target->IsGravityDisabled() && !target->CanFly())
3041 target->GetMotionMaster()->MoveFall();
3042 }
3043
3045 if (mode & AURA_EFFECT_HANDLE_REAL)
3046 {
3047 //Players on flying mounts must be immune to polymorph
3048 if (target->GetTypeId() == TYPEID_PLAYER)
3050
3051 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3052 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountDisplayId())
3053 target->SetMountDisplayId(16314);
3054 }
3055 }
3056}
3057
3058void AuraEffect::HandleAuraModIncreaseSwimSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3059{
3061 return;
3062
3063 Unit* target = aurApp->GetTarget();
3064
3065 target->UpdateSpeed(MOVE_SWIM);
3066}
3067
3068void AuraEffect::HandleAuraModDecreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3069{
3071 return;
3072
3073 Unit* target = aurApp->GetTarget();
3074
3075 target->UpdateSpeed(MOVE_RUN);
3076 target->UpdateSpeed(MOVE_SWIM);
3077 target->UpdateSpeed(MOVE_FLIGHT);
3078 target->UpdateSpeed(MOVE_RUN_BACK);
3079 target->UpdateSpeed(MOVE_SWIM_BACK);
3081}
3082
3083void AuraEffect::HandleAuraModUseNormalSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3084{
3085 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3086 return;
3087
3088 Unit* target = aurApp->GetTarget();
3089
3090 target->UpdateSpeed(MOVE_RUN);
3091 target->UpdateSpeed(MOVE_SWIM);
3092 target->UpdateSpeed(MOVE_FLIGHT);
3093}
3094
3095/*********************************************************/
3096/*** IMMUNITY ***/
3097/*********************************************************/
3098
3099void AuraEffect::HandleModMechanicImmunityMask(AuraApplication const* aurApp, uint8 mode, bool apply) const
3100{
3101 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3102 return;
3103
3104 Unit* target = aurApp->GetTarget();
3106}
3107
3108void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3109{
3110 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3111 return;
3112
3113 Unit* target = aurApp->GetTarget();
3115}
3116
3117void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3118{
3119 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3120 return;
3121
3122 Unit* target = aurApp->GetTarget();
3124
3125 // when removing flag aura, handle flag drop
3126 Player* player = target->ToPlayer();
3127 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3128 {
3129 if (player->InBattleground())
3130 {
3131 if (Battleground* bg = player->GetBattleground())
3132 bg->EventPlayerDroppedFlag(player);
3133 }
3134 else
3135 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3136 }
3137}
3138
3139void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3140{
3141 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3142 return;
3143
3144 Unit* target = aurApp->GetTarget();
3146}
3147
3148void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3149{
3150 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3151 return;
3152
3153 Unit* target = aurApp->GetTarget();
3155
3156 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3157 {
3158 if (apply)
3160 else
3161 {
3162 bool banishFound = false;
3163 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
3164 for (AuraEffect const* aurEff : banishAuras)
3165 {
3166 if (aurEff->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3167 {
3168 banishFound = true;
3169 break;
3170 }
3171 }
3172
3173 if (!banishFound)
3175 }
3176 }
3177
3178 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
3180
3181 // remove all flag auras (they are positive, but they must be removed when you are immune)
3185
3186 if (apply)
3187 {
3190 }
3191 else
3192 {
3193 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3195 return;
3197 }
3198}
3199
3200void AuraEffect::HandleAuraModDmgImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3201{
3202 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3203 return;
3204
3205 Unit* target = aurApp->GetTarget();
3207
3208 if (apply)
3209 {
3212 }
3213 else
3214 {
3215 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3217 return;
3219 }
3220}
3221
3222void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3223{
3224 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3225 return;
3226
3227 Unit* target = aurApp->GetTarget();
3229}
3230
3231/*********************************************************/
3232/*** MODIFY STATS ***/
3233/*********************************************************/
3234
3235/********************************/
3236/*** RESISTANCE ***/
3237/********************************/
3238
3239void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const* aurApp, uint8 mode, bool apply) const
3240{
3242 return;
3243
3244 Unit* target = aurApp->GetTarget();
3245
3246 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3247 {
3248 if (GetMiscValue() & (1 << x))
3249 {
3251 if (amount < GetAmount())
3252 {
3253 float value = float(GetAmount() - amount);
3255 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3257 }
3258 }
3259 }
3260}
3261
3262void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3263{
3265 return;
3266
3267 Unit* target = aurApp->GetTarget();
3268
3269 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3270 {
3271 if (GetMiscValue() & (1 << x))
3272 {
3274 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3276 }
3277 }
3278}
3279
3280void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
3281{
3283 return;
3284
3285 Unit* target = aurApp->GetTarget();
3286
3287 // only players have base stats
3288 if (target->GetTypeId() != TYPEID_PLAYER)
3289 {
3290 //pets only have base armor
3291 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3292 {
3293 if (apply)
3295 else
3296 {
3298 target->SetStatPctModifier(UNIT_MOD_ARMOR, BASE_PCT, amount);
3299 }
3300 }
3301 }
3302 else
3303 {
3304 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3305 {
3306 if (GetMiscValue() & (1 << x))
3307 {
3308 if (apply)
3310 else
3311 {
3314 }
3315 }
3316 }
3317 }
3318}
3319
3320void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3321{
3323 return;
3324
3325 Unit* target = aurApp->GetTarget();
3326
3327 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3328 {
3329 if (GetMiscValue() & (1 << i))
3330 {
3333 continue;
3334
3336 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3338 }
3339 }
3340}
3341
3342void AuraEffect::HandleModBaseResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3343{
3345 return;
3346
3347 Unit* target = aurApp->GetTarget();
3348
3349 // only players have base stats
3350 if (target->GetTypeId() != TYPEID_PLAYER)
3351 {
3352 //pets only have base armor
3353 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3355 }
3356 else
3357 {
3358 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3359 if (GetMiscValue() & (1 << i))
3361 }
3362}
3363
3364void AuraEffect::HandleModTargetResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3365{
3367 return;
3368
3369 Unit* target = aurApp->GetTarget();
3370
3371 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
3372
3373 // show armor penetration
3376
3377 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
3380}
3381
3382/********************************/
3383/*** STAT ***/
3384/********************************/
3385
3386void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3387{
3389 return;
3390
3391 if (GetMiscValue() < -2 || GetMiscValue() > 4)
3392 {
3393 TC_LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
3394 return;
3395 }
3396
3397 Unit* target = aurApp->GetTarget();
3399 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3400 return;
3401
3402 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3403 {
3404 // -1 or -2 is all stats (misc < -2 checked in function beginning)
3405 if (GetMiscValue() < 0 || GetMiscValue() == i)
3406 {
3407 if (spellGroupVal)
3408 {
3409 target->HandleStatFlatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
3410 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3411 target->UpdateStatBuffMod(Stats(i));
3412 }
3413
3415 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3416 target->UpdateStatBuffMod(Stats(i));
3417 }
3418 }
3419}
3420
3421void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3422{
3424 return;
3425
3426 Unit* target = aurApp->GetTarget();
3427
3428 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3429 {
3430 TC_LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3431 return;
3432 }
3433
3434 // only players have base stats
3435 if (target->GetTypeId() != TYPEID_PLAYER)
3436 return;
3437
3438 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3439 {
3440 if (GetMiscValue() == i || GetMiscValue() == -1)
3441 {
3442 if (apply)
3444 else
3445 {
3446 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff) -> bool
3447 {
3448 if (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1)
3449 return true;
3450 return false;
3451 });
3453 }
3454 }
3455 }
3456}
3457
3458void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3459{
3461 return;
3462
3463 Unit* target = aurApp->GetTarget();
3464
3465 if (target->GetTypeId() != TYPEID_PLAYER)
3466 return;
3467
3468 // Magic damage modifiers implemented in Unit::SpellDamageBonus
3469 // This information for client side use only
3470 // Recalculate bonus
3472}
3473
3474void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3475{
3477 return;
3478
3479 Unit* target = aurApp->GetTarget();
3480
3481 if (target->GetTypeId() != TYPEID_PLAYER)
3482 return;
3483
3484 // Recalculate bonus
3486}
3487
3489{
3491 return;
3492
3493 Unit* target = aurApp->GetTarget();
3494
3495 if (target->GetTypeId() != TYPEID_PLAYER)
3496 return;
3497
3498 // Magic damage modifiers implemented in Unit::SpellDamageBonus
3499 // This information for client side use only
3500 // Recalculate bonus
3502}
3503
3505{
3507 return;
3508
3509 Unit* target = aurApp->GetTarget();
3510
3511 if (target->GetTypeId() != TYPEID_PLAYER)
3512 return;
3513
3514 // Recalculate bonus
3516}
3517
3518void AuraEffect::HandleModHealingDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3519{
3521 return;
3522
3523 Unit* target = aurApp->GetTarget();
3524
3525 if (target->GetTypeId() != TYPEID_PLAYER)
3526 return;
3527 // implemented in Unit::SpellHealingBonus
3528 // this information is for client side only
3530}
3531
3532void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3533{
3535 return;
3536
3537 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3538 {
3539 TC_LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3540 return;
3541 }
3542
3543 Unit* target = aurApp->GetTarget();
3544
3545 // save current health state
3546 float healthPct = target->GetHealthPct();
3547 bool zeroHealth = !target->IsAlive();
3548
3549 // players in corpse state may mean two different states:
3552 if (target->getDeathState() == CORPSE)
3553 zeroHealth = (target->GetHealth() == 0);
3554
3555 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3556 {
3557 if (GetMiscValue() == i || GetMiscValue() == -1) // affect the same stats
3558 {
3559 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff) -> bool
3560 {
3561 if (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1)
3562 return true;
3563 return false;
3564 });
3565
3566 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
3567 continue;
3568
3570 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3571 target->UpdateStatBuffMod(Stats(i));
3572 }
3573 }
3574
3575 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_ABILITY 0x00000010 flag)
3576 // this check is total bullshit i think
3578 target->SetHealth(std::max<uint32>(CalculatePct(target->GetMaxHealth(), healthPct), (zeroHealth ? 0 : 1)));
3579}
3580
3581void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3582{
3584 return;
3585
3586 Unit* target = aurApp->GetTarget();
3587
3588 if (target->GetTypeId() != TYPEID_PLAYER)
3589 return;
3590
3592 {
3593 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
3594 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
3595 TC_LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
3596 return;
3597 }
3598
3599 // Recalculate Armor
3600 target->UpdateArmor();
3601}
3602
3603void AuraEffect::HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3604{
3606 return;
3607
3608 Unit* target = aurApp->GetTarget();
3609
3610 if (target->GetTypeId() != TYPEID_PLAYER)
3611 return;
3612
3615}
3616
3617/********************************/
3618/*** HEAL & ENERGIZE ***/
3619/********************************/
3620void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3621{
3623 return;
3624
3625 Unit* target = aurApp->GetTarget();
3626
3627 if (target->GetTypeId() != TYPEID_PLAYER)
3628 return;
3629
3630 if (GetMiscValue() == POWER_RUNE)
3632 else
3633 target->ToPlayer()->UpdatePowerRegen(static_cast<Powers>(GetMiscValue()));
3634}
3635
3636void AuraEffect::HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
3637{
3638 HandleModPowerRegen(aurApp, mode, apply);
3639}
3640
3641void AuraEffect::HandleModManaRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3642{
3644 return;
3645
3646 Unit* target = aurApp->GetTarget();
3647
3648 if (target->GetTypeId() != TYPEID_PLAYER)
3649 return;
3650
3651 //Note: an increase in regen does NOT cause threat.
3653}
3654
3655void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
3656{
3658 return;
3659
3660 Unit* target = aurApp->GetTarget();
3661
3662 int32 const amt = apply ? GetAmount() : -GetAmount();
3663 if (amt < 0)
3664 target->ModifyHealth(std::max<int32>(1 - target->GetHealth(), amt));
3665
3667
3668 if (amt > 0)
3669 target->ModifyHealth(amt);
3670}
3671
3672void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
3673{
3675 return;
3676
3677 Unit* target = aurApp->GetTarget();
3678
3679 float percent = target->GetHealthPct();
3680
3682
3683 // refresh percentage
3684 if (target->GetHealth() > 0)
3685 {
3686 uint32 newHealth = std::max<uint32>(target->CountPctFromMaxHealth(int32(percent)), 1);
3687 target->SetHealth(newHealth);
3688 }
3689}
3690
3691void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const* aurApp, uint8 mode, bool apply) const
3692{
3694 return;
3695
3696 Unit* target = aurApp->GetTarget();
3698
3699 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
3700}
3701
3703{
3705 return;
3706
3707 Unit* target = aurApp->GetTarget();
3708 Powers powerType = Powers(GetMiscValue());
3710
3711 // Save old powers for further calculation
3712 int32 oldPower = int32(target->GetPower(powerType));
3713 int32 oldMaxPower = int32(target->GetMaxPower(powerType));
3714
3715 // Handle aura effect for max power
3716 if (apply)
3717 {
3718 float amount = float(GetAmount());
3719 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
3720 }
3721 else
3722 {
3724 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
3725 }
3726
3727 // Calculate the current power change
3728 int32 change = target->GetMaxPower(powerType) - oldMaxPower;
3729 change = (oldPower + change) - target->GetPower(powerType);
3730 target->ModifyPower(powerType, change);
3731}
3732
3734{
3736 return;
3737
3738 Unit* target = aurApp->GetTarget();
3739
3740 // Unit will keep hp% after MaxHealth being modified if unit is alive.
3741 float percent = target->GetHealthPct();
3742 if (apply)
3744 else
3745 {
3748 }
3749
3750 if (target->GetHealth() > 0)
3751 {
3752 uint32 newHealth = std::max<uint32>(CalculatePct(target->GetMaxHealth(), percent), 1);
3753 target->SetHealth(newHealth);
3754 }
3755}
3756
3758{
3760 return;
3761
3762 Unit* target = aurApp->GetTarget();
3763
3764 if (apply)
3766 else
3767 {
3770 }
3771}
3772
3773/********************************/
3774/*** FIGHT ***/
3775/********************************/
3776
3777void AuraEffect::HandleAuraModParryPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3778{
3780 return;
3781
3782 Unit* target = aurApp->GetTarget();
3783
3784 if (target->GetTypeId() != TYPEID_PLAYER)
3785 return;
3786
3787 target->ToPlayer()->UpdateParryPercentage();
3788}
3789
3790void AuraEffect::HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3791{
3793 return;
3794
3795 Unit* target = aurApp->GetTarget();
3796
3797 if (target->GetTypeId() != TYPEID_PLAYER)
3798 return;
3799
3800 target->ToPlayer()->UpdateDodgePercentage();
3801}
3802
3803void AuraEffect::HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3804{
3806 return;
3807
3808 Unit* target = aurApp->GetTarget();
3809
3810 if (target->GetTypeId() != TYPEID_PLAYER)
3811 return;
3812
3813 target->ToPlayer()->UpdateBlockPercentage();
3814}
3815
3816void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool apply) const
3817{
3818 HandleModManaRegen(aurApp, mode, apply);
3819}
3820
3821void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3822{
3824 return;
3825
3826 Player* target = aurApp->GetTarget()->ToPlayer();
3827 if (!target)
3828 return;
3829
3831}
3832
3833void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3834{
3836 return;
3837
3838 Unit* target = aurApp->GetTarget();
3839
3840 if (target->GetTypeId() == TYPEID_PLAYER)
3841 target->ToPlayer()->UpdateSpellHitChances();
3842 else
3843 target->m_modSpellHitChance += (apply) ? GetAmount(): (-GetAmount());
3844}
3845
3846void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3847{
3849 return;
3850
3851 Unit* target = aurApp->GetTarget();
3852
3853 if (target->GetTypeId() == TYPEID_PLAYER)
3855 else
3856 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
3857}
3858
3859void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3860{
3862 return;
3863
3864 Unit* target = aurApp->GetTarget();
3865
3866 if (target->GetTypeId() != TYPEID_PLAYER)
3867 return;
3868
3869 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
3870 if (GetMiscValue() & (1<<school))
3871 target->ToPlayer()->UpdateSpellCritChance(school);
3872}
3873
3874void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3875{
3877 return;
3878
3879 Unit* target = aurApp->GetTarget();
3880
3881 if (target->GetTypeId() != TYPEID_PLAYER)
3882 {
3883 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
3884 return;
3885 }
3886
3888
3889 // included in Player::UpdateSpellCritChance calculation
3891}
3892
3893/********************************/
3894/*** ATTACK SPEED ***/
3895/********************************/
3896
3897void AuraEffect::HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
3898{
3900 return;
3901
3902 Unit* target = aurApp->GetTarget();
3903
3904 // Do not apply such auras in normal way
3905 if (GetAmount() >= 1000)
3906 {
3907 if (apply)
3908 target->SetInstantCast(true);
3909 else
3910 {
3911 // only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount
3912 // it's some rare case that you have 2 auras like that, but just in case ;)
3913
3914 bool remove = true;
3916 for (AuraEffect const* aurEff : castingSpeedNotStack)
3917 {
3918 if (aurEff != this && aurEff->GetAmount() >= 1000)
3919 {
3920 remove = false;
3921 break;
3922 }
3923 }
3924
3925 if (remove)
3926 target->SetInstantCast(false);
3927 }
3928
3929 return;
3930 }
3931
3932 int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
3933 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3934 return;
3935
3936 if (spellGroupVal)
3937 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
3938
3939 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
3940}
3941
3942void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3943{
3945 return;
3946
3947 Unit* target = aurApp->GetTarget();
3948
3949 target->ApplyAttackTimePercentMod(BASE_ATTACK, (float)GetAmount(), apply);
3950 target->ApplyAttackTimePercentMod(OFF_ATTACK, (float)GetAmount(), apply);
3951 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
3952}
3953
3954void AuraEffect::HandleModCombatSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3955{
3957 return;
3958
3959 Unit* target = aurApp->GetTarget();
3961 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3962 return;
3963
3964 if (spellGroupVal)
3965 {
3966 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
3967 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
3968 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
3969 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
3970 }
3971 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
3972 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
3973 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
3974 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
3975}
3976
3977void AuraEffect::HandleModAttackSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
3978{
3980 return;
3981
3982 Unit* target = aurApp->GetTarget();
3983
3984 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
3986}
3987
3988void AuraEffect::HandleModMeleeSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3989{
3991 return;
3992
3993 Unit* target = aurApp->GetTarget();
3995 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3996 return;
3997
3998 if (spellGroupVal)
3999 {
4000 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4001 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4002 }
4003 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4004 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4005}
4006
4007void AuraEffect::HandleAuraModRangedHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4008{
4010 return;
4011
4012 Unit* target = aurApp->GetTarget();
4013
4014 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4015}
4016
4017void AuraEffect::HandleRangedAmmoHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4018{
4020 return;
4021
4022 Unit* target = aurApp->GetTarget();
4023
4024 if (target->GetTypeId() != TYPEID_PLAYER)
4025 return;
4026
4027 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4028}
4029
4030/********************************/
4031/*** COMBAT RATING ***/
4032/********************************/
4033
4034void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool apply) const
4035{
4037 return;
4038
4039 Unit* target = aurApp->GetTarget();
4040
4041 if (target->GetTypeId() != TYPEID_PLAYER)
4042 return;
4043
4044 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4045 if (GetMiscValue() & (1 << rating))
4046 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4047}
4048
4049void AuraEffect::HandleModRatingFromStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
4050{
4052 return;
4053
4054 Unit* target = aurApp->GetTarget();
4055
4056 if (target->GetTypeId() != TYPEID_PLAYER)
4057 return;
4058
4059 // Just recalculate ratings
4060 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4061 if (GetMiscValue() & (1 << rating))
4062 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
4063}
4064
4065/********************************/
4066/*** ATTACK POWER ***/
4067/********************************/
4068
4069void AuraEffect::HandleAuraModAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4070{
4072 return;
4073
4074 Unit* target = aurApp->GetTarget();
4075
4077}
4078
4079void AuraEffect::HandleAuraModRangedAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4080{
4082 return;
4083
4084 Unit* target = aurApp->GetTarget();
4085
4086 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4087 return;
4088
4090}
4091
4092void AuraEffect::HandleAuraModAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
4093{
4095 return;
4096
4097 Unit* target = aurApp->GetTarget();
4098
4100}
4101
4103{
4105 return;
4106
4107 Unit* target = aurApp->GetTarget();
4108
4109 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4110 return;
4111
4113}
4114
4116{
4118 return;
4119
4120 Unit* target = aurApp->GetTarget();
4121
4122 // Recalculate bonus
4123 if (target->GetTypeId() == TYPEID_PLAYER && !(target->GetClassMask() & CLASSMASK_WAND_USERS))
4124 target->ToPlayer()->UpdateAttackPowerAndDamage(true);
4125}
4126
4127void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4128{
4130 return;
4131
4132 Unit* target = aurApp->GetTarget();
4133
4134 // Recalculate bonus
4135 if (target->GetTypeId() == TYPEID_PLAYER)
4136 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
4137}
4138
4139/********************************/
4140/*** DAMAGE BONUS ***/
4141/********************************/
4142void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const
4143{
4145 return;
4146
4147 Unit* target = aurApp->GetTarget();
4148
4150 target->UpdateAllDamageDoneMods();
4151
4152 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonusDone
4153 // This information for client side use only
4154 if (target->GetTypeId() == TYPEID_PLAYER)
4155 {
4157 for (uint16 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
4158 if (GetMiscValue() & (1 << i))
4159 target->ApplyModInt32Value(baseField + i, GetAmount(), apply);
4160
4161 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
4162 pet->UpdateAttackPowerAndDamage();
4163 }
4164}
4165
4166void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4167{
4169 return;
4170
4171 Unit* target = aurApp->GetTarget();
4172
4173 // also handles spell group stacks
4176
4177 if (target->GetTypeId() == TYPEID_PLAYER)
4178 {
4179 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
4180 {
4181 if (GetMiscValue() & (1 << i))
4182 {
4183 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
4186 }
4187 }
4188 }
4189}
4190
4191void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4192{
4194 return;
4195
4196 Unit* target = aurApp->GetTarget();
4197
4198 // also handles spell group stacks
4200}
4201
4202void AuraEffect::HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mode, bool apply) const
4203{
4205 return;
4206
4207 Player* target = aurApp->GetTarget()->ToPlayer();
4208 if (!target)
4209 return;
4210
4211 target->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
4212}
4213
4214void AuraEffect::HandleShieldBlockValuePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
4215{
4217 return;
4218
4219 Player* target = aurApp->GetTarget()->ToPlayer();
4220 if (!target)
4221 return;
4222
4223 if (apply)
4225 else
4226 {
4228 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
4229 }
4230}
4231
4232/********************************/
4233/*** POWER COST ***/
4234/********************************/
4235
4236void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
4237{
4239 return;
4240
4241 Unit* target = aurApp->GetTarget();
4242
4243 float amount = CalculatePct(1.0f, GetAmount());
4244 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4245 if (GetMiscValue() & (1 << i))
4247}
4248
4249void AuraEffect::HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, bool apply) const
4250{
4252 return;
4253
4254 Unit* target = aurApp->GetTarget();
4255
4256 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4257 if (GetMiscValue() & (1<<i))
4259}
4260
4261void AuraEffect::HandleArenaPreparation(AuraApplication const* aurApp, uint8 mode, bool apply) const
4262{
4263 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4264 return;
4265
4266 Unit* target = aurApp->GetTarget();
4267
4268 if (apply)
4270 else
4271 {
4272 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4273 if (target->HasAuraType(GetAuraType()))
4274 return;
4276 }
4277}
4278
4279void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4280{
4281 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4282 return;
4283
4284 Unit* target = aurApp->GetTarget();
4285
4286 if (target->GetTypeId() != TYPEID_PLAYER)
4287 return;
4288
4289 flag96 mask;
4291 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
4292 mask |= (*i)->GetSpellEffectInfo().SpellClassMask;
4293
4294 target->ToPlayer()->SetNoRegentCostMask(mask);
4295}
4296
4297void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const* aurApp, uint8 mode, bool apply) const
4298{
4299 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4300 return;
4301
4302 Unit* target = aurApp->GetTarget();
4303
4304 if (target->GetTypeId() != TYPEID_PLAYER)
4305 return;
4306
4307 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
4308 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
4309 if (!(apply) && GetBase()->GetDuration() == 0)
4310 target->ToPlayer()->AddComboPoints(-GetAmount());
4311}
4312
4313/*********************************************************/
4314/*** OTHERS ***/
4315/*********************************************************/
4316
4317void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4318{
4320 return;
4321
4322 Unit* target = aurApp->GetTarget();
4323
4324 Unit* caster = GetCaster();
4325
4326 // pet auras
4327 if (target->GetTypeId() == TYPEID_PLAYER && (mode & AURA_EFFECT_HANDLE_REAL))
4328 {
4329 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), GetEffIndex()))
4330 {
4331 if (apply)
4332 target->ToPlayer()->AddPetAura(petSpell);
4333 else
4334 target->ToPlayer()->RemovePetAura(petSpell);
4335 }
4336 }
4337
4339 {
4340 // AT APPLY
4341 if (apply)
4342 {
4343 switch (GetId())
4344 {
4345 case 1515: // Tame beast
4346 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
4347 if (caster && target->CanHaveThreatList())
4348 target->GetThreatManager().AddThreat(caster, 10.0f);
4349 break;
4350 case 13139: // net-o-matic
4351 // root to self part of (root_target->charge->root_self sequence
4352 if (caster)
4353 caster->CastSpell(caster, 13138, this);
4354 break;
4355 case 34026: // kill command
4356 {
4357 Unit* pet = target->GetGuardianPet();
4358 if (!pet)
4359 break;
4360
4361 target->CastSpell(target, 34027, this);
4362
4363 // set 3 stacks and 3 charges (to make all auras not disappear at once)
4364 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
4365 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
4366 if (owner_aura)
4367 {
4368 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4369 if (pet_aura)
4370 {
4371 pet_aura->SetCharges(0);
4372 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4373 }
4374 }
4375 break;
4376 }
4377 case 37096: // Blood Elf Illusion
4378 {
4379 if (caster)
4380 {
4381 if (caster->GetGender() == GENDER_FEMALE)
4382 caster->CastSpell(target, 37095, this); // Blood Elf Disguise
4383 else
4384 caster->CastSpell(target, 37093, this);
4385 }
4386 break;
4387 }
4388 case 55198: // Tidal Force
4389 {
4390 target->CastSpell(target, 55166, this);
4391 // set 3 stacks and 3 charges (to make all auras not disappear at once)
4392 Aura* owner_aura = target->GetAura(55166, GetCasterGUID());
4393 if (owner_aura)
4394 {
4395 // This aura lasts 2 sec, need this hack to properly proc spells
4397 GetBase()->SetDuration(owner_aura->GetDuration());
4398 // Make aura be not charged-this prevents removing charge on not crit spells
4399 owner_aura->SetCharges(0);
4400 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4401 }
4402 break;
4403 }
4404 case 39850: // Rocket Blast
4405 if (roll_chance_i(20)) // backfire stun
4406 target->CastSpell(target, 51581, this);
4407 break;
4408 case 43873: // Headless Horseman Laugh
4409 target->PlayDistanceSound(11965);
4410 break;
4411 case 46354: // Blood Elf Illusion
4412 if (caster)
4413 {
4414 if (caster->GetGender() == GENDER_FEMALE)
4415 caster->CastSpell(target, 46356, this);
4416 else
4417 caster->CastSpell(target, 46355, this);
4418 }
4419 break;
4420 case 46361: // Reinforced Net
4421 if (caster)
4422 target->GetMotionMaster()->MoveFall();
4423 break;
4424 case 46699: // Requires No Ammo
4425 if (target->GetTypeId() == TYPEID_PLAYER)
4426 target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
4427 break;
4428 }
4429 }
4430 // AT REMOVE
4431 else
4432 {
4434 {
4436 switch (GetId())
4437 {
4438 case 2584: // Waiting to Resurrect
4439 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
4440 if (target->GetTypeId() == TYPEID_PLAYER)
4441 {
4442 if (Battleground* bg = target->ToPlayer()->GetBattleground())
4443 bg->RemovePlayerFromResurrectQueue(target->GetGUID());
4444 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
4445 bf->RemovePlayerFromResurrectQueue(target->GetGUID());
4446 }
4447 break;
4448 case 43681: // Inactive
4449 {
4450 if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
4451 return;
4452
4453 if (target->GetMap()->IsBattleground())
4454 target->ToPlayer()->LeaveBattleground();
4455 break;
4456 }
4457 case 46308: // Burning Winds cast only at creatures at spawn
4458 target->CastSpell(target, 47287, this);
4459 break;
4460 case 52172: // Coyote Spirit Despawn Aura
4461 case 60244: // Blood Parrot Despawn Aura
4462 target->CastSpell(nullptr, GetAmount(), this);
4463 break;
4464 case 58600: // Restricted Flight Area
4465 case 58730: // Restricted Flight Area
4466 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
4467 target->CastSpell(target, 58601, true);
4468 break;
4469 }
4470 break;
4472 // Summon Gargoyle (Dismiss Gargoyle at remove)
4473 if (GetId() == 61777)
4474 target->CastSpell(target, GetAmount(), true);
4475 break;
4476 default:
4477 break;
4478 }
4479 }
4480 }
4481
4482 // AT APPLY & REMOVE
4483
4485 {
4487 {
4488 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4489 break;
4490 switch (GetId())
4491 {
4492 // Recently Bandaged
4493 case 11196:
4495 break;
4496 // Unstable Power
4497 case 24658:
4498 {
4499 uint32 spellId = 24659;
4500 if (apply && caster)
4501 {
4502 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
4503
4504 for (uint32 i = 0; i < spell->StackAmount; ++i)
4505 caster->CastSpell(target, spell->Id, GetCasterGUID());
4506 break;
4507 }
4508 target->RemoveAurasDueToSpell(spellId);
4509 break;
4510 }
4511 // Restless Strength
4512 case 24661:
4513 {
4514 uint32 spellId = 24662;
4515 if (apply && caster)
4516 {
4517 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
4518 for (uint32 i = 0; i < spell->StackAmount; ++i)
4519 caster->CastSpell(target, spell->Id, GetCasterGUID());
4520 break;
4521 }
4522 target->RemoveAurasDueToSpell(spellId);
4523 break;
4524 }
4525 // Tag Murloc
4526 case 30877:
4527 {
4528 // Tag/untag Blacksilt Scout
4529 target->SetEntry(apply ? 17654 : 17326);
4530 break;
4531 }
4532 case 57819: // Argent Champion
4533 case 57820: // Ebon Champion
4534 case 57821: // Champion of the Kirin Tor
4535 case 57822: // Wyrmrest Champion
4536 {
4537 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4538 break;
4539
4540 uint32 FactionID = 0;
4541
4542 if (apply)
4543 {
4544 switch (m_spellInfo->Id)
4545 {
4546 case 57819: FactionID = 1106; break; // Argent Crusade
4547 case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
4548 case 57821: FactionID = 1090; break; // Kirin Tor
4549 case 57822: FactionID = 1091; break; // The Wyrmrest Accord
4550 }
4551 }
4552 caster->ToPlayer()->SetChampioningFaction(FactionID);
4553 break;
4554 }
4555 // LK Intro VO (1)
4556 case 58204:
4557 if (target->GetTypeId() == TYPEID_PLAYER)
4558 {
4559 // Play part 1
4560 if (apply)
4561 target->PlayDirectSound(14970, target->ToPlayer());
4562 // continue in 58205
4563 else
4564 target->CastSpell(target, 58205, true);
4565 }
4566 break;
4567 // LK Intro VO (2)
4568 case 58205:
4569 if (target->GetTypeId() == TYPEID_PLAYER)
4570 {
4571 // Play part 2
4572 if (apply)
4573 target->PlayDirectSound(14971, target->ToPlayer());
4574 // Play part 3
4575 else
4576 target->PlayDirectSound(14972, target->ToPlayer());
4577 }
4578 break;
4579 case 62061: // Festive Holiday Mount
4580 if (target->HasAuraType(SPELL_AURA_MOUNTED))
4581 {
4582 uint32 creatureEntry = 0;
4583 if (apply)
4584 {
4586 creatureEntry = 24906;
4587 else
4588 creatureEntry = 15665;
4589 }
4590 else
4591 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
4592
4593 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
4594 {
4595 uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo);
4596 sObjectMgr->GetCreatureModelRandomGender(&displayID);
4597
4598 target->SetMountDisplayId(displayID);
4599 }
4600 }
4601 break;
4602 }
4603
4604 break;
4605 }
4606 case SPELLFAMILY_MAGE:
4607 {
4608 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4609 //break;
4610 break;
4611 }
4612 case SPELLFAMILY_PRIEST:
4613 {
4614 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4615 //break;
4616 break;
4617 }
4618 case SPELLFAMILY_DRUID:
4619 {
4620 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4621 //break;
4622 break;
4623 }
4624 case SPELLFAMILY_SHAMAN:
4625 {
4626 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4627 //break;
4628 break;
4629 }
4631 // if (!(mode & AURA_EFFECT_HANDLE_REAL))
4632 // break;
4633 break;
4635 {
4636 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4637 // break;
4638 break;
4639 }
4640 }
4641}
4642
4643void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mode, bool apply) const
4644{
4645 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4646 return;
4647
4648 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
4649 return;
4650
4651 Unit* caster = GetCaster();
4652
4653 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4654 return;
4655
4656 Player* plCaster = caster->ToPlayer();
4657 Unit* target = aurApp->GetTarget();
4658
4659 // Item amount
4660 if (GetAmount() <= 0)
4661 return;
4662
4663 if (GetSpellEffectInfo().ItemType == 0)
4664 return;
4665
4666 // Soul Shard
4667 if (GetSpellEffectInfo().ItemType == 6265)
4668 {
4669 // Soul Shard only from units that grant XP or honor
4670 if (!plCaster->isHonorOrXPTarget(target) ||
4671 (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
4672 return;
4673
4674 // If this is Drain Soul, check for Glyph of Drain Soul
4675 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
4676 {
4677 // Glyph of Drain Soul - chance to create an additional Soul Shard
4678 if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
4679 if (roll_chance_i(aur->GetMiscValue()))
4680 caster->CastSpell(caster, 58068, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
4681 }
4682 }
4683
4684 //Adding items
4685 uint32 noSpaceForCount = 0;
4686 uint32 count = GetAmount();
4687
4688 ItemPosCountVec dest;
4689 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellEffectInfo().ItemType, count, &noSpaceForCount);
4690 if (msg != EQUIP_ERR_OK)
4691 {
4692 count -= noSpaceForCount;
4693 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellEffectInfo().ItemType);
4694 if (count == 0)
4695 return;
4696 }
4697
4698 Item* newitem = plCaster->StoreNewItem(dest, GetSpellEffectInfo().ItemType, true);
4699 if (!newitem)
4700 {
4701 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
4702 return;
4703 }
4704 plCaster->SendNewItem(newitem, count, true, true);
4705}
4706
4707void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
4708{
4709 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4710 return;
4711
4712 Unit* target = aurApp->GetTarget();
4713
4714 Unit* caster = GetCaster();
4715
4716 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4717 return;
4718
4719 caster->ToPlayer()->SetViewpoint(target, apply);
4720}
4721
4722void AuraEffect::HandleForceReaction(AuraApplication const* aurApp, uint8 mode, bool apply) const
4723{
4725 return;
4726
4727 Unit* target = aurApp->GetTarget();
4728
4729 Player* player = target->ToPlayer();
4730 if (!player)
4731 return;
4732
4733 uint32 factionId = GetMiscValue();
4734 ReputationRank factionRank = ReputationRank(GetAmount());
4735
4736 player->GetReputationMgr().ApplyForceReaction(factionId, factionRank, apply);
4738
4739 // stop fighting at apply (if forced rank friendly) or at remove (if real rank friendly)
4740 if ((apply && factionRank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(factionId) >= REP_FRIENDLY))
4741 player->StopAttackFaction(factionId);
4742}
4743
4744void AuraEffect::HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4745{
4746 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4747 return;
4748
4749 Unit* target = aurApp->GetTarget();
4750 if (!apply)
4751 {
4752 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4753 if (target->HasAuraType(GetAuraType()))
4754 return;
4755 }
4756
4757 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
4758 {
4759 if (apply)
4761 else
4763 }
4764}
4765
4766void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode, bool apply) const
4767{
4768 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4769 return;
4770
4771 Unit* target = aurApp->GetTarget();
4772
4773 if (apply)
4774 {
4775 target->SetFaction(GetMiscValue());
4776 if (target->GetTypeId() == TYPEID_PLAYER)
4778 }
4779 else
4780 {
4781 target->RestoreFaction();
4782 if (target->GetTypeId() == TYPEID_PLAYER)
4784 }
4785}
4786
4787void AuraEffect::HandleComprehendLanguage(AuraApplication const* aurApp, uint8 mode, bool apply) const
4788{
4790 return;
4791
4792 Unit* target = aurApp->GetTarget();
4793
4794 if (apply)
4796 else
4797 {
4798 if (target->HasAuraType(GetAuraType()))
4799 return;
4800
4802 }
4803}
4804
4805void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode, bool apply) const
4806{
4807 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4808 return;
4809
4810 Unit* target = aurApp->GetTarget();
4811
4812 Player* player = target->ToPlayer();
4813 if (!player)
4814 return;
4815
4816 if (player->GetClass() != CLASS_DEATH_KNIGHT)
4817 return;
4818
4819 uint32 runes = GetAmount();
4820 // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
4821 if (apply)
4822 {
4823 for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
4824 {
4825 if (GetMiscValue() != player->GetCurrentRune(i))
4826 continue;
4827 if (!player->GetRuneCooldown(i))
4828 {
4829 player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
4830 --runes;
4831 }
4832 }
4833 }
4834 else
4835 player->RemoveRunesByAuraEffect(this);
4836}
4837
4838void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const
4839{
4840 Unit* target = aurApp->GetTarget();
4841
4842 uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(GetSpellEffectInfo().TriggerSpell, target);
4843 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
4844 if (!triggeredSpellInfo)
4845 return;
4846
4847 if (mode & AURA_EFFECT_HANDLE_REAL)
4848 {
4849 if (apply)
4850 {
4851 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
4852 if (!caster)
4853 return;
4854
4855 CastSpellExtraArgs args(this);
4856 if (GetAmount()) // If amount avalible cast with basepoints (Crypt Fever for example)
4858
4859 caster->CastSpell(target, triggeredSpellId, args);
4860 }
4861 else
4862 {
4863 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
4864 target->RemoveAura(triggeredSpellId, casterGUID);
4865 }
4866 }
4867 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
4868 {
4869 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
4870 // change the stack amount to be equal to stack amount of our aura
4871 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
4872 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
4873 }
4874}
4875
4876void AuraEffect::HandleAuraOpenStable(AuraApplication const* aurApp, uint8 mode, bool apply) const
4877{
4878 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4879 return;
4880
4881 Unit* target = aurApp->GetTarget();
4882
4883 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
4884 return;
4885
4886 if (apply)
4887 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
4888
4889 // client auto close stable dialog at !apply aura
4890}
4891
4892void AuraEffect::HandleAuraModFakeInebriation(AuraApplication const* aurApp, uint8 mode, bool apply) const
4893{
4895 return;
4896
4897 Player* target = aurApp->GetTarget()->ToPlayer();
4898 if (!target)
4899 return;
4900
4901 target->ApplyModFakeDrunkValue(GetAmount(), apply);
4903}
4904
4905void AuraEffect::HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 mode, bool apply) const
4906{
4907 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4908 return;
4909
4910 Player* target = aurApp->GetTarget()->ToPlayer();
4911
4912 if (!target || !target->IsInWorld())
4913 return;
4914
4915 uint32 overrideId = uint32(GetMiscValue());
4916
4917 if (apply)
4918 {
4920 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
4921 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
4922 if (uint32 spellId = overrideSpells->Spells[i])
4923 target->AddTemporarySpell(spellId);
4924 }
4925 else
4926 {
4928 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
4929 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
4930 if (uint32 spellId = overrideSpells->Spells[i])
4931 target->RemoveTemporarySpell(spellId);
4932 }
4933}
4934
4935void AuraEffect::HandleAuraPreventRegeneratePower(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4936{
4938 return;
4939
4940 Unit* target = aurApp->GetTarget();
4941
4942 if (target->GetTypeId() != TYPEID_PLAYER)
4943 return;
4944
4945 target->ToPlayer()->UpdatePowerRegen(static_cast<Powers>(GetAmount()));
4946}
4947
4948void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const
4949{
4950 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4951 return;
4952
4953 Unit* target = aurApp->GetTarget();
4954
4955 if (!target->IsInWorld())
4956 return;
4957
4958 uint32 vehicleId = GetMiscValue();
4959
4960 if (apply)
4961 {
4962 if (!target->CreateVehicleKit(vehicleId, 0))
4963 return;
4964 }
4965 else if (target->GetVehicleKit())
4966 target->RemoveVehicleKit();
4967
4968 if (target->GetTypeId() != TYPEID_PLAYER)
4969 return;
4970
4972 data << target->GetPackGUID();
4973 data << uint32(apply ? vehicleId : 0);
4974 target->SendMessageToSet(&data, true);
4975
4976 if (apply)
4978}
4979
4980void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const
4981{
4982 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4983 return;
4984
4985 if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
4986 return;
4987
4988 if (apply)
4990 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
4992}
4993
4995{
4996 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
4997 if (triggerSpellId == 0)
4998 {
4999 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5000 return;
5001 }
5002
5003 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5004 {
5005 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5006 {
5007 triggerCaster->CastSpell(target, triggerSpellId, this);
5008 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5009 }
5010 }
5011 else
5012 TC_LOG_ERROR("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5013}
5014
5016{
5017 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5018 if (triggerSpellId == 0)
5019 {
5020 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5021 return;
5022 }
5023
5024 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5025 {
5026 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5027 {
5028 CastSpellExtraArgs args(this);
5029 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5031
5032 triggerCaster->CastSpell(target, triggerSpellId, args);
5033 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5034 }
5035 }
5036 else
5037 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5038}
5039
5041{
5042 if (!target->IsAlive())
5043 return;
5044
5046 {
5047 SendTickImmune(target, caster);
5048 return;
5049 }
5050
5051 // Consecrate ticks can miss and will not show up in the combat log
5052 // dynobj auras must always have a caster
5054 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5055 return;
5056
5058
5059 // ignore negative values (can be result apply spellmods to aura damage
5060 uint32 damage = std::max(GetAmount(), 0);
5061
5062 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5063 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5064
5066 {
5067 // leave only target depending bonuses, rest is handled in calculate amount
5068 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
5069 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5070
5071 switch (GetSpellInfo()->SpellFamilyName)
5072 {
5074 {
5075 switch (GetId())
5076 {
5077 case 70911: // Unbound Plague
5078 case 72854: // Unbound Plague
5079 case 72855: // Unbound Plague
5080 case 72856: // Unbound Plague
5081 damage *= uint32(pow(1.25f, int32(_ticksDone)));
5082 break;
5083 default:
5084 break;
5085 }
5086 break;
5087 }
5088 default:
5089 break;
5090 }
5091 }
5092 else // ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
5093 damage = uint32(ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
5094
5095 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5096
5097 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5098 if (crit)
5099 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5100
5101 // Calculate armor mitigation
5102 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5103 {
5104 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5105 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5106 damage = damageReducedArmor;
5107 }
5108
5109 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE))
5110 {
5111 if (GetSpellEffectInfo().IsTargetingArea() || GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
5112 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, GetBase()->GetCasterGUID());
5113 }
5114
5115 int32 dmg = damage;
5116 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE) && GetBase()->CanApplyResilience())
5117 Unit::ApplyResilience(target, nullptr, &dmg, crit, CR_CRIT_TAKEN_SPELL);
5118 damage = dmg;
5119
5120 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, BASE_ATTACK);
5121 Unit::CalcAbsorbResist(damageInfo);
5122 damage = damageInfo.GetDamage();
5123
5124 uint32 absorb = damageInfo.GetAbsorb();
5125 uint32 resist = damageInfo.GetResist();
5126 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} absorb is {}",
5127 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5128
5129 Unit::DealDamageMods(target, damage, &absorb);
5130
5131 // Set trigger flag
5132 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5133 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5134 uint32 hitMask = damageInfo.GetHitMask();
5135 if (damage)
5136 {
5137 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5138 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
5139 }
5140
5141 int32 overkill = damage - target->GetHealth();
5142 if (overkill < 0)
5143 overkill = 0;
5144
5145 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
5146 target->SendPeriodicAuraLog(&pInfo);
5147
5148 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
5149
5150 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5151}
5152
5154{
5155 if (!target->IsAlive())
5156 return;
5157
5159 {
5160 SendTickImmune(target, caster);
5161 return;
5162 }
5163
5164 // dynobj auras must always have a caster
5166 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5167 return;
5168
5169 CleanDamage cleanDamage = CleanDamage(0, 0, GetSpellInfo()->GetAttackType(), MELEE_HIT_NORMAL);
5170
5171 // ignore negative values (can be result apply spellmods to aura damage
5172 uint32 damage = std::max(GetAmount(), 0);
5173
5174 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5175 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5176
5177 // dynobj auras must always have a caster
5178 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
5179 damage = ASSERT_NOTNULL(caster)->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5180 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5181
5182 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5183 if (crit)
5184 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5185
5186 // Calculate armor mitigation
5187 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5188 {
5189 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5190 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5191 damage = damageReducedArmor;
5192 }
5193
5194 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE))
5195 {
5196 if (GetSpellEffectInfo().IsTargetingArea() || GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
5197 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, GetBase()->GetCasterGUID());
5198 }
5199
5200 int32 dmg = damage;
5201 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE) && GetBase()->CanApplyResilience())
5202 Unit::ApplyResilience(target, nullptr, &dmg, crit, CR_CRIT_TAKEN_SPELL);
5203 damage = dmg;
5204
5205 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, GetSpellInfo()->GetAttackType());
5206 Unit::CalcAbsorbResist(damageInfo);
5207
5208 uint32 absorb = damageInfo.GetAbsorb();
5209 uint32 resist = damageInfo.GetResist();
5210 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
5211 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5212
5213 // SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
5214 if (caster)
5215 {
5216 SpellNonMeleeDamage log(caster, target, GetId(), GetSpellInfo()->GetSchoolMask());
5217 log.damage = damage;
5218 log.absorb = absorb;
5219 log.resist = resist;
5220 log.periodicLog = true;
5221 if (crit)
5223
5224 caster->SendSpellNonMeleeDamageLog(&log);
5225 }
5226 damage = damageInfo.GetDamage();
5227
5228 // Set trigger flag
5229 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5230 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5231 uint32 hitMask = damageInfo.GetHitMask();
5232 if (damage)
5233 {
5234 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5235 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
5236 }
5237
5238 int32 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
5239 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5240
5241 // process caster heal from now on (must be in world)
5242 if (!caster || !caster->IsAlive())
5243 return;
5244
5245 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5246
5247 uint32 heal = caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5248 heal = caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
5249
5250 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5251 caster->HealBySpell(healInfo);
5252
5253 caster->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5255}
5256
5258{
5259 if (!caster || !caster->IsAlive() || !target->IsAlive())
5260 return;
5261
5262 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5263 {
5264 SendTickImmune(target, caster);
5265 return;
5266 }
5267
5268 uint32 damage = std::max(GetAmount(), 0);
5269 // do not kill health donator
5270 if (caster->GetHealth() < damage)
5271 damage = caster->GetHealth() - 1;
5272 if (!damage)
5273 return;
5274
5275 caster->ModifyHealth(-(int32)damage);
5276 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
5277
5278 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5279
5280 damage = int32(damage * gainMultiplier);
5281
5282 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5283 caster->HealBySpell(healInfo);
5285}
5286
5288{
5289 if (!target->IsAlive())
5290 return;
5291
5292 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5293 {
5294 SendTickImmune(target, caster);
5295 return;
5296 }
5297
5298 // heal for caster damage (must be alive)
5299 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_HEALTH_FUNNEL) && (!caster || !caster->IsAlive()))
5300 return;
5301
5302 // don't regen when permanent aura target has full power
5303 if (GetBase()->IsPermanent() && target->IsFullHealth())
5304 return;
5305
5306 // ignore negative values (can be result apply spellmods to aura damage
5307 uint32 damage = std::max(GetAmount(), 0);
5308
5309 // Script Hook For HandlePeriodicHealAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5310 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5311
5313 damage = uint32(target->CountPctFromMaxHealth(damage));
5314 else
5315 {
5316 // dynobj auras must always have a caster
5317 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
5318 damage = ASSERT_NOTNULL(caster)->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5319 }
5320
5321 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT);
5322
5323 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5324 if (crit)
5325 damage = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, damage, target);
5326
5327 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
5328 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
5329
5330 uint32 heal = damage;
5331
5332 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5333 Unit::CalcHealAbsorb(healInfo);
5334 Unit::DealHeal(healInfo);
5335
5336 SpellPeriodicAuraLogInfo pInfo(this, heal, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
5337 target->SendPeriodicAuraLog(&pInfo);
5338
5339 if (caster)
5340 target->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5341
5342 bool haveCastItem = !GetBase()->GetCastItemGUID().IsEmpty();
5343
5344 // Health Funnel
5345 // damage caster for heal amount
5346 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_HEALTH_FUNNEL))
5347 {
5348 uint32 funnelDamage = GetSpellInfo()->ManaPerSecond; // damage is not affected by spell power
5349
5350 if (funnelDamage > healInfo.GetEffectiveHeal() && healInfo.GetEffectiveHeal())
5351 funnelDamage = healInfo.GetEffectiveHeal();
5352
5353 uint32 funnelAbsorb = 0;
5354 Unit::DealDamageMods(caster, funnelDamage, &funnelAbsorb);
5355
5356 if (caster)
5357 {
5358 SpellNonMeleeDamage log(caster, caster, GetId(), GetSpellInfo()->GetSchoolMask());
5359 log.damage = funnelDamage;
5360 log.absorb = funnelAbsorb;
5361 log.periodicLog = true;
5362 caster->SendSpellNonMeleeDamageLog(&log);
5363 }
5364
5366 Unit::DealDamage(caster, caster, funnelDamage, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
5367 }
5368
5369 // %-based heal - does not proc auras
5371 return;
5372
5373 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5374 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5375 uint32 hitMask = crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5376 // ignore item heals
5377 if (!haveCastItem)
5378 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_HEAL, PROC_SPELL_PHASE_HIT, hitMask, nullptr, nullptr, &healInfo);
5379}
5380
5382{
5383 Powers powerType = Powers(GetMiscValue());
5384
5385 if (!caster || !caster->IsAlive() || !target->IsAlive() || target->GetPowerType() != powerType)
5386 return;
5387
5389 {
5390 SendTickImmune(target, caster);
5391 return;
5392 }
5393
5395 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5396 return;
5397
5398 // ignore negative values (can be result apply spellmods to aura damage
5399 int32 drainAmount = std::max(GetAmount(), 0);
5400
5401 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
5402 // It's mana percent cost spells, m_amount is percent drain from target
5404 {
5405 // max value
5406 int32 maxmana = CalculatePct(caster->GetMaxPower(powerType), drainAmount * 2.0f);
5407 ApplyPct(drainAmount, target->GetMaxPower(powerType));
5408 if (drainAmount > maxmana)
5409 drainAmount = maxmana;
5410 }
5411
5412 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
5413 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
5414
5415 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
5416 if (powerType == POWER_MANA)
5417 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
5418
5419 int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
5420
5421 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5422
5423 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
5424 target->SendPeriodicAuraLog(&pInfo);
5425
5426 int32 gainAmount = int32(drainedAmount * gainMultiplier);
5427 int32 gainedAmount = 0;
5428 if (gainAmount)
5429 {
5430 gainedAmount = caster->ModifyPower(powerType, gainAmount);
5431 // energize is not modified by threat modifiers
5432 target->GetThreatManager().AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo(), true);
5433 }
5434
5435 // Drain Mana - Mana Feed effect
5437 {
5438 int32 manaFeedVal = 0;
5439 if (AuraEffect const* aurEff = GetBase()->GetEffect(EFFECT_1))
5440 manaFeedVal = aurEff->GetAmount();
5441
5442 if (manaFeedVal > 0)
5443 {
5444 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
5445
5446 CastSpellExtraArgs args(this);
5447 args.AddSpellMod(SPELLVALUE_BASE_POINT0, feedAmount);
5448 caster->CastSpell(caster, 32554, args);
5449 }
5450 }
5451}
5452
5454{
5455 Powers powerType = Powers(GetMiscValue());
5456
5457 if (!target->IsAlive() || !target->GetMaxPower(powerType))
5458 return;
5459
5460 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5461 {
5462 SendTickImmune(target, caster);
5463 return;
5464 }
5465
5466 // don't regen when permanent aura target has full power
5467 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
5468 return;
5469
5470 // ignore negative values (can be result apply spellmods to aura damage
5471 uint32 amount = std::max(GetAmount(), 0) * target->GetMaxPower(powerType) /100;
5472 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
5473 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
5474
5475 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
5476 target->SendPeriodicAuraLog(&pInfo);
5477
5478 int32 gain = target->ModifyPower(powerType, amount);
5479
5480 if (caster)
5481 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
5482}
5483
5485{
5486 Powers powerType = Powers(GetMiscValue());
5487
5489 return;
5490
5491 if (!target->IsAlive() || !target->GetMaxPower(powerType))
5492 return;
5493
5494 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5495 {
5496 SendTickImmune(target, caster);
5497 return;
5498 }
5499
5500 // don't regen when permanent aura target has full power
5501 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
5502 return;
5503
5504 // ignore negative values (can be result apply spellmods to aura damage
5505 int32 amount = std::max(GetAmount(), 0);
5506
5507 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
5508 target->SendPeriodicAuraLog(&pInfo);
5509
5510 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
5511 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
5512
5513 int32 gain = target->ModifyPower(powerType, amount);
5514
5515 if (caster)
5516 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
5517}
5518
5520{
5521 Powers powerType = Powers(GetMiscValue());
5522
5523 if (!caster || !target->IsAlive() || target->GetPowerType() != powerType)
5524 return;
5525
5527 {
5528 SendTickImmune(target, caster);
5529 return;
5530 }
5531
5532 // ignore negative values (can be result apply spellmods to aura damage
5533 int32 damage = std::max(GetAmount(), 0);
5534
5535 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
5536 if (powerType == POWER_MANA)
5537 damage -= target->GetSpellCritDamageReduction(damage);
5538
5539 uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
5540
5541 float dmgMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5542
5543 SpellInfo const* spellProto = GetSpellInfo();
5544 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
5545 SpellNonMeleeDamage damageInfo(caster, target, spellProto->Id, spellProto->SchoolMask);
5546 damageInfo.periodicLog = true;
5547 // no SpellDamageBonus for burn mana
5548 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
5549
5550 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
5551
5552 caster->SendSpellNonMeleeDamageLog(&damageInfo);
5553
5554 // Set trigger flag
5555 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5556 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5557 uint32 hitMask = createProcHitMask(&damageInfo, SPELL_MISS_NONE);
5558 uint32 spellTypeMask = PROC_SPELL_TYPE_NO_DMG_HEAL;
5559 if (damageInfo.damage)
5560 {
5561 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
5562 spellTypeMask |= PROC_SPELL_TYPE_DAMAGE;
5563 }
5564
5565 caster->DealSpellDamage(&damageInfo, true);
5566
5567 DamageInfo dotDamageInfo(damageInfo, DOT, BASE_ATTACK, hitMask);
5568 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, spellTypeMask, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &dotDamageInfo, nullptr);
5569}
5570
5572{
5573 int32 const armorMod = GetSpellEffectInfo().CalcValue(caster, &m_baseAmount);
5574 const_cast<AuraEffect*>(this)->SetAmount(target->GetArmor() / armorMod);
5575
5576 target->UpdateAttackPowerAndDamage(false);
5577 target->UpdateAttackPowerAndDamage(true);
5578}
5579
5581{
5582 int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
5583
5584 if (damageLeft <= 0)
5585 aurApp->GetTarget()->RemoveAura(aurApp);
5586 else
5587 SetAmount(damageLeft);
5588}
5589
5591{
5592 Unit* triggerCaster = aurApp->GetTarget();
5593 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
5594
5595 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5596 if (triggerSpellId == 0)
5597 {
5598 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5599 return;
5600 }
5601
5602 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5603 {
5604 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
5605 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo->Id, this);
5606 }
5607 else
5608 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5609}
5610
5612{
5613 Unit* triggerCaster = aurApp->GetTarget();
5614 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
5615
5616 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5617 if (triggerSpellId == 0)
5618 {
5619 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5620 return;
5621 }
5622
5623 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5624 {
5625 CastSpellExtraArgs args(this);
5627 triggerCaster->CastSpell(triggerTarget, triggerSpellId, args);
5628 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, GetAmount(), GetId());
5629 }
5630 else
5631 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5632}
5633
5635{
5636 if (!aurApp)
5637 return;
5638
5639 Unit* target = aurApp->GetTarget();
5640 Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
5641 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo()))
5642 {
5643 SendTickImmune(triggerTarget, target);
5644 return;
5645 }
5646
5647 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask);
5648 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetSpellEffectInfo(), { });
5649 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
5650 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
5651 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
5652 target->SendSpellNonMeleeDamageLog(&damageInfo);
5653 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
5654 target->DealSpellDamage(&damageInfo, true);
5655}
5656
5658{
5659 Unit* target = aurApp->GetTarget();
5660
5661 uint32 triggerSpellId;
5662 switch (GetId())
5663 {
5664 case 57949: // Shiver
5665 triggerSpellId = 57952;
5666 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
5667 break;
5668 case 59978: // Shiver
5669 triggerSpellId = 59979;
5670 break;
5671 case 43593: // Cold Stare
5672 triggerSpellId = 43594;
5673 break;
5674 default:
5675 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
5676 return;
5677 }
5678
5679 int32 jumps = GetBase()->GetCharges();
5680
5681 // current aura expire on proc finish
5682 GetBase()->SetCharges(0);
5683 GetBase()->SetUsingCharges(true);
5684
5685 // next target selection
5686 if (jumps > 0)
5687 {
5688 if (Unit* caster = GetCaster())
5689 {
5690 float radius = GetSpellEffectInfo().CalcRadius(caster);
5691
5692 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
5693 {
5694 target->CastSpell(triggerTarget, GetId(), { this, GetCasterGUID() });
5695 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
5696 aura->SetCharges(jumps);
5697 }
5698 }
5699 }
5700
5701 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
5702 target->CastSpell(target, triggerSpellId, { this, GetCasterGUID() });
5703}
5704
5706{
5707 Unit* target = aurApp->GetTarget();
5708
5709 // Currently only Prayer of Mending
5710 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
5711 {
5712 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
5713 return;
5714 }
5715 uint32 triggerSpellId = 33110;
5716
5717 int32 jumps = GetBase()->GetCharges();
5718
5719 // current aura expire on proc finish
5720 GetBase()->SetCharges(0);
5721 GetBase()->SetUsingCharges(true);
5722
5723 CastSpellExtraArgs args(this);
5726
5727 // next target selection
5728 if (jumps > 0)
5729 {
5730 if (Unit* caster = GetCaster())
5731 {
5732 float radius = GetSpellEffectInfo().CalcRadius(caster);
5733
5734 Unit* triggerTarget = nullptr;
5735 Trinity::MostHPMissingGroupInRange u_check(target, radius, 0);
5736 Trinity::UnitLastSearcher<Trinity::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
5737 Cell::VisitAllObjects(target, searcher, radius);
5738
5739 if (triggerTarget)
5740 {
5741 target->CastSpell(triggerTarget, GetId(), args);
5742 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
5743 aura->SetCharges(jumps);
5744 }
5745 }
5746 }
5747
5748 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
5749 target->CastSpell(target, triggerSpellId, args);
5750}
5751
5752template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
5753template TC_GAME_API void AuraEffect::GetTargetList(std::deque<Unit*>&) const;
5754template TC_GAME_API void AuraEffect::GetTargetList(std::vector<Unit*>&) const;
5755
5756template TC_GAME_API void AuraEffect::GetApplicationList(std::list<AuraApplication*>&) const;
5757template TC_GAME_API void AuraEffect::GetApplicationList(std::deque<AuraApplication*>&) const;
5758template TC_GAME_API void AuraEffect::GetApplicationList(std::vector<AuraApplication*>&) const;
#define sBattlefieldMgr
@ IN_MILLISECONDS
Definition Common.h:35
#define MAX_SPELL_EFFECTS
Definition DBCEnums.h:386
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormfmt)
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
#define MAX_SHAPESHIFT_SPELLS
#define MAX_ITEM_ENCHANTMENT_EFFECTS
#define MAX_OVERRIDE_SPELL
#define TC_GAME_API
Definition Define.h:114
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint64_t uint64
Definition Define.h:132
#define UI64LIT(N)
Definition Define.h:118
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133
#define ASSERT_NOTNULL(pointer)
Definition Errors.h:84
#define ASSERT
Definition Errors.h:68
InventoryResult
Definition ItemDefines.h:25
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition ItemDefines.h:49
@ EQUIP_ERR_OK
Definition ItemDefines.h:26
#define TC_LOG_WARN(filterType__,...)
Definition Log.h:162
#define TC_LOG_DEBUG(filterType__,...)
Definition Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition Log.h:165
@ PHASEMASK_NORMAL
@ TYPEID_UNIT
Definition ObjectGuid.h:38
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define sObjectMgr
Definition ObjectMgr.h:1721
#define sOutdoorPvPMgr
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
#define PET_FOLLOW_DIST
Definition PetDefines.h:85
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:575
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:576
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:632
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:438
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:439
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition Player.h:429
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition Player.h:430
std::unordered_map< uint32, PlayerSpell > PlayerSpellMap
Definition Player.h:180
@ PLAYER_ALLOW_ONLY_ABILITY
Definition Player.h:369
@ PLAYER_FLAGS_GHOST
Definition Player.h:350
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
Definition Player.h:421
SpellModType
Definition Player.h:123
@ PLAYER_FIELD_BYTES_OFFSET_FLAGS
Definition Player.h:406
@ PLAYERSPELL_REMOVED
Definition Player.h:153
RuneType
Definition Player.h:289
#define INVENTORY_SLOT_BAG_0
Definition Player.h:555
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition Player.h:416
bool roll_chance_f(float chance)
Definition Random.h:53
bool roll_chance_i(int chance)
Definition Random.h:59
#define sScriptMgr
Definition ScriptMgr.h:1168
@ SERVERSIDE_VISIBILITY_GHOST
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
SpellSchools
@ SPELL_SCHOOL_NORMAL
@ MAX_SPELL_SCHOOL
@ SPELL_ATTR7_CAN_RESTORE_SECONDARY_POWER
StealthType
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ SPELL_EFFECT_SUMMON
#define MAX_RUNES
#define CLASSMASK_WAND_USERS
@ SPELL_PREVENTION_TYPE_SILENCE
@ GENDER_MALE
@ GENDER_FEMALE
@ SPELL_ATTR5_START_PERIODIC_AT_APPLY
@ SPELL_ATTR5_HASTE_AFFECT_DURATION
@ SPELL_SCHOOL_MASK_NORMAL
@ SPELL_SCHOOL_MASK_SPELL
@ SPELL_ATTR2_HEALTH_FUNNEL
@ SPELL_ATTR2_FAIL_ON_ALL_TARGETS_IMMUNE
@ CREATURE_TYPE_BEAST
InvisibilityType
@ INVISIBILITY_UNK10
@ INVISIBILITY_GENERAL
@ SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY
@ SPELL_ATTR1_CHANNEL_TRACK_TARGET
@ UNIT_DYNFLAG_SPECIALINFO
@ UNIT_DYNFLAG_DEAD
@ UNIT_DYNFLAG_TRACK_UNIT
#define MAX_GLYPH_SLOT_INDEX
WeaponAttackType
@ OFF_ATTACK
@ MAX_ATTACK
@ BASE_ATTACK
@ RANGED_ATTACK
@ CLASS_DRUID
@ CLASS_DEATH_KNIGHT
@ MECHANIC_POLYMORPH
@ MECHANIC_BANISH
@ IMMUNITY_MECHANIC
@ SPELLFAMILY_PRIEST
@ SPELLFAMILY_WARLOCK
@ SPELLFAMILY_MAGE
@ SPELLFAMILY_GENERIC
@ SPELLFAMILY_WARRIOR
@ SPELLFAMILY_PALADIN
@ SPELLFAMILY_SHAMAN
@ SPELLFAMILY_DRUID
@ SPELLFAMILY_DEATHKNIGHT
Powers
@ POWER_RAGE
@ POWER_ENERGY
@ POWER_MANA
@ POWER_RUNE
@ SPELL_ATTR0_PASSIVE
@ SPELL_ATTR0_HIDDEN_CLIENTSIDE
@ SPELL_ATTR0_ABILITY
ReputationRank
@ REP_FRIENDLY
@ GHOST_VISIBILITY_ALIVE
@ GHOST_VISIBILITY_GHOST
@ SPELL_HIT_TYPE_CRIT
@ RACE_TROLL
@ RACE_UNDEAD_PLAYER
@ RACE_ORC
@ RACE_DRAENEI
@ RACE_NIGHTELF
@ RACE_BLOODELF
@ RACE_DWARF
@ RACE_GNOME
@ RACE_HUMAN
@ RACE_TAUREN
@ SPELL_MISS_NONE
Stats
@ MAX_STATS
@ STAT_STRENGTH
@ STAT_STAMINA
@ SPELL_ATTR4_FIXED_DAMAGE
@ SKILL_DEFENSE
@ AURA_REMOVE_NONE
@ AURA_REMOVE_BY_DEATH
@ AURA_REMOVE_BY_EXPIRE
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
@ SPELL_AURA_MANA_SHIELD
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
@ SPELL_AURA_MOD_DISARM_RANGED
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_PERIODIC_HASTE
@ SPELL_AURA_MOD_SHAPESHIFT
@ SPELL_AURA_MOD_DISARM
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
@ SPELL_AURA_OBS_MOD_HEALTH
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
@ SPELL_AURA_MELEE_SLOW
@ 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_OBS_MOD_POWER
@ SPELL_AURA_ADD_FLAT_MODIFIER
@ SPELL_AURA_MOD_STEALTH_DETECT
@ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_MOD_MELEE_HASTE
@ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
@ SPELL_AURA_MOD_INVISIBILITY
@ SPELL_AURA_PERIODIC_HEAL
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
@ SPELL_AURA_DUMMY
@ SPELL_AURA_FLY
@ SPELL_AURA_MOD_PACIFY
@ SPELL_AURA_MOD_SILENCE
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
@ SPELL_AURA_MOD_DISARM_OFFHAND
@ SPELL_AURA_MOD_STAT
@ 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_ALLOW_ONLY_ABILITY
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
@ SPELL_AURA_MECHANIC_IMMUNITY
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
@ SPELL_AURA_PHASE
@ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
@ SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER
@ SPELL_AURA_MOD_PACIFY_SILENCE
@ SPELL_AURA_TRANSFORM
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
@ SPELL_AURA_SCHOOL_ABSORB
@ SPELL_AURA_MOD_RESISTANCE_PCT
@ SPELL_AURA_PERIODIC_ENERGIZE
@ SPELL_AURA_MOD_INVISIBILITY_DETECT
@ SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
@ SPELL_AURA_MOD_BASE_RESISTANCE_PCT
@ SPELL_AURA_PERIODIC_LEECH
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
@ SPELL_AURA_DAMAGE_IMMUNITY
@ SPELL_AURA_POWER_BURN
@ SPELL_AURA_MOD_PERCENT_STAT
@ SPELL_AURA_MOD_CONFUSE
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
@ SPELL_AURA_PERIODIC_DUMMY
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
@ SPELL_AURA_MOD_BASE_HEALTH_PCT
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
@ SPELL_AURA_NO_REAGENT_USE
@ SPELL_AURA_MOD_UNATTACKABLE
@ SPELL_AURA_MOD_STEALTH
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL
@ SPELL_AURA_MOD_SKILL_TALENT
@ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
@ SPELL_AURA_MOD_STUN
ShapeshiftForm
@ FORM_DIREBEAR
@ FORM_UNDEAD
@ FORM_TEST
@ FORM_TRAVEL
@ FORM_CREATUREBEAR
@ FORM_SHADOW
@ FORM_SHADOW_DANCE
@ FORM_SPIRITOFREDEMPTION
@ FORM_BERSERKERSTANCE
@ FORM_MASTER_ANGLER
@ FORM_DEFENSIVESTANCE
@ FORM_THARONJA_SKELETON
@ FORM_FLIGHT_EPIC
@ FORM_STEVES_GHOUL
@ FORM_MOONKIN
@ FORM_NONE
@ FORM_CREATURECAT
@ FORM_CAT
@ FORM_FLIGHT
@ FORM_ZOMBIE
@ FORM_GHOSTWOLF
@ FORM_AMBIENT
@ FORM_AQUA
@ FORM_STEALTH
@ FORM_BATTLESTANCE
@ FORM_BLB_PLAYER
@ FORM_METAMORPHOSIS
@ FORM_GHOUL
@ FORM_TREE
@ FORM_TEST_OF_STRENGTH
@ FORM_BEAR
@ DYNOBJ_AURA_TYPE
@ UNIT_AURA_TYPE
pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]
void(AuraEffect::* pAuraEffectHandler)(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellModOp
@ SPELLMOD_EFFECT2
@ SPELLMOD_ALL_EFFECTS
@ SPELLMOD_EFFECT3
@ SPELLMOD_ACTIVATION_TIME
@ SPELLMOD_EFFECT1
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
SpellValueMod
@ SPELLVALUE_BASE_POINT0
@ AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
@ SPELL_ATTR0_CU_ROLLING_PERIODIC
Definition SpellInfo.h:152
@ SPELL_ATTR0_CU_CAN_CRIT
Definition SpellInfo.h:148
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:221
@ PROC_HIT_NORMAL
Definition SpellMgr.h:220
#define sSpellMgr
Definition SpellMgr.h:738
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:203
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:202
@ PROC_SPELL_TYPE_NO_DMG_HEAL
Definition SpellMgr.h:204
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:212
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:142
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:143
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:145
@ UNIT_FLAG2_MIRROR_IMAGE
@ UNIT_FLAG2_COMPREHEND_LANG
@ UNIT_FLAG2_FORCE_MOVEMENT
@ UNIT_FLAG2_FEIGN_DEATH
@ UNIT_FLAG2_DISARM_OFFHAND
@ UNIT_FLAG2_DISARM_RANGED
@ REACT_PASSIVE
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ UNIT_VIS_FLAGS_UNTRACKABLE
Definition UnitDefines.h:53
@ UNIT_VIS_FLAGS_CREEP
Definition UnitDefines.h:52
@ COMMAND_STAY
@ MOVE_FLIGHT
@ MOVE_SWIM
@ MOVE_FLIGHT_BACK
@ MOVE_SWIM_BACK
@ MOVE_RUN
@ MOVE_RUN_BACK
@ 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_SILENCED
@ UNIT_FLAG_PLAYER_CONTROLLED
uint32 createProcHitMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition Unit.cpp:9978
@ BASE_VALUE
Definition Unit.h:139
@ TOTAL_VALUE
Definition Unit.h:140
UnitMods
Definition Unit.h:158
@ UNIT_MOD_ARMOR
Definition Unit.h:172
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:186
@ UNIT_MOD_HEALTH
Definition Unit.h:164
@ UNIT_MOD_POWER_START
Definition Unit.h:188
@ UNIT_MOD_STAT_START
Definition Unit.h:184
@ CORPSE
Definition Unit.h:227
@ JUST_DIED
Definition Unit.h:226
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition Unit.h:626
CurrentSpellTypes
Definition Unit.h:619
@ CURRENT_GENERIC_SPELL
Definition Unit.h:621
@ CURRENT_MELEE_SPELL
Definition Unit.h:620
@ UNIT_STATE_DIED
Definition Unit.h:234
@ UNIT_STATE_CONFUSED
Definition Unit.h:245
@ UNIT_STATE_ROOT
Definition Unit.h:244
@ UNIT_STATE_ISOLATED
Definition Unit.h:247
@ UNIT_STATE_FLEEING
Definition Unit.h:241
@ UNIT_STATE_CASTING
Definition Unit.h:249
@ UNIT_STATE_STUNNED
Definition Unit.h:237
@ MELEE_HIT_NORMAL
Definition Unit.h:409
#define MAX_COMBAT_RATING
Definition Unit.h:363
@ SHIELD_BLOCK_VALUE
Definition Unit.h:197
#define CURRENT_MAX_SPELL
Definition Unit.h:627
CombatRating
Definition Unit.h:335
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:352
@ NULL_BAG
Definition Unit.h:60
@ NULL_SLOT
Definition Unit.h:61
@ SELF_DAMAGE
Definition Unit.h:372
@ DOT
Definition Unit.h:369
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:368
@ CHARM_TYPE_CHARM
Definition Unit.h:668
@ CHARM_TYPE_POSSESS
Definition Unit.h:669
@ CHARM_TYPE_CONVERT
Definition Unit.h:671
std::list< Unit * > UnitList
Definition Unit.h:106
@ TOTAL_PCT
Definition Unit.h:147
@ BASE_PCT
Definition Unit.h:146
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
@ UNIT_FIELD_POWER_COST_MODIFIER
@ PLAYER_FIELD_MOD_TARGET_RESISTANCE
@ UNIT_MOD_CAST_SPEED
@ PLAYER_FIELD_BYTES2
@ PLAYER_FLAGS
@ PLAYER_TRACK_CREATURES
@ PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
@ PLAYER_FIELD_BYTES
@ PLAYER_TRACK_RESOURCES
@ UNIT_FIELD_POWER_COST_MULTIPLIER
@ PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
@ PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
T AddPct(T &base, U pct)
Definition Util.h:77
T ApplyPct(T &base, U pct)
Definition Util.h:83
T CalculatePct(T base, U pct)
Definition Util.h:71
PowerType
Unit * GetTarget() const
Definition SpellAuras.h:74
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:88
void HandleAuraModDecreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModBlockPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePreventFleeing(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModShapeshift(AuraApplication const *aurApp, uint8 mode, bool apply) const
void GetApplicationList(Container &applicationContainer) const
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false)
void HandleAuraModStun(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModHealingDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraRetainComboPoints(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModRatingFromStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDispelImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicPowerBurnAuraTick(Unit *target, Unit *caster) const
SpellInfo const * GetSpellInfo() const
AuraType GetAuraType() const
SpellEffIndex GetEffIndex() const
void HandleAuraTrackResources(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 HandleModPowerCostPCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraEmpathy(AuraApplication const *aurApp, uint8 mode, bool apply) const
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 HandlePeriodicManaLeechAuraTick(Unit *target, Unit *caster) const
void HandleNULL(AuraApplication const *, uint8, bool) const
void HandleModCombatSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
SpellModifier * m_spellmod
void HandleModFear(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModFaction(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModRangedAttackPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void ApplySpellMod(Unit *target, bool apply)
SpellEffectInfo const & GetSpellEffectInfo() const
void HandleObsModPowerAuraTick(Unit *target, Unit *caster) const
void HandleAuraSetVehicle(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseHealthPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModResistanceExclusive(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 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 HandleAuraModDmgImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModPetTalentsPoints(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModDamageDone(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModAttackPowerPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleSpiritOfRedemption(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTaunt(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseMountedSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseHealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleArenaPreparation(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSchoolImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleUnused(AuraApplication const *, uint8, bool) const
void HandlePeriodicEnergizeAuraTick(Unit *target, Unit *caster) const
void HandleModPowerRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModInvisibilityDetect(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModResistenceOfStatPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicTriggerSpellAuraTick(Unit *target, Unit *caster) const
void HandleNoImmediateEffect(AuraApplication const *, uint8, bool) 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 HandleAuraMounted(AuraApplication const *aurApp, uint8 mode, bool apply) const
uint32 GetRemainingTicks() const
uint32 GetId() const
void HandleAuraModRangedHaste(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraControlVehicle(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModBaseResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleShapeshiftBoosts(Unit *target, bool apply) const
int32 CalculateAmount(Unit *caster)
void HandlePreventResurrection(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMechanicImmunityMask(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraAllowFlight(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 HandleRaidProcFromChargeAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void HandlePeriodicHealthLeechAuraTick(Unit *target, Unit *caster) const
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
bool IsAffectingSpell(SpellInfo const *spell) const
void HandleAuraGhost(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraAllowOnlyAbility(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPercentStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
void HandleAuraModStateImmunity(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMiscValueB() const
void HandleAuraModExpertise(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraTransform(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModDisarm(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModOffhandDamagePercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandlePeriodicDamageAurasTick(Unit *target, Unit *caster) const
void HandleAuraTrackStealthed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModUnattackable(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModMeleeRangedSpeedPct(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellCritChanceShool(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 HandleRangedAmmoHaste(AuraApplication const *aurApp, uint8 mode, bool apply) const
void SetAmount(int32 amount)
void HandleCharmConvert(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseSwimSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModCastingSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseMaxHealth(AuraApplication const *aurApp, uint8 mode, bool apply) const
Unit * GetCaster() const
void HandleModStealthLevel(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTargetResistance(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMiscValue() const
void GetTargetList(Container &targetContainer) const
void HandleModConfuse(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModTotalPercentStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModStealthDetect(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellCritChance(AuraApplication const *aurApp, uint8 mode, bool apply) const
uint32 GetTotalTicks() const
void HandleAuraModScale(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModIncreaseSpeed(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraConvertRune(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 HandleAuraModRoot(AuraApplication const *aurApp, uint8 mode, bool apply) const
Aura * GetBase() 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
int32 const m_baseAmount
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 CleanupTriggeredSpells(Unit *target)
void HandleShieldBlockValue(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModCharm(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
SpellInfo const *const m_spellInfo
void HandleAuraModAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModSilence(AuraApplication const *aurApp, uint8 mode, bool apply) const
void ResetPeriodic(bool resetPeriodicTimer=false)
void HandleModManaRegen(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModBaseResistancePCT(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleShieldBlockValuePercent(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 HandleModSpellDamagePercentFromAttackPower(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleAuraModAttackPowerOfStatPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void HandleBreakableCCAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
ObjectGuid GetCasterGUID() const
void HandleAuraModStat(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleForceMoveForward(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModSpellHealingPercentFromAttackPower(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 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 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 HandleAuraHover(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleBindSight(AuraApplication const *aurApp, uint8 mode, bool apply) const
AuraEffect(Aura *base, SpellEffectInfo const &spellEfffectInfo, int32 const *baseAmount, Unit *caster)
void HandleAuraModIncreaseFlightSpeed(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 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 HandleModAttackPowerOfArmorAuraTick(Unit *target, Unit *caster) const
void HandleProcTriggerSpellAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
void HandleAuraModIncreaseEnergyPercent(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModDetaunt(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetAmount() const
void HandleModInvisibility(AuraApplication const *aurApp, uint8 mode, bool apply) const
void HandleModPossess(AuraApplication const *aurApp, uint8 mode, bool apply) const
int32 GetMaxDuration() const
Definition SpellAuras.h:168
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:232
void SetStackAmount(uint8 num)
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Unit * GetUnitOwner() const
Definition SpellAuras.h:147
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:234
void SetUsingCharges(bool val)
Definition SpellAuras.h:248
bool CallScriptEffectRemoveHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
void CallScriptEffectCalcAmountHandlers(AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
bool CallScriptEffectPeriodicHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp)
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:144
int32 GetDuration() const
Definition SpellAuras.h:173
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:226
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)
bool CallScriptEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void CallScriptAfterEffectProcHandlers(AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
void SetDuration(int32 duration, bool withMods=false)
uint8 GetStackAmount() const
Definition SpellAuras.h:189
uint8 GetCharges() const
Definition SpellAuras.h:180
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:140
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:143
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
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:129
bool IsPermanent() const
Definition SpellAuras.h:178
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool isTappedBy(Player const *player) const
uint8 GetCurrentEquipmentId() const
Definition Creature.h:186
uint32 GetHitMask() const
Definition Unit.cpp:233
uint32 GetResist() const
Definition Unit.h:480
uint32 GetDamage() const
Definition Unit.h:478
uint32 GetAbsorb() const
Definition Unit.h:479
bool HasFlag(FLAG_TYPE flag) const
Definition Object.h:288
void AddFlag(FLAG_TYPE flag)
Definition Object.h:289
T_FLAGS GetFlags() const
Definition Object.h:287
void DelFlag(FLAG_TYPE flag)
Definition Object.h:290
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:294
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:293
uint32 GetAbsorb() const
Definition Unit.h:508
uint32 GetEffectiveHeal() const
Definition Unit.h:507
Definition Item.h:62
bool IsDungeon() const
Definition Map.cpp:4231
bool IsBattleground() const
Definition Map.cpp:4262
bool Instanceable() const
Definition Map.cpp:4221
float GetVisibilityRange() const
Definition Map.h:332
float GetFollowAngle() const override
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
void MoveFall(uint32 id=0)
static ObjectGuid const Empty
Definition ObjectGuid.h:140
bool IsEmpty() const
Definition ObjectGuid.h:172
std::string ToString() const
static uint32 ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:745
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:90
static Creature * ToCreature(Object *o)
Definition Object.h:189
bool IsPlayer() const
Definition Object.h:182
PackedGuid const & GetPackGUID() const
Definition Object.h:80
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition Object.cpp:676
bool IsInWorld() const
Definition Object.h:73
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:729
TypeID GetTypeId() const
Definition Object.h:93
void ApplyModByteFlag(uint16 index, uint8 offset, uint8 flag, bool apply)
Definition Object.cpp:854
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:761
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:776
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:89
float GetFloatValue(uint16 index) const
Definition Object.cpp:253
uint32 GetEntry() const
Definition Object.h:81
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:647
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:825
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SetEntry(uint32 entry)
Definition Object.h:82
static Player * ToPlayer(Object *o)
Definition Object.h:183
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:811
std::size_t size() const
Definition ObjectGuid.h:278
Definition Pet.h:40
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:732
void UpdateParryPercentage()
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition Player.cpp:13070
void UpdateAllSpellCritChances()
void ApplyModFakeDrunkValue(int32 mod, bool apply)
Definition Player.h:1870
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:24367
void UpdateRuneRegen(RuneType rune)
void UpdateDodgePercentage()
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 itemId, bool update, int32 randomPropertyId=0, GuidSet const &allowedLooters=GuidSet())
Definition Player.cpp:11619
void LeaveBattleground(bool teleportToEntryPoint=true, bool withoutDeserterDebuff=false)
Definition Player.cpp:21952
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition Player.cpp:7528
void HandleBaseModFlatValue(BaseModGroup modGroup, float amount, bool apply)
Definition Player.cpp:4971
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5279
void UpdatePowerRegen(Powers power)
void AddTemporarySpell(uint32 spellId)
Definition Player.cpp:3329
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, bool apply)
Definition Player.cpp:7382
void UpdateBlockPercentage()
bool InBattleground() const
Definition Player.h:1969
void SetNoRegentCostMask(flag96 mask)
Definition Player.h:1107
void PetSpellInitialize()
Definition Player.cpp:20594
void SetFallInformation(uint32 time, float z)
Definition Player.cpp:24827
void setRegenTimerCount(uint32 time)
Definition Player.h:1389
Pet * GetPet() const
Definition Player.cpp:20284
void RemoveTemporarySpell(uint32 spellId)
Definition Player.cpp:3342
void ApplyItemDependentAuras(Item *item, bool apply)
Definition Player.cpp:7535
void RemoveAmmo()
Definition Player.cpp:11608
WorldSession * GetSession() const
Definition Player.h:1705
void UpdateSpellHitChances()
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9550
void UpdateExpertise(WeaponAttackType attType)
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:24094
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1518
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:21286
uint32 GetRuneCooldown(uint8 index) const
Definition Player.h:2194
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:5006
Battleground * GetBattleground() const
Definition Player.cpp:23024
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition Player.cpp:24361
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:7522
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition Player.cpp:13857
void SetChampioningFaction(uint32 faction)
Definition Player.h:2230
void UpdateSpellDamageAndHealingBonus()
RuneType GetCurrentRune(uint8 index) const
Definition Player.h:2193
void UpdateMirrorTimers()
Definition Player.cpp:718
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition Player.cpp:5692
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr) const
Definition Player.cpp:20805
void SendOnCancelExpectedVehicleRideAura() const
Definition Player.cpp:20588
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:4984
uint8 GetActiveTalentGroup() const
Definition Player.h:1480
uint32 GetGlyph(uint8 group, uint8 slot) const
Definition Player.h:1508
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6305
void RemovePetAura(PetAura const *petSpell)
Definition Player.cpp:20405
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3881
bool isHonorOrXPTarget(Unit const *victim) const
Definition Player.cpp:23548
void UpdateInvisibilityDrunkDetect()
Definition Player.cpp:901
void UpdateDefenseBonusesMod()
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:20874
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:9987
void UpdateAttackPowerAndDamage(bool ranged=false) override
ReputationMgr & GetReputationMgr()
Definition Player.h:1834
static WeaponAttackType GetAttackBySlot(uint8 slot)
Definition Player.cpp:9652
void UpdateSpellCritChance(uint32 school)
void AddPetAura(PetAura const *petSpell)
Definition Player.cpp:20398
Unit * GetActionTarget() const
Definition Unit.h:523
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:269
Unit * GetActor()
Definition Unit.h:522
DamageInfo * GetDamageInfo() const
Definition Unit.h:533
void ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
void SendForceReactions()
float CalcRadius(WorldObject *caster=nullptr, Spell *=nullptr) const
float CalcValueMultiplier(WorldObject *caster, Spell *spell=nullptr) const
uint32 TriggerSpell
Definition SpellInfo.h:228
flag96 SpellClassMask
Definition SpellInfo.h:229
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr) const
uint32 ApplyAuraPeriod
Definition SpellInfo.h:212
flag96 SpellFamilyFlags
Definition SpellInfo.h:357
bool IsAffected(uint32 familyName, flag96 const &familyFlags) const
uint64 Stances
Definition SpellInfo.h:302
bool IsPassive() const
uint32 StackAmount
Definition SpellInfo.h:340
uint32 Mechanic
Definition SpellInfo.h:292
uint32 Id
Definition SpellInfo.h:289
uint32 CalcCastTime(Spell *spell=nullptr) const
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell) const
uint32 SchoolMask
Definition SpellInfo.h:361
bool IsAffectedBySpellMod(SpellModifier const *mod) const
uint32 ProcFlags
Definition SpellInfo.h:324
SpellSchoolMask GetSchoolMask() const
uint32 ManaPerSecond
Definition SpellInfo.h:334
void ApplyAllSpellImmunitiesTo(Unit *target, SpellEffectInfo const &spellEffectInfo, bool apply) const
bool IsChanneled() const
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:375
int32 GetDuration() const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:483
uint32 ManaCostPercentage
Definition SpellInfo.h:336
uint32 SpellIconID
Definition SpellInfo.h:349
bool IsPositive() const
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > const & GetEffects() const
Definition SpellInfo.h:482
uint32 SpellFamilyName
Definition SpellInfo.h:356
uint32 ManaCost
Definition SpellInfo.h:332
Definition Spell.h:152
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 AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
void UpdateMyTempModifiers()
Definition Unit.h:783
int32 ModifyHealth(int32 val)
Definition Unit.cpp:8321
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:724
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:9040
void ClearUnitState(uint32 f)
Definition Unit.h:891
bool IsVehicle() const
Definition Unit.h:901
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype) const
Definition Unit.cpp:7498
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8379
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3584
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3788
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1397
float GetHealthPct() const
Definition Unit.h:935
float m_baseSpellCritChance
Definition Unit.h:1513
virtual void RecalculateObjectScale()
Definition Unit.cpp:10375
void HandleAttackPowerModifier(AttackPowerModIndex index, AttackPowerModType modifierType, float amount, bool apply)
Definition Unit.cpp:9091
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4462
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition Unit.cpp:7240
Pet * ToPet()
Definition Unit.h:1804
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition Unit.h:1136
void RemoveAurasByShapeShift()
Definition Unit.cpp:4132
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:9162
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3661
void UpdateObjectVisibility(bool forced=true) override
Definition Unit.cpp:12151
ThreatManager & GetThreatManager()
Definition Unit.h:1169
void RestoreFaction()
Definition Unit.cpp:11747
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
Definition Unit.cpp:4578
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11227
uint8 GetClass() const
Definition Unit.h:909
void SetVisFlag(UnitVisFlags flags)
Definition Unit.h:1020
bool CanUseAttackType(uint8 attacktype) const
Definition Unit.cpp:2405
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition Unit.cpp:4045
uint32 GetClassMask() const
Definition Unit.h:911
bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster) const
Definition Unit.cpp:4570
uint32 GetLastExtraAttackSpell() const
Definition Unit.h:1058
uint32 GetMountDisplayId() const
Definition Unit.h:1028
void UpdateAllDamageDoneMods()
Definition Unit.cpp:9156
void UpdateDisplayPower()
Definition Unit.cpp:5395
static void DealHeal(HealInfo &healInfo)
Definition Unit.cpp:6104
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:794
void UpdateSpeed(UnitMoveType mtype)
Definition Unit.cpp:8463
bool IsPolymorphed() const
Definition Unit.cpp:10354
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1503
void SetFaction(uint32 faction) override
Definition Unit.h:988
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, Optional< float > const &donePctTotal, uint32 stack=1) const
Definition Unit.cpp:7274
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2027
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:1006
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:9020
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:8987
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition Unit.cpp:5287
uint32 GetTransformSpell() const
Definition Unit.h:1604
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition Unit.cpp:1120
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition Unit.cpp:1780
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3116
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition Unit.h:1683
bool SetFeatherFall(bool enable)
Definition Unit.cpp:13436
bool IsPet() const
Definition Unit.h:898
Powers GetPowerType() const
Definition Unit.h:945
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit *victim, uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK, uint8 attackerLevel=0)
Definition Unit.cpp:1596
void Dismount()
Definition Unit.cpp:8174
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13475
uint32 GetMaxHealth() const
Definition Unit.h:928
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4382
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1074
bool IsFullHealth() const
Definition Unit.h:930
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:974
bool IsAlive() const
Definition Unit.h:1247
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:4662
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:10598
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:6360
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:12651
float SpellCritChanceTaken(Unit const *caster, SpellInfo const *spellInfo, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType=BASE_ATTACK, bool isPeriodic=false) const
Definition Unit.cpp:7009
void SetHealth(uint32 val)
Definition Unit.cpp:9338
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition Unit.cpp:5199
void RemoveVehicleKit()
Definition Unit.cpp:11779
bool IsStandState() const
Definition Unit.cpp:10334
bool IsGravityDisabled() const
Definition Unit.h:1231
CharmInfo * GetCharmInfo()
Definition Unit.h:1300
void RemoveVisFlag(UnitVisFlags flags)
Definition Unit.h:1021
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4558
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:6246
void AddUnitState(uint32 f)
Definition Unit.h:889
float GetTotalAuraMultiplier(AuraType auraType) const
Definition Unit.cpp:4820
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:8124
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, Optional< float > const &donePctTotal, uint32 stack=1) const
Definition Unit.cpp:6393
Gender GetGender() const
Definition Unit.h:912
virtual void UpdateDamagePhysical(WeaponAttackType attType)
virtual Gender GetNativeGender() const
Definition Unit.h:914
uint32 GetCreatureType() const
Definition Unit.cpp:8880
void SetInstantCast(bool set)
Definition Unit.h:1816
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition Unit.cpp:13724
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask, AuraEffect const *except=nullptr) const
Definition Unit.cpp:4855
bool SetCanFly(bool enable, bool packetOnly=false)
Definition Unit.cpp:13349
float GetTotalAuraMultiplierByMiscValue(AuraType auraType, int32 misc_value) const
Definition Unit.cpp:4885
uint32 GetDisplayId() const
Definition Unit.h:1598
uint32 GetNativeDisplayId() const
Definition Unit.h:1600
virtual void UpdateArmor()=0
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:4528
static void ProcSkillsAndAuras(Unit *actor, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
Definition Unit.cpp:5218
uint32 GetMaxPower(Powers power) const
Definition Unit.h:950
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={})
Definition Unit.cpp:3044
uint32 GetHealth() const
Definition Unit.h:927
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool force=false)
Definition Unit.cpp:9398
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:975
bool IsVisible() const
Definition Unit.cpp:8448
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4565
uint32 GetArmor() const
Definition Unit.h:919
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:12003
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:12123
void StopAttackFaction(uint32 faction_id)
Definition Unit.cpp:13050
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:11637
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition Unit.cpp:11767
bool IsMounted() const
Definition Unit.h:1027
virtual void SetDisplayId(uint32 modelId)
Definition Unit.cpp:10383
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3807
void SetPowerType(Powers power, bool sendUpdate=true)
Definition Unit.cpp:5350
Unit * GetVictim() const
Definition Unit.h:873
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:7579
DeathState getDeathState() const
Definition Unit.h:1251
ObjectGuid GetChannelObjectGuid() const
Definition Unit.h:1473
float GetTotalAuraMultiplierByMiscMask(AuraType auraType, uint32 misc_mask) const
Definition Unit.cpp:4845
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:10437
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:10618
int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, ObjectGuid const &casterGuid) const
Definition Unit.cpp:12062
void UpdateResistanceBuffModsMod(SpellSchools school)
Definition Unit.cpp:4955
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8082
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:3074
bool IsInFeralForm() const
Definition Unit.cpp:8909
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition Unit.cpp:7197
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition Unit.cpp:3575
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:5231
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:936
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:12547
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10340
void RestoreDisplayId()
Definition Unit.cpp:10391
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:11460
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.cpp:4438
bool SetWaterWalking(bool enable)
Definition Unit.cpp:13397
virtual void setDeathState(DeathState s)
Definition Unit.cpp:8668
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true)
Definition Unit.cpp:10901
uint32 GetPower(Powers power) const
Definition Unit.h:948
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:5633
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:1587
void HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
Definition Unit.cpp:8963
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:968
bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo const *affectedSpell) const
Definition Unit.cpp:4587
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1351
std::list< AuraEffect * > AuraEffectList
Definition Unit.h:801
void SetInFront(WorldObject const *target)
Definition Unit.cpp:13220
Vehicle * GetVehicleKit() const
Definition Unit.h:1751
float m_modSpellHitChance
Definition Unit.h:1512
Guardian * GetGuardianPet() const
Definition Unit.cpp:5836
void UpdateAllDamagePctDoneMods()
Definition Unit.cpp:9200
bool AttackStop()
Definition Unit.cpp:5587
void SetTransformSpell(uint32 spellid)
Definition Unit.h:1603
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:8904
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:714
void SetMountDisplayId(uint32 mountDisplayId)
Definition Unit.h:1029
uint8 GetRace() const
Definition Unit.h:906
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition Unit.cpp:12210
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:969
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype) const
Definition Unit.cpp:6850
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:4992
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1489
Vehicle * RemovePassenger(Unit *passenger)
Removes the passenger from the vehicle.
Definition Vehicle.cpp:497
void RemovePendingEventsForPassenger(Unit *passenger)
Definition Vehicle.cpp:761
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:1784
Map * GetMap() const
Definition Object.h:451
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:443
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:444
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:441
Player * GetSpellModOwner() const
Definition Object.cpp:2224
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1193
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:440
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:447
void PlayDirectSound(uint32 soundId, Player *target=nullptr)
Definition Object.cpp:3432
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
Definition Object.cpp:2572
void PlayDistanceSound(uint32 soundId, Player *target=nullptr)
Definition Object.cpp:3424
uint32 GetZoneId() const
Definition Object.h:375
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:446
int32 CalculateSpellDamage(SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr) const
Definition Object.cpp:2249
void ModSpellDurationTime(SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
Definition Object.cpp:2437
void SendStablePet(ObjectGuid guid)
Definition Util.h:412
@ SMSG_PLAYER_VEHICLE_DATA
Definition Opcodes.h:1220
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
ObjectGuid OriginalCaster
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:192
bool HasCommandState(CommandStates state) const
Definition Unit.h:697
uint32 mitigated_damage
Definition Unit.h:434
float GetPositionZ() const
Definition Position.h:81
SpellModOp op
Definition Player.h:170
SpellModType type
Definition Player.h:171
int32 value
Definition Player.h:173
uint32 spellId
Definition Player.h:175
flag96 mask
Definition Player.h:174
uint32 PresetSpellID[MAX_SHAPESHIFT_SPELLS]