2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include "Database/DatabaseEnv.h"
21 #include "WorldPacket.h"
22 #include "WorldSession.h"
25 #include "UpdateMask.h"
27 #include "ObjectMgr.h"
32 #include "DynamicObject.h"
34 #include "UpdateData.h"
35 #include "ObjectAccessor.h"
36 #include "Policies/SingletonImp.h"
40 #include "BattleGround.h"
41 #include "CreatureAI.h"
42 #include "ScriptCalls.h"
44 #include "GridNotifiers.h"
45 #include "GridNotifiersImpl.h"
48 #define NULL_AURA_SLOT 0xFF
50 pAuraHandler AuraHandler
[TOTAL_AURAS
]=
52 &Aura::HandleNULL
, // 0 SPELL_AURA_NONE
53 &Aura::HandleBindSight
, // 1 SPELL_AURA_BIND_SIGHT
54 &Aura::HandleModPossess
, // 2 SPELL_AURA_MOD_POSSESS
55 &Aura::HandlePeriodicDamage
, // 3 SPELL_AURA_PERIODIC_DAMAGE
56 &Aura::HandleAuraDummy
, // 4 SPELL_AURA_DUMMY
57 &Aura::HandleModConfuse
, // 5 SPELL_AURA_MOD_CONFUSE
58 &Aura::HandleModCharm
, // 6 SPELL_AURA_MOD_CHARM
59 &Aura::HandleModFear
, // 7 SPELL_AURA_MOD_FEAR
60 &Aura::HandlePeriodicHeal
, // 8 SPELL_AURA_PERIODIC_HEAL
61 &Aura::HandleModAttackSpeed
, // 9 SPELL_AURA_MOD_ATTACKSPEED
62 &Aura::HandleModThreat
, // 10 SPELL_AURA_MOD_THREAT
63 &Aura::HandleModTaunt
, // 11 SPELL_AURA_MOD_TAUNT
64 &Aura::HandleAuraModStun
, // 12 SPELL_AURA_MOD_STUN
65 &Aura::HandleModDamageDone
, // 13 SPELL_AURA_MOD_DAMAGE_DONE
66 &Aura::HandleNoImmediateEffect
, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
67 &Aura::HandleNoImmediateEffect
, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
68 &Aura::HandleModStealth
, // 16 SPELL_AURA_MOD_STEALTH
69 &Aura::HandleNoImmediateEffect
, // 17 SPELL_AURA_MOD_STEALTH_DETECT
70 &Aura::HandleInvisibility
, // 18 SPELL_AURA_MOD_INVISIBILITY
71 &Aura::HandleInvisibilityDetect
, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION
72 &Aura::HandleAuraModTotalHealthPercentRegen
, // 20 SPELL_AURA_OBS_MOD_HEALTH
73 &Aura::HandleAuraModTotalManaPercentRegen
, // 21 SPELL_AURA_OBS_MOD_MANA
74 &Aura::HandleAuraModResistance
, // 22 SPELL_AURA_MOD_RESISTANCE
75 &Aura::HandlePeriodicTriggerSpell
, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL
76 &Aura::HandlePeriodicEnergize
, // 24 SPELL_AURA_PERIODIC_ENERGIZE
77 &Aura::HandleAuraModPacify
, // 25 SPELL_AURA_MOD_PACIFY
78 &Aura::HandleAuraModRoot
, // 26 SPELL_AURA_MOD_ROOT
79 &Aura::HandleAuraModSilence
, // 27 SPELL_AURA_MOD_SILENCE
80 &Aura::HandleNoImmediateEffect
, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
81 &Aura::HandleAuraModStat
, // 29 SPELL_AURA_MOD_STAT
82 &Aura::HandleAuraModSkill
, // 30 SPELL_AURA_MOD_SKILL
83 &Aura::HandleAuraModIncreaseSpeed
, // 31 SPELL_AURA_MOD_INCREASE_SPEED
84 &Aura::HandleAuraModIncreaseMountedSpeed
, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
85 &Aura::HandleAuraModDecreaseSpeed
, // 33 SPELL_AURA_MOD_DECREASE_SPEED
86 &Aura::HandleAuraModIncreaseHealth
, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
87 &Aura::HandleAuraModIncreaseEnergy
, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
88 &Aura::HandleAuraModShapeshift
, // 36 SPELL_AURA_MOD_SHAPESHIFT
89 &Aura::HandleAuraModEffectImmunity
, // 37 SPELL_AURA_EFFECT_IMMUNITY
90 &Aura::HandleAuraModStateImmunity
, // 38 SPELL_AURA_STATE_IMMUNITY
91 &Aura::HandleAuraModSchoolImmunity
, // 39 SPELL_AURA_SCHOOL_IMMUNITY
92 &Aura::HandleAuraModDmgImmunity
, // 40 SPELL_AURA_DAMAGE_IMMUNITY
93 &Aura::HandleAuraModDispelImmunity
, // 41 SPELL_AURA_DISPEL_IMMUNITY
94 &Aura::HandleAuraProcTriggerSpell
, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in Unit::ProcDamageAndSpellFor and Unit::HandleProcTriggerSpell
95 &Aura::HandleNoImmediateEffect
, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in Unit::ProcDamageAndSpellFor
96 &Aura::HandleAuraTrackCreatures
, // 44 SPELL_AURA_TRACK_CREATURES
97 &Aura::HandleAuraTrackResources
, // 45 SPELL_AURA_TRACK_RESOURCES
98 &Aura::HandleUnused
, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
99 &Aura::HandleAuraModParryPercent
, // 47 SPELL_AURA_MOD_PARRY_PERCENT
100 &Aura::HandleNULL
, // 48 SPELL_AURA_48 spell Napalm (area damage spell with additional delayed damage effect)
101 &Aura::HandleAuraModDodgePercent
, // 49 SPELL_AURA_MOD_DODGE_PERCENT
102 &Aura::HandleNoImmediateEffect
, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_BONUS
103 &Aura::HandleAuraModBlockPercent
, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
104 &Aura::HandleAuraModCritPercent
, // 52 SPELL_AURA_MOD_CRIT_PERCENT
105 &Aura::HandlePeriodicLeech
, // 53 SPELL_AURA_PERIODIC_LEECH
106 &Aura::HandleModHitChance
, // 54 SPELL_AURA_MOD_HIT_CHANCE
107 &Aura::HandleModSpellHitChance
, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
108 &Aura::HandleAuraTransform
, // 56 SPELL_AURA_TRANSFORM
109 &Aura::HandleModSpellCritChance
, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
110 &Aura::HandleAuraModIncreaseSwimSpeed
, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
111 &Aura::HandleNoImmediateEffect
, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
112 &Aura::HandleAuraModPacifyAndSilence
, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
113 &Aura::HandleAuraModScale
, // 61 SPELL_AURA_MOD_SCALE
114 &Aura::HandlePeriodicHealthFunnel
, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL
115 &Aura::HandleUnused
, // 63 unused (3.0.8a) old SPELL_AURA_PERIODIC_MANA_FUNNEL
116 &Aura::HandlePeriodicManaLeech
, // 64 SPELL_AURA_PERIODIC_MANA_LEECH
117 &Aura::HandleModCastingSpeed
, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
118 &Aura::HandleFeignDeath
, // 66 SPELL_AURA_FEIGN_DEATH
119 &Aura::HandleAuraModDisarm
, // 67 SPELL_AURA_MOD_DISARM
120 &Aura::HandleAuraModStalked
, // 68 SPELL_AURA_MOD_STALKED
121 &Aura::HandleSchoolAbsorb
, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
122 &Aura::HandleUnused
, // 70 SPELL_AURA_EXTRA_ATTACKS Useless, used by only one spell that has only visual effect
123 &Aura::HandleModSpellCritChanceShool
, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
124 &Aura::HandleModPowerCostPCT
, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
125 &Aura::HandleModPowerCost
, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
126 &Aura::HandleNoImmediateEffect
, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
127 &Aura::HandleNoImmediateEffect
, // 75 SPELL_AURA_MOD_LANGUAGE
128 &Aura::HandleFarSight
, // 76 SPELL_AURA_FAR_SIGHT
129 &Aura::HandleModMechanicImmunity
, // 77 SPELL_AURA_MECHANIC_IMMUNITY
130 &Aura::HandleAuraMounted
, // 78 SPELL_AURA_MOUNTED
131 &Aura::HandleModDamagePercentDone
, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
132 &Aura::HandleModPercentStat
, // 80 SPELL_AURA_MOD_PERCENT_STAT
133 &Aura::HandleNoImmediateEffect
, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT
134 &Aura::HandleWaterBreathing
, // 82 SPELL_AURA_WATER_BREATHING
135 &Aura::HandleModBaseResistance
, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
136 &Aura::HandleModRegen
, // 84 SPELL_AURA_MOD_REGEN
137 &Aura::HandleModPowerRegen
, // 85 SPELL_AURA_MOD_POWER_REGEN
138 &Aura::HandleChannelDeathItem
, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
139 &Aura::HandleNoImmediateEffect
, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
140 &Aura::HandleNoImmediateEffect
, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
141 &Aura::HandlePeriodicDamagePCT
, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
142 &Aura::HandleUnused
, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
143 &Aura::HandleNoImmediateEffect
, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
144 &Aura::HandlePreventFleeing
, // 92 SPELL_AURA_PREVENTS_FLEEING
145 &Aura::HandleModUnattackable
, // 93 SPELL_AURA_MOD_UNATTACKABLE
146 &Aura::HandleNoImmediateEffect
, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::RegenerateAll
147 &Aura::HandleAuraGhost
, // 95 SPELL_AURA_GHOST
148 &Aura::HandleNoImmediateEffect
, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::SelectMagnetTarget
149 &Aura::HandleManaShield
, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
150 &Aura::HandleAuraModSkill
, // 98 SPELL_AURA_MOD_SKILL_TALENT
151 &Aura::HandleAuraModAttackPower
, // 99 SPELL_AURA_MOD_ATTACK_POWER
152 &Aura::HandleUnused
, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
153 &Aura::HandleModResistancePercent
, //101 SPELL_AURA_MOD_RESISTANCE_PCT
154 &Aura::HandleNoImmediateEffect
, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
155 &Aura::HandleAuraModTotalThreat
, //103 SPELL_AURA_MOD_TOTAL_THREAT
156 &Aura::HandleAuraWaterWalk
, //104 SPELL_AURA_WATER_WALK
157 &Aura::HandleAuraFeatherFall
, //105 SPELL_AURA_FEATHER_FALL
158 &Aura::HandleAuraHover
, //106 SPELL_AURA_HOVER
159 &Aura::HandleAddModifier
, //107 SPELL_AURA_ADD_FLAT_MODIFIER
160 &Aura::HandleAddModifier
, //108 SPELL_AURA_ADD_PCT_MODIFIER
161 &Aura::HandleAddTargetTrigger
, //109 SPELL_AURA_ADD_TARGET_TRIGGER
162 &Aura::HandleModPowerRegenPCT
, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT
163 &Aura::HandleNoImmediateEffect
, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER implemented in Unit::SelectMagnetTarget
164 &Aura::HandleNoImmediateEffect
, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
165 &Aura::HandleNoImmediateEffect
, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
166 &Aura::HandleNoImmediateEffect
, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
167 &Aura::HandleNoImmediateEffect
, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
168 &Aura::HandleNoImmediateEffect
, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
169 &Aura::HandleNoImmediateEffect
, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
170 &Aura::HandleNoImmediateEffect
, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
171 &Aura::HandleUnused
, //119 unused (3.0.8a) old SPELL_AURA_SHARE_PET_TRACKING
172 &Aura::HandleAuraUntrackable
, //120 SPELL_AURA_UNTRACKABLE
173 &Aura::HandleAuraEmpathy
, //121 SPELL_AURA_EMPATHY
174 &Aura::HandleModOffhandDamagePercent
, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
175 &Aura::HandleModTargetResistance
, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
176 &Aura::HandleAuraModRangedAttackPower
, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
177 &Aura::HandleNoImmediateEffect
, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
178 &Aura::HandleNoImmediateEffect
, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
179 &Aura::HandleNoImmediateEffect
, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
180 &Aura::HandleModPossessPet
, //128 SPELL_AURA_MOD_POSSESS_PET
181 &Aura::HandleAuraModIncreaseSpeed
, //129 SPELL_AURA_MOD_SPEED_ALWAYS
182 &Aura::HandleAuraModIncreaseMountedSpeed
, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
183 &Aura::HandleNoImmediateEffect
, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
184 &Aura::HandleAuraModIncreaseEnergyPercent
, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
185 &Aura::HandleAuraModIncreaseHealthPercent
, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
186 &Aura::HandleAuraModRegenInterrupt
, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
187 &Aura::HandleModHealingDone
, //135 SPELL_AURA_MOD_HEALING_DONE
188 &Aura::HandleNoImmediateEffect
, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus
189 &Aura::HandleModTotalPercentStat
, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
190 &Aura::HandleHaste
, //138 SPELL_AURA_MOD_HASTE
191 &Aura::HandleForceReaction
, //139 SPELL_AURA_FORCE_REACTION
192 &Aura::HandleAuraModRangedHaste
, //140 SPELL_AURA_MOD_RANGED_HASTE
193 &Aura::HandleRangedAmmoHaste
, //141 SPELL_AURA_MOD_RANGED_AMMO_HASTE
194 &Aura::HandleAuraModBaseResistancePCT
, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
195 &Aura::HandleAuraModResistanceExclusive
, //143 SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
196 &Aura::HandleNoImmediateEffect
, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
197 &Aura::HandleAuraModPetTalentsPoints
, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
198 &Aura::HandleNoImmediateEffect
, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
199 &Aura::HandleNULL
, //147 SPELL_AURA_ADD_CREATURE_IMMUNITY
200 &Aura::HandleAuraRetainComboPoints
, //148 SPELL_AURA_RETAIN_COMBO_POINTS
201 &Aura::HandleNoImmediateEffect
, //149 SPELL_AURA_REDUCE_PUSHBACK
202 &Aura::HandleShieldBlockValue
, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
203 &Aura::HandleAuraTrackStealthed
, //151 SPELL_AURA_TRACK_STEALTHED
204 &Aura::HandleNoImmediateEffect
, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
205 &Aura::HandleNoImmediateEffect
, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT
206 &Aura::HandleNoImmediateEffect
, //154 SPELL_AURA_MOD_STEALTH_LEVEL
207 &Aura::HandleNoImmediateEffect
, //155 SPELL_AURA_MOD_WATER_BREATHING
208 &Aura::HandleNoImmediateEffect
, //156 SPELL_AURA_MOD_REPUTATION_GAIN
209 &Aura::HandleNULL
, //157 SPELL_AURA_PET_DAMAGE_MULTI
210 &Aura::HandleShieldBlockValue
, //158 SPELL_AURA_MOD_SHIELD_BLOCKVALUE
211 &Aura::HandleNoImmediateEffect
, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
212 &Aura::HandleNoImmediateEffect
, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemented in Unit::MagicSpellHitResult
213 &Aura::HandleNoImmediateEffect
, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
214 &Aura::HandleAuraPowerBurn
, //162 SPELL_AURA_POWER_BURN_MANA
215 &Aura::HandleNoImmediateEffect
, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE
216 &Aura::HandleUnused
, //164 unused (3.0.8a), only one test spell
217 &Aura::HandleNoImmediateEffect
, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
218 &Aura::HandleAuraModAttackPowerPercent
, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
219 &Aura::HandleAuraModRangedAttackPowerPercent
, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
220 &Aura::HandleNoImmediateEffect
, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
221 &Aura::HandleNoImmediateEffect
, //169 SPELL_AURA_MOD_CRIT_PERCENT_VERSUS implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus
222 &Aura::HandleNULL
, //170 SPELL_AURA_DETECT_AMORE different spells that ignore transformation effects
223 &Aura::HandleAuraModIncreaseSpeed
, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
224 &Aura::HandleAuraModIncreaseMountedSpeed
, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
225 &Aura::HandleUnused
, //173 unused (3.0.8a) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
226 &Aura::HandleModSpellDamagePercentFromStat
, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
227 &Aura::HandleModSpellHealingPercentFromStat
, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
228 &Aura::HandleSpiritOfRedemption
, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
229 &Aura::HandleNULL
, //177 SPELL_AURA_AOE_CHARM
230 &Aura::HandleNoImmediateEffect
, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
231 &Aura::HandleNoImmediateEffect
, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
232 &Aura::HandleNoImmediateEffect
, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
233 &Aura::HandleUnused
, //181 unused (3.0.8a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
234 &Aura::HandleAuraModResistenceOfStatPercent
, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
235 &Aura::HandleNULL
, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746
236 &Aura::HandleNoImmediateEffect
, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
237 &Aura::HandleNoImmediateEffect
, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
238 &Aura::HandleNoImmediateEffect
, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
239 &Aura::HandleNoImmediateEffect
, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
240 &Aura::HandleNoImmediateEffect
, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
241 &Aura::HandleModRating
, //189 SPELL_AURA_MOD_RATING
242 &Aura::HandleNULL
, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
243 &Aura::HandleAuraModUseNormalSpeed
, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
244 &Aura::HandleModMeleeRangedSpeedPct
, //192 SPELL_AURA_HASTE_MELEE
245 &Aura::HandleModCombatSpeedPct
, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
246 &Aura::HandleNULL
, //194 SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL
247 &Aura::HandleNoImmediateEffect
, //195 SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL implement in Unit::CalculateSpellDamage
248 &Aura::HandleNULL
, //196 SPELL_AURA_MOD_COOLDOWN
249 &Aura::HandleNoImmediateEffect
, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
250 &Aura::HandleUnused
, //198 unused (3.0.8a) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
251 &Aura::HandleNoImmediateEffect
, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
252 &Aura::HandleNoImmediateEffect
, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::GiveXP
253 &Aura::HandleAuraAllowFlight
, //201 SPELL_AURA_FLY this aura enable flight mode...
254 &Aura::HandleNoImmediateEffect
, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
255 &Aura::HandleNoImmediateEffect
, //203 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
256 &Aura::HandleNoImmediateEffect
, //204 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
257 &Aura::HandleNULL
, //205 vulnerable to school dmg?
258 &Aura::HandleNULL
, //206 SPELL_AURA_MOD_SPEED_MOUNTED
259 &Aura::HandleAuraModIncreaseFlightSpeed
, //207 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
260 &Aura::HandleAuraModIncreaseFlightSpeed
, //208 SPELL_AURA_MOD_SPEED_FLIGHT, used only in spell: Flight Form (Passive)
261 &Aura::HandleAuraModIncreaseFlightSpeed
, //209 SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
262 &Aura::HandleNULL
, //210 Commentator's Command
263 &Aura::HandleAuraModIncreaseFlightSpeed
, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
264 &Aura::HandleAuraModRangedAttackPowerOfStatPercent
, //212 SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
265 &Aura::HandleNoImmediateEffect
, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
266 &Aura::HandleNULL
, //214 Tamed Pet Passive
267 &Aura::HandleArenaPreparation
, //215 SPELL_AURA_ARENA_PREPARATION
268 &Aura::HandleModCastingSpeed
, //216 SPELL_AURA_HASTE_SPELLS
269 &Aura::HandleUnused
, //217 unused (3.0.8a)
270 &Aura::HandleAuraModRangedHaste
, //218 SPELL_AURA_HASTE_RANGED
271 &Aura::HandleModManaRegen
, //219 SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
272 &Aura::HandleModRatingFromStat
, //220 SPELL_AURA_MOD_RATING_FROM_STAT
273 &Aura::HandleNULL
, //221 ignored
274 &Aura::HandleUnused
, //222 unused (3.0.8a) only for spell 44586 that not used in real spell cast
275 &Aura::HandleNULL
, //223 Cold Stare
276 &Aura::HandleUnused
, //224 unused (3.0.8a)
277 &Aura::HandleNoImmediateEffect
, //225 SPELL_AURA_PRAYER_OF_MENDING
278 &Aura::HandleAuraPeriodicDummy
, //226 SPELL_AURA_PERIODIC_DUMMY
279 &Aura::HandlePeriodicTriggerSpellWithValue
, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
280 &Aura::HandleNoImmediateEffect
, //228 stealth detection
281 &Aura::HandleNULL
, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
282 &Aura::HandleAuraModIncreaseMaxHealth
, //230 Commanding Shout
283 &Aura::HandleNoImmediateEffect
, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
284 &Aura::HandleNoImmediateEffect
, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
285 &Aura::HandleNULL
, //233 set model id to the one of the creature with id m_modifier.m_miscvalue
286 &Aura::HandleNoImmediateEffect
, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
287 &Aura::HandleAuraModDispelResist
, //235 SPELL_AURA_MOD_DISPEL_RESIST implement in Unit::MagicSpellHitResult
288 &Aura::HandleAuraControlVehicle
, //236 SPELL_AURA_CONTROL_VEHICLE
289 &Aura::HandleModSpellDamagePercentFromAttackPower
, //237 SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER implemented in Unit::SpellBaseDamageBonus
290 &Aura::HandleModSpellHealingPercentFromAttackPower
, //238 SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER implemented in Unit::SpellBaseHealingBonus
291 &Aura::HandleAuraModScale
, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
292 &Aura::HandleAuraModExpertise
, //240 SPELL_AURA_MOD_EXPERTISE
293 &Aura::HandleForceMoveForward
, //241 Forces the player to move forward
294 &Aura::HandleUnused
, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING
295 &Aura::HandleNULL
, //243 faction reaction override spells
296 &Aura::HandleComprehendLanguage
, //244 Comprehend language
297 &Aura::HandleNULL
, //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
298 &Aura::HandleNoImmediateEffect
, //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL
299 &Aura::HandleNULL
, //247 target to become a clone of the caster
300 &Aura::HandleNoImmediateEffect
, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
301 &Aura::HandleAuraConvertRune
, //249 SPELL_AURA_CONVERT_RUNE
302 &Aura::HandleAuraModIncreaseHealth
, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
303 &Aura::HandleNULL
, //251 SPELL_AURA_MOD_ENEMY_DODGE
304 &Aura::HandleNULL
, //252 haste all?
305 &Aura::HandleNULL
, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
306 &Aura::HandleNULL
, //254 SPELL_AURA_MOD_DISARM_SHIELD disarm Shield
307 &Aura::HandleNoImmediateEffect
, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
308 &Aura::HandleNoReagentUseAura
, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
309 &Aura::HandleNULL
, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
310 &Aura::HandleNULL
, //258 SPELL_AURA_MOD_SPELL_VISUAL
311 &Aura::HandleNULL
, //259 corrupt healing over time spell
312 &Aura::HandleNoImmediateEffect
, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
313 &Aura::HandlePhase
, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
314 &Aura::HandleNULL
, //262
315 &Aura::HandleNULL
, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
316 &Aura::HandleUnused
, //264 unused (3.0.8a)
317 &Aura::HandleUnused
, //265 unused (3.0.8a)
318 &Aura::HandleUnused
, //266 unused (3.0.8a)
319 &Aura::HandleNoImmediateEffect
, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
320 &Aura::HandleAuraModAttackPowerOfStatPercent
, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
321 &Aura::HandleNULL
, //269 ignore DR effects?
322 &Aura::HandleNULL
, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST
323 &Aura::HandleNoImmediateEffect
, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus
324 &Aura::HandleNULL
, //272 reduce spell cast time?
325 &Aura::HandleNULL
, //273
326 &Aura::HandleNULL
, //274 proc free shot?
327 &Aura::HandleNoImmediateEffect
, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
328 &Aura::HandleNULL
, //276 mod damage % mechanic?
329 &Aura::HandleNoImmediateEffect
, //277 SPELL_AURA_MOD_MAX_AFFECTED_TARGETS Use SpellClassMask for spell select
330 &Aura::HandleNULL
, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
331 &Aura::HandleNULL
, //279 visual effects? 58836 and 57507
332 &Aura::HandleNULL
, //280 SPELL_AURA_MOD_TARGET_ARMOR_PCT
333 &Aura::HandleNULL
, //281 SPELL_AURA_MOD_HONOR_GAIN
334 &Aura::HandleAuraIncreaseBaseHealthPercent
, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
335 &Aura::HandleNoImmediateEffect
, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
336 &Aura::HandleUnused
, //284 not used by any spells (3.08a)
337 &Aura::HandleUnused
, //285 not used by any spells (3.08a)
338 &Aura::HandleUnused
, //286 not used by any spells (3.08a)
339 &Aura::HandleNoImmediateEffect
, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
340 &Aura::HandleUnused
, //288 not used by any spells (3.09) except 1 test spell.
343 static AuraType
const frozenAuraTypes
[] = { SPELL_AURA_MOD_ROOT
, SPELL_AURA_MOD_STUN
, SPELL_AURA_NONE
};
345 Aura::Aura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
, Unit
*caster
, Item
* castItem
) :
346 m_spellmod(NULL
), m_caster_guid(0), m_target(target
), m_castItemGuid(castItem
?castItem
->GetGUID():0),
347 m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT
), m_AuraDRGroup(DIMINISHING_NONE
),
348 m_effIndex(eff
), m_auraSlot(MAX_AURAS
), m_auraFlags(AFLAG_NONE
), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),
349 m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
350 m_isRemovedOnShapeLost(true), m_updated(false), m_in_use(false)
354 assert(spellproto
&& spellproto
== sSpellStore
.LookupEntry( spellproto
->Id
) && "`info` must be pointer to sSpellStore element");
356 m_spellProto
= spellproto
;
358 m_currentBasePoints
= currentBasePoints
? *currentBasePoints
: m_spellProto
->EffectBasePoints
[eff
];
360 m_isPassive
= IsPassiveSpell(GetId());
361 m_positive
= IsPositiveEffect(GetId(), m_effIndex
);
363 m_isSingleTargetAura
= IsSingleTargetSpell(m_spellProto
);
365 m_applyTime
= time(NULL
);
370 m_caster_guid
= target
->GetGUID();
371 damage
= m_currentBasePoints
+1; // stored value-1
372 m_maxduration
= target
->CalculateSpellDuration(m_spellProto
, m_effIndex
, target
);
376 m_caster_guid
= caster
->GetGUID();
378 damage
= caster
->CalculateSpellDamage(m_spellProto
,m_effIndex
,m_currentBasePoints
,target
);
379 m_maxduration
= caster
->CalculateSpellDuration(m_spellProto
, m_effIndex
, target
);
381 if (!damage
&& castItem
&& castItem
->GetItemSuffixFactor())
383 ItemRandomSuffixEntry
const *item_rand_suffix
= sItemRandomSuffixStore
.LookupEntry(abs(castItem
->GetItemRandomPropertyId()));
386 for (int k
=0; k
<3; k
++)
388 SpellItemEnchantmentEntry
const *pEnchant
= sSpellItemEnchantmentStore
.LookupEntry(item_rand_suffix
->enchant_id
[k
]);
391 for (int t
=0; t
<3; t
++)
392 if(pEnchant
->spellid
[t
] == m_spellProto
->Id
)
394 damage
= uint32((item_rand_suffix
->prefix
[k
]*castItem
->GetItemSuffixFactor()) / 10000 );
406 if(m_maxduration
== -1 || m_isPassive
&& m_spellProto
->DurationIndex
== 0)
409 Player
* modOwner
= caster
? caster
->GetSpellModOwner() : NULL
;
411 if(!m_permanent
&& modOwner
)
413 modOwner
->ApplySpellMod(GetId(), SPELLMOD_DURATION
, m_maxduration
);
414 // Get zero duration aura after - need set m_maxduration > 0 for apply/remove aura work
415 if (m_maxduration
<=0)
419 m_duration
= m_maxduration
;
421 sLog
.outDebug("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto
->Id
, m_spellProto
->EffectApplyAuraName
[eff
], m_maxduration
, m_spellProto
->EffectImplicitTargetA
[eff
],damage
);
424 SetModifier(AuraType(m_spellProto
->EffectApplyAuraName
[eff
]), damage
, m_spellProto
->EffectAmplitude
[eff
], m_spellProto
->EffectMiscValue
[eff
]);
426 // Apply periodic time mod
427 if(modOwner
&& m_modifier
.periodictime
)
428 modOwner
->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME
, m_modifier
.periodictime
);
430 // Start periodic on next tick or at aura apply
431 if (!(m_spellProto
->AttributesEx5
& SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY
))
432 m_periodicTimer
+= m_modifier
.periodictime
;
434 m_isDeathPersist
= IsDeathPersistentSpell(m_spellProto
);
436 m_procCharges
= m_spellProto
->procCharges
;
438 modOwner
->ApplySpellMod(GetId(), SPELLMOD_CHARGES
, m_procCharges
);
440 m_isRemovedOnShapeLost
= (m_caster_guid
==m_target
->GetGUID() &&
441 m_spellProto
->Stances
&&
442 !(m_spellProto
->AttributesEx2
& SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT
) &&
443 !(m_spellProto
->Attributes
& SPELL_ATTR_NOT_SHAPESHIFT
));
450 AreaAura::AreaAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
,
451 Unit
*caster
, Item
* castItem
) : Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
)
455 // caster==NULL in constructor args if target==caster in fact
456 Unit
* caster_ptr
= caster
? caster
: target
;
458 m_radius
= GetSpellRadius(sSpellRadiusStore
.LookupEntry(GetSpellProto()->EffectRadiusIndex
[m_effIndex
]));
459 if(Player
* modOwner
= caster_ptr
->GetSpellModOwner())
460 modOwner
->ApplySpellMod(GetId(), SPELLMOD_RADIUS
, m_radius
);
462 switch(spellproto
->Effect
[eff
])
464 case SPELL_EFFECT_APPLY_AREA_AURA_PARTY
:
465 m_areaAuraType
= AREA_AURA_PARTY
;
466 if (target
->GetTypeId() == TYPEID_UNIT
&& ((Creature
*)target
)->isTotem())
467 m_modifier
.m_auraname
= SPELL_AURA_NONE
;
469 case SPELL_EFFECT_APPLY_AREA_AURA_RAID
:
470 m_areaAuraType
= AREA_AURA_RAID
;
471 if (target
->GetTypeId() == TYPEID_UNIT
&& ((Creature
*)target
)->isTotem())
472 m_modifier
.m_auraname
= SPELL_AURA_NONE
;
474 case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
:
475 m_areaAuraType
= AREA_AURA_FRIEND
;
477 case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
:
478 m_areaAuraType
= AREA_AURA_ENEMY
;
479 if (target
== caster_ptr
)
480 m_modifier
.m_auraname
= SPELL_AURA_NONE
; // Do not do any effect on self
482 case SPELL_EFFECT_APPLY_AREA_AURA_PET
:
483 m_areaAuraType
= AREA_AURA_PET
;
485 case SPELL_EFFECT_APPLY_AREA_AURA_OWNER
:
486 m_areaAuraType
= AREA_AURA_OWNER
;
487 if (target
== caster_ptr
)
488 m_modifier
.m_auraname
= SPELL_AURA_NONE
;
491 sLog
.outError("Wrong spell effect in AreaAura constructor");
497 AreaAura::~AreaAura()
501 PersistentAreaAura::PersistentAreaAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
,
502 Unit
*caster
, Item
* castItem
) : Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
)
504 m_isPersistent
= true;
507 PersistentAreaAura::~PersistentAreaAura()
511 SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
,
512 Unit
*caster
, Item
* castItem
) : Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
)
515 m_casters_target_guid
= caster
->GetTypeId()==TYPEID_PLAYER
? ((Player
*)caster
)->GetSelection() : caster
->GetUInt64Value(UNIT_FIELD_TARGET
);
517 m_casters_target_guid
= 0;
520 SingleEnemyTargetAura::~SingleEnemyTargetAura()
524 Unit
* SingleEnemyTargetAura::GetTriggerTarget() const
526 return ObjectAccessor::GetUnit(*m_target
, m_casters_target_guid
);
529 Aura
* CreateAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
, Unit
*caster
, Item
* castItem
)
531 if (IsAreaAuraEffect(spellproto
->Effect
[eff
]))
532 return new AreaAura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
);
534 uint32 triggeredSpellId
= spellproto
->EffectTriggerSpell
[eff
];
536 if(SpellEntry
const* triggeredSpellInfo
= sSpellStore
.LookupEntry(triggeredSpellId
))
537 for (int i
= 0; i
< 3; ++i
)
538 if (triggeredSpellInfo
->EffectImplicitTargetA
[i
] == TARGET_SINGLE_ENEMY
)
539 return new SingleEnemyTargetAura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
);
541 return new Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
);
544 Unit
* Aura::GetCaster() const
546 if(m_caster_guid
==m_target
->GetGUID())
549 //return ObjectAccessor::GetUnit(*m_target,m_caster_guid);
550 //must return caster even if it's in another grid/map
551 Unit
*unit
= ObjectAccessor::GetObjectInWorld(m_caster_guid
, (Unit
*)NULL
);
552 return unit
&& unit
->IsInWorld() ? unit
: NULL
;
555 void Aura::SetModifier(AuraType t
, int32 a
, uint32 pt
, int32 miscValue
)
557 m_modifier
.m_auraname
= t
;
558 m_modifier
.m_amount
= a
;
559 m_modifier
.m_miscvalue
= miscValue
;
560 m_modifier
.periodictime
= pt
;
563 void Aura::Update(uint32 diff
)
572 // GetEffIndex()==0 prevent double/triple apply manaPerSecond/manaPerSecondPerLevel to same spell with many auras
573 // all spells with manaPerSecond/manaPerSecondPerLevel have aura in effect 0
574 if(GetEffIndex()==0 && m_timeCla
<= 0)
576 if(Unit
* caster
= GetCaster())
578 Powers powertype
= Powers(m_spellProto
->powerType
);
579 int32 manaPerSecond
= m_spellProto
->manaPerSecond
+ m_spellProto
->manaPerSecondPerLevel
* caster
->getLevel();
580 m_timeCla
= 1*IN_MILISECONDS
;
583 if(powertype
==POWER_HEALTH
)
584 caster
->ModifyHealth(-manaPerSecond
);
586 caster
->ModifyPower(powertype
,-manaPerSecond
);
592 // Channeled aura required check distance from caster
593 if(IsChanneledSpell(m_spellProto
) && m_caster_guid
!= m_target
->GetGUID())
595 Unit
* caster
= GetCaster();
598 m_target
->RemoveAura(GetId(),GetEffIndex());
605 if (m_spellProto
->EffectRadiusIndex
[GetEffIndex()])
607 radius
= GetSpellRadius(sSpellRadiusStore
.LookupEntry(m_spellProto
->EffectRadiusIndex
[GetEffIndex()]));
608 mod
= SPELLMOD_RADIUS
;
612 radius
= GetSpellMaxRange(sSpellRangeStore
.LookupEntry(m_spellProto
->rangeIndex
));
613 mod
= SPELLMOD_RANGE
;
616 if(Player
* modOwner
= caster
->GetSpellModOwner())
617 modOwner
->ApplySpellMod(GetId(), mod
, radius
,NULL
);
619 if(!caster
->IsWithinDistInMap(m_target
,radius
))
621 m_target
->RemoveAura(GetId(),GetEffIndex());
626 if(m_isPeriodic
&& (m_duration
>= 0 || m_isPassive
|| m_permanent
))
628 m_periodicTimer
-= diff
;
629 if(m_periodicTimer
<= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
631 // update before applying (aura can be removed in TriggerSpell or PeriodicTick calls)
632 m_periodicTimer
+= m_modifier
.periodictime
;
638 void AreaAura::Update(uint32 diff
)
640 // update for the caster of the aura
641 if(m_caster_guid
== m_target
->GetGUID())
643 Unit
* caster
= m_target
;
645 if( !caster
->hasUnitState(UNIT_STAT_ISOLATED
) )
647 Unit
* owner
= caster
->GetCharmerOrOwner();
650 std::list
<Unit
*> targets
;
652 switch(m_areaAuraType
)
654 case AREA_AURA_PARTY
:
656 Group
*pGroup
= NULL
;
658 if (owner
->GetTypeId() == TYPEID_PLAYER
)
659 pGroup
= ((Player
*)owner
)->GetGroup();
663 uint8 subgroup
= ((Player
*)owner
)->GetSubGroup();
664 for(GroupReference
*itr
= pGroup
->GetFirstMember(); itr
!= NULL
; itr
= itr
->next())
666 Player
* Target
= itr
->getSource();
667 if(Target
&& Target
->isAlive() && Target
->GetSubGroup()==subgroup
&& caster
->IsFriendlyTo(Target
))
669 if(caster
->IsWithinDistInMap(Target
, m_radius
))
670 targets
.push_back(Target
);
671 Pet
*pet
= Target
->GetPet();
672 if(pet
&& pet
->isAlive() && caster
->IsWithinDistInMap(pet
, m_radius
))
673 targets
.push_back(pet
);
680 if( owner
!= caster
&& caster
->IsWithinDistInMap(owner
, m_radius
) )
681 targets
.push_back(owner
);
683 Unit
* pet
= caster
->GetPet();
684 if( pet
&& caster
->IsWithinDistInMap(pet
, m_radius
))
685 targets
.push_back(pet
);
691 Group
*pGroup
= NULL
;
693 if (owner
->GetTypeId() == TYPEID_PLAYER
)
694 pGroup
= ((Player
*)owner
)->GetGroup();
698 for(GroupReference
*itr
= pGroup
->GetFirstMember(); itr
!= NULL
; itr
= itr
->next())
700 Player
* Target
= itr
->getSource();
701 if(Target
&& Target
->isAlive() && caster
->IsFriendlyTo(Target
))
703 if(caster
->IsWithinDistInMap(Target
, m_radius
))
704 targets
.push_back(Target
);
705 Pet
*pet
= Target
->GetPet();
706 if(pet
&& pet
->isAlive() && caster
->IsWithinDistInMap(pet
, m_radius
))
707 targets
.push_back(pet
);
714 if( owner
!= caster
&& caster
->IsWithinDistInMap(owner
, m_radius
) )
715 targets
.push_back(owner
);
717 Unit
* pet
= caster
->GetPet();
718 if( pet
&& caster
->IsWithinDistInMap(pet
, m_radius
))
719 targets
.push_back(pet
);
723 case AREA_AURA_FRIEND
:
725 CellPair
p(MaNGOS::ComputeCellPair(caster
->GetPositionX(), caster
->GetPositionY()));
727 cell
.data
.Part
.reserved
= ALL_DISTRICT
;
730 MaNGOS::AnyFriendlyUnitInObjectRangeCheck
u_check(caster
, owner
, m_radius
);
731 MaNGOS::UnitListSearcher
<MaNGOS::AnyFriendlyUnitInObjectRangeCheck
> searcher(caster
,targets
, u_check
);
732 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyFriendlyUnitInObjectRangeCheck
>, WorldTypeMapContainer
> world_unit_searcher(searcher
);
733 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyFriendlyUnitInObjectRangeCheck
>, GridTypeMapContainer
> grid_unit_searcher(searcher
);
734 CellLock
<GridReadGuard
> cell_lock(cell
, p
);
735 cell_lock
->Visit(cell_lock
, world_unit_searcher
, *caster
->GetMap());
736 cell_lock
->Visit(cell_lock
, grid_unit_searcher
, *caster
->GetMap());
739 case AREA_AURA_ENEMY
:
741 CellPair
p(MaNGOS::ComputeCellPair(caster
->GetPositionX(), caster
->GetPositionY()));
743 cell
.data
.Part
.reserved
= ALL_DISTRICT
;
746 MaNGOS::AnyAoETargetUnitInObjectRangeCheck
u_check(caster
, owner
, m_radius
); // No GetCharmer in searcher
747 MaNGOS::UnitListSearcher
<MaNGOS::AnyAoETargetUnitInObjectRangeCheck
> searcher(caster
, targets
, u_check
);
748 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyAoETargetUnitInObjectRangeCheck
>, WorldTypeMapContainer
> world_unit_searcher(searcher
);
749 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyAoETargetUnitInObjectRangeCheck
>, GridTypeMapContainer
> grid_unit_searcher(searcher
);
750 CellLock
<GridReadGuard
> cell_lock(cell
, p
);
751 cell_lock
->Visit(cell_lock
, world_unit_searcher
, *caster
->GetMap());
752 cell_lock
->Visit(cell_lock
, grid_unit_searcher
, *caster
->GetMap());
755 case AREA_AURA_OWNER
:
759 targets
.push_back(owner
);
764 for(std::list
<Unit
*>::iterator tIter
= targets
.begin(); tIter
!= targets
.end(); tIter
++)
766 if((*tIter
)->HasAura(GetId(), m_effIndex
))
769 if(SpellEntry
const *actualSpellInfo
= spellmgr
.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter
)->getLevel()))
771 int32 actualBasePoints
= m_currentBasePoints
;
772 // recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?)
773 if(actualSpellInfo
!= GetSpellProto())
774 actualBasePoints
= actualSpellInfo
->EffectBasePoints
[m_effIndex
];
775 AreaAura
*aur
= new AreaAura(actualSpellInfo
, m_effIndex
, &actualBasePoints
, (*tIter
), caster
, NULL
);
776 aur
->SetAuraDuration(GetAuraDuration());
777 (*tIter
)->AddAura(aur
);
783 else // aura at non-caster
785 Unit
* tmp_target
= m_target
;
786 Unit
* caster
= GetCaster();
787 uint32 tmp_spellId
= GetId(), tmp_effIndex
= m_effIndex
;
789 // WARNING: the aura may get deleted during the update
790 // DO NOT access its members after update!
793 // remove aura if out-of-range from caster (after teleport for example)
794 // or caster is isolated or caster no longer has the aura
795 // or caster is (no longer) friendly
796 bool needFriendly
= (m_areaAuraType
== AREA_AURA_ENEMY
? false : true);
797 if( !caster
|| caster
->hasUnitState(UNIT_STAT_ISOLATED
) ||
798 !caster
->IsWithinDistInMap(tmp_target
, m_radius
) ||
799 !caster
->HasAura(tmp_spellId
, tmp_effIndex
) ||
800 caster
->IsFriendlyTo(tmp_target
) != needFriendly
803 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
805 else if( m_areaAuraType
== AREA_AURA_PARTY
) // check if in same sub group
807 // not check group if target == owner or target == pet
808 if (caster
->GetCharmerOrOwnerGUID() != tmp_target
->GetGUID() && caster
->GetGUID() != tmp_target
->GetCharmerOrOwnerGUID())
810 Player
* check
= caster
->GetCharmerOrOwnerPlayerOrPlayerItself();
812 Group
*pGroup
= check
? check
->GetGroup() : NULL
;
815 Player
* checkTarget
= tmp_target
->GetCharmerOrOwnerPlayerOrPlayerItself();
816 if(!checkTarget
|| !pGroup
->SameSubGroup(check
, checkTarget
))
817 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
820 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
823 else if( m_areaAuraType
== AREA_AURA_RAID
) // TODO: fix me!
825 // not check group if target == owner or target == pet
826 if (caster
->GetCharmerOrOwnerGUID() != tmp_target
->GetGUID() && caster
->GetGUID() != tmp_target
->GetCharmerOrOwnerGUID())
828 Player
* check
= caster
->GetCharmerOrOwnerPlayerOrPlayerItself();
830 Group
*pGroup
= check
? check
->GetGroup() : NULL
;
833 Player
* checkTarget
= tmp_target
->GetCharmerOrOwnerPlayerOrPlayerItself();
835 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
838 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
841 else if( m_areaAuraType
== AREA_AURA_PET
|| m_areaAuraType
== AREA_AURA_OWNER
)
843 if( tmp_target
->GetGUID() != caster
->GetCharmerOrOwnerGUID() )
844 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
849 void PersistentAreaAura::Update(uint32 diff
)
853 // remove the aura if its caster or the dynamic object causing it was removed
854 // or if the target moves too far from the dynamic object
855 Unit
*caster
= GetCaster();
858 DynamicObject
*dynObj
= caster
->GetDynObject(GetId(), GetEffIndex());
861 if (!m_target
->IsWithinDistInMap(dynObj
, dynObj
->GetRadius()))
870 Unit
*tmp_target
= m_target
;
871 uint32 tmp_id
= GetId(), tmp_index
= GetEffIndex();
873 // WARNING: the aura may get deleted during the update
874 // DO NOT access its members after update!
878 tmp_target
->RemoveAura(tmp_id
, tmp_index
);
881 void Aura::ApplyModifier(bool apply
, bool Real
)
883 AuraType aura
= m_modifier
.m_auraname
;
887 (*this.*AuraHandler
[aura
])(apply
,Real
);
891 void Aura::_AddAura()
898 // Second aura if some spell
899 bool secondaura
= false;
900 // Try find slot for aura
901 uint8 slot
= NULL_AURA_SLOT
;
902 // Lookup for some spell auras (and get slot from it)
903 for(uint8 i
= 0; i
< m_effIndex
; i
++)
905 Unit::spellEffectPair spair
= Unit::spellEffectPair(GetId(), i
);
906 for(Unit::AuraMap::const_iterator itr
= m_target
->GetAuras().lower_bound(spair
); itr
!= m_target
->GetAuras().upper_bound(spair
); ++itr
)
908 // allow use single slot only by auras from same caster
909 if(itr
->second
->GetCasterGUID()==GetCasterGUID())
911 slot
= itr
->second
->GetAuraSlot();
920 if (!secondaura
&& m_target
->GetVisibleAurasCount() < MAX_AURAS
)
922 Unit::VisibleAuraMap
const *visibleAuras
= m_target
->GetVisibleAuras();
923 for(uint8 i
= 0; i
< MAX_AURAS
; ++i
)
925 Unit::VisibleAuraMap::const_iterator itr
= visibleAuras
->find(i
);
926 if(itr
== visibleAuras
->end())
929 // update for out of range group members (on 1 slot use)
930 m_target
->UpdateAuraForGroup(slot
);
936 Unit
* caster
= GetCaster();
938 // set infinity cooldown state for spells
939 if(caster
&& caster
->GetTypeId() == TYPEID_PLAYER
)
941 if (m_spellProto
->Attributes
& SPELL_ATTR_DISABLED_WHILE_ACTIVE
)
943 Item
* castItem
= m_castItemGuid
? ((Player
*)caster
)->GetItemByGuid(m_castItemGuid
) : NULL
;
944 ((Player
*)caster
)->AddSpellAndCategoryCooldowns(m_spellProto
,castItem
? castItem
->GetEntry() : 0, NULL
,true);
948 // passive auras (except totem auras) do not get placed in the slots
949 // area auras with SPELL_AURA_NONE are not shown on target
950 if((!m_isPassive
|| (caster
&& caster
->GetTypeId() == TYPEID_UNIT
&& ((Creature
*)caster
)->isTotem())) &&
951 (m_spellProto
->Effect
[GetEffIndex()] != SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
|| m_target
!= caster
))
954 if(slot
< MAX_AURAS
) // slot found send data to client
957 SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_CASTER
| ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION
: AFLAG_NONE
) | (IsPositive() ? AFLAG_POSITIVE
: AFLAG_NEGATIVE
));
958 SetAuraLevel(caster
? caster
->getLevel() : sWorld
.getConfig(CONFIG_MAX_PLAYER_LEVEL
));
959 SendAuraUpdate(false);
962 //*****************************************************
963 // Update target aura state flag (at 1 aura apply)
964 // TODO: Make it easer
965 //*****************************************************
968 // Sitdown on apply aura req seated
969 if (m_spellProto
->AuraInterruptFlags
& AURA_INTERRUPT_FLAG_NOT_SEATED
&& !m_target
->IsSitState())
970 m_target
->SetStandState(UNIT_STAND_STATE_SIT
);
972 // register aura diminishing on apply
973 if (getDiminishGroup() != DIMINISHING_NONE
)
974 m_target
->ApplyDiminishingAura(getDiminishGroup(),true);
976 // Update Seals information
977 if (IsSealSpell(m_spellProto
))
978 m_target
->ModifyAuraState(AURA_STATE_JUDGEMENT
, true);
980 // Conflagrate aura state on Immolate
981 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_WARLOCK
&& m_spellProto
->SpellFamilyFlags
& 4)
982 m_target
->ModifyAuraState(AURA_STATE_IMMOLATE
, true);
984 // Faerie Fire (druid versions)
985 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_DRUID
&& m_spellProto
->SpellFamilyFlags
& 0x0000000000000400LL
)
986 m_target
->ModifyAuraState(AURA_STATE_FAERIE_FIRE
, true);
989 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_WARRIOR
&& m_spellProto
->SpellFamilyFlags
& 0x0004000000000000LL
)
990 m_target
->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH
, true);
992 // Swiftmend state on Regrowth & Rejuvenation
993 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_DRUID
&& m_spellProto
->SpellFamilyFlags
& 0x50 )
994 m_target
->ModifyAuraState(AURA_STATE_SWIFTMEND
, true);
996 // Deadly poison aura state
997 if(m_spellProto
->SpellFamilyName
== SPELLFAMILY_ROGUE
&& m_spellProto
->SpellFamilyFlags
& 0x10000)
998 m_target
->ModifyAuraState(AURA_STATE_DEADLY_POISON
, true);
1000 // Enrage aura state
1001 if(m_spellProto
->Dispel
== DISPEL_ENRAGE
)
1002 m_target
->ModifyAuraState(AURA_STATE_ENRAGE
, true);
1007 void Aura::_RemoveAura()
1009 // Remove all triggered by aura spells vs unlimited duration
1010 // except same aura replace case
1011 if(m_removeMode
!=AURA_REMOVE_BY_STACK
)
1012 CleanupTriggeredSpells();
1014 Unit
* caster
= GetCaster();
1016 if(caster
&& IsPersistent())
1018 DynamicObject
*dynObj
= caster
->GetDynObject(GetId(), GetEffIndex());
1020 dynObj
->RemoveAffected(m_target
);
1023 //passive auras do not get put in slots
1024 // Note: but totem can be not accessible for aura target in time remove (to far for find in grid)
1025 //if(m_isPassive && !(caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem()))
1028 uint8 slot
= GetAuraSlot();
1030 if(slot
>= MAX_AURAS
) // slot not set
1033 if(m_target
->GetVisibleAura(slot
) == 0)
1036 bool lastaura
= true;
1038 // find other aura in same slot (current already removed from list)
1039 for(uint8 i
= 0; i
< 3; i
++)
1041 Unit::spellEffectPair spair
= Unit::spellEffectPair(GetId(), i
);
1042 for(Unit::AuraMap::const_iterator itr
= m_target
->GetAuras().lower_bound(spair
); itr
!= m_target
->GetAuras().upper_bound(spair
); ++itr
)
1044 if(itr
->second
->GetAuraSlot()==slot
)
1054 // only remove icon when the last aura of the spell is removed (current aura already removed from list)
1057 // unregister aura diminishing (and store last time)
1058 if (getDiminishGroup() != DIMINISHING_NONE
)
1059 m_target
->ApplyDiminishingAura(getDiminishGroup(),false);
1062 SetAuraFlags(AFLAG_NONE
);
1064 SendAuraUpdate(true);
1066 // update for out of range group members
1067 m_target
->UpdateAuraForGroup(slot
);
1069 //*****************************************************
1070 // Update target aura state flag (at last aura remove)
1071 //*****************************************************
1072 // Enrage aura state
1073 if(m_spellProto
->Dispel
== DISPEL_ENRAGE
)
1074 m_target
->ModifyAuraState(AURA_STATE_ENRAGE
, false);
1076 uint32 removeState
= 0;
1077 switch(m_spellProto
->SpellFamilyName
)
1079 case SPELLFAMILY_PALADIN
:
1080 if (IsSealSpell(m_spellProto
))
1081 removeState
= AURA_STATE_JUDGEMENT
; // Update Seals information
1083 case SPELLFAMILY_WARLOCK
:
1084 if(m_spellProto
->SpellFamilyFlags
& 4)
1085 removeState
= AURA_STATE_IMMOLATE
; // Conflagrate aura state
1087 case SPELLFAMILY_DRUID
:
1088 if(m_spellProto
->SpellFamilyFlags
& 0x0000000000000400LL
)
1089 removeState
= AURA_STATE_FAERIE_FIRE
; // Faerie Fire (druid versions)
1090 else if(m_spellProto
->SpellFamilyFlags
& 0x50)
1091 removeState
= AURA_STATE_SWIFTMEND
; // Swiftmend aura state
1093 case SPELLFAMILY_WARRIOR
:
1094 if(m_spellProto
->SpellFamilyFlags
& 0x0004000000000000LL
)
1095 removeState
= AURA_STATE_WARRIOR_VICTORY_RUSH
; // Victorious
1097 case SPELLFAMILY_ROGUE
:
1098 if(m_spellProto
->SpellFamilyFlags
& 0x10000)
1099 removeState
= AURA_STATE_DEADLY_POISON
; // Deadly poison aura state
1101 case SPELLFAMILY_HUNTER
:
1102 if(m_spellProto
->SpellFamilyFlags
& 0x1000000000000000LL
)
1103 removeState
= AURA_STATE_FAERIE_FIRE
; // Sting (hunter versions)
1106 // Remove state (but need check other auras for it)
1110 Unit::AuraMap
& Auras
= m_target
->GetAuras();
1111 for(Unit::AuraMap::iterator i
= Auras
.begin(); i
!= Auras
.end(); ++i
)
1113 SpellEntry
const *auraSpellInfo
= (*i
).second
->GetSpellProto();
1114 if(auraSpellInfo
->SpellFamilyName
== m_spellProto
->SpellFamilyName
&&
1115 auraSpellInfo
->SpellFamilyFlags
== m_spellProto
->SpellFamilyFlags
)
1121 // this has been last aura
1123 m_target
->ModifyAuraState(AuraState(removeState
), false);
1126 // reset cooldown state for spells
1127 if(caster
&& caster
->GetTypeId() == TYPEID_PLAYER
)
1129 if ( GetSpellProto()->Attributes
& SPELL_ATTR_DISABLED_WHILE_ACTIVE
)
1130 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
1131 ((Player
*)caster
)->SendCooldownEvent(GetSpellProto());
1136 void Aura::SendAuraUpdate(bool remove
)
1138 WorldPacket
data(SMSG_AURA_UPDATE
);
1139 data
.append(m_target
->GetPackGUID());
1140 data
<< uint8(GetAuraSlot());
1141 data
<< uint32(remove
? 0 : GetId());
1145 m_target
->SendMessageToSet(&data
, true);
1149 uint8 auraFlags
= GetAuraFlags();
1150 data
<< uint8(auraFlags
);
1151 data
<< uint8(GetAuraLevel());
1152 data
<< uint8(m_procCharges
? m_procCharges
: m_stackAmount
);
1154 if(!(auraFlags
& AFLAG_NOT_CASTER
))
1156 data
<< uint8(0); // pguid
1159 if(auraFlags
& AFLAG_DURATION
)
1161 data
<< uint32(GetAuraMaxDuration());
1162 data
<< uint32(GetAuraDuration());
1165 m_target
->SendMessageToSet(&data
, true);
1168 void Aura::SetStackAmount(uint8 stackAmount
)
1170 if (stackAmount
!= m_stackAmount
)
1172 Unit
*target
= GetTarget();
1173 Unit
*caster
= GetCaster();
1174 if (!target
|| !caster
)
1176 m_stackAmount
= stackAmount
;
1177 int32 amount
= m_stackAmount
* caster
->CalculateSpellDamage(m_spellProto
, m_effIndex
, m_currentBasePoints
, target
);
1178 // Reapply if amount change
1179 if (amount
!=m_modifier
.m_amount
)
1181 ApplyModifier(false, true);
1182 m_modifier
.m_amount
= amount
;
1183 ApplyModifier(true, true);
1189 bool Aura::modStackAmount(int32 num
)
1192 if (!m_spellProto
->StackAmount
)
1195 // Modify stack but limit it
1196 int32 stackAmount
= m_stackAmount
+ num
;
1197 if (stackAmount
> m_spellProto
->StackAmount
)
1198 stackAmount
= m_spellProto
->StackAmount
;
1199 else if (stackAmount
<=0) // Last aura from stack removed
1202 return true; // need remove aura
1205 // Update stack amount
1206 SetStackAmount(stackAmount
);
1210 void Aura::RefreshAura()
1212 m_duration
= m_maxduration
;
1213 SendAuraUpdate(false);
1216 bool Aura::isAffectedOnSpell(SpellEntry
const *spell
) const
1218 // Check family name
1219 if (spell
->SpellFamilyName
!= m_spellProto
->SpellFamilyName
)
1221 // Check EffectClassMask
1222 uint32
const *ptr
= getAuraSpellClassMask();
1223 if (((uint64
*)ptr
)[0] & spell
->SpellFamilyFlags
)
1225 if (ptr
[2] & spell
->SpellFamilyFlags2
)
1230 /*********************************************************/
1231 /*** BASIC AURA FUNCTION ***/
1232 /*********************************************************/
1233 void Aura::HandleAddModifier(bool apply
, bool Real
)
1235 if(m_target
->GetTypeId() != TYPEID_PLAYER
|| !Real
)
1238 if(m_modifier
.m_miscvalue
>= MAX_SPELLMOD
)
1243 // Add custom charges for some mod aura
1244 switch (m_spellProto
->Id
)
1246 case 17941: // Shadow Trance
1247 case 22008: // Netherwind Focus
1248 case 31834: // Light's Grace
1249 case 34754: // Clearcasting
1250 case 34936: // Backlash
1251 case 48108: // Hot Streak
1252 case 51124: // Killing Machine
1253 case 54741: // Firestarter
1254 case 57761: // Fireball!
1259 SpellModifier
*mod
= new SpellModifier
;
1260 mod
->op
= SpellModOp(m_modifier
.m_miscvalue
);
1261 mod
->value
= m_modifier
.m_amount
;
1262 mod
->type
= SpellModType(m_modifier
.m_auraname
); // SpellModType value == spell aura types
1263 mod
->spellId
= GetId();
1266 SpellAffectEntry
const *spellAffect
= spellmgr
.GetSpellAffect(GetId(), m_effIndex
);
1268 ptr
= &spellAffect
->SpellClassMask
[0];
1273 case 0: ptr
= &m_spellProto
->EffectSpellClassMaskA
[0]; break;
1274 case 1: ptr
= &m_spellProto
->EffectSpellClassMaskB
[0]; break;
1275 case 2: ptr
= &m_spellProto
->EffectSpellClassMaskC
[0]; break;
1281 mod
->mask
= (uint64
)ptr
[0] | (uint64
)ptr
[1]<<32;
1282 mod
->mask2
= (uint64
)ptr
[2];
1283 mod
->charges
= m_procCharges
;
1288 uint64 spellFamilyMask
= m_spellmod
->mask
;
1290 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
1292 // reapply some passive spells after add/remove related spellmods
1293 if(m_spellProto
->SpellFamilyName
==SPELLFAMILY_WARRIOR
&& (spellFamilyMask
& 0x0000100000000000LL
))
1295 m_target
->RemoveAurasDueToSpell(45471);
1298 m_target
->CastSpell(m_target
,45471,true);
1301 void Aura::HandleAddTargetTrigger(bool apply
, bool /*Real*/)
1303 // Use SpellModifier structure for check
1304 // used only fields:
1305 // spellId, mask, mask2
1308 SpellModifier
*mod
= new SpellModifier
;
1309 mod
->spellId
= GetId();
1312 SpellAffectEntry
const *spellAffect
= spellmgr
.GetSpellAffect(GetId(), m_effIndex
);
1314 ptr
= &spellAffect
->SpellClassMask
[0];
1319 case 0: ptr
= &m_spellProto
->EffectSpellClassMaskA
[0]; break;
1320 case 1: ptr
= &m_spellProto
->EffectSpellClassMaskB
[0]; break;
1321 case 2: ptr
= &m_spellProto
->EffectSpellClassMaskC
[0]; break;
1327 mod
->mask
= (uint64
)ptr
[0] | (uint64
)ptr
[1]<<32;
1328 mod
->mask2
= (uint64
)ptr
[2];
1338 void Aura::TriggerSpell()
1340 Unit
* caster
= GetCaster();
1341 Unit
* target
= GetTriggerTarget();
1343 if(!caster
|| !target
)
1346 // generic casting code with custom spells and target/caster customs
1347 uint32 trigger_spell_id
= GetSpellProto()->EffectTriggerSpell
[m_effIndex
];
1349 SpellEntry
const *triggeredSpellInfo
= sSpellStore
.LookupEntry(trigger_spell_id
);
1350 SpellEntry
const *auraSpellInfo
= GetSpellProto();
1351 uint32 auraId
= auraSpellInfo
->Id
;
1353 // specific code for cases with no trigger spell provided in field
1354 if (triggeredSpellInfo
== NULL
)
1356 switch(auraSpellInfo
->SpellFamilyName
)
1358 case SPELLFAMILY_GENERIC
:
1362 // Firestone Passive (1-5 ranks)
1369 if (caster
->GetTypeId()!=TYPEID_PLAYER
)
1371 Item
* item
= ((Player
*)caster
)->GetWeaponForAttack(BASE_ATTACK
);
1374 uint32 enchant_id
= 0;
1377 case 758: enchant_id
= 1803; break; // Rank 1
1378 case 17945: enchant_id
= 1823; break; // Rank 2
1379 case 17947: enchant_id
= 1824; break; // Rank 3
1380 case 17949: enchant_id
= 1825; break; // Rank 4
1381 case 27252: enchant_id
= 2645; break; // Rank 5
1385 // remove old enchanting before applying new
1386 ((Player
*)caster
)->ApplyEnchantment(item
,TEMP_ENCHANTMENT_SLOT
,false);
1387 item
->SetEnchantment(TEMP_ENCHANTMENT_SLOT
, enchant_id
, m_modifier
.periodictime
+1000, 0);
1388 // add new enchanting
1389 ((Player
*)caster
)->ApplyEnchantment(item
,TEMP_ENCHANTMENT_SLOT
,true);
1392 // // Periodic Mana Burn
1394 // // Polymorphic Ray
1395 // case 6965: break;
1396 // // Fire Nova (1-7 ranks)
1405 // Thaumaturgy Channel
1406 case 9712: trigger_spell_id
= 21029; break;
1407 // // Egan's Blaster
1408 // case 17368: break;
1410 // case 18347: break;
1411 // // Ranshalla Waiting
1412 // case 18953: break;
1414 // case 19695: break;
1415 // // Frostwolf Muzzle DND
1416 // case 21794: break;
1417 // // Alterac Ram Collar DND
1418 // case 21866: break;
1419 // // Celebras Waiting
1420 // case 21916: break;
1421 // Brood Affliction: Bronze
1424 m_target
->CastSpell(m_target
, 23171, true, 0, this);
1428 // case 23184: break;
1432 int32 heal
= caster
->GetMaxHealth() / 10;
1433 caster
->DealHeal(caster
, heal
, auraSpellInfo
);
1435 int32 mana
= caster
->GetMaxPower(POWER_MANA
);
1439 caster
->ModifyPower( POWER_MANA
, mana
);
1440 caster
->SendEnergizeSpellLog(caster
, 23493, mana
, POWER_MANA
);
1444 // // Stoneclaw Totem Passive TEST
1445 // case 23792: break;
1447 // case 24018: break;
1448 // // Mark of Arlokk
1449 // case 24210: break;
1451 // case 24379: break;
1453 // case 24716: break;
1455 // case 24780: break;
1457 // case 24832: break;
1458 // // Shadow Bolt Whirl
1459 // case 24834: break;
1461 // case 24918: break;
1462 // // Mark of Nature
1463 // case 25041: break;
1465 // case 25152: break;
1467 // case 25371: break;
1469 // case 25572: break;
1471 // case 26009: break;
1473 // case 26136: break;
1475 // case 26196: break;
1477 // case 26615: break;
1479 // case 27177: break;
1480 // // Teleport: IF/UC
1481 // case 27601: break;
1482 // // Five Fat Finger Exploding Heart Technique
1483 // case 27673: break;
1485 // case 27746: break;
1486 // // Steam Tank Passive
1487 // case 27747: break;
1491 int32 bpDamage
= target
->GetMaxHealth()*26/100;
1492 caster
->CastCustomSpell(target
,29879,&bpDamage
,NULL
,NULL
,true,NULL
,this);
1496 // case 27819: break;
1497 // // Controller Timer
1498 // case 28095: break;
1500 // case 28096: break;
1501 // // Stalagg Tesla Passive
1502 // case 28097: break;
1503 // // Feugen Tesla Passive
1504 // case 28109: break;
1506 // case 28111: break;
1507 // // Mark of Didier
1508 // case 28114: break;
1509 // // Communique Timer, camp
1510 // case 28346: break;
1512 // case 28522: break;
1514 // case 29519: break;
1515 // Inoculate Nestlewood Owlkin
1517 if(target
->GetTypeId()!=TYPEID_UNIT
)// prevent error reports in case ignored player target
1521 // case 29768: break;
1523 // case 29788: break;
1525 // case 29793: break;
1527 // case 29794: break;
1528 // // Guardian of Icecrown Passive
1529 // case 29897: break;
1530 // Feed Captured Animal
1531 case 29917: trigger_spell_id
= 29916; break;
1533 // case 29946: break;
1535 // case 29947: break;
1536 // // Mind Exhaustion Passive
1537 // case 30025: break;
1538 // // Nether Beam - Serenity
1539 // case 30401: break;
1543 // move loot to player inventory and despawn target
1544 if(caster
->GetTypeId() ==TYPEID_PLAYER
&&
1545 target
->GetTypeId() == TYPEID_UNIT
&&
1546 ((Creature
*)target
)->GetCreatureInfo()->type
== CREATURE_TYPE_GAS_CLOUD
)
1548 Player
* player
= (Player
*)caster
;
1549 Creature
* creature
= (Creature
*)target
;
1550 // missing lootid has been reported on startup - just return
1551 if (!creature
->GetCreatureInfo()->SkinLootId
)
1554 player
->AutoStoreLoot(creature
->GetCreatureInfo()->SkinLootId
,LootTemplates_Skinning
,true);
1556 creature
->setDeathState(JUST_DIED
);
1557 creature
->RemoveCorpse();
1558 creature
->SetHealth(0); // just for nice GM-mode view
1563 case 30576: trigger_spell_id
= 30571; break;
1565 // case 30598: break;
1571 // // Despawn Self - Smoke cloud
1572 // case 31269: break;
1573 // // Time Rift Periodic
1574 // case 31320: break;
1575 // // Corrupt Medivh
1576 // case 31326: break;
1580 m_target
->CastSpell(m_target
,31350,true);
1581 m_target
->DealDamage(m_target
, m_target
->GetHealth(), NULL
, DIRECT_DAMAGE
, SPELL_SCHOOL_MASK_NORMAL
, NULL
, false);
1587 // Summon Elemental after create item
1588 caster
->SummonCreature(17870, 0, 0, 0, caster
->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN
, 0);
1591 // // Bloodmyst Tesla
1592 // case 31611: break;
1594 // case 31944: break;
1596 // case 32236: break;
1598 // case 32686: break;
1600 // case 33401: break;
1602 // case 33563: break;
1603 // // Murmur's Touch
1604 // case 33711: break;
1608 // cast 24 spells 34269-34289, 34314-34316
1609 for(uint32 spell_id
= 34269; spell_id
!= 34290; ++spell_id
)
1610 caster
->CastSpell(m_target
,spell_id
,true);
1611 for(uint32 spell_id
= 34314; spell_id
!= 34317; ++spell_id
)
1612 caster
->CastSpell(m_target
,spell_id
,true);
1616 // case 34480: break;
1618 // case 34683: break;
1619 // // Frostbite Rotate
1620 // case 34748: break;
1622 // case 34821: break;
1623 // // Interrupt Shutdown
1624 // case 35016: break;
1625 // // Interrupt Shutdown
1626 // case 35176: break;
1628 // case 35268: break;
1629 // // Salaadin's Tesla
1630 // case 35515: break;
1631 // // Ethereal Channel (Red)
1632 // case 35518: break;
1634 // case 35879: break;
1635 // // Dark Portal Storm
1636 // case 36018: break;
1638 // case 36056: break;
1639 // // Living Grove Defender Lifespan
1640 // case 36061: break;
1641 // // Professor Dabiri Talks
1642 // case 36064: break;
1643 // // Kael Gaining Power
1644 // case 36091: break;
1645 // // They Must Burn Bomb Aura
1646 // case 36344: break;
1647 // // They Must Burn Bomb Aura (self)
1648 // case 36350: break;
1649 // // Stolen Ravenous Ravager Egg
1650 // case 36401: break;
1651 // // Activated Cannon
1652 // case 36410: break;
1653 // // Stolen Ravenous Ravager Egg
1654 // case 36418: break;
1655 // // Enchanted Weapons
1656 // case 36510: break;
1657 // // Cursed Scarab Periodic
1658 // case 36556: break;
1659 // // Cursed Scarab Despawn Periodic
1660 // case 36561: break;
1662 // case 36573: break;
1663 // // Cannon Charging (platform)
1664 // case 36785: break;
1665 // // Cannon Charging (self)
1666 // case 36860: break;
1668 case 37027: trigger_spell_id
= 37029; break;
1670 // case 37125: break;
1672 // case 37268: break;
1674 // case 37429: break;
1676 // case 37430: break;
1677 // // Karazhan - Chess NPC AI, Snapshot timer
1678 // case 37440: break;
1679 // // Karazhan - Chess NPC AI, action timer
1680 // case 37504: break;
1681 // // Karazhan - Chess: Is Square OCCUPIED aura (DND)
1682 // case 39400: break;
1684 // case 37546: break;
1685 // // Shriveling Gaze
1686 // case 37589: break;
1687 // // Fake Aggro Radius (2 yd)
1688 // case 37815: break;
1689 // // Corrupt Medivh
1690 // case 37853: break;
1694 m_target
->CastSpell(m_target
, 38530, true);
1697 // Absorb Eye of Grillok (Zezzak's Shard)
1700 if(m_target
->GetTypeId() != TYPEID_UNIT
)
1703 caster
->CastSpell(caster
, 38495, true);
1705 Creature
* creatureTarget
= (Creature
*)m_target
;
1707 creatureTarget
->setDeathState(JUST_DIED
);
1708 creatureTarget
->RemoveCorpse();
1709 creatureTarget
->SetHealth(0); // just for nice GM-mode view
1712 // // Magic Sucker Device timer
1713 // case 38672: break;
1714 // // Tomb Guarding Charging
1715 // case 38751: break;
1716 // // Murmur's Touch
1717 // case 38794: break;
1718 // // Activate Nether-wraith Beacon (31742 Nether-wraith Beacon item)
1719 // case 39105: break;
1720 // // Drain World Tree Visual
1721 // case 39140: break;
1722 // // Quest - Dustin's Undead Dragon Visual aura
1723 // case 39259: break;
1724 // // Hellfire - The Exorcism, Jules releases darkness, aura
1725 // case 39306: break;
1727 // case 39346: break;
1728 // // Enchanted Weapons
1729 // case 39489: break;
1730 // // Shadow Bolt Whirl
1731 // case 39630: break;
1732 // // Shadow Bolt Whirl
1733 // case 39634: break;
1734 // // Shadow Inferno
1735 // case 39645: break;
1736 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything,and this only prevents the console spam
1737 case 39857: trigger_spell_id
= 39856; break;
1738 // // Soulgrinder Ritual Visual (Smashed)
1739 // case 39974: break;
1740 // // Simon Game Pre-game timer
1741 // case 40041: break;
1742 // // Knockdown Fel Cannon: The Aggro Check Aura
1743 // case 40113: break;
1745 // case 40157: break;
1746 // // Demon Transform 2
1747 // case 40398: break;
1748 // // Demon Transform 1
1749 // case 40511: break;
1750 // // Ancient Flames
1751 // case 40657: break;
1752 // // Ethereal Ring Cannon: Cannon Aura
1753 // case 40734: break;
1755 // case 40760: break;
1756 // // Random Periodic
1757 // case 40867: break;
1758 // // Prismatic Shield
1759 // case 40879: break;
1760 // // Aura of Desire
1761 // case 41350: break;
1763 // case 41404: break;
1765 // case 41629: break;
1767 // case 42177: break;
1769 // case 42581: break;
1771 // case 42582: break;
1772 // // Return to the Spirit Realm
1773 // case 44035: break;
1774 // // Curse of Boundless Agony
1775 // case 45050: break;
1777 // case 46240: break;
1778 // Personalized Weather
1779 case 46736: trigger_spell_id
= 46737; break;
1780 // // Stay Submerged
1781 // case 46981: break;
1782 // // Dragonblight Ram
1783 // case 47015: break;
1784 // // Party G.R.E.N.A.D.E.
1785 // case 51510: break;
1791 case SPELLFAMILY_MAGE
:
1797 // Here need periodic triger reducing threat spell (or do it manually)
1804 // case SPELLFAMILY_WARRIOR:
1809 // case 23410: break;
1810 // // Corrupted Totems
1811 // case 23425: break;
1817 // case SPELLFAMILY_PRIEST:
1822 // case 32930: break;
1823 // // Fury of the Dreghood Elders
1824 // case 35460: break;
1830 case SPELLFAMILY_DRUID
:
1835 // trigger_spell_id not set and unknown effect triggered in this case, ignoring for while
1838 // Frenzied Regeneration
1844 int32 LifePerRage
= GetModifier()->m_amount
;
1846 int32 lRage
= m_target
->GetPower(POWER_RAGE
);
1847 if(lRage
> 100) // rage stored as rage*10
1849 m_target
->ModifyPower(POWER_RAGE
, -lRage
);
1850 int32 FRTriggerBasePoints
= int32(lRage
*LifePerRage
/10);
1851 m_target
->CastCustomSpell(m_target
,22845,&FRTriggerBasePoints
,NULL
,NULL
,true,NULL
,this);
1860 // case SPELLFAMILY_HUNTER:
1864 // //Frost Trap Aura
1867 // //Rizzle's Frost Trap
1871 // case 19597: // Tame Ice Claw Bear
1872 // case 19676: // Tame Snow Leopard
1873 // case 19677: // Tame Large Crag Boar
1874 // case 19678: // Tame Adult Plainstrider
1875 // case 19679: // Tame Prairie Stalker
1876 // case 19680: // Tame Swoop
1877 // case 19681: // Tame Dire Mottled Boar
1878 // case 19682: // Tame Surf Crawler
1879 // case 19683: // Tame Armored Scorpid
1880 // case 19684: // Tame Webwood Lurker
1881 // case 19685: // Tame Nightsaber Stalker
1882 // case 19686: // Tame Strigid Screecher
1883 // case 30100: // Tame Crazed Dragonhawk
1884 // case 30103: // Tame Elder Springpaw
1885 // case 30104: // Tame Mistbat
1886 // case 30647: // Tame Barbed Crawler
1887 // case 30648: // Tame Greater Timberstrider
1888 // case 30652: // Tame Nightstalker
1895 case SPELLFAMILY_SHAMAN
:
1899 // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
1902 // Need remove self if Lightning Shield not active
1903 Unit::AuraMap
const& auras
= target
->GetAuras();
1904 for(Unit::AuraMap::const_iterator itr
= auras
.begin(); itr
!= auras
.end(); ++itr
)
1906 SpellEntry
const* spell
= itr
->second
->GetSpellProto();
1907 if( spell
->SpellFamilyName
== SPELLFAMILY_SHAMAN
&&
1908 spell
->SpellFamilyFlags
& 0x0000000000000400L
)
1911 target
->RemoveAurasDueToSpell(28820);
1914 // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus)
1918 for(int i
= 0; i
< MAX_TOTEM
; ++i
)
1920 if(!caster
->m_TotemSlot
[i
])
1928 caster
->CastSpell(caster
,38437,true);
1930 caster
->RemoveAurasDueToSpell(38437);
1942 // Reget trigger spell proto
1943 triggeredSpellInfo
= sSpellStore
.LookupEntry(trigger_spell_id
);
1947 // Spell exist but require custom code
1953 // TODO: spell casted by result in correct way mostly
1955 // 1) target show casting at each triggered cast: target don't must show casting animation for any triggered spell
1956 // but must show affect apply like item casting
1957 // 2) maybe aura must be replace by new with accumulative stat mods instead stacking
1959 // prevent cast by triggered auras
1960 if(m_caster_guid
== m_target
->GetGUID())
1963 // stop triggering after each affected stats lost > 90
1964 int32 intelectLoss
= 0;
1965 int32 spiritLoss
= 0;
1967 Unit::AuraList
const& mModStat
= m_target
->GetAurasByType(SPELL_AURA_MOD_STAT
);
1968 for(Unit::AuraList::const_iterator i
= mModStat
.begin(); i
!= mModStat
.end(); ++i
)
1970 if ((*i
)->GetId() == 1010)
1972 switch((*i
)->GetModifier()->m_miscvalue
)
1974 case STAT_INTELLECT
: intelectLoss
+= (*i
)->GetModifier()->m_amount
; break;
1975 case STAT_SPIRIT
: spiritLoss
+= (*i
)->GetModifier()->m_amount
; break;
1981 if(intelectLoss
<= -90 && spiritLoss
<= -90)
1990 caster
->CastCustomSpell(target
, trigger_spell_id
, &m_modifier
.m_amount
, NULL
, NULL
, true, NULL
, this);
1996 // All ok cast by default case
1997 if(triggeredSpellInfo
)
1998 caster
->CastSpell(target
, triggeredSpellInfo
, true, 0, this);
1999 else if(target
->GetTypeId()!=TYPEID_UNIT
|| !Script
->EffectDummyCreature(caster
, GetId(), GetEffIndex(), (Creature
*)target
))
2000 sLog
.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
2003 void Aura::TriggerSpellWithValue()
2005 Unit
* caster
= GetCaster();
2006 Unit
* target
= GetTriggerTarget();
2008 if(!caster
|| !target
)
2011 // generic casting code with custom spells and target/caster customs
2012 uint32 trigger_spell_id
= GetSpellProto()->EffectTriggerSpell
[m_effIndex
];
2013 int32 basepoints0
= this->GetModifier()->m_amount
;
2015 caster
->CastCustomSpell(target
, trigger_spell_id
, &basepoints0
, 0, 0, true, 0, this);
2018 /*********************************************************/
2019 /*** AURA EFFECTS ***/
2020 /*********************************************************/
2022 void Aura::HandleAuraDummy(bool apply
, bool Real
)
2024 // spells required only Real aura add/remove
2028 Unit
* caster
= GetCaster();
2035 case 1515: // Tame beast
2036 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
2037 if( caster
&& m_target
->CanHaveThreatList())
2038 m_target
->AddThreat(caster
, 10.0f
);
2040 case 13139: // net-o-matic
2041 // root to self part of (root_target->charge->root_self sequence
2043 caster
->CastSpell(caster
,13138,true,NULL
,this);
2045 case 39850: // Rocket Blast
2046 if(roll_chance_i(20)) // backfire stun
2047 m_target
->CastSpell(m_target
, 51581, true, NULL
, this);
2049 case 43873: // Headless Horseman Laugh
2050 m_target
->PlayDistanceSound(11965);
2052 case 46354: // Blood Elf Illusion
2055 switch(caster
->getGender())
2058 caster
->CastSpell(m_target
,46356,true,NULL
,this);
2061 caster
->CastSpell(m_target
,46355,true,NULL
,this);
2068 case 46699: // Requires No Ammo
2069 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
2070 ((Player
*)m_target
)->RemoveAmmo(); // not use ammo and not allow use
2075 if ( caster
&& GetSpellProto()->SpellFamilyName
== SPELLFAMILY_SHAMAN
&& (GetSpellProto()->SpellFamilyFlags
& 0x40000000000LL
))
2077 // prevent double apply bonuses
2078 if(m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading())
2079 m_modifier
.m_amount
= caster
->SpellHealingBonus(m_target
, GetSpellProto(), m_modifier
.m_amount
, SPELL_DIRECT_DAMAGE
);
2086 if( m_target
->GetTypeId() == TYPEID_PLAYER
&&
2087 ( GetSpellProto()->Effect
[0]==72 || GetSpellProto()->Effect
[0]==6 &&
2088 ( GetSpellProto()->EffectApplyAuraName
[0]==1 || GetSpellProto()->EffectApplyAuraName
[0]==128 ) ) )
2090 // spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425
2091 ((Player
*)m_target
)->SetFarSightGUID(0);
2092 WorldPacket
data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE
, 0);
2093 ((Player
*)m_target
)->GetSession()->SendPacket(&data
);
2097 if( (IsQuestTameSpell(GetId())) && caster
&& caster
->isAlive() && m_target
->isAlive())
2099 uint32 finalSpelId
= 0;
2102 case 19548: finalSpelId
= 19597; break;
2103 case 19674: finalSpelId
= 19677; break;
2104 case 19687: finalSpelId
= 19676; break;
2105 case 19688: finalSpelId
= 19678; break;
2106 case 19689: finalSpelId
= 19679; break;
2107 case 19692: finalSpelId
= 19680; break;
2108 case 19693: finalSpelId
= 19684; break;
2109 case 19694: finalSpelId
= 19681; break;
2110 case 19696: finalSpelId
= 19682; break;
2111 case 19697: finalSpelId
= 19683; break;
2112 case 19699: finalSpelId
= 19685; break;
2113 case 19700: finalSpelId
= 19686; break;
2114 case 30646: finalSpelId
= 30647; break;
2115 case 30653: finalSpelId
= 30648; break;
2116 case 30654: finalSpelId
= 30652; break;
2117 case 30099: finalSpelId
= 30100; break;
2118 case 30102: finalSpelId
= 30103; break;
2119 case 30105: finalSpelId
= 30104; break;
2123 caster
->CastSpell(m_target
,finalSpelId
,true,NULL
,this);
2129 case 2584: // Waiting to Resurrect
2131 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
2132 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2133 if(BattleGround
*bg
= ((Player
*)m_target
)->GetBattleGround())
2134 bg
->RemovePlayerFromResurrectQueue(m_target
->GetGUID());
2137 case 45934: // Dark Fiend
2139 // Kill target if dispelled
2140 if (m_removeMode
==AURA_REMOVE_BY_DISPEL
)
2141 m_target
->DealDamage(m_target
, m_target
->GetHealth(), NULL
, DIRECT_DAMAGE
, SPELL_SCHOOL_MASK_NORMAL
, NULL
, false);
2144 case 46308: // Burning Winds
2146 // casted only at creatures at spawn
2147 m_target
->CastSpell(m_target
,47287,true,NULL
,this);
2152 if (caster
&& m_removeMode
== AURA_REMOVE_BY_DEATH
)
2154 // Stop caster Arcane Missle chanelling on death
2155 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_MAGE
&&
2156 m_spellProto
->SpellFamilyFlags
&0x0000000000000800LL
)
2158 caster
->InterruptSpell(CURRENT_CHANNELED_SPELL
);
2161 // Stop caster Penance chanelling on death
2162 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_PRIEST
&&
2163 m_spellProto
->SpellFamilyFlags2
& 0x00000080)
2165 caster
->InterruptSpell(CURRENT_CHANNELED_SPELL
);
2172 // AT APPLY & REMOVE
2174 switch(m_spellProto
->SpellFamilyName
)
2176 case SPELLFAMILY_GENERIC
:
2183 uint32 spellId
= 24659;
2184 if (apply
&& caster
)
2186 const SpellEntry
*spell
= sSpellStore
.LookupEntry(spellId
);
2190 for (int i
=0; i
< spell
->StackAmount
; ++i
)
2191 caster
->CastSpell(m_target
, spell
->Id
, true, NULL
, NULL
, GetCasterGUID());
2194 m_target
->RemoveAurasDueToSpell(spellId
);
2197 // Restless Strength
2200 uint32 spellId
= 24662;
2201 if (apply
&& caster
)
2203 const SpellEntry
*spell
= sSpellStore
.LookupEntry(spellId
);
2206 for (int i
=0; i
< spell
->StackAmount
; ++i
)
2207 caster
->CastSpell(m_target
, spell
->Id
, true, NULL
, NULL
, GetCasterGUID());
2210 m_target
->RemoveAurasDueToSpell(spellId
);
2213 //Summon Fire Elemental
2219 Unit
*owner
= caster
->GetOwner();
2220 if (owner
&& owner
->GetTypeId() == TYPEID_PLAYER
)
2223 owner
->CastSpell(owner
,8985,true);
2225 ((Player
*)owner
)->RemovePet(NULL
, PET_SAVE_NOT_IN_SLOT
, true);
2229 //Summon Earth Elemental
2235 Unit
*owner
= caster
->GetOwner();
2236 if (owner
&& owner
->GetTypeId() == TYPEID_PLAYER
)
2239 owner
->CastSpell(owner
,19704,true);
2241 ((Player
*)owner
)->RemovePet(NULL
, PET_SAVE_NOT_IN_SLOT
, true);
2247 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2251 m_target
->PlayDirectSound(14970, (Player
*)m_target
);
2252 // continue in 58205
2254 m_target
->CastSpell(m_target
, 58205, true);
2259 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2263 m_target
->PlayDirectSound(14971, (Player
*)m_target
);
2266 m_target
->PlayDirectSound(14972, (Player
*)m_target
);
2272 case SPELLFAMILY_MAGE
:
2276 case SPELLFAMILY_PRIEST
:
2278 // Pain and Suffering
2279 if( m_spellProto
->SpellIconID
== 2874 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2283 // Reduce backfire damage (dot damage) from Shadow Word: Death
2284 SpellModifier
*mod
= new SpellModifier
;
2285 mod
->op
= SPELLMOD_DOT
;
2286 mod
->value
= m_modifier
.m_amount
;
2287 mod
->type
= SPELLMOD_PCT
;
2288 mod
->spellId
= GetId();
2289 mod
->mask
= 0x0000200000000000LL
;
2293 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2298 case SPELLFAMILY_DRUID
:
2302 case 34246: // Idol of the Emerald Queen
2304 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
2309 SpellModifier
*mod
= new SpellModifier
;
2310 mod
->op
= SPELLMOD_DOT
;
2311 mod
->value
= m_modifier
.m_amount
/7;
2312 mod
->type
= SPELLMOD_FLAT
;
2313 mod
->spellId
= GetId();
2314 mod
->mask
= 0x001000000000LL
;
2320 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2323 case 61336: // Survival Instincts
2327 if (!m_target
->IsInFeralForm())
2330 int32 bp0
= int32(m_target
->GetMaxHealth() * m_modifier
.m_amount
/ 100);
2331 m_target
->CastCustomSpell(m_target
, 50322, &bp0
, NULL
, NULL
, true);
2334 m_target
-> RemoveAurasDueToSpell(50322);
2340 if ( GetSpellProto()->SpellFamilyFlags
& 0x1000000000LL
)
2345 // prevent double apply bonuses
2346 if(m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading())
2347 m_modifier
.m_amount
= caster
->SpellHealingBonus(m_target
, GetSpellProto(), m_modifier
.m_amount
, SPELL_DIRECT_DAMAGE
);
2351 // Final heal only on dispelled or duration end
2352 if ( !(GetAuraDuration() <= 0 || m_removeMode
==AURA_REMOVE_BY_DISPEL
) )
2355 // have a look if there is still some other Lifebloom dummy aura
2356 Unit::AuraList auras
= m_target
->GetAurasByType(SPELL_AURA_DUMMY
);
2357 for(Unit::AuraList::iterator itr
= auras
.begin(); itr
!=auras
.end(); ++itr
)
2358 if((*itr
)->GetSpellProto()->SpellFamilyName
== SPELLFAMILY_DRUID
&&
2359 (*itr
)->GetSpellProto()->SpellFamilyFlags
& 0x1000000000LL
)
2363 if(m_target
->IsInWorld() && m_stackAmount
> 0)
2365 int32 amount
= m_modifier
.m_amount
/ m_stackAmount
;
2366 m_target
->CastCustomSpell(m_target
,33778,&amount
,NULL
,NULL
,true,NULL
,this,GetCasterGUID());
2372 // Predatory Strikes
2373 if(m_target
->GetTypeId()==TYPEID_PLAYER
&& GetSpellProto()->SpellIconID
== 1563)
2375 ((Player
*)m_target
)->UpdateAttackPowerAndDamage();
2380 case SPELLFAMILY_HUNTER
:
2382 // Improved Aspect of the Viper
2383 if( GetId()==38390 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2387 // + effect value for Aspect of the Viper
2388 SpellModifier
*mod
= new SpellModifier
;
2389 mod
->op
= SPELLMOD_EFFECT1
;
2390 mod
->value
= m_modifier
.m_amount
;
2391 mod
->type
= SPELLMOD_FLAT
;
2392 mod
->spellId
= GetId();
2393 mod
->mask
= 0x4000000000000LL
;
2399 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2404 case SPELLFAMILY_SHAMAN
:
2406 // Improved Weapon Totems
2407 if( GetSpellProto()->SpellIconID
== 57 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2411 SpellModifier
*mod
= new SpellModifier
;
2412 mod
->op
= SPELLMOD_EFFECT1
;
2413 mod
->value
= m_modifier
.m_amount
;
2414 mod
->type
= SPELLMOD_PCT
;
2415 mod
->spellId
= GetId();
2419 mod
->mask
= 0x00200000000LL
; // Windfury Totem
2423 mod
->mask
= 0x00400000000LL
; // Flametongue Totem
2431 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2439 if(PetAura
const* petSpell
= spellmgr
.GetPetAura(GetId()))
2442 m_target
->AddPetAura(petSpell
);
2444 m_target
->RemovePetAura(petSpell
);
2448 if(GetEffIndex()==0 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2450 SpellAreaForAreaMapBounds saBounds
= spellmgr
.GetSpellAreaForAuraMapBounds(GetId());
2451 if(saBounds
.first
!= saBounds
.second
)
2454 m_target
->GetZoneAndAreaId(zone
,area
);
2456 for(SpellAreaForAreaMap::const_iterator itr
= saBounds
.first
; itr
!= saBounds
.second
; ++itr
)
2458 // some auras remove at aura remove
2459 if(!itr
->second
->IsFitToRequirements((Player
*)m_target
,zone
,area
))
2460 m_target
->RemoveAurasDueToSpell(itr
->second
->spellId
);
2461 // some auras applied at aura apply
2462 else if(itr
->second
->autocast
)
2464 if( !m_target
->HasAura(itr
->second
->spellId
,0) )
2465 m_target
->CastSpell(m_target
,itr
->second
->spellId
,true);
2472 void Aura::HandleAuraMounted(bool apply
, bool Real
)
2474 // only at real add/remove aura
2480 CreatureInfo
const* ci
= objmgr
.GetCreatureTemplate(m_modifier
.m_miscvalue
);
2483 sLog
.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier
.m_miscvalue
);
2488 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
2489 team
= ((Player
*)m_target
)->GetTeam();
2491 uint32 display_id
= objmgr
.ChooseDisplayId(team
,ci
);
2492 CreatureModelInfo
const *minfo
= objmgr
.GetCreatureModelRandomGender(display_id
);
2494 display_id
= minfo
->modelid
;
2496 m_target
->Mount(display_id
);
2500 m_target
->Unmount();
2504 void Aura::HandleAuraWaterWalk(bool apply
, bool Real
)
2506 // only at real add/remove aura
2512 data
.Initialize(SMSG_MOVE_WATER_WALK
, 8+4);
2514 data
.Initialize(SMSG_MOVE_LAND_WALK
, 8+4);
2515 data
.append(m_target
->GetPackGUID());
2517 m_target
->SendMessageToSet(&data
,true);
2520 void Aura::HandleAuraFeatherFall(bool apply
, bool Real
)
2522 // only at real add/remove aura
2528 data
.Initialize(SMSG_MOVE_FEATHER_FALL
, 8+4);
2530 data
.Initialize(SMSG_MOVE_NORMAL_FALL
, 8+4);
2531 data
.append(m_target
->GetPackGUID());
2533 m_target
->SendMessageToSet(&data
,true);
2536 void Aura::HandleAuraHover(bool apply
, bool Real
)
2538 // only at real add/remove aura
2544 data
.Initialize(SMSG_MOVE_SET_HOVER
, 8+4);
2546 data
.Initialize(SMSG_MOVE_UNSET_HOVER
, 8+4);
2547 data
.append(m_target
->GetPackGUID());
2549 m_target
->SendMessageToSet(&data
,true);
2552 void Aura::HandleWaterBreathing(bool /*apply*/, bool /*Real*/)
2554 // update timers in client
2555 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
2556 ((Player
*)m_target
)->UpdateMirrorTimers();
2559 void Aura::HandleAuraModShapeshift(bool apply
, bool Real
)
2565 Powers PowerType
= POWER_MANA
;
2566 ShapeshiftForm form
= ShapeshiftForm(m_modifier
.m_miscvalue
);
2570 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2574 PowerType
= POWER_ENERGY
;
2580 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2586 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2590 PowerType
= POWER_RAGE
;
2593 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2597 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2601 PowerType
= POWER_RAGE
;
2603 case FORM_CREATUREBEAR
:
2606 case FORM_GHOSTWOLF
:
2610 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2616 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2621 case FORM_FLIGHT_EPIC
:
2622 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2627 case FORM_METAMORPHOSIS
:
2637 case FORM_BATTLESTANCE
:
2638 case FORM_BERSERKERSTANCE
:
2639 case FORM_DEFENSIVESTANCE
:
2640 PowerType
= POWER_RAGE
;
2642 case FORM_SPIRITOFREDEMPTION
:
2646 sLog
.outError("Auras: Unknown Shapeshift Type: %u", m_modifier
.m_miscvalue
);
2649 // remove polymorph before changing display id to keep new display id
2658 case FORM_FLIGHT_EPIC
:
2661 // remove movement affects
2662 m_target
->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT
);
2663 m_target
->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED
);
2665 // and polymorphic affects
2666 if(m_target
->IsPolymorphed())
2667 m_target
->RemoveAurasDueToSpell(m_target
->getTransForm());
2675 // remove other shapeshift before applying a new one
2676 if(m_target
->m_ShapeShiftFormSpellId
)
2677 m_target
->RemoveAurasDueToSpell(m_target
->m_ShapeShiftFormSpellId
,this);
2679 m_target
->SetByteValue(UNIT_FIELD_BYTES_2
, 3, form
);
2682 m_target
->SetDisplayId(modelid
);
2684 if(PowerType
!= POWER_MANA
)
2686 // reset power to default values only at power change
2687 if(m_target
->getPowerType()!=PowerType
)
2688 m_target
->setPowerType(PowerType
);
2696 // get furor proc chance
2697 uint32 FurorChance
= 0;
2698 Unit::AuraList
const& mDummy
= m_target
->GetAurasByType(SPELL_AURA_DUMMY
);
2699 for(Unit::AuraList::const_iterator i
= mDummy
.begin(); i
!= mDummy
.end(); ++i
)
2701 if ((*i
)->GetSpellProto()->SpellIconID
== 238)
2703 FurorChance
= (*i
)->GetModifier()->m_amount
;
2708 if (m_modifier
.m_miscvalue
== FORM_CAT
)
2710 m_target
->SetPower(POWER_ENERGY
,0);
2711 if(urand(1,100) <= FurorChance
)
2712 m_target
->CastSpell(m_target
,17099,true,NULL
,this);
2716 m_target
->SetPower(POWER_RAGE
,0);
2717 if(urand(1,100) <= FurorChance
)
2718 m_target
->CastSpell(m_target
,17057,true,NULL
,this);
2722 case FORM_BATTLESTANCE
:
2723 case FORM_DEFENSIVESTANCE
:
2724 case FORM_BERSERKERSTANCE
:
2726 uint32 Rage_val
= 0;
2727 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2728 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2730 PlayerSpellMap
const& sp_list
= ((Player
*)m_target
)->GetSpellMap();
2731 for (PlayerSpellMap::const_iterator itr
= sp_list
.begin(); itr
!= sp_list
.end(); ++itr
)
2733 if(itr
->second
->state
== PLAYERSPELL_REMOVED
) continue;
2734 SpellEntry
const *spellInfo
= sSpellStore
.LookupEntry(itr
->first
);
2735 if (spellInfo
&& spellInfo
->SpellFamilyName
== SPELLFAMILY_WARRIOR
&& spellInfo
->SpellIconID
== 139)
2736 Rage_val
+= m_target
->CalculateSpellDamage(spellInfo
,0,spellInfo
->EffectBasePoints
[0],m_target
) * 10;
2740 if (m_target
->GetPower(POWER_RAGE
) > Rage_val
)
2741 m_target
->SetPower(POWER_RAGE
,Rage_val
);
2749 m_target
->m_ShapeShiftFormSpellId
= GetId();
2750 m_target
->m_form
= form
;
2755 m_target
->SetDisplayId(m_target
->GetNativeDisplayId());
2756 m_target
->SetByteValue(UNIT_FIELD_BYTES_2
, 3, FORM_NONE
);
2757 if(m_target
->getClass() == CLASS_DRUID
)
2758 m_target
->setPowerType(POWER_MANA
);
2759 m_target
->m_ShapeShiftFormSpellId
= 0;
2760 m_target
->m_form
= FORM_NONE
;
2764 // Nordrassil Harness - bonus
2768 if(Aura
* dummy
= m_target
->GetDummyAura(37315) )
2769 m_target
->CastSpell(m_target
,37316,true,NULL
,dummy
);
2771 // Nordrassil Regalia - bonus
2773 if(Aura
* dummy
= m_target
->GetDummyAura(37324) )
2774 m_target
->CastSpell(m_target
,37325,true,NULL
,dummy
);
2781 // adding/removing linked auras
2782 // add/remove the shapeshift aura's boosts
2783 HandleShapeshiftBoosts(apply
);
2785 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
2786 ((Player
*)m_target
)->InitDataForForm();
2789 void Aura::HandleAuraTransform(bool apply
, bool Real
)
2793 // special case (spell specific functionality)
2794 if (m_modifier
.m_miscvalue
==0)
2796 // player applied only
2797 if (m_target
->GetTypeId()!=TYPEID_PLAYER
)
2805 uint32 orb_model
= m_target
->GetNativeDisplayId();
2809 case 1479: m_target
->SetDisplayId(10134); break;
2811 case 1478: m_target
->SetDisplayId(10135); break;
2813 case 59: m_target
->SetDisplayId(10136); break;
2815 case 49: m_target
->SetDisplayId(10137); break;
2817 case 50: m_target
->SetDisplayId(10138); break;
2819 case 51: m_target
->SetDisplayId(10139); break;
2821 case 52: m_target
->SetDisplayId(10140); break;
2823 case 53: m_target
->SetDisplayId(10141); break;
2825 case 54: m_target
->SetDisplayId(10142); break;
2827 case 55: m_target
->SetDisplayId(10143); break;
2829 case 56: m_target
->SetDisplayId(10144); break;
2831 case 58: m_target
->SetDisplayId(10145); break;
2833 case 57: m_target
->SetDisplayId(10146); break;
2835 case 60: m_target
->SetDisplayId(10147); break;
2837 case 1563: m_target
->SetDisplayId(10148); break;
2839 case 1564: m_target
->SetDisplayId(10149); break;
2841 case 15475: m_target
->SetDisplayId(17830); break;
2843 case 15476: m_target
->SetDisplayId(17829); break;
2845 case 16126: m_target
->SetDisplayId(17828); break;
2847 case 16125: m_target
->SetDisplayId(17827); break;
2853 case 42365: m_target
->SetDisplayId(21723); break;
2859 CreatureInfo
const * ci
= objmgr
.GetCreatureTemplate(m_modifier
.m_miscvalue
);
2863 m_target
->SetDisplayId(16358);
2864 sLog
.outError("Auras: unknown creature id = %d (only need its modelid) Form Spell Aura Transform in Spell ID = %d", m_modifier
.m_miscvalue
, GetId());
2868 // Will use the default model here
2869 m_target
->SetDisplayId(ci
->DisplayID_A
);
2871 // Dragonmaw Illusion (set mount model also)
2872 if(GetId()==42016 && m_target
->GetMountID() && !m_target
->GetAurasByType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
).empty())
2873 m_target
->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
,16314);
2877 // update active transform spell only not set or not overwriting negative by positive case
2878 if (!m_target
->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(m_target
->getTransForm()))
2879 m_target
->setTransForm(GetId());
2882 if (Real
&& m_target
->GetTypeId() == TYPEID_PLAYER
&& m_target
->IsPolymorphed())
2884 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2885 // only if caster is Player (after patch 2.4.2)
2886 if (IS_PLAYER_GUID(GetCasterGUID()) )
2887 ((Player
*)m_target
)->setRegenTimer(1*IN_MILISECONDS
);
2889 //dismount polymorphed target (after patch 2.4.2)
2890 if (m_target
->IsMounted())
2891 m_target
->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED
);
2896 // ApplyModifier(true) will reapply it if need
2897 m_target
->setTransForm(0);
2898 m_target
->SetDisplayId(m_target
->GetNativeDisplayId());
2900 // re-aplly some from still active with preference negative cases
2901 Unit::AuraList
const& otherTransforms
= m_target
->GetAurasByType(SPELL_AURA_TRANSFORM
);
2902 if (!otherTransforms
.empty())
2904 // look for other transform auras
2905 Aura
* handledAura
= *otherTransforms
.begin();
2906 for(Unit::AuraList::const_iterator i
= otherTransforms
.begin();i
!= otherTransforms
.end(); ++i
)
2908 // negative auras are preferred
2909 if (!IsPositiveSpell((*i
)->GetSpellProto()->Id
))
2915 handledAura
->ApplyModifier(true);
2918 // Dragonmaw Illusion (restore mount model)
2919 if (GetId()==42016 && m_target
->GetMountID()==16314)
2921 if (!m_target
->GetAurasByType(SPELL_AURA_MOUNTED
).empty())
2923 uint32 cr_id
= m_target
->GetAurasByType(SPELL_AURA_MOUNTED
).front()->GetModifier()->m_miscvalue
;
2924 if (CreatureInfo
const* ci
= objmgr
.GetCreatureTemplate(cr_id
))
2927 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
2928 team
= ((Player
*)m_target
)->GetTeam();
2930 uint32 display_id
= objmgr
.ChooseDisplayId(team
,ci
);
2931 CreatureModelInfo
const *minfo
= objmgr
.GetCreatureModelRandomGender(display_id
);
2933 display_id
= minfo
->modelid
;
2935 m_target
->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
,display_id
);
2942 void Aura::HandleForceReaction(bool apply
, bool Real
)
2944 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
2950 Player
* player
= (Player
*)m_target
;
2952 uint32 faction_id
= m_modifier
.m_miscvalue
;
2953 uint32 faction_rank
= m_modifier
.m_amount
;
2955 player
->GetReputationMgr().ApplyForceReaction(faction_id
,ReputationRank(faction_rank
),apply
);
2956 player
->GetReputationMgr().SendForceReactions();
2959 void Aura::HandleAuraModSkill(bool apply
, bool /*Real*/)
2961 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
2964 uint32 prot
=GetSpellProto()->EffectMiscValue
[m_effIndex
];
2965 int32 points
= GetModifier()->m_amount
;
2967 ((Player
*)m_target
)->ModifySkillBonus(prot
,(apply
? points
: -points
),m_modifier
.m_auraname
==SPELL_AURA_MOD_SKILL_TALENT
);
2968 if(prot
== SKILL_DEFENSE
)
2969 ((Player
*)m_target
)->UpdateDefenseBonusesMod();
2972 void Aura::HandleChannelDeathItem(bool apply
, bool Real
)
2976 Unit
* caster
= GetCaster();
2977 Unit
* victim
= GetTarget();
2978 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
|| !victim
|| m_removeMode
!=AURA_REMOVE_BY_DEATH
)
2981 if (m_modifier
.m_amount
<= 0)
2984 SpellEntry
const *spellInfo
= GetSpellProto();
2985 if(spellInfo
->EffectItemType
[m_effIndex
] == 0)
2988 // Soul Shard only from non-grey units
2989 if( spellInfo
->EffectItemType
[m_effIndex
] == 6265 &&
2990 (victim
->getLevel() <= MaNGOS::XP::GetGrayLevel(caster
->getLevel()) ||
2991 victim
->GetTypeId()==TYPEID_UNIT
&& !((Player
*)caster
)->isAllowedToLoot((Creature
*)victim
)) )
2994 uint32 noSpaceForCount
= 0;
2995 uint32 count
= m_modifier
.m_amount
;
2997 ItemPosCountVec dest
;
2998 uint8 msg
= ((Player
*)caster
)->CanStoreNewItem( NULL_BAG
, NULL_SLOT
, dest
, spellInfo
->EffectItemType
[m_effIndex
], count
, &noSpaceForCount
);
2999 if( msg
!= EQUIP_ERR_OK
)
3001 count
-=noSpaceForCount
;
3002 ((Player
*)caster
)->SendEquipError( msg
, NULL
, NULL
);
3007 Item
* newitem
= ((Player
*)caster
)->StoreNewItem(dest
, spellInfo
->EffectItemType
[m_effIndex
], true);
3008 ((Player
*)caster
)->SendNewItem(newitem
, count
, true, false);
3012 void Aura::HandleBindSight(bool apply
, bool /*Real*/)
3014 Unit
* caster
= GetCaster();
3015 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
)
3018 ((Player
*)caster
)->SetFarSightGUID(apply
? m_target
->GetGUID() : 0);
3021 void Aura::HandleFarSight(bool apply
, bool /*Real*/)
3023 Unit
* caster
= GetCaster();
3024 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
)
3027 ((Player
*)caster
)->SetFarSightGUID(apply
? m_target
->GetGUID() : 0);
3030 void Aura::HandleAuraTrackCreatures(bool apply
, bool /*Real*/)
3032 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
3036 m_target
->RemoveNoStackAurasDueToAura(this);
3037 m_target
->SetUInt32Value(PLAYER_TRACK_CREATURES
, apply
? ((uint32
)1)<<(m_modifier
.m_miscvalue
-1) : 0 );
3040 void Aura::HandleAuraTrackResources(bool apply
, bool /*Real*/)
3042 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
3046 m_target
->RemoveNoStackAurasDueToAura(this);
3047 m_target
->SetUInt32Value(PLAYER_TRACK_RESOURCES
, apply
? ((uint32
)1)<<(m_modifier
.m_miscvalue
-1): 0 );
3050 void Aura::HandleAuraTrackStealthed(bool apply
, bool /*Real*/)
3052 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
3056 m_target
->RemoveNoStackAurasDueToAura(this);
3058 m_target
->ApplyModFlag(PLAYER_FIELD_BYTES
,PLAYER_FIELD_BYTE_TRACK_STEALTHED
,apply
);
3061 void Aura::HandleAuraModScale(bool apply
, bool /*Real*/)
3063 m_target
->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X
,m_modifier
.m_amount
,apply
);
3066 void Aura::HandleModPossess(bool apply
, bool Real
)
3071 if(m_target
->getLevel() > m_modifier
.m_amount
)
3074 // not possess yourself
3075 if(GetCasterGUID() == m_target
->GetGUID())
3078 Unit
* caster
= GetCaster();
3084 m_target
->SetCharmerGUID(GetCasterGUID());
3085 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,caster
->getFaction());
3087 caster
->SetCharm(m_target
);
3089 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3091 ((Player
*)caster
)->SetFarSightGUID(m_target
->GetGUID());
3092 ((Player
*)caster
)->SetClientControl(m_target
, 1);
3095 m_target
->CombatStop();
3096 m_target
->DeleteThreatList();
3097 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3099 m_target
->StopMoving();
3100 m_target
->GetMotionMaster()->Clear();
3101 m_target
->GetMotionMaster()->MoveIdle();
3103 else if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3105 ((Player
*)m_target
)->SetClientControl(m_target
, 0);
3108 if(CharmInfo
*charmInfo
= m_target
->InitCharmInfo(m_target
))
3109 charmInfo
->InitPossessCreateSpells();
3111 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3112 ((Player
*)caster
)->PossessSpellInitialize();
3116 m_target
->SetCharmerGUID(0);
3117 caster
->InterruptSpell(CURRENT_CHANNELED_SPELL
); // the spell is not automatically canceled when interrupted, do it now
3119 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3121 ((Player
*)m_target
)->setFactionForRace(m_target
->getRace());
3122 ((Player
*)m_target
)->SetClientControl(m_target
, 1);
3124 else if(m_target
->GetTypeId() == TYPEID_UNIT
)
3126 CreatureInfo
const *cinfo
= ((Creature
*)m_target
)->GetCreatureInfo();
3127 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,cinfo
->faction_A
);
3130 caster
->SetCharm(NULL
);
3132 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3134 ((Player
*)caster
)->SetFarSightGUID(0);
3135 ((Player
*)caster
)->SetClientControl(m_target
,0);
3137 WorldPacket
data(SMSG_PET_SPELLS
, 8+4);
3140 ((Player
*)caster
)->GetSession()->SendPacket(&data
);
3143 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3145 ((Creature
*)m_target
)->AIM_Initialize();
3147 if (((Creature
*)m_target
)->AI())
3148 ((Creature
*)m_target
)->AI()->AttackedBy(caster
);
3153 void Aura::HandleModPossessPet(bool apply
, bool Real
)
3158 Unit
* caster
= GetCaster();
3159 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
)
3162 Pet
*pet
= caster
->GetPet();
3163 if(!pet
|| pet
!= m_target
)
3167 pet
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_24
);
3169 pet
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_24
);
3171 ((Player
*)caster
)->SetFarSightGUID(apply
? pet
->GetGUID() : 0);
3172 ((Player
*)caster
)->SetCharm(apply
? pet
: NULL
);
3173 ((Player
*)caster
)->SetClientControl(pet
, apply
? 1 : 0);
3178 pet
->GetMotionMaster()->Clear();
3179 pet
->GetMotionMaster()->MoveIdle();
3184 pet
->GetMotionMaster()->MoveFollow(caster
, PET_FOLLOW_DIST
, PET_FOLLOW_ANGLE
);
3185 pet
->SetUnitMovementFlags(MOVEMENTFLAG_NONE
);
3189 void Aura::HandleAuraModPetTalentsPoints(bool /*Apply*/, bool Real
)
3194 // Recalculate pet tlaent points
3195 if (Pet
*pet
=m_target
->GetPet())
3196 pet
->InitTalentForLevel();
3199 void Aura::HandleModCharm(bool apply
, bool Real
)
3204 // not charm yourself
3205 if(GetCasterGUID() == m_target
->GetGUID())
3208 Unit
* caster
= GetCaster();
3212 if(int32(m_target
->getLevel()) <= m_modifier
.m_amount
)
3216 m_target
->SetCharmerGUID(GetCasterGUID());
3217 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,caster
->getFaction());
3218 m_target
->CastStop(m_target
==caster
? GetId() : 0);
3219 caster
->SetCharm(m_target
);
3221 m_target
->CombatStop();
3222 m_target
->DeleteThreatList();
3224 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3226 ((Creature
*)m_target
)->AIM_Initialize();
3227 CharmInfo
*charmInfo
= m_target
->InitCharmInfo(m_target
);
3228 charmInfo
->InitCharmCreateSpells();
3229 charmInfo
->SetReactState( REACT_DEFENSIVE
);
3231 if(caster
->GetTypeId() == TYPEID_PLAYER
&& caster
->getClass() == CLASS_WARLOCK
)
3233 CreatureInfo
const *cinfo
= ((Creature
*)m_target
)->GetCreatureInfo();
3234 if(cinfo
&& cinfo
->type
== CREATURE_TYPE_DEMON
)
3236 //to prevent client crash
3237 m_target
->SetFlag(UNIT_FIELD_BYTES_0
, 2048);
3238 //just to enable stat window
3239 charmInfo
->SetPetNumber(objmgr
.GeneratePetNumber(), true);
3240 //if charmed two demons the same session, the 2nd gets the 1st one's name
3241 m_target
->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP
, time(NULL
));
3246 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3248 ((Player
*)caster
)->CharmSpellInitialize();
3253 m_target
->SetCharmerGUID(0);
3255 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3256 ((Player
*)m_target
)->setFactionForRace(m_target
->getRace());
3259 CreatureInfo
const *cinfo
= ((Creature
*)m_target
)->GetCreatureInfo();
3262 if(((Creature
*)m_target
)->isPet())
3264 if(Unit
* owner
= m_target
->GetOwner())
3265 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,owner
->getFaction());
3267 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,cinfo
->faction_A
);
3269 else if(cinfo
) // normal creature
3270 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,cinfo
->faction_A
);
3272 // restore UNIT_FIELD_BYTES_0
3273 if(cinfo
&& caster
->GetTypeId() == TYPEID_PLAYER
&& caster
->getClass() == CLASS_WARLOCK
&& cinfo
->type
== CREATURE_TYPE_DEMON
)
3275 CreatureDataAddon
const *cainfo
= ((Creature
*)m_target
)->GetCreatureAddon();
3276 if(cainfo
&& cainfo
->bytes0
!= 0)
3277 m_target
->SetUInt32Value(UNIT_FIELD_BYTES_0
, cainfo
->bytes0
);
3279 m_target
->RemoveFlag(UNIT_FIELD_BYTES_0
, 2048);
3281 if(m_target
->GetCharmInfo())
3282 m_target
->GetCharmInfo()->SetPetNumber(0, true);
3284 sLog
.outError("Aura::HandleModCharm: target="I64FMTD
" with typeid=%d has a charm aura but no charm info!", m_target
->GetGUID(), m_target
->GetTypeId());
3288 caster
->SetCharm(NULL
);
3290 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3292 WorldPacket
data(SMSG_PET_SPELLS
, 8+4);
3295 ((Player
*)caster
)->GetSession()->SendPacket(&data
);
3297 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3299 ((Creature
*)m_target
)->AIM_Initialize();
3300 if (((Creature
*)m_target
)->AI())
3301 ((Creature
*)m_target
)->AI()->AttackedBy(caster
);
3307 void Aura::HandleModConfuse(bool apply
, bool Real
)
3312 m_target
->SetConfused(apply
, GetCasterGUID(), GetId());
3315 void Aura::HandleModFear(bool apply
, bool Real
)
3320 m_target
->SetFeared(apply
, GetCasterGUID(), GetId());
3323 void Aura::HandleFeignDeath(bool apply
, bool Real
)
3328 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
3334 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3335 data<<m_target->GetGUID();
3337 m_target->SendMessageToSet(&data,true);
3340 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_29
);
3342 m_target
->SetFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FEIGN_DEATH
);
3344 m_target
->SetFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_DEAD
);
3346 m_target
->addUnitState(UNIT_STAT_DIED
);
3347 m_target
->CombatStop();
3348 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
3350 // prevent interrupt message
3351 if(m_caster_guid
==m_target
->GetGUID() && m_target
->m_currentSpells
[CURRENT_GENERIC_SPELL
])
3352 m_target
->m_currentSpells
[CURRENT_GENERIC_SPELL
]->finish();
3353 m_target
->InterruptNonMeleeSpells(true);
3354 m_target
->getHostilRefManager().deleteReferences();
3359 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3360 data<<m_target->GetGUID();
3362 m_target->SendMessageToSet(&data,true);
3365 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_29
);
3367 m_target
->RemoveFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FEIGN_DEATH
);
3369 m_target
->RemoveFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_DEAD
);
3371 m_target
->clearUnitState(UNIT_STAT_DIED
);
3375 void Aura::HandleAuraModDisarm(bool apply
, bool Real
)
3380 if(!apply
&& m_target
->HasAuraType(SPELL_AURA_MOD_DISARM
))
3383 // not sure for it's correctness
3385 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_DISARMED
);
3387 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_DISARMED
);
3389 // only at real add/remove aura
3390 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
3393 // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove.
3394 if (m_target
->IsInFeralForm())
3398 m_target
->SetAttackTime(BASE_ATTACK
,BASE_ATTACK_TIME
);
3400 ((Player
*)m_target
)->SetRegularAttackTime();
3402 m_target
->UpdateDamagePhysical(BASE_ATTACK
);
3405 void Aura::HandleAuraModStun(bool apply
, bool Real
)
3412 // Frost stun aura -> freeze/unfreeze target
3413 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3414 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3416 m_target
->addUnitState(UNIT_STAT_STUNNED
);
3417 m_target
->SetUInt64Value(UNIT_FIELD_TARGET
, 0);
3419 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_STUNNED
);
3420 m_target
->CastStop(m_target
->GetGUID() == GetCasterGUID() ? GetId() : 0);
3422 // Creature specific
3423 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
3424 ((Creature
*)m_target
)->StopMoving();
3426 m_target
->SetUnitMovementFlags(0); //Clear movement flags
3428 WorldPacket
data(SMSG_FORCE_MOVE_ROOT
, 8);
3430 data
.append(m_target
->GetPackGUID());
3432 m_target
->SendMessageToSet(&data
,true);
3434 // Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine
3435 if(GetId() == 39837)
3437 GameObject
* pObj
= new GameObject
;
3438 if(pObj
->Create(objmgr
.GenerateLowGuid(HIGHGUID_GAMEOBJECT
), 185584, m_target
->GetMap(), m_target
->GetPhaseMask(),
3439 m_target
->GetPositionX(), m_target
->GetPositionY(), m_target
->GetPositionZ(), m_target
->GetOrientation(), 0.0f
, 0.0f
, 0.0f
, 0.0f
, 100, GO_STATE_READY
))
3441 pObj
->SetRespawnTime(GetAuraDuration()/IN_MILISECONDS
);
3442 pObj
->SetSpellId(GetId());
3443 m_target
->AddGameObject(pObj
);
3444 m_target
->GetMap()->Add(pObj
);
3452 // Frost stun aura -> freeze/unfreeze target
3453 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3455 bool found_another
= false;
3456 for(AuraType
const* itr
= &frozenAuraTypes
[0]; *itr
!= SPELL_AURA_NONE
; ++itr
)
3458 Unit::AuraList
const& auras
= m_target
->GetAurasByType(*itr
);
3459 for(Unit::AuraList::const_iterator i
= auras
.begin(); i
!= auras
.end(); ++i
)
3461 if( GetSpellSchoolMask((*i
)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST
)
3463 found_another
= true;
3472 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3475 // Real remove called after current aura remove from lists, check if other similar auras active
3476 if(m_target
->HasAuraType(SPELL_AURA_MOD_STUN
))
3479 m_target
->clearUnitState(UNIT_STAT_STUNNED
);
3480 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_STUNNED
);
3482 if(!m_target
->hasUnitState(UNIT_STAT_ROOT
)) // prevent allow move if have also root effect
3484 if(m_target
->getVictim() && m_target
->isAlive())
3485 m_target
->SetUInt64Value(UNIT_FIELD_TARGET
,m_target
->getVictim()->GetGUID() );
3487 WorldPacket
data(SMSG_FORCE_MOVE_UNROOT
, 8+4);
3488 data
.append(m_target
->GetPackGUID());
3490 m_target
->SendMessageToSet(&data
,true);
3494 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_HUNTER
&& m_spellProto
->SpellFamilyFlags
& 0x0000100000000000LL
)
3496 Unit
* caster
= GetCaster();
3497 if( !caster
|| caster
->GetTypeId()!=TYPEID_PLAYER
)
3500 uint32 spell_id
= 0;
3504 case 19386: spell_id
= 24131; break;
3505 case 24132: spell_id
= 24134; break;
3506 case 24133: spell_id
= 24135; break;
3507 case 27068: spell_id
= 27069; break;
3508 case 49011: spell_id
= 49009; break;
3509 case 49012: spell_id
= 49010; break;
3511 sLog
.outError("Spell selection called for unexpected original spell %u, new spell for this spell family?",GetId());
3515 SpellEntry
const* spellInfo
= sSpellStore
.LookupEntry(spell_id
);
3520 caster
->CastSpell(m_target
,spellInfo
,true,NULL
,this);
3526 void Aura::HandleModStealth(bool apply
, bool Real
)
3528 Unit
* pTarget
= m_target
;
3529 SpellEntry
const* pSpellInfo
= GetSpellProto();
3533 // drop flag at stealth in bg
3534 pTarget
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
3536 // only at real aura add
3539 pTarget
->SetStandFlags(UNIT_STAND_FLAGS_CREEP
);
3541 if (pTarget
->GetTypeId()==TYPEID_PLAYER
)
3542 pTarget
->SetFlag(PLAYER_FIELD_BYTES2
, 0x2000);
3544 // apply only if not in GM invisibility (and overwrite invisibility state)
3545 if (pTarget
->GetVisibility()!=VISIBILITY_OFF
)
3547 pTarget
->SetVisibility(VISIBILITY_GROUP_NO_DETECT
);
3548 pTarget
->SetVisibility(VISIBILITY_GROUP_STEALTH
);
3551 // apply full stealth period bonuses only at first stealth aura in stack
3552 if(pTarget
->GetAurasByType(SPELL_AURA_MOD_STEALTH
).size()<=1)
3554 Unit::AuraList
const& mDummyAuras
= pTarget
->GetAurasByType(SPELL_AURA_DUMMY
);
3555 for(Unit::AuraList::const_iterator i
= mDummyAuras
.begin();i
!= mDummyAuras
.end(); ++i
)
3557 // Master of Subtlety
3558 if ((*i
)->GetSpellProto()->SpellIconID
== 2114)
3560 pTarget
->RemoveAurasDueToSpell(31666);
3561 int32 bp
= (*i
)->GetModifier()->m_amount
;
3562 pTarget
->CastCustomSpell(pTarget
,31665,&bp
,NULL
,NULL
,true);
3565 else if ((*i
)->GetId() == 58426 && pSpellInfo
->SpellFamilyFlags
& 0x0000000000400000LL
)
3567 pTarget
->RemoveAurasDueToSpell(58428);
3568 pTarget
->CastSpell(pTarget
, 58427, true);
3576 // only at real aura remove of _last_ SPELL_AURA_MOD_STEALTH
3577 if (Real
&& !pTarget
->HasAuraType(SPELL_AURA_MOD_STEALTH
))
3579 // if no GM invisibility
3580 if(pTarget
->GetVisibility()!=VISIBILITY_OFF
)
3582 pTarget
->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP
);
3584 if (pTarget
->GetTypeId()==TYPEID_PLAYER
)
3585 pTarget
->RemoveFlag(PLAYER_FIELD_BYTES2
, 0x2000);
3587 // restore invisibility if any
3588 if (pTarget
->HasAuraType(SPELL_AURA_MOD_INVISIBILITY
))
3590 pTarget
->SetVisibility(VISIBILITY_GROUP_NO_DETECT
);
3591 pTarget
->SetVisibility(VISIBILITY_GROUP_INVISIBILITY
);
3594 pTarget
->SetVisibility(VISIBILITY_ON
);
3597 // apply delayed talent bonus remover at last stealth aura remove
3598 Unit::AuraList
const& mDummyAuras
= pTarget
->GetAurasByType(SPELL_AURA_DUMMY
);
3599 for(Unit::AuraList::const_iterator i
= mDummyAuras
.begin();i
!= mDummyAuras
.end(); ++i
)
3601 // Master of Subtlety
3602 if ((*i
)->GetSpellProto()->SpellIconID
== 2114)
3603 pTarget
->CastSpell(pTarget
,31666,true);
3605 else if ((*i
)->GetId() == 58426 && pSpellInfo
->SpellFamilyFlags
& 0x0000000000400000LL
)
3606 pTarget
->CastSpell(pTarget
, 58428, true);
3612 void Aura::HandleInvisibility(bool apply
, bool Real
)
3616 m_target
->m_invisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3618 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
3620 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
3622 // apply glow vision
3623 m_target
->SetFlag(PLAYER_FIELD_BYTES2
,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
);
3627 // apply only if not in GM invisibility and not stealth
3628 if(m_target
->GetVisibility()==VISIBILITY_ON
)
3630 // Aura not added yet but visibility code expect temporary add aura
3631 m_target
->SetVisibility(VISIBILITY_GROUP_NO_DETECT
);
3632 m_target
->SetVisibility(VISIBILITY_GROUP_INVISIBILITY
);
3637 // recalculate value at modifier remove (current aura already removed)
3638 m_target
->m_invisibilityMask
= 0;
3639 Unit::AuraList
const& auras
= m_target
->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY
);
3640 for(Unit::AuraList::const_iterator itr
= auras
.begin(); itr
!= auras
.end(); ++itr
)
3641 m_target
->m_invisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3643 // only at real aura remove and if not have different invisibility auras.
3644 if(Real
&& m_target
->m_invisibilityMask
==0)
3646 // remove glow vision
3647 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3648 m_target
->RemoveFlag(PLAYER_FIELD_BYTES2
,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
);
3650 // apply only if not in GM invisibility & not stealthed while invisible
3651 if(m_target
->GetVisibility()!=VISIBILITY_OFF
)
3653 // if have stealth aura then already have stealth visibility
3654 if(!m_target
->HasAuraType(SPELL_AURA_MOD_STEALTH
))
3655 m_target
->SetVisibility(VISIBILITY_ON
);
3661 void Aura::HandleInvisibilityDetect(bool apply
, bool Real
)
3665 m_target
->m_detectInvisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3669 // recalculate value at modifier remove (current aura already removed)
3670 m_target
->m_detectInvisibilityMask
= 0;
3671 Unit::AuraList
const& auras
= m_target
->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION
);
3672 for(Unit::AuraList::const_iterator itr
= auras
.begin(); itr
!= auras
.end(); ++itr
)
3673 m_target
->m_detectInvisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3675 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
3676 ObjectAccessor::UpdateVisibilityForPlayer((Player
*)m_target
);
3679 void Aura::HandleAuraModRoot(bool apply
, bool Real
)
3681 // only at real add/remove aura
3687 // Frost root aura -> freeze/unfreeze target
3688 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3689 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3691 m_target
->addUnitState(UNIT_STAT_ROOT
);
3692 m_target
->SetUInt64Value (UNIT_FIELD_TARGET
, 0);
3693 // probably wrong (this add skinable flag)
3694 // TODO: find correct flag
3695 // m_target->SetFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));
3697 //Save last orientation
3698 if( m_target
->getVictim() )
3699 m_target
->SetOrientation(m_target
->GetAngle(m_target
->getVictim()));
3701 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3703 WorldPacket
data(SMSG_FORCE_MOVE_ROOT
, 10);
3704 data
.append(m_target
->GetPackGUID());
3706 m_target
->SendMessageToSet(&data
,true);
3708 //Clear unit movement flags
3709 m_target
->SetUnitMovementFlags(0);
3712 ((Creature
*)m_target
)->StopMoving();
3716 // Frost root aura -> freeze/unfreeze target
3717 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3719 bool found_another
= false;
3720 for(AuraType
const* itr
= &frozenAuraTypes
[0]; *itr
!= SPELL_AURA_NONE
; ++itr
)
3722 Unit::AuraList
const& auras
= m_target
->GetAurasByType(*itr
);
3723 for(Unit::AuraList::const_iterator i
= auras
.begin(); i
!= auras
.end(); ++i
)
3725 if( GetSpellSchoolMask((*i
)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST
)
3727 found_another
= true;
3736 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3739 // Real remove called after current aura remove from lists, check if other similar auras active
3740 if(m_target
->HasAuraType(SPELL_AURA_MOD_ROOT
))
3743 m_target
->clearUnitState(UNIT_STAT_ROOT
);
3744 // probably wrong (this add skinable flag)
3745 // TODO: find correct flag
3746 // m_target->RemoveFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));
3748 if(!m_target
->hasUnitState(UNIT_STAT_STUNNED
)) // prevent allow move if have also stun effect
3750 if(m_target
->getVictim() && m_target
->isAlive())
3751 m_target
->SetUInt64Value (UNIT_FIELD_TARGET
,m_target
->getVictim()->GetGUID() );
3753 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3755 WorldPacket
data(SMSG_FORCE_MOVE_UNROOT
, 10);
3756 data
.append(m_target
->GetPackGUID());
3758 m_target
->SendMessageToSet(&data
,true);
3764 void Aura::HandleAuraModSilence(bool apply
, bool Real
)
3766 // only at real add/remove aura
3772 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_SILENCED
);
3773 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3774 for (uint32 i
= CURRENT_MELEE_SPELL
; i
< CURRENT_MAX_SPELL
;i
++)
3775 if (m_target
->m_currentSpells
[i
] && m_target
->m_currentSpells
[i
]->m_spellInfo
->PreventionType
== SPELL_PREVENTION_TYPE_SILENCE
)
3776 m_target
->InterruptSpell(i
,false); // Stop spells on prepare or casting state
3780 // Arcane Torrent (Energy)
3783 Unit
* caster
= GetCaster();
3787 // Search Mana Tap auras on caster
3788 Aura
* dummy
= caster
->GetDummyAura(28734);
3791 int32 bp
= dummy
->GetStackAmount() * 10;
3792 caster
->CastCustomSpell(caster
, 25048, &bp
, NULL
, NULL
, true);
3793 caster
->RemoveAurasDueToSpell(28734);
3800 // Real remove called after current aura remove from lists, check if other similar auras active
3801 if(m_target
->HasAuraType(SPELL_AURA_MOD_SILENCE
))
3804 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_SILENCED
);
3808 void Aura::HandleModThreat(bool apply
, bool Real
)
3810 // only at real add/remove aura
3814 if(!m_target
->isAlive())
3817 Unit
* caster
= GetCaster();
3819 if(!caster
|| !caster
->isAlive())
3828 level_diff
= m_target
->getLevel() - 60;
3831 // The Eye of Diminution
3833 level_diff
= m_target
->getLevel() - 60;
3838 m_modifier
.m_amount
+= multiplier
* level_diff
;
3840 for(int8 x
=0;x
< MAX_SPELL_SCHOOL
;x
++)
3842 if(m_modifier
.m_miscvalue
& int32(1<<x
))
3844 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3845 ApplyPercentModFloatVar(m_target
->m_threatModifier
[x
], m_positive
? m_modifier
.m_amount
: -m_modifier
.m_amount
, apply
);
3850 void Aura::HandleAuraModTotalThreat(bool apply
, bool Real
)
3852 // only at real add/remove aura
3856 if(!m_target
->isAlive() || m_target
->GetTypeId()!= TYPEID_PLAYER
)
3859 Unit
* caster
= GetCaster();
3861 if(!caster
|| !caster
->isAlive())
3864 float threatMod
= 0.0f
;
3866 threatMod
= float(m_modifier
.m_amount
);
3868 threatMod
= float(-m_modifier
.m_amount
);
3870 m_target
->getHostilRefManager().threatAssist(caster
, threatMod
);
3873 void Aura::HandleModTaunt(bool apply
, bool Real
)
3875 // only at real add/remove aura
3879 if(!m_target
->isAlive() || !m_target
->CanHaveThreatList())
3882 Unit
* caster
= GetCaster();
3884 if(!caster
|| !caster
->isAlive() || caster
->GetTypeId() != TYPEID_PLAYER
)
3888 m_target
->TauntApply(caster
);
3891 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3892 m_target
->TauntFadeOut(caster
);
3896 /*********************************************************/
3897 /*** MODIFY SPEED ***/
3898 /*********************************************************/
3899 void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real
)
3901 // all applied/removed only at real aura add/remove
3905 m_target
->UpdateSpeed(MOVE_RUN
, true);
3908 void Aura::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real
)
3910 // all applied/removed only at real aura add/remove
3914 m_target
->UpdateSpeed(MOVE_RUN
, true);
3917 void Aura::HandleAuraModIncreaseFlightSpeed(bool apply
, bool Real
)
3919 // all applied/removed only at real aura add/remove
3923 // Enable Fly mode for flying mounts
3924 if (m_modifier
.m_auraname
== SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
)
3928 data
.Initialize(SMSG_MOVE_SET_CAN_FLY
, 12);
3930 data
.Initialize(SMSG_MOVE_UNSET_CAN_FLY
, 12);
3931 data
.append(m_target
->GetPackGUID());
3932 data
<< uint32(0); // unknown
3933 m_target
->SendMessageToSet(&data
, true);
3935 //Players on flying mounts must be immune to polymorph
3936 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
3937 m_target
->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC
,MECHANIC_POLYMORPH
,apply
);
3939 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3940 if( apply
&& m_target
->HasAura(42016,0) && m_target
->GetMountID())
3941 m_target
->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
,16314);
3944 m_target
->UpdateSpeed(MOVE_FLIGHT
, true);
3947 void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real
)
3949 // all applied/removed only at real aura add/remove
3953 m_target
->UpdateSpeed(MOVE_SWIM
, true);
3956 void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real
)
3958 // all applied/removed only at real aura add/remove
3962 m_target
->UpdateSpeed(MOVE_RUN
, true);
3963 m_target
->UpdateSpeed(MOVE_SWIM
, true);
3964 m_target
->UpdateSpeed(MOVE_FLIGHT
, true);
3967 void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real
)
3969 // all applied/removed only at real aura add/remove
3973 m_target
->UpdateSpeed(MOVE_RUN
, true);
3974 m_target
->UpdateSpeed(MOVE_SWIM
, true);
3975 m_target
->UpdateSpeed(MOVE_FLIGHT
, true);
3978 /*********************************************************/
3980 /*********************************************************/
3982 void Aura::HandleModMechanicImmunity(bool apply
, bool /*Real*/)
3984 uint32 mechanic
= 1 << m_modifier
.m_miscvalue
;
3986 //immune movement impairment and loss of control
3987 if(GetId()==42292 || GetId()==59752)
3988 mechanic
=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
;
3990 // cache values in local vars for prevent access to possible deleted aura data
3991 SpellEntry
const* spellInfo
= GetSpellProto();
3992 uint32 misc
= m_modifier
.m_miscvalue
;
3993 Unit
* target
= m_target
;
3995 if(apply
&& spellInfo
->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
)
3997 Unit::AuraMap
& Auras
= target
->GetAuras();
3998 for(Unit::AuraMap::iterator iter
= Auras
.begin(), next
; iter
!= Auras
.end(); iter
= next
)
4002 SpellEntry
const *spell
= iter
->second
->GetSpellProto();
4003 if (!( spell
->Attributes
& SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY
) && // spells unaffected by invulnerability
4004 spell
->Id
!= spellInfo
->Id
)
4006 //check for mechanic mask
4007 if(GetSpellMechanicMask(spell
, iter
->second
->GetEffIndex()) & mechanic
)
4009 target
->RemoveAurasDueToSpell(spell
->Id
);
4013 next
= Auras
.begin();
4019 target
->ApplySpellImmune(spellInfo
->Id
,IMMUNITY_MECHANIC
,misc
,apply
);
4022 if (spellInfo
->SpellFamilyName
== SPELLFAMILY_HUNTER
&& spellInfo
->SpellIconID
== 1680)
4024 // The Beast Within cast on owner if talent present
4025 if (Unit
* owner
= target
->GetOwner())
4028 Unit::AuraList
const& dummyAuras
= owner
->GetAurasByType(SPELL_AURA_DUMMY
);
4029 for(Unit::AuraList::const_iterator i
= dummyAuras
.begin(); i
!= dummyAuras
.end(); ++i
)
4031 if ((*i
)->GetSpellProto()->SpellIconID
== 2229)
4034 owner
->CastSpell(owner
, 34471, true, 0, this);
4036 owner
->RemoveAurasDueToSpell(34471);
4043 // The Beast Within and Bestial Wrath - immunity
4044 if (spellInfo
->Id
== 19574 || spellInfo
->Id
== 34471)
4048 target
->CastSpell(target
,24395,true);
4049 target
->CastSpell(target
,24396,true);
4050 target
->CastSpell(target
,24397,true);
4051 target
->CastSpell(target
,26592,true);
4055 target
->RemoveAurasDueToSpell(24395);
4056 target
->RemoveAurasDueToSpell(24396);
4057 target
->RemoveAurasDueToSpell(24397);
4058 target
->RemoveAurasDueToSpell(26592);
4063 //this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
4064 void Aura::HandleAuraModEffectImmunity(bool apply
, bool /*Real*/)
4066 // when removing flag aura, handle flag drop
4067 if( !apply
&& m_target
->GetTypeId() == TYPEID_PLAYER
4068 && (GetSpellProto()->AuraInterruptFlags
& AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
) )
4070 if( BattleGround
*bg
= ((Player
*)m_target
)->GetBattleGround() )
4071 bg
->EventPlayerDroppedFlag(((Player
*)m_target
));
4074 m_target
->ApplySpellImmune(GetId(),IMMUNITY_EFFECT
,m_modifier
.m_miscvalue
,apply
);
4077 void Aura::HandleAuraModStateImmunity(bool apply
, bool Real
)
4079 if(apply
&& Real
&& GetSpellProto()->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
)
4081 Unit::AuraList
const& auraList
= m_target
->GetAurasByType(AuraType(m_modifier
.m_miscvalue
));
4082 for(Unit::AuraList::const_iterator itr
= auraList
.begin(); itr
!= auraList
.end();)
4084 if (auraList
.front() != this) // skip itself aura (it already added)
4086 m_target
->RemoveAurasDueToSpell(auraList
.front()->GetId());
4087 itr
= auraList
.begin();
4094 m_target
->ApplySpellImmune(GetId(),IMMUNITY_STATE
,m_modifier
.m_miscvalue
,apply
);
4097 void Aura::HandleAuraModSchoolImmunity(bool apply
, bool Real
)
4099 m_target
->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL
,m_modifier
.m_miscvalue
,apply
);
4101 // remove all flag auras (they are positive, but they must be removed when you are immune)
4102 if( this->GetSpellProto()->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
4103 && this->GetSpellProto()->AttributesEx2
& SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD
)
4104 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
4106 // TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
4108 && GetSpellProto()->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
4109 && IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
4111 uint32 school_mask
= m_modifier
.m_miscvalue
;
4112 Unit::AuraMap
& Auras
= m_target
->GetAuras();
4113 for(Unit::AuraMap::iterator iter
= Auras
.begin(), next
; iter
!= Auras
.end(); iter
= next
)
4117 SpellEntry
const *spell
= iter
->second
->GetSpellProto();
4118 if((GetSpellSchoolMask(spell
) & school_mask
)//Check for school mask
4119 && !( spell
->Attributes
& SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY
) //Spells unaffected by invulnerability
4120 && !iter
->second
->IsPositive() //Don't remove positive spells
4121 && spell
->Id
!= GetId() ) //Don't remove self
4123 m_target
->RemoveAurasDueToSpell(spell
->Id
);
4127 next
= Auras
.begin();
4131 if( Real
&& GetSpellProto()->Mechanic
== MECHANIC_BANISH
)
4134 m_target
->addUnitState(UNIT_STAT_ISOLATED
);
4136 m_target
->clearUnitState(UNIT_STAT_ISOLATED
);
4140 void Aura::HandleAuraModDmgImmunity(bool apply
, bool /*Real*/)
4142 m_target
->ApplySpellImmune(GetId(),IMMUNITY_DAMAGE
,m_modifier
.m_miscvalue
,apply
);
4145 void Aura::HandleAuraModDispelImmunity(bool apply
, bool Real
)
4147 // all applied/removed only at real aura add/remove
4151 m_target
->ApplySpellDispelImmunity(m_spellProto
, DispelType(m_modifier
.m_miscvalue
), apply
);
4154 void Aura::HandleAuraProcTriggerSpell(bool apply
, bool Real
)
4161 // some spell have charges by functionality not have its in spell data
4164 case 28200: // Ascendance (Talisman of Ascendance trinket)
4172 void Aura::HandleAuraModStalked(bool apply
, bool /*Real*/)
4174 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
4176 m_target
->SetFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_TRACK_UNIT
);
4178 m_target
->RemoveFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_TRACK_UNIT
);
4181 /*********************************************************/
4183 /*********************************************************/
4185 void Aura::HandlePeriodicTriggerSpell(bool apply
, bool /*Real*/)
4187 m_isPeriodic
= apply
;
4188 if (m_spellProto
->Id
== 66 && !apply
)
4190 if (m_removeMode
== AURA_REMOVE_BY_DEFAULT
&& m_duration
<=0)
4191 m_target
->CastSpell(m_target
, 32612, true, NULL
, this);
4195 void Aura::HandlePeriodicTriggerSpellWithValue(bool apply
, bool /*Real*/)
4197 m_isPeriodic
= apply
;
4200 void Aura::HandlePeriodicEnergize(bool apply
, bool Real
)
4205 m_isPeriodic
= apply
;
4207 // Replenishment (0.25% from max)
4208 // Infinite Replenishment
4209 if (GetId() == 57669 ||
4211 m_modifier
.m_amount
= m_target
->GetMaxPower(POWER_MANA
) * 25 / 10000;
4214 void Aura::HandleAuraPowerBurn(bool apply
, bool /*Real*/)
4216 m_isPeriodic
= apply
;
4219 void Aura::HandleAuraPeriodicDummy(bool apply
, bool Real
)
4221 // spells required only Real aura add/remove
4225 // For prevent double apply bonuses
4226 bool loading
= (m_target
->GetTypeId() == TYPEID_PLAYER
&& ((Player
*)m_target
)->GetSession()->PlayerLoading());
4228 Unit
* caster
= GetCaster();
4230 SpellEntry
const*spell
= GetSpellProto();
4231 switch( spell
->SpellFamilyName
)
4233 case SPELLFAMILY_ROGUE
:
4239 // Master of Subtlety
4240 case 31666: m_target
->RemoveAurasDueToSpell(31665); break;
4242 case 58428: m_target
->RemoveAurasDueToSpell(58427); break;
4247 case SPELLFAMILY_HUNTER
:
4250 if (apply
&& !loading
&& caster
)
4251 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(RANGED_ATTACK
) * 8 / 100);
4256 m_isPeriodic
= apply
;
4259 void Aura::HandlePeriodicHeal(bool apply
, bool /*Real*/)
4261 m_isPeriodic
= apply
;
4264 void Aura::HandlePeriodicDamage(bool apply
, bool Real
)
4266 // spells required only Real aura add/remove
4270 m_isPeriodic
= apply
;
4272 // For prevent double apply bonuses
4273 bool loading
= (m_target
->GetTypeId() == TYPEID_PLAYER
&& ((Player
*)m_target
)->GetSession()->PlayerLoading());
4275 // Custom damage calculation after
4281 Unit
*caster
= GetCaster();
4285 switch (m_spellProto
->SpellFamilyName
)
4287 case SPELLFAMILY_GENERIC
:
4290 if ( m_spellProto
->SpellIconID
== 147 && m_spellProto
->SpellVisual
[0] == 0 )
4292 // $AP*0.18/6 bonus per tick
4293 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 3 / 100);
4298 case SPELLFAMILY_WARRIOR
:
4301 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000000020LL
)
4303 // $0.2*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick
4304 float ap
= caster
->GetTotalAttackPowerValue(BASE_ATTACK
);
4305 int32 mws
= caster
->GetAttackTime(BASE_ATTACK
);
4306 float mwb_min
= caster
->GetWeaponDamageRange(BASE_ATTACK
,MINDAMAGE
);
4307 float mwb_max
= caster
->GetWeaponDamageRange(BASE_ATTACK
,MAXDAMAGE
);
4308 m_modifier
.m_amount
+=int32(((mwb_min
+mwb_max
)/2+ap
*mws
/14000)*0.2f
);
4313 case SPELLFAMILY_DRUID
:
4316 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000001000LL
)
4318 // $AP*0.06 bonus per tick
4319 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 6 / 100);
4323 if (m_spellProto
->SpellFamilyFlags
& 0x000000010000000000LL
)
4325 // $AP*0.05/5 bonus per tick
4326 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) / 100);
4330 if (m_spellProto
->SpellFamilyFlags
& 0x000000000000800000LL
)
4333 if (caster
->GetTypeId() != TYPEID_PLAYER
)
4336 uint8 cp
= ((Player
*)caster
)->GetComboPoints();
4338 // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
4339 Unit::AuraList
const& dummyAuras
= caster
->GetAurasByType(SPELL_AURA_DUMMY
);
4340 for(Unit::AuraList::const_iterator itr
= dummyAuras
.begin(); itr
!= dummyAuras
.end(); ++itr
)
4342 if((*itr
)->GetId()==34241)
4344 m_modifier
.m_amount
+= cp
* (*itr
)->GetModifier()->m_amount
;
4348 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * cp
/ 100);
4352 if (m_spellProto
->SpellFamilyFlags
& 0x1000000000000000LL
)
4355 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 15 / 100);
4360 case SPELLFAMILY_ROGUE
:
4363 if (m_spellProto
->SpellFamilyFlags
& 0x000000000000100000LL
)
4365 if (caster
->GetTypeId() != TYPEID_PLAYER
)
4367 //1 point : ${($m1+$b1*1+0.015*$AP)*4} damage over 8 secs
4368 //2 points: ${($m1+$b1*2+0.024*$AP)*5} damage over 10 secs
4369 //3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs
4370 //4 points: ${($m1+$b1*4+0.03428571*$AP)*7} damage over 14 secs
4371 //5 points: ${($m1+$b1*5+0.0375*$AP)*8} damage over 16 secs
4372 float AP_per_combo
[6] = {0.0f
, 0.015f
, 0.024f
, 0.03f
, 0.03428571f
, 0.0375f
};
4373 uint8 cp
= ((Player
*)caster
)->GetComboPoints();
4375 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * AP_per_combo
[cp
]);
4379 if (m_spellProto
->SpellFamilyFlags
& 0x000000000000000100LL
)
4381 // $AP*0.07 bonus per tick
4382 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 7 / 100);
4386 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000010000)
4388 // 0.08*$AP / 4 * amount of stack
4389 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 2 * GetStackAmount() / 100);
4394 case SPELLFAMILY_HUNTER
:
4397 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000004000LL
)
4399 // $RAP*0.1/5 bonus per tick
4400 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(RANGED_ATTACK
) * 10 / 500);
4404 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000000004LL
&& m_spellProto
->SpellIconID
== 678)
4406 // $RAP*0.1/5 bonus per tick
4407 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(RANGED_ATTACK
) * 10 / 500);
4416 // remove time effects
4419 // Parasitic Shadowfiend - handle summoning of two Shadowfiends on DoT expire
4420 if(m_spellProto
->Id
== 41917)
4421 m_target
->CastSpell(m_target
, 41915, true);
4425 void Aura::HandlePeriodicDamagePCT(bool apply
, bool /*Real*/)
4427 m_isPeriodic
= apply
;
4430 void Aura::HandlePeriodicLeech(bool apply
, bool /*Real*/)
4432 m_isPeriodic
= apply
;
4435 void Aura::HandlePeriodicManaLeech(bool apply
, bool /*Real*/)
4437 m_isPeriodic
= apply
;
4440 void Aura::HandlePeriodicHealthFunnel(bool apply
, bool /*Real*/)
4442 m_isPeriodic
= apply
;
4445 /*********************************************************/
4446 /*** MODIFY STATS ***/
4447 /*********************************************************/
4449 /********************************/
4450 /*** RESISTANCE ***/
4451 /********************************/
4453 void Aura::HandleAuraModResistanceExclusive(bool apply
, bool /*Real*/)
4455 for(int8 x
= SPELL_SCHOOL_NORMAL
; x
< MAX_SPELL_SCHOOL
;x
++)
4457 if(m_modifier
.m_miscvalue
& int32(1<<x
))
4459 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ x
), BASE_VALUE
, float(m_modifier
.m_amount
), apply
);
4460 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4461 m_target
->ApplyResistanceBuffModsMod(SpellSchools(x
),m_positive
,m_modifier
.m_amount
, apply
);
4466 void Aura::HandleAuraModResistance(bool apply
, bool /*Real*/)
4468 for(int8 x
= SPELL_SCHOOL_NORMAL
; x
< MAX_SPELL_SCHOOL
;x
++)
4470 if(m_modifier
.m_miscvalue
& int32(1<<x
))
4472 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ x
), TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4473 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4474 m_target
->ApplyResistanceBuffModsMod(SpellSchools(x
),m_positive
,m_modifier
.m_amount
, apply
);
4479 void Aura::HandleAuraModBaseResistancePCT(bool apply
, bool /*Real*/)
4481 // only players have base stats
4482 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4484 //pets only have base armor
4485 if(((Creature
*)m_target
)->isPet() && (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
))
4486 m_target
->HandleStatModifier(UNIT_MOD_ARMOR
, BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4490 for(int8 x
= SPELL_SCHOOL_NORMAL
; x
< MAX_SPELL_SCHOOL
;x
++)
4492 if(m_modifier
.m_miscvalue
& int32(1<<x
))
4493 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ x
), BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4498 void Aura::HandleModResistancePercent(bool apply
, bool /*Real*/)
4500 for(int8 i
= SPELL_SCHOOL_NORMAL
; i
< MAX_SPELL_SCHOOL
; i
++)
4502 if(m_modifier
.m_miscvalue
& int32(1<<i
))
4504 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ i
), TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4505 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4507 m_target
->ApplyResistanceBuffModsPercentMod(SpellSchools(i
),true,m_modifier
.m_amount
, apply
);
4508 m_target
->ApplyResistanceBuffModsPercentMod(SpellSchools(i
),false,m_modifier
.m_amount
, apply
);
4514 void Aura::HandleModBaseResistance(bool apply
, bool /*Real*/)
4516 // only players have base stats
4517 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4519 //only pets have base stats
4520 if(((Creature
*)m_target
)->isPet() && (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
))
4521 m_target
->HandleStatModifier(UNIT_MOD_ARMOR
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4525 for(int i
= SPELL_SCHOOL_NORMAL
; i
< MAX_SPELL_SCHOOL
; i
++)
4526 if(m_modifier
.m_miscvalue
& (1<<i
))
4527 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ i
), TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4531 /********************************/
4533 /********************************/
4535 void Aura::HandleAuraModStat(bool apply
, bool /*Real*/)
4537 if (m_modifier
.m_miscvalue
< -2 || m_modifier
.m_miscvalue
> 4)
4539 sLog
.outError("WARNING: Spell %u effect %u have unsupported misc value (%i) for SPELL_AURA_MOD_STAT ",GetId(),GetEffIndex(),m_modifier
.m_miscvalue
);
4543 for(int32 i
= STAT_STRENGTH
; i
< MAX_STATS
; i
++)
4545 // -1 or -2 is all stats ( misc < -2 checked in function beginning )
4546 if (m_modifier
.m_miscvalue
< 0 || m_modifier
.m_miscvalue
== i
)
4548 //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply);
4549 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START
+ i
), TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4550 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4551 m_target
->ApplyStatBuffMod(Stats(i
),m_modifier
.m_amount
,apply
);
4556 void Aura::HandleModPercentStat(bool apply
, bool /*Real*/)
4558 if (m_modifier
.m_miscvalue
< -1 || m_modifier
.m_miscvalue
> 4)
4560 sLog
.outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4564 // only players have base stats
4565 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
4568 for (int32 i
= STAT_STRENGTH
; i
< MAX_STATS
; ++i
)
4570 if(m_modifier
.m_miscvalue
== i
|| m_modifier
.m_miscvalue
== -1)
4571 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START
+ i
), BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4575 void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool /*Real*/)
4577 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4580 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4581 // This information for client side use only
4582 // Recalculate bonus
4583 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4586 void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool /*Real*/)
4588 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4591 // Recalculate bonus
4592 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4595 void Aura::HandleAuraModDispelResist(bool apply
, bool Real
)
4601 m_target
->CastSpell(m_target
,44416,true,NULL
,this,GetCasterGUID());
4604 void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool /*Real*/)
4606 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4609 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4610 // This information for client side use only
4611 // Recalculate bonus
4612 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4615 void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool /*Real*/)
4617 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4620 // Recalculate bonus
4621 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4624 void Aura::HandleModHealingDone(bool /*apply*/, bool /*Real*/)
4626 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4628 // implemented in Unit::SpellHealingBonus
4629 // this information is for client side only
4630 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4633 void Aura::HandleModTotalPercentStat(bool apply
, bool /*Real*/)
4635 if (m_modifier
.m_miscvalue
< -1 || m_modifier
.m_miscvalue
> 4)
4637 sLog
.outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4641 //save current and max HP before applying aura
4642 uint32 curHPValue
= m_target
->GetHealth();
4643 uint32 maxHPValue
= m_target
->GetMaxHealth();
4645 for (int32 i
= STAT_STRENGTH
; i
< MAX_STATS
; i
++)
4647 if(m_modifier
.m_miscvalue
== i
|| m_modifier
.m_miscvalue
== -1)
4649 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START
+ i
), TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4650 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4651 m_target
->ApplyStatPercentBuffMod(Stats(i
), m_modifier
.m_amount
, apply
);
4655 //recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag)
4656 if ((m_modifier
.m_miscvalue
== STAT_STAMINA
) && (maxHPValue
> 0) && (m_spellProto
->Attributes
& 0x10))
4658 // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed
4659 uint32 newHPValue
= (m_target
->GetMaxHealth() * curHPValue
) / maxHPValue
;
4660 m_target
->SetHealth(newHPValue
);
4664 void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool /*Real*/)
4666 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4669 if(m_modifier
.m_miscvalue
!= SPELL_SCHOOL_MASK_NORMAL
)
4671 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4672 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4673 sLog
.outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) need adding support for non-armor resistances!");
4677 // Recalculate Armor
4678 m_target
->UpdateArmor();
4681 /********************************/
4682 /*** HEAL & ENERGIZE ***/
4683 /********************************/
4684 void Aura::HandleAuraModTotalHealthPercentRegen(bool apply
, bool /*Real*/)
4686 m_isPeriodic
= apply
;
4689 void Aura::HandleAuraModTotalManaPercentRegen(bool apply
, bool /*Real*/)
4691 if(m_modifier
.periodictime
== 0)
4692 m_modifier
.periodictime
= 1000;
4694 m_periodicTimer
= m_modifier
.periodictime
;
4695 m_isPeriodic
= apply
;
4698 void Aura::HandleModRegen(bool apply
, bool /*Real*/) // eating
4700 if(m_modifier
.periodictime
== 0)
4701 m_modifier
.periodictime
= 5000;
4703 m_periodicTimer
= 5000;
4704 m_isPeriodic
= apply
;
4707 void Aura::HandleModPowerRegen(bool apply
, bool Real
) // drinking
4712 Powers pt
= m_target
->getPowerType();
4713 if(m_modifier
.periodictime
== 0)
4715 // Anger Management (only spell use this aura for rage)
4716 if (pt
== POWER_RAGE
)
4717 m_modifier
.periodictime
= 3000;
4719 m_modifier
.periodictime
= 2000;
4722 m_periodicTimer
= 5000;
4724 if (m_target
->GetTypeId() == TYPEID_PLAYER
&& m_modifier
.m_miscvalue
== POWER_MANA
)
4725 ((Player
*)m_target
)->UpdateManaRegen();
4727 m_isPeriodic
= apply
;
4730 void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real
)
4732 // spells required only Real aura add/remove
4736 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
4739 // Update manaregen value
4740 if (m_modifier
.m_miscvalue
== POWER_MANA
)
4741 ((Player
*)m_target
)->UpdateManaRegen();
4744 void Aura::HandleModManaRegen(bool /*apply*/, bool Real
)
4746 // spells required only Real aura add/remove
4750 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
4753 //Note: an increase in regen does NOT cause threat.
4754 ((Player
*)m_target
)->UpdateManaRegen();
4757 void Aura::HandleComprehendLanguage(bool apply
, bool /*Real*/)
4760 m_target
->SetFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_COMPREHEND_LANG
);
4762 m_target
->RemoveFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_COMPREHEND_LANG
);
4765 void Aura::HandleAuraModIncreaseHealth(bool apply
, bool Real
)
4767 // Special case with temporary increase max/current health
4770 case 12976: // Warrior Last Stand triggered spell
4771 case 28726: // Nightmare Seed ( Nightmare Seed )
4772 case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings)
4773 case 44055: // Tremendous Fortitude (Battlemaster's Alacrity)
4774 case 50322: // Survival Instincts
4780 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4781 m_target
->ModifyHealth(m_modifier
.m_amount
);
4785 if (int32(m_target
->GetHealth()) > m_modifier
.m_amount
)
4786 m_target
->ModifyHealth(-m_modifier
.m_amount
);
4788 m_target
->SetHealth(1);
4789 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4797 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4800 void Aura::HandleAuraModIncreaseMaxHealth(bool apply
, bool /*Real*/)
4802 uint32 oldhealth
= m_target
->GetHealth();
4803 double healthPercentage
= (double)oldhealth
/ (double)m_target
->GetMaxHealth();
4805 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4807 // refresh percentage
4810 uint32 newhealth
= uint32(ceil((double)m_target
->GetMaxHealth() * healthPercentage
));
4814 m_target
->SetHealth(newhealth
);
4818 void Aura::HandleAuraModIncreaseEnergy(bool apply
, bool /*Real*/)
4820 Powers powerType
= m_target
->getPowerType();
4821 if(int32(powerType
) != m_modifier
.m_miscvalue
)
4824 UnitMods unitMod
= UnitMods(UNIT_MOD_POWER_START
+ powerType
);
4826 m_target
->HandleStatModifier(unitMod
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4829 void Aura::HandleAuraModIncreaseEnergyPercent(bool apply
, bool /*Real*/)
4831 Powers powerType
= m_target
->getPowerType();
4832 if(int32(powerType
) != m_modifier
.m_miscvalue
)
4835 UnitMods unitMod
= UnitMods(UNIT_MOD_POWER_START
+ powerType
);
4837 m_target
->HandleStatModifier(unitMod
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4840 void Aura::HandleAuraModIncreaseHealthPercent(bool apply
, bool /*Real*/)
4842 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4845 void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply
, bool /*Real*/)
4847 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4850 /********************************/
4852 /********************************/
4854 void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/)
4856 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4859 ((Player
*)m_target
)->UpdateParryPercentage();
4862 void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/)
4864 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4867 ((Player
*)m_target
)->UpdateDodgePercentage();
4868 //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount));
4871 void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool /*Real*/)
4873 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4876 ((Player
*)m_target
)->UpdateBlockPercentage();
4877 //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount));
4880 void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real
)
4882 // spells required only Real aura add/remove
4886 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4889 ((Player
*)m_target
)->UpdateManaRegen();
4892 void Aura::HandleAuraModCritPercent(bool apply
, bool Real
)
4894 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4897 // apply item specific bonuses for already equipped weapon
4900 for(int i
= 0; i
< MAX_ATTACK
; ++i
)
4901 if(Item
* pItem
= ((Player
*)m_target
)->GetWeaponForAttack(WeaponAttackType(i
)))
4902 ((Player
*)m_target
)->_ApplyWeaponDependentAuraCritMod(pItem
,WeaponAttackType(i
),this,apply
);
4905 // mods must be applied base at equipped weapon class and subclass comparison
4906 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4907 // m_modifier.m_miscvalue comparison with item generated damage types
4909 if (GetSpellProto()->EquippedItemClass
== -1)
4911 ((Player
*)m_target
)->HandleBaseModValue(CRIT_PERCENTAGE
, FLAT_MOD
, float (m_modifier
.m_amount
), apply
);
4912 ((Player
*)m_target
)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE
, FLAT_MOD
, float (m_modifier
.m_amount
), apply
);
4913 ((Player
*)m_target
)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE
, FLAT_MOD
, float (m_modifier
.m_amount
), apply
);
4917 // done in Player::_ApplyWeaponDependentAuraMods
4921 void Aura::HandleModHitChance(bool apply
, bool /*Real*/)
4923 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4925 ((Player
*)m_target
)->UpdateMeleeHitChances();
4926 ((Player
*)m_target
)->UpdateRangedHitChances();
4930 m_target
->m_modMeleeHitChance
+= apply
? m_modifier
.m_amount
: (-m_modifier
.m_amount
);
4931 m_target
->m_modRangedHitChance
+= apply
? m_modifier
.m_amount
: (-m_modifier
.m_amount
);
4935 void Aura::HandleModSpellHitChance(bool apply
, bool /*Real*/)
4937 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4939 ((Player
*)m_target
)->UpdateSpellHitChances();
4943 m_target
->m_modSpellHitChance
+= apply
? m_modifier
.m_amount
: (-m_modifier
.m_amount
);
4947 void Aura::HandleModSpellCritChance(bool apply
, bool Real
)
4949 // spells required only Real aura add/remove
4953 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4955 ((Player
*)m_target
)->UpdateAllSpellCritChances();
4959 m_target
->m_baseSpellCritChance
+= apply
? m_modifier
.m_amount
:(-m_modifier
.m_amount
);
4963 void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real
)
4965 // spells required only Real aura add/remove
4969 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4972 for(int school
= SPELL_SCHOOL_NORMAL
; school
< MAX_SPELL_SCHOOL
; ++school
)
4973 if (m_modifier
.m_miscvalue
& (1<<school
))
4974 ((Player
*)m_target
)->UpdateSpellCritChance(school
);
4977 /********************************/
4978 /*** ATTACK SPEED ***/
4979 /********************************/
4981 void Aura::HandleModCastingSpeed(bool apply
, bool /*Real*/)
4983 m_target
->ApplyCastTimePercentMod(m_modifier
.m_amount
,apply
);
4986 void Aura::HandleModMeleeRangedSpeedPct(bool apply
, bool /*Real*/)
4988 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
,m_modifier
.m_amount
,apply
);
4989 m_target
->ApplyAttackTimePercentMod(OFF_ATTACK
,m_modifier
.m_amount
,apply
);
4990 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
, m_modifier
.m_amount
, apply
);
4993 void Aura::HandleModCombatSpeedPct(bool apply
, bool /*Real*/)
4995 m_target
->ApplyCastTimePercentMod(m_modifier
.m_amount
,apply
);
4996 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
,m_modifier
.m_amount
,apply
);
4997 m_target
->ApplyAttackTimePercentMod(OFF_ATTACK
,m_modifier
.m_amount
,apply
);
4998 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
, m_modifier
.m_amount
, apply
);
5001 void Aura::HandleModAttackSpeed(bool apply
, bool /*Real*/)
5003 if(!m_target
->isAlive() )
5006 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
,m_modifier
.m_amount
,apply
);
5009 void Aura::HandleHaste(bool apply
, bool /*Real*/)
5011 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
, m_modifier
.m_amount
,apply
);
5012 m_target
->ApplyAttackTimePercentMod(OFF_ATTACK
, m_modifier
.m_amount
,apply
);
5013 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
,m_modifier
.m_amount
,apply
);
5016 void Aura::HandleAuraModRangedHaste(bool apply
, bool /*Real*/)
5018 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
, m_modifier
.m_amount
, apply
);
5021 void Aura::HandleRangedAmmoHaste(bool apply
, bool /*Real*/)
5023 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5025 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
,m_modifier
.m_amount
, apply
);
5028 /********************************/
5029 /*** ATTACK POWER ***/
5030 /********************************/
5032 void Aura::HandleAuraModAttackPower(bool apply
, bool /*Real*/)
5034 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5037 void Aura::HandleAuraModRangedAttackPower(bool apply
, bool /*Real*/)
5039 if((m_target
->getClassMask() & CLASSMASK_WAND_USERS
)!=0)
5042 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5045 void Aura::HandleAuraModAttackPowerPercent(bool apply
, bool /*Real*/)
5047 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
5048 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5051 void Aura::HandleAuraModRangedAttackPowerPercent(bool apply
, bool /*Real*/)
5053 if((m_target
->getClassMask() & CLASSMASK_WAND_USERS
)!=0)
5056 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
5057 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5060 void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool /*apply*/, bool Real
)
5062 // spells required only Real aura add/remove
5066 // Recalculate bonus
5067 if(m_target
->GetTypeId() == TYPEID_PLAYER
&& !(m_target
->getClassMask() & CLASSMASK_WAND_USERS
))
5068 ((Player
*)m_target
)->UpdateAttackPowerAndDamage(true);
5071 void Aura::HandleAuraModAttackPowerOfStatPercent(bool /*apply*/, bool Real
)
5073 // spells required only Real aura add/remove
5077 // Recalculate bonus
5078 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5079 ((Player
*)m_target
)->UpdateAttackPowerAndDamage(false);
5082 /********************************/
5083 /*** DAMAGE BONUS ***/
5084 /********************************/
5085 void Aura::HandleModDamageDone(bool apply
, bool Real
)
5087 // apply item specific bonuses for already equipped weapon
5088 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
5090 for(int i
= 0; i
< MAX_ATTACK
; ++i
)
5091 if(Item
* pItem
= ((Player
*)m_target
)->GetWeaponForAttack(WeaponAttackType(i
)))
5092 ((Player
*)m_target
)->_ApplyWeaponDependentAuraDamageMod(pItem
,WeaponAttackType(i
),this,apply
);
5095 // m_modifier.m_miscvalue is bitmask of spell schools
5096 // 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
5097 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
5098 // 127 - full bitmask any damages
5100 // mods must be applied base at equipped weapon class and subclass comparison
5101 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
5102 // m_modifier.m_miscvalue comparison with item generated damage types
5104 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
) != 0)
5106 // apply generic physical damage bonuses including wand case
5107 if (GetSpellProto()->EquippedItemClass
== -1 || m_target
->GetTypeId() != TYPEID_PLAYER
)
5109 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5110 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5111 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5115 // done in Player::_ApplyWeaponDependentAuraMods
5118 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5121 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS
,m_modifier
.m_amount
,apply
);
5123 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
,m_modifier
.m_amount
,apply
);
5127 // Skip non magic case for speedup
5128 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_MAGIC
) == 0)
5131 if( GetSpellProto()->EquippedItemClass
!= -1 || GetSpellProto()->EquippedItemInventoryTypeMask
!= 0 )
5133 // wand magic case (skip generic to all item spell bonuses)
5134 // done in Player::_ApplyWeaponDependentAuraMods
5136 // Skip item specific requirements for not wand magic damage
5140 // Magic damage modifiers implemented in Unit::SpellDamageBonus
5141 // This information for client side use only
5142 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5146 for(int i
= SPELL_SCHOOL_HOLY
; i
< MAX_SPELL_SCHOOL
; i
++)
5148 if((m_modifier
.m_miscvalue
& (1<<i
)) != 0)
5149 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS
+i
,m_modifier
.m_amount
,apply
);
5154 for(int i
= SPELL_SCHOOL_HOLY
; i
< MAX_SPELL_SCHOOL
; i
++)
5156 if((m_modifier
.m_miscvalue
& (1<<i
)) != 0)
5157 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
+i
,m_modifier
.m_amount
,apply
);
5160 Pet
* pet
= m_target
->GetPet();
5162 pet
->UpdateAttackPowerAndDamage();
5166 void Aura::HandleModDamagePercentDone(bool apply
, bool Real
)
5168 sLog
.outDebug("AURA MOD DAMAGE type:%u negative:%u", m_modifier
.m_miscvalue
, m_positive
? 0 : 1);
5170 // apply item specific bonuses for already equipped weapon
5171 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
5173 for(int i
= 0; i
< MAX_ATTACK
; ++i
)
5174 if(Item
* pItem
= ((Player
*)m_target
)->GetWeaponForAttack(WeaponAttackType(i
)))
5175 ((Player
*)m_target
)->_ApplyWeaponDependentAuraDamageMod(pItem
,WeaponAttackType(i
),this,apply
);
5178 // m_modifier.m_miscvalue is bitmask of spell schools
5179 // 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
5180 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wand
5181 // 127 - full bitmask any damages
5183 // mods must be applied base at equipped weapon class and subclass comparison
5184 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
5185 // m_modifier.m_miscvalue comparison with item generated damage types
5187 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
) != 0)
5189 // apply generic physical damage bonuses including wand case
5190 if (GetSpellProto()->EquippedItemClass
== -1 || m_target
->GetTypeId() != TYPEID_PLAYER
)
5192 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5193 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5194 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5198 // done in Player::_ApplyWeaponDependentAuraMods
5200 // For show in client
5201 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5202 m_target
->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
,m_modifier
.m_amount
/100.0f
,apply
);
5205 // Skip non magic case for speedup
5206 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_MAGIC
) == 0)
5209 if( GetSpellProto()->EquippedItemClass
!= -1 || GetSpellProto()->EquippedItemInventoryTypeMask
!= 0 )
5211 // wand magic case (skip generic to all item spell bonuses)
5212 // done in Player::_ApplyWeaponDependentAuraMods
5214 // Skip item specific requirements for not wand magic damage
5218 // Magic damage percent modifiers implemented in Unit::SpellDamageBonus
5219 // Send info to client
5220 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5221 for(int i
= SPELL_SCHOOL_HOLY
; i
< MAX_SPELL_SCHOOL
; ++i
)
5222 m_target
->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
+i
,m_modifier
.m_amount
/100.0f
,apply
);
5225 void Aura::HandleModOffhandDamagePercent(bool apply
, bool Real
)
5227 // spells required only Real aura add/remove
5231 sLog
.outDebug("AURA MOD OFFHAND DAMAGE");
5233 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5236 /********************************/
5237 /*** POWER COST ***/
5238 /********************************/
5240 void Aura::HandleModPowerCostPCT(bool apply
, bool Real
)
5242 // spells required only Real aura add/remove
5246 float amount
= m_modifier
.m_amount
/100.0f
;
5247 for(int i
= 0; i
< MAX_SPELL_SCHOOL
; ++i
)
5248 if(m_modifier
.m_miscvalue
& (1<<i
))
5249 m_target
->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER
+i
,amount
,apply
);
5252 void Aura::HandleModPowerCost(bool apply
, bool Real
)
5254 // spells required only Real aura add/remove
5258 for(int i
= 0; i
< MAX_SPELL_SCHOOL
; ++i
)
5259 if(m_modifier
.m_miscvalue
& (1<<i
))
5260 m_target
->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER
+i
,m_modifier
.m_amount
,apply
);
5263 void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real
)
5265 // spells required only Real aura add/remove
5268 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5270 uint32 mask
[3] = {0, 0, 0};
5271 Unit::AuraList
const& noReagent
= m_target
->GetAurasByType(SPELL_AURA_NO_REAGENT_USE
);
5272 for(Unit::AuraList::const_iterator i
= noReagent
.begin(); i
!= noReagent
.end(); ++i
)
5274 uint32
const *ptr
= (*i
)->getAuraSpellClassMask();
5280 m_target
->SetUInt32Value(PLAYER_NO_REAGENT_COST_1
, mask
[0]);
5281 m_target
->SetUInt32Value(PLAYER_NO_REAGENT_COST_1
+1, mask
[1]);
5282 m_target
->SetUInt32Value(PLAYER_NO_REAGENT_COST_1
+2, mask
[2]);
5285 /*********************************************************/
5287 /*********************************************************/
5289 void Aura::HandleShapeshiftBoosts(bool apply
)
5292 uint32 spellId2
= 0;
5293 uint32 HotWSpellId
= 0;
5295 switch(GetModifier()->m_miscvalue
)
5299 HotWSpellId
= 24900;
5314 HotWSpellId
= 24899;
5319 HotWSpellId
= 24899;
5321 case FORM_BATTLESTANCE
:
5324 case FORM_DEFENSIVESTANCE
:
5327 case FORM_BERSERKERSTANCE
:
5332 // aura from effect trigger spell
5339 case FORM_FLIGHT_EPIC
:
5343 case FORM_METAMORPHOSIS
:
5347 case FORM_SPIRITOFREDEMPTION
:
5349 spellId2
= 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
5351 case FORM_GHOSTWOLF
:
5356 case FORM_CREATURECAT
:
5357 case FORM_CREATUREBEAR
:
5362 uint32 form
= GetModifier()->m_miscvalue
-1;
5366 if (spellId
) m_target
->CastSpell(m_target
, spellId
, true, NULL
, this );
5367 if (spellId2
) m_target
->CastSpell(m_target
, spellId2
, true, NULL
, this);
5369 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5371 const PlayerSpellMap
& sp_list
= ((Player
*)m_target
)->GetSpellMap();
5372 for (PlayerSpellMap::const_iterator itr
= sp_list
.begin(); itr
!= sp_list
.end(); ++itr
)
5374 if(itr
->second
->state
== PLAYERSPELL_REMOVED
) continue;
5375 if(itr
->first
==spellId
|| itr
->first
==spellId2
) continue;
5376 SpellEntry
const *spellInfo
= sSpellStore
.LookupEntry(itr
->first
);
5377 if (!spellInfo
|| !(spellInfo
->Attributes
& (SPELL_ATTR_PASSIVE
| (1<<7)))) continue;
5378 if (spellInfo
->Stances
& (1<<form
))
5379 m_target
->CastSpell(m_target
, itr
->first
, true, NULL
, this);
5382 if (((Player
*)m_target
)->HasSpell(17007))
5384 SpellEntry
const *spellInfo
= sSpellStore
.LookupEntry(24932);
5385 if (spellInfo
&& spellInfo
->Stances
& (1<<form
))
5386 m_target
->CastSpell(m_target
, 24932, true, NULL
, this);
5391 Unit::AuraList
const& mModTotalStatPct
= m_target
->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
);
5392 for(Unit::AuraList::const_iterator i
= mModTotalStatPct
.begin(); i
!= mModTotalStatPct
.end(); ++i
)
5394 if ((*i
)->GetSpellProto()->SpellIconID
== 240 && (*i
)->GetModifier()->m_miscvalue
== 3)
5396 int32 HotWMod
= (*i
)->GetModifier()->m_amount
;
5397 if(GetModifier()->m_miscvalue
== FORM_CAT
)
5400 m_target
->CastCustomSpell(m_target
, HotWSpellId
, &HotWMod
, NULL
, NULL
, true, NULL
, this);
5409 m_target
->RemoveAurasDueToSpell(spellId
);
5410 m_target
->RemoveAurasDueToSpell(spellId2
);
5412 Unit::AuraMap
& tAuras
= m_target
->GetAuras();
5413 for (Unit::AuraMap::iterator itr
= tAuras
.begin(); itr
!= tAuras
.end();)
5415 if (itr
->second
->IsRemovedOnShapeLost())
5417 m_target
->RemoveAurasDueToSpell(itr
->second
->GetId());
5418 itr
= tAuras
.begin();
5427 /*double healthPercentage = (double)m_target->GetHealth() / (double)m_target->GetMaxHealth();
5428 m_target->SetHealth(uint32(ceil((double)m_target->GetMaxHealth() * healthPercentage)));*/
5431 void Aura::HandleAuraEmpathy(bool apply
, bool /*Real*/)
5433 if(m_target
->GetTypeId() != TYPEID_UNIT
)
5436 CreatureInfo
const * ci
= objmgr
.GetCreatureTemplate(m_target
->GetEntry());
5437 if(ci
&& ci
->type
== CREATURE_TYPE_BEAST
)
5438 m_target
->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_SPECIALINFO
, apply
);
5441 void Aura::HandleAuraUntrackable(bool apply
, bool /*Real*/)
5444 m_target
->SetByteFlag(UNIT_FIELD_BYTES_1
, 3, UNIT_BYTE1_FLAG_UNTRACKABLE
);
5446 m_target
->RemoveByteFlag(UNIT_FIELD_BYTES_1
, 3, UNIT_BYTE1_FLAG_UNTRACKABLE
);
5449 void Aura::HandleAuraModPacify(bool apply
, bool /*Real*/)
5451 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5455 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PACIFIED
);
5457 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PACIFIED
);
5460 void Aura::HandleAuraModPacifyAndSilence(bool apply
, bool Real
)
5462 HandleAuraModPacify(apply
,Real
);
5463 HandleAuraModSilence(apply
,Real
);
5466 void Aura::HandleAuraGhost(bool apply
, bool /*Real*/)
5468 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5473 m_target
->SetFlag(PLAYER_FLAGS
, PLAYER_FLAGS_GHOST
);
5477 m_target
->RemoveFlag(PLAYER_FLAGS
, PLAYER_FLAGS_GHOST
);
5481 void Aura::HandleAuraAllowFlight(bool apply
, bool Real
)
5483 // all applied/removed only at real aura add/remove
5490 data
.Initialize(SMSG_MOVE_SET_CAN_FLY
, 12);
5492 data
.Initialize(SMSG_MOVE_UNSET_CAN_FLY
, 12);
5493 data
.append(m_target
->GetPackGUID());
5494 data
<< uint32(0); // unk
5495 m_target
->SendMessageToSet(&data
, true);
5498 void Aura::HandleModRating(bool apply
, bool Real
)
5500 // spells required only Real aura add/remove
5504 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5507 for (uint32 rating
= 0; rating
< MAX_COMBAT_RATING
; ++rating
)
5508 if (m_modifier
.m_miscvalue
& (1 << rating
))
5509 ((Player
*)m_target
)->ApplyRatingMod(CombatRating(rating
), m_modifier
.m_amount
, apply
);
5512 void Aura::HandleModRatingFromStat(bool apply
, bool Real
)
5514 // spells required only Real aura add/remove
5518 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5520 // Just recalculate ratings
5521 for (uint32 rating
= 0; rating
< MAX_COMBAT_RATING
; ++rating
)
5522 if (m_modifier
.m_miscvalue
& (1 << rating
))
5523 ((Player
*)m_target
)->ApplyRatingMod(CombatRating(rating
), 0, apply
);
5526 void Aura::HandleForceMoveForward(bool apply
, bool Real
)
5528 if(!Real
|| m_target
->GetTypeId() != TYPEID_PLAYER
)
5531 m_target
->SetFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FORCE_MOVE
);
5533 m_target
->RemoveFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FORCE_MOVE
);
5536 void Aura::HandleAuraModExpertise(bool /*apply*/, bool /*Real*/)
5538 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5541 ((Player
*)m_target
)->UpdateExpertise(BASE_ATTACK
);
5542 ((Player
*)m_target
)->UpdateExpertise(OFF_ATTACK
);
5545 void Aura::HandleModTargetResistance(bool apply
, bool Real
)
5547 // spells required only Real aura add/remove
5550 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
5552 // show armor penetration
5553 if (m_target
->GetTypeId() == TYPEID_PLAYER
&& (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
))
5554 m_target
->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
,m_modifier
.m_amount
, apply
);
5556 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
5557 if (m_target
->GetTypeId() == TYPEID_PLAYER
&& (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_SPELL
)==SPELL_SCHOOL_MASK_SPELL
)
5558 m_target
->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE
,m_modifier
.m_amount
, apply
);
5561 void Aura::HandleShieldBlockValue(bool apply
, bool /*Real*/)
5563 BaseModType modType
= FLAT_MOD
;
5564 if(m_modifier
.m_auraname
== SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
)
5567 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5568 ((Player
*)m_target
)->HandleBaseModValue(SHIELD_BLOCK_VALUE
, modType
, float(m_modifier
.m_amount
), apply
);
5571 void Aura::HandleAuraRetainComboPoints(bool apply
, bool Real
)
5573 // spells required only Real aura add/remove
5577 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5580 Player
*target
= (Player
*)m_target
;
5582 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5583 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5584 if( !apply
&& m_duration
==0 && target
->GetComboTarget())
5585 if(Unit
* unit
= ObjectAccessor::GetUnit(*m_target
,target
->GetComboTarget()))
5586 target
->AddComboPoints(unit
, -m_modifier
.m_amount
);
5589 void Aura::HandleModUnattackable( bool Apply
, bool Real
)
5593 m_target
->CombatStop();
5594 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
5596 m_target
->ApplyModFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_NON_ATTACKABLE
,Apply
);
5599 void Aura::HandleSpiritOfRedemption( bool apply
, bool Real
)
5601 // spells required only Real aura add/remove
5605 // prepare spirit state
5608 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
5610 // disable breath/etc timers
5611 ((Player
*)m_target
)->StopMirrorTimers();
5613 // set stand state (expected in this form)
5614 if(!m_target
->IsStandState())
5615 m_target
->SetStandState(UNIT_STAND_STATE_STAND
);
5618 m_target
->SetHealth(1);
5622 m_target
->DealDamage(m_target
, m_target
->GetHealth(), NULL
, DIRECT_DAMAGE
, SPELL_SCHOOL_MASK_NORMAL
, GetSpellProto(), false);
5625 void Aura::CleanupTriggeredSpells()
5627 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_WARRIOR
&& m_spellProto
->SpellFamilyFlags
& 0x0000001000000020LL
)
5629 // Blood Frenzy remove
5630 m_target
->RemoveAurasDueToSpell(30069);
5631 m_target
->RemoveAurasDueToSpell(30070);
5635 uint32 tSpellId
= m_spellProto
->EffectTriggerSpell
[GetEffIndex()];
5639 SpellEntry
const* tProto
= sSpellStore
.LookupEntry(tSpellId
);
5643 if(GetSpellDuration(tProto
) != -1)
5646 // needed for spell 43680, maybe others
5647 // TODO: is there a spell flag, which can solve this in a more sophisticated way?
5648 if(m_spellProto
->EffectApplyAuraName
[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL
&&
5649 GetSpellDuration(m_spellProto
) == m_spellProto
->EffectAmplitude
[GetEffIndex()])
5651 m_target
->RemoveAurasDueToSpell(tSpellId
);
5654 void Aura::HandleSchoolAbsorb(bool apply
, bool Real
)
5659 // prevent double apply bonuses
5660 if(apply
&& (m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading()))
5662 if(Unit
* caster
= GetCaster())
5664 float DoneActualBenefit
= 0.0f
;
5665 switch(m_spellProto
->SpellFamilyName
)
5667 case SPELLFAMILY_PRIEST
:
5668 if(m_spellProto
->SpellFamilyFlags
== 0x1) //PW:S
5670 //+30% from +healing bonus
5671 DoneActualBenefit
= caster
->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto
)) * 0.3f
;
5675 case SPELLFAMILY_MAGE
:
5676 if(m_spellProto
->SpellFamilyFlags
== 0x80100 || m_spellProto
->SpellFamilyFlags
== 0x8 || m_spellProto
->SpellFamilyFlags
== 0x100000000LL
)
5678 //frost ward, fire ward, ice barrier
5679 //+10% from +spd bonus
5680 DoneActualBenefit
= caster
->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto
)) * 0.1f
;
5684 case SPELLFAMILY_WARLOCK
:
5685 if(m_spellProto
->SpellFamilyFlags
== 0x00)
5688 //+10% from +spd bonus
5689 DoneActualBenefit
= caster
->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto
)) * 0.1f
;
5697 DoneActualBenefit
*= caster
->CalculateLevelPenalty(GetSpellProto());
5699 m_modifier
.m_amount
+= (int32
)DoneActualBenefit
;
5704 void Aura::PeriodicTick()
5706 if(!m_target
->isAlive())
5709 switch(m_modifier
.m_auraname
)
5711 case SPELL_AURA_PERIODIC_DAMAGE
:
5712 case SPELL_AURA_PERIODIC_DAMAGE_PERCENT
:
5714 Unit
*pCaster
= GetCaster();
5718 if( GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA
&&
5719 pCaster
->SpellHitResult(m_target
,GetSpellProto(),false)!=SPELL_MISS_NONE
)
5722 // Check for immune (not use charges)
5723 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
5726 // some auras remove at specific health level or more
5727 if(m_modifier
.m_auraname
==SPELL_AURA_PERIODIC_DAMAGE
)
5731 case 43093: case 31956: case 38801:
5732 case 35321: case 38363: case 39215:
5733 if(m_target
->GetHealth() == m_target
->GetMaxHealth() )
5735 m_target
->RemoveAurasDueToSpell(GetId());
5742 GetEffIndex() < 2 && GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_DUMMY
?
5743 pCaster
->CalculateSpellDamage(GetSpellProto(),GetEffIndex()+1,GetSpellProto()->EffectBasePoints
[GetEffIndex()+1],m_target
) :
5745 if(m_target
->GetHealth()*100 >= m_target
->GetMaxHealth()*percent
)
5747 m_target
->RemoveAurasDueToSpell(GetId());
5759 CleanDamage cleanDamage
= CleanDamage(0, BASE_ATTACK
, MELEE_HIT_NORMAL
);
5761 // ignore non positive values (can be result apply spellmods to aura damage
5762 uint32 amount
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
5766 if(m_modifier
.m_auraname
== SPELL_AURA_PERIODIC_DAMAGE
)
5770 // Calculate armor mitigation if it is a physical spell
5771 // But not for bleed mechanic spells
5772 if ( GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL
&&
5773 GetEffectMechanic(GetSpellProto(), m_effIndex
) != MECHANIC_BLEED
)
5775 uint32 pdamageReductedArmor
= pCaster
->CalcArmorReducedDamage(m_target
, pdamage
);
5776 cleanDamage
.damage
+= pdamage
- pdamageReductedArmor
;
5777 pdamage
= pdamageReductedArmor
;
5780 pdamage
= pCaster
->SpellDamageBonus(m_target
, GetSpellProto(), pdamage
, DOT
, GetStackAmount());
5782 // Curse of Agony damage-per-tick calculation
5783 if (GetSpellProto()->SpellFamilyName
==SPELLFAMILY_WARLOCK
&& (GetSpellProto()->SpellFamilyFlags
& 0x0000000000000400LL
) && GetSpellProto()->SpellIconID
==544)
5785 // 1..4 ticks, 1/2 from normal tick damage
5786 if (m_duration
>=((m_maxduration
-m_modifier
.periodictime
)*2/3))
5787 pdamage
= pdamage
/2;
5788 // 9..12 ticks, 3/2 from normal tick damage
5789 else if(m_duration
<((m_maxduration
-m_modifier
.periodictime
)/3))
5790 pdamage
+= (pdamage
+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
5791 // 5..8 ticks have normal tick damage
5795 pdamage
= uint32(m_target
->GetMaxHealth()*amount
/100);
5797 //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
5798 // Reduce dot damage from resilience for players
5799 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
5800 pdamage
-=((Player
*)m_target
)->GetDotDamageReduction(pdamage
);
5802 pCaster
->CalcAbsorbResist(m_target
, GetSpellSchoolMask(GetSpellProto()), DOT
, pdamage
, &absorb
, &resist
);
5804 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
5805 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId(),absorb
);
5807 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
5808 data
.append(m_target
->GetPackGUID());
5809 data
.appendPackGUID(GetCasterGUID());
5810 data
<< uint32(GetId());
5812 data
<< uint32(m_modifier
.m_auraname
);
5813 data
<< (uint32
)pdamage
;
5814 data
<< uint32(0); // overkill
5815 data
<< (uint32
)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x
5816 data
<< (uint32
)absorb
;
5817 data
<< (uint32
)resist
;
5818 m_target
->SendMessageToSet(&data
,true);
5820 Unit
* target
= m_target
; // aura can be deleted in DealDamage
5821 SpellEntry
const* spellProto
= GetSpellProto();
5824 uint32 procAttacker
= PROC_FLAG_ON_DO_PERIODIC
;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
5825 uint32 procVictim
= PROC_FLAG_ON_TAKE_PERIODIC
;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
5826 pdamage
= (pdamage
<= absorb
+resist
) ? 0 : (pdamage
-absorb
-resist
);
5828 procVictim
|=PROC_FLAG_TAKEN_ANY_DAMAGE
;
5829 pCaster
->ProcDamageAndSpell(target
, procAttacker
, procVictim
, PROC_EX_NORMAL_HIT
, pdamage
, BASE_ATTACK
, spellProto
);
5831 pCaster
->DealDamage(target
, pdamage
, &cleanDamage
, DOT
, GetSpellSchoolMask(spellProto
), spellProto
, true);
5834 case SPELL_AURA_PERIODIC_LEECH
:
5835 case SPELL_AURA_PERIODIC_HEALTH_FUNNEL
:
5837 Unit
*pCaster
= GetCaster();
5841 if(!pCaster
->isAlive())
5844 if( GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA
&&
5845 pCaster
->SpellHitResult(m_target
,GetSpellProto(),false)!=SPELL_MISS_NONE
)
5849 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
5854 CleanDamage cleanDamage
= CleanDamage(0, BASE_ATTACK
, MELEE_HIT_NORMAL
);
5856 uint32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
5858 //Calculate armor mitigation if it is a physical spell
5859 if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL
)
5861 uint32 pdamageReductedArmor
= pCaster
->CalcArmorReducedDamage(m_target
, pdamage
);
5862 cleanDamage
.damage
+= pdamage
- pdamageReductedArmor
;
5863 pdamage
= pdamageReductedArmor
;
5866 pdamage
= pCaster
->SpellDamageBonus(m_target
, GetSpellProto(), pdamage
, DOT
, GetStackAmount());
5868 //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
5869 // Reduce dot damage from resilience for players
5870 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
5871 pdamage
-=((Player
*)m_target
)->GetDotDamageReduction(pdamage
);
5873 pCaster
->CalcAbsorbResist(m_target
, GetSpellSchoolMask(GetSpellProto()), DOT
, pdamage
, &absorb
, &resist
);
5875 if(m_target
->GetHealth() < pdamage
)
5876 pdamage
= uint32(m_target
->GetHealth());
5878 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
5879 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId(),absorb
);
5881 pCaster
->SendSpellNonMeleeDamageLog(m_target
, GetId(), pdamage
, GetSpellSchoolMask(GetSpellProto()), absorb
, resist
, false, 0);
5884 Unit
* target
= m_target
; // aura can be deleted in DealDamage
5885 SpellEntry
const* spellProto
= GetSpellProto();
5886 float multiplier
= spellProto
->EffectMultipleValue
[GetEffIndex()] > 0 ? spellProto
->EffectMultipleValue
[GetEffIndex()] : 1;
5887 int32 stackAmount
= GetStackAmount();
5890 uint32 procAttacker
= PROC_FLAG_ON_DO_PERIODIC
;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
5891 uint32 procVictim
= PROC_FLAG_ON_TAKE_PERIODIC
;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
5892 pdamage
= (pdamage
<= absorb
+resist
) ? 0 : (pdamage
-absorb
-resist
);
5894 procVictim
|=PROC_FLAG_TAKEN_ANY_DAMAGE
;
5895 pCaster
->ProcDamageAndSpell(target
, procAttacker
, procVictim
, PROC_EX_NORMAL_HIT
, pdamage
, BASE_ATTACK
, spellProto
);
5896 int32 new_damage
= pCaster
->DealDamage(target
, pdamage
, &cleanDamage
, DOT
, GetSpellSchoolMask(spellProto
), spellProto
, false);
5898 if (!target
->isAlive() && pCaster
->IsNonMeleeSpellCasted(false))
5900 for (uint32 i
= CURRENT_FIRST_NON_MELEE_SPELL
; i
< CURRENT_MAX_SPELL
; i
++)
5902 if (pCaster
->m_currentSpells
[i
] && pCaster
->m_currentSpells
[i
]->m_spellInfo
->Id
== spellProto
->Id
)
5903 pCaster
->m_currentSpells
[i
]->cancel();
5908 if(Player
*modOwner
= pCaster
->GetSpellModOwner())
5909 modOwner
->ApplySpellMod(spellProto
->Id
, SPELLMOD_MULTIPLE_VALUE
, multiplier
);
5911 uint32 heal
= pCaster
->SpellHealingBonus(pCaster
, spellProto
, uint32(new_damage
* multiplier
), DOT
, stackAmount
);
5913 int32 gain
= pCaster
->DealHeal(pCaster
, heal
, spellProto
);
5914 pCaster
->getHostilRefManager().threatAssist(pCaster
, gain
* 0.5f
, spellProto
);
5917 case SPELL_AURA_PERIODIC_HEAL
:
5918 case SPELL_AURA_OBS_MOD_HEALTH
:
5920 Unit
*pCaster
= GetCaster();
5924 // heal for caster damage (must be alive)
5925 if(m_target
!= pCaster
&& GetSpellProto()->SpellVisual
[0]==163 && !pCaster
->isAlive())
5928 // ignore non positive values (can be result apply spellmods to aura damage
5929 uint32 amount
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
5933 if(m_modifier
.m_auraname
==SPELL_AURA_OBS_MOD_HEALTH
)
5934 pdamage
= uint32(m_target
->GetMaxHealth() * amount
/100);
5938 pdamage
= pCaster
->SpellHealingBonus(m_target
, GetSpellProto(), pdamage
, DOT
, GetStackAmount());
5940 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
5941 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
5943 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
5944 data
.append(m_target
->GetPackGUID());
5945 data
.appendPackGUID(GetCasterGUID());
5946 data
<< uint32(GetId());
5948 data
<< uint32(m_modifier
.m_auraname
);
5949 data
<< (uint32
)pdamage
;
5950 data
<< uint32(0); // wotlk
5951 m_target
->SendMessageToSet(&data
,true);
5953 int32 gain
= m_target
->ModifyHealth(pdamage
);
5955 // add HoTs to amount healed in bgs
5956 if( pCaster
->GetTypeId() == TYPEID_PLAYER
)
5957 if( BattleGround
*bg
= ((Player
*)pCaster
)->GetBattleGround() )
5958 bg
->UpdatePlayerScore(((Player
*)pCaster
), SCORE_HEALING_DONE
, gain
);
5960 m_target
->getHostilRefManager().threatAssist(pCaster
, float(gain
) * 0.5f
, GetSpellProto());
5962 SpellEntry
const* spellProto
= GetSpellProto();
5964 // heal for caster damage
5965 if(m_target
!=pCaster
&& spellProto
->SpellVisual
[0]==163)
5967 uint32 dmg
= spellProto
->manaPerSecond
;
5968 if(pCaster
->GetHealth() <= dmg
&& pCaster
->GetTypeId()==TYPEID_PLAYER
)
5970 pCaster
->RemoveAurasDueToSpell(GetId());
5972 // finish current generic/channeling spells, don't affect autorepeat
5973 if(pCaster
->m_currentSpells
[CURRENT_GENERIC_SPELL
])
5975 pCaster
->m_currentSpells
[CURRENT_GENERIC_SPELL
]->finish();
5977 if(pCaster
->m_currentSpells
[CURRENT_CHANNELED_SPELL
])
5979 pCaster
->m_currentSpells
[CURRENT_CHANNELED_SPELL
]->SendChannelUpdate(0);
5980 pCaster
->m_currentSpells
[CURRENT_CHANNELED_SPELL
]->finish();
5985 pCaster
->SendSpellNonMeleeDamageLog(pCaster
, GetId(), gain
, GetSpellSchoolMask(GetSpellProto()), 0, 0, false, 0, false);
5987 CleanDamage cleanDamage
= CleanDamage(0, BASE_ATTACK
, MELEE_HIT_NORMAL
);
5988 pCaster
->DealDamage(pCaster
, gain
, &cleanDamage
, NODAMAGE
, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);
5992 // uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HEAL;
5993 // uint32 procVictim = 0;//ROC_FLAG_ON_TAKE_PERIODIC | PROC_FLAG_TAKEN_HEAL;
5994 // ignore item heals
5995 // if(procSpell && !haveCastItem)
5996 // pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
5999 case SPELL_AURA_PERIODIC_MANA_LEECH
:
6001 if(m_modifier
.m_miscvalue
< 0 || m_modifier
.m_miscvalue
>= MAX_POWERS
)
6004 Powers power
= Powers(m_modifier
.m_miscvalue
);
6006 // power type might have changed between aura applying and tick (druid's shapeshift)
6007 if(m_target
->getPowerType() != power
)
6010 Unit
*pCaster
= GetCaster();
6014 if(!pCaster
->isAlive())
6017 if( GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA
&&
6018 pCaster
->SpellHitResult(m_target
,GetSpellProto(),false)!=SPELL_MISS_NONE
)
6021 // Check for immune (not use charges)
6022 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
6025 // ignore non positive values (can be result apply spellmods to aura damage
6026 uint32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6028 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
6029 // It's mana percent cost spells, m_modifier.m_amount is percent drain from target
6030 if (m_spellProto
->ManaCostPercentage
)
6033 uint32 maxmana
= pCaster
->GetMaxPower(power
) * pdamage
* 2 / 100;
6034 pdamage
= m_target
->GetMaxPower(power
) * pdamage
/ 100;
6035 if(pdamage
> maxmana
)
6039 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
6040 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
6042 int32 drain_amount
= m_target
->GetPower(power
) > pdamage
? pdamage
: m_target
->GetPower(power
);
6044 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6045 if (power
== POWER_MANA
&& m_target
->GetTypeId() == TYPEID_PLAYER
)
6046 drain_amount
-= ((Player
*)m_target
)->GetSpellCritDamageReduction(drain_amount
);
6048 m_target
->ModifyPower(power
, -drain_amount
);
6050 float gain_multiplier
= 0;
6052 if(pCaster
->GetMaxPower(power
) > 0)
6054 gain_multiplier
= GetSpellProto()->EffectMultipleValue
[GetEffIndex()];
6056 if(Player
*modOwner
= pCaster
->GetSpellModOwner())
6057 modOwner
->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE
, gain_multiplier
);
6060 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
6061 data
.append(m_target
->GetPackGUID());
6062 data
.appendPackGUID(GetCasterGUID());
6063 data
<< uint32(GetId());
6065 data
<< uint32(m_modifier
.m_auraname
);
6066 data
<< (uint32
)power
; // power type
6067 data
<< (uint32
)drain_amount
;
6068 data
<< (float)gain_multiplier
;
6069 m_target
->SendMessageToSet(&data
,true);
6071 int32 gain_amount
= int32(drain_amount
*gain_multiplier
);
6075 int32 gain
= pCaster
->ModifyPower(power
,gain_amount
);
6076 m_target
->AddThreat(pCaster
, float(gain
) * 0.5f
, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
6080 case SPELL_AURA_PERIODIC_ENERGIZE
:
6082 // ignore non positive values (can be result apply spellmods to aura damage
6083 uint32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6085 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
6086 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
6088 if(m_modifier
.m_miscvalue
< 0 || m_modifier
.m_miscvalue
>= MAX_POWERS
)
6091 Powers power
= Powers(m_modifier
.m_miscvalue
);
6093 if(m_target
->GetMaxPower(power
) == 0)
6096 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
6097 data
.append(m_target
->GetPackGUID());
6098 data
.appendPackGUID(GetCasterGUID());
6099 data
<< uint32(GetId());
6101 data
<< uint32(m_modifier
.m_auraname
);
6102 data
<< (uint32
)power
; // power type
6103 data
<< (uint32
)pdamage
;
6104 m_target
->SendMessageToSet(&data
,true);
6106 int32 gain
= m_target
->ModifyPower(power
,pdamage
);
6108 if(Unit
* pCaster
= GetCaster())
6109 m_target
->getHostilRefManager().threatAssist(pCaster
, float(gain
) * 0.5f
, GetSpellProto());
6112 case SPELL_AURA_OBS_MOD_MANA
:
6114 // ignore non positive values (can be result apply spellmods to aura damage
6115 uint32 amount
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6117 uint32 pdamage
= uint32(m_target
->GetMaxPower(POWER_MANA
) * amount
/100);
6119 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u mana inflicted by %u",
6120 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
6122 if(m_target
->GetMaxPower(POWER_MANA
) == 0)
6125 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
6126 data
.append(m_target
->GetPackGUID());
6127 data
.appendPackGUID(GetCasterGUID());
6128 data
<< uint32(GetId());
6130 data
<< uint32(m_modifier
.m_auraname
);
6131 data
<< (uint32
)0; // ?
6132 data
<< (uint32
)pdamage
;
6133 m_target
->SendMessageToSet(&data
,true);
6135 int32 gain
= m_target
->ModifyPower(POWER_MANA
, pdamage
);
6137 if(Unit
* pCaster
= GetCaster())
6138 m_target
->getHostilRefManager().threatAssist(pCaster
, float(gain
) * 0.5f
, GetSpellProto());
6141 case SPELL_AURA_POWER_BURN_MANA
:
6143 Unit
*pCaster
= GetCaster();
6147 // Check for immune (not use charges)
6148 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
6151 int32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6153 Powers powerType
= Powers(m_modifier
.m_miscvalue
);
6155 if(!m_target
->isAlive() || m_target
->getPowerType() != powerType
)
6158 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6159 if (powerType
== POWER_MANA
&& m_target
->GetTypeId() == TYPEID_PLAYER
)
6160 pdamage
-= ((Player
*)m_target
)->GetSpellCritDamageReduction(pdamage
);
6162 uint32 gain
= uint32(-m_target
->ModifyPower(powerType
, -pdamage
));
6164 gain
= uint32(gain
* GetSpellProto()->EffectMultipleValue
[GetEffIndex()]);
6166 SpellEntry
const* spellProto
= GetSpellProto();
6167 //maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6168 SpellNonMeleeDamage
damageInfo(pCaster
, m_target
, spellProto
->Id
, spellProto
->SchoolMask
);
6169 pCaster
->CalculateSpellDamage(&damageInfo
, gain
, spellProto
);
6170 pCaster
->SendSpellNonMeleeDamageLog(&damageInfo
);
6173 uint32 procAttacker
= PROC_FLAG_ON_DO_PERIODIC
;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
6174 uint32 procVictim
= PROC_FLAG_ON_TAKE_PERIODIC
;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
6175 uint32 procEx
= createProcExtendMask(&damageInfo
, SPELL_MISS_NONE
);
6176 if (damageInfo
.damage
)
6177 procVictim
|=PROC_FLAG_TAKEN_ANY_DAMAGE
;
6179 pCaster
->ProcDamageAndSpell(damageInfo
.target
, procAttacker
, procVictim
, procEx
, damageInfo
.damage
, BASE_ATTACK
, spellProto
);
6181 pCaster
->DealSpellDamage(&damageInfo
, true);
6184 case SPELL_AURA_MOD_REGEN
:
6186 int32 gain
= m_target
->ModifyHealth(m_modifier
.m_amount
);
6187 if (Unit
*caster
= GetCaster())
6188 m_target
->getHostilRefManager().threatAssist(caster
, float(gain
) * 0.5f
, GetSpellProto());
6191 case SPELL_AURA_MOD_POWER_REGEN
:
6193 Powers pt
= m_target
->getPowerType();
6194 if(int32(pt
) != m_modifier
.m_miscvalue
)
6197 if ( GetSpellProto()->AuraInterruptFlags
& AURA_INTERRUPT_FLAG_NOT_SEATED
)
6200 m_target
->HandleEmoteCommand(EMOTE_ONESHOT_EAT
);
6202 else if( GetId() == 20577 )
6205 m_target
->HandleEmoteCommand(EMOTE_STATE_CANNIBALIZE
);
6209 // amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3
6210 // so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec
6211 if(pt
== POWER_RAGE
)
6212 m_target
->ModifyPower(pt
, m_modifier
.m_amount
*3/5);
6215 // Here tick dummy auras
6216 case SPELL_AURA_PERIODIC_DUMMY
:
6218 PeriodicDummyTick();
6221 case SPELL_AURA_PERIODIC_TRIGGER_SPELL
:
6226 case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
:
6228 TriggerSpellWithValue();
6236 void Aura::PeriodicDummyTick()
6238 Unit
*caster
= GetCaster();
6239 SpellEntry
const* spell
= GetSpellProto();
6240 switch (spell
->SpellFamilyName
)
6242 case SPELLFAMILY_GENERIC
:
6258 case 49472: // Drink Coffee
6261 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
6263 // Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus
6264 Unit::AuraList
const& aura
= m_target
->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN
);
6265 for(Unit::AuraList::const_iterator i
= aura
.begin(); i
!= aura
.end(); ++i
)
6267 if ((*i
)->GetId() == GetId())
6269 (*i
)->GetModifier()->m_amount
= m_modifier
.m_amount
;
6270 ((Player
*)m_target
)->UpdateManaRegen();
6272 m_isPeriodic
= false;
6281 // Possibly need cast one of them (but
6282 // 7038 Forsaken Skill: Swords
6283 // 7039 Forsaken Skill: Axes
6284 // 7040 Forsaken Skill: Daggers
6285 // 7041 Forsaken Skill: Maces
6286 // 7042 Forsaken Skill: Staves
6287 // 7043 Forsaken Skill: Bows
6288 // 7044 Forsaken Skill: Guns
6289 // 7045 Forsaken Skill: 2H Axes
6290 // 7046 Forsaken Skill: 2H Maces
6291 // 7047 Forsaken Skill: 2H Swords
6292 // 7048 Forsaken Skill: Defense
6293 // 7049 Forsaken Skill: Fire
6294 // 7050 Forsaken Skill: Frost
6295 // 7051 Forsaken Skill: Holy
6296 // 7053 Forsaken Skill: Shadow
6300 // case 19230: break;
6301 // // Gossip NPC Periodic - Talk
6302 // case 33208: break;
6303 // // Gossip NPC Periodic - Despawn
6304 // case 33209: break;
6306 // case 36207: break;
6307 // // Simon Game START timer, (DND)
6308 // case 39993: break;
6309 // // Knockdown Fel Cannon: break; The Aggro Burst
6310 // case 40119: break;
6311 // // Old Mount Spell
6312 // case 40154: break;
6314 // case 40581: break;
6315 // // Ethereal Ring: break; The Bolt Burst
6316 // case 40801: break;
6317 // // Crystal Prison
6318 // case 40846: break;
6320 // case 41054: break;
6322 // case 41404: break;
6323 // // Ethereal Ring Visual, Lightning Aura
6324 // case 41477: break;
6325 // // Ethereal Ring Visual, Lightning Aura (Fork)
6326 // case 41525: break;
6327 // // Ethereal Ring Visual, Lightning Jumper Aura
6328 // case 41567: break;
6330 // case 41955: break;
6331 // // Headless Horseman - Fire
6332 // case 42074: break;
6333 // // Headless Horseman - Visual - Large Fire
6334 // case 42075: break;
6335 // // Headless Horseman - Start Fire, Periodic Aura
6336 // case 42140: break;
6337 // // Ram Speed Boost
6338 // case 42152: break;
6339 // // Headless Horseman - Fires Out Victory Aura
6340 // case 42235: break;
6341 // // Pumpkin Life Cycle
6342 // case 42280: break;
6343 // // Brewfest Request Chick Chuck Mug Aura
6344 // case 42537: break;
6346 // case 42596: break;
6347 // // Headless Horseman Climax, Head: Periodic
6348 // case 42603: break;
6350 // case 42621: break;
6351 // // Headless Horseman - Conflagrate, Periodic Aura
6352 // case 42637: break;
6353 // // Headless Horseman - Create Pumpkin Treats Aura
6354 // case 42774: break;
6355 // // Headless Horseman Climax - Summoning Rhyme Aura
6356 // case 42879: break;
6358 // case 42919: break;
6360 // case 42924: break;
6362 // case 42992: break;
6364 // case 42993: break;
6366 // case 42994: break;
6367 // // Ram Level - Neutral
6368 // case 43310: break;
6369 // // Headless Horseman - Maniacal Laugh, Maniacal, Delayed 17
6370 // case 43884: break;
6372 // case 43963: break;
6373 // // Headless Horseman - Maniacal Laugh, Maniacal, other, Delayed 17
6374 // case 44000: break;
6375 // // Energy Feedback
6376 // case 44328: break;
6377 // // Romantic Picnic
6378 // case 45102: break;
6379 // // Romantic Picnic
6380 // case 45123: break;
6381 // // Looking for Love
6382 // case 45124: break;
6383 // // Kite - Lightning Strike Kite Aura
6384 // case 45197: break;
6385 // // Rocket Chicken
6386 // case 45202: break;
6387 // // Copy Offhand Weapon
6388 // case 45205: break;
6389 // // Upper Deck - Kite - Lightning Periodic Aura
6390 // case 45207: break;
6391 // // Kite -Sky Lightning Strike Kite Aura
6392 // case 45251: break;
6393 // // Ribbon Pole Dancer Check Aura
6394 // case 45390: break;
6395 // // Holiday - Midsummer, Ribbon Pole Periodic Visual
6396 // case 45406: break;
6398 // case 45472: break;
6399 // // Alliance Flag, Extra Damage Debuff
6400 // case 45898: break;
6401 // // Horde Flag, Extra Damage Debuff
6402 // case 45899: break;
6403 // // Ahune - Summoning Rhyme Aura
6404 // case 45926: break;
6405 // // Ahune - Slippery Floor
6406 // case 45945: break;
6407 // // Ahune's Shield
6408 // case 45954: break;
6409 // // Nether Vapor Lightning
6410 // case 45960: break;
6412 // case 45996: break;
6413 // // Summon Blood Elves Periodic
6414 // case 46041: break;
6415 // // Transform Visual Missile Periodic
6416 // case 46205: break;
6417 // // Find Opening Beam End
6418 // case 46333: break;
6419 // // Ice Spear Control Aura
6420 // case 46371: break;
6421 // // Hailstone Chill
6422 // case 46458: break;
6423 // // Hailstone Chill, Internal
6424 // case 46465: break;
6425 // // Chill, Internal Shifter
6426 // case 46549: break;
6427 // // Summon Ice Spear Knockback Delayer
6428 // case 46878: break;
6429 // // Burninate Effect
6430 // case 47214: break;
6431 // // Fizzcrank Practice Parachute
6432 // case 47228: break;
6433 // // Send Mug Control Aura
6434 // case 47369: break;
6435 // // Direbrew's Disarm (precast)
6436 // case 47407: break;
6437 // // Mole Machine Port Schedule
6438 // case 47489: break;
6439 // case 47941: break; // Crystal Spike
6440 // case 48200: break; // Healer Aura
6441 // case 48630: break; // Summon Gauntlet Mobs Periodic
6442 // case 49313: break; // Proximity Mine Area Aura
6443 // // Mole Machine Portal Schedule
6444 // case 49466: break;
6445 // case 49555: break; // Corpse Explode
6446 // case 49592: break; // Temporal Rift
6447 // case 49957: break; // Cutting Laser
6448 // case 50085: break; // Slow Fall
6449 // // Listening to Music
6450 // case 50493: break;
6451 // // Love Rocket Barrage
6452 // case 50530: break;
6453 // Exist more after, need add later
6458 case SPELLFAMILY_MAGE
:
6461 // if (spell->Id == 55342)
6465 case SPELLFAMILY_WARRIOR
:
6467 // Armored to the Teeth
6468 if (spell
->SpellIconID
== 3516)
6470 // Increases your attack power by $s1 for every $s2 armor value you have.
6471 // Calculate AP bonus (from 1 efect of this spell)
6472 int32 apBonus
= m_modifier
.m_amount
* m_target
->GetArmor() / m_target
->CalculateSpellDamage(spell
, 1, spell
->EffectBasePoints
[1], m_target
);
6473 m_target
->CastCustomSpell(m_target
, 61217, &apBonus
, &apBonus
, 0, true, 0, this);
6478 case SPELLFAMILY_DRUID
:
6482 // Frenzied Regeneration
6485 // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
6486 // Should be manauser
6487 if (m_target
->getPowerType()!=POWER_RAGE
)
6489 uint32 rage
= m_target
->GetPower(POWER_RAGE
);
6493 int32 mod
= (rage
< 100) ? rage
: 100;
6494 int32 points
= m_target
->CalculateSpellDamage(spell
, 1, spell
->EffectBasePoints
[1], m_target
);
6495 int32 regen
= m_target
->GetMaxHealth() * (mod
* points
/ 10) / 1000;
6496 m_target
->CastCustomSpell(m_target
, 22845, ®en
, 0, 0, true, 0, this);
6497 m_target
->SetPower(POWER_RAGE
, rage
-mod
);
6508 case SPELLFAMILY_ROGUE
:
6510 // switch (spell->Id)
6512 // Master of Subtlety
6513 // case 31666: break;
6515 // case 51690: break;
6517 // case 58428: break;
6523 case SPELLFAMILY_HUNTER
:
6526 if (spell
->SpellFamilyFlags
& 0x8000000000000000LL
)
6530 int32 damage
= m_modifier
.m_amount
;
6531 // Full damage to target at 0 tick
6532 if (m_duration
> m_modifier
.periodictime
)
6534 caster
->CastCustomSpell(m_target
, 53352, &damage
, 0, 0, true, 0, this);
6538 caster
->CastCustomSpell(m_target
, 56298, &damage
, 0, 0, true, 0, this);
6546 // Feeding Frenzy Rank 1
6548 if ( m_target
->GetHealth() * 100 < m_target
->GetMaxHealth() * 35 )
6549 m_target
->CastSpell(m_target
, 60096, true, 0, this);
6551 // Feeding Frenzy Rank 2
6553 if ( m_target
->GetHealth() * 100 < m_target
->GetMaxHealth() * 35 )
6554 m_target
->CastSpell(m_target
, 60097, true, 0, this);
6561 case SPELLFAMILY_SHAMAN
:
6564 if (spell
->Id
== 52179)
6566 // Periodic need for remove visual on stun/fear/silence lost
6567 if (!(m_target
->GetUInt32Value(UNIT_FIELD_FLAGS
)&(UNIT_FLAG_STUNNED
|UNIT_FLAG_FLEEING
|UNIT_FLAG_SILENCED
)))
6568 m_target
->RemoveAurasDueToSpell(52179);
6573 case SPELLFAMILY_DEATHKNIGHT
:
6576 if (spell
->SpellFamilyFlags
& 0x0000000000000020LL
)
6579 caster
->CastCustomSpell(m_target
, 52212, &m_modifier
.m_amount
, NULL
, NULL
, true, 0, this);
6583 // if (spell->SpellFamilyFlags & 0x0000000000001000LL)
6586 if (spell
->SpellFamilyFlags
& 0x0000400000000000LL
)
6588 // Get 0 effect aura
6589 Aura
*slow
= m_target
->GetAura(GetId(), 0);
6592 slow
->ApplyModifier(false, true);
6593 Modifier
*mod
= slow
->GetModifier();
6594 mod
->m_amount
+= m_modifier
.m_amount
;
6595 if (mod
->m_amount
> 0) mod
->m_amount
= 0;
6596 slow
->ApplyModifier(true, true);
6601 // if (spell->SpellFamilyFlags & 0x0000008000000000LL)
6603 // Death Rune Mastery
6604 // if (spell->SpellFamilyFlags & 0x0000000000004000LL)
6607 if (spell
->SpellIconID
== 2653)
6609 // Increases your attack power by $s1 for every $s2 armor value you have.
6610 // Calculate AP bonus (from 1 efect of this spell)
6611 int32 apBonus
= m_modifier
.m_amount
* m_target
->GetArmor() / m_target
->CalculateSpellDamage(spell
, 1, spell
->EffectBasePoints
[1], m_target
);
6612 m_target
->CastCustomSpell(m_target
, 61217, &apBonus
, &apBonus
, 0, true, 0, this);
6616 // if (spell->SpellIconID == 22)
6618 // Blood of the North
6619 // if (spell->SpellIconID == 30412)
6628 void Aura::HandlePreventFleeing(bool apply
, bool Real
)
6633 Unit::AuraList
const& fearAuras
= m_target
->GetAurasByType(SPELL_AURA_MOD_FEAR
);
6634 if( !fearAuras
.empty() )
6637 m_target
->SetFeared(false, fearAuras
.front()->GetCasterGUID());
6639 m_target
->SetFeared(true);
6643 void Aura::HandleManaShield(bool apply
, bool Real
)
6648 // prevent double apply bonuses
6649 if(apply
&& (m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading()))
6651 if(Unit
* caster
= GetCaster())
6653 float DoneActualBenefit
= 0.0f
;
6654 switch(m_spellProto
->SpellFamilyName
)
6656 case SPELLFAMILY_MAGE
:
6657 if(m_spellProto
->SpellFamilyFlags
& 0x8000)
6660 // +50% from +spd bonus
6661 DoneActualBenefit
= caster
->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto
)) * 0.5f
;
6669 DoneActualBenefit
*= caster
->CalculateLevelPenalty(GetSpellProto());
6671 m_modifier
.m_amount
+= (int32
)DoneActualBenefit
;
6676 void Aura::HandleArenaPreparation(bool apply
, bool Real
)
6682 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PREPARATION
);
6684 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PREPARATION
);
6687 void Aura::HandleAuraControlVehicle(bool /*apply*/, bool Real
)
6692 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
6695 if(Pet
*pet
= m_target
->GetPet())
6696 pet
->Remove(PET_SAVE_AS_CURRENT
);
6698 WorldPacket
data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
, 0);
6699 ((Player
*)m_target
)->GetSession()->SendPacket(&data
);
6702 void Aura::HandleAuraConvertRune(bool apply
, bool Real
)
6707 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
6710 Player
*plr
= (Player
*)m_target
;
6712 if(plr
->getClass() != CLASS_DEATH_KNIGHT
)
6715 // how to determine what rune need to be converted?
6716 for(uint32 i
= 0; i
< MAX_RUNES
; ++i
)
6720 if(!plr
->GetRuneCooldown(i
))
6722 plr
->ConvertRune(i
, GetSpellProto()->EffectMiscValueB
[m_effIndex
]);
6728 if(plr
->GetCurrentRune(i
) == GetSpellProto()->EffectMiscValueB
[m_effIndex
])
6730 plr
->ConvertRune(i
, plr
->GetBaseRune(i
));
6737 void Aura::HandlePhase(bool apply
, bool Real
)
6742 // always non stackable
6745 Unit::AuraList
const& phases
= m_target
->GetAurasByType(SPELL_AURA_PHASE
);
6747 m_target
->RemoveAurasDueToSpell(phases
.front()->GetId(),this);
6750 // no-phase is also phase state so same code for apply and remove
6752 // phase auras normally not expected at BG but anyway better check
6753 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
6755 // drop flag at invisible in bg
6756 if(((Player
*)m_target
)->InBattleGround())
6757 if(BattleGround
*bg
= ((Player
*)m_target
)->GetBattleGround())
6758 bg
->EventPlayerDroppedFlag((Player
*)m_target
);
6760 // GM-mode have mask 0xFFFFFFFF
6761 if(!((Player
*)m_target
)->isGameMaster())
6762 m_target
->SetPhaseMask(apply
? GetMiscValue() : PHASEMASK_NORMAL
,false);
6764 ((Player
*)m_target
)->GetSession()->SendSetPhaseShift(apply
? GetMiscValue() : PHASEMASK_NORMAL
);
6766 if(GetEffIndex()==0)
6768 SpellAreaForAreaMapBounds saBounds
= spellmgr
.GetSpellAreaForAuraMapBounds(GetId());
6769 if(saBounds
.first
!= saBounds
.second
)
6772 m_target
->GetZoneAndAreaId(zone
,area
);
6774 for(SpellAreaForAreaMap::const_iterator itr
= saBounds
.first
; itr
!= saBounds
.second
; ++itr
)
6776 // some auras remove at aura remove
6777 if(!itr
->second
->IsFitToRequirements((Player
*)m_target
,zone
,area
))
6778 m_target
->RemoveAurasDueToSpell(itr
->second
->spellId
);
6779 // some auras applied at aura apply
6780 else if(itr
->second
->autocast
)
6782 if( !m_target
->HasAura(itr
->second
->spellId
,0) )
6783 m_target
->CastSpell(m_target
,itr
->second
->spellId
,true);
6790 m_target
->SetPhaseMask(apply
? GetMiscValue() : PHASEMASK_NORMAL
,false);
6792 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
6793 if(m_target
->GetVisibility()!=VISIBILITY_OFF
)
6794 m_target
->SetVisibility(m_target
->GetVisibility());
6797 void Aura::UnregisterSingleCastAura()
6799 if (IsSingleTarget())
6801 Unit
* caster
= NULL
;
6802 caster
= GetCaster();
6805 caster
->GetSingleCastAuras().remove(this);
6809 sLog
.outError("Couldn't find the caster of the single target aura, may crash later!");
6812 m_isSingleTargetAura
= false;