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_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus
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 {
1393 // if not have different invisibility auras.
1394 // always remove glow vision
1395 if (target->GetTypeId() == TYPEID_PLAYER)
1397
1398 target->m_invisibility.DelFlag(type);
1399 }
1400 else
1401 {
1402 bool found = false;
1404 for (Unit::AuraEffectList::const_iterator i = invisAuras.begin(); i != invisAuras.end(); ++i)
1405 {
1406 if (GetMiscValue() == (*i)->GetMiscValue())
1407 {
1408 found = true;
1409 break;
1410 }
1411 }
1412 if (!found)
1413 {
1414 target->m_invisibility.DelFlag(type);
1415
1416 // if not have invisibility auras of type INVISIBILITY_GENERAL or INVISIBILITY_UNK10
1417 // remove glow vision
1420 }
1421 }
1422
1423 target->m_invisibility.AddValue(type, -GetAmount());
1424 }
1425
1426 // call functions which may have additional effects after changing state of unit
1427 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1428 {
1429 // drop flag at invisibiliy in bg
1431 }
1432
1433 if (target->IsInWorld())
1434 target->UpdateObjectVisibility();
1435}
1436
1437void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
1438{
1440 return;
1441
1442 Unit* target = aurApp->GetTarget();
1444
1445 if (apply)
1446 {
1447 target->m_stealthDetect.AddFlag(type);
1448 target->m_stealthDetect.AddValue(type, GetAmount());
1449 }
1450 else
1451 {
1453 target->m_stealthDetect.DelFlag(type);
1454
1455 target->m_stealthDetect.AddValue(type, -GetAmount());
1456 }
1457
1458 // call functions which may have additional effects after changing state of unit
1459 if (target->IsInWorld())
1460 target->UpdateObjectVisibility();
1461}
1462
1463void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
1464{
1466 return;
1467
1468 Unit* target = aurApp->GetTarget();
1470
1471 if (apply)
1472 {
1473 target->m_stealth.AddFlag(type);
1474 target->m_stealth.AddValue(type, GetAmount());
1475
1477 if (target->GetTypeId() == TYPEID_PLAYER)
1479 }
1480 else
1481 {
1482 target->m_stealth.AddValue(type, -GetAmount());
1483
1484 if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) // if last SPELL_AURA_MOD_STEALTH
1485 {
1486 target->m_stealth.DelFlag(type);
1487
1489 if (target->GetTypeId() == TYPEID_PLAYER)
1491 }
1492 }
1493
1494 // call functions which may have additional effects after changing state of unit
1495 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
1496 {
1497 // drop flag at stealth in bg
1499 }
1500
1501 if (target->IsInWorld())
1502 target->UpdateObjectVisibility();
1503}
1504
1505void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const
1506{
1508 return;
1509
1510 Unit* target = aurApp->GetTarget();
1512
1513 if (apply)
1514 target->m_stealth.AddValue(type, GetAmount());
1515 else
1516 target->m_stealth.AddValue(type, -GetAmount());
1517
1518 // call functions which may have additional effects after changing state of unit
1519 if (target->IsInWorld())
1520 target->UpdateObjectVisibility();
1521}
1522
1523void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const
1524{
1526 return;
1527
1528 Unit* target = aurApp->GetTarget();
1529
1530 if (target->GetTypeId() != TYPEID_PLAYER)
1531 return;
1532
1533 if (apply)
1535 else
1536 {
1538 {
1540 for (Unit::AuraEffectList::const_iterator i = amoreAuras.begin(); i != amoreAuras.end(); ++i)
1541 {
1542 if (GetMiscValue() == (*i)->GetMiscValue())
1543 return;
1544 }
1545 }
1546
1548 }
1549}
1550
1551void AuraEffect::HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 mode, bool apply) const
1552{
1553 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1554 return;
1555
1556 Unit* target = aurApp->GetTarget();
1557
1558 if (target->GetTypeId() != TYPEID_PLAYER)
1559 return;
1560
1561 // prepare spirit state
1562 if (apply)
1563 {
1564 if (target->GetTypeId() == TYPEID_PLAYER)
1565 {
1566 // set stand state (expected in this form)
1567 if (!target->IsStandState())
1569 }
1570
1571 target->SetHealth(1);
1572 }
1573 // die at aura end
1574 else if (target->IsAlive())
1575 // call functions which may have additional effects after changing state of unit
1576 target->setDeathState(JUST_DIED);
1577}
1578
1579void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const
1580{
1582 return;
1583
1584 Unit* target = aurApp->GetTarget();
1585 if (target->GetTypeId() != TYPEID_PLAYER)
1586 return;
1587
1588 if (apply)
1589 {
1593 }
1594 else
1595 {
1596 if (target->HasAuraType(SPELL_AURA_GHOST))
1597 return;
1598
1602 }
1603}
1604
1605void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const
1606{
1607 if (!(mode & AURA_EFFECT_HANDLE_REAL))
1608 return;
1609
1610 Unit* target = aurApp->GetTarget();
1611
1612 // no-phase is also phase state so same code for apply and remove
1613 uint32 newPhase = 0;
1615 if (!phases.empty())
1616 for (Unit::AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
1617 newPhase |= (*itr)->GetMiscValue();
1618
1619 if (Player* player = target->ToPlayer())
1620 {
1621 if (!newPhase)
1622 newPhase = PHASEMASK_NORMAL;
1623
1624 // GM-mode have mask 0xFFFFFFFF
1625 if (player->IsGameMaster())
1626 newPhase = 0xFFFFFFFF;
1627
1628 player->SetPhaseMask(newPhase, false);
1629 player->GetSession()->SendSetPhaseShift(newPhase);
1630 }
1631 else
1632 {
1633 if (!newPhase)
1634 {
1635 newPhase = PHASEMASK_NORMAL;
1636 if (Creature* creature = target->ToCreature())
1637 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
1638 newPhase = data->phaseMask;
1639 }
1640
1641 target->SetPhaseMask(newPhase, false);
1642 }
1643
1644 // call functions which may have additional effects after changing state of unit
1645 // phase auras normally not expected at BG but anyway better check
1646 if (apply)
1647 {
1648 // drop flag at invisibiliy in bg
1650 }
1651
1652 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
1653 if (target->IsVisible())
1654 target->UpdateObjectVisibility();
1655}
1656
1657/**********************/
1658/*** UNIT MODEL ***/
1659/**********************/
1660
1661void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mode, bool apply) const
1662{
1664 return;
1665
1666 Unit* target = aurApp->GetTarget();
1667
1668 uint32 modelid = 0;
1671
1672 switch (form)
1673 {
1674 case FORM_CAT: // 0x01
1675 case FORM_GHOUL: // 0x07
1677 break;
1678
1679 case FORM_BEAR: // 0x05
1680 case FORM_DIREBEAR: // 0x08
1681
1682 case FORM_BATTLESTANCE: // 0x11
1683 case FORM_DEFENSIVESTANCE: // 0x12
1684 case FORM_BERSERKERSTANCE: // 0x13
1686 break;
1687
1688 case FORM_TREE: // 0x02
1689 case FORM_TRAVEL: // 0x03
1690 case FORM_AQUA: // 0x04
1691 case FORM_AMBIENT: // 0x06
1692
1693 case FORM_STEVES_GHOUL: // 0x09
1694 case FORM_THARONJA_SKELETON: // 0x0A
1695 case FORM_TEST_OF_STRENGTH: // 0x0B
1696 case FORM_BLB_PLAYER: // 0x0C
1697 case FORM_SHADOW_DANCE: // 0x0D
1698 case FORM_CREATUREBEAR: // 0x0E
1699 case FORM_CREATURECAT: // 0x0F
1700 case FORM_GHOSTWOLF: // 0x10
1701
1702 case FORM_TEST: // 0x14
1703 case FORM_ZOMBIE: // 0x15
1704 case FORM_METAMORPHOSIS: // 0x16
1705 case FORM_UNDEAD: // 0x19
1706 case FORM_MASTER_ANGLER: // 0x1A
1707 case FORM_FLIGHT_EPIC: // 0x1B
1708 case FORM_SHADOW: // 0x1C
1709 case FORM_FLIGHT: // 0x1D
1710 case FORM_STEALTH: // 0x1E
1711 case FORM_MOONKIN: // 0x1F
1712 case FORM_SPIRITOFREDEMPTION: // 0x20
1713 break;
1714 default:
1715 TC_LOG_ERROR("spells.aura.effect", "Auras: Unknown Shapeshift Type: {}", GetMiscValue());
1716 }
1717
1718 modelid = target->GetModelForForm(form, GetId());
1719
1720 if (apply)
1721 {
1722 // remove polymorph before changing display id to keep new display id
1723 switch (form)
1724 {
1725 case FORM_CAT:
1726 case FORM_TREE:
1727 case FORM_TRAVEL:
1728 case FORM_AQUA:
1729 case FORM_BEAR:
1730 case FORM_DIREBEAR:
1731 case FORM_FLIGHT_EPIC:
1732 case FORM_FLIGHT:
1733 case FORM_MOONKIN:
1734 {
1735 // remove movement affects
1736 target->RemoveAurasByShapeShift();
1737
1738 // and polymorphic affects
1739 if (target->IsPolymorphed())
1740 target->RemoveAurasDueToSpell(target->GetTransformSpell());
1741 break;
1742 }
1743 default:
1744 break;
1745 }
1746
1747 // remove other shapeshift before applying a new one
1749
1750 // stop handling the effect if it was removed by linked event
1751 if (aurApp->GetRemoveMode())
1752 return;
1753
1754 if (PowerType != POWER_MANA)
1755 {
1756 uint32 oldPower = target->GetPower(PowerType);
1757 // reset power to default values only at power change
1758 if (target->GetPowerType() != PowerType)
1759 target->SetPowerType(PowerType);
1760
1761 switch (form)
1762 {
1763 case FORM_CAT:
1764 case FORM_BEAR:
1765 case FORM_DIREBEAR:
1766 {
1767 // get furor proc chance
1768 int32 FurorChance = 0;
1769 if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
1770 FurorChance = std::max(dummy->GetAmount(), 0);
1771
1772 switch (GetMiscValue())
1773 {
1774 case FORM_CAT:
1775 {
1776 CastSpellExtraArgs args(this);
1777 args.AddSpellMod(SPELLVALUE_BASE_POINT0, std::min<int32>(oldPower, FurorChance));
1778 target->SetPower(POWER_ENERGY, 0);
1779 target->CastSpell(target, 17099, args);
1780 break;
1781 }
1782 case FORM_BEAR:
1783 case FORM_DIREBEAR:
1784 if (roll_chance_i(FurorChance))
1785 target->CastSpell(target, 17057, true);
1786 break;
1787 default:
1788 {
1789 uint32 newEnergy = std::min<int32>(target->GetPower(POWER_ENERGY), FurorChance);
1790 target->SetPower(POWER_ENERGY, newEnergy);
1791 break;
1792 }
1793 }
1794 break;
1795 }
1796 default:
1797 break;
1798 }
1799 }
1800 // stop handling the effect if it was removed by linked event
1801 if (aurApp->GetRemoveMode())
1802 return;
1803
1804 ShapeshiftForm prevForm = target->GetShapeshiftForm();
1805 target->SetShapeshiftForm(form);
1806 // add the shapeshift aura's boosts
1807 if (prevForm != form)
1808 HandleShapeshiftBoosts(target, true);
1809
1810 if (modelid > 0)
1811 {
1812 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell());
1813 if (!transformSpellInfo || !GetSpellInfo()->IsPositive())
1814 target->SetDisplayId(modelid);
1815 }
1816 }
1817 else
1818 {
1819 // reset model id if no other auras present
1820 // may happen when aura is applied on linked event on aura removal
1822 {
1824 if (target->GetClass() == CLASS_DRUID)
1825 {
1826 // Remove movement impairing effects also when shifting out
1827 target->RemoveAurasByShapeShift();
1828 }
1829 }
1830
1831 if (modelid > 0)
1832 target->RestoreDisplayId();
1833
1834 switch (form)
1835 {
1836 // Nordrassil Harness - bonus
1837 case FORM_BEAR:
1838 case FORM_DIREBEAR:
1839 case FORM_CAT:
1840 if (AuraEffect* dummy = target->GetAuraEffect(37315, 0))
1841 target->CastSpell(target, 37316, dummy);
1842 break;
1843 // Nordrassil Regalia - bonus
1844 case FORM_MOONKIN:
1845 if (AuraEffect* dummy = target->GetAuraEffect(37324, 0))
1846 target->CastSpell(target, 37325, dummy);
1847 break;
1848 case FORM_BATTLESTANCE:
1851 {
1852 uint32 Rage_val = 0;
1853 // Defensive Tactics
1854 if (form == FORM_DEFENSIVESTANCE)
1855 {
1856 if (AuraEffect const* aurEff = target->IsScriptOverriden(m_spellInfo, 831))
1857 Rage_val += aurEff->GetAmount() * 10;
1858 }
1859 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
1860 if (target->GetTypeId() == TYPEID_PLAYER)
1861 {
1862 PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
1863 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
1864 {
1865 if (itr->second.state == PLAYERSPELL_REMOVED || itr->second.disabled)
1866 continue;
1867
1868 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
1869 if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
1870 Rage_val += target->CalculateSpellDamage(spellInfo->GetEffect(EFFECT_0)) * 10;
1871 }
1872 }
1873 if (target->GetPower(POWER_RAGE) > Rage_val)
1874 target->SetPower(POWER_RAGE, Rage_val);
1875 break;
1876 }
1877 default:
1878 break;
1879 }
1880
1881 // remove the shapeshift aura's boosts
1882 HandleShapeshiftBoosts(target, false);
1883 }
1884
1885 if (target->GetTypeId() == TYPEID_PLAYER)
1886 target->ToPlayer()->InitDataForForm();
1887 else
1888 target->UpdateDisplayPower();
1889
1890 if (target->GetClass() == CLASS_DRUID)
1891 {
1892 // Dash
1894 aurEff->RecalculateAmount();
1895
1896 // Disarm handling
1897 // If druid shifts while being disarmed we need to deal with that since forms aren't affected by disarm
1898 // and also HandleAuraModDisarm is not triggered
1899 if (!target->CanUseAttackType(BASE_ATTACK))
1900 {
1902 target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), apply);
1903 }
1904 }
1905
1906 // stop handling the effect if it was removed by linked event
1907 if (apply && aurApp->GetRemoveMode())
1908 return;
1909
1910 if (target->GetTypeId() == TYPEID_PLAYER)
1911 {
1912 SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1913 ASSERT(shapeInfo);
1914 // Learn spells for shapeshift form - no need to send action bars or add spells to spellbook
1915 for (uint8 i = 0; i < MAX_SHAPESHIFT_SPELLS; ++i)
1916 {
1917 if (!shapeInfo->PresetSpellID[i])
1918 continue;
1919 if (apply)
1920 target->ToPlayer()->AddTemporarySpell(shapeInfo->PresetSpellID[i]);
1921 else
1922 target->ToPlayer()->RemoveTemporarySpell(shapeInfo->PresetSpellID[i]);
1923 }
1924 }
1925}
1926
1927void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const
1928{
1930 return;
1931
1932 Unit* target = aurApp->GetTarget();
1933
1934 if (apply)
1935 {
1936 // update active transform spell only when transform not set or not overwriting negative by positive case
1937 SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(target->GetTransformSpell());
1938 if (!transformSpellInfo || !GetSpellInfo()->IsPositive() || transformSpellInfo->IsPositive())
1939 {
1940 target->SetTransformSpell(GetId());
1941 // special case (spell specific functionality)
1942 if (GetMiscValue() == 0)
1943 {
1944 uint8 gender = target->GetNativeGender();
1945 switch (GetId())
1946 {
1947 // Orb of Deception
1948 case 16739:
1949 {
1950 if (target->GetTypeId() != TYPEID_PLAYER)
1951 return;
1952
1953 switch (target->GetRace())
1954 {
1955 // Blood Elf
1956 case RACE_BLOODELF:
1957 target->SetDisplayId(gender == GENDER_FEMALE ? 17830 : 17829);
1958 break;
1959 // Orc
1960 case RACE_ORC:
1961 target->SetDisplayId(gender == GENDER_FEMALE ? 10140 : 10139);
1962 break;
1963 // Troll
1964 case RACE_TROLL:
1965 target->SetDisplayId(gender == GENDER_FEMALE ? 10134 : 10135);
1966 break;
1967 // Tauren
1968 case RACE_TAUREN:
1969 target->SetDisplayId(gender == GENDER_FEMALE ? 10147 : 10136);
1970 break;
1971 // Undead
1972 case RACE_UNDEAD_PLAYER:
1973 target->SetDisplayId(gender == GENDER_FEMALE ? 10145 : 10146);
1974 break;
1975 // Draenei
1976 case RACE_DRAENEI:
1977 target->SetDisplayId(gender == GENDER_FEMALE ? 17828 : 17827);
1978 break;
1979 // Dwarf
1980 case RACE_DWARF:
1981 target->SetDisplayId(gender == GENDER_FEMALE ? 10142 : 10141);
1982 break;
1983 // Gnome
1984 case RACE_GNOME:
1985 target->SetDisplayId(gender == GENDER_FEMALE ? 10149 : 10148);
1986 break;
1987 // Human
1988 case RACE_HUMAN:
1989 target->SetDisplayId(gender == GENDER_FEMALE ? 10138 : 10137);
1990 break;
1991 // Night Elf
1992 case RACE_NIGHTELF:
1993 target->SetDisplayId(gender == GENDER_FEMALE ? 10144 : 10143);
1994 break;
1995 default:
1996 break;
1997 }
1998 break;
1999 }
2000 // Murloc costume
2001 case 42365:
2002 target->SetDisplayId(21723);
2003 break;
2004 // Dread Corsair
2005 case 50517:
2006 // Corsair Costume
2007 case 51926:
2008 {
2009 if (target->GetTypeId() != TYPEID_PLAYER)
2010 return;
2011
2012 switch (target->GetRace())
2013 {
2014 // Blood Elf
2015 case RACE_BLOODELF:
2016 target->SetDisplayId(gender == GENDER_MALE ? 25032 : 25043);
2017 break;
2018 // Orc
2019 case RACE_ORC:
2020 target->SetDisplayId(gender == GENDER_MALE ? 25039 : 25050);
2021 break;
2022 // Troll
2023 case RACE_TROLL:
2024 target->SetDisplayId(gender == GENDER_MALE ? 25041 : 25052);
2025 break;
2026 // Tauren
2027 case RACE_TAUREN:
2028 target->SetDisplayId(gender == GENDER_MALE ? 25040 : 25051);
2029 break;
2030 // Undead
2031 case RACE_UNDEAD_PLAYER:
2032 target->SetDisplayId(gender == GENDER_MALE ? 25042 : 25053);
2033 break;
2034 // Draenei
2035 case RACE_DRAENEI:
2036 target->SetDisplayId(gender == GENDER_MALE ? 25033 : 25044);
2037 break;
2038 // Dwarf
2039 case RACE_DWARF:
2040 target->SetDisplayId(gender == GENDER_MALE ? 25034 : 25045);
2041 break;
2042 // Gnome
2043 case RACE_GNOME:
2044 target->SetDisplayId(gender == GENDER_MALE ? 25035 : 25046);
2045 break;
2046 // Human
2047 case RACE_HUMAN:
2048 target->SetDisplayId(gender == GENDER_MALE ? 25037 : 25048);
2049 break;
2050 // Night Elf
2051 case RACE_NIGHTELF:
2052 target->SetDisplayId(gender == GENDER_MALE ? 25038 : 25049);
2053 break;
2054 default:
2055 break;
2056 }
2057 break;
2058 }
2059 // Pygmy Oil
2060 case 53806:
2061 target->SetDisplayId(22512);
2062 break;
2063 // Honor the Dead
2064 case 65386:
2065 case 65495:
2066 target->SetDisplayId(gender == GENDER_MALE ? 29203 : 29204);
2067 break;
2068 // Darkspear Pride
2069 case 75532:
2070 target->SetDisplayId(gender == GENDER_MALE ? 31737 : 31738);
2071 break;
2072 // Gnomeregan Pride
2073 case 75531:
2074 target->SetDisplayId(gender == GENDER_MALE ? 31654 : 31655);
2075 break;
2076 default:
2077 break;
2078 }
2079 }
2080 else
2081 {
2082 CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
2083 if (!ci)
2084 {
2085 target->SetDisplayId(16358); // pig pink ^_^
2086 TC_LOG_ERROR("spells.aura.effect", "Auras: unknown creature id = {} (only need its modelid) From Spell Aura Transform in Spell ID = {}", GetMiscValue(), GetId());
2087 }
2088 else
2089 {
2090 uint32 model_id = 0;
2091
2092 // choose a model, based on trigger flag
2093 if (uint32 modelid = ObjectMgr::ChooseDisplayId(ci))
2094 model_id = modelid;
2095
2096 // Polymorph (sheep)
2097 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
2098 if (Unit* caster = GetCaster())
2099 if (caster->HasAura(52648)) // Glyph of the Penguin
2100 model_id = 26452;
2101
2102 target->SetDisplayId(model_id);
2103
2104 // Dragonmaw Illusion (set mount model also)
2105 if (GetId() == 42016 && target->GetMountDisplayId() && !target->GetAuraEffectsByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
2106 target->SetMountDisplayId(16314);
2107 }
2108 }
2109 }
2110
2111 // polymorph case
2112 if ((mode & AURA_EFFECT_HANDLE_REAL) && target->GetTypeId() == TYPEID_PLAYER && target->IsPolymorphed())
2113 {
2114 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2115 // only if caster is Player (after patch 2.4.2)
2116 if (GetCasterGUID().IsPlayer())
2118
2119 //dismount polymorphed target (after patch 2.4.2)
2120 if (target->IsMounted())
2122 }
2123 }
2124 else
2125 {
2126 // HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true) will reapply it if need
2127 if (target->GetTransformSpell() == GetId())
2128 target->SetTransformSpell(0);
2129
2130 target->RestoreDisplayId();
2131
2132 // Dragonmaw Illusion (restore mount model)
2133 if (GetId() == 42016 && target->GetMountDisplayId() == 16314)
2134 {
2135 if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
2136 {
2137 uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
2138 if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
2139 {
2140 uint32 displayID = ObjectMgr::ChooseDisplayId(ci);
2141 sObjectMgr->GetCreatureModelRandomGender(&displayID);
2142
2143 target->SetMountDisplayId(displayID);
2144 }
2145 }
2146 }
2147 }
2148}
2149
2150void AuraEffect::HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2151{
2153 return;
2154
2155 aurApp->GetTarget()->RecalculateObjectScale();
2156}
2157
2158void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode, bool apply) const
2159{
2161 return;
2162
2163 Unit* target = aurApp->GetTarget();
2164
2165 if (apply)
2166 {
2167 Unit* caster = GetCaster();
2168 if (!caster || caster == target)
2169 return;
2170
2171 // What must be cloned? at least display and scale
2172 target->SetDisplayId(caster->GetDisplayId());
2173 //target->SetObjectScale(caster->GetObjectScale()); // we need retail info about how scaling is handled (aura maybe?)
2175 }
2176 else
2177 {
2178 target->SetDisplayId(target->GetNativeDisplayId());
2180 }
2181}
2182
2183/************************/
2184/*** FIGHT ***/
2185/************************/
2186
2187void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, bool apply) const
2188{
2189 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2190 return;
2191
2192 Unit* target = aurApp->GetTarget();
2193
2194 if (apply)
2195 {
2196 /*
2197 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2198 data << target->GetGUID();
2199 data << uint8(0);
2200 target->SendMessageToSet(&data, true);
2201 */
2202
2203 UnitList targets;
2204 Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetMap()->GetVisibilityRange());
2206 Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
2207 for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
2208 {
2209 if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
2210 continue;
2211
2213 {
2214 if ((*iter)->GetCurrentSpell(i)
2215 && (*iter)->GetCurrentSpell(i)->m_targets.GetUnitTargetGUID() == target->GetGUID())
2216 {
2217 (*iter)->InterruptSpell(CurrentSpellTypes(i), false);
2218 }
2219 }
2220 }
2221
2222 for (auto& pair : target->GetThreatManager().GetThreatenedByMeList())
2223 pair.second->ScaleThreat(0.0f);
2224
2225 if (target->GetMap()->IsDungeon()) // feign death does not remove combat in dungeons
2226 {
2227 target->AttackStop();
2228 if (Player* targetPlayer = target->ToPlayer())
2229 targetPlayer->SendAttackSwingCancelAttack();
2230 }
2231 else
2232 target->CombatStop(false, false);
2233
2235
2236 // prevent interrupt message
2237 if (GetCasterGUID() == target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL))
2238 target->FinishSpell(CURRENT_GENERIC_SPELL, false);
2239 target->InterruptNonMeleeSpells(true);
2240
2241 // stop handling the effect if it was removed by linked event
2242 if (aurApp->GetRemoveMode())
2243 return;
2244
2245 target->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); // blizz like 2.0.x
2246 target->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x
2247 target->SetDynamicFlag(UNIT_DYNFLAG_DEAD); // blizz like 2.0.x
2249
2250 if (Creature* creature = target->ToCreature())
2251 creature->SetReactState(REACT_PASSIVE);
2252 }
2253 else
2254 {
2255 /*
2256 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
2257 data << target->GetGUID();
2258 data << uint8(1);
2259 target->SendMessageToSet(&data, true);
2260 */
2261
2262 target->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); // blizz like 2.0.x
2263 target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x
2264 target->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD); // blizz like 2.0.x
2266
2267 if (Creature* creature = target->ToCreature())
2268 creature->InitializeReactState();
2269 }
2270}
2271
2272void AuraEffect::HandleModUnattackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
2273{
2275 return;
2276
2277 Unit* target = aurApp->GetTarget();
2278
2279 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2280 if (!apply && target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
2281 return;
2282
2283 if (apply)
2285 else
2287
2288 // call functions which may have additional effects after changing state of unit
2289 if (apply && (mode & AURA_EFFECT_HANDLE_REAL))
2290 {
2291 if (target->GetMap()->IsDungeon())
2292 {
2293 target->AttackStop();
2294 if (Player* targetPlayer = target->ToPlayer())
2295 targetPlayer->SendAttackSwingCancelAttack();
2296 }
2297 else
2298 target->CombatStop();
2300 }
2301}
2302
2303void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, bool apply) const
2304{
2305 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2306 return;
2307
2308 Unit* target = aurApp->GetTarget();
2309
2310 // Prevent handling aura twice
2311 AuraType type = GetAuraType();
2312 if (apply ? target->GetAuraEffectsByType(type).size() > 1 : target->HasAuraType(type))
2313 return;
2314
2315 void(*flagChangeFunc)(Unit* u) = nullptr;
2316
2317 uint32 slot;
2318 WeaponAttackType attType;
2319 switch (type)
2320 {
2322 if (apply)
2323 flagChangeFunc = [](Unit* u) { u->SetUnitFlag(UNIT_FLAG_DISARMED); };
2324 else
2325 flagChangeFunc = [](Unit* u) { u->RemoveUnitFlag(UNIT_FLAG_DISARMED); };
2327 attType = BASE_ATTACK;
2328 break;
2330 if (apply)
2331 flagChangeFunc = [](Unit* u) { u->SetUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); };
2332 else
2333 flagChangeFunc = [](Unit* u) { u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND); };
2335 attType = OFF_ATTACK;
2336 break;
2338 if (apply)
2339 flagChangeFunc = [](Unit* u) { u->SetUnitFlag2(UNIT_FLAG2_DISARM_RANGED); };
2340 else
2341 flagChangeFunc = [](Unit* u) { u->RemoveUnitFlag2(UNIT_FLAG2_DISARM_RANGED); };
2343 attType = RANGED_ATTACK;
2344 break;
2345 default:
2346 return;
2347 }
2348
2349 // set/remove flag before weapon bonuses so it's properly reflected in CanUseAttackType
2350 if (flagChangeFunc)
2351 flagChangeFunc(target);
2352
2353 // Handle damage modification, shapeshifted druids are not affected
2354 if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
2355 {
2356 Player* player = target->ToPlayer();
2357 if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
2358 {
2359 WeaponAttackType const attackType = Player::GetAttackBySlot(slot);
2360
2361 player->ApplyItemDependentAuras(item, !apply);
2362 if (attackType != MAX_ATTACK)
2363 {
2364 player->_ApplyWeaponDamage(slot, item->GetTemplate(), !apply);
2365 if (!apply) // apply case already handled on item dependent aura removal (if any)
2366 player->UpdateWeaponDependentAuras(attackType);
2367 }
2368 }
2369 }
2370
2371 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
2372 target->UpdateDamagePhysical(attType);
2373}
2374
2375void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const
2376{
2377 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2378 return;
2379
2380 Unit* target = aurApp->GetTarget();
2381
2382 if (apply)
2383 {
2385
2386 // call functions which may have additional effects after changing state of unit
2387 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
2388 for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
2389 if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i)))
2390 if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
2391 // Stop spells on prepare or casting state
2392 target->InterruptSpell(CurrentSpellTypes(i), false);
2393 }
2394 else
2395 {
2396 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2398 return;
2399
2401 }
2402}
2403
2404void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const
2405{
2407 return;
2408
2409 Unit* target = aurApp->GetTarget();
2410
2411 if (apply)
2413 else
2414 {
2415 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2417 return;
2419 }
2420}
2421
2422void AuraEffect::HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const
2423{
2425 return;
2426
2427 Unit* target = aurApp->GetTarget();
2428
2429 // Vengeance of the Blue Flight (@todo REMOVE THIS!)
2431 if (m_spellInfo->Id == 45839)
2432 {
2433 if (apply)
2435 else
2437 }
2438 if (!(apply))
2439 {
2440 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2442 return;
2443 }
2444 HandleAuraModPacify(aurApp, mode, apply);
2445 HandleAuraModSilence(aurApp, mode, apply);
2446}
2447
2448void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8 mode, bool apply) const
2449{
2451 return;
2452
2453 Unit* target = aurApp->GetTarget();
2454
2455 if (target->GetTypeId() == TYPEID_PLAYER)
2456 {
2457 if (apply)
2459 else
2460 {
2461 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2463 return;
2465 }
2466 }
2467}
2468
2469/****************************/
2470/*** TRACKING ***/
2471/****************************/
2472
2473void AuraEffect::HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 mode, bool apply) const
2474{
2476 return;
2477
2478 Unit* target = aurApp->GetTarget();
2479
2480 if (target->GetTypeId() != TYPEID_PLAYER)
2481 return;
2482
2483 if (apply)
2484 target->SetFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2485 else
2486 target->RemoveFlag(PLAYER_TRACK_CREATURES, uint32(1) << (GetMiscValue() - 1));
2487}
2488
2489void AuraEffect::HandleAuraTrackResources(AuraApplication const* aurApp, uint8 mode, bool apply) const
2490{
2492 return;
2493
2494 Unit* target = aurApp->GetTarget();
2495
2496 if (target->GetTypeId() != TYPEID_PLAYER)
2497 return;
2498
2499 if (apply)
2500 target->SetFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2501 else
2502 target->RemoveFlag(PLAYER_TRACK_RESOURCES, uint32(1) << (GetMiscValue() - 1));
2503}
2504
2505void AuraEffect::HandleAuraTrackStealthed(AuraApplication const* aurApp, uint8 mode, bool apply) const
2506{
2508 return;
2509
2510 Unit* target = aurApp->GetTarget();
2511
2512 if (target->GetTypeId() != TYPEID_PLAYER)
2513 return;
2514
2515 if (!(apply))
2516 {
2517 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2518 if (target->HasAuraType(GetAuraType()))
2519 return;
2520 }
2522}
2523
2524void AuraEffect::HandleAuraModStalked(AuraApplication const* aurApp, uint8 mode, bool apply) const
2525{
2527 return;
2528
2529 Unit* target = aurApp->GetTarget();
2530
2531 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
2532 if (apply)
2534 else
2535 {
2536 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2537 if (!target->HasAuraType(GetAuraType()))
2539 }
2540
2541 // call functions which may have additional effects after changing state of unit
2542 if (target->IsInWorld())
2543 target->UpdateObjectVisibility();
2544}
2545
2546void AuraEffect::HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const
2547{
2549 return;
2550
2551 Unit* target = aurApp->GetTarget();
2552
2553 if (apply)
2555 else
2556 {
2557 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2558 if (target->HasAuraType(GetAuraType()))
2559 return;
2561 }
2562}
2563
2564/****************************/
2565/*** SKILLS & TALENTS ***/
2566/****************************/
2567
2568void AuraEffect::HandleAuraModPetTalentsPoints(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2569{
2571 return;
2572
2573 Unit* target = aurApp->GetTarget();
2574
2575 if (target->GetTypeId() != TYPEID_PLAYER)
2576 return;
2577
2578 // Recalculate pet talent points
2579 if (Pet* pet = target->ToPlayer()->GetPet())
2580 pet->InitTalentForLevel();
2581}
2582
2583void AuraEffect::HandleAuraModSkill(AuraApplication const* aurApp, uint8 mode, bool apply) const
2584{
2586 return;
2587
2588 Player* target = aurApp->GetTarget()->ToPlayer();
2589 if (!target)
2590 return;
2591
2592 uint32 prot = GetMiscValue();
2593 int32 points = GetAmount();
2594
2595 target->ModifySkillBonus(prot, ((apply) ? points: -points), GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
2596 if (prot == SKILL_DEFENSE)
2597 target->UpdateDefenseBonusesMod();
2598}
2599
2600/****************************/
2601/*** MOVEMENT ***/
2602/****************************/
2603
2604void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bool apply) const
2605{
2607 return;
2608
2609 Unit* target = aurApp->GetTarget();
2610
2611 if (apply)
2612 {
2613 uint32 creatureEntry = GetMiscValue();
2614 uint32 displayId = 0;
2615 uint32 vehicleId = 0;
2616
2617 // Festive Holiday Mount
2618 if (target->HasAura(62061))
2619 {
2621 creatureEntry = 24906;
2622 else
2623 creatureEntry = 15665;
2624 }
2625
2626 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
2627 {
2628 if (GetMiscValueB() > 0) // Choose proper modelid
2629 displayId = GetMiscValueB() == 2 && creatureInfo->Modelid2 > 0 ? creatureInfo->Modelid2 : creatureInfo->Modelid1;
2630 else // Should we choose random modelid in this case?
2631 displayId = ObjectMgr::ChooseDisplayId(creatureInfo);
2632 sObjectMgr->GetCreatureModelRandomGender(&displayId);
2633
2634 vehicleId = creatureInfo->VehicleId;
2635
2636 //some spell has one aura of mount and one of vehicle
2637 for (SpellEffectInfo const& effect : GetSpellInfo()->GetEffects())
2638 if (effect.IsEffect(SPELL_EFFECT_SUMMON) && effect.MiscValue == GetMiscValue())
2639 displayId = 0;
2640 }
2641
2642 target->Mount(displayId, vehicleId, creatureEntry);
2643 }
2644 else
2645 {
2646 target->Dismount();
2647 //some mounts like Headless Horseman's Mount or broom stick are skill based spell
2648 // need to remove ALL arura related to mounts, this will stop client crash with broom stick
2649 // and never endless flying after using Headless Horseman's Mount
2650 if (mode & AURA_EFFECT_HANDLE_REAL)
2652 }
2653}
2654
2655void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode, bool apply) const
2656{
2658 return;
2659
2660 Unit* target = aurApp->GetTarget();
2661
2662 if (!apply)
2663 {
2664 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2666 return;
2667 }
2668
2669 if (target->SetCanFly(apply))
2670 {
2671 if (!apply && !target->IsGravityDisabled() && !target->CanFly())
2672 target->GetMotionMaster()->MoveFall();
2673 }
2674}
2675
2676void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
2677{
2679 return;
2680
2681 Unit* target = aurApp->GetTarget();
2682
2683 if (!apply)
2684 {
2685 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2686 if (target->HasAuraType(GetAuraType()))
2687 return;
2688 }
2689
2690 target->SetWaterWalking(apply);
2691}
2692
2693void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode, bool apply) const
2694{
2696 return;
2697
2698 Unit* target = aurApp->GetTarget();
2699
2700 if (!apply)
2701 {
2702 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2703 if (target->HasAuraType(GetAuraType()))
2704 return;
2705 }
2706
2707 target->SetFeatherFall(apply);
2708
2709 // start fall from current height
2710 if (!apply && target->GetTypeId() == TYPEID_PLAYER)
2711 target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
2712}
2713
2714void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const
2715{
2717 return;
2718
2719 Unit* target = aurApp->GetTarget();
2720
2721 if (!apply)
2722 {
2723 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2724 if (target->HasAuraType(GetAuraType()))
2725 return;
2726 }
2727
2728 target->SetHover(apply);
2729}
2730
2731void AuraEffect::HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2732{
2734 return;
2735
2736 Unit* target = aurApp->GetTarget();
2737
2738 // update timers in client
2739 if (target->GetTypeId() == TYPEID_PLAYER)
2740 target->ToPlayer()->UpdateMirrorTimers();
2741}
2742
2743void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mode, bool apply) const
2744{
2746 return;
2747
2748 Unit* target = aurApp->GetTarget();
2749
2750 if (apply)
2752 else
2753 {
2754 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
2755 if (target->HasAuraType(GetAuraType()))
2756 return;
2758 }
2759}
2760
2761/****************************/
2762/*** THREAT ***/
2763/****************************/
2764
2765void AuraEffect::HandleModThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2766{
2768 return;
2769
2771}
2772
2773void AuraEffect::HandleAuraModTotalThreat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2774{
2776 return;
2777
2778 Unit* target = aurApp->GetTarget();
2779
2780 if (!target->IsAlive() || target->GetTypeId() != TYPEID_PLAYER)
2781 return;
2782
2783 Unit* caster = GetCaster();
2784 if (caster && caster->IsAlive())
2786}
2787
2788void AuraEffect::HandleModTaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2789{
2790 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2791 return;
2792
2793 Unit* target = aurApp->GetTarget();
2794
2795 if (!target->IsAlive() || !target->CanHaveThreatList())
2796 return;
2797
2798 target->GetThreatManager().TauntUpdate();
2799}
2800
2801void AuraEffect::HandleModDetaunt(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
2802{
2803 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2804 return;
2805
2806 Unit* caster = GetCaster();
2807 Unit* target = aurApp->GetTarget();
2808
2809 if (!caster || !caster->IsAlive() || !target->IsAlive() || !caster->CanHaveThreatList())
2810 return;
2811
2812 caster->GetThreatManager().TauntUpdate();
2813}
2814
2815/*****************************/
2816/*** CONTROL ***/
2817/*****************************/
2818
2819void AuraEffect::HandleModConfuse(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_CONFUSED);
2827 if (apply)
2829}
2830
2831void AuraEffect::HandleModFear(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_FLEEING);
2839}
2840
2841void AuraEffect::HandleAuraModStun(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 target->SetControlled(apply, UNIT_STATE_STUNNED);
2849 if (apply)
2851}
2852
2853void AuraEffect::HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bool apply) const
2854{
2855 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2856 return;
2857
2858 Unit* target = aurApp->GetTarget();
2859
2860 target->SetControlled(apply, UNIT_STATE_ROOT);
2861}
2862
2863void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const
2864{
2865 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2866 return;
2867
2868 Unit* target = aurApp->GetTarget();
2869
2870 // Since patch 3.0.2 this mechanic no longer affects fear effects. It will ONLY prevent humanoids from fleeing due to low health.
2871 if (!apply || target->HasAuraType(SPELL_AURA_MOD_FEAR))
2872 return;
2875 target->SetControlled(false, UNIT_STATE_FLEEING);
2876}
2877
2878/***************************/
2879/*** CHARM ***/
2880/***************************/
2881
2882void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const
2883{
2884 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2885 return;
2886
2887 Unit* target = aurApp->GetTarget();
2888
2889 Unit* caster = GetCaster();
2890
2891 // no support for posession AI yet
2892 if (caster && caster->GetTypeId() == TYPEID_UNIT)
2893 {
2894 HandleModCharm(aurApp, mode, apply);
2895 return;
2896 }
2897
2898 if (apply)
2899 target->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
2900 else
2901 target->RemoveCharmedBy(caster);
2902}
2903
2904void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const
2905{
2906 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2907 return;
2908
2909 Unit* caster = GetCaster();
2910 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
2911 return;
2912
2913 // seems it may happen that when removing it is no longer owner's pet
2914 //if (caster->ToPlayer()->GetPet() != target)
2915 // return;
2916
2917 Unit* target = aurApp->GetTarget();
2918 if (target->GetTypeId() != TYPEID_UNIT || !target->IsPet())
2919 return;
2920
2921 Pet* pet = target->ToPet();
2922 if (apply)
2923 {
2924 if (caster->ToPlayer()->GetPet() != pet)
2925 return;
2926
2927 pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
2928 }
2929 else
2930 {
2931 pet->RemoveCharmedBy(caster);
2932
2933 if (!pet->IsWithinDistInMap(caster, pet->GetMap()->GetVisibilityRange()))
2934 pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
2935 else
2936 {
2937 // Reinitialize the pet bar or it will appear greyed out
2938 caster->ToPlayer()->PetSpellInitialize();
2939
2940 // TODO: remove this
2941 if (!pet->GetVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
2943 }
2944 }
2945}
2946
2947void AuraEffect::HandleModCharm(AuraApplication const* aurApp, uint8 mode, bool apply) const
2948{
2949 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2950 return;
2951
2952 Unit* target = aurApp->GetTarget();
2953
2954 Unit* caster = GetCaster();
2955
2956 if (apply)
2957 target->SetCharmedBy(caster, CHARM_TYPE_CHARM, aurApp);
2958 else
2959 target->RemoveCharmedBy(caster);
2960}
2961
2962void AuraEffect::HandleCharmConvert(AuraApplication const* aurApp, uint8 mode, bool apply) const
2963{
2964 if (!(mode & AURA_EFFECT_HANDLE_REAL))
2965 return;
2966
2967 Unit* target = aurApp->GetTarget();
2968
2969 Unit* caster = GetCaster();
2970
2971 if (apply)
2972 target->SetCharmedBy(caster, CHARM_TYPE_CONVERT, aurApp);
2973 else
2974 target->RemoveCharmedBy(caster);
2975}
2976
2981void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const
2982{
2984 return;
2985
2986 Unit* target = aurApp->GetTarget();
2987 if (!target->IsVehicle())
2988 return;
2989
2990 Unit* caster = GetCaster();
2991 if (!caster || caster == target)
2992 return;
2993
2994 if (apply)
2995 {
2996 // Currently spells that have base points 0 and DieSides 0 = "0/0" exception are pushed to -1,
2997 // however the idea of 0/0 is to ingore flag VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT and -1 checks for it,
2998 // so this break such spells or most of them.
2999 // Current formula about m_amount: effect base points + dieside - 1
3000 // TO DO: Reasearch more about 0/0 and fix it.
3001 caster->_EnterVehicle(target->GetVehicleKit(), GetAmount() - 1, aurApp);
3002 }
3003 else
3004 {
3005 // Remove pending passengers before exiting vehicle - might cause an Uninstall
3007
3008 if (GetId() == 53111) // Devour Humanoid
3009 {
3010 Unit::Kill(target, caster);
3011 if (caster->GetTypeId() == TYPEID_UNIT)
3012 caster->ToCreature()->DespawnOrUnsummon();
3013 }
3014
3015 bool seatChange = (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT) // Seat change on the same direct vehicle
3016 || target->HasAuraTypeWithCaster(SPELL_AURA_CONTROL_VEHICLE, caster->GetGUID()); // Seat change to a proxy vehicle (for example turret mounted on a siege engine)
3017
3018 if (!seatChange)
3019 caster->_ExitVehicle();
3020 else
3021 target->GetVehicleKit()->RemovePassenger(caster); // Only remove passenger from vehicle without launching exit movement or despawning the vehicle
3022
3023 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
3024 caster->RemoveAurasDueToSpell(GetId());
3025 }
3026}
3027
3028/*********************************************************/
3029/*** MODIFY SPEED ***/
3030/*********************************************************/
3031void AuraEffect::HandleAuraModIncreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3032{
3034 return;
3035
3036 Unit* target = aurApp->GetTarget();
3037
3038 target->UpdateSpeed(MOVE_RUN);
3039}
3040
3042{
3043 HandleAuraModIncreaseSpeed(aurApp, mode, apply);
3044}
3045
3046void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
3047{
3049 return;
3050
3051 Unit* target = aurApp->GetTarget();
3053 target->UpdateSpeed(MOVE_FLIGHT);
3054
3057 {
3058 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
3060 {
3061 if (target->SetCanFly(apply))
3062 if (!apply && !target->IsGravityDisabled() && !target->CanFly())
3063 target->GetMotionMaster()->MoveFall();
3064 }
3065
3067 if (mode & AURA_EFFECT_HANDLE_REAL)
3068 {
3069 //Players on flying mounts must be immune to polymorph
3070 if (target->GetTypeId() == TYPEID_PLAYER)
3072
3073 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3074 if (apply && target->HasAuraEffect(42016, 0) && target->GetMountDisplayId())
3075 target->SetMountDisplayId(16314);
3076 }
3077 }
3078}
3079
3080void AuraEffect::HandleAuraModIncreaseSwimSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3081{
3083 return;
3084
3085 Unit* target = aurApp->GetTarget();
3086
3087 target->UpdateSpeed(MOVE_SWIM);
3088}
3089
3090void AuraEffect::HandleAuraModDecreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3091{
3093 return;
3094
3095 Unit* target = aurApp->GetTarget();
3096
3097 target->UpdateSpeed(MOVE_RUN);
3098 target->UpdateSpeed(MOVE_SWIM);
3099 target->UpdateSpeed(MOVE_FLIGHT);
3100 target->UpdateSpeed(MOVE_RUN_BACK);
3101 target->UpdateSpeed(MOVE_SWIM_BACK);
3103}
3104
3105void AuraEffect::HandleAuraModUseNormalSpeed(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3106{
3107 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3108 return;
3109
3110 Unit* target = aurApp->GetTarget();
3111
3112 target->UpdateSpeed(MOVE_RUN);
3113 target->UpdateSpeed(MOVE_SWIM);
3114 target->UpdateSpeed(MOVE_FLIGHT);
3115}
3116
3117/*********************************************************/
3118/*** IMMUNITY ***/
3119/*********************************************************/
3120
3121void AuraEffect::HandleModMechanicImmunityMask(AuraApplication const* aurApp, uint8 mode, bool apply) const
3122{
3123 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3124 return;
3125
3126 Unit* target = aurApp->GetTarget();
3128}
3129
3130void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3131{
3132 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3133 return;
3134
3135 Unit* target = aurApp->GetTarget();
3137}
3138
3139void AuraEffect::HandleAuraModEffectImmunity(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 // when removing flag aura, handle flag drop
3148 Player* player = target->ToPlayer();
3149 if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
3150 {
3151 if (player->InBattleground())
3152 {
3153 if (Battleground* bg = player->GetBattleground())
3154 bg->EventPlayerDroppedFlag(player);
3155 }
3156 else
3157 sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
3158 }
3159}
3160
3161void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3162{
3163 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3164 return;
3165
3166 Unit* target = aurApp->GetTarget();
3168}
3169
3170void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3171{
3172 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3173 return;
3174
3175 Unit* target = aurApp->GetTarget();
3177
3178 if (GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3179 {
3180 if (apply)
3182 else
3183 {
3184 bool banishFound = false;
3185 Unit::AuraEffectList const& banishAuras = target->GetAuraEffectsByType(GetAuraType());
3186 for (AuraEffect const* aurEff : banishAuras)
3187 {
3188 if (aurEff->GetSpellInfo()->Mechanic == MECHANIC_BANISH)
3189 {
3190 banishFound = true;
3191 break;
3192 }
3193 }
3194
3195 if (!banishFound)
3197 }
3198 }
3199
3200 if (apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
3202
3203 // remove all flag auras (they are positive, but they must be removed when you are immune)
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::HandleAuraModDmgImmunity(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 if (apply)
3231 {
3234 }
3235 else
3236 {
3237 // do not remove unit flag if there are more than this auraEffect of that kind on unit
3239 return;
3241 }
3242}
3243
3244void AuraEffect::HandleAuraModDispelImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
3245{
3246 if (!(mode & AURA_EFFECT_HANDLE_REAL))
3247 return;
3248
3249 Unit* target = aurApp->GetTarget();
3251}
3252
3253/*********************************************************/
3254/*** MODIFY STATS ***/
3255/*********************************************************/
3256
3257/********************************/
3258/*** RESISTANCE ***/
3259/********************************/
3260
3261void AuraEffect::HandleAuraModResistanceExclusive(AuraApplication const* aurApp, uint8 mode, bool apply) const
3262{
3264 return;
3265
3266 Unit* target = aurApp->GetTarget();
3267
3268 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3269 {
3270 if (GetMiscValue() & (1 << x))
3271 {
3273 if (amount < GetAmount())
3274 {
3275 float value = float(GetAmount() - amount);
3277 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3279 }
3280 }
3281 }
3282}
3283
3284void AuraEffect::HandleAuraModResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3285{
3287 return;
3288
3289 Unit* target = aurApp->GetTarget();
3290
3291 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3292 {
3293 if (GetMiscValue() & (1 << x))
3294 {
3296 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3298 }
3299 }
3300}
3301
3302void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
3303{
3305 return;
3306
3307 Unit* target = aurApp->GetTarget();
3308
3309 // only players have base stats
3310 if (target->GetTypeId() != TYPEID_PLAYER)
3311 {
3312 //pets only have base armor
3313 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3314 {
3315 if (apply)
3317 else
3318 {
3320 target->SetStatPctModifier(UNIT_MOD_ARMOR, BASE_PCT, amount);
3321 }
3322 }
3323 }
3324 else
3325 {
3326 for (uint8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; ++x)
3327 {
3328 if (GetMiscValue() & (1 << x))
3329 {
3330 if (apply)
3332 else
3333 {
3336 }
3337 }
3338 }
3339 }
3340}
3341
3342void AuraEffect::HandleModResistancePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3343{
3345 return;
3346
3347 Unit* target = aurApp->GetTarget();
3348
3349 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3350 {
3351 if (GetMiscValue() & (1 << i))
3352 {
3355 continue;
3356
3358 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3360 }
3361 }
3362}
3363
3364void AuraEffect::HandleModBaseResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3365{
3367 return;
3368
3369 Unit* target = aurApp->GetTarget();
3370
3371 // only players have base stats
3372 if (target->GetTypeId() != TYPEID_PLAYER)
3373 {
3374 //pets only have base armor
3375 if (target->IsPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
3377 }
3378 else
3379 {
3380 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
3381 if (GetMiscValue() & (1 << i))
3383 }
3384}
3385
3386void AuraEffect::HandleModTargetResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3387{
3389 return;
3390
3391 Unit* target = aurApp->GetTarget();
3392
3393 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
3394
3395 // show armor penetration
3398
3399 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
3402}
3403
3404/********************************/
3405/*** STAT ***/
3406/********************************/
3407
3408void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3409{
3411 return;
3412
3413 if (GetMiscValue() < -2 || GetMiscValue() > 4)
3414 {
3415 TC_LOG_ERROR("spells.aura.effect", "WARNING: Spell {} effect {} has an unsupported misc value ({}) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
3416 return;
3417 }
3418
3419 Unit* target = aurApp->GetTarget();
3421 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3422 return;
3423
3424 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3425 {
3426 // -1 or -2 is all stats (misc < -2 checked in function beginning)
3427 if (GetMiscValue() < 0 || GetMiscValue() == i)
3428 {
3429 if (spellGroupVal)
3430 {
3431 target->HandleStatFlatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(spellGroupVal), !apply);
3432 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3433 target->UpdateStatBuffMod(Stats(i));
3434 }
3435
3437 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3438 target->UpdateStatBuffMod(Stats(i));
3439 }
3440 }
3441}
3442
3443void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
3444{
3446 return;
3447
3448 Unit* target = aurApp->GetTarget();
3449
3450 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3451 {
3452 TC_LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3453 return;
3454 }
3455
3456 // only players have base stats
3457 if (target->GetTypeId() != TYPEID_PLAYER)
3458 return;
3459
3460 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3461 {
3462 if (GetMiscValue() == i || GetMiscValue() == -1)
3463 {
3464 if (apply)
3466 else
3467 {
3468 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_PERCENT_STAT, [i](AuraEffect const* aurEff) -> bool
3469 {
3470 if (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1)
3471 return true;
3472 return false;
3473 });
3475 }
3476 }
3477 }
3478}
3479
3480void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3481{
3483 return;
3484
3485 Unit* target = aurApp->GetTarget();
3486
3487 if (target->GetTypeId() != TYPEID_PLAYER)
3488 return;
3489
3490 // Magic damage modifiers implemented in Unit::SpellDamageBonus
3491 // This information for client side use only
3492 // Recalculate bonus
3494}
3495
3496void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3497{
3499 return;
3500
3501 Unit* target = aurApp->GetTarget();
3502
3503 if (target->GetTypeId() != TYPEID_PLAYER)
3504 return;
3505
3506 // Recalculate bonus
3508}
3509
3511{
3513 return;
3514
3515 Unit* target = aurApp->GetTarget();
3516
3517 if (target->GetTypeId() != TYPEID_PLAYER)
3518 return;
3519
3520 // Magic damage modifiers implemented in Unit::SpellDamageBonus
3521 // This information for client side use only
3522 // Recalculate bonus
3524}
3525
3527{
3529 return;
3530
3531 Unit* target = aurApp->GetTarget();
3532
3533 if (target->GetTypeId() != TYPEID_PLAYER)
3534 return;
3535
3536 // Recalculate bonus
3538}
3539
3540void AuraEffect::HandleModHealingDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3541{
3543 return;
3544
3545 Unit* target = aurApp->GetTarget();
3546
3547 if (target->GetTypeId() != TYPEID_PLAYER)
3548 return;
3549 // implemented in Unit::SpellHealingBonus
3550 // this information is for client side only
3552}
3553
3554void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3555{
3557 return;
3558
3559 if (GetMiscValue() < -1 || GetMiscValue() > 4)
3560 {
3561 TC_LOG_ERROR("spells.aura.effect", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
3562 return;
3563 }
3564
3565 Unit* target = aurApp->GetTarget();
3566
3567 // save current health state
3568 float healthPct = target->GetHealthPct();
3569 bool zeroHealth = !target->IsAlive();
3570
3571 // players in corpse state may mean two different states:
3574 if (target->getDeathState() == CORPSE)
3575 zeroHealth = (target->GetHealth() == 0);
3576
3577 for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
3578 {
3579 if (GetMiscValue() == i || GetMiscValue() == -1) // affect the same stats
3580 {
3581 float amount = target->GetTotalAuraMultiplier(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, [i](AuraEffect const* aurEff) -> bool
3582 {
3583 if (aurEff->GetMiscValue() == i || aurEff->GetMiscValue() == -1)
3584 return true;
3585 return false;
3586 });
3587
3588 if (target->GetPctModifierValue(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT) == amount)
3589 continue;
3590
3592 if (target->GetTypeId() == TYPEID_PLAYER || target->IsPet())
3593 target->UpdateStatBuffMod(Stats(i));
3594 }
3595 }
3596
3597 // recalculate current HP/MP after applying aura modifications (only for spells with SPELL_ATTR0_ABILITY 0x00000010 flag)
3598 // this check is total bullshit i think
3600 target->SetHealth(std::max<uint32>(CalculatePct(target->GetMaxHealth(), healthPct), (zeroHealth ? 0 : 1)));
3601}
3602
3603void AuraEffect::HandleAuraModResistenceOfStatPercent(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
3614 {
3615 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
3616 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
3617 TC_LOG_ERROR("spells.aura.effect", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
3618 return;
3619 }
3620
3621 // Recalculate Armor
3622 target->UpdateArmor();
3623}
3624
3625void AuraEffect::HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3626{
3628 return;
3629
3630 Unit* target = aurApp->GetTarget();
3631
3632 if (target->GetTypeId() != TYPEID_PLAYER)
3633 return;
3634
3637}
3638
3639/********************************/
3640/*** HEAL & ENERGIZE ***/
3641/********************************/
3642void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3643{
3645 return;
3646
3647 Unit* target = aurApp->GetTarget();
3648
3649 if (target->GetTypeId() != TYPEID_PLAYER)
3650 return;
3651
3652 if (GetMiscValue() == POWER_RUNE)
3654 else
3655 target->ToPlayer()->UpdatePowerRegen(static_cast<Powers>(GetMiscValue()));
3656
3657}
3658
3659void AuraEffect::HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
3660{
3661 HandleModPowerRegen(aurApp, mode, apply);
3662}
3663
3664void AuraEffect::HandleModManaRegen(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3665{
3667 return;
3668
3669 Unit* target = aurApp->GetTarget();
3670
3671 if (target->GetTypeId() != TYPEID_PLAYER)
3672 return;
3673
3674 //Note: an increase in regen does NOT cause threat.
3676}
3677
3678void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
3679{
3681 return;
3682
3683 Unit* target = aurApp->GetTarget();
3684
3685 int32 const amt = apply ? GetAmount() : -GetAmount();
3686 if (amt < 0)
3687 target->ModifyHealth(std::max<int32>(1 - target->GetHealth(), amt));
3688
3690
3691 if (amt > 0)
3692 target->ModifyHealth(amt);
3693}
3694
3695void AuraEffect::HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
3696{
3698 return;
3699
3700 Unit* target = aurApp->GetTarget();
3701
3702 float percent = target->GetHealthPct();
3703
3705
3706 // refresh percentage
3707 if (target->GetHealth() > 0)
3708 {
3709 uint32 newHealth = std::max<uint32>(target->CountPctFromMaxHealth(int32(percent)), 1);
3710 target->SetHealth(newHealth);
3711 }
3712}
3713
3714void AuraEffect::HandleAuraModIncreaseEnergy(AuraApplication const* aurApp, uint8 mode, bool apply) const
3715{
3717 return;
3718
3719 Unit* target = aurApp->GetTarget();
3721
3722 target->HandleStatFlatModifier(unitMod, TOTAL_VALUE, float(GetAmount()), apply);
3723}
3724
3726{
3728 return;
3729
3730 Unit* target = aurApp->GetTarget();
3731 Powers powerType = Powers(GetMiscValue());
3733
3734 // Save old powers for further calculation
3735 int32 oldPower = int32(target->GetPower(powerType));
3736 int32 oldMaxPower = int32(target->GetMaxPower(powerType));
3737
3738 // Handle aura effect for max power
3739 if (apply)
3740 {
3741 float amount = float(GetAmount());
3742 target->ApplyStatPctModifier(unitMod, TOTAL_PCT, amount);
3743 }
3744 else
3745 {
3747 target->SetStatPctModifier(unitMod, TOTAL_PCT, amount);
3748 }
3749
3750 // Calculate the current power change
3751 int32 change = target->GetMaxPower(powerType) - oldMaxPower;
3752 change = (oldPower + change) - target->GetPower(powerType);
3753 target->ModifyPower(powerType, change);
3754}
3755
3757{
3759 return;
3760
3761 Unit* target = aurApp->GetTarget();
3762
3763 // Unit will keep hp% after MaxHealth being modified if unit is alive.
3764 float percent = target->GetHealthPct();
3765 if (apply)
3767 else
3768 {
3771 }
3772
3773 if (target->GetHealth() > 0)
3774 {
3775 uint32 newHealth = std::max<uint32>(CalculatePct(target->GetMaxHealth(), percent), 1);
3776 target->SetHealth(newHealth);
3777 }
3778}
3779
3781{
3783 return;
3784
3785 Unit* target = aurApp->GetTarget();
3786
3787 if (apply)
3789 else
3790 {
3793 }
3794}
3795
3796/********************************/
3797/*** FIGHT ***/
3798/********************************/
3799
3800void AuraEffect::HandleAuraModParryPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3801{
3803 return;
3804
3805 Unit* target = aurApp->GetTarget();
3806
3807 if (target->GetTypeId() != TYPEID_PLAYER)
3808 return;
3809
3810 target->ToPlayer()->UpdateParryPercentage();
3811}
3812
3813void AuraEffect::HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3814{
3816 return;
3817
3818 Unit* target = aurApp->GetTarget();
3819
3820 if (target->GetTypeId() != TYPEID_PLAYER)
3821 return;
3822
3823 target->ToPlayer()->UpdateDodgePercentage();
3824}
3825
3826void AuraEffect::HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3827{
3829 return;
3830
3831 Unit* target = aurApp->GetTarget();
3832
3833 if (target->GetTypeId() != TYPEID_PLAYER)
3834 return;
3835
3836 target->ToPlayer()->UpdateBlockPercentage();
3837}
3838
3839void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool apply) const
3840{
3841 HandleModManaRegen(aurApp, mode, apply);
3842}
3843
3844void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3845{
3847 return;
3848
3849 Player* target = aurApp->GetTarget()->ToPlayer();
3850 if (!target)
3851 return;
3852
3854}
3855
3856void AuraEffect::HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3857{
3859 return;
3860
3861 Unit* target = aurApp->GetTarget();
3862
3863 if (target->GetTypeId() == TYPEID_PLAYER)
3864 target->ToPlayer()->UpdateSpellHitChances();
3865 else
3866 target->m_modSpellHitChance += (apply) ? GetAmount(): (-GetAmount());
3867}
3868
3869void AuraEffect::HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const
3870{
3872 return;
3873
3874 Unit* target = aurApp->GetTarget();
3875
3876 if (target->GetTypeId() == TYPEID_PLAYER)
3878 else
3879 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
3880}
3881
3882void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
3883{
3885 return;
3886
3887 Unit* target = aurApp->GetTarget();
3888
3889 if (target->GetTypeId() != TYPEID_PLAYER)
3890 return;
3891
3892 for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
3893 if (GetMiscValue() & (1<<school))
3894 target->ToPlayer()->UpdateSpellCritChance(school);
3895}
3896
3897void AuraEffect::HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3898{
3900 return;
3901
3902 Unit* target = aurApp->GetTarget();
3903
3904 if (target->GetTypeId() != TYPEID_PLAYER)
3905 {
3906 target->m_baseSpellCritChance += apply ? GetAmount() : -GetAmount();
3907 return;
3908 }
3909
3911
3912 // included in Player::UpdateSpellCritChance calculation
3914}
3915
3916/********************************/
3917/*** ATTACK SPEED ***/
3918/********************************/
3919
3920void AuraEffect::HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
3921{
3923 return;
3924
3925 Unit* target = aurApp->GetTarget();
3926
3927 // Do not apply such auras in normal way
3928 if (GetAmount() >= 1000)
3929 {
3930 if (apply)
3931 target->SetInstantCast(true);
3932 else
3933 {
3934 // only SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK can have this high amount
3935 // it's some rare case that you have 2 auras like that, but just in case ;)
3936
3937 bool remove = true;
3939 for (AuraEffect const* aurEff : castingSpeedNotStack)
3940 {
3941 if (aurEff != this && aurEff->GetAmount() >= 1000)
3942 {
3943 remove = false;
3944 break;
3945 }
3946 }
3947
3948 if (remove)
3949 target->SetInstantCast(false);
3950 }
3951
3952 return;
3953 }
3954
3955 int32 spellGroupVal = target->GetHighestExclusiveSameEffectSpellGroupValue(this, GetAuraType());
3956 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3957 return;
3958
3959 if (spellGroupVal)
3960 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
3961
3962 target->ApplyCastTimePercentMod((float)GetAmount(), apply);
3963}
3964
3965void AuraEffect::HandleModMeleeRangedSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3966{
3968 return;
3969
3970 Unit* target = aurApp->GetTarget();
3971
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::HandleModCombatSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
3978{
3980 return;
3981
3982 Unit* target = aurApp->GetTarget();
3984 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
3985 return;
3986
3987 if (spellGroupVal)
3988 {
3989 target->ApplyCastTimePercentMod(float(spellGroupVal), !apply);
3990 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
3991 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
3992 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(spellGroupVal), !apply);
3993 }
3994 target->ApplyCastTimePercentMod(float(GetAmount()), apply);
3995 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
3996 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
3997 target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(GetAmount()), apply);
3998}
3999
4000void AuraEffect::HandleModAttackSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const
4001{
4003 return;
4004
4005 Unit* target = aurApp->GetTarget();
4006
4007 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4009}
4010
4011void AuraEffect::HandleModMeleeSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const
4012{
4014 return;
4015
4016 Unit* target = aurApp->GetTarget();
4018 if (std::abs(spellGroupVal) >= std::abs(GetAmount()))
4019 return;
4020
4021 if (spellGroupVal)
4022 {
4023 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(spellGroupVal), !apply);
4024 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(spellGroupVal), !apply);
4025 }
4026 target->ApplyAttackTimePercentMod(BASE_ATTACK, float(GetAmount()), apply);
4027 target->ApplyAttackTimePercentMod(OFF_ATTACK, float(GetAmount()), apply);
4028}
4029
4030void AuraEffect::HandleAuraModRangedHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4031{
4033 return;
4034
4035 Unit* target = aurApp->GetTarget();
4036
4037 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4038}
4039
4040void AuraEffect::HandleRangedAmmoHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const
4041{
4043 return;
4044
4045 Unit* target = aurApp->GetTarget();
4046
4047 if (target->GetTypeId() != TYPEID_PLAYER)
4048 return;
4049
4050 target->ApplyAttackTimePercentMod(RANGED_ATTACK, (float)GetAmount(), apply);
4051}
4052
4053/********************************/
4054/*** COMBAT RATING ***/
4055/********************************/
4056
4057void AuraEffect::HandleModRating(AuraApplication const* aurApp, uint8 mode, bool apply) const
4058{
4060 return;
4061
4062 Unit* target = aurApp->GetTarget();
4063
4064 if (target->GetTypeId() != TYPEID_PLAYER)
4065 return;
4066
4067 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4068 if (GetMiscValue() & (1 << rating))
4069 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
4070}
4071
4072void AuraEffect::HandleModRatingFromStat(AuraApplication const* aurApp, uint8 mode, bool apply) const
4073{
4075 return;
4076
4077 Unit* target = aurApp->GetTarget();
4078
4079 if (target->GetTypeId() != TYPEID_PLAYER)
4080 return;
4081
4082 // Just recalculate ratings
4083 for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
4084 if (GetMiscValue() & (1 << rating))
4085 target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
4086}
4087
4088/********************************/
4089/*** ATTACK POWER ***/
4090/********************************/
4091
4092void AuraEffect::HandleAuraModAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4093{
4095 return;
4096
4097 Unit* target = aurApp->GetTarget();
4098
4100}
4101
4102void AuraEffect::HandleAuraModRangedAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const
4103{
4105 return;
4106
4107 Unit* target = aurApp->GetTarget();
4108
4109 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4110 return;
4111
4113}
4114
4115void AuraEffect::HandleAuraModAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
4116{
4118 return;
4119
4120 Unit* target = aurApp->GetTarget();
4121
4122 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
4123 if (apply)
4125 else
4126 {
4129 }
4130}
4131
4133{
4135 return;
4136
4137 Unit* target = aurApp->GetTarget();
4138
4139 if ((target->GetClassMask() & CLASSMASK_WAND_USERS) != 0)
4140 return;
4141
4142 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
4143 if (apply)
4145 else
4146 {
4149 }
4150}
4151
4153{
4155 return;
4156
4157 Unit* target = aurApp->GetTarget();
4158
4159 // Recalculate bonus
4160 if (target->GetTypeId() == TYPEID_PLAYER && !(target->GetClassMask() & CLASSMASK_WAND_USERS))
4161 target->ToPlayer()->UpdateAttackPowerAndDamage(true);
4162}
4163
4164void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4165{
4167 return;
4168
4169 Unit* target = aurApp->GetTarget();
4170
4171 // Recalculate bonus
4172 if (target->GetTypeId() == TYPEID_PLAYER)
4173 target->ToPlayer()->UpdateAttackPowerAndDamage(false);
4174}
4175
4176/********************************/
4177/*** DAMAGE BONUS ***/
4178/********************************/
4179void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const
4180{
4182 return;
4183
4184 Unit* target = aurApp->GetTarget();
4185
4187 target->UpdateAllDamageDoneMods();
4188
4189 // Magic damage modifiers implemented in Unit::SpellBaseDamageBonusDone
4190 // This information for client side use only
4191 if (target->GetTypeId() == TYPEID_PLAYER)
4192 {
4194 for (uint16 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
4195 if (GetMiscValue() & (1 << i))
4196 target->ApplyModInt32Value(baseField + i, GetAmount(), apply);
4197
4198 if (Guardian* pet = target->ToPlayer()->GetGuardianPet())
4199 pet->UpdateAttackPowerAndDamage();
4200 }
4201}
4202
4203void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4204{
4206 return;
4207
4208 Unit* target = aurApp->GetTarget();
4209
4210 // also handles spell group stacks
4213
4214 if (target->GetTypeId() == TYPEID_PLAYER)
4215 {
4216 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
4217 {
4218 if (GetMiscValue() & (1 << i))
4219 {
4220 // only aura type modifying PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
4223 }
4224 }
4225 }
4226}
4227
4228void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4229{
4231 return;
4232
4233 Unit* target = aurApp->GetTarget();
4234
4235 // also handles spell group stacks
4237}
4238
4239void AuraEffect::HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mode, bool apply) const
4240{
4242 return;
4243
4244 Player* target = aurApp->GetTarget()->ToPlayer();
4245 if (!target)
4246 return;
4247
4248 target->HandleBaseModFlatValue(SHIELD_BLOCK_VALUE, float(GetAmount()), apply);
4249}
4250
4251void AuraEffect::HandleShieldBlockValuePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
4252{
4254 return;
4255
4256 Player* target = aurApp->GetTarget()->ToPlayer();
4257 if (!target)
4258 return;
4259
4260 if (apply)
4262 else
4263 {
4265 target->SetBaseModPctValue(SHIELD_BLOCK_VALUE, amount);
4266 }
4267}
4268
4269/********************************/
4270/*** POWER COST ***/
4271/********************************/
4272
4273void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const
4274{
4276 return;
4277
4278 Unit* target = aurApp->GetTarget();
4279
4280 float amount = CalculatePct(1.0f, GetAmount());
4281 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4282 if (GetMiscValue() & (1 << i))
4284}
4285
4286void AuraEffect::HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, bool apply) const
4287{
4289 return;
4290
4291 Unit* target = aurApp->GetTarget();
4292
4293 for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
4294 if (GetMiscValue() & (1<<i))
4296}
4297
4298void AuraEffect::HandleArenaPreparation(AuraApplication const* aurApp, uint8 mode, bool apply) const
4299{
4300 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4301 return;
4302
4303 Unit* target = aurApp->GetTarget();
4304
4305 if (apply)
4307 else
4308 {
4309 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4310 if (target->HasAuraType(GetAuraType()))
4311 return;
4313 }
4314}
4315
4316void AuraEffect::HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4317{
4318 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4319 return;
4320
4321 Unit* target = aurApp->GetTarget();
4322
4323 if (target->GetTypeId() != TYPEID_PLAYER)
4324 return;
4325
4326 flag96 mask;
4328 for (Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
4329 mask |= (*i)->GetSpellEffectInfo().SpellClassMask;
4330
4331 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]);
4332 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]);
4333 target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask[2]);
4334}
4335
4336void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const* aurApp, uint8 mode, bool apply) const
4337{
4338 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4339 return;
4340
4341 Unit* target = aurApp->GetTarget();
4342
4343 if (target->GetTypeId() != TYPEID_PLAYER)
4344 return;
4345
4346 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
4347 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
4348 if (!(apply) && GetBase()->GetDuration() == 0)
4349 target->ToPlayer()->AddComboPoints(-GetAmount());
4350}
4351
4352/*********************************************************/
4353/*** OTHERS ***/
4354/*********************************************************/
4355
4356void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4357{
4359 return;
4360
4361 Unit* target = aurApp->GetTarget();
4362
4363 Unit* caster = GetCaster();
4364
4365 // pet auras
4366 if (target->GetTypeId() == TYPEID_PLAYER && (mode & AURA_EFFECT_HANDLE_REAL))
4367 {
4368 if (PetAura const* petSpell = sSpellMgr->GetPetAura(GetId(), GetEffIndex()))
4369 {
4370 if (apply)
4371 target->ToPlayer()->AddPetAura(petSpell);
4372 else
4373 target->ToPlayer()->RemovePetAura(petSpell);
4374 }
4375 }
4376
4378 {
4379 // AT APPLY
4380 if (apply)
4381 {
4382 switch (GetId())
4383 {
4384 case 1515: // Tame beast
4385 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
4386 if (caster && target->CanHaveThreatList())
4387 target->GetThreatManager().AddThreat(caster, 10.0f);
4388 break;
4389 case 13139: // net-o-matic
4390 // root to self part of (root_target->charge->root_self sequence
4391 if (caster)
4392 caster->CastSpell(caster, 13138, this);
4393 break;
4394 case 34026: // kill command
4395 {
4396 Unit* pet = target->GetGuardianPet();
4397 if (!pet)
4398 break;
4399
4400 target->CastSpell(target, 34027, this);
4401
4402 // set 3 stacks and 3 charges (to make all auras not disappear at once)
4403 Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
4404 Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
4405 if (owner_aura)
4406 {
4407 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4408 if (pet_aura)
4409 {
4410 pet_aura->SetCharges(0);
4411 pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4412 }
4413 }
4414 break;
4415 }
4416 case 37096: // Blood Elf Illusion
4417 {
4418 if (caster)
4419 {
4420 if (caster->GetGender() == GENDER_FEMALE)
4421 caster->CastSpell(target, 37095, this); // Blood Elf Disguise
4422 else
4423 caster->CastSpell(target, 37093, this);
4424 }
4425 break;
4426 }
4427 case 55198: // Tidal Force
4428 {
4429 target->CastSpell(target, 55166, this);
4430 // set 3 stacks and 3 charges (to make all auras not disappear at once)
4431 Aura* owner_aura = target->GetAura(55166, GetCasterGUID());
4432 if (owner_aura)
4433 {
4434 // This aura lasts 2 sec, need this hack to properly proc spells
4436 GetBase()->SetDuration(owner_aura->GetDuration());
4437 // Make aura be not charged-this prevents removing charge on not crit spells
4438 owner_aura->SetCharges(0);
4439 owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount);
4440 }
4441 break;
4442 }
4443 case 39850: // Rocket Blast
4444 if (roll_chance_i(20)) // backfire stun
4445 target->CastSpell(target, 51581, this);
4446 break;
4447 case 43873: // Headless Horseman Laugh
4448 target->PlayDistanceSound(11965);
4449 break;
4450 case 46354: // Blood Elf Illusion
4451 if (caster)
4452 {
4453 if (caster->GetGender() == GENDER_FEMALE)
4454 caster->CastSpell(target, 46356, this);
4455 else
4456 caster->CastSpell(target, 46355, this);
4457 }
4458 break;
4459 case 46361: // Reinforced Net
4460 if (caster)
4461 target->GetMotionMaster()->MoveFall();
4462 break;
4463 case 46699: // Requires No Ammo
4464 if (target->GetTypeId() == TYPEID_PLAYER)
4465 target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
4466 break;
4467 }
4468 }
4469 // AT REMOVE
4470 else
4471 {
4473 {
4475 switch (GetId())
4476 {
4477 case 2584: // Waiting to Resurrect
4478 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
4479 if (target->GetTypeId() == TYPEID_PLAYER)
4480 {
4481 if (Battleground* bg = target->ToPlayer()->GetBattleground())
4482 bg->RemovePlayerFromResurrectQueue(target->GetGUID());
4483 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
4484 bf->RemovePlayerFromResurrectQueue(target->GetGUID());
4485 }
4486 break;
4487 case 43681: // Inactive
4488 {
4489 if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
4490 return;
4491
4492 if (target->GetMap()->IsBattleground())
4493 target->ToPlayer()->LeaveBattleground();
4494 break;
4495 }
4496 case 46308: // Burning Winds cast only at creatures at spawn
4497 target->CastSpell(target, 47287, this);
4498 break;
4499 case 52172: // Coyote Spirit Despawn Aura
4500 case 60244: // Blood Parrot Despawn Aura
4501 target->CastSpell(nullptr, GetAmount(), this);
4502 break;
4503 case 58600: // Restricted Flight Area
4504 case 58730: // Restricted Flight Area
4505 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
4506 target->CastSpell(target, 58601, true);
4507 break;
4508 }
4509 break;
4511 // Summon Gargoyle (Dismiss Gargoyle at remove)
4512 if (GetId() == 61777)
4513 target->CastSpell(target, GetAmount(), true);
4514 break;
4515 default:
4516 break;
4517 }
4518 }
4519 }
4520
4521 // AT APPLY & REMOVE
4522
4524 {
4526 {
4527 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4528 break;
4529 switch (GetId())
4530 {
4531 // Recently Bandaged
4532 case 11196:
4534 break;
4535 // Unstable Power
4536 case 24658:
4537 {
4538 uint32 spellId = 24659;
4539 if (apply && caster)
4540 {
4541 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
4542
4543 for (uint32 i = 0; i < spell->StackAmount; ++i)
4544 caster->CastSpell(target, spell->Id, GetCasterGUID());
4545 break;
4546 }
4547 target->RemoveAurasDueToSpell(spellId);
4548 break;
4549 }
4550 // Restless Strength
4551 case 24661:
4552 {
4553 uint32 spellId = 24662;
4554 if (apply && caster)
4555 {
4556 SpellInfo const* spell = sSpellMgr->AssertSpellInfo(spellId);
4557 for (uint32 i = 0; i < spell->StackAmount; ++i)
4558 caster->CastSpell(target, spell->Id, GetCasterGUID());
4559 break;
4560 }
4561 target->RemoveAurasDueToSpell(spellId);
4562 break;
4563 }
4564 // Tag Murloc
4565 case 30877:
4566 {
4567 // Tag/untag Blacksilt Scout
4568 target->SetEntry(apply ? 17654 : 17326);
4569 break;
4570 }
4571 case 57819: // Argent Champion
4572 case 57820: // Ebon Champion
4573 case 57821: // Champion of the Kirin Tor
4574 case 57822: // Wyrmrest Champion
4575 {
4576 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4577 break;
4578
4579 uint32 FactionID = 0;
4580
4581 if (apply)
4582 {
4583 switch (m_spellInfo->Id)
4584 {
4585 case 57819: FactionID = 1106; break; // Argent Crusade
4586 case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
4587 case 57821: FactionID = 1090; break; // Kirin Tor
4588 case 57822: FactionID = 1091; break; // The Wyrmrest Accord
4589 }
4590 }
4591 caster->ToPlayer()->SetChampioningFaction(FactionID);
4592 break;
4593 }
4594 // LK Intro VO (1)
4595 case 58204:
4596 if (target->GetTypeId() == TYPEID_PLAYER)
4597 {
4598 // Play part 1
4599 if (apply)
4600 target->PlayDirectSound(14970, target->ToPlayer());
4601 // continue in 58205
4602 else
4603 target->CastSpell(target, 58205, true);
4604 }
4605 break;
4606 // LK Intro VO (2)
4607 case 58205:
4608 if (target->GetTypeId() == TYPEID_PLAYER)
4609 {
4610 // Play part 2
4611 if (apply)
4612 target->PlayDirectSound(14971, target->ToPlayer());
4613 // Play part 3
4614 else
4615 target->PlayDirectSound(14972, target->ToPlayer());
4616 }
4617 break;
4618 case 62061: // Festive Holiday Mount
4619 if (target->HasAuraType(SPELL_AURA_MOUNTED))
4620 {
4621 uint32 creatureEntry = 0;
4622 if (apply)
4623 {
4625 creatureEntry = 24906;
4626 else
4627 creatureEntry = 15665;
4628 }
4629 else
4630 creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
4631
4632 if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
4633 {
4634 uint32 displayID = ObjectMgr::ChooseDisplayId(creatureInfo);
4635 sObjectMgr->GetCreatureModelRandomGender(&displayID);
4636
4637 target->SetMountDisplayId(displayID);
4638 }
4639 }
4640 break;
4641 }
4642
4643 break;
4644 }
4645 case SPELLFAMILY_MAGE:
4646 {
4647 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4648 //break;
4649 break;
4650 }
4651 case SPELLFAMILY_PRIEST:
4652 {
4653 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4654 //break;
4655 break;
4656 }
4657 case SPELLFAMILY_DRUID:
4658 {
4659 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4660 //break;
4661 break;
4662 }
4663 case SPELLFAMILY_SHAMAN:
4664 {
4665 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4666 //break;
4667 break;
4668 }
4670 // if (!(mode & AURA_EFFECT_HANDLE_REAL))
4671 // break;
4672 break;
4674 {
4675 //if (!(mode & AURA_EFFECT_HANDLE_REAL))
4676 // break;
4677 break;
4678 }
4679 }
4680}
4681
4682void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mode, bool apply) const
4683{
4684 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4685 return;
4686
4687 if (apply || aurApp->GetRemoveMode() != AURA_REMOVE_BY_DEATH)
4688 return;
4689
4690 Unit* caster = GetCaster();
4691
4692 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4693 return;
4694
4695 Player* plCaster = caster->ToPlayer();
4696 Unit* target = aurApp->GetTarget();
4697
4698 // Item amount
4699 if (GetAmount() <= 0)
4700 return;
4701
4702 if (GetSpellEffectInfo().ItemType == 0)
4703 return;
4704
4705 // Soul Shard
4706 if (GetSpellEffectInfo().ItemType == 6265)
4707 {
4708 // Soul Shard only from units that grant XP or honor
4709 if (!plCaster->isHonorOrXPTarget(target) ||
4710 (target->GetTypeId() == TYPEID_UNIT && !target->ToCreature()->isTappedBy(plCaster)))
4711 return;
4712
4713 // If this is Drain Soul, check for Glyph of Drain Soul
4714 if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000))
4715 {
4716 // Glyph of Drain Soul - chance to create an additional Soul Shard
4717 if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
4718 if (roll_chance_i(aur->GetMiscValue()))
4719 caster->CastSpell(caster, 58068, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
4720 }
4721 }
4722
4723 //Adding items
4724 uint32 noSpaceForCount = 0;
4725 uint32 count = GetAmount();
4726
4727 ItemPosCountVec dest;
4728 InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellEffectInfo().ItemType, count, &noSpaceForCount);
4729 if (msg != EQUIP_ERR_OK)
4730 {
4731 count -= noSpaceForCount;
4732 plCaster->SendEquipError(msg, nullptr, nullptr, GetSpellEffectInfo().ItemType);
4733 if (count == 0)
4734 return;
4735 }
4736
4737 Item* newitem = plCaster->StoreNewItem(dest, GetSpellEffectInfo().ItemType, true);
4738 if (!newitem)
4739 {
4740 plCaster->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
4741 return;
4742 }
4743 plCaster->SendNewItem(newitem, count, true, true);
4744}
4745
4746void AuraEffect::HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const
4747{
4748 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4749 return;
4750
4751 Unit* target = aurApp->GetTarget();
4752
4753 Unit* caster = GetCaster();
4754
4755 if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
4756 return;
4757
4758 caster->ToPlayer()->SetViewpoint(target, apply);
4759}
4760
4761void AuraEffect::HandleForceReaction(AuraApplication const* aurApp, uint8 mode, bool apply) const
4762{
4764 return;
4765
4766 Unit* target = aurApp->GetTarget();
4767
4768 Player* player = target->ToPlayer();
4769 if (!player)
4770 return;
4771
4772 uint32 factionId = GetMiscValue();
4773 ReputationRank factionRank = ReputationRank(GetAmount());
4774
4775 player->GetReputationMgr().ApplyForceReaction(factionId, factionRank, apply);
4777
4778 // stop fighting at apply (if forced rank friendly) or at remove (if real rank friendly)
4779 if ((apply && factionRank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(factionId) >= REP_FRIENDLY))
4780 player->StopAttackFaction(factionId);
4781}
4782
4783void AuraEffect::HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bool apply) const
4784{
4785 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4786 return;
4787
4788 Unit* target = aurApp->GetTarget();
4789 if (!apply)
4790 {
4791 // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
4792 if (target->HasAuraType(GetAuraType()))
4793 return;
4794 }
4795
4796 if (target->GetCreatureType() == CREATURE_TYPE_BEAST)
4797 {
4798 if (apply)
4800 else
4802 }
4803}
4804
4805void AuraEffect::HandleAuraModFaction(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 if (apply)
4813 {
4814 target->SetFaction(GetMiscValue());
4815 if (target->GetTypeId() == TYPEID_PLAYER)
4817 }
4818 else
4819 {
4820 target->RestoreFaction();
4821 if (target->GetTypeId() == TYPEID_PLAYER)
4823 }
4824}
4825
4826void AuraEffect::HandleComprehendLanguage(AuraApplication const* aurApp, uint8 mode, bool apply) const
4827{
4829 return;
4830
4831 Unit* target = aurApp->GetTarget();
4832
4833 if (apply)
4835 else
4836 {
4837 if (target->HasAuraType(GetAuraType()))
4838 return;
4839
4841 }
4842}
4843
4844void AuraEffect::HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode, bool apply) const
4845{
4846 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4847 return;
4848
4849 Unit* target = aurApp->GetTarget();
4850
4851 Player* player = target->ToPlayer();
4852 if (!player)
4853 return;
4854
4855 if (player->GetClass() != CLASS_DEATH_KNIGHT)
4856 return;
4857
4858 uint32 runes = GetAmount();
4859 // convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
4860 if (apply)
4861 {
4862 for (uint32 i = 0; i < MAX_RUNES && runes; ++i)
4863 {
4864 if (GetMiscValue() != player->GetCurrentRune(i))
4865 continue;
4866 if (!player->GetRuneCooldown(i))
4867 {
4868 player->AddRuneByAuraEffect(i, RuneType(GetMiscValueB()), this);
4869 --runes;
4870 }
4871 }
4872 }
4873 else
4874 player->RemoveRunesByAuraEffect(this);
4875}
4876
4877void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const
4878{
4879 Unit* target = aurApp->GetTarget();
4880
4881 uint32 triggeredSpellId = sSpellMgr->GetSpellIdForDifficulty(GetSpellEffectInfo().TriggerSpell, target);
4882 SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggeredSpellId);
4883 if (!triggeredSpellInfo)
4884 return;
4885
4886 if (mode & AURA_EFFECT_HANDLE_REAL)
4887 {
4888 if (apply)
4889 {
4890 Unit* caster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCaster() : target;
4891 if (!caster)
4892 return;
4893
4894 CastSpellExtraArgs args(this);
4895 if (GetAmount()) // If amount avalible cast with basepoints (Crypt Fever for example)
4897
4898 caster->CastSpell(target, triggeredSpellId, args);
4899 }
4900 else
4901 {
4902 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
4903 target->RemoveAura(triggeredSpellId, casterGUID);
4904 }
4905 }
4906 else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
4907 {
4908 ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? GetCasterGUID() : target->GetGUID();
4909 // change the stack amount to be equal to stack amount of our aura
4910 if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
4911 triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
4912 }
4913}
4914
4915void AuraEffect::HandleAuraOpenStable(AuraApplication const* aurApp, uint8 mode, bool apply) const
4916{
4917 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4918 return;
4919
4920 Unit* target = aurApp->GetTarget();
4921
4922 if (target->GetTypeId() != TYPEID_PLAYER || !target->IsInWorld())
4923 return;
4924
4925 if (apply)
4926 target->ToPlayer()->GetSession()->SendStablePet(target->GetGUID());
4927
4928 // client auto close stable dialog at !apply aura
4929}
4930
4931void AuraEffect::HandleAuraModFakeInebriation(AuraApplication const* aurApp, uint8 mode, bool apply) const
4932{
4934 return;
4935
4936 Player* target = aurApp->GetTarget()->ToPlayer();
4937 if (!target)
4938 return;
4939
4942}
4943
4944void AuraEffect::HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 mode, bool apply) const
4945{
4946 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4947 return;
4948
4949 Player* target = aurApp->GetTarget()->ToPlayer();
4950
4951 if (!target || !target->IsInWorld())
4952 return;
4953
4954 uint32 overrideId = uint32(GetMiscValue());
4955
4956 if (apply)
4957 {
4959 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
4960 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
4961 if (uint32 spellId = overrideSpells->Spells[i])
4962 target->AddTemporarySpell(spellId);
4963 }
4964 else
4965 {
4967 if (OverrideSpellDataEntry const* overrideSpells = sOverrideSpellDataStore.LookupEntry(overrideId))
4968 for (uint8 i = 0; i < MAX_OVERRIDE_SPELL; ++i)
4969 if (uint32 spellId = overrideSpells->Spells[i])
4970 target->RemoveTemporarySpell(spellId);
4971 }
4972}
4973
4974void AuraEffect::HandleAuraPreventRegeneratePower(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
4975{
4977 return;
4978
4979 Unit* target = aurApp->GetTarget();
4980
4981 if (target->GetTypeId() != TYPEID_PLAYER)
4982 return;
4983
4984 target->ToPlayer()->UpdatePowerRegen(static_cast<Powers>(GetAmount()));
4985}
4986
4987void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const
4988{
4989 if (!(mode & AURA_EFFECT_HANDLE_REAL))
4990 return;
4991
4992 Unit* target = aurApp->GetTarget();
4993
4994 if (!target->IsInWorld())
4995 return;
4996
4997 uint32 vehicleId = GetMiscValue();
4998
4999 if (apply)
5000 {
5001 if (!target->CreateVehicleKit(vehicleId, 0))
5002 return;
5003 }
5004 else if (target->GetVehicleKit())
5005 target->RemoveVehicleKit();
5006
5007 if (target->GetTypeId() != TYPEID_PLAYER)
5008 return;
5009
5011 data << target->GetPackGUID();
5012 data << uint32(apply ? vehicleId : 0);
5013 target->SendMessageToSet(&data, true);
5014
5015 if (apply)
5017}
5018
5019void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const
5020{
5021 if (!(mode & AURA_EFFECT_HANDLE_REAL))
5022 return;
5023
5024 if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER)
5025 return;
5026
5027 if (apply)
5029 else if (!aurApp->GetTarget()->GetMap()->Instanceable())
5031}
5032
5034{
5035 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5036 if (triggerSpellId == 0)
5037 {
5038 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5039 return;
5040 }
5041
5042 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5043 {
5044 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5045 {
5046 triggerCaster->CastSpell(target, triggerSpellId, this);
5047 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5048 }
5049 }
5050 else
5051 TC_LOG_ERROR("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5052}
5053
5055{
5056 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5057 if (triggerSpellId == 0)
5058 {
5059 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5060 return;
5061 }
5062
5063 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5064 {
5065 if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target)
5066 {
5067 CastSpellExtraArgs args(this);
5068 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5070
5071 triggerCaster->CastSpell(target, triggerSpellId, args);
5072 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} Trigger {}", GetId(), triggeredSpellInfo->Id);
5073 }
5074 }
5075 else
5076 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5077}
5078
5080{
5081 if (!target->IsAlive())
5082 return;
5083
5085 {
5086 SendTickImmune(target, caster);
5087 return;
5088 }
5089
5090 // Consecrate ticks can miss and will not show up in the combat log
5091 // dynobj auras must always have a caster
5093 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5094 return;
5095
5097
5098 // ignore negative values (can be result apply spellmods to aura damage
5099 uint32 damage = std::max(GetAmount(), 0);
5100
5101 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5102 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5103
5105 {
5106 // leave only target depending bonuses, rest is handled in calculate amount
5107 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
5108 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5109
5110 switch (GetSpellInfo()->SpellFamilyName)
5111 {
5113 {
5114 switch (GetId())
5115 {
5116 case 70911: // Unbound Plague
5117 case 72854: // Unbound Plague
5118 case 72855: // Unbound Plague
5119 case 72856: // Unbound Plague
5120 damage *= uint32(pow(1.25f, int32(_ticksDone)));
5121 break;
5122 default:
5123 break;
5124 }
5125 break;
5126 }
5127 default:
5128 break;
5129 }
5130 }
5131 else // ceil obtained value, it may happen that 10 ticks for 10% damage may not kill owner
5132 damage = uint32(ceil(CalculatePct<float, float>(target->GetMaxHealth(), damage)));
5133
5134 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5135
5136 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5137 if (crit)
5138 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5139
5140 // Calculate armor mitigation
5141 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5142 {
5143 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5144 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5145 damage = damageReducedArmor;
5146 }
5147
5148 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE))
5149 {
5150 if (GetSpellEffectInfo().IsTargetingArea() || GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
5151 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, GetBase()->GetCasterGUID());
5152 }
5153
5154 int32 dmg = damage;
5155 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE) && GetBase()->CanApplyResilience())
5156 Unit::ApplyResilience(target, nullptr, &dmg, crit, CR_CRIT_TAKEN_SPELL);
5157 damage = dmg;
5158
5159 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, BASE_ATTACK);
5160 Unit::CalcAbsorbResist(damageInfo);
5161 damage = damageInfo.GetDamage();
5162
5163 uint32 absorb = damageInfo.GetAbsorb();
5164 uint32 resist = damageInfo.GetResist();
5165 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} attacked {} for {} dmg inflicted by {} absorb is {}",
5166 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5167
5168 Unit::DealDamageMods(target, damage, &absorb);
5169
5170 // Set trigger flag
5171 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5172 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5173 uint32 hitMask = damageInfo.GetHitMask();
5174 if (damage)
5175 {
5176 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5177 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
5178 }
5179
5180 int32 overkill = damage - target->GetHealth();
5181 if (overkill < 0)
5182 overkill = 0;
5183
5184 SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
5185 target->SendPeriodicAuraLog(&pInfo);
5186
5187 Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
5188
5189 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5190}
5191
5193{
5194 if (!target->IsAlive())
5195 return;
5196
5198 {
5199 SendTickImmune(target, caster);
5200 return;
5201 }
5202
5203 // dynobj auras must always have a caster
5205 ASSERT_NOTNULL(caster)->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5206 return;
5207
5208 CleanDamage cleanDamage = CleanDamage(0, 0, GetSpellInfo()->GetAttackType(), MELEE_HIT_NORMAL);
5209
5210 // ignore negative values (can be result apply spellmods to aura damage
5211 uint32 damage = std::max(GetAmount(), 0);
5212
5213 // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5214 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5215
5216 // dynobj auras must always have a caster
5217 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
5218 damage = ASSERT_NOTNULL(caster)->SpellDamageBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5219 damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
5220
5221 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5222 if (crit)
5223 damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target);
5224
5225 // Calculate armor mitigation
5226 if (Unit::IsDamageReducedByArmor(GetSpellInfo()->GetSchoolMask(), GetSpellInfo()))
5227 {
5228 uint32 damageReducedArmor = Unit::CalcArmorReducedDamage(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetAttackType(), GetBase()->GetCasterLevel());
5229 cleanDamage.mitigated_damage += damage - damageReducedArmor;
5230 damage = damageReducedArmor;
5231 }
5232
5233 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE))
5234 {
5235 if (GetSpellEffectInfo().IsTargetingArea() || GetSpellEffectInfo().IsAreaAuraEffect() || GetSpellEffectInfo().Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
5236 damage = target->CalculateAOEAvoidance(damage, m_spellInfo->SchoolMask, GetBase()->GetCasterGUID());
5237 }
5238
5239 int32 dmg = damage;
5240 if (!GetSpellInfo()->HasAttribute(SPELL_ATTR4_FIXED_DAMAGE) && GetBase()->CanApplyResilience())
5241 Unit::ApplyResilience(target, nullptr, &dmg, crit, CR_CRIT_TAKEN_SPELL);
5242 damage = dmg;
5243
5244 DamageInfo damageInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask(), DOT, GetSpellInfo()->GetAttackType());
5245 Unit::CalcAbsorbResist(damageInfo);
5246
5247 uint32 absorb = damageInfo.GetAbsorb();
5248 uint32 resist = damageInfo.GetResist();
5249 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} health leech of {} for {} dmg inflicted by {} abs is {}",
5250 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId(), absorb);
5251
5252 // SendSpellNonMeleeDamageLog expects non-absorbed/non-resisted damage
5253 if (caster)
5254 caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, true, 0, crit);
5255 damage = damageInfo.GetDamage();
5256
5257 // Set trigger flag
5258 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5259 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5260 uint32 hitMask = damageInfo.GetHitMask();
5261 if (damage)
5262 {
5263 hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5264 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
5265 }
5266
5267 int32 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
5268 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_DAMAGE, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &damageInfo, nullptr);
5269
5270 // process caster heal from now on (must be in world)
5271 if (!caster || !caster->IsAlive())
5272 return;
5273
5274 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5275
5276 uint32 heal = caster->SpellHealingBonusDone(caster, GetSpellInfo(), uint32(new_damage * gainMultiplier), DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5277 heal = caster->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
5278
5279 HealInfo healInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5280 caster->HealBySpell(healInfo);
5281
5282 caster->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5284}
5285
5287{
5288 if (!caster || !caster->IsAlive() || !target->IsAlive())
5289 return;
5290
5291 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5292 {
5293 SendTickImmune(target, caster);
5294 return;
5295 }
5296
5297 uint32 damage = std::max(GetAmount(), 0);
5298 // do not kill health donator
5299 if (caster->GetHealth() < damage)
5300 damage = caster->GetHealth() - 1;
5301 if (!damage)
5302 return;
5303
5304 caster->ModifyHealth(-(int32)damage);
5305 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: donator {} target {} damage {}.", caster->GetEntry(), target->GetEntry(), damage);
5306
5307 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5308
5309 damage = int32(damage * gainMultiplier);
5310
5311 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5312 caster->HealBySpell(healInfo);
5314}
5315
5317{
5318 if (!target->IsAlive())
5319 return;
5320
5321 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5322 {
5323 SendTickImmune(target, caster);
5324 return;
5325 }
5326
5327 // heal for caster damage (must be alive)
5328 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_HEALTH_FUNNEL) && (!caster || !caster->IsAlive()))
5329 return;
5330
5331 // don't regen when permanent aura target has full power
5332 if (GetBase()->IsPermanent() && target->IsFullHealth())
5333 return;
5334
5335 // ignore negative values (can be result apply spellmods to aura damage
5336 uint32 damage = std::max(GetAmount(), 0);
5337
5338 // Script Hook For HandlePeriodicHealAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
5339 sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
5340
5342 damage = uint32(target->CountPctFromMaxHealth(damage));
5343 else
5344 {
5345 // dynobj auras must always have a caster
5346 if (GetBase()->GetType() == DYNOBJ_AURA_TYPE)
5347 damage = ASSERT_NOTNULL(caster)->SpellHealingBonusDone(target, GetSpellInfo(), damage, DOT, GetSpellEffectInfo(), { }, GetBase()->GetStackAmount());
5348 }
5349
5350 damage = target->SpellHealingBonusTaken(caster, GetSpellInfo(), damage, DOT);
5351
5352 bool crit = roll_chance_f(GetCritChanceFor(caster, target));
5353 if (crit)
5354 damage = Unit::SpellCriticalHealingBonus(caster, m_spellInfo, damage, target);
5355
5356 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} heal of {} for {} health inflicted by {}",
5357 GetCasterGUID().ToString(), target->GetGUID().ToString(), damage, GetId());
5358
5359 uint32 heal = damage;
5360
5361 HealInfo healInfo(caster, target, damage, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
5362 Unit::CalcHealAbsorb(healInfo);
5363 Unit::DealHeal(healInfo);
5364
5365 SpellPeriodicAuraLogInfo pInfo(this, heal, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
5366 target->SendPeriodicAuraLog(&pInfo);
5367
5368 if (caster)
5369 target->GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
5370
5371 bool haveCastItem = !GetBase()->GetCastItemGUID().IsEmpty();
5372
5373 // Health Funnel
5374 // damage caster for heal amount
5375 if (target != caster && GetSpellInfo()->HasAttribute(SPELL_ATTR2_HEALTH_FUNNEL))
5376 {
5377 uint32 funnelDamage = GetSpellInfo()->ManaPerSecond; // damage is not affected by spell power
5378
5379 if (funnelDamage > healInfo.GetEffectiveHeal() && healInfo.GetEffectiveHeal())
5380 funnelDamage = healInfo.GetEffectiveHeal();
5381
5382 uint32 funnelAbsorb = 0;
5383 Unit::DealDamageMods(caster, funnelDamage, &funnelAbsorb);
5384
5385 if (caster)
5386 caster->SendSpellNonMeleeDamageLog(caster, GetId(), funnelDamage, GetSpellInfo()->GetSchoolMask(), funnelAbsorb, 0, true, 0, false);
5387
5389 Unit::DealDamage(caster, caster, funnelDamage, &cleanDamage, SELF_DAMAGE, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
5390 }
5391
5392 // %-based heal - does not proc auras
5394 return;
5395
5396 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5397 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5398 uint32 hitMask = crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
5399 // ignore item heals
5400 if (!haveCastItem)
5401 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, PROC_SPELL_TYPE_HEAL, PROC_SPELL_PHASE_HIT, hitMask, nullptr, nullptr, &healInfo);
5402}
5403
5405{
5406 Powers powerType = Powers(GetMiscValue());
5407
5408 if (!caster || !caster->IsAlive() || !target->IsAlive() || target->GetPowerType() != powerType)
5409 return;
5410
5412 {
5413 SendTickImmune(target, caster);
5414 return;
5415 }
5416
5418 caster->SpellHitResult(target, GetSpellInfo(), false) != SPELL_MISS_NONE)
5419 return;
5420
5421 // ignore negative values (can be result apply spellmods to aura damage
5422 int32 drainAmount = std::max(GetAmount(), 0);
5423
5424 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
5425 // It's mana percent cost spells, m_amount is percent drain from target
5427 {
5428 // max value
5429 int32 maxmana = CalculatePct(caster->GetMaxPower(powerType), drainAmount * 2.0f);
5430 ApplyPct(drainAmount, target->GetMaxPower(powerType));
5431 if (drainAmount > maxmana)
5432 drainAmount = maxmana;
5433 }
5434
5435 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} power leech of {} for {} dmg inflicted by {}",
5436 GetCasterGUID().ToString(), target->GetGUID().ToString(), drainAmount, GetId());
5437
5438 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
5439 if (powerType == POWER_MANA)
5440 drainAmount -= target->GetSpellCritDamageReduction(drainAmount);
5441
5442 int32 drainedAmount = -target->ModifyPower(powerType, -drainAmount);
5443
5444 float gainMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5445
5446 SpellPeriodicAuraLogInfo pInfo(this, drainedAmount, 0, 0, 0, gainMultiplier, false);
5447 target->SendPeriodicAuraLog(&pInfo);
5448
5449 int32 gainAmount = int32(drainedAmount * gainMultiplier);
5450 int32 gainedAmount = 0;
5451 if (gainAmount)
5452 {
5453 gainedAmount = caster->ModifyPower(powerType, gainAmount);
5454 // energize is not modified by threat modifiers
5455 target->GetThreatManager().AddThreat(caster, float(gainedAmount) * 0.5f, GetSpellInfo(), true);
5456 }
5457
5458 // Drain Mana - Mana Feed effect
5460 {
5461 int32 manaFeedVal = 0;
5462 if (AuraEffect const* aurEff = GetBase()->GetEffect(EFFECT_1))
5463 manaFeedVal = aurEff->GetAmount();
5464
5465 if (manaFeedVal > 0)
5466 {
5467 int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
5468
5469 CastSpellExtraArgs args(this);
5470 args.AddSpellMod(SPELLVALUE_BASE_POINT0, feedAmount);
5471 caster->CastSpell(caster, 32554, args);
5472 }
5473 }
5474}
5475
5477{
5478 Powers powerType;
5479 if (GetMiscValue() == POWER_ALL)
5480 powerType = target->GetPowerType();
5481 else
5482 powerType = Powers(GetMiscValue());
5483
5484 if (!target->IsAlive() || !target->GetMaxPower(powerType))
5485 return;
5486
5487 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5488 {
5489 SendTickImmune(target, caster);
5490 return;
5491 }
5492
5493 // don't regen when permanent aura target has full power
5494 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
5495 return;
5496
5497 // ignore negative values (can be result apply spellmods to aura damage
5498 uint32 amount = std::max(GetAmount(), 0) * target->GetMaxPower(powerType) /100;
5499 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
5500 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
5501
5502 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
5503 target->SendPeriodicAuraLog(&pInfo);
5504
5505 int32 gain = target->ModifyPower(powerType, amount);
5506
5507 if (caster)
5508 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
5509}
5510
5512{
5513 Powers powerType = Powers(GetMiscValue());
5514
5516 return;
5517
5518 if (!target->IsAlive() || !target->GetMaxPower(powerType))
5519 return;
5520
5521 if (target->HasUnitState(UNIT_STATE_ISOLATED))
5522 {
5523 SendTickImmune(target, caster);
5524 return;
5525 }
5526
5527 // don't regen when permanent aura target has full power
5528 if (GetBase()->IsPermanent() && target->GetPower(powerType) == target->GetMaxPower(powerType))
5529 return;
5530
5531 // ignore negative values (can be result apply spellmods to aura damage
5532 int32 amount = std::max(GetAmount(), 0);
5533
5534 SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
5535 target->SendPeriodicAuraLog(&pInfo);
5536
5537 TC_LOG_DEBUG("spells.aura.effect", "PeriodicTick: {} energize {} for {} dmg inflicted by {}",
5538 GetCasterGUID().ToString(), target->GetGUID().ToString(), amount, GetId());
5539
5540 int32 gain = target->ModifyPower(powerType, amount);
5541
5542 if (caster)
5543 target->GetThreatManager().ForwardThreatForAssistingMe(caster, float(gain)*0.5f, GetSpellInfo(), true);
5544}
5545
5547{
5548 Powers powerType = Powers(GetMiscValue());
5549
5550 if (!caster || !target->IsAlive() || target->GetPowerType() != powerType)
5551 return;
5552
5554 {
5555 SendTickImmune(target, caster);
5556 return;
5557 }
5558
5559 // ignore negative values (can be result apply spellmods to aura damage
5560 int32 damage = std::max(GetAmount(), 0);
5561
5562 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
5563 if (powerType == POWER_MANA)
5564 damage -= target->GetSpellCritDamageReduction(damage);
5565
5566 uint32 gain = uint32(-target->ModifyPower(powerType, -damage));
5567
5568 float dmgMultiplier = GetSpellEffectInfo().CalcValueMultiplier(caster);
5569
5570 SpellInfo const* spellProto = GetSpellInfo();
5571 // maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
5572 SpellNonMeleeDamage damageInfo(caster, target, spellProto->Id, spellProto->SchoolMask);
5573 damageInfo.periodicLog = true;
5574 // no SpellDamageBonus for burn mana
5575 caster->CalculateSpellDamageTaken(&damageInfo, int32(gain * dmgMultiplier), spellProto);
5576
5577 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
5578
5579 caster->SendSpellNonMeleeDamageLog(&damageInfo);
5580
5581 // Set trigger flag
5582 uint32 procAttacker = PROC_FLAG_DONE_PERIODIC;
5583 uint32 procVictim = PROC_FLAG_TAKEN_PERIODIC;
5584 uint32 hitMask = createProcHitMask(&damageInfo, SPELL_MISS_NONE);
5585 uint32 spellTypeMask = PROC_SPELL_TYPE_NO_DMG_HEAL;
5586 if (damageInfo.damage)
5587 {
5588 procVictim |= PROC_FLAG_TAKEN_DAMAGE;
5589 spellTypeMask |= PROC_SPELL_TYPE_DAMAGE;
5590 }
5591
5592 caster->DealSpellDamage(&damageInfo, true);
5593
5594 DamageInfo dotDamageInfo(damageInfo, DOT, BASE_ATTACK, hitMask);
5595 Unit::ProcSkillsAndAuras(caster, target, procAttacker, procVictim, spellTypeMask, PROC_SPELL_PHASE_HIT, hitMask, nullptr, &dotDamageInfo, nullptr);
5596}
5597
5599{
5600 int32 const armorMod = GetSpellEffectInfo().CalcValue(caster, &m_baseAmount);
5601 const_cast<AuraEffect*>(this)->SetAmount(target->GetArmor() / armorMod);
5602
5603 target->UpdateAttackPowerAndDamage(false);
5604 target->UpdateAttackPowerAndDamage(true);
5605}
5606
5608{
5609 int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
5610
5611 if (damageLeft <= 0)
5612 aurApp->GetTarget()->RemoveAura(aurApp);
5613 else
5614 SetAmount(damageLeft);
5615}
5616
5618{
5619 Unit* triggerCaster = aurApp->GetTarget();
5620 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
5621
5622 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5623 if (triggerSpellId == 0)
5624 {
5625 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5626 return;
5627 }
5628
5629 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5630 {
5631 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell {} from aura {} proc", triggeredSpellInfo->Id, GetId());
5632 triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo->Id, this);
5633 }
5634 else
5635 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5636}
5637
5639{
5640 Unit* triggerCaster = aurApp->GetTarget();
5641 Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
5642
5643 uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell;
5644 if (triggerSpellId == 0)
5645 {
5646 TC_LOG_WARN("spells.aura.effect.nospell", "AuraEffect::HandleProcTriggerSpellAuraProc: Spell {} [EffectIndex: {}] does not have triggered spell.", GetId(), GetEffIndex());
5647 return;
5648 }
5649
5650 if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId))
5651 {
5652 CastSpellExtraArgs args(this);
5654 triggerCaster->CastSpell(triggerTarget, triggerSpellId, args);
5655 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell {} with value {} from aura {} proc", triggeredSpellInfo->Id, GetAmount(), GetId());
5656 }
5657 else
5658 TC_LOG_ERROR("spells.aura.effect.nospell","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Spell {} has non-existent spell {} in EffectTriggered[{}] and is therefore not triggered.", GetId(), triggerSpellId, GetEffIndex());
5659}
5660
5662{
5663 if (!aurApp)
5664 return;
5665
5666 Unit* target = aurApp->GetTarget();
5667 Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor();
5668 if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo()))
5669 {
5670 SendTickImmune(triggerTarget, target);
5671 return;
5672 }
5673
5674 SpellNonMeleeDamage damageInfo(target, triggerTarget, GetId(), GetSpellInfo()->SchoolMask);
5675 uint32 damage = target->SpellDamageBonusDone(triggerTarget, GetSpellInfo(), GetAmount(), SPELL_DIRECT_DAMAGE, GetSpellEffectInfo(), { });
5676 damage = triggerTarget->SpellDamageBonusTaken(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
5677 target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo());
5678 Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
5679 target->SendSpellNonMeleeDamageLog(&damageInfo);
5680 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering {} spell damage from aura {} proc", damage, GetId());
5681 target->DealSpellDamage(&damageInfo, true);
5682}
5683
5685{
5686 Unit* target = aurApp->GetTarget();
5687
5688 uint32 triggerSpellId;
5689 switch (GetId())
5690 {
5691 case 57949: // Shiver
5692 triggerSpellId = 57952;
5693 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
5694 break;
5695 case 59978: // Shiver
5696 triggerSpellId = 59979;
5697 break;
5698 case 43593: // Cold Stare
5699 triggerSpellId = 43594;
5700 break;
5701 default:
5702 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: {}", GetId());
5703 return;
5704 }
5705
5706 int32 jumps = GetBase()->GetCharges();
5707
5708 // current aura expire on proc finish
5709 GetBase()->SetCharges(0);
5710 GetBase()->SetUsingCharges(true);
5711
5712 // next target selection
5713 if (jumps > 0)
5714 {
5715 if (Unit* caster = GetCaster())
5716 {
5717 float radius = GetSpellEffectInfo().CalcRadius(caster);
5718
5719 if (Unit* triggerTarget = target->GetNextRandomRaidMemberOrPet(radius))
5720 {
5721 target->CastSpell(triggerTarget, GetId(), { this, GetCasterGUID() });
5722 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
5723 aura->SetCharges(jumps);
5724 }
5725 }
5726 }
5727
5728 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
5729 target->CastSpell(target, triggerSpellId, { this, GetCasterGUID() });
5730}
5731
5733{
5734 Unit* target = aurApp->GetTarget();
5735
5736 // Currently only Prayer of Mending
5737 if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20))
5738 {
5739 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: {}", GetId());
5740 return;
5741 }
5742 uint32 triggerSpellId = 33110;
5743
5744 int32 jumps = GetBase()->GetCharges();
5745
5746 // current aura expire on proc finish
5747 GetBase()->SetCharges(0);
5748 GetBase()->SetUsingCharges(true);
5749
5750 CastSpellExtraArgs args(this);
5753
5754 // next target selection
5755 if (jumps > 0)
5756 {
5757 if (Unit* caster = GetCaster())
5758 {
5759 float radius = GetSpellEffectInfo().CalcRadius(caster);
5760
5761 Unit* triggerTarget = nullptr;
5762 Trinity::MostHPMissingGroupInRange u_check(target, radius, 0);
5763 Trinity::UnitLastSearcher<Trinity::MostHPMissingGroupInRange> searcher(target, triggerTarget, u_check);
5764 Cell::VisitAllObjects(target, searcher, radius);
5765
5766 if (triggerTarget)
5767 {
5768 target->CastSpell(triggerTarget, GetId(), args);
5769 if (Aura* aura = triggerTarget->GetAura(GetId(), GetCasterGUID()))
5770 aura->SetCharges(jumps);
5771 }
5772 }
5773 }
5774
5775 TC_LOG_DEBUG("spells.aura.effect", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell {} from aura {} proc", triggerSpellId, GetId());
5776 target->CastSpell(target, triggerSpellId, args);
5777}
5778
5779template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
5780template TC_GAME_API void AuraEffect::GetTargetList(std::deque<Unit*>&) const;
5781template TC_GAME_API void AuraEffect::GetTargetList(std::vector<Unit*>&) const;
5782
5783template TC_GAME_API void AuraEffect::GetApplicationList(std::list<AuraApplication*>&) const;
5784template TC_GAME_API void AuraEffect::GetApplicationList(std::deque<AuraApplication*>&) const;
5785template 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:388
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:567
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:568
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:624
@ PLAYER_FIELD_BYTE2_STEALTH
Definition Player.h:436
@ PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
Definition Player.h:437
@ PLAYER_FIELD_BYTE_TRACK_STEALTHED
Definition Player.h:427
@ PLAYER_FIELD_BYTE_RELEASE_TIMER
Definition Player.h:428
std::unordered_map< uint32, PlayerSpell > PlayerSpellMap
Definition Player.h:178
@ PLAYER_ALLOW_ONLY_ABILITY
Definition Player.h:367
@ PLAYER_FLAGS_GHOST
Definition Player.h:348
#define PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET
Definition Player.h:419
SpellModType
Definition Player.h:121
@ PLAYER_FIELD_BYTES_OFFSET_FLAGS
Definition Player.h:404
@ PLAYERSPELL_REMOVED
Definition Player.h:151
RuneType
Definition Player.h:287
#define INVENTORY_SLOT_BAG_0
Definition Player.h:547
@ PLAYER_FIELD_BYTES_2_OFFSET_AURA_VISION
Definition Player.h:414
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_ALL
@ 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
@ 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_MOD_RANGED_ATTACK_POWER_PCT
@ 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_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_MOD_DAMAGE_FROM_CASTER
@ 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_ATTACK_POWER_PCT
@ 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:10001
@ BASE_VALUE
Definition Unit.h:138
@ TOTAL_VALUE
Definition Unit.h:139
UnitMods
Definition Unit.h:157
@ UNIT_MOD_ARMOR
Definition Unit.h:171
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:178
@ UNIT_MOD_RESISTANCE_START
Definition Unit.h:187
@ UNIT_MOD_HEALTH
Definition Unit.h:163
@ UNIT_MOD_POWER_START
Definition Unit.h:189
@ UNIT_MOD_STAT_START
Definition Unit.h:185
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:179
@ CORPSE
Definition Unit.h:213
@ JUST_DIED
Definition Unit.h:212
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition Unit.h:612
CurrentSpellTypes
Definition Unit.h:605
@ CURRENT_GENERIC_SPELL
Definition Unit.h:607
@ CURRENT_MELEE_SPELL
Definition Unit.h:606
@ UNIT_STATE_DIED
Definition Unit.h:220
@ UNIT_STATE_CONFUSED
Definition Unit.h:231
@ UNIT_STATE_ROOT
Definition Unit.h:230
@ UNIT_STATE_ISOLATED
Definition Unit.h:233
@ UNIT_STATE_FLEEING
Definition Unit.h:227
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ UNIT_STATE_STUNNED
Definition Unit.h:223
@ MELEE_HIT_NORMAL
Definition Unit.h:395
#define MAX_COMBAT_RATING
Definition Unit.h:349
@ SHIELD_BLOCK_VALUE
Definition Unit.h:198
#define CURRENT_MAX_SPELL
Definition Unit.h:613
CombatRating
Definition Unit.h:321
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:338
@ NULL_BAG
Definition Unit.h:61
@ NULL_SLOT
Definition Unit.h:62
@ SELF_DAMAGE
Definition Unit.h:358
@ DOT
Definition Unit.h:355
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:354
@ CHARM_TYPE_CHARM
Definition Unit.h:654
@ CHARM_TYPE_POSSESS
Definition Unit.h:655
@ CHARM_TYPE_CONVERT
Definition Unit.h:657
std::list< Unit * > UnitList
Definition Unit.h:105
@ TOTAL_PCT
Definition Unit.h:146
@ BASE_PCT
Definition Unit.h:145
@ PLAYER_FIELD_MOD_DAMAGE_DONE_POS
@ PLAYER_FAKE_INEBRIATION
@ UNIT_FIELD_POWER_COST_MODIFIER
@ PLAYER_NO_REAGENT_COST_1
@ 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:66
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:80
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:143
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:207
void SetStackAmount(uint8 num)
void CallScriptEffectCalcSpellModHandlers(AuraEffect const *aurEff, SpellModifier *&spellMod)
Unit * GetUnitOwner() const
Definition SpellAuras.h:122
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:209
void SetUsingCharges(bool val)
Definition SpellAuras.h:223
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:119
int32 GetDuration() const
Definition SpellAuras.h:148
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:201
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:164
uint8 GetCharges() const
Definition SpellAuras.h:155
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:115
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:118
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:104
bool IsPermanent() const
Definition SpellAuras.h:153
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool isTappedBy(Player const *player) const
uint8 GetCurrentEquipmentId() const
Definition Creature.h:177
uint32 GetHitMask() const
Definition Unit.cpp:232
uint32 GetResist() const
Definition Unit.h:466
uint32 GetDamage() const
Definition Unit.h:464
uint32 GetAbsorb() const
Definition Unit.h:465
bool HasFlag(FLAG_TYPE flag) const
Definition Object.h:286
void AddFlag(FLAG_TYPE flag)
Definition Object.h:287
void DelFlag(FLAG_TYPE flag)
Definition Object.h:288
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:292
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:291
uint32 GetAbsorb() const
Definition Unit.h:494
uint32 GetEffectiveHeal() const
Definition Unit.h:493
Definition Item.h:62
bool IsDungeon() const
Definition Map.cpp:4236
bool IsBattleground() const
Definition Map.cpp:4267
bool Instanceable() const
Definition Map.cpp:4226
float GetVisibilityRange() const
Definition Map.h:311
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:744
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:90
static Creature * ToCreature(Object *o)
Definition Object.h:186
bool IsPlayer() const
Definition Object.h:179
PackedGuid const & GetPackGUID() const
Definition Object.h:80
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition Object.cpp:684
bool IsInWorld() const
Definition Object.h:73
void ApplyModInt32Value(uint16 index, int32 val, bool apply)
Definition Object.cpp:737
TypeID GetTypeId() const
Definition Object.h:93
void ApplyModByteFlag(uint16 index, uint8 offset, uint8 flag, bool apply)
Definition Object.cpp:853
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:760
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:775
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:89
float GetFloatValue(uint16 index) const
Definition Object.cpp:261
uint32 GetEntry() const
Definition Object.h:81
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:655
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:824
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SetEntry(uint32 entry)
Definition Object.h:82
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:585
static Player * ToPlayer(Object *o)
Definition Object.h:180
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:810
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 UpdateAllSpellCritChances()
void RemoveRunesByAuraEffect(AuraEffect const *aura)
Definition Player.cpp:24392
void UpdateRuneRegen(RuneType rune)
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0, GuidSet const &allowedLooters=GuidSet())
Definition Player.cpp:11621
void UpdateDodgePercentage()
void LeaveBattleground(bool teleportToEntryPoint=true, bool withoutDeserterDebuff=false)
Definition Player.cpp:21955
void UpdateWeaponDependentAuras(WeaponAttackType attackType)
Definition Player.cpp:7527
void HandleBaseModFlatValue(BaseModGroup modGroup, float amount, bool apply)
Definition Player.cpp:4952
void ApplyRatingMod(CombatRating cr, int32 value, bool apply)
Definition Player.cpp:5260
void UpdatePowerRegen(Powers power)
void AddTemporarySpell(uint32 spellId)
Definition Player.cpp:3301
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, bool apply)
Definition Player.cpp:7381
void UpdateBlockPercentage()
bool InBattleground() const
Definition Player.h:1982
void PetSpellInitialize()
Definition Player.cpp:20596
void SetFallInformation(uint32 time, float z)
Definition Player.cpp:24853
void setRegenTimerCount(uint32 time)
Definition Player.h:1405
Pet * GetPet() const
Definition Player.cpp:20286
void RemoveTemporarySpell(uint32 spellId)
Definition Player.cpp:3314
void ApplyItemDependentAuras(Item *item, bool apply)
Definition Player.cpp:7534
void RemoveAmmo()
Definition Player.cpp:11610
WorldSession * GetSession() const
Definition Player.h:1719
void UpdateSpellHitChances()
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9552
void UpdateExpertise(WeaponAttackType attType)
void SetViewpoint(WorldObject *target, bool apply)
Definition Player.cpp:24119
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1534
void InitDataForForm(bool reapplyMods=false)
Definition Player.cpp:21289
uint32 GetRuneCooldown(uint8 index) const
Definition Player.h:2206
void SetBaseModPctValue(BaseModGroup modGroup, float val)
Definition Player.cpp:4987
Battleground * GetBattleground() const
Definition Player.cpp:23049
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const *aura)
Definition Player.cpp:24386
void UpdateAllWeaponDependentCritAuras()
Definition Player.cpp:7521
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition Player.cpp:13856
void SetChampioningFaction(uint32 faction)
Definition Player.h:2242
void UpdateSpellDamageAndHealingBonus()
RuneType GetCurrentRune(uint8 index) const
Definition Player.h:2205
void UpdateMirrorTimers()
Definition Player.cpp:714
void ModifySkillBonus(uint32 skillid, int32 val, bool talent)
Definition Player.cpp:5678
void ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell *spell=nullptr) const
Definition Player.cpp:20807
void SendOnCancelExpectedVehicleRideAura() const
Definition Player.cpp:20590
void ApplyBaseModPctValue(BaseModGroup modGroup, float pct)
Definition Player.cpp:4965
uint8 GetActiveTalentGroup() const
Definition Player.h:1496
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0) const
Definition Player.cpp:13075
uint32 GetGlyph(uint8 group, uint8 slot) const
Definition Player.h:1524
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:6303
void RemovePetAura(PetAura const *petSpell)
Definition Player.cpp:20407
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3853
bool isHonorOrXPTarget(Unit const *victim) const
Definition Player.cpp:23573
void UpdateInvisibilityDrunkDetect()
Definition Player.cpp:897
void UpdateDefenseBonusesMod()
void AddSpellMod(SpellModifier *mod, bool apply)
Definition Player.cpp:20876
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:9989
void UpdateAttackPowerAndDamage(bool ranged=false) override
ReputationMgr & GetReputationMgr()
Definition Player.h:1848
static WeaponAttackType GetAttackBySlot(uint8 slot)
Definition Player.cpp:9654
void UpdateSpellCritChance(uint32 school)
void AddPetAura(PetAura const *petSpell)
Definition Player.cpp:20400
Unit * GetActionTarget() const
Definition Unit.h:509
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:268
Unit * GetActor()
Definition Unit.h:508
DamageInfo * GetDamageInfo() const
Definition Unit.h:519
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:769
int32 ModifyHealth(int32 val)
Definition Unit.cpp:8381
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:716
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:9095
void ClearUnitState(uint32 f)
Definition Unit.h:877
bool IsVehicle() const
Definition Unit.h:887
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype) const
Definition Unit.cpp:7558
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8439
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3561
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3765
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1384
float GetHealthPct() const
Definition Unit.h:921
float m_baseSpellCritChance
Definition Unit.h:1500
virtual void RecalculateObjectScale()
Definition Unit.cpp:10399
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4439
static uint32 SpellCriticalHealingBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition Unit.cpp:7300
Pet * ToPet()
Definition Unit.h:1788
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition Unit.h:1122
void RemoveAurasByShapeShift()
Definition Unit.cpp:4109
void UpdateDamagePctDoneMods(WeaponAttackType attackType)
Definition Unit.cpp:9185
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
void UpdateObjectVisibility(bool forced=true) override
Definition Unit.cpp:12180
ThreatManager & GetThreatManager()
Definition Unit.h:1155
void RestoreFaction()
Definition Unit.cpp:11776
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11256
uint8 GetClass() const
Definition Unit.h:895
void SetVisFlag(UnitVisFlags flags)
Definition Unit.h:1006
bool CanUseAttackType(uint8 attacktype) const
Definition Unit.cpp:2382
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0)
Definition Unit.cpp:4022
uint32 GetClassMask() const
Definition Unit.h:897
bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster) const
Definition Unit.cpp:4547
uint32 GetLastExtraAttackSpell() const
Definition Unit.h:1044
uint32 GetMountDisplayId() const
Definition Unit.h:1014
void UpdateAllDamageDoneMods()
Definition Unit.cpp:9179
void UpdateDisplayPower()
Definition Unit.cpp:5453
static void DealHeal(HealInfo &healInfo)
Definition Unit.cpp:6164
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:780
void UpdateSpeed(UnitMoveType mtype)
Definition Unit.cpp:8523
bool IsPolymorphed() const
Definition Unit.cpp:10378
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1490
void SetFaction(uint32 faction) override
Definition Unit.h:974
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:7334
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2008
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:995
void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val)
Definition Unit.cpp:9075
void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount)
Definition Unit.cpp:9042
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition Unit.cpp:5309
uint32 GetTransformSpell() const
Definition Unit.h:1588
void DealSpellDamage(SpellNonMeleeDamage const *damageInfo, bool durabilityLoss)
Definition Unit.cpp:1109
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition Unit.cpp:1769
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetFeatherFall(bool enable)
Definition Unit.cpp:13463
bool IsPet() const
Definition Unit.h:884
Powers GetPowerType() const
Definition Unit.h:931
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit *victim, uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK, uint8 attackerLevel=0)
Definition Unit.cpp:1585
void Dismount()
Definition Unit.cpp:8234
bool SetHover(bool enable, bool updateAnimTier=true)
Definition Unit.cpp:13503
uint32 GetMaxHealth() const
Definition Unit.h:914
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4359
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1060
bool IsFullHealth() const
Definition Unit.h:916
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:960
bool IsAlive() const
Definition Unit.h:1234
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:4639
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:10627
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:6420
void _ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:12680
float SpellCritChanceTaken(Unit const *caster, SpellInfo const *spellInfo, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType=BASE_ATTACK, bool isPeriodic=false) const
Definition Unit.cpp:7069
void SetHealth(uint32 val)
Definition Unit.cpp:9361
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition Unit.cpp:5185
void RemoveVehicleKit()
Definition Unit.cpp:11808
bool IsStandState() const
Definition Unit.cpp:10357
bool IsGravityDisabled() const
Definition Unit.h:1218
CharmInfo * GetCharmInfo()
Definition Unit.h:1287
void RemoveVisFlag(UnitVisFlags flags)
Definition Unit.h:1007
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:6306
void AddUnitState(uint32 f)
Definition Unit.h:875
float GetTotalAuraMultiplier(AuraType auraType) const
Definition Unit.cpp:4797
void Mount(uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
Definition Unit.cpp:8184
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:6453
Gender GetGender() const
Definition Unit.h:898
virtual void UpdateDamagePhysical(WeaponAttackType attType)
virtual Gender GetNativeGender() const
Definition Unit.h:900
uint32 GetCreatureType() const
Definition Unit.cpp:8940
void SetInstantCast(bool set)
Definition Unit.h:1800
int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const *aurEff, AuraType auraType, bool checkMiscValue=false, int32 miscValue=0) const
Definition Unit.cpp:13753
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask, AuraEffect const *except=nullptr) const
Definition Unit.cpp:4832
bool SetCanFly(bool enable, bool packetOnly=false)
Definition Unit.cpp:13374
float GetTotalAuraMultiplierByMiscValue(AuraType auraType, int32 misc_value) const
Definition Unit.cpp:4862
uint32 GetDisplayId() const
Definition Unit.h:1582
uint32 GetNativeDisplayId() const
Definition Unit.h:1584
virtual void UpdateArmor()=0
bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
Definition Unit.cpp:4505
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:5240
uint32 GetMaxPower(Powers power) const
Definition Unit.h:936
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={})
Definition Unit.cpp:3021
uint32 GetHealth() const
Definition Unit.h:913
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool force=false)
Definition Unit.cpp:9421
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:961
bool IsVisible() const
Definition Unit.cpp:8508
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4542
uint32 GetArmor() const
Definition Unit.h:905
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:12032
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:12152
void StopAttackFaction(uint32 faction_id)
Definition Unit.cpp:13074
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:11666
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition Unit.cpp:11796
bool IsMounted() const
Definition Unit.h:1013
virtual void SetDisplayId(uint32 modelId)
Definition Unit.cpp:10407
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetPowerType(Powers power, bool sendUpdate=true)
Definition Unit.cpp:5408
Unit * GetVictim() const
Definition Unit.h:859
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:7639
DeathState getDeathState() const
Definition Unit.h:1238
ObjectGuid GetChannelObjectGuid() const
Definition Unit.h:1460
float GetTotalAuraMultiplierByMiscMask(AuraType auraType, uint32 misc_mask) const
Definition Unit.cpp:4822
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:10461
void ApplyCastTimePercentMod(float val, bool apply)
Definition Unit.cpp:10647
int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, ObjectGuid const &casterGuid) const
Definition Unit.cpp:12091
void UpdateResistanceBuffModsMod(SpellSchools school)
Definition Unit.cpp:4932
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
void FinishSpell(CurrentSpellTypes spellType, bool ok=true)
Definition Unit.cpp:3051
bool IsInFeralForm() const
Definition Unit.cpp:8969
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit *victim)
Definition Unit.cpp:7257
void _RegisterAuraEffect(AuraEffect *aurEff, bool apply)
Definition Unit.cpp:3552
void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo)
Definition Unit.cpp:5253
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:922
void _EnterVehicle(Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:12576
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
void RestoreDisplayId()
Definition Unit.cpp:10415
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:11489
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.cpp:4415
bool SetWaterWalking(bool enable)
Definition Unit.cpp:13423
virtual void setDeathState(DeathState s)
Definition Unit.cpp:8728
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true)
Definition Unit.cpp:10930
uint32 GetPower(Powers power) const
Definition Unit.h:934
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:5691
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:1576
void HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply)
Definition Unit.cpp:9018
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo const *affectedSpell) const
Definition Unit.cpp:4564
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1338
std::list< AuraEffect * > AuraEffectList
Definition Unit.h:787
void SetInFront(WorldObject const *target)
Definition Unit.cpp:13244
Vehicle * GetVehicleKit() const
Definition Unit.h:1735
float m_modSpellHitChance
Definition Unit.h:1499
Guardian * GetGuardianPet() const
Definition Unit.cpp:5894
void UpdateAllDamagePctDoneMods()
Definition Unit.cpp:9223
bool AttackStop()
Definition Unit.cpp:5645
void SetTransformSpell(uint32 spellid)
Definition Unit.h:1587
void SetShapeshiftForm(ShapeshiftForm form)
Definition Unit.cpp:8964
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:706
void SetMountDisplayId(uint32 mountDisplayId)
Definition Unit.h:1015
uint8 GetRace() const
Definition Unit.h:892
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition Unit.cpp:12239
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype) const
Definition Unit.cpp:6910
void UpdateStatBuffMod(Stats stat)
Definition Unit.cpp:4969
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1476
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:1783
Map * GetMap() const
Definition Object.h:449
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition Object.h:441
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition Object.h:442
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition Object.h:439
Player * GetSpellModOwner() const
Definition Object.cpp:2223
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition Object.h:438
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition Object.h:445
void PlayDirectSound(uint32 soundId, Player *target=nullptr)
Definition Object.cpp:3433
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
Definition Object.cpp:2571
void PlayDistanceSound(uint32 soundId, Player *target=nullptr)
Definition Object.cpp:3425
uint32 GetZoneId() const
Definition Object.h:373
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:444
int32 CalculateSpellDamage(SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr) const
Definition Object.cpp:2248
void ModSpellDurationTime(SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
Definition Object.cpp:2436
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:683
uint32 mitigated_damage
Definition Unit.h:420
float GetPositionZ() const
Definition Position.h:81
SpellModOp op
Definition Player.h:168
SpellModType type
Definition Player.h:169
int32 value
Definition Player.h:171
uint32 spellId
Definition Player.h:173
flag96 mask
Definition Player.h:172
uint32 PresetSpellID[MAX_SHAPESHIFT_SPELLS]