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"
49 #define NULL_AURA_SLOT 0xFF
51 pAuraHandler AuraHandler
[TOTAL_AURAS
]=
53 &Aura::HandleNULL
, // 0 SPELL_AURA_NONE
54 &Aura::HandleBindSight
, // 1 SPELL_AURA_BIND_SIGHT
55 &Aura::HandleModPossess
, // 2 SPELL_AURA_MOD_POSSESS
56 &Aura::HandlePeriodicDamage
, // 3 SPELL_AURA_PERIODIC_DAMAGE
57 &Aura::HandleAuraDummy
, // 4 SPELL_AURA_DUMMY
58 &Aura::HandleModConfuse
, // 5 SPELL_AURA_MOD_CONFUSE
59 &Aura::HandleModCharm
, // 6 SPELL_AURA_MOD_CHARM
60 &Aura::HandleModFear
, // 7 SPELL_AURA_MOD_FEAR
61 &Aura::HandlePeriodicHeal
, // 8 SPELL_AURA_PERIODIC_HEAL
62 &Aura::HandleModAttackSpeed
, // 9 SPELL_AURA_MOD_ATTACKSPEED
63 &Aura::HandleModThreat
, // 10 SPELL_AURA_MOD_THREAT
64 &Aura::HandleModTaunt
, // 11 SPELL_AURA_MOD_TAUNT
65 &Aura::HandleAuraModStun
, // 12 SPELL_AURA_MOD_STUN
66 &Aura::HandleModDamageDone
, // 13 SPELL_AURA_MOD_DAMAGE_DONE
67 &Aura::HandleNoImmediateEffect
, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
68 &Aura::HandleNoImmediateEffect
, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
69 &Aura::HandleModStealth
, // 16 SPELL_AURA_MOD_STEALTH
70 &Aura::HandleNoImmediateEffect
, // 17 SPELL_AURA_MOD_STEALTH_DETECT
71 &Aura::HandleInvisibility
, // 18 SPELL_AURA_MOD_INVISIBILITY
72 &Aura::HandleInvisibilityDetect
, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION
73 &Aura::HandleAuraModTotalHealthPercentRegen
, // 20 SPELL_AURA_OBS_MOD_HEALTH
74 &Aura::HandleAuraModTotalManaPercentRegen
, // 21 SPELL_AURA_OBS_MOD_MANA
75 &Aura::HandleAuraModResistance
, // 22 SPELL_AURA_MOD_RESISTANCE
76 &Aura::HandlePeriodicTriggerSpell
, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL
77 &Aura::HandlePeriodicEnergize
, // 24 SPELL_AURA_PERIODIC_ENERGIZE
78 &Aura::HandleAuraModPacify
, // 25 SPELL_AURA_MOD_PACIFY
79 &Aura::HandleAuraModRoot
, // 26 SPELL_AURA_MOD_ROOT
80 &Aura::HandleAuraModSilence
, // 27 SPELL_AURA_MOD_SILENCE
81 &Aura::HandleNoImmediateEffect
, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
82 &Aura::HandleAuraModStat
, // 29 SPELL_AURA_MOD_STAT
83 &Aura::HandleAuraModSkill
, // 30 SPELL_AURA_MOD_SKILL
84 &Aura::HandleAuraModIncreaseSpeed
, // 31 SPELL_AURA_MOD_INCREASE_SPEED
85 &Aura::HandleAuraModIncreaseMountedSpeed
, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
86 &Aura::HandleAuraModDecreaseSpeed
, // 33 SPELL_AURA_MOD_DECREASE_SPEED
87 &Aura::HandleAuraModIncreaseHealth
, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
88 &Aura::HandleAuraModIncreaseEnergy
, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
89 &Aura::HandleAuraModShapeshift
, // 36 SPELL_AURA_MOD_SHAPESHIFT
90 &Aura::HandleAuraModEffectImmunity
, // 37 SPELL_AURA_EFFECT_IMMUNITY
91 &Aura::HandleAuraModStateImmunity
, // 38 SPELL_AURA_STATE_IMMUNITY
92 &Aura::HandleAuraModSchoolImmunity
, // 39 SPELL_AURA_SCHOOL_IMMUNITY
93 &Aura::HandleAuraModDmgImmunity
, // 40 SPELL_AURA_DAMAGE_IMMUNITY
94 &Aura::HandleAuraModDispelImmunity
, // 41 SPELL_AURA_DISPEL_IMMUNITY
95 &Aura::HandleAuraProcTriggerSpell
, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in Unit::ProcDamageAndSpellFor and Unit::HandleProcTriggerSpell
96 &Aura::HandleNoImmediateEffect
, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in Unit::ProcDamageAndSpellFor
97 &Aura::HandleAuraTrackCreatures
, // 44 SPELL_AURA_TRACK_CREATURES
98 &Aura::HandleAuraTrackResources
, // 45 SPELL_AURA_TRACK_RESOURCES
99 &Aura::HandleUnused
, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
100 &Aura::HandleAuraModParryPercent
, // 47 SPELL_AURA_MOD_PARRY_PERCENT
101 &Aura::HandleNULL
, // 48 SPELL_AURA_48 spell Napalm (area damage spell with additional delayed damage effect)
102 &Aura::HandleAuraModDodgePercent
, // 49 SPELL_AURA_MOD_DODGE_PERCENT
103 &Aura::HandleNoImmediateEffect
, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_BONUS
104 &Aura::HandleAuraModBlockPercent
, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
105 &Aura::HandleAuraModCritPercent
, // 52 SPELL_AURA_MOD_CRIT_PERCENT
106 &Aura::HandlePeriodicLeech
, // 53 SPELL_AURA_PERIODIC_LEECH
107 &Aura::HandleModHitChance
, // 54 SPELL_AURA_MOD_HIT_CHANCE
108 &Aura::HandleModSpellHitChance
, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
109 &Aura::HandleAuraTransform
, // 56 SPELL_AURA_TRANSFORM
110 &Aura::HandleModSpellCritChance
, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
111 &Aura::HandleAuraModIncreaseSwimSpeed
, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
112 &Aura::HandleNoImmediateEffect
, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
113 &Aura::HandleAuraModPacifyAndSilence
, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
114 &Aura::HandleAuraModScale
, // 61 SPELL_AURA_MOD_SCALE
115 &Aura::HandlePeriodicHealthFunnel
, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL
116 &Aura::HandleUnused
, // 63 unused (3.0.8a) old SPELL_AURA_PERIODIC_MANA_FUNNEL
117 &Aura::HandlePeriodicManaLeech
, // 64 SPELL_AURA_PERIODIC_MANA_LEECH
118 &Aura::HandleModCastingSpeed
, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
119 &Aura::HandleFeignDeath
, // 66 SPELL_AURA_FEIGN_DEATH
120 &Aura::HandleAuraModDisarm
, // 67 SPELL_AURA_MOD_DISARM
121 &Aura::HandleAuraModStalked
, // 68 SPELL_AURA_MOD_STALKED
122 &Aura::HandleSchoolAbsorb
, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
123 &Aura::HandleUnused
, // 70 SPELL_AURA_EXTRA_ATTACKS Useless, used by only one spell that has only visual effect
124 &Aura::HandleModSpellCritChanceShool
, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
125 &Aura::HandleModPowerCostPCT
, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
126 &Aura::HandleModPowerCost
, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
127 &Aura::HandleNoImmediateEffect
, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
128 &Aura::HandleNoImmediateEffect
, // 75 SPELL_AURA_MOD_LANGUAGE
129 &Aura::HandleFarSight
, // 76 SPELL_AURA_FAR_SIGHT
130 &Aura::HandleModMechanicImmunity
, // 77 SPELL_AURA_MECHANIC_IMMUNITY
131 &Aura::HandleAuraMounted
, // 78 SPELL_AURA_MOUNTED
132 &Aura::HandleModDamagePercentDone
, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
133 &Aura::HandleModPercentStat
, // 80 SPELL_AURA_MOD_PERCENT_STAT
134 &Aura::HandleNoImmediateEffect
, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT
135 &Aura::HandleWaterBreathing
, // 82 SPELL_AURA_WATER_BREATHING
136 &Aura::HandleModBaseResistance
, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
137 &Aura::HandleModRegen
, // 84 SPELL_AURA_MOD_REGEN
138 &Aura::HandleModPowerRegen
, // 85 SPELL_AURA_MOD_POWER_REGEN
139 &Aura::HandleChannelDeathItem
, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
140 &Aura::HandleNoImmediateEffect
, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
141 &Aura::HandleNoImmediateEffect
, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
142 &Aura::HandlePeriodicDamagePCT
, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
143 &Aura::HandleUnused
, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
144 &Aura::HandleNoImmediateEffect
, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
145 &Aura::HandlePreventFleeing
, // 92 SPELL_AURA_PREVENTS_FLEEING
146 &Aura::HandleModUnattackable
, // 93 SPELL_AURA_MOD_UNATTACKABLE
147 &Aura::HandleNoImmediateEffect
, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::RegenerateAll
148 &Aura::HandleAuraGhost
, // 95 SPELL_AURA_GHOST
149 &Aura::HandleNoImmediateEffect
, // 96 SPELL_AURA_SPELL_MAGNET implemented in Unit::SelectMagnetTarget
150 &Aura::HandleManaShield
, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
151 &Aura::HandleAuraModSkill
, // 98 SPELL_AURA_MOD_SKILL_TALENT
152 &Aura::HandleAuraModAttackPower
, // 99 SPELL_AURA_MOD_ATTACK_POWER
153 &Aura::HandleUnused
, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
154 &Aura::HandleModResistancePercent
, //101 SPELL_AURA_MOD_RESISTANCE_PCT
155 &Aura::HandleNoImmediateEffect
, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
156 &Aura::HandleAuraModTotalThreat
, //103 SPELL_AURA_MOD_TOTAL_THREAT
157 &Aura::HandleAuraWaterWalk
, //104 SPELL_AURA_WATER_WALK
158 &Aura::HandleAuraFeatherFall
, //105 SPELL_AURA_FEATHER_FALL
159 &Aura::HandleAuraHover
, //106 SPELL_AURA_HOVER
160 &Aura::HandleAddModifier
, //107 SPELL_AURA_ADD_FLAT_MODIFIER
161 &Aura::HandleAddModifier
, //108 SPELL_AURA_ADD_PCT_MODIFIER
162 &Aura::HandleAddTargetTrigger
, //109 SPELL_AURA_ADD_TARGET_TRIGGER
163 &Aura::HandleModPowerRegenPCT
, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT
164 &Aura::HandleNoImmediateEffect
, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER implemented in Unit::SelectMagnetTarget
165 &Aura::HandleNoImmediateEffect
, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
166 &Aura::HandleNoImmediateEffect
, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
167 &Aura::HandleNoImmediateEffect
, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
168 &Aura::HandleNoImmediateEffect
, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
169 &Aura::HandleNoImmediateEffect
, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
170 &Aura::HandleNoImmediateEffect
, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
171 &Aura::HandleNoImmediateEffect
, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
172 &Aura::HandleUnused
, //119 unused (3.0.8a) old SPELL_AURA_SHARE_PET_TRACKING
173 &Aura::HandleAuraUntrackable
, //120 SPELL_AURA_UNTRACKABLE
174 &Aura::HandleAuraEmpathy
, //121 SPELL_AURA_EMPATHY
175 &Aura::HandleModOffhandDamagePercent
, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
176 &Aura::HandleModTargetResistance
, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
177 &Aura::HandleAuraModRangedAttackPower
, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
178 &Aura::HandleNoImmediateEffect
, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
179 &Aura::HandleNoImmediateEffect
, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
180 &Aura::HandleNoImmediateEffect
, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
181 &Aura::HandleModPossessPet
, //128 SPELL_AURA_MOD_POSSESS_PET
182 &Aura::HandleAuraModIncreaseSpeed
, //129 SPELL_AURA_MOD_SPEED_ALWAYS
183 &Aura::HandleAuraModIncreaseMountedSpeed
, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
184 &Aura::HandleNoImmediateEffect
, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
185 &Aura::HandleAuraModIncreaseEnergyPercent
, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
186 &Aura::HandleAuraModIncreaseHealthPercent
, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
187 &Aura::HandleAuraModRegenInterrupt
, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
188 &Aura::HandleModHealingDone
, //135 SPELL_AURA_MOD_HEALING_DONE
189 &Aura::HandleNoImmediateEffect
, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus
190 &Aura::HandleModTotalPercentStat
, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
191 &Aura::HandleHaste
, //138 SPELL_AURA_MOD_HASTE
192 &Aura::HandleForceReaction
, //139 SPELL_AURA_FORCE_REACTION
193 &Aura::HandleAuraModRangedHaste
, //140 SPELL_AURA_MOD_RANGED_HASTE
194 &Aura::HandleRangedAmmoHaste
, //141 SPELL_AURA_MOD_RANGED_AMMO_HASTE
195 &Aura::HandleAuraModBaseResistancePCT
, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
196 &Aura::HandleAuraModResistanceExclusive
, //143 SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
197 &Aura::HandleAuraSafeFall
, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
198 &Aura::HandleAuraModPetTalentsPoints
, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
199 &Aura::HandleNoImmediateEffect
, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
200 &Aura::HandleNULL
, //147 SPELL_AURA_ADD_CREATURE_IMMUNITY
201 &Aura::HandleAuraRetainComboPoints
, //148 SPELL_AURA_RETAIN_COMBO_POINTS
202 &Aura::HandleNoImmediateEffect
, //149 SPELL_AURA_REDUCE_PUSHBACK
203 &Aura::HandleShieldBlockValue
, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
204 &Aura::HandleAuraTrackStealthed
, //151 SPELL_AURA_TRACK_STEALTHED
205 &Aura::HandleNoImmediateEffect
, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
206 &Aura::HandleNoImmediateEffect
, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT
207 &Aura::HandleNoImmediateEffect
, //154 SPELL_AURA_MOD_STEALTH_LEVEL
208 &Aura::HandleNoImmediateEffect
, //155 SPELL_AURA_MOD_WATER_BREATHING
209 &Aura::HandleNoImmediateEffect
, //156 SPELL_AURA_MOD_REPUTATION_GAIN
210 &Aura::HandleNULL
, //157 SPELL_AURA_PET_DAMAGE_MULTI
211 &Aura::HandleShieldBlockValue
, //158 SPELL_AURA_MOD_SHIELD_BLOCKVALUE
212 &Aura::HandleNoImmediateEffect
, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
213 &Aura::HandleNoImmediateEffect
, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemented in Unit::MagicSpellHitResult
214 &Aura::HandleNoImmediateEffect
, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
215 &Aura::HandleAuraPowerBurn
, //162 SPELL_AURA_POWER_BURN_MANA
216 &Aura::HandleNoImmediateEffect
, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE
217 &Aura::HandleUnused
, //164 unused (3.0.8a), only one test spell
218 &Aura::HandleNoImmediateEffect
, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
219 &Aura::HandleAuraModAttackPowerPercent
, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
220 &Aura::HandleAuraModRangedAttackPowerPercent
, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
221 &Aura::HandleNoImmediateEffect
, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
222 &Aura::HandleNoImmediateEffect
, //169 SPELL_AURA_MOD_CRIT_PERCENT_VERSUS implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus
223 &Aura::HandleNULL
, //170 SPELL_AURA_DETECT_AMORE different spells that ignore transformation effects
224 &Aura::HandleAuraModIncreaseSpeed
, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
225 &Aura::HandleAuraModIncreaseMountedSpeed
, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
226 &Aura::HandleUnused
, //173 unused (3.0.8a) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
227 &Aura::HandleModSpellDamagePercentFromStat
, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
228 &Aura::HandleModSpellHealingPercentFromStat
, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
229 &Aura::HandleSpiritOfRedemption
, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
230 &Aura::HandleNULL
, //177 SPELL_AURA_AOE_CHARM
231 &Aura::HandleNoImmediateEffect
, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
232 &Aura::HandleNoImmediateEffect
, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
233 &Aura::HandleNoImmediateEffect
, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
234 &Aura::HandleUnused
, //181 unused (3.0.8a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
235 &Aura::HandleAuraModResistenceOfStatPercent
, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
236 &Aura::HandleNULL
, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746
237 &Aura::HandleNoImmediateEffect
, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
238 &Aura::HandleNoImmediateEffect
, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
239 &Aura::HandleNoImmediateEffect
, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
240 &Aura::HandleNoImmediateEffect
, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
241 &Aura::HandleNoImmediateEffect
, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
242 &Aura::HandleModRating
, //189 SPELL_AURA_MOD_RATING
243 &Aura::HandleNULL
, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
244 &Aura::HandleAuraModUseNormalSpeed
, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
245 &Aura::HandleModMeleeRangedSpeedPct
, //192 SPELL_AURA_HASTE_MELEE
246 &Aura::HandleModCombatSpeedPct
, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
247 &Aura::HandleNULL
, //194 SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL
248 &Aura::HandleNoImmediateEffect
, //195 SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL implement in Unit::CalculateSpellDamage
249 &Aura::HandleNULL
, //196 SPELL_AURA_MOD_COOLDOWN
250 &Aura::HandleNoImmediateEffect
, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
251 &Aura::HandleUnused
, //198 unused (3.0.8a) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
252 &Aura::HandleNoImmediateEffect
, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
253 &Aura::HandleNoImmediateEffect
, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::GiveXP
254 &Aura::HandleAuraAllowFlight
, //201 SPELL_AURA_FLY this aura enable flight mode...
255 &Aura::HandleNoImmediateEffect
, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
256 &Aura::HandleNoImmediateEffect
, //203 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
257 &Aura::HandleNoImmediateEffect
, //204 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
258 &Aura::HandleNULL
, //205 vulnerable to school dmg?
259 &Aura::HandleNULL
, //206 SPELL_AURA_MOD_SPEED_MOUNTED
260 &Aura::HandleAuraModIncreaseFlightSpeed
, //207 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
261 &Aura::HandleAuraModIncreaseFlightSpeed
, //208 SPELL_AURA_MOD_SPEED_FLIGHT, used only in spell: Flight Form (Passive)
262 &Aura::HandleAuraModIncreaseFlightSpeed
, //209 SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
263 &Aura::HandleNULL
, //210 Commentator's Command
264 &Aura::HandleAuraModIncreaseFlightSpeed
, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
265 &Aura::HandleAuraModRangedAttackPowerOfStatPercent
, //212 SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
266 &Aura::HandleNoImmediateEffect
, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
267 &Aura::HandleNULL
, //214 Tamed Pet Passive
268 &Aura::HandleArenaPreparation
, //215 SPELL_AURA_ARENA_PREPARATION
269 &Aura::HandleModCastingSpeed
, //216 SPELL_AURA_HASTE_SPELLS
270 &Aura::HandleUnused
, //217 unused (3.0.8a)
271 &Aura::HandleAuraModRangedHaste
, //218 SPELL_AURA_HASTE_RANGED
272 &Aura::HandleModManaRegen
, //219 SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
273 &Aura::HandleModRatingFromStat
, //220 SPELL_AURA_MOD_RATING_FROM_STAT
274 &Aura::HandleNULL
, //221 ignored
275 &Aura::HandleUnused
, //222 unused (3.0.8a) only for spell 44586 that not used in real spell cast
276 &Aura::HandleNULL
, //223 Cold Stare
277 &Aura::HandleUnused
, //224 unused (3.0.8a)
278 &Aura::HandleNoImmediateEffect
, //225 SPELL_AURA_PRAYER_OF_MENDING
279 &Aura::HandleAuraPeriodicDummy
, //226 SPELL_AURA_PERIODIC_DUMMY
280 &Aura::HandlePeriodicTriggerSpellWithValue
, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
281 &Aura::HandleNoImmediateEffect
, //228 stealth detection
282 &Aura::HandleNULL
, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
283 &Aura::HandleAuraModIncreaseMaxHealth
, //230 Commanding Shout
284 &Aura::HandleNoImmediateEffect
, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
285 &Aura::HandleNoImmediateEffect
, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
286 &Aura::HandleNULL
, //233 set model id to the one of the creature with id m_modifier.m_miscvalue
287 &Aura::HandleNoImmediateEffect
, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
288 &Aura::HandleAuraModDispelResist
, //235 SPELL_AURA_MOD_DISPEL_RESIST implement in Unit::MagicSpellHitResult
289 &Aura::HandleAuraControlVehicle
, //236 SPELL_AURA_CONTROL_VEHICLE
290 &Aura::HandleModSpellDamagePercentFromAttackPower
, //237 SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER implemented in Unit::SpellBaseDamageBonus
291 &Aura::HandleModSpellHealingPercentFromAttackPower
, //238 SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER implemented in Unit::SpellBaseHealingBonus
292 &Aura::HandleAuraModScale
, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
293 &Aura::HandleAuraModExpertise
, //240 SPELL_AURA_MOD_EXPERTISE
294 &Aura::HandleForceMoveForward
, //241 Forces the player to move forward
295 &Aura::HandleUnused
, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING
296 &Aura::HandleNULL
, //243 faction reaction override spells
297 &Aura::HandleComprehendLanguage
, //244 Comprehend language
298 &Aura::HandleNULL
, //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
299 &Aura::HandleNoImmediateEffect
, //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL
300 &Aura::HandleNULL
, //247 target to become a clone of the caster
301 &Aura::HandleNoImmediateEffect
, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
302 &Aura::HandleAuraConvertRune
, //249 SPELL_AURA_CONVERT_RUNE
303 &Aura::HandleAuraModIncreaseHealth
, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
304 &Aura::HandleNULL
, //251 SPELL_AURA_MOD_ENEMY_DODGE
305 &Aura::HandleNULL
, //252 haste all?
306 &Aura::HandleNULL
, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
307 &Aura::HandleNULL
, //254 SPELL_AURA_MOD_DISARM_SHIELD disarm Shield
308 &Aura::HandleNoImmediateEffect
, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
309 &Aura::HandleNoReagentUseAura
, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
310 &Aura::HandleNULL
, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
311 &Aura::HandleNULL
, //258 SPELL_AURA_MOD_SPELL_VISUAL
312 &Aura::HandleNULL
, //259 corrupt healing over time spell
313 &Aura::HandleNoImmediateEffect
, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
314 &Aura::HandlePhase
, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
315 &Aura::HandleNULL
, //262
316 &Aura::HandleNULL
, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
317 &Aura::HandleUnused
, //264 unused (3.0.8a)
318 &Aura::HandleUnused
, //265 unused (3.0.8a)
319 &Aura::HandleUnused
, //266 unused (3.0.8a)
320 &Aura::HandleNoImmediateEffect
, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
321 &Aura::HandleAuraModAttackPowerOfStatPercent
, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
322 &Aura::HandleNULL
, //269 ignore DR effects?
323 &Aura::HandleNULL
, //270 SPELL_AURA_MOD_IGNORE_TARGET_RESIST
324 &Aura::HandleNoImmediateEffect
, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus
325 &Aura::HandleNULL
, //272 reduce spell cast time?
326 &Aura::HandleNULL
, //273
327 &Aura::HandleNULL
, //274 proc free shot?
328 &Aura::HandleNoImmediateEffect
, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
329 &Aura::HandleNULL
, //276 mod damage % mechanic?
330 &Aura::HandleNoImmediateEffect
, //277 SPELL_AURA_MOD_MAX_AFFECTED_TARGETS Use SpellClassMask for spell select
331 &Aura::HandleNULL
, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
332 &Aura::HandleNULL
, //279 visual effects? 58836 and 57507
333 &Aura::HandleNULL
, //280 SPELL_AURA_MOD_TARGET_ARMOR_PCT
334 &Aura::HandleNULL
, //281 SPELL_AURA_MOD_HONOR_GAIN
335 &Aura::HandleAuraIncreaseBaseHealthPercent
, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
336 &Aura::HandleNoImmediateEffect
, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
337 &Aura::HandleUnused
, //284 not used by any spells (3.08a)
338 &Aura::HandleUnused
, //285 not used by any spells (3.08a)
339 &Aura::HandleUnused
, //286 not used by any spells (3.08a)
340 &Aura::HandleNoImmediateEffect
, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
341 &Aura::HandleUnused
, //288 not used by any spells (3.09) except 1 test spell.
344 static AuraType
const frozenAuraTypes
[] = { SPELL_AURA_MOD_ROOT
, SPELL_AURA_MOD_STUN
, SPELL_AURA_NONE
};
346 Aura::Aura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
, Unit
*caster
, Item
* castItem
) :
347 m_spellmod(NULL
), m_caster_guid(0), m_target(target
), m_castItemGuid(castItem
?castItem
->GetGUID():0),
348 m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT
), m_AuraDRGroup(DIMINISHING_NONE
),
349 m_effIndex(eff
), m_auraSlot(MAX_AURAS
), m_auraFlags(AFLAG_NONE
), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),
350 m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
351 m_isRemovedOnShapeLost(true), m_updated(false), m_in_use(false)
355 assert(spellproto
&& spellproto
== sSpellStore
.LookupEntry( spellproto
->Id
) && "`info` must be pointer to sSpellStore element");
357 m_spellProto
= spellproto
;
359 m_currentBasePoints
= currentBasePoints
? *currentBasePoints
: m_spellProto
->EffectBasePoints
[eff
];
361 m_isPassive
= IsPassiveSpell(GetId());
362 m_positive
= IsPositiveEffect(GetId(), m_effIndex
);
364 m_isSingleTargetAura
= IsSingleTargetSpell(m_spellProto
);
366 m_applyTime
= time(NULL
);
371 m_caster_guid
= target
->GetGUID();
372 damage
= m_currentBasePoints
+1; // stored value-1
373 m_maxduration
= target
->CalculateSpellDuration(m_spellProto
, m_effIndex
, target
);
377 m_caster_guid
= caster
->GetGUID();
379 damage
= caster
->CalculateSpellDamage(m_spellProto
,m_effIndex
,m_currentBasePoints
,target
);
380 m_maxduration
= caster
->CalculateSpellDuration(m_spellProto
, m_effIndex
, target
);
382 if (!damage
&& castItem
&& castItem
->GetItemSuffixFactor())
384 ItemRandomSuffixEntry
const *item_rand_suffix
= sItemRandomSuffixStore
.LookupEntry(abs(castItem
->GetItemRandomPropertyId()));
387 for (int k
=0; k
<3; k
++)
389 SpellItemEnchantmentEntry
const *pEnchant
= sSpellItemEnchantmentStore
.LookupEntry(item_rand_suffix
->enchant_id
[k
]);
392 for (int t
=0; t
<3; t
++)
393 if(pEnchant
->spellid
[t
] == m_spellProto
->Id
)
395 damage
= uint32((item_rand_suffix
->prefix
[k
]*castItem
->GetItemSuffixFactor()) / 10000 );
407 if(m_maxduration
== -1 || m_isPassive
&& m_spellProto
->DurationIndex
== 0)
410 Player
* modOwner
= caster
? caster
->GetSpellModOwner() : NULL
;
412 if(!m_permanent
&& modOwner
)
414 modOwner
->ApplySpellMod(GetId(), SPELLMOD_DURATION
, m_maxduration
);
415 // Get zero duration aura after - need set m_maxduration > 0 for apply/remove aura work
416 if (m_maxduration
<=0)
420 m_duration
= m_maxduration
;
422 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
);
425 SetModifier(AuraType(m_spellProto
->EffectApplyAuraName
[eff
]), damage
, m_spellProto
->EffectAmplitude
[eff
], m_spellProto
->EffectMiscValue
[eff
]);
427 // Apply periodic time mod
428 if(modOwner
&& m_modifier
.periodictime
)
429 modOwner
->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME
, m_modifier
.periodictime
);
431 // Start periodic on next tick or at aura apply
432 if (!(m_spellProto
->AttributesEx5
& SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY
))
433 m_periodicTimer
+= m_modifier
.periodictime
;
435 m_isDeathPersist
= IsDeathPersistentSpell(m_spellProto
);
437 m_procCharges
= m_spellProto
->procCharges
;
439 modOwner
->ApplySpellMod(GetId(), SPELLMOD_CHARGES
, m_procCharges
);
441 m_isRemovedOnShapeLost
= (m_caster_guid
==m_target
->GetGUID() &&
442 m_spellProto
->Stances
&&
443 !(m_spellProto
->AttributesEx2
& SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT
) &&
444 !(m_spellProto
->Attributes
& SPELL_ATTR_NOT_SHAPESHIFT
));
451 AreaAura::AreaAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
,
452 Unit
*caster
, Item
* castItem
) : Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
)
456 // caster==NULL in constructor args if target==caster in fact
457 Unit
* caster_ptr
= caster
? caster
: target
;
459 m_radius
= GetSpellRadius(sSpellRadiusStore
.LookupEntry(GetSpellProto()->EffectRadiusIndex
[m_effIndex
]));
460 if(Player
* modOwner
= caster_ptr
->GetSpellModOwner())
461 modOwner
->ApplySpellMod(GetId(), SPELLMOD_RADIUS
, m_radius
);
463 switch(spellproto
->Effect
[eff
])
465 case SPELL_EFFECT_APPLY_AREA_AURA_PARTY
:
466 m_areaAuraType
= AREA_AURA_PARTY
;
467 if (target
->GetTypeId() == TYPEID_UNIT
&& ((Creature
*)target
)->isTotem())
468 m_modifier
.m_auraname
= SPELL_AURA_NONE
;
470 case SPELL_EFFECT_APPLY_AREA_AURA_RAID
:
471 m_areaAuraType
= AREA_AURA_RAID
;
472 if (target
->GetTypeId() == TYPEID_UNIT
&& ((Creature
*)target
)->isTotem())
473 m_modifier
.m_auraname
= SPELL_AURA_NONE
;
475 case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
:
476 m_areaAuraType
= AREA_AURA_FRIEND
;
478 case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
:
479 m_areaAuraType
= AREA_AURA_ENEMY
;
480 if (target
== caster_ptr
)
481 m_modifier
.m_auraname
= SPELL_AURA_NONE
; // Do not do any effect on self
483 case SPELL_EFFECT_APPLY_AREA_AURA_PET
:
484 m_areaAuraType
= AREA_AURA_PET
;
486 case SPELL_EFFECT_APPLY_AREA_AURA_OWNER
:
487 m_areaAuraType
= AREA_AURA_OWNER
;
488 if (target
== caster_ptr
)
489 m_modifier
.m_auraname
= SPELL_AURA_NONE
;
492 sLog
.outError("Wrong spell effect in AreaAura constructor");
498 AreaAura::~AreaAura()
502 PersistentAreaAura::PersistentAreaAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
,
503 Unit
*caster
, Item
* castItem
) : Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
)
505 m_isPersistent
= true;
508 PersistentAreaAura::~PersistentAreaAura()
512 SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
,
513 Unit
*caster
, Item
* castItem
) : Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
)
516 m_casters_target_guid
= caster
->GetTypeId()==TYPEID_PLAYER
? ((Player
*)caster
)->GetSelection() : caster
->GetUInt64Value(UNIT_FIELD_TARGET
);
518 m_casters_target_guid
= 0;
521 SingleEnemyTargetAura::~SingleEnemyTargetAura()
525 Unit
* SingleEnemyTargetAura::GetTriggerTarget() const
527 return ObjectAccessor::GetUnit(*m_target
, m_casters_target_guid
);
530 Aura
* CreateAura(SpellEntry
const* spellproto
, uint32 eff
, int32
*currentBasePoints
, Unit
*target
, Unit
*caster
, Item
* castItem
)
532 if (IsAreaAuraEffect(spellproto
->Effect
[eff
]))
533 return new AreaAura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
);
535 uint32 triggeredSpellId
= spellproto
->EffectTriggerSpell
[eff
];
537 if(SpellEntry
const* triggeredSpellInfo
= sSpellStore
.LookupEntry(triggeredSpellId
))
538 for (int i
= 0; i
< 3; ++i
)
539 if (triggeredSpellInfo
->EffectImplicitTargetA
[i
] == TARGET_SINGLE_ENEMY
)
540 return new SingleEnemyTargetAura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
);
542 return new Aura(spellproto
, eff
, currentBasePoints
, target
, caster
, castItem
);
545 Unit
* Aura::GetCaster() const
547 if(m_caster_guid
==m_target
->GetGUID())
550 //return ObjectAccessor::GetUnit(*m_target,m_caster_guid);
551 //must return caster even if it's in another grid/map
552 Unit
*unit
= ObjectAccessor::GetObjectInWorld(m_caster_guid
, (Unit
*)NULL
);
553 return unit
&& unit
->IsInWorld() ? unit
: NULL
;
556 void Aura::SetModifier(AuraType t
, int32 a
, uint32 pt
, int32 miscValue
)
558 m_modifier
.m_auraname
= t
;
559 m_modifier
.m_amount
= a
;
560 m_modifier
.m_miscvalue
= miscValue
;
561 m_modifier
.periodictime
= pt
;
564 void Aura::Update(uint32 diff
)
573 // GetEffIndex()==0 prevent double/triple apply manaPerSecond/manaPerSecondPerLevel to same spell with many auras
574 // all spells with manaPerSecond/manaPerSecondPerLevel have aura in effect 0
575 if(GetEffIndex()==0 && m_timeCla
<= 0)
577 if(Unit
* caster
= GetCaster())
579 Powers powertype
= Powers(m_spellProto
->powerType
);
580 int32 manaPerSecond
= m_spellProto
->manaPerSecond
+ m_spellProto
->manaPerSecondPerLevel
* caster
->getLevel();
581 m_timeCla
= 1*IN_MILISECONDS
;
584 if(powertype
==POWER_HEALTH
)
585 caster
->ModifyHealth(-manaPerSecond
);
587 caster
->ModifyPower(powertype
,-manaPerSecond
);
593 // Channeled aura required check distance from caster
594 if(IsChanneledSpell(m_spellProto
) && m_caster_guid
!= m_target
->GetGUID())
596 Unit
* caster
= GetCaster();
599 m_target
->RemoveAura(GetId(),GetEffIndex());
606 if (m_spellProto
->EffectRadiusIndex
[GetEffIndex()])
608 radius
= GetSpellRadius(sSpellRadiusStore
.LookupEntry(m_spellProto
->EffectRadiusIndex
[GetEffIndex()]));
609 mod
= SPELLMOD_RADIUS
;
613 radius
= GetSpellMaxRange(sSpellRangeStore
.LookupEntry(m_spellProto
->rangeIndex
));
614 mod
= SPELLMOD_RANGE
;
617 if(Player
* modOwner
= caster
->GetSpellModOwner())
618 modOwner
->ApplySpellMod(GetId(), mod
, radius
,NULL
);
620 if(!caster
->IsWithinDistInMap(m_target
,radius
))
622 m_target
->RemoveAura(GetId(),GetEffIndex());
627 if(m_isPeriodic
&& (m_duration
>= 0 || m_isPassive
|| m_permanent
))
629 m_periodicTimer
-= diff
;
630 if(m_periodicTimer
<= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
632 // update before applying (aura can be removed in TriggerSpell or PeriodicTick calls)
633 m_periodicTimer
+= m_modifier
.periodictime
;
639 void AreaAura::Update(uint32 diff
)
641 // update for the caster of the aura
642 if(m_caster_guid
== m_target
->GetGUID())
644 Unit
* caster
= m_target
;
646 if( !caster
->hasUnitState(UNIT_STAT_ISOLATED
) )
648 Unit
* owner
= caster
->GetCharmerOrOwner();
651 std::list
<Unit
*> targets
;
653 switch(m_areaAuraType
)
655 case AREA_AURA_PARTY
:
657 Group
*pGroup
= NULL
;
659 if (owner
->GetTypeId() == TYPEID_PLAYER
)
660 pGroup
= ((Player
*)owner
)->GetGroup();
664 uint8 subgroup
= ((Player
*)owner
)->GetSubGroup();
665 for(GroupReference
*itr
= pGroup
->GetFirstMember(); itr
!= NULL
; itr
= itr
->next())
667 Player
* Target
= itr
->getSource();
668 if(Target
&& Target
->isAlive() && Target
->GetSubGroup()==subgroup
&& caster
->IsFriendlyTo(Target
))
670 if(caster
->IsWithinDistInMap(Target
, m_radius
))
671 targets
.push_back(Target
);
672 Pet
*pet
= Target
->GetPet();
673 if(pet
&& pet
->isAlive() && caster
->IsWithinDistInMap(pet
, m_radius
))
674 targets
.push_back(pet
);
681 if( owner
!= caster
&& caster
->IsWithinDistInMap(owner
, m_radius
) )
682 targets
.push_back(owner
);
684 Unit
* pet
= caster
->GetPet();
685 if( pet
&& caster
->IsWithinDistInMap(pet
, m_radius
))
686 targets
.push_back(pet
);
692 Group
*pGroup
= NULL
;
694 if (owner
->GetTypeId() == TYPEID_PLAYER
)
695 pGroup
= ((Player
*)owner
)->GetGroup();
699 for(GroupReference
*itr
= pGroup
->GetFirstMember(); itr
!= NULL
; itr
= itr
->next())
701 Player
* Target
= itr
->getSource();
702 if(Target
&& Target
->isAlive() && caster
->IsFriendlyTo(Target
))
704 if(caster
->IsWithinDistInMap(Target
, m_radius
))
705 targets
.push_back(Target
);
706 Pet
*pet
= Target
->GetPet();
707 if(pet
&& pet
->isAlive() && caster
->IsWithinDistInMap(pet
, m_radius
))
708 targets
.push_back(pet
);
715 if( owner
!= caster
&& caster
->IsWithinDistInMap(owner
, m_radius
) )
716 targets
.push_back(owner
);
718 Unit
* pet
= caster
->GetPet();
719 if( pet
&& caster
->IsWithinDistInMap(pet
, m_radius
))
720 targets
.push_back(pet
);
724 case AREA_AURA_FRIEND
:
726 CellPair
p(MaNGOS::ComputeCellPair(caster
->GetPositionX(), caster
->GetPositionY()));
728 cell
.data
.Part
.reserved
= ALL_DISTRICT
;
731 MaNGOS::AnyFriendlyUnitInObjectRangeCheck
u_check(caster
, owner
, m_radius
);
732 MaNGOS::UnitListSearcher
<MaNGOS::AnyFriendlyUnitInObjectRangeCheck
> searcher(caster
,targets
, u_check
);
733 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyFriendlyUnitInObjectRangeCheck
>, WorldTypeMapContainer
> world_unit_searcher(searcher
);
734 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyFriendlyUnitInObjectRangeCheck
>, GridTypeMapContainer
> grid_unit_searcher(searcher
);
735 CellLock
<GridReadGuard
> cell_lock(cell
, p
);
736 cell_lock
->Visit(cell_lock
, world_unit_searcher
, *caster
->GetMap());
737 cell_lock
->Visit(cell_lock
, grid_unit_searcher
, *caster
->GetMap());
740 case AREA_AURA_ENEMY
:
742 CellPair
p(MaNGOS::ComputeCellPair(caster
->GetPositionX(), caster
->GetPositionY()));
744 cell
.data
.Part
.reserved
= ALL_DISTRICT
;
747 MaNGOS::AnyAoETargetUnitInObjectRangeCheck
u_check(caster
, owner
, m_radius
); // No GetCharmer in searcher
748 MaNGOS::UnitListSearcher
<MaNGOS::AnyAoETargetUnitInObjectRangeCheck
> searcher(caster
, targets
, u_check
);
749 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyAoETargetUnitInObjectRangeCheck
>, WorldTypeMapContainer
> world_unit_searcher(searcher
);
750 TypeContainerVisitor
<MaNGOS::UnitListSearcher
<MaNGOS::AnyAoETargetUnitInObjectRangeCheck
>, GridTypeMapContainer
> grid_unit_searcher(searcher
);
751 CellLock
<GridReadGuard
> cell_lock(cell
, p
);
752 cell_lock
->Visit(cell_lock
, world_unit_searcher
, *caster
->GetMap());
753 cell_lock
->Visit(cell_lock
, grid_unit_searcher
, *caster
->GetMap());
756 case AREA_AURA_OWNER
:
760 targets
.push_back(owner
);
765 for(std::list
<Unit
*>::iterator tIter
= targets
.begin(); tIter
!= targets
.end(); tIter
++)
767 if((*tIter
)->HasAura(GetId(), m_effIndex
))
770 if(SpellEntry
const *actualSpellInfo
= spellmgr
.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter
)->getLevel()))
772 int32 actualBasePoints
= m_currentBasePoints
;
773 // recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?)
774 if(actualSpellInfo
!= GetSpellProto())
775 actualBasePoints
= actualSpellInfo
->EffectBasePoints
[m_effIndex
];
776 AreaAura
*aur
= new AreaAura(actualSpellInfo
, m_effIndex
, &actualBasePoints
, (*tIter
), caster
, NULL
);
777 aur
->SetAuraDuration(GetAuraDuration());
778 (*tIter
)->AddAura(aur
);
784 else // aura at non-caster
786 Unit
* tmp_target
= m_target
;
787 Unit
* caster
= GetCaster();
788 uint32 tmp_spellId
= GetId(), tmp_effIndex
= m_effIndex
;
790 // WARNING: the aura may get deleted during the update
791 // DO NOT access its members after update!
794 // remove aura if out-of-range from caster (after teleport for example)
795 // or caster is isolated or caster no longer has the aura
796 // or caster is (no longer) friendly
797 bool needFriendly
= (m_areaAuraType
== AREA_AURA_ENEMY
? false : true);
798 if( !caster
|| caster
->hasUnitState(UNIT_STAT_ISOLATED
) ||
799 !caster
->IsWithinDistInMap(tmp_target
, m_radius
) ||
800 !caster
->HasAura(tmp_spellId
, tmp_effIndex
) ||
801 caster
->IsFriendlyTo(tmp_target
) != needFriendly
804 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
806 else if( m_areaAuraType
== AREA_AURA_PARTY
) // check if in same sub group
808 // not check group if target == owner or target == pet
809 if (caster
->GetCharmerOrOwnerGUID() != tmp_target
->GetGUID() && caster
->GetGUID() != tmp_target
->GetCharmerOrOwnerGUID())
811 Player
* check
= caster
->GetCharmerOrOwnerPlayerOrPlayerItself();
813 Group
*pGroup
= check
? check
->GetGroup() : NULL
;
816 Player
* checkTarget
= tmp_target
->GetCharmerOrOwnerPlayerOrPlayerItself();
817 if(!checkTarget
|| !pGroup
->SameSubGroup(check
, checkTarget
))
818 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
821 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
824 else if( m_areaAuraType
== AREA_AURA_RAID
) // TODO: fix me!
826 // not check group if target == owner or target == pet
827 if (caster
->GetCharmerOrOwnerGUID() != tmp_target
->GetGUID() && caster
->GetGUID() != tmp_target
->GetCharmerOrOwnerGUID())
829 Player
* check
= caster
->GetCharmerOrOwnerPlayerOrPlayerItself();
831 Group
*pGroup
= check
? check
->GetGroup() : NULL
;
834 Player
* checkTarget
= tmp_target
->GetCharmerOrOwnerPlayerOrPlayerItself();
836 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
839 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
842 else if( m_areaAuraType
== AREA_AURA_PET
|| m_areaAuraType
== AREA_AURA_OWNER
)
844 if( tmp_target
->GetGUID() != caster
->GetCharmerOrOwnerGUID() )
845 tmp_target
->RemoveAura(tmp_spellId
, tmp_effIndex
);
850 void PersistentAreaAura::Update(uint32 diff
)
854 // remove the aura if its caster or the dynamic object causing it was removed
855 // or if the target moves too far from the dynamic object
856 Unit
*caster
= GetCaster();
859 DynamicObject
*dynObj
= caster
->GetDynObject(GetId(), GetEffIndex());
862 if (!m_target
->IsWithinDistInMap(dynObj
, dynObj
->GetRadius()))
871 Unit
*tmp_target
= m_target
;
872 uint32 tmp_id
= GetId(), tmp_index
= GetEffIndex();
874 // WARNING: the aura may get deleted during the update
875 // DO NOT access its members after update!
879 tmp_target
->RemoveAura(tmp_id
, tmp_index
);
882 void Aura::ApplyModifier(bool apply
, bool Real
)
884 AuraType aura
= m_modifier
.m_auraname
;
888 (*this.*AuraHandler
[aura
])(apply
,Real
);
892 void Aura::_AddAura()
899 // Second aura if some spell
900 bool secondaura
= false;
901 // Try find slot for aura
902 uint8 slot
= NULL_AURA_SLOT
;
903 // Lookup for some spell auras (and get slot from it)
904 for(uint8 i
= 0; i
< m_effIndex
; i
++)
906 Unit::spellEffectPair spair
= Unit::spellEffectPair(GetId(), i
);
907 for(Unit::AuraMap::const_iterator itr
= m_target
->GetAuras().lower_bound(spair
); itr
!= m_target
->GetAuras().upper_bound(spair
); ++itr
)
909 // allow use single slot only by auras from same caster
910 if(itr
->second
->GetCasterGUID()==GetCasterGUID())
912 slot
= itr
->second
->GetAuraSlot();
921 if (!secondaura
&& m_target
->GetVisibleAurasCount() < MAX_AURAS
)
923 Unit::VisibleAuraMap
const *visibleAuras
= m_target
->GetVisibleAuras();
924 for(uint8 i
= 0; i
< MAX_AURAS
; ++i
)
926 Unit::VisibleAuraMap::const_iterator itr
= visibleAuras
->find(i
);
927 if(itr
== visibleAuras
->end())
930 // update for out of range group members (on 1 slot use)
931 m_target
->UpdateAuraForGroup(slot
);
937 Unit
* caster
= GetCaster();
939 // set infinity cooldown state for spells
940 if(caster
&& caster
->GetTypeId() == TYPEID_PLAYER
)
942 if (m_spellProto
->Attributes
& SPELL_ATTR_DISABLED_WHILE_ACTIVE
)
944 Item
* castItem
= m_castItemGuid
? ((Player
*)caster
)->GetItemByGuid(m_castItemGuid
) : NULL
;
945 ((Player
*)caster
)->AddSpellAndCategoryCooldowns(m_spellProto
,castItem
? castItem
->GetEntry() : 0, NULL
,true);
949 // passive auras (except totem auras) do not get placed in the slots
950 // area auras with SPELL_AURA_NONE are not shown on target
951 if((!m_isPassive
|| (caster
&& caster
->GetTypeId() == TYPEID_UNIT
&& ((Creature
*)caster
)->isTotem())) &&
952 (m_spellProto
->Effect
[GetEffIndex()] != SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
|| m_target
!= caster
))
955 if(slot
< MAX_AURAS
) // slot found send data to client
958 SetAuraFlags((1 << GetEffIndex()) | AFLAG_NOT_CASTER
| ((GetAuraMaxDuration() > 0) ? AFLAG_DURATION
: AFLAG_NONE
) | (IsPositive() ? AFLAG_POSITIVE
: AFLAG_NEGATIVE
));
959 SetAuraLevel(caster
? caster
->getLevel() : sWorld
.getConfig(CONFIG_MAX_PLAYER_LEVEL
));
960 SendAuraUpdate(false);
963 //*****************************************************
964 // Update target aura state flag (at 1 aura apply)
965 // TODO: Make it easer
966 //*****************************************************
969 // Sitdown on apply aura req seated
970 if (m_spellProto
->AuraInterruptFlags
& AURA_INTERRUPT_FLAG_NOT_SEATED
&& !m_target
->IsSitState())
971 m_target
->SetStandState(UNIT_STAND_STATE_SIT
);
973 // register aura diminishing on apply
974 if (getDiminishGroup() != DIMINISHING_NONE
)
975 m_target
->ApplyDiminishingAura(getDiminishGroup(),true);
977 // Update Seals information
978 if (IsSealSpell(m_spellProto
))
979 m_target
->ModifyAuraState(AURA_STATE_JUDGEMENT
, true);
981 // Conflagrate aura state on Immolate
982 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_WARLOCK
&& m_spellProto
->SpellFamilyFlags
& 4)
983 m_target
->ModifyAuraState(AURA_STATE_IMMOLATE
, true);
985 // Faerie Fire (druid versions)
986 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_DRUID
&& m_spellProto
->SpellFamilyFlags
& 0x0000000000000400LL
)
987 m_target
->ModifyAuraState(AURA_STATE_FAERIE_FIRE
, true);
990 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_WARRIOR
&& m_spellProto
->SpellFamilyFlags
& 0x0004000000000000LL
)
991 m_target
->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH
, true);
993 // Swiftmend state on Regrowth & Rejuvenation
994 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_DRUID
&& m_spellProto
->SpellFamilyFlags
& 0x50 )
995 m_target
->ModifyAuraState(AURA_STATE_SWIFTMEND
, true);
997 // Deadly poison aura state
998 if(m_spellProto
->SpellFamilyName
== SPELLFAMILY_ROGUE
&& m_spellProto
->SpellFamilyFlags
& 0x10000)
999 m_target
->ModifyAuraState(AURA_STATE_DEADLY_POISON
, true);
1001 // Enrage aura state
1002 if(m_spellProto
->Dispel
== DISPEL_ENRAGE
)
1003 m_target
->ModifyAuraState(AURA_STATE_ENRAGE
, true);
1008 void Aura::_RemoveAura()
1010 // Remove all triggered by aura spells vs unlimited duration
1011 // except same aura replace case
1012 if(m_removeMode
!=AURA_REMOVE_BY_STACK
)
1013 CleanupTriggeredSpells();
1015 Unit
* caster
= GetCaster();
1017 if(caster
&& IsPersistent())
1019 DynamicObject
*dynObj
= caster
->GetDynObject(GetId(), GetEffIndex());
1021 dynObj
->RemoveAffected(m_target
);
1024 //passive auras do not get put in slots
1025 // Note: but totem can be not accessible for aura target in time remove (to far for find in grid)
1026 //if(m_isPassive && !(caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem()))
1029 uint8 slot
= GetAuraSlot();
1031 if(slot
>= MAX_AURAS
) // slot not set
1034 if(m_target
->GetVisibleAura(slot
) == 0)
1037 bool lastaura
= true;
1039 // find other aura in same slot (current already removed from list)
1040 for(uint8 i
= 0; i
< 3; i
++)
1042 Unit::spellEffectPair spair
= Unit::spellEffectPair(GetId(), i
);
1043 for(Unit::AuraMap::const_iterator itr
= m_target
->GetAuras().lower_bound(spair
); itr
!= m_target
->GetAuras().upper_bound(spair
); ++itr
)
1045 if(itr
->second
->GetAuraSlot()==slot
)
1055 // only remove icon when the last aura of the spell is removed (current aura already removed from list)
1058 // unregister aura diminishing (and store last time)
1059 if (getDiminishGroup() != DIMINISHING_NONE
)
1060 m_target
->ApplyDiminishingAura(getDiminishGroup(),false);
1063 SetAuraFlags(AFLAG_NONE
);
1065 SendAuraUpdate(true);
1067 // update for out of range group members
1068 m_target
->UpdateAuraForGroup(slot
);
1070 //*****************************************************
1071 // Update target aura state flag (at last aura remove)
1072 //*****************************************************
1073 // Enrage aura state
1074 if(m_spellProto
->Dispel
== DISPEL_ENRAGE
)
1075 m_target
->ModifyAuraState(AURA_STATE_ENRAGE
, false);
1077 uint32 removeState
= 0;
1078 switch(m_spellProto
->SpellFamilyName
)
1080 case SPELLFAMILY_PALADIN
:
1081 if (IsSealSpell(m_spellProto
))
1082 removeState
= AURA_STATE_JUDGEMENT
; // Update Seals information
1084 case SPELLFAMILY_WARLOCK
:
1085 if(m_spellProto
->SpellFamilyFlags
& 4)
1086 removeState
= AURA_STATE_IMMOLATE
; // Conflagrate aura state
1088 case SPELLFAMILY_DRUID
:
1089 if(m_spellProto
->SpellFamilyFlags
& 0x0000000000000400LL
)
1090 removeState
= AURA_STATE_FAERIE_FIRE
; // Faerie Fire (druid versions)
1091 else if(m_spellProto
->SpellFamilyFlags
& 0x50)
1092 removeState
= AURA_STATE_SWIFTMEND
; // Swiftmend aura state
1094 case SPELLFAMILY_WARRIOR
:
1095 if(m_spellProto
->SpellFamilyFlags
& 0x0004000000000000LL
)
1096 removeState
= AURA_STATE_WARRIOR_VICTORY_RUSH
; // Victorious
1098 case SPELLFAMILY_ROGUE
:
1099 if(m_spellProto
->SpellFamilyFlags
& 0x10000)
1100 removeState
= AURA_STATE_DEADLY_POISON
; // Deadly poison aura state
1102 case SPELLFAMILY_HUNTER
:
1103 if(m_spellProto
->SpellFamilyFlags
& 0x1000000000000000LL
)
1104 removeState
= AURA_STATE_FAERIE_FIRE
; // Sting (hunter versions)
1107 // Remove state (but need check other auras for it)
1111 Unit::AuraMap
& Auras
= m_target
->GetAuras();
1112 for(Unit::AuraMap::iterator i
= Auras
.begin(); i
!= Auras
.end(); ++i
)
1114 SpellEntry
const *auraSpellInfo
= (*i
).second
->GetSpellProto();
1115 if(auraSpellInfo
->SpellFamilyName
== m_spellProto
->SpellFamilyName
&&
1116 auraSpellInfo
->SpellFamilyFlags
== m_spellProto
->SpellFamilyFlags
)
1122 // this has been last aura
1124 m_target
->ModifyAuraState(AuraState(removeState
), false);
1127 // reset cooldown state for spells
1128 if(caster
&& caster
->GetTypeId() == TYPEID_PLAYER
)
1130 if ( GetSpellProto()->Attributes
& SPELL_ATTR_DISABLED_WHILE_ACTIVE
)
1131 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
1132 ((Player
*)caster
)->SendCooldownEvent(GetSpellProto());
1137 void Aura::SendAuraUpdate(bool remove
)
1139 WorldPacket
data(SMSG_AURA_UPDATE
);
1140 data
.append(m_target
->GetPackGUID());
1141 data
<< uint8(GetAuraSlot());
1142 data
<< uint32(remove
? 0 : GetId());
1146 m_target
->SendMessageToSet(&data
, true);
1150 uint8 auraFlags
= GetAuraFlags();
1151 data
<< uint8(auraFlags
);
1152 data
<< uint8(GetAuraLevel());
1153 data
<< uint8(m_procCharges
? m_procCharges
: m_stackAmount
);
1155 if(!(auraFlags
& AFLAG_NOT_CASTER
))
1157 data
<< uint8(0); // pguid
1160 if(auraFlags
& AFLAG_DURATION
)
1162 data
<< uint32(GetAuraMaxDuration());
1163 data
<< uint32(GetAuraDuration());
1166 m_target
->SendMessageToSet(&data
, true);
1169 void Aura::SetStackAmount(uint8 stackAmount
)
1171 if (stackAmount
!= m_stackAmount
)
1173 Unit
*target
= GetTarget();
1174 Unit
*caster
= GetCaster();
1175 if (!target
|| !caster
)
1177 m_stackAmount
= stackAmount
;
1178 int32 amount
= m_stackAmount
* caster
->CalculateSpellDamage(m_spellProto
, m_effIndex
, m_currentBasePoints
, target
);
1179 // Reapply if amount change
1180 if (amount
!=m_modifier
.m_amount
)
1182 ApplyModifier(false, true);
1183 m_modifier
.m_amount
= amount
;
1184 ApplyModifier(true, true);
1190 bool Aura::modStackAmount(int32 num
)
1193 if (!m_spellProto
->StackAmount
)
1196 // Modify stack but limit it
1197 int32 stackAmount
= m_stackAmount
+ num
;
1198 if (stackAmount
> m_spellProto
->StackAmount
)
1199 stackAmount
= m_spellProto
->StackAmount
;
1200 else if (stackAmount
<=0) // Last aura from stack removed
1203 return true; // need remove aura
1206 // Update stack amount
1207 SetStackAmount(stackAmount
);
1211 void Aura::RefreshAura()
1213 m_duration
= m_maxduration
;
1214 SendAuraUpdate(false);
1217 bool Aura::isAffectedOnSpell(SpellEntry
const *spell
) const
1219 // Check family name
1220 if (spell
->SpellFamilyName
!= m_spellProto
->SpellFamilyName
)
1222 // Check EffectClassMask
1223 uint32
const *ptr
= getAuraSpellClassMask();
1224 if (((uint64
*)ptr
)[0] & spell
->SpellFamilyFlags
)
1226 if (ptr
[2] & spell
->SpellFamilyFlags2
)
1231 /*********************************************************/
1232 /*** BASIC AURA FUNCTION ***/
1233 /*********************************************************/
1234 void Aura::HandleAddModifier(bool apply
, bool Real
)
1236 if(m_target
->GetTypeId() != TYPEID_PLAYER
|| !Real
)
1239 if(m_modifier
.m_miscvalue
>= MAX_SPELLMOD
)
1244 // Add custom charges for some mod aura
1245 switch (m_spellProto
->Id
)
1247 case 17941: // Shadow Trance
1248 case 22008: // Netherwind Focus
1249 case 31834: // Light's Grace
1250 case 34754: // Clearcasting
1251 case 34936: // Backlash
1252 case 48108: // Hot Streak
1253 case 51124: // Killing Machine
1254 case 54741: // Firestarter
1255 case 57761: // Fireball!
1260 SpellModifier
*mod
= new SpellModifier
;
1261 mod
->op
= SpellModOp(m_modifier
.m_miscvalue
);
1262 mod
->value
= m_modifier
.m_amount
;
1263 mod
->type
= SpellModType(m_modifier
.m_auraname
); // SpellModType value == spell aura types
1264 mod
->spellId
= GetId();
1267 SpellAffectEntry
const *spellAffect
= spellmgr
.GetSpellAffect(GetId(), m_effIndex
);
1269 ptr
= &spellAffect
->SpellClassMask
[0];
1274 case 0: ptr
= &m_spellProto
->EffectSpellClassMaskA
[0]; break;
1275 case 1: ptr
= &m_spellProto
->EffectSpellClassMaskB
[0]; break;
1276 case 2: ptr
= &m_spellProto
->EffectSpellClassMaskC
[0]; break;
1282 mod
->mask
= (uint64
)ptr
[0] | (uint64
)ptr
[1]<<32;
1283 mod
->mask2
= (uint64
)ptr
[2];
1284 mod
->charges
= m_procCharges
;
1289 uint64 spellFamilyMask
= m_spellmod
->mask
;
1291 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
1293 // reapply some passive spells after add/remove related spellmods
1294 if(m_spellProto
->SpellFamilyName
==SPELLFAMILY_WARRIOR
&& (spellFamilyMask
& 0x0000100000000000LL
))
1296 m_target
->RemoveAurasDueToSpell(45471);
1299 m_target
->CastSpell(m_target
,45471,true);
1302 void Aura::HandleAddTargetTrigger(bool apply
, bool /*Real*/)
1304 // Use SpellModifier structure for check
1305 // used only fields:
1306 // spellId, mask, mask2
1309 SpellModifier
*mod
= new SpellModifier
;
1310 mod
->spellId
= GetId();
1313 SpellAffectEntry
const *spellAffect
= spellmgr
.GetSpellAffect(GetId(), m_effIndex
);
1315 ptr
= &spellAffect
->SpellClassMask
[0];
1320 case 0: ptr
= &m_spellProto
->EffectSpellClassMaskA
[0]; break;
1321 case 1: ptr
= &m_spellProto
->EffectSpellClassMaskB
[0]; break;
1322 case 2: ptr
= &m_spellProto
->EffectSpellClassMaskC
[0]; break;
1328 mod
->mask
= (uint64
)ptr
[0] | (uint64
)ptr
[1]<<32;
1329 mod
->mask2
= (uint64
)ptr
[2];
1339 void Aura::TriggerSpell()
1341 Unit
* caster
= GetCaster();
1342 Unit
* target
= GetTriggerTarget();
1344 if(!caster
|| !target
)
1347 // generic casting code with custom spells and target/caster customs
1348 uint32 trigger_spell_id
= GetSpellProto()->EffectTriggerSpell
[m_effIndex
];
1350 SpellEntry
const *triggeredSpellInfo
= sSpellStore
.LookupEntry(trigger_spell_id
);
1351 SpellEntry
const *auraSpellInfo
= GetSpellProto();
1352 uint32 auraId
= auraSpellInfo
->Id
;
1354 // specific code for cases with no trigger spell provided in field
1355 if (triggeredSpellInfo
== NULL
)
1357 switch(auraSpellInfo
->SpellFamilyName
)
1359 case SPELLFAMILY_GENERIC
:
1363 // Firestone Passive (1-5 ranks)
1370 if (caster
->GetTypeId()!=TYPEID_PLAYER
)
1372 Item
* item
= ((Player
*)caster
)->GetWeaponForAttack(BASE_ATTACK
);
1375 uint32 enchant_id
= 0;
1378 case 758: enchant_id
= 1803; break; // Rank 1
1379 case 17945: enchant_id
= 1823; break; // Rank 2
1380 case 17947: enchant_id
= 1824; break; // Rank 3
1381 case 17949: enchant_id
= 1825; break; // Rank 4
1382 case 27252: enchant_id
= 2645; break; // Rank 5
1386 // remove old enchanting before applying new
1387 ((Player
*)caster
)->ApplyEnchantment(item
,TEMP_ENCHANTMENT_SLOT
,false);
1388 item
->SetEnchantment(TEMP_ENCHANTMENT_SLOT
, enchant_id
, m_modifier
.periodictime
+1000, 0);
1389 // add new enchanting
1390 ((Player
*)caster
)->ApplyEnchantment(item
,TEMP_ENCHANTMENT_SLOT
,true);
1393 // // Periodic Mana Burn
1395 // // Polymorphic Ray
1396 // case 6965: break;
1397 // // Fire Nova (1-7 ranks)
1406 // Thaumaturgy Channel
1407 case 9712: trigger_spell_id
= 21029; break;
1408 // // Egan's Blaster
1409 // case 17368: break;
1411 // case 18347: break;
1412 // // Ranshalla Waiting
1413 // case 18953: break;
1415 // case 19695: break;
1416 // // Frostwolf Muzzle DND
1417 // case 21794: break;
1418 // // Alterac Ram Collar DND
1419 // case 21866: break;
1420 // // Celebras Waiting
1421 // case 21916: break;
1422 // Brood Affliction: Bronze
1425 m_target
->CastSpell(m_target
, 23171, true, 0, this);
1429 // case 23184: break;
1433 int32 heal
= caster
->GetMaxHealth() / 10;
1434 caster
->DealHeal(caster
, heal
, auraSpellInfo
);
1436 int32 mana
= caster
->GetMaxPower(POWER_MANA
);
1440 caster
->ModifyPower( POWER_MANA
, mana
);
1441 caster
->SendEnergizeSpellLog(caster
, 23493, mana
, POWER_MANA
);
1445 // // Stoneclaw Totem Passive TEST
1446 // case 23792: break;
1448 // case 24018: break;
1449 // // Mark of Arlokk
1450 // case 24210: break;
1452 // case 24379: break;
1454 // case 24716: break;
1456 // case 24780: break;
1458 // case 24832: break;
1459 // // Shadow Bolt Whirl
1460 // case 24834: break;
1462 // case 24918: break;
1463 // // Mark of Nature
1464 // case 25041: break;
1466 // case 25152: break;
1468 // case 25371: break;
1470 // case 25572: break;
1472 // case 26009: break;
1474 // case 26136: break;
1476 // case 26196: break;
1478 // case 26615: break;
1480 // case 27177: break;
1481 // // Teleport: IF/UC
1482 // case 27601: break;
1483 // // Five Fat Finger Exploding Heart Technique
1484 // case 27673: break;
1486 // case 27746: break;
1487 // // Steam Tank Passive
1488 // case 27747: break;
1492 int32 bpDamage
= target
->GetMaxHealth()*26/100;
1493 caster
->CastCustomSpell(target
,29879,&bpDamage
,NULL
,NULL
,true,NULL
,this);
1497 // case 27819: break;
1498 // // Controller Timer
1499 // case 28095: break;
1501 // case 28096: break;
1502 // // Stalagg Tesla Passive
1503 // case 28097: break;
1504 // // Feugen Tesla Passive
1505 // case 28109: break;
1507 // case 28111: break;
1508 // // Mark of Didier
1509 // case 28114: break;
1510 // // Communique Timer, camp
1511 // case 28346: break;
1513 // case 28522: break;
1515 // case 29519: break;
1516 // Inoculate Nestlewood Owlkin
1518 if(target
->GetTypeId()!=TYPEID_UNIT
)// prevent error reports in case ignored player target
1522 // case 29768: break;
1524 // case 29788: break;
1526 // case 29793: break;
1528 // case 29794: break;
1529 // // Guardian of Icecrown Passive
1530 // case 29897: break;
1531 // Feed Captured Animal
1532 case 29917: trigger_spell_id
= 29916; break;
1534 // case 29946: break;
1536 // case 29947: break;
1537 // // Mind Exhaustion Passive
1538 // case 30025: break;
1539 // // Nether Beam - Serenity
1540 // case 30401: break;
1544 // move loot to player inventory and despawn target
1545 if(caster
->GetTypeId() ==TYPEID_PLAYER
&&
1546 target
->GetTypeId() == TYPEID_UNIT
&&
1547 ((Creature
*)target
)->GetCreatureInfo()->type
== CREATURE_TYPE_GAS_CLOUD
)
1549 Player
* player
= (Player
*)caster
;
1550 Creature
* creature
= (Creature
*)target
;
1551 // missing lootid has been reported on startup - just return
1552 if (!creature
->GetCreatureInfo()->SkinLootId
)
1555 player
->AutoStoreLoot(creature
->GetCreatureInfo()->SkinLootId
,LootTemplates_Skinning
,true);
1557 creature
->setDeathState(JUST_DIED
);
1558 creature
->RemoveCorpse();
1559 creature
->SetHealth(0); // just for nice GM-mode view
1564 case 30576: trigger_spell_id
= 30571; break;
1566 // case 30598: break;
1572 // // Despawn Self - Smoke cloud
1573 // case 31269: break;
1574 // // Time Rift Periodic
1575 // case 31320: break;
1576 // // Corrupt Medivh
1577 // case 31326: break;
1581 m_target
->CastSpell(m_target
,31350,true);
1582 m_target
->DealDamage(m_target
, m_target
->GetHealth(), NULL
, DIRECT_DAMAGE
, SPELL_SCHOOL_MASK_NORMAL
, NULL
, false);
1588 // Summon Elemental after create item
1589 caster
->SummonCreature(17870, 0, 0, 0, caster
->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN
, 0);
1592 // // Bloodmyst Tesla
1593 // case 31611: break;
1595 // case 31944: break;
1597 // case 32236: break;
1599 // case 32686: break;
1601 // case 33401: break;
1603 // case 33563: break;
1604 // // Murmur's Touch
1605 // case 33711: break;
1609 // cast 24 spells 34269-34289, 34314-34316
1610 for(uint32 spell_id
= 34269; spell_id
!= 34290; ++spell_id
)
1611 caster
->CastSpell(m_target
,spell_id
,true);
1612 for(uint32 spell_id
= 34314; spell_id
!= 34317; ++spell_id
)
1613 caster
->CastSpell(m_target
,spell_id
,true);
1617 // case 34480: break;
1619 // case 34683: break;
1620 // // Frostbite Rotate
1621 // case 34748: break;
1623 // case 34821: break;
1624 // // Interrupt Shutdown
1625 // case 35016: break;
1626 // // Interrupt Shutdown
1627 // case 35176: break;
1629 // case 35268: break;
1630 // // Salaadin's Tesla
1631 // case 35515: break;
1632 // // Ethereal Channel (Red)
1633 // case 35518: break;
1635 // case 35879: break;
1636 // // Dark Portal Storm
1637 // case 36018: break;
1639 // case 36056: break;
1640 // // Living Grove Defender Lifespan
1641 // case 36061: break;
1642 // // Professor Dabiri Talks
1643 // case 36064: break;
1644 // // Kael Gaining Power
1645 // case 36091: break;
1646 // // They Must Burn Bomb Aura
1647 // case 36344: break;
1648 // // They Must Burn Bomb Aura (self)
1649 // case 36350: break;
1650 // // Stolen Ravenous Ravager Egg
1651 // case 36401: break;
1652 // // Activated Cannon
1653 // case 36410: break;
1654 // // Stolen Ravenous Ravager Egg
1655 // case 36418: break;
1656 // // Enchanted Weapons
1657 // case 36510: break;
1658 // // Cursed Scarab Periodic
1659 // case 36556: break;
1660 // // Cursed Scarab Despawn Periodic
1661 // case 36561: break;
1663 // case 36573: break;
1664 // // Cannon Charging (platform)
1665 // case 36785: break;
1666 // // Cannon Charging (self)
1667 // case 36860: break;
1669 case 37027: trigger_spell_id
= 37029; break;
1671 // case 37125: break;
1673 // case 37268: break;
1675 // case 37429: break;
1677 // case 37430: break;
1678 // // Karazhan - Chess NPC AI, Snapshot timer
1679 // case 37440: break;
1680 // // Karazhan - Chess NPC AI, action timer
1681 // case 37504: break;
1682 // // Karazhan - Chess: Is Square OCCUPIED aura (DND)
1683 // case 39400: break;
1685 // case 37546: break;
1686 // // Shriveling Gaze
1687 // case 37589: break;
1688 // // Fake Aggro Radius (2 yd)
1689 // case 37815: break;
1690 // // Corrupt Medivh
1691 // case 37853: break;
1695 m_target
->CastSpell(m_target
, 38530, true);
1698 // Absorb Eye of Grillok (Zezzak's Shard)
1701 if(m_target
->GetTypeId() != TYPEID_UNIT
)
1704 caster
->CastSpell(caster
, 38495, true);
1706 Creature
* creatureTarget
= (Creature
*)m_target
;
1708 creatureTarget
->setDeathState(JUST_DIED
);
1709 creatureTarget
->RemoveCorpse();
1710 creatureTarget
->SetHealth(0); // just for nice GM-mode view
1713 // // Magic Sucker Device timer
1714 // case 38672: break;
1715 // // Tomb Guarding Charging
1716 // case 38751: break;
1717 // // Murmur's Touch
1718 // case 38794: break;
1719 // // Activate Nether-wraith Beacon (31742 Nether-wraith Beacon item)
1720 // case 39105: break;
1721 // // Drain World Tree Visual
1722 // case 39140: break;
1723 // // Quest - Dustin's Undead Dragon Visual aura
1724 // case 39259: break;
1725 // // Hellfire - The Exorcism, Jules releases darkness, aura
1726 // case 39306: break;
1728 // case 39346: break;
1729 // // Enchanted Weapons
1730 // case 39489: break;
1731 // // Shadow Bolt Whirl
1732 // case 39630: break;
1733 // // Shadow Bolt Whirl
1734 // case 39634: break;
1735 // // Shadow Inferno
1736 // case 39645: break;
1737 // Tear of Azzinoth Summon Channel - it's not really supposed to do anything,and this only prevents the console spam
1738 case 39857: trigger_spell_id
= 39856; break;
1739 // // Soulgrinder Ritual Visual (Smashed)
1740 // case 39974: break;
1741 // // Simon Game Pre-game timer
1742 // case 40041: break;
1743 // // Knockdown Fel Cannon: The Aggro Check Aura
1744 // case 40113: break;
1746 // case 40157: break;
1747 // // Demon Transform 2
1748 // case 40398: break;
1749 // // Demon Transform 1
1750 // case 40511: break;
1751 // // Ancient Flames
1752 // case 40657: break;
1753 // // Ethereal Ring Cannon: Cannon Aura
1754 // case 40734: break;
1756 // case 40760: break;
1757 // // Random Periodic
1758 // case 40867: break;
1759 // // Prismatic Shield
1760 // case 40879: break;
1761 // // Aura of Desire
1762 // case 41350: break;
1764 // case 41404: break;
1766 // case 41629: break;
1768 // case 42177: break;
1770 // case 42581: break;
1772 // case 42582: break;
1773 // // Return to the Spirit Realm
1774 // case 44035: break;
1775 // // Curse of Boundless Agony
1776 // case 45050: break;
1778 // case 46240: break;
1779 // Personalized Weather
1780 case 46736: trigger_spell_id
= 46737; break;
1781 // // Stay Submerged
1782 // case 46981: break;
1783 // // Dragonblight Ram
1784 // case 47015: break;
1785 // // Party G.R.E.N.A.D.E.
1786 // case 51510: break;
1792 case SPELLFAMILY_MAGE
:
1798 // Here need periodic triger reducing threat spell (or do it manually)
1805 // case SPELLFAMILY_WARRIOR:
1810 // case 23410: break;
1811 // // Corrupted Totems
1812 // case 23425: break;
1818 // case SPELLFAMILY_PRIEST:
1823 // case 32930: break;
1824 // // Fury of the Dreghood Elders
1825 // case 35460: break;
1831 case SPELLFAMILY_DRUID
:
1836 // trigger_spell_id not set and unknown effect triggered in this case, ignoring for while
1839 // Frenzied Regeneration
1845 int32 LifePerRage
= GetModifier()->m_amount
;
1847 int32 lRage
= m_target
->GetPower(POWER_RAGE
);
1848 if(lRage
> 100) // rage stored as rage*10
1850 m_target
->ModifyPower(POWER_RAGE
, -lRage
);
1851 int32 FRTriggerBasePoints
= int32(lRage
*LifePerRage
/10);
1852 m_target
->CastCustomSpell(m_target
,22845,&FRTriggerBasePoints
,NULL
,NULL
,true,NULL
,this);
1861 // case SPELLFAMILY_HUNTER:
1865 // //Frost Trap Aura
1868 // //Rizzle's Frost Trap
1872 // case 19597: // Tame Ice Claw Bear
1873 // case 19676: // Tame Snow Leopard
1874 // case 19677: // Tame Large Crag Boar
1875 // case 19678: // Tame Adult Plainstrider
1876 // case 19679: // Tame Prairie Stalker
1877 // case 19680: // Tame Swoop
1878 // case 19681: // Tame Dire Mottled Boar
1879 // case 19682: // Tame Surf Crawler
1880 // case 19683: // Tame Armored Scorpid
1881 // case 19684: // Tame Webwood Lurker
1882 // case 19685: // Tame Nightsaber Stalker
1883 // case 19686: // Tame Strigid Screecher
1884 // case 30100: // Tame Crazed Dragonhawk
1885 // case 30103: // Tame Elder Springpaw
1886 // case 30104: // Tame Mistbat
1887 // case 30647: // Tame Barbed Crawler
1888 // case 30648: // Tame Greater Timberstrider
1889 // case 30652: // Tame Nightstalker
1896 case SPELLFAMILY_SHAMAN
:
1900 // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield)
1903 // Need remove self if Lightning Shield not active
1904 Unit::AuraMap
const& auras
= target
->GetAuras();
1905 for(Unit::AuraMap::const_iterator itr
= auras
.begin(); itr
!= auras
.end(); ++itr
)
1907 SpellEntry
const* spell
= itr
->second
->GetSpellProto();
1908 if( spell
->SpellFamilyName
== SPELLFAMILY_SHAMAN
&&
1909 spell
->SpellFamilyFlags
& 0x0000000000000400L
)
1912 target
->RemoveAurasDueToSpell(28820);
1915 // Totemic Mastery (Skyshatter Regalia (Shaman Tier 6) - bonus)
1919 for(int i
= 0; i
< MAX_TOTEM
; ++i
)
1921 if(!caster
->m_TotemSlot
[i
])
1929 caster
->CastSpell(caster
,38437,true);
1931 caster
->RemoveAurasDueToSpell(38437);
1943 // Reget trigger spell proto
1944 triggeredSpellInfo
= sSpellStore
.LookupEntry(trigger_spell_id
);
1948 // Spell exist but require custom code
1954 // TODO: spell casted by result in correct way mostly
1956 // 1) target show casting at each triggered cast: target don't must show casting animation for any triggered spell
1957 // but must show affect apply like item casting
1958 // 2) maybe aura must be replace by new with accumulative stat mods instead stacking
1960 // prevent cast by triggered auras
1961 if(m_caster_guid
== m_target
->GetGUID())
1964 // stop triggering after each affected stats lost > 90
1965 int32 intelectLoss
= 0;
1966 int32 spiritLoss
= 0;
1968 Unit::AuraList
const& mModStat
= m_target
->GetAurasByType(SPELL_AURA_MOD_STAT
);
1969 for(Unit::AuraList::const_iterator i
= mModStat
.begin(); i
!= mModStat
.end(); ++i
)
1971 if ((*i
)->GetId() == 1010)
1973 switch((*i
)->GetModifier()->m_miscvalue
)
1975 case STAT_INTELLECT
: intelectLoss
+= (*i
)->GetModifier()->m_amount
; break;
1976 case STAT_SPIRIT
: spiritLoss
+= (*i
)->GetModifier()->m_amount
; break;
1982 if(intelectLoss
<= -90 && spiritLoss
<= -90)
1991 caster
->CastCustomSpell(target
, trigger_spell_id
, &m_modifier
.m_amount
, NULL
, NULL
, true, NULL
, this);
1997 // All ok cast by default case
1998 if(triggeredSpellInfo
)
1999 caster
->CastSpell(target
, triggeredSpellInfo
, true, 0, this);
2000 else if(target
->GetTypeId()!=TYPEID_UNIT
|| !Script
->EffectDummyCreature(caster
, GetId(), GetEffIndex(), (Creature
*)target
))
2001 sLog
.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
2004 void Aura::TriggerSpellWithValue()
2006 Unit
* caster
= GetCaster();
2007 Unit
* target
= GetTriggerTarget();
2009 if(!caster
|| !target
)
2012 // generic casting code with custom spells and target/caster customs
2013 uint32 trigger_spell_id
= GetSpellProto()->EffectTriggerSpell
[m_effIndex
];
2014 int32 basepoints0
= this->GetModifier()->m_amount
;
2016 caster
->CastCustomSpell(target
, trigger_spell_id
, &basepoints0
, 0, 0, true, 0, this);
2019 /*********************************************************/
2020 /*** AURA EFFECTS ***/
2021 /*********************************************************/
2023 void Aura::HandleAuraDummy(bool apply
, bool Real
)
2025 // spells required only Real aura add/remove
2029 Unit
* caster
= GetCaster();
2036 case 1515: // Tame beast
2037 // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness
2038 if( caster
&& m_target
->CanHaveThreatList())
2039 m_target
->AddThreat(caster
, 10.0f
);
2041 case 13139: // net-o-matic
2042 // root to self part of (root_target->charge->root_self sequence
2044 caster
->CastSpell(caster
,13138,true,NULL
,this);
2046 case 39850: // Rocket Blast
2047 if(roll_chance_i(20)) // backfire stun
2048 m_target
->CastSpell(m_target
, 51581, true, NULL
, this);
2050 case 43873: // Headless Horseman Laugh
2051 m_target
->PlayDistanceSound(11965);
2053 case 46354: // Blood Elf Illusion
2056 switch(caster
->getGender())
2059 caster
->CastSpell(m_target
,46356,true,NULL
,this);
2062 caster
->CastSpell(m_target
,46355,true,NULL
,this);
2069 case 46699: // Requires No Ammo
2070 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
2071 ((Player
*)m_target
)->RemoveAmmo(); // not use ammo and not allow use
2076 if ( caster
&& GetSpellProto()->SpellFamilyName
== SPELLFAMILY_SHAMAN
&& (GetSpellProto()->SpellFamilyFlags
& 0x40000000000LL
))
2078 // prevent double apply bonuses
2079 if(m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading())
2080 m_modifier
.m_amount
= caster
->SpellHealingBonus(m_target
, GetSpellProto(), m_modifier
.m_amount
, SPELL_DIRECT_DAMAGE
);
2087 if( m_target
->GetTypeId() == TYPEID_PLAYER
&&
2088 ( GetSpellProto()->Effect
[0]==72 || GetSpellProto()->Effect
[0]==6 &&
2089 ( GetSpellProto()->EffectApplyAuraName
[0]==1 || GetSpellProto()->EffectApplyAuraName
[0]==128 ) ) )
2091 // spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425
2092 ((Player
*)m_target
)->SetFarSightGUID(0);
2093 WorldPacket
data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE
, 0);
2094 ((Player
*)m_target
)->GetSession()->SendPacket(&data
);
2098 if( (IsQuestTameSpell(GetId())) && caster
&& caster
->isAlive() && m_target
->isAlive())
2100 uint32 finalSpelId
= 0;
2103 case 19548: finalSpelId
= 19597; break;
2104 case 19674: finalSpelId
= 19677; break;
2105 case 19687: finalSpelId
= 19676; break;
2106 case 19688: finalSpelId
= 19678; break;
2107 case 19689: finalSpelId
= 19679; break;
2108 case 19692: finalSpelId
= 19680; break;
2109 case 19693: finalSpelId
= 19684; break;
2110 case 19694: finalSpelId
= 19681; break;
2111 case 19696: finalSpelId
= 19682; break;
2112 case 19697: finalSpelId
= 19683; break;
2113 case 19699: finalSpelId
= 19685; break;
2114 case 19700: finalSpelId
= 19686; break;
2115 case 30646: finalSpelId
= 30647; break;
2116 case 30653: finalSpelId
= 30648; break;
2117 case 30654: finalSpelId
= 30652; break;
2118 case 30099: finalSpelId
= 30100; break;
2119 case 30102: finalSpelId
= 30103; break;
2120 case 30105: finalSpelId
= 30104; break;
2124 caster
->CastSpell(m_target
,finalSpelId
,true,NULL
,this);
2130 case 2584: // Waiting to Resurrect
2132 // Waiting to resurrect spell cancel, we must remove player from resurrect queue
2133 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2134 if(BattleGround
*bg
= ((Player
*)m_target
)->GetBattleGround())
2135 bg
->RemovePlayerFromResurrectQueue(m_target
->GetGUID());
2138 case 45934: // Dark Fiend
2140 // Kill target if dispelled
2141 if (m_removeMode
==AURA_REMOVE_BY_DISPEL
)
2142 m_target
->DealDamage(m_target
, m_target
->GetHealth(), NULL
, DIRECT_DAMAGE
, SPELL_SCHOOL_MASK_NORMAL
, NULL
, false);
2145 case 46308: // Burning Winds
2147 // casted only at creatures at spawn
2148 m_target
->CastSpell(m_target
,47287,true,NULL
,this);
2153 if (caster
&& m_removeMode
== AURA_REMOVE_BY_DEATH
)
2155 // Stop caster Arcane Missle chanelling on death
2156 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_MAGE
&&
2157 m_spellProto
->SpellFamilyFlags
&0x0000000000000800LL
)
2159 caster
->InterruptSpell(CURRENT_CHANNELED_SPELL
);
2162 // Stop caster Penance chanelling on death
2163 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_PRIEST
&&
2164 m_spellProto
->SpellFamilyFlags2
& 0x00000080)
2166 caster
->InterruptSpell(CURRENT_CHANNELED_SPELL
);
2173 // AT APPLY & REMOVE
2175 switch(m_spellProto
->SpellFamilyName
)
2177 case SPELLFAMILY_GENERIC
:
2184 uint32 spellId
= 24659;
2185 if (apply
&& caster
)
2187 const SpellEntry
*spell
= sSpellStore
.LookupEntry(spellId
);
2191 for (int i
=0; i
< spell
->StackAmount
; ++i
)
2192 caster
->CastSpell(m_target
, spell
->Id
, true, NULL
, NULL
, GetCasterGUID());
2195 m_target
->RemoveAurasDueToSpell(spellId
);
2198 // Restless Strength
2201 uint32 spellId
= 24662;
2202 if (apply
&& caster
)
2204 const SpellEntry
*spell
= sSpellStore
.LookupEntry(spellId
);
2207 for (int i
=0; i
< spell
->StackAmount
; ++i
)
2208 caster
->CastSpell(m_target
, spell
->Id
, true, NULL
, NULL
, GetCasterGUID());
2211 m_target
->RemoveAurasDueToSpell(spellId
);
2214 //Summon Fire Elemental
2220 Unit
*owner
= caster
->GetOwner();
2221 if (owner
&& owner
->GetTypeId() == TYPEID_PLAYER
)
2224 owner
->CastSpell(owner
,8985,true);
2226 ((Player
*)owner
)->RemovePet(NULL
, PET_SAVE_NOT_IN_SLOT
, true);
2230 //Summon Earth Elemental
2236 Unit
*owner
= caster
->GetOwner();
2237 if (owner
&& owner
->GetTypeId() == TYPEID_PLAYER
)
2240 owner
->CastSpell(owner
,19704,true);
2242 ((Player
*)owner
)->RemovePet(NULL
, PET_SAVE_NOT_IN_SLOT
, true);
2248 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2252 m_target
->PlayDirectSound(14970, (Player
*)m_target
);
2253 // continue in 58205
2255 m_target
->CastSpell(m_target
, 58205, true);
2260 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2264 m_target
->PlayDirectSound(14971, (Player
*)m_target
);
2267 m_target
->PlayDirectSound(14972, (Player
*)m_target
);
2273 case SPELLFAMILY_MAGE
:
2277 case SPELLFAMILY_PRIEST
:
2279 // Pain and Suffering
2280 if( m_spellProto
->SpellIconID
== 2874 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2284 // Reduce backfire damage (dot damage) from Shadow Word: Death
2285 SpellModifier
*mod
= new SpellModifier
;
2286 mod
->op
= SPELLMOD_DOT
;
2287 mod
->value
= m_modifier
.m_amount
;
2288 mod
->type
= SPELLMOD_PCT
;
2289 mod
->spellId
= GetId();
2290 mod
->mask
= 0x0000200000000000LL
;
2294 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2299 case SPELLFAMILY_DRUID
:
2303 case 34246: // Idol of the Emerald Queen
2304 case 60779: // Idol of Lush Moss
2306 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
2311 SpellModifier
*mod
= new SpellModifier
;
2312 mod
->op
= SPELLMOD_DOT
;
2313 mod
->value
= m_modifier
.m_amount
/7;
2314 mod
->type
= SPELLMOD_FLAT
;
2315 mod
->spellId
= GetId();
2316 mod
->mask
= 0x001000000000LL
;
2322 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2325 case 61336: // Survival Instincts
2329 if (!m_target
->IsInFeralForm())
2332 int32 bp0
= int32(m_target
->GetMaxHealth() * m_modifier
.m_amount
/ 100);
2333 m_target
->CastCustomSpell(m_target
, 50322, &bp0
, NULL
, NULL
, true);
2336 m_target
-> RemoveAurasDueToSpell(50322);
2342 if ( GetSpellProto()->SpellFamilyFlags
& 0x1000000000LL
)
2347 // prevent double apply bonuses
2348 if(m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading())
2349 m_modifier
.m_amount
= caster
->SpellHealingBonus(m_target
, GetSpellProto(), m_modifier
.m_amount
, SPELL_DIRECT_DAMAGE
);
2353 // Final heal only on dispelled or duration end
2354 if ( !(GetAuraDuration() <= 0 || m_removeMode
==AURA_REMOVE_BY_DISPEL
) )
2357 // have a look if there is still some other Lifebloom dummy aura
2358 Unit::AuraList auras
= m_target
->GetAurasByType(SPELL_AURA_DUMMY
);
2359 for(Unit::AuraList::iterator itr
= auras
.begin(); itr
!=auras
.end(); ++itr
)
2360 if((*itr
)->GetSpellProto()->SpellFamilyName
== SPELLFAMILY_DRUID
&&
2361 (*itr
)->GetSpellProto()->SpellFamilyFlags
& 0x1000000000LL
)
2365 if(m_target
->IsInWorld() && m_stackAmount
> 0)
2367 int32 amount
= m_modifier
.m_amount
/ m_stackAmount
;
2368 m_target
->CastCustomSpell(m_target
,33778,&amount
,NULL
,NULL
,true,NULL
,this,GetCasterGUID());
2374 // Predatory Strikes
2375 if(m_target
->GetTypeId()==TYPEID_PLAYER
&& GetSpellProto()->SpellIconID
== 1563)
2377 ((Player
*)m_target
)->UpdateAttackPowerAndDamage();
2382 case SPELLFAMILY_HUNTER
:
2384 // Improved Aspect of the Viper
2385 if( GetId()==38390 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2389 // + effect value for Aspect of the Viper
2390 SpellModifier
*mod
= new SpellModifier
;
2391 mod
->op
= SPELLMOD_EFFECT1
;
2392 mod
->value
= m_modifier
.m_amount
;
2393 mod
->type
= SPELLMOD_FLAT
;
2394 mod
->spellId
= GetId();
2395 mod
->mask
= 0x4000000000000LL
;
2401 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2406 case SPELLFAMILY_SHAMAN
:
2408 // Improved Weapon Totems
2409 if( GetSpellProto()->SpellIconID
== 57 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2413 SpellModifier
*mod
= new SpellModifier
;
2414 mod
->op
= SPELLMOD_EFFECT1
;
2415 mod
->value
= m_modifier
.m_amount
;
2416 mod
->type
= SPELLMOD_PCT
;
2417 mod
->spellId
= GetId();
2421 mod
->mask
= 0x00200000000LL
; // Windfury Totem
2425 mod
->mask
= 0x00400000000LL
; // Flametongue Totem
2433 ((Player
*)m_target
)->AddSpellMod(m_spellmod
, apply
);
2441 if(PetAura
const* petSpell
= spellmgr
.GetPetAura(GetId()))
2444 m_target
->AddPetAura(petSpell
);
2446 m_target
->RemovePetAura(petSpell
);
2450 if(GetEffIndex()==0 && m_target
->GetTypeId()==TYPEID_PLAYER
)
2452 SpellAreaForAreaMapBounds saBounds
= spellmgr
.GetSpellAreaForAuraMapBounds(GetId());
2453 if(saBounds
.first
!= saBounds
.second
)
2456 m_target
->GetZoneAndAreaId(zone
,area
);
2458 for(SpellAreaForAreaMap::const_iterator itr
= saBounds
.first
; itr
!= saBounds
.second
; ++itr
)
2460 // some auras remove at aura remove
2461 if(!itr
->second
->IsFitToRequirements((Player
*)m_target
,zone
,area
))
2462 m_target
->RemoveAurasDueToSpell(itr
->second
->spellId
);
2463 // some auras applied at aura apply
2464 else if(itr
->second
->autocast
)
2466 if( !m_target
->HasAura(itr
->second
->spellId
,0) )
2467 m_target
->CastSpell(m_target
,itr
->second
->spellId
,true);
2474 void Aura::HandleAuraMounted(bool apply
, bool Real
)
2476 // only at real add/remove aura
2482 CreatureInfo
const* ci
= objmgr
.GetCreatureTemplate(m_modifier
.m_miscvalue
);
2485 sLog
.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier
.m_miscvalue
);
2490 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
2491 team
= ((Player
*)m_target
)->GetTeam();
2493 uint32 display_id
= objmgr
.ChooseDisplayId(team
,ci
);
2494 CreatureModelInfo
const *minfo
= objmgr
.GetCreatureModelRandomGender(display_id
);
2496 display_id
= minfo
->modelid
;
2498 m_target
->Mount(display_id
);
2502 m_target
->Unmount();
2506 void Aura::HandleAuraWaterWalk(bool apply
, bool Real
)
2508 // only at real add/remove aura
2514 data
.Initialize(SMSG_MOVE_WATER_WALK
, 8+4);
2516 data
.Initialize(SMSG_MOVE_LAND_WALK
, 8+4);
2517 data
.append(m_target
->GetPackGUID());
2519 m_target
->SendMessageToSet(&data
,true);
2522 void Aura::HandleAuraFeatherFall(bool apply
, bool Real
)
2524 // only at real add/remove aura
2530 data
.Initialize(SMSG_MOVE_FEATHER_FALL
, 8+4);
2532 data
.Initialize(SMSG_MOVE_NORMAL_FALL
, 8+4);
2533 data
.append(m_target
->GetPackGUID());
2535 m_target
->SendMessageToSet(&data
,true);
2538 void Aura::HandleAuraHover(bool apply
, bool Real
)
2540 // only at real add/remove aura
2546 data
.Initialize(SMSG_MOVE_SET_HOVER
, 8+4);
2548 data
.Initialize(SMSG_MOVE_UNSET_HOVER
, 8+4);
2549 data
.append(m_target
->GetPackGUID());
2551 m_target
->SendMessageToSet(&data
,true);
2554 void Aura::HandleWaterBreathing(bool /*apply*/, bool /*Real*/)
2556 // update timers in client
2557 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
2558 ((Player
*)m_target
)->UpdateMirrorTimers();
2561 void Aura::HandleAuraModShapeshift(bool apply
, bool Real
)
2567 Powers PowerType
= POWER_MANA
;
2568 ShapeshiftForm form
= ShapeshiftForm(m_modifier
.m_miscvalue
);
2572 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2576 PowerType
= POWER_ENERGY
;
2582 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2588 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2592 PowerType
= POWER_RAGE
;
2595 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2599 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2603 PowerType
= POWER_RAGE
;
2605 case FORM_CREATUREBEAR
:
2608 case FORM_GHOSTWOLF
:
2612 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2618 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2623 case FORM_FLIGHT_EPIC
:
2624 if(Player::TeamForRace(m_target
->getRace())==ALLIANCE
)
2629 case FORM_METAMORPHOSIS
:
2639 case FORM_BATTLESTANCE
:
2640 case FORM_BERSERKERSTANCE
:
2641 case FORM_DEFENSIVESTANCE
:
2642 PowerType
= POWER_RAGE
;
2644 case FORM_SPIRITOFREDEMPTION
:
2648 sLog
.outError("Auras: Unknown Shapeshift Type: %u", m_modifier
.m_miscvalue
);
2651 // remove polymorph before changing display id to keep new display id
2660 case FORM_FLIGHT_EPIC
:
2663 // remove movement affects
2664 m_target
->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT
);
2665 m_target
->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED
);
2667 // and polymorphic affects
2668 if(m_target
->IsPolymorphed())
2669 m_target
->RemoveAurasDueToSpell(m_target
->getTransForm());
2677 // remove other shapeshift before applying a new one
2678 if(m_target
->m_ShapeShiftFormSpellId
)
2679 m_target
->RemoveAurasDueToSpell(m_target
->m_ShapeShiftFormSpellId
,this);
2681 m_target
->SetByteValue(UNIT_FIELD_BYTES_2
, 3, form
);
2684 m_target
->SetDisplayId(modelid
);
2686 if(PowerType
!= POWER_MANA
)
2688 // reset power to default values only at power change
2689 if(m_target
->getPowerType()!=PowerType
)
2690 m_target
->setPowerType(PowerType
);
2698 // get furor proc chance
2699 uint32 FurorChance
= 0;
2700 Unit::AuraList
const& mDummy
= m_target
->GetAurasByType(SPELL_AURA_DUMMY
);
2701 for(Unit::AuraList::const_iterator i
= mDummy
.begin(); i
!= mDummy
.end(); ++i
)
2703 if ((*i
)->GetSpellProto()->SpellIconID
== 238)
2705 FurorChance
= (*i
)->GetModifier()->m_amount
;
2710 if (m_modifier
.m_miscvalue
== FORM_CAT
)
2712 m_target
->SetPower(POWER_ENERGY
,0);
2713 if(urand(1,100) <= FurorChance
)
2714 m_target
->CastSpell(m_target
,17099,true,NULL
,this);
2718 m_target
->SetPower(POWER_RAGE
,0);
2719 if(urand(1,100) <= FurorChance
)
2720 m_target
->CastSpell(m_target
,17057,true,NULL
,this);
2724 case FORM_BATTLESTANCE
:
2725 case FORM_DEFENSIVESTANCE
:
2726 case FORM_BERSERKERSTANCE
:
2728 uint32 Rage_val
= 0;
2729 // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch)
2730 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
2732 PlayerSpellMap
const& sp_list
= ((Player
*)m_target
)->GetSpellMap();
2733 for (PlayerSpellMap::const_iterator itr
= sp_list
.begin(); itr
!= sp_list
.end(); ++itr
)
2735 if(itr
->second
->state
== PLAYERSPELL_REMOVED
) continue;
2736 SpellEntry
const *spellInfo
= sSpellStore
.LookupEntry(itr
->first
);
2737 if (spellInfo
&& spellInfo
->SpellFamilyName
== SPELLFAMILY_WARRIOR
&& spellInfo
->SpellIconID
== 139)
2738 Rage_val
+= m_target
->CalculateSpellDamage(spellInfo
,0,spellInfo
->EffectBasePoints
[0],m_target
) * 10;
2742 if (m_target
->GetPower(POWER_RAGE
) > Rage_val
)
2743 m_target
->SetPower(POWER_RAGE
,Rage_val
);
2751 m_target
->m_ShapeShiftFormSpellId
= GetId();
2752 m_target
->m_form
= form
;
2757 m_target
->SetDisplayId(m_target
->GetNativeDisplayId());
2758 m_target
->SetByteValue(UNIT_FIELD_BYTES_2
, 3, FORM_NONE
);
2759 if(m_target
->getClass() == CLASS_DRUID
)
2760 m_target
->setPowerType(POWER_MANA
);
2761 m_target
->m_ShapeShiftFormSpellId
= 0;
2762 m_target
->m_form
= FORM_NONE
;
2766 // Nordrassil Harness - bonus
2770 if(Aura
* dummy
= m_target
->GetDummyAura(37315) )
2771 m_target
->CastSpell(m_target
,37316,true,NULL
,dummy
);
2773 // Nordrassil Regalia - bonus
2775 if(Aura
* dummy
= m_target
->GetDummyAura(37324) )
2776 m_target
->CastSpell(m_target
,37325,true,NULL
,dummy
);
2783 // adding/removing linked auras
2784 // add/remove the shapeshift aura's boosts
2785 HandleShapeshiftBoosts(apply
);
2787 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
2788 ((Player
*)m_target
)->InitDataForForm();
2791 void Aura::HandleAuraTransform(bool apply
, bool Real
)
2795 // special case (spell specific functionality)
2796 if (m_modifier
.m_miscvalue
==0)
2798 // player applied only
2799 if (m_target
->GetTypeId()!=TYPEID_PLAYER
)
2807 uint32 orb_model
= m_target
->GetNativeDisplayId();
2811 case 1479: m_target
->SetDisplayId(10134); break;
2813 case 1478: m_target
->SetDisplayId(10135); break;
2815 case 59: m_target
->SetDisplayId(10136); break;
2817 case 49: m_target
->SetDisplayId(10137); break;
2819 case 50: m_target
->SetDisplayId(10138); break;
2821 case 51: m_target
->SetDisplayId(10139); break;
2823 case 52: m_target
->SetDisplayId(10140); break;
2825 case 53: m_target
->SetDisplayId(10141); break;
2827 case 54: m_target
->SetDisplayId(10142); break;
2829 case 55: m_target
->SetDisplayId(10143); break;
2831 case 56: m_target
->SetDisplayId(10144); break;
2833 case 58: m_target
->SetDisplayId(10145); break;
2835 case 57: m_target
->SetDisplayId(10146); break;
2837 case 60: m_target
->SetDisplayId(10147); break;
2839 case 1563: m_target
->SetDisplayId(10148); break;
2841 case 1564: m_target
->SetDisplayId(10149); break;
2843 case 15475: m_target
->SetDisplayId(17830); break;
2845 case 15476: m_target
->SetDisplayId(17829); break;
2847 case 16126: m_target
->SetDisplayId(17828); break;
2849 case 16125: m_target
->SetDisplayId(17827); break;
2855 case 42365: m_target
->SetDisplayId(21723); break;
2861 CreatureInfo
const * ci
= objmgr
.GetCreatureTemplate(m_modifier
.m_miscvalue
);
2865 m_target
->SetDisplayId(16358);
2866 sLog
.outError("Auras: unknown creature id = %d (only need its modelid) Form Spell Aura Transform in Spell ID = %d", m_modifier
.m_miscvalue
, GetId());
2870 // Will use the default model here
2871 m_target
->SetDisplayId(ci
->DisplayID_A
);
2873 // Dragonmaw Illusion (set mount model also)
2874 if(GetId()==42016 && m_target
->GetMountID() && !m_target
->GetAurasByType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
).empty())
2875 m_target
->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
,16314);
2879 // update active transform spell only not set or not overwriting negative by positive case
2880 if (!m_target
->getTransForm() || !IsPositiveSpell(GetId()) || IsPositiveSpell(m_target
->getTransForm()))
2881 m_target
->setTransForm(GetId());
2884 if (Real
&& m_target
->GetTypeId() == TYPEID_PLAYER
&& m_target
->IsPolymorphed())
2886 // for players, start regeneration after 1s (in polymorph fast regeneration case)
2887 // only if caster is Player (after patch 2.4.2)
2888 if (IS_PLAYER_GUID(GetCasterGUID()) )
2889 ((Player
*)m_target
)->setRegenTimer(1*IN_MILISECONDS
);
2891 //dismount polymorphed target (after patch 2.4.2)
2892 if (m_target
->IsMounted())
2893 m_target
->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED
);
2898 // ApplyModifier(true) will reapply it if need
2899 m_target
->setTransForm(0);
2900 m_target
->SetDisplayId(m_target
->GetNativeDisplayId());
2902 // re-aplly some from still active with preference negative cases
2903 Unit::AuraList
const& otherTransforms
= m_target
->GetAurasByType(SPELL_AURA_TRANSFORM
);
2904 if (!otherTransforms
.empty())
2906 // look for other transform auras
2907 Aura
* handledAura
= *otherTransforms
.begin();
2908 for(Unit::AuraList::const_iterator i
= otherTransforms
.begin();i
!= otherTransforms
.end(); ++i
)
2910 // negative auras are preferred
2911 if (!IsPositiveSpell((*i
)->GetSpellProto()->Id
))
2917 handledAura
->ApplyModifier(true);
2920 // Dragonmaw Illusion (restore mount model)
2921 if (GetId()==42016 && m_target
->GetMountID()==16314)
2923 if (!m_target
->GetAurasByType(SPELL_AURA_MOUNTED
).empty())
2925 uint32 cr_id
= m_target
->GetAurasByType(SPELL_AURA_MOUNTED
).front()->GetModifier()->m_miscvalue
;
2926 if (CreatureInfo
const* ci
= objmgr
.GetCreatureTemplate(cr_id
))
2929 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
2930 team
= ((Player
*)m_target
)->GetTeam();
2932 uint32 display_id
= objmgr
.ChooseDisplayId(team
,ci
);
2933 CreatureModelInfo
const *minfo
= objmgr
.GetCreatureModelRandomGender(display_id
);
2935 display_id
= minfo
->modelid
;
2937 m_target
->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
,display_id
);
2944 void Aura::HandleForceReaction(bool apply
, bool Real
)
2946 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
2952 Player
* player
= (Player
*)m_target
;
2954 uint32 faction_id
= m_modifier
.m_miscvalue
;
2955 uint32 faction_rank
= m_modifier
.m_amount
;
2957 player
->GetReputationMgr().ApplyForceReaction(faction_id
,ReputationRank(faction_rank
),apply
);
2958 player
->GetReputationMgr().SendForceReactions();
2961 void Aura::HandleAuraModSkill(bool apply
, bool /*Real*/)
2963 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
2966 uint32 prot
=GetSpellProto()->EffectMiscValue
[m_effIndex
];
2967 int32 points
= GetModifier()->m_amount
;
2969 ((Player
*)m_target
)->ModifySkillBonus(prot
,(apply
? points
: -points
),m_modifier
.m_auraname
==SPELL_AURA_MOD_SKILL_TALENT
);
2970 if(prot
== SKILL_DEFENSE
)
2971 ((Player
*)m_target
)->UpdateDefenseBonusesMod();
2974 void Aura::HandleChannelDeathItem(bool apply
, bool Real
)
2978 Unit
* caster
= GetCaster();
2979 Unit
* victim
= GetTarget();
2980 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
|| !victim
|| m_removeMode
!=AURA_REMOVE_BY_DEATH
)
2983 if (m_modifier
.m_amount
<= 0)
2986 SpellEntry
const *spellInfo
= GetSpellProto();
2987 if(spellInfo
->EffectItemType
[m_effIndex
] == 0)
2990 // Soul Shard only from non-grey units
2991 if( spellInfo
->EffectItemType
[m_effIndex
] == 6265 &&
2992 (victim
->getLevel() <= MaNGOS::XP::GetGrayLevel(caster
->getLevel()) ||
2993 victim
->GetTypeId()==TYPEID_UNIT
&& !((Player
*)caster
)->isAllowedToLoot((Creature
*)victim
)) )
2996 uint32 noSpaceForCount
= 0;
2997 uint32 count
= m_modifier
.m_amount
;
2999 ItemPosCountVec dest
;
3000 uint8 msg
= ((Player
*)caster
)->CanStoreNewItem( NULL_BAG
, NULL_SLOT
, dest
, spellInfo
->EffectItemType
[m_effIndex
], count
, &noSpaceForCount
);
3001 if( msg
!= EQUIP_ERR_OK
)
3003 count
-=noSpaceForCount
;
3004 ((Player
*)caster
)->SendEquipError( msg
, NULL
, NULL
);
3009 Item
* newitem
= ((Player
*)caster
)->StoreNewItem(dest
, spellInfo
->EffectItemType
[m_effIndex
], true);
3010 ((Player
*)caster
)->SendNewItem(newitem
, count
, true, false);
3014 void Aura::HandleBindSight(bool apply
, bool /*Real*/)
3016 Unit
* caster
= GetCaster();
3017 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
)
3020 ((Player
*)caster
)->SetFarSightGUID(apply
? m_target
->GetGUID() : 0);
3023 void Aura::HandleFarSight(bool apply
, bool /*Real*/)
3025 Unit
* caster
= GetCaster();
3026 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
)
3029 ((Player
*)caster
)->SetFarSightGUID(apply
? m_target
->GetGUID() : 0);
3032 void Aura::HandleAuraTrackCreatures(bool apply
, bool /*Real*/)
3034 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
3038 m_target
->RemoveNoStackAurasDueToAura(this);
3039 m_target
->SetUInt32Value(PLAYER_TRACK_CREATURES
, apply
? ((uint32
)1)<<(m_modifier
.m_miscvalue
-1) : 0 );
3042 void Aura::HandleAuraTrackResources(bool apply
, bool /*Real*/)
3044 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
3048 m_target
->RemoveNoStackAurasDueToAura(this);
3049 m_target
->SetUInt32Value(PLAYER_TRACK_RESOURCES
, apply
? ((uint32
)1)<<(m_modifier
.m_miscvalue
-1): 0 );
3052 void Aura::HandleAuraTrackStealthed(bool apply
, bool /*Real*/)
3054 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
3058 m_target
->RemoveNoStackAurasDueToAura(this);
3060 m_target
->ApplyModFlag(PLAYER_FIELD_BYTES
,PLAYER_FIELD_BYTE_TRACK_STEALTHED
,apply
);
3063 void Aura::HandleAuraModScale(bool apply
, bool /*Real*/)
3065 m_target
->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X
,m_modifier
.m_amount
,apply
);
3068 void Aura::HandleModPossess(bool apply
, bool Real
)
3073 if(m_target
->getLevel() > m_modifier
.m_amount
)
3076 // not possess yourself
3077 if(GetCasterGUID() == m_target
->GetGUID())
3080 Unit
* caster
= GetCaster();
3086 m_target
->SetCharmerGUID(GetCasterGUID());
3087 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,caster
->getFaction());
3089 caster
->SetCharm(m_target
);
3091 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3093 ((Player
*)caster
)->SetFarSightGUID(m_target
->GetGUID());
3094 ((Player
*)caster
)->SetClientControl(m_target
, 1);
3097 m_target
->CombatStop();
3098 m_target
->DeleteThreatList();
3099 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3101 m_target
->StopMoving();
3102 m_target
->GetMotionMaster()->Clear();
3103 m_target
->GetMotionMaster()->MoveIdle();
3105 else if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3107 ((Player
*)m_target
)->SetClientControl(m_target
, 0);
3110 if(CharmInfo
*charmInfo
= m_target
->InitCharmInfo(m_target
))
3111 charmInfo
->InitPossessCreateSpells();
3113 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3114 ((Player
*)caster
)->PossessSpellInitialize();
3118 m_target
->SetCharmerGUID(0);
3119 caster
->InterruptSpell(CURRENT_CHANNELED_SPELL
); // the spell is not automatically canceled when interrupted, do it now
3121 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3123 ((Player
*)m_target
)->setFactionForRace(m_target
->getRace());
3124 ((Player
*)m_target
)->SetClientControl(m_target
, 1);
3126 else if(m_target
->GetTypeId() == TYPEID_UNIT
)
3128 CreatureInfo
const *cinfo
= ((Creature
*)m_target
)->GetCreatureInfo();
3129 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,cinfo
->faction_A
);
3132 caster
->SetCharm(NULL
);
3134 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3136 ((Player
*)caster
)->SetFarSightGUID(0);
3137 ((Player
*)caster
)->SetClientControl(m_target
,0);
3139 WorldPacket
data(SMSG_PET_SPELLS
, 8+4);
3142 ((Player
*)caster
)->GetSession()->SendPacket(&data
);
3145 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3147 ((Creature
*)m_target
)->AIM_Initialize();
3149 if (((Creature
*)m_target
)->AI())
3150 ((Creature
*)m_target
)->AI()->AttackedBy(caster
);
3155 void Aura::HandleModPossessPet(bool apply
, bool Real
)
3160 Unit
* caster
= GetCaster();
3161 if(!caster
|| caster
->GetTypeId() != TYPEID_PLAYER
)
3164 Pet
*pet
= caster
->GetPet();
3165 if(!pet
|| pet
!= m_target
)
3169 pet
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_24
);
3171 pet
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_24
);
3173 ((Player
*)caster
)->SetFarSightGUID(apply
? pet
->GetGUID() : 0);
3174 ((Player
*)caster
)->SetCharm(apply
? pet
: NULL
);
3175 ((Player
*)caster
)->SetClientControl(pet
, apply
? 1 : 0);
3180 pet
->GetMotionMaster()->Clear();
3181 pet
->GetMotionMaster()->MoveIdle();
3186 pet
->GetMotionMaster()->MoveFollow(caster
, PET_FOLLOW_DIST
, PET_FOLLOW_ANGLE
);
3187 pet
->SetUnitMovementFlags(MOVEMENTFLAG_NONE
);
3191 void Aura::HandleAuraModPetTalentsPoints(bool /*Apply*/, bool Real
)
3196 // Recalculate pet tlaent points
3197 if (Pet
*pet
=m_target
->GetPet())
3198 pet
->InitTalentForLevel();
3201 void Aura::HandleModCharm(bool apply
, bool Real
)
3206 // not charm yourself
3207 if(GetCasterGUID() == m_target
->GetGUID())
3210 Unit
* caster
= GetCaster();
3214 if(int32(m_target
->getLevel()) <= m_modifier
.m_amount
)
3218 m_target
->SetCharmerGUID(GetCasterGUID());
3219 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,caster
->getFaction());
3220 m_target
->CastStop(m_target
==caster
? GetId() : 0);
3221 caster
->SetCharm(m_target
);
3223 m_target
->CombatStop();
3224 m_target
->DeleteThreatList();
3226 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3228 ((Creature
*)m_target
)->AIM_Initialize();
3229 CharmInfo
*charmInfo
= m_target
->InitCharmInfo(m_target
);
3230 charmInfo
->InitCharmCreateSpells();
3231 charmInfo
->SetReactState( REACT_DEFENSIVE
);
3233 if(caster
->GetTypeId() == TYPEID_PLAYER
&& caster
->getClass() == CLASS_WARLOCK
)
3235 CreatureInfo
const *cinfo
= ((Creature
*)m_target
)->GetCreatureInfo();
3236 if(cinfo
&& cinfo
->type
== CREATURE_TYPE_DEMON
)
3238 //to prevent client crash
3239 m_target
->SetFlag(UNIT_FIELD_BYTES_0
, 2048);
3240 //just to enable stat window
3241 charmInfo
->SetPetNumber(objmgr
.GeneratePetNumber(), true);
3242 //if charmed two demons the same session, the 2nd gets the 1st one's name
3243 m_target
->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP
, time(NULL
));
3248 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3250 ((Player
*)caster
)->CharmSpellInitialize();
3255 m_target
->SetCharmerGUID(0);
3257 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3258 ((Player
*)m_target
)->setFactionForRace(m_target
->getRace());
3261 CreatureInfo
const *cinfo
= ((Creature
*)m_target
)->GetCreatureInfo();
3264 if(((Creature
*)m_target
)->isPet())
3266 if(Unit
* owner
= m_target
->GetOwner())
3267 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,owner
->getFaction());
3269 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,cinfo
->faction_A
);
3271 else if(cinfo
) // normal creature
3272 m_target
->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
,cinfo
->faction_A
);
3274 // restore UNIT_FIELD_BYTES_0
3275 if(cinfo
&& caster
->GetTypeId() == TYPEID_PLAYER
&& caster
->getClass() == CLASS_WARLOCK
&& cinfo
->type
== CREATURE_TYPE_DEMON
)
3277 CreatureDataAddon
const *cainfo
= ((Creature
*)m_target
)->GetCreatureAddon();
3278 if(cainfo
&& cainfo
->bytes0
!= 0)
3279 m_target
->SetUInt32Value(UNIT_FIELD_BYTES_0
, cainfo
->bytes0
);
3281 m_target
->RemoveFlag(UNIT_FIELD_BYTES_0
, 2048);
3283 if(m_target
->GetCharmInfo())
3284 m_target
->GetCharmInfo()->SetPetNumber(0, true);
3286 sLog
.outError("Aura::HandleModCharm: target="I64FMTD
" with typeid=%d has a charm aura but no charm info!", m_target
->GetGUID(), m_target
->GetTypeId());
3290 caster
->SetCharm(NULL
);
3292 if(caster
->GetTypeId() == TYPEID_PLAYER
)
3294 WorldPacket
data(SMSG_PET_SPELLS
, 8+4);
3297 ((Player
*)caster
)->GetSession()->SendPacket(&data
);
3299 if(m_target
->GetTypeId() == TYPEID_UNIT
)
3301 ((Creature
*)m_target
)->AIM_Initialize();
3302 if (((Creature
*)m_target
)->AI())
3303 ((Creature
*)m_target
)->AI()->AttackedBy(caster
);
3309 void Aura::HandleModConfuse(bool apply
, bool Real
)
3314 m_target
->SetConfused(apply
, GetCasterGUID(), GetId());
3317 void Aura::HandleModFear(bool apply
, bool Real
)
3322 m_target
->SetFeared(apply
, GetCasterGUID(), GetId());
3325 void Aura::HandleFeignDeath(bool apply
, bool Real
)
3330 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
3336 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3337 data<<m_target->GetGUID();
3339 m_target->SendMessageToSet(&data,true);
3342 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_29
);
3344 m_target
->SetFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FEIGN_DEATH
);
3346 m_target
->SetFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_DEAD
);
3348 m_target
->addUnitState(UNIT_STAT_DIED
);
3349 m_target
->CombatStop();
3350 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
3352 // prevent interrupt message
3353 if(m_caster_guid
==m_target
->GetGUID() && m_target
->m_currentSpells
[CURRENT_GENERIC_SPELL
])
3354 m_target
->m_currentSpells
[CURRENT_GENERIC_SPELL
]->finish();
3355 m_target
->InterruptNonMeleeSpells(true);
3356 m_target
->getHostilRefManager().deleteReferences();
3361 WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9);
3362 data<<m_target->GetGUID();
3364 m_target->SendMessageToSet(&data,true);
3367 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_UNK_29
);
3369 m_target
->RemoveFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FEIGN_DEATH
);
3371 m_target
->RemoveFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_DEAD
);
3373 m_target
->clearUnitState(UNIT_STAT_DIED
);
3377 void Aura::HandleAuraModDisarm(bool apply
, bool Real
)
3382 if(!apply
&& m_target
->HasAuraType(SPELL_AURA_MOD_DISARM
))
3385 // not sure for it's correctness
3387 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_DISARMED
);
3389 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_DISARMED
);
3391 // only at real add/remove aura
3392 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
3395 // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove.
3396 if (m_target
->IsInFeralForm())
3400 m_target
->SetAttackTime(BASE_ATTACK
,BASE_ATTACK_TIME
);
3402 ((Player
*)m_target
)->SetRegularAttackTime();
3404 m_target
->UpdateDamagePhysical(BASE_ATTACK
);
3407 void Aura::HandleAuraModStun(bool apply
, bool Real
)
3414 // Frost stun aura -> freeze/unfreeze target
3415 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3416 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3418 m_target
->addUnitState(UNIT_STAT_STUNNED
);
3419 m_target
->SetUInt64Value(UNIT_FIELD_TARGET
, 0);
3421 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_STUNNED
);
3422 m_target
->CastStop(m_target
->GetGUID() == GetCasterGUID() ? GetId() : 0);
3424 // Creature specific
3425 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
3426 ((Creature
*)m_target
)->StopMoving();
3428 m_target
->SetUnitMovementFlags(0); //Clear movement flags
3430 WorldPacket
data(SMSG_FORCE_MOVE_ROOT
, 8);
3432 data
.append(m_target
->GetPackGUID());
3434 m_target
->SendMessageToSet(&data
,true);
3436 // Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine
3437 if(GetId() == 39837)
3439 GameObject
* pObj
= new GameObject
;
3440 if(pObj
->Create(objmgr
.GenerateLowGuid(HIGHGUID_GAMEOBJECT
), 185584, m_target
->GetMap(), m_target
->GetPhaseMask(),
3441 m_target
->GetPositionX(), m_target
->GetPositionY(), m_target
->GetPositionZ(), m_target
->GetOrientation(), 0.0f
, 0.0f
, 0.0f
, 0.0f
, 100, GO_STATE_READY
))
3443 pObj
->SetRespawnTime(GetAuraDuration()/IN_MILISECONDS
);
3444 pObj
->SetSpellId(GetId());
3445 m_target
->AddGameObject(pObj
);
3446 m_target
->GetMap()->Add(pObj
);
3454 // Frost stun aura -> freeze/unfreeze target
3455 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3457 bool found_another
= false;
3458 for(AuraType
const* itr
= &frozenAuraTypes
[0]; *itr
!= SPELL_AURA_NONE
; ++itr
)
3460 Unit::AuraList
const& auras
= m_target
->GetAurasByType(*itr
);
3461 for(Unit::AuraList::const_iterator i
= auras
.begin(); i
!= auras
.end(); ++i
)
3463 if( GetSpellSchoolMask((*i
)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST
)
3465 found_another
= true;
3474 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3477 // Real remove called after current aura remove from lists, check if other similar auras active
3478 if(m_target
->HasAuraType(SPELL_AURA_MOD_STUN
))
3481 m_target
->clearUnitState(UNIT_STAT_STUNNED
);
3482 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_STUNNED
);
3484 if(!m_target
->hasUnitState(UNIT_STAT_ROOT
)) // prevent allow move if have also root effect
3486 if(m_target
->getVictim() && m_target
->isAlive())
3487 m_target
->SetUInt64Value(UNIT_FIELD_TARGET
,m_target
->getVictim()->GetGUID() );
3489 WorldPacket
data(SMSG_FORCE_MOVE_UNROOT
, 8+4);
3490 data
.append(m_target
->GetPackGUID());
3492 m_target
->SendMessageToSet(&data
,true);
3496 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_HUNTER
&& m_spellProto
->SpellFamilyFlags
& 0x0000100000000000LL
)
3498 Unit
* caster
= GetCaster();
3499 if( !caster
|| caster
->GetTypeId()!=TYPEID_PLAYER
)
3502 uint32 spell_id
= 0;
3506 case 19386: spell_id
= 24131; break;
3507 case 24132: spell_id
= 24134; break;
3508 case 24133: spell_id
= 24135; break;
3509 case 27068: spell_id
= 27069; break;
3510 case 49011: spell_id
= 49009; break;
3511 case 49012: spell_id
= 49010; break;
3513 sLog
.outError("Spell selection called for unexpected original spell %u, new spell for this spell family?",GetId());
3517 SpellEntry
const* spellInfo
= sSpellStore
.LookupEntry(spell_id
);
3522 caster
->CastSpell(m_target
,spellInfo
,true,NULL
,this);
3528 void Aura::HandleModStealth(bool apply
, bool Real
)
3530 Unit
* pTarget
= m_target
;
3531 SpellEntry
const* pSpellInfo
= GetSpellProto();
3535 // drop flag at stealth in bg
3536 pTarget
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
3538 // only at real aura add
3541 pTarget
->SetStandFlags(UNIT_STAND_FLAGS_CREEP
);
3543 if (pTarget
->GetTypeId()==TYPEID_PLAYER
)
3544 pTarget
->SetFlag(PLAYER_FIELD_BYTES2
, 0x2000);
3546 // apply only if not in GM invisibility (and overwrite invisibility state)
3547 if (pTarget
->GetVisibility()!=VISIBILITY_OFF
)
3549 pTarget
->SetVisibility(VISIBILITY_GROUP_NO_DETECT
);
3550 pTarget
->SetVisibility(VISIBILITY_GROUP_STEALTH
);
3553 // apply full stealth period bonuses only at first stealth aura in stack
3554 if(pTarget
->GetAurasByType(SPELL_AURA_MOD_STEALTH
).size()<=1)
3556 Unit::AuraList
const& mDummyAuras
= pTarget
->GetAurasByType(SPELL_AURA_DUMMY
);
3557 for(Unit::AuraList::const_iterator i
= mDummyAuras
.begin();i
!= mDummyAuras
.end(); ++i
)
3559 // Master of Subtlety
3560 if ((*i
)->GetSpellProto()->SpellIconID
== 2114)
3562 pTarget
->RemoveAurasDueToSpell(31666);
3563 int32 bp
= (*i
)->GetModifier()->m_amount
;
3564 pTarget
->CastCustomSpell(pTarget
,31665,&bp
,NULL
,NULL
,true);
3567 else if ((*i
)->GetId() == 58426 && pSpellInfo
->SpellFamilyFlags
& 0x0000000000400000LL
)
3569 pTarget
->RemoveAurasDueToSpell(58428);
3570 pTarget
->CastSpell(pTarget
, 58427, true);
3578 // only at real aura remove of _last_ SPELL_AURA_MOD_STEALTH
3579 if (Real
&& !pTarget
->HasAuraType(SPELL_AURA_MOD_STEALTH
))
3581 // if no GM invisibility
3582 if(pTarget
->GetVisibility()!=VISIBILITY_OFF
)
3584 pTarget
->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP
);
3586 if (pTarget
->GetTypeId()==TYPEID_PLAYER
)
3587 pTarget
->RemoveFlag(PLAYER_FIELD_BYTES2
, 0x2000);
3589 // restore invisibility if any
3590 if (pTarget
->HasAuraType(SPELL_AURA_MOD_INVISIBILITY
))
3592 pTarget
->SetVisibility(VISIBILITY_GROUP_NO_DETECT
);
3593 pTarget
->SetVisibility(VISIBILITY_GROUP_INVISIBILITY
);
3596 pTarget
->SetVisibility(VISIBILITY_ON
);
3599 // apply delayed talent bonus remover at last stealth aura remove
3600 Unit::AuraList
const& mDummyAuras
= pTarget
->GetAurasByType(SPELL_AURA_DUMMY
);
3601 for(Unit::AuraList::const_iterator i
= mDummyAuras
.begin();i
!= mDummyAuras
.end(); ++i
)
3603 // Master of Subtlety
3604 if ((*i
)->GetSpellProto()->SpellIconID
== 2114)
3605 pTarget
->CastSpell(pTarget
,31666,true);
3607 else if ((*i
)->GetId() == 58426 && pSpellInfo
->SpellFamilyFlags
& 0x0000000000400000LL
)
3608 pTarget
->CastSpell(pTarget
, 58428, true);
3614 void Aura::HandleInvisibility(bool apply
, bool Real
)
3618 m_target
->m_invisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3620 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
3622 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
3624 // apply glow vision
3625 m_target
->SetFlag(PLAYER_FIELD_BYTES2
,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
);
3629 // apply only if not in GM invisibility and not stealth
3630 if(m_target
->GetVisibility()==VISIBILITY_ON
)
3632 // Aura not added yet but visibility code expect temporary add aura
3633 m_target
->SetVisibility(VISIBILITY_GROUP_NO_DETECT
);
3634 m_target
->SetVisibility(VISIBILITY_GROUP_INVISIBILITY
);
3639 // recalculate value at modifier remove (current aura already removed)
3640 m_target
->m_invisibilityMask
= 0;
3641 Unit::AuraList
const& auras
= m_target
->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY
);
3642 for(Unit::AuraList::const_iterator itr
= auras
.begin(); itr
!= auras
.end(); ++itr
)
3643 m_target
->m_invisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3645 // only at real aura remove and if not have different invisibility auras.
3646 if(Real
&& m_target
->m_invisibilityMask
==0)
3648 // remove glow vision
3649 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3650 m_target
->RemoveFlag(PLAYER_FIELD_BYTES2
,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW
);
3652 // apply only if not in GM invisibility & not stealthed while invisible
3653 if(m_target
->GetVisibility()!=VISIBILITY_OFF
)
3655 // if have stealth aura then already have stealth visibility
3656 if(!m_target
->HasAuraType(SPELL_AURA_MOD_STEALTH
))
3657 m_target
->SetVisibility(VISIBILITY_ON
);
3663 void Aura::HandleInvisibilityDetect(bool apply
, bool Real
)
3667 m_target
->m_detectInvisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3671 // recalculate value at modifier remove (current aura already removed)
3672 m_target
->m_detectInvisibilityMask
= 0;
3673 Unit::AuraList
const& auras
= m_target
->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION
);
3674 for(Unit::AuraList::const_iterator itr
= auras
.begin(); itr
!= auras
.end(); ++itr
)
3675 m_target
->m_detectInvisibilityMask
|= (1 << m_modifier
.m_miscvalue
);
3677 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
3678 ObjectAccessor::UpdateVisibilityForPlayer((Player
*)m_target
);
3681 void Aura::HandleAuraModRoot(bool apply
, bool Real
)
3683 // only at real add/remove aura
3689 // Frost root aura -> freeze/unfreeze target
3690 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3691 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3693 m_target
->addUnitState(UNIT_STAT_ROOT
);
3694 m_target
->SetUInt64Value (UNIT_FIELD_TARGET
, 0);
3695 // probably wrong (this add skinable flag)
3696 // TODO: find correct flag
3697 // m_target->SetFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));
3699 //Save last orientation
3700 if( m_target
->getVictim() )
3701 m_target
->SetOrientation(m_target
->GetAngle(m_target
->getVictim()));
3703 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3705 WorldPacket
data(SMSG_FORCE_MOVE_ROOT
, 10);
3706 data
.append(m_target
->GetPackGUID());
3708 m_target
->SendMessageToSet(&data
,true);
3710 //Clear unit movement flags
3711 m_target
->SetUnitMovementFlags(0);
3714 ((Creature
*)m_target
)->StopMoving();
3718 // Frost root aura -> freeze/unfreeze target
3719 if (GetSpellSchoolMask(m_spellProto
) & SPELL_SCHOOL_MASK_FROST
)
3721 bool found_another
= false;
3722 for(AuraType
const* itr
= &frozenAuraTypes
[0]; *itr
!= SPELL_AURA_NONE
; ++itr
)
3724 Unit::AuraList
const& auras
= m_target
->GetAurasByType(*itr
);
3725 for(Unit::AuraList::const_iterator i
= auras
.begin(); i
!= auras
.end(); ++i
)
3727 if( GetSpellSchoolMask((*i
)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST
)
3729 found_another
= true;
3738 m_target
->ModifyAuraState(AURA_STATE_FROZEN
, apply
);
3741 // Real remove called after current aura remove from lists, check if other similar auras active
3742 if(m_target
->HasAuraType(SPELL_AURA_MOD_ROOT
))
3745 m_target
->clearUnitState(UNIT_STAT_ROOT
);
3746 // probably wrong (this add skinable flag)
3747 // TODO: find correct flag
3748 // m_target->RemoveFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));
3750 if(!m_target
->hasUnitState(UNIT_STAT_STUNNED
)) // prevent allow move if have also stun effect
3752 if(m_target
->getVictim() && m_target
->isAlive())
3753 m_target
->SetUInt64Value (UNIT_FIELD_TARGET
,m_target
->getVictim()->GetGUID() );
3755 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3757 WorldPacket
data(SMSG_FORCE_MOVE_UNROOT
, 10);
3758 data
.append(m_target
->GetPackGUID());
3760 m_target
->SendMessageToSet(&data
,true);
3766 void Aura::HandleAuraModSilence(bool apply
, bool Real
)
3768 // only at real add/remove aura
3774 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_SILENCED
);
3775 // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
3776 for (uint32 i
= CURRENT_MELEE_SPELL
; i
< CURRENT_MAX_SPELL
;i
++)
3777 if (m_target
->m_currentSpells
[i
] && m_target
->m_currentSpells
[i
]->m_spellInfo
->PreventionType
== SPELL_PREVENTION_TYPE_SILENCE
)
3778 m_target
->InterruptSpell(i
,false); // Stop spells on prepare or casting state
3782 // Arcane Torrent (Energy)
3785 Unit
* caster
= GetCaster();
3789 // Search Mana Tap auras on caster
3790 Aura
* dummy
= caster
->GetDummyAura(28734);
3793 int32 bp
= dummy
->GetStackAmount() * 10;
3794 caster
->CastCustomSpell(caster
, 25048, &bp
, NULL
, NULL
, true);
3795 caster
->RemoveAurasDueToSpell(28734);
3802 // Real remove called after current aura remove from lists, check if other similar auras active
3803 if(m_target
->HasAuraType(SPELL_AURA_MOD_SILENCE
))
3806 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_SILENCED
);
3810 void Aura::HandleModThreat(bool apply
, bool Real
)
3812 // only at real add/remove aura
3816 if(!m_target
->isAlive())
3819 Unit
* caster
= GetCaster();
3821 if(!caster
|| !caster
->isAlive())
3830 level_diff
= m_target
->getLevel() - 60;
3833 // The Eye of Diminution
3835 level_diff
= m_target
->getLevel() - 60;
3840 m_modifier
.m_amount
+= multiplier
* level_diff
;
3842 for(int8 x
=0;x
< MAX_SPELL_SCHOOL
;x
++)
3844 if(m_modifier
.m_miscvalue
& int32(1<<x
))
3846 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
3847 ApplyPercentModFloatVar(m_target
->m_threatModifier
[x
], m_positive
? m_modifier
.m_amount
: -m_modifier
.m_amount
, apply
);
3852 void Aura::HandleAuraModTotalThreat(bool apply
, bool Real
)
3854 // only at real add/remove aura
3858 if(!m_target
->isAlive() || m_target
->GetTypeId()!= TYPEID_PLAYER
)
3861 Unit
* caster
= GetCaster();
3863 if(!caster
|| !caster
->isAlive())
3866 float threatMod
= 0.0f
;
3868 threatMod
= float(m_modifier
.m_amount
);
3870 threatMod
= float(-m_modifier
.m_amount
);
3872 m_target
->getHostilRefManager().threatAssist(caster
, threatMod
);
3875 void Aura::HandleModTaunt(bool apply
, bool Real
)
3877 // only at real add/remove aura
3881 if(!m_target
->isAlive() || !m_target
->CanHaveThreatList())
3884 Unit
* caster
= GetCaster();
3886 if(!caster
|| !caster
->isAlive() || caster
->GetTypeId() != TYPEID_PLAYER
)
3890 m_target
->TauntApply(caster
);
3893 // When taunt aura fades out, mob will switch to previous target if current has less than 1.1 * secondthreat
3894 m_target
->TauntFadeOut(caster
);
3898 /*********************************************************/
3899 /*** MODIFY SPEED ***/
3900 /*********************************************************/
3901 void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real
)
3903 // all applied/removed only at real aura add/remove
3907 m_target
->UpdateSpeed(MOVE_RUN
, true);
3910 void Aura::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real
)
3912 // all applied/removed only at real aura add/remove
3916 m_target
->UpdateSpeed(MOVE_RUN
, true);
3919 void Aura::HandleAuraModIncreaseFlightSpeed(bool apply
, bool Real
)
3921 // all applied/removed only at real aura add/remove
3925 // Enable Fly mode for flying mounts
3926 if (m_modifier
.m_auraname
== SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
)
3930 data
.Initialize(SMSG_MOVE_SET_CAN_FLY
, 12);
3932 data
.Initialize(SMSG_MOVE_UNSET_CAN_FLY
, 12);
3933 data
.append(m_target
->GetPackGUID());
3934 data
<< uint32(0); // unknown
3935 m_target
->SendMessageToSet(&data
, true);
3937 //Players on flying mounts must be immune to polymorph
3938 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
3939 m_target
->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC
,MECHANIC_POLYMORPH
,apply
);
3941 // Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
3942 if( apply
&& m_target
->HasAura(42016,0) && m_target
->GetMountID())
3943 m_target
->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
,16314);
3946 m_target
->UpdateSpeed(MOVE_FLIGHT
, true);
3949 void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real
)
3951 // all applied/removed only at real aura add/remove
3955 m_target
->UpdateSpeed(MOVE_SWIM
, true);
3958 void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real
)
3960 // all applied/removed only at real aura add/remove
3964 m_target
->UpdateSpeed(MOVE_RUN
, true);
3965 m_target
->UpdateSpeed(MOVE_SWIM
, true);
3966 m_target
->UpdateSpeed(MOVE_FLIGHT
, true);
3969 void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real
)
3971 // all applied/removed only at real aura add/remove
3975 m_target
->UpdateSpeed(MOVE_RUN
, true);
3976 m_target
->UpdateSpeed(MOVE_SWIM
, true);
3977 m_target
->UpdateSpeed(MOVE_FLIGHT
, true);
3980 /*********************************************************/
3982 /*********************************************************/
3984 void Aura::HandleModMechanicImmunity(bool apply
, bool /*Real*/)
3986 uint32 mechanic
= 1 << m_modifier
.m_miscvalue
;
3988 //immune movement impairment and loss of control
3989 if(GetId()==42292 || GetId()==59752)
3990 mechanic
=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK
;
3992 // cache values in local vars for prevent access to possible deleted aura data
3993 SpellEntry
const* spellInfo
= GetSpellProto();
3994 uint32 misc
= m_modifier
.m_miscvalue
;
3995 Unit
* target
= m_target
;
3997 if(apply
&& spellInfo
->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
)
3999 Unit::AuraMap
& Auras
= target
->GetAuras();
4000 for(Unit::AuraMap::iterator iter
= Auras
.begin(), next
; iter
!= Auras
.end(); iter
= next
)
4004 SpellEntry
const *spell
= iter
->second
->GetSpellProto();
4005 if (!( spell
->Attributes
& SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY
) && // spells unaffected by invulnerability
4006 spell
->Id
!= spellInfo
->Id
)
4008 //check for mechanic mask
4009 if(GetSpellMechanicMask(spell
, iter
->second
->GetEffIndex()) & mechanic
)
4011 target
->RemoveAurasDueToSpell(spell
->Id
);
4015 next
= Auras
.begin();
4021 target
->ApplySpellImmune(spellInfo
->Id
,IMMUNITY_MECHANIC
,misc
,apply
);
4024 if (spellInfo
->SpellFamilyName
== SPELLFAMILY_HUNTER
&& spellInfo
->SpellIconID
== 1680)
4026 // The Beast Within cast on owner if talent present
4027 if (Unit
* owner
= target
->GetOwner())
4030 Unit::AuraList
const& dummyAuras
= owner
->GetAurasByType(SPELL_AURA_DUMMY
);
4031 for(Unit::AuraList::const_iterator i
= dummyAuras
.begin(); i
!= dummyAuras
.end(); ++i
)
4033 if ((*i
)->GetSpellProto()->SpellIconID
== 2229)
4036 owner
->CastSpell(owner
, 34471, true, 0, this);
4038 owner
->RemoveAurasDueToSpell(34471);
4045 // The Beast Within and Bestial Wrath - immunity
4046 if (spellInfo
->Id
== 19574 || spellInfo
->Id
== 34471)
4050 target
->CastSpell(target
,24395,true);
4051 target
->CastSpell(target
,24396,true);
4052 target
->CastSpell(target
,24397,true);
4053 target
->CastSpell(target
,26592,true);
4057 target
->RemoveAurasDueToSpell(24395);
4058 target
->RemoveAurasDueToSpell(24396);
4059 target
->RemoveAurasDueToSpell(24397);
4060 target
->RemoveAurasDueToSpell(26592);
4065 //this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
4066 void Aura::HandleAuraModEffectImmunity(bool apply
, bool /*Real*/)
4068 // when removing flag aura, handle flag drop
4069 if( !apply
&& m_target
->GetTypeId() == TYPEID_PLAYER
4070 && (GetSpellProto()->AuraInterruptFlags
& AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
) )
4072 if( BattleGround
*bg
= ((Player
*)m_target
)->GetBattleGround() )
4073 bg
->EventPlayerDroppedFlag(((Player
*)m_target
));
4076 m_target
->ApplySpellImmune(GetId(),IMMUNITY_EFFECT
,m_modifier
.m_miscvalue
,apply
);
4079 void Aura::HandleAuraModStateImmunity(bool apply
, bool Real
)
4081 if(apply
&& Real
&& GetSpellProto()->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
)
4083 Unit::AuraList
const& auraList
= m_target
->GetAurasByType(AuraType(m_modifier
.m_miscvalue
));
4084 for(Unit::AuraList::const_iterator itr
= auraList
.begin(); itr
!= auraList
.end();)
4086 if (auraList
.front() != this) // skip itself aura (it already added)
4088 m_target
->RemoveAurasDueToSpell(auraList
.front()->GetId());
4089 itr
= auraList
.begin();
4096 m_target
->ApplySpellImmune(GetId(),IMMUNITY_STATE
,m_modifier
.m_miscvalue
,apply
);
4099 void Aura::HandleAuraModSchoolImmunity(bool apply
, bool Real
)
4101 m_target
->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL
,m_modifier
.m_miscvalue
,apply
);
4103 // remove all flag auras (they are positive, but they must be removed when you are immune)
4104 if( this->GetSpellProto()->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
4105 && this->GetSpellProto()->AttributesEx2
& SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD
)
4106 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
4108 // TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
4110 && GetSpellProto()->AttributesEx
& SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
4111 && IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
4113 uint32 school_mask
= m_modifier
.m_miscvalue
;
4114 Unit::AuraMap
& Auras
= m_target
->GetAuras();
4115 for(Unit::AuraMap::iterator iter
= Auras
.begin(), next
; iter
!= Auras
.end(); iter
= next
)
4119 SpellEntry
const *spell
= iter
->second
->GetSpellProto();
4120 if((GetSpellSchoolMask(spell
) & school_mask
)//Check for school mask
4121 && !( spell
->Attributes
& SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY
) //Spells unaffected by invulnerability
4122 && !iter
->second
->IsPositive() //Don't remove positive spells
4123 && spell
->Id
!= GetId() ) //Don't remove self
4125 m_target
->RemoveAurasDueToSpell(spell
->Id
);
4129 next
= Auras
.begin();
4133 if( Real
&& GetSpellProto()->Mechanic
== MECHANIC_BANISH
)
4136 m_target
->addUnitState(UNIT_STAT_ISOLATED
);
4138 m_target
->clearUnitState(UNIT_STAT_ISOLATED
);
4142 void Aura::HandleAuraModDmgImmunity(bool apply
, bool /*Real*/)
4144 m_target
->ApplySpellImmune(GetId(),IMMUNITY_DAMAGE
,m_modifier
.m_miscvalue
,apply
);
4147 void Aura::HandleAuraModDispelImmunity(bool apply
, bool Real
)
4149 // all applied/removed only at real aura add/remove
4153 m_target
->ApplySpellDispelImmunity(m_spellProto
, DispelType(m_modifier
.m_miscvalue
), apply
);
4156 void Aura::HandleAuraProcTriggerSpell(bool apply
, bool Real
)
4163 // some spell have charges by functionality not have its in spell data
4166 case 28200: // Ascendance (Talisman of Ascendance trinket)
4174 void Aura::HandleAuraModStalked(bool apply
, bool /*Real*/)
4176 // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
4178 m_target
->SetFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_TRACK_UNIT
);
4180 m_target
->RemoveFlag(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_TRACK_UNIT
);
4183 /*********************************************************/
4185 /*********************************************************/
4187 void Aura::HandlePeriodicTriggerSpell(bool apply
, bool /*Real*/)
4189 m_isPeriodic
= apply
;
4190 if (m_spellProto
->Id
== 66 && !apply
)
4192 if (m_removeMode
== AURA_REMOVE_BY_DEFAULT
&& m_duration
<=0)
4193 m_target
->CastSpell(m_target
, 32612, true, NULL
, this);
4197 void Aura::HandlePeriodicTriggerSpellWithValue(bool apply
, bool /*Real*/)
4199 m_isPeriodic
= apply
;
4202 void Aura::HandlePeriodicEnergize(bool apply
, bool Real
)
4207 m_isPeriodic
= apply
;
4209 // Replenishment (0.25% from max)
4210 // Infinite Replenishment
4211 if (GetId() == 57669 ||
4213 m_modifier
.m_amount
= m_target
->GetMaxPower(POWER_MANA
) * 25 / 10000;
4216 void Aura::HandleAuraPowerBurn(bool apply
, bool /*Real*/)
4218 m_isPeriodic
= apply
;
4221 void Aura::HandleAuraPeriodicDummy(bool apply
, bool Real
)
4223 // spells required only Real aura add/remove
4227 // For prevent double apply bonuses
4228 bool loading
= (m_target
->GetTypeId() == TYPEID_PLAYER
&& ((Player
*)m_target
)->GetSession()->PlayerLoading());
4230 Unit
* caster
= GetCaster();
4232 SpellEntry
const*spell
= GetSpellProto();
4233 switch( spell
->SpellFamilyName
)
4235 case SPELLFAMILY_ROGUE
:
4241 // Master of Subtlety
4242 case 31666: m_target
->RemoveAurasDueToSpell(31665); break;
4244 case 58428: m_target
->RemoveAurasDueToSpell(58427); break;
4249 case SPELLFAMILY_HUNTER
:
4252 if (apply
&& !loading
&& caster
)
4253 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(RANGED_ATTACK
) * 8 / 100);
4258 m_isPeriodic
= apply
;
4261 void Aura::HandlePeriodicHeal(bool apply
, bool /*Real*/)
4263 m_isPeriodic
= apply
;
4266 void Aura::HandlePeriodicDamage(bool apply
, bool Real
)
4268 // spells required only Real aura add/remove
4272 m_isPeriodic
= apply
;
4274 // For prevent double apply bonuses
4275 bool loading
= (m_target
->GetTypeId() == TYPEID_PLAYER
&& ((Player
*)m_target
)->GetSession()->PlayerLoading());
4277 // Custom damage calculation after
4283 Unit
*caster
= GetCaster();
4287 switch (m_spellProto
->SpellFamilyName
)
4289 case SPELLFAMILY_GENERIC
:
4292 if ( m_spellProto
->SpellIconID
== 147 && m_spellProto
->SpellVisual
[0] == 0 )
4294 // $AP*0.18/6 bonus per tick
4295 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 3 / 100);
4300 case SPELLFAMILY_WARRIOR
:
4303 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000000020LL
)
4305 // $0.2*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick
4306 float ap
= caster
->GetTotalAttackPowerValue(BASE_ATTACK
);
4307 int32 mws
= caster
->GetAttackTime(BASE_ATTACK
);
4308 float mwb_min
= caster
->GetWeaponDamageRange(BASE_ATTACK
,MINDAMAGE
);
4309 float mwb_max
= caster
->GetWeaponDamageRange(BASE_ATTACK
,MAXDAMAGE
);
4310 m_modifier
.m_amount
+=int32(((mwb_min
+mwb_max
)/2+ap
*mws
/14000)*0.2f
);
4315 case SPELLFAMILY_DRUID
:
4318 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000001000LL
)
4320 // $AP*0.06 bonus per tick
4321 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 6 / 100);
4325 if (m_spellProto
->SpellFamilyFlags
& 0x000000010000000000LL
)
4327 // $AP*0.05/5 bonus per tick
4328 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) / 100);
4332 if (m_spellProto
->SpellFamilyFlags
& 0x000000000000800000LL
)
4335 if (caster
->GetTypeId() != TYPEID_PLAYER
)
4338 uint8 cp
= ((Player
*)caster
)->GetComboPoints();
4340 // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
4341 Unit::AuraList
const& dummyAuras
= caster
->GetAurasByType(SPELL_AURA_DUMMY
);
4342 for(Unit::AuraList::const_iterator itr
= dummyAuras
.begin(); itr
!= dummyAuras
.end(); ++itr
)
4344 if((*itr
)->GetId()==34241)
4346 m_modifier
.m_amount
+= cp
* (*itr
)->GetModifier()->m_amount
;
4350 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * cp
/ 100);
4354 if (m_spellProto
->SpellFamilyFlags
& 0x1000000000000000LL
)
4357 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 15 / 100);
4362 case SPELLFAMILY_ROGUE
:
4365 if (m_spellProto
->SpellFamilyFlags
& 0x000000000000100000LL
)
4367 if (caster
->GetTypeId() != TYPEID_PLAYER
)
4369 //1 point : ${($m1+$b1*1+0.015*$AP)*4} damage over 8 secs
4370 //2 points: ${($m1+$b1*2+0.024*$AP)*5} damage over 10 secs
4371 //3 points: ${($m1+$b1*3+0.03*$AP)*6} damage over 12 secs
4372 //4 points: ${($m1+$b1*4+0.03428571*$AP)*7} damage over 14 secs
4373 //5 points: ${($m1+$b1*5+0.0375*$AP)*8} damage over 16 secs
4374 float AP_per_combo
[6] = {0.0f
, 0.015f
, 0.024f
, 0.03f
, 0.03428571f
, 0.0375f
};
4375 uint8 cp
= ((Player
*)caster
)->GetComboPoints();
4377 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * AP_per_combo
[cp
]);
4381 if (m_spellProto
->SpellFamilyFlags
& 0x000000000000000100LL
)
4383 // $AP*0.07 bonus per tick
4384 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 7 / 100);
4388 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000010000)
4390 // 0.08*$AP / 4 * amount of stack
4391 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(BASE_ATTACK
) * 2 * GetStackAmount() / 100);
4396 case SPELLFAMILY_HUNTER
:
4399 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000004000LL
)
4401 // $RAP*0.1/5 bonus per tick
4402 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(RANGED_ATTACK
) * 10 / 500);
4406 if (m_spellProto
->SpellFamilyFlags
& 0x0000000000000004LL
&& m_spellProto
->SpellIconID
== 678)
4408 // $RAP*0.1/5 bonus per tick
4409 m_modifier
.m_amount
+= int32(caster
->GetTotalAttackPowerValue(RANGED_ATTACK
) * 10 / 500);
4418 // remove time effects
4421 // Parasitic Shadowfiend - handle summoning of two Shadowfiends on DoT expire
4422 if(m_spellProto
->Id
== 41917)
4423 m_target
->CastSpell(m_target
, 41915, true);
4427 void Aura::HandlePeriodicDamagePCT(bool apply
, bool /*Real*/)
4429 m_isPeriodic
= apply
;
4432 void Aura::HandlePeriodicLeech(bool apply
, bool /*Real*/)
4434 m_isPeriodic
= apply
;
4437 void Aura::HandlePeriodicManaLeech(bool apply
, bool /*Real*/)
4439 m_isPeriodic
= apply
;
4442 void Aura::HandlePeriodicHealthFunnel(bool apply
, bool /*Real*/)
4444 m_isPeriodic
= apply
;
4447 /*********************************************************/
4448 /*** MODIFY STATS ***/
4449 /*********************************************************/
4451 /********************************/
4452 /*** RESISTANCE ***/
4453 /********************************/
4455 void Aura::HandleAuraModResistanceExclusive(bool apply
, bool /*Real*/)
4457 for(int8 x
= SPELL_SCHOOL_NORMAL
; x
< MAX_SPELL_SCHOOL
;x
++)
4459 if(m_modifier
.m_miscvalue
& int32(1<<x
))
4461 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ x
), BASE_VALUE
, float(m_modifier
.m_amount
), apply
);
4462 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4463 m_target
->ApplyResistanceBuffModsMod(SpellSchools(x
),m_positive
,m_modifier
.m_amount
, apply
);
4468 void Aura::HandleAuraModResistance(bool apply
, bool /*Real*/)
4470 for(int8 x
= SPELL_SCHOOL_NORMAL
; x
< MAX_SPELL_SCHOOL
;x
++)
4472 if(m_modifier
.m_miscvalue
& int32(1<<x
))
4474 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ x
), TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4475 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4476 m_target
->ApplyResistanceBuffModsMod(SpellSchools(x
),m_positive
,m_modifier
.m_amount
, apply
);
4481 void Aura::HandleAuraModBaseResistancePCT(bool apply
, bool /*Real*/)
4483 // only players have base stats
4484 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4486 //pets only have base armor
4487 if(((Creature
*)m_target
)->isPet() && (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
))
4488 m_target
->HandleStatModifier(UNIT_MOD_ARMOR
, BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4492 for(int8 x
= SPELL_SCHOOL_NORMAL
; x
< MAX_SPELL_SCHOOL
;x
++)
4494 if(m_modifier
.m_miscvalue
& int32(1<<x
))
4495 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ x
), BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4500 void Aura::HandleModResistancePercent(bool apply
, bool /*Real*/)
4502 for(int8 i
= SPELL_SCHOOL_NORMAL
; i
< MAX_SPELL_SCHOOL
; i
++)
4504 if(m_modifier
.m_miscvalue
& int32(1<<i
))
4506 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ i
), TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4507 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4509 m_target
->ApplyResistanceBuffModsPercentMod(SpellSchools(i
),true,m_modifier
.m_amount
, apply
);
4510 m_target
->ApplyResistanceBuffModsPercentMod(SpellSchools(i
),false,m_modifier
.m_amount
, apply
);
4516 void Aura::HandleModBaseResistance(bool apply
, bool /*Real*/)
4518 // only players have base stats
4519 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4521 //only pets have base stats
4522 if(((Creature
*)m_target
)->isPet() && (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
))
4523 m_target
->HandleStatModifier(UNIT_MOD_ARMOR
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4527 for(int i
= SPELL_SCHOOL_NORMAL
; i
< MAX_SPELL_SCHOOL
; i
++)
4528 if(m_modifier
.m_miscvalue
& (1<<i
))
4529 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START
+ i
), TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4533 /********************************/
4535 /********************************/
4537 void Aura::HandleAuraModStat(bool apply
, bool /*Real*/)
4539 if (m_modifier
.m_miscvalue
< -2 || m_modifier
.m_miscvalue
> 4)
4541 sLog
.outError("WARNING: Spell %u effect %u have unsupported misc value (%i) for SPELL_AURA_MOD_STAT ",GetId(),GetEffIndex(),m_modifier
.m_miscvalue
);
4545 for(int32 i
= STAT_STRENGTH
; i
< MAX_STATS
; i
++)
4547 // -1 or -2 is all stats ( misc < -2 checked in function beginning )
4548 if (m_modifier
.m_miscvalue
< 0 || m_modifier
.m_miscvalue
== i
)
4550 //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply);
4551 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START
+ i
), TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4552 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4553 m_target
->ApplyStatBuffMod(Stats(i
),m_modifier
.m_amount
,apply
);
4558 void Aura::HandleModPercentStat(bool apply
, bool /*Real*/)
4560 if (m_modifier
.m_miscvalue
< -1 || m_modifier
.m_miscvalue
> 4)
4562 sLog
.outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4566 // only players have base stats
4567 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
4570 for (int32 i
= STAT_STRENGTH
; i
< MAX_STATS
; ++i
)
4572 if(m_modifier
.m_miscvalue
== i
|| m_modifier
.m_miscvalue
== -1)
4573 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START
+ i
), BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4577 void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool /*Real*/)
4579 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4582 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4583 // This information for client side use only
4584 // Recalculate bonus
4585 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4588 void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool /*Real*/)
4590 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4593 // Recalculate bonus
4594 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4597 void Aura::HandleAuraModDispelResist(bool apply
, bool Real
)
4603 m_target
->CastSpell(m_target
,44416,true,NULL
,this,GetCasterGUID());
4606 void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool /*Real*/)
4608 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4611 // Magic damage modifiers implemented in Unit::SpellDamageBonus
4612 // This information for client side use only
4613 // Recalculate bonus
4614 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4617 void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool /*Real*/)
4619 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4622 // Recalculate bonus
4623 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4626 void Aura::HandleModHealingDone(bool /*apply*/, bool /*Real*/)
4628 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4630 // implemented in Unit::SpellHealingBonus
4631 // this information is for client side only
4632 ((Player
*)m_target
)->UpdateSpellDamageAndHealingBonus();
4635 void Aura::HandleModTotalPercentStat(bool apply
, bool /*Real*/)
4637 if (m_modifier
.m_miscvalue
< -1 || m_modifier
.m_miscvalue
> 4)
4639 sLog
.outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
4643 //save current and max HP before applying aura
4644 uint32 curHPValue
= m_target
->GetHealth();
4645 uint32 maxHPValue
= m_target
->GetMaxHealth();
4647 for (int32 i
= STAT_STRENGTH
; i
< MAX_STATS
; i
++)
4649 if(m_modifier
.m_miscvalue
== i
|| m_modifier
.m_miscvalue
== -1)
4651 m_target
->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START
+ i
), TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4652 if(m_target
->GetTypeId() == TYPEID_PLAYER
|| ((Creature
*)m_target
)->isPet())
4653 m_target
->ApplyStatPercentBuffMod(Stats(i
), m_modifier
.m_amount
, apply
);
4657 //recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag)
4658 if ((m_modifier
.m_miscvalue
== STAT_STAMINA
) && (maxHPValue
> 0) && (m_spellProto
->Attributes
& 0x10))
4660 // newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed
4661 uint32 newHPValue
= (m_target
->GetMaxHealth() * curHPValue
) / maxHPValue
;
4662 m_target
->SetHealth(newHPValue
);
4666 void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool /*Real*/)
4668 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4671 if(m_modifier
.m_miscvalue
!= SPELL_SCHOOL_MASK_NORMAL
)
4673 // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
4674 // and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
4675 sLog
.outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) need adding support for non-armor resistances!");
4679 // Recalculate Armor
4680 m_target
->UpdateArmor();
4683 /********************************/
4684 /*** HEAL & ENERGIZE ***/
4685 /********************************/
4686 void Aura::HandleAuraModTotalHealthPercentRegen(bool apply
, bool /*Real*/)
4688 m_isPeriodic
= apply
;
4691 void Aura::HandleAuraModTotalManaPercentRegen(bool apply
, bool /*Real*/)
4693 if(m_modifier
.periodictime
== 0)
4694 m_modifier
.periodictime
= 1000;
4696 m_periodicTimer
= m_modifier
.periodictime
;
4697 m_isPeriodic
= apply
;
4700 void Aura::HandleModRegen(bool apply
, bool /*Real*/) // eating
4702 if(m_modifier
.periodictime
== 0)
4703 m_modifier
.periodictime
= 5000;
4705 m_periodicTimer
= 5000;
4706 m_isPeriodic
= apply
;
4709 void Aura::HandleModPowerRegen(bool apply
, bool Real
) // drinking
4714 Powers pt
= m_target
->getPowerType();
4715 if(m_modifier
.periodictime
== 0)
4717 // Anger Management (only spell use this aura for rage)
4718 if (pt
== POWER_RAGE
)
4719 m_modifier
.periodictime
= 3000;
4721 m_modifier
.periodictime
= 2000;
4724 m_periodicTimer
= 5000;
4726 if (m_target
->GetTypeId() == TYPEID_PLAYER
&& m_modifier
.m_miscvalue
== POWER_MANA
)
4727 ((Player
*)m_target
)->UpdateManaRegen();
4729 m_isPeriodic
= apply
;
4732 void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real
)
4734 // spells required only Real aura add/remove
4738 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
4741 // Update manaregen value
4742 if (m_modifier
.m_miscvalue
== POWER_MANA
)
4743 ((Player
*)m_target
)->UpdateManaRegen();
4746 void Aura::HandleModManaRegen(bool /*apply*/, bool Real
)
4748 // spells required only Real aura add/remove
4752 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
4755 //Note: an increase in regen does NOT cause threat.
4756 ((Player
*)m_target
)->UpdateManaRegen();
4759 void Aura::HandleComprehendLanguage(bool apply
, bool /*Real*/)
4762 m_target
->SetFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_COMPREHEND_LANG
);
4764 m_target
->RemoveFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_COMPREHEND_LANG
);
4767 void Aura::HandleAuraModIncreaseHealth(bool apply
, bool Real
)
4769 // Special case with temporary increase max/current health
4772 case 12976: // Warrior Last Stand triggered spell
4773 case 28726: // Nightmare Seed ( Nightmare Seed )
4774 case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings)
4775 case 44055: // Tremendous Fortitude (Battlemaster's Alacrity)
4776 case 50322: // Survival Instincts
4782 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4783 m_target
->ModifyHealth(m_modifier
.m_amount
);
4787 if (int32(m_target
->GetHealth()) > m_modifier
.m_amount
)
4788 m_target
->ModifyHealth(-m_modifier
.m_amount
);
4790 m_target
->SetHealth(1);
4791 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4799 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4802 void Aura::HandleAuraModIncreaseMaxHealth(bool apply
, bool /*Real*/)
4804 uint32 oldhealth
= m_target
->GetHealth();
4805 double healthPercentage
= (double)oldhealth
/ (double)m_target
->GetMaxHealth();
4807 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4809 // refresh percentage
4812 uint32 newhealth
= uint32(ceil((double)m_target
->GetMaxHealth() * healthPercentage
));
4816 m_target
->SetHealth(newhealth
);
4820 void Aura::HandleAuraModIncreaseEnergy(bool apply
, bool /*Real*/)
4822 Powers powerType
= m_target
->getPowerType();
4823 if(int32(powerType
) != m_modifier
.m_miscvalue
)
4826 UnitMods unitMod
= UnitMods(UNIT_MOD_POWER_START
+ powerType
);
4828 m_target
->HandleStatModifier(unitMod
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
4831 void Aura::HandleAuraModIncreaseEnergyPercent(bool apply
, bool /*Real*/)
4833 Powers powerType
= m_target
->getPowerType();
4834 if(int32(powerType
) != m_modifier
.m_miscvalue
)
4837 UnitMods unitMod
= UnitMods(UNIT_MOD_POWER_START
+ powerType
);
4839 m_target
->HandleStatModifier(unitMod
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4842 void Aura::HandleAuraModIncreaseHealthPercent(bool apply
, bool /*Real*/)
4844 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
4847 void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply
, bool /*Real*/)
4849 m_target
->HandleStatModifier(UNIT_MOD_HEALTH
, BASE_PCT
, float(m_modifier
.m_amount
), apply
);
4852 /********************************/
4854 /********************************/
4856 void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/)
4858 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4861 ((Player
*)m_target
)->UpdateParryPercentage();
4864 void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/)
4866 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4869 ((Player
*)m_target
)->UpdateDodgePercentage();
4870 //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount));
4873 void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool /*Real*/)
4875 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4878 ((Player
*)m_target
)->UpdateBlockPercentage();
4879 //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount));
4882 void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real
)
4884 // spells required only Real aura add/remove
4888 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4891 ((Player
*)m_target
)->UpdateManaRegen();
4894 void Aura::HandleAuraModCritPercent(bool apply
, bool Real
)
4896 if(m_target
->GetTypeId()!=TYPEID_PLAYER
)
4899 // apply item specific bonuses for already equipped weapon
4902 for(int i
= 0; i
< MAX_ATTACK
; ++i
)
4903 if(Item
* pItem
= ((Player
*)m_target
)->GetWeaponForAttack(WeaponAttackType(i
)))
4904 ((Player
*)m_target
)->_ApplyWeaponDependentAuraCritMod(pItem
,WeaponAttackType(i
),this,apply
);
4907 // mods must be applied base at equipped weapon class and subclass comparison
4908 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
4909 // m_modifier.m_miscvalue comparison with item generated damage types
4911 if (GetSpellProto()->EquippedItemClass
== -1)
4913 ((Player
*)m_target
)->HandleBaseModValue(CRIT_PERCENTAGE
, FLAT_MOD
, float (m_modifier
.m_amount
), apply
);
4914 ((Player
*)m_target
)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE
, FLAT_MOD
, float (m_modifier
.m_amount
), apply
);
4915 ((Player
*)m_target
)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE
, FLAT_MOD
, float (m_modifier
.m_amount
), apply
);
4919 // done in Player::_ApplyWeaponDependentAuraMods
4923 void Aura::HandleModHitChance(bool apply
, bool /*Real*/)
4925 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4927 ((Player
*)m_target
)->UpdateMeleeHitChances();
4928 ((Player
*)m_target
)->UpdateRangedHitChances();
4932 m_target
->m_modMeleeHitChance
+= apply
? m_modifier
.m_amount
: (-m_modifier
.m_amount
);
4933 m_target
->m_modRangedHitChance
+= apply
? m_modifier
.m_amount
: (-m_modifier
.m_amount
);
4937 void Aura::HandleModSpellHitChance(bool apply
, bool /*Real*/)
4939 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4941 ((Player
*)m_target
)->UpdateSpellHitChances();
4945 m_target
->m_modSpellHitChance
+= apply
? m_modifier
.m_amount
: (-m_modifier
.m_amount
);
4949 void Aura::HandleModSpellCritChance(bool apply
, bool Real
)
4951 // spells required only Real aura add/remove
4955 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
4957 ((Player
*)m_target
)->UpdateAllSpellCritChances();
4961 m_target
->m_baseSpellCritChance
+= apply
? m_modifier
.m_amount
:(-m_modifier
.m_amount
);
4965 void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real
)
4967 // spells required only Real aura add/remove
4971 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
4974 for(int school
= SPELL_SCHOOL_NORMAL
; school
< MAX_SPELL_SCHOOL
; ++school
)
4975 if (m_modifier
.m_miscvalue
& (1<<school
))
4976 ((Player
*)m_target
)->UpdateSpellCritChance(school
);
4979 /********************************/
4980 /*** ATTACK SPEED ***/
4981 /********************************/
4983 void Aura::HandleModCastingSpeed(bool apply
, bool /*Real*/)
4985 m_target
->ApplyCastTimePercentMod(m_modifier
.m_amount
,apply
);
4988 void Aura::HandleModMeleeRangedSpeedPct(bool apply
, bool /*Real*/)
4990 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
,m_modifier
.m_amount
,apply
);
4991 m_target
->ApplyAttackTimePercentMod(OFF_ATTACK
,m_modifier
.m_amount
,apply
);
4992 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
, m_modifier
.m_amount
, apply
);
4995 void Aura::HandleModCombatSpeedPct(bool apply
, bool /*Real*/)
4997 m_target
->ApplyCastTimePercentMod(m_modifier
.m_amount
,apply
);
4998 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
,m_modifier
.m_amount
,apply
);
4999 m_target
->ApplyAttackTimePercentMod(OFF_ATTACK
,m_modifier
.m_amount
,apply
);
5000 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
, m_modifier
.m_amount
, apply
);
5003 void Aura::HandleModAttackSpeed(bool apply
, bool /*Real*/)
5005 if(!m_target
->isAlive() )
5008 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
,m_modifier
.m_amount
,apply
);
5011 void Aura::HandleHaste(bool apply
, bool /*Real*/)
5013 m_target
->ApplyAttackTimePercentMod(BASE_ATTACK
, m_modifier
.m_amount
,apply
);
5014 m_target
->ApplyAttackTimePercentMod(OFF_ATTACK
, m_modifier
.m_amount
,apply
);
5015 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
,m_modifier
.m_amount
,apply
);
5018 void Aura::HandleAuraModRangedHaste(bool apply
, bool /*Real*/)
5020 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
, m_modifier
.m_amount
, apply
);
5023 void Aura::HandleRangedAmmoHaste(bool apply
, bool /*Real*/)
5025 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5027 m_target
->ApplyAttackTimePercentMod(RANGED_ATTACK
,m_modifier
.m_amount
, apply
);
5030 /********************************/
5031 /*** ATTACK POWER ***/
5032 /********************************/
5034 void Aura::HandleAuraModAttackPower(bool apply
, bool /*Real*/)
5036 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5039 void Aura::HandleAuraModRangedAttackPower(bool apply
, bool /*Real*/)
5041 if((m_target
->getClassMask() & CLASSMASK_WAND_USERS
)!=0)
5044 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5047 void Aura::HandleAuraModAttackPowerPercent(bool apply
, bool /*Real*/)
5049 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
5050 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5053 void Aura::HandleAuraModRangedAttackPowerPercent(bool apply
, bool /*Real*/)
5055 if((m_target
->getClassMask() & CLASSMASK_WAND_USERS
)!=0)
5058 //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
5059 m_target
->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5062 void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool /*apply*/, bool Real
)
5064 // spells required only Real aura add/remove
5068 // Recalculate bonus
5069 if(m_target
->GetTypeId() == TYPEID_PLAYER
&& !(m_target
->getClassMask() & CLASSMASK_WAND_USERS
))
5070 ((Player
*)m_target
)->UpdateAttackPowerAndDamage(true);
5073 void Aura::HandleAuraModAttackPowerOfStatPercent(bool /*apply*/, bool Real
)
5075 // spells required only Real aura add/remove
5079 // Recalculate bonus
5080 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5081 ((Player
*)m_target
)->UpdateAttackPowerAndDamage(false);
5084 /********************************/
5085 /*** DAMAGE BONUS ***/
5086 /********************************/
5087 void Aura::HandleModDamageDone(bool apply
, bool Real
)
5089 // apply item specific bonuses for already equipped weapon
5090 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
5092 for(int i
= 0; i
< MAX_ATTACK
; ++i
)
5093 if(Item
* pItem
= ((Player
*)m_target
)->GetWeaponForAttack(WeaponAttackType(i
)))
5094 ((Player
*)m_target
)->_ApplyWeaponDependentAuraDamageMod(pItem
,WeaponAttackType(i
),this,apply
);
5097 // m_modifier.m_miscvalue is bitmask of spell schools
5098 // 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
5099 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
5100 // 127 - full bitmask any damages
5102 // mods must be applied base at equipped weapon class and subclass comparison
5103 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
5104 // m_modifier.m_miscvalue comparison with item generated damage types
5106 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
) != 0)
5108 // apply generic physical damage bonuses including wand case
5109 if (GetSpellProto()->EquippedItemClass
== -1 || m_target
->GetTypeId() != TYPEID_PLAYER
)
5111 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5112 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5113 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED
, TOTAL_VALUE
, float(m_modifier
.m_amount
), apply
);
5117 // done in Player::_ApplyWeaponDependentAuraMods
5120 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5123 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS
,m_modifier
.m_amount
,apply
);
5125 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
,m_modifier
.m_amount
,apply
);
5129 // Skip non magic case for speedup
5130 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_MAGIC
) == 0)
5133 if( GetSpellProto()->EquippedItemClass
!= -1 || GetSpellProto()->EquippedItemInventoryTypeMask
!= 0 )
5135 // wand magic case (skip generic to all item spell bonuses)
5136 // done in Player::_ApplyWeaponDependentAuraMods
5138 // Skip item specific requirements for not wand magic damage
5142 // Magic damage modifiers implemented in Unit::SpellDamageBonus
5143 // This information for client side use only
5144 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5148 for(int i
= SPELL_SCHOOL_HOLY
; i
< MAX_SPELL_SCHOOL
; i
++)
5150 if((m_modifier
.m_miscvalue
& (1<<i
)) != 0)
5151 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS
+i
,m_modifier
.m_amount
,apply
);
5156 for(int i
= SPELL_SCHOOL_HOLY
; i
< MAX_SPELL_SCHOOL
; i
++)
5158 if((m_modifier
.m_miscvalue
& (1<<i
)) != 0)
5159 m_target
->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
+i
,m_modifier
.m_amount
,apply
);
5162 Pet
* pet
= m_target
->GetPet();
5164 pet
->UpdateAttackPowerAndDamage();
5168 void Aura::HandleModDamagePercentDone(bool apply
, bool Real
)
5170 sLog
.outDebug("AURA MOD DAMAGE type:%u negative:%u", m_modifier
.m_miscvalue
, m_positive
? 0 : 1);
5172 // apply item specific bonuses for already equipped weapon
5173 if(Real
&& m_target
->GetTypeId()==TYPEID_PLAYER
)
5175 for(int i
= 0; i
< MAX_ATTACK
; ++i
)
5176 if(Item
* pItem
= ((Player
*)m_target
)->GetWeaponForAttack(WeaponAttackType(i
)))
5177 ((Player
*)m_target
)->_ApplyWeaponDependentAuraDamageMod(pItem
,WeaponAttackType(i
),this,apply
);
5180 // m_modifier.m_miscvalue is bitmask of spell schools
5181 // 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
5182 // 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wand
5183 // 127 - full bitmask any damages
5185 // mods must be applied base at equipped weapon class and subclass comparison
5186 // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
5187 // m_modifier.m_miscvalue comparison with item generated damage types
5189 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
) != 0)
5191 // apply generic physical damage bonuses including wand case
5192 if (GetSpellProto()->EquippedItemClass
== -1 || m_target
->GetTypeId() != TYPEID_PLAYER
)
5194 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5195 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5196 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5200 // done in Player::_ApplyWeaponDependentAuraMods
5202 // For show in client
5203 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5204 m_target
->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
,m_modifier
.m_amount
/100.0f
,apply
);
5207 // Skip non magic case for speedup
5208 if((m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_MAGIC
) == 0)
5211 if( GetSpellProto()->EquippedItemClass
!= -1 || GetSpellProto()->EquippedItemInventoryTypeMask
!= 0 )
5213 // wand magic case (skip generic to all item spell bonuses)
5214 // done in Player::_ApplyWeaponDependentAuraMods
5216 // Skip item specific requirements for not wand magic damage
5220 // Magic damage percent modifiers implemented in Unit::SpellDamageBonus
5221 // Send info to client
5222 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5223 for(int i
= SPELL_SCHOOL_HOLY
; i
< MAX_SPELL_SCHOOL
; ++i
)
5224 m_target
->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
+i
,m_modifier
.m_amount
/100.0f
,apply
);
5227 void Aura::HandleModOffhandDamagePercent(bool apply
, bool Real
)
5229 // spells required only Real aura add/remove
5233 sLog
.outDebug("AURA MOD OFFHAND DAMAGE");
5235 m_target
->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND
, TOTAL_PCT
, float(m_modifier
.m_amount
), apply
);
5238 /********************************/
5239 /*** POWER COST ***/
5240 /********************************/
5242 void Aura::HandleModPowerCostPCT(bool apply
, bool Real
)
5244 // spells required only Real aura add/remove
5248 float amount
= m_modifier
.m_amount
/100.0f
;
5249 for(int i
= 0; i
< MAX_SPELL_SCHOOL
; ++i
)
5250 if(m_modifier
.m_miscvalue
& (1<<i
))
5251 m_target
->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER
+i
,amount
,apply
);
5254 void Aura::HandleModPowerCost(bool apply
, bool Real
)
5256 // spells required only Real aura add/remove
5260 for(int i
= 0; i
< MAX_SPELL_SCHOOL
; ++i
)
5261 if(m_modifier
.m_miscvalue
& (1<<i
))
5262 m_target
->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER
+i
,m_modifier
.m_amount
,apply
);
5265 void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real
)
5267 // spells required only Real aura add/remove
5270 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5272 uint32 mask
[3] = {0, 0, 0};
5273 Unit::AuraList
const& noReagent
= m_target
->GetAurasByType(SPELL_AURA_NO_REAGENT_USE
);
5274 for(Unit::AuraList::const_iterator i
= noReagent
.begin(); i
!= noReagent
.end(); ++i
)
5276 uint32
const *ptr
= (*i
)->getAuraSpellClassMask();
5282 m_target
->SetUInt32Value(PLAYER_NO_REAGENT_COST_1
, mask
[0]);
5283 m_target
->SetUInt32Value(PLAYER_NO_REAGENT_COST_1
+1, mask
[1]);
5284 m_target
->SetUInt32Value(PLAYER_NO_REAGENT_COST_1
+2, mask
[2]);
5287 /*********************************************************/
5289 /*********************************************************/
5291 void Aura::HandleShapeshiftBoosts(bool apply
)
5294 uint32 spellId2
= 0;
5295 uint32 HotWSpellId
= 0;
5297 switch(GetModifier()->m_miscvalue
)
5301 HotWSpellId
= 24900;
5316 HotWSpellId
= 24899;
5321 HotWSpellId
= 24899;
5323 case FORM_BATTLESTANCE
:
5326 case FORM_DEFENSIVESTANCE
:
5329 case FORM_BERSERKERSTANCE
:
5334 // aura from effect trigger spell
5341 case FORM_FLIGHT_EPIC
:
5345 case FORM_METAMORPHOSIS
:
5349 case FORM_SPIRITOFREDEMPTION
:
5351 spellId2
= 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
5353 case FORM_GHOSTWOLF
:
5358 case FORM_CREATURECAT
:
5359 case FORM_CREATUREBEAR
:
5364 uint32 form
= GetModifier()->m_miscvalue
-1;
5368 if (spellId
) m_target
->CastSpell(m_target
, spellId
, true, NULL
, this );
5369 if (spellId2
) m_target
->CastSpell(m_target
, spellId2
, true, NULL
, this);
5371 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5373 const PlayerSpellMap
& sp_list
= ((Player
*)m_target
)->GetSpellMap();
5374 for (PlayerSpellMap::const_iterator itr
= sp_list
.begin(); itr
!= sp_list
.end(); ++itr
)
5376 if(itr
->second
->state
== PLAYERSPELL_REMOVED
) continue;
5377 if(itr
->first
==spellId
|| itr
->first
==spellId2
) continue;
5378 SpellEntry
const *spellInfo
= sSpellStore
.LookupEntry(itr
->first
);
5379 if (!spellInfo
|| !(spellInfo
->Attributes
& (SPELL_ATTR_PASSIVE
| (1<<7)))) continue;
5380 if (spellInfo
->Stances
& (1<<form
))
5381 m_target
->CastSpell(m_target
, itr
->first
, true, NULL
, this);
5384 if (((Player
*)m_target
)->HasSpell(17007))
5386 SpellEntry
const *spellInfo
= sSpellStore
.LookupEntry(24932);
5387 if (spellInfo
&& spellInfo
->Stances
& (1<<form
))
5388 m_target
->CastSpell(m_target
, 24932, true, NULL
, this);
5393 Unit::AuraList
const& mModTotalStatPct
= m_target
->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
);
5394 for(Unit::AuraList::const_iterator i
= mModTotalStatPct
.begin(); i
!= mModTotalStatPct
.end(); ++i
)
5396 if ((*i
)->GetSpellProto()->SpellIconID
== 240 && (*i
)->GetModifier()->m_miscvalue
== 3)
5398 int32 HotWMod
= (*i
)->GetModifier()->m_amount
;
5399 if(GetModifier()->m_miscvalue
== FORM_CAT
)
5402 m_target
->CastCustomSpell(m_target
, HotWSpellId
, &HotWMod
, NULL
, NULL
, true, NULL
, this);
5411 m_target
->RemoveAurasDueToSpell(spellId
);
5412 m_target
->RemoveAurasDueToSpell(spellId2
);
5414 Unit::AuraMap
& tAuras
= m_target
->GetAuras();
5415 for (Unit::AuraMap::iterator itr
= tAuras
.begin(); itr
!= tAuras
.end();)
5417 if (itr
->second
->IsRemovedOnShapeLost())
5419 m_target
->RemoveAurasDueToSpell(itr
->second
->GetId());
5420 itr
= tAuras
.begin();
5429 /*double healthPercentage = (double)m_target->GetHealth() / (double)m_target->GetMaxHealth();
5430 m_target->SetHealth(uint32(ceil((double)m_target->GetMaxHealth() * healthPercentage)));*/
5433 void Aura::HandleAuraEmpathy(bool apply
, bool /*Real*/)
5435 if(m_target
->GetTypeId() != TYPEID_UNIT
)
5438 CreatureInfo
const * ci
= objmgr
.GetCreatureTemplate(m_target
->GetEntry());
5439 if(ci
&& ci
->type
== CREATURE_TYPE_BEAST
)
5440 m_target
->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS
, UNIT_DYNFLAG_SPECIALINFO
, apply
);
5443 void Aura::HandleAuraUntrackable(bool apply
, bool /*Real*/)
5446 m_target
->SetByteFlag(UNIT_FIELD_BYTES_1
, 3, UNIT_BYTE1_FLAG_UNTRACKABLE
);
5448 m_target
->RemoveByteFlag(UNIT_FIELD_BYTES_1
, 3, UNIT_BYTE1_FLAG_UNTRACKABLE
);
5451 void Aura::HandleAuraModPacify(bool apply
, bool /*Real*/)
5453 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5457 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PACIFIED
);
5459 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PACIFIED
);
5462 void Aura::HandleAuraModPacifyAndSilence(bool apply
, bool Real
)
5464 HandleAuraModPacify(apply
,Real
);
5465 HandleAuraModSilence(apply
,Real
);
5468 void Aura::HandleAuraGhost(bool apply
, bool /*Real*/)
5470 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5475 m_target
->SetFlag(PLAYER_FLAGS
, PLAYER_FLAGS_GHOST
);
5479 m_target
->RemoveFlag(PLAYER_FLAGS
, PLAYER_FLAGS_GHOST
);
5483 void Aura::HandleAuraAllowFlight(bool apply
, bool Real
)
5485 // all applied/removed only at real aura add/remove
5492 data
.Initialize(SMSG_MOVE_SET_CAN_FLY
, 12);
5494 data
.Initialize(SMSG_MOVE_UNSET_CAN_FLY
, 12);
5495 data
.append(m_target
->GetPackGUID());
5496 data
<< uint32(0); // unk
5497 m_target
->SendMessageToSet(&data
, true);
5500 void Aura::HandleModRating(bool apply
, bool Real
)
5502 // spells required only Real aura add/remove
5506 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5509 for (uint32 rating
= 0; rating
< MAX_COMBAT_RATING
; ++rating
)
5510 if (m_modifier
.m_miscvalue
& (1 << rating
))
5511 ((Player
*)m_target
)->ApplyRatingMod(CombatRating(rating
), m_modifier
.m_amount
, apply
);
5514 void Aura::HandleModRatingFromStat(bool apply
, bool Real
)
5516 // spells required only Real aura add/remove
5520 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5522 // Just recalculate ratings
5523 for (uint32 rating
= 0; rating
< MAX_COMBAT_RATING
; ++rating
)
5524 if (m_modifier
.m_miscvalue
& (1 << rating
))
5525 ((Player
*)m_target
)->ApplyRatingMod(CombatRating(rating
), 0, apply
);
5528 void Aura::HandleForceMoveForward(bool apply
, bool Real
)
5530 if(!Real
|| m_target
->GetTypeId() != TYPEID_PLAYER
)
5533 m_target
->SetFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FORCE_MOVE
);
5535 m_target
->RemoveFlag(UNIT_FIELD_FLAGS_2
, UNIT_FLAG2_FORCE_MOVE
);
5538 void Aura::HandleAuraModExpertise(bool /*apply*/, bool /*Real*/)
5540 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5543 ((Player
*)m_target
)->UpdateExpertise(BASE_ATTACK
);
5544 ((Player
*)m_target
)->UpdateExpertise(OFF_ATTACK
);
5547 void Aura::HandleModTargetResistance(bool apply
, bool Real
)
5549 // spells required only Real aura add/remove
5552 // applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
5554 // show armor penetration
5555 if (m_target
->GetTypeId() == TYPEID_PLAYER
&& (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_NORMAL
))
5556 m_target
->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
,m_modifier
.m_amount
, apply
);
5558 // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
5559 if (m_target
->GetTypeId() == TYPEID_PLAYER
&& (m_modifier
.m_miscvalue
& SPELL_SCHOOL_MASK_SPELL
)==SPELL_SCHOOL_MASK_SPELL
)
5560 m_target
->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE
,m_modifier
.m_amount
, apply
);
5563 void Aura::HandleShieldBlockValue(bool apply
, bool /*Real*/)
5565 BaseModType modType
= FLAT_MOD
;
5566 if(m_modifier
.m_auraname
== SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
)
5569 if(m_target
->GetTypeId() == TYPEID_PLAYER
)
5570 ((Player
*)m_target
)->HandleBaseModValue(SHIELD_BLOCK_VALUE
, modType
, float(m_modifier
.m_amount
), apply
);
5573 void Aura::HandleAuraRetainComboPoints(bool apply
, bool Real
)
5575 // spells required only Real aura add/remove
5579 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
5582 Player
*target
= (Player
*)m_target
;
5584 // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
5585 // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
5586 if( !apply
&& m_duration
==0 && target
->GetComboTarget())
5587 if(Unit
* unit
= ObjectAccessor::GetUnit(*m_target
,target
->GetComboTarget()))
5588 target
->AddComboPoints(unit
, -m_modifier
.m_amount
);
5591 void Aura::HandleModUnattackable( bool Apply
, bool Real
)
5595 m_target
->CombatStop();
5596 m_target
->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION
);
5598 m_target
->ApplyModFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_NON_ATTACKABLE
,Apply
);
5601 void Aura::HandleSpiritOfRedemption( bool apply
, bool Real
)
5603 // spells required only Real aura add/remove
5607 // prepare spirit state
5610 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
5612 // disable breath/etc timers
5613 ((Player
*)m_target
)->StopMirrorTimers();
5615 // set stand state (expected in this form)
5616 if(!m_target
->IsStandState())
5617 m_target
->SetStandState(UNIT_STAND_STATE_STAND
);
5620 m_target
->SetHealth(1);
5624 m_target
->DealDamage(m_target
, m_target
->GetHealth(), NULL
, DIRECT_DAMAGE
, SPELL_SCHOOL_MASK_NORMAL
, GetSpellProto(), false);
5627 void Aura::CleanupTriggeredSpells()
5629 if (m_spellProto
->SpellFamilyName
== SPELLFAMILY_WARRIOR
&& m_spellProto
->SpellFamilyFlags
& 0x0000001000000020LL
)
5631 // Blood Frenzy remove
5632 m_target
->RemoveAurasDueToSpell(30069);
5633 m_target
->RemoveAurasDueToSpell(30070);
5637 uint32 tSpellId
= m_spellProto
->EffectTriggerSpell
[GetEffIndex()];
5641 SpellEntry
const* tProto
= sSpellStore
.LookupEntry(tSpellId
);
5645 if(GetSpellDuration(tProto
) != -1)
5648 // needed for spell 43680, maybe others
5649 // TODO: is there a spell flag, which can solve this in a more sophisticated way?
5650 if(m_spellProto
->EffectApplyAuraName
[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL
&&
5651 GetSpellDuration(m_spellProto
) == m_spellProto
->EffectAmplitude
[GetEffIndex()])
5653 m_target
->RemoveAurasDueToSpell(tSpellId
);
5656 void Aura::HandleSchoolAbsorb(bool apply
, bool Real
)
5661 // prevent double apply bonuses
5662 if(apply
&& (m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading()))
5664 if(Unit
* caster
= GetCaster())
5666 float DoneActualBenefit
= 0.0f
;
5667 switch(m_spellProto
->SpellFamilyName
)
5669 case SPELLFAMILY_PRIEST
:
5670 if(m_spellProto
->SpellFamilyFlags
== 0x1) //PW:S
5672 //+30% from +healing bonus
5673 DoneActualBenefit
= caster
->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto
)) * 0.3f
;
5677 case SPELLFAMILY_MAGE
:
5678 if(m_spellProto
->SpellFamilyFlags
== 0x80100 || m_spellProto
->SpellFamilyFlags
== 0x8 || m_spellProto
->SpellFamilyFlags
== 0x100000000LL
)
5680 //frost ward, fire ward, ice barrier
5681 //+10% from +spd bonus
5682 DoneActualBenefit
= caster
->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto
)) * 0.1f
;
5686 case SPELLFAMILY_WARLOCK
:
5687 if(m_spellProto
->SpellFamilyFlags
== 0x00)
5690 //+10% from +spd bonus
5691 DoneActualBenefit
= caster
->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto
)) * 0.1f
;
5699 DoneActualBenefit
*= caster
->CalculateLevelPenalty(GetSpellProto());
5701 m_modifier
.m_amount
+= (int32
)DoneActualBenefit
;
5706 void Aura::PeriodicTick()
5708 if(!m_target
->isAlive())
5711 switch(m_modifier
.m_auraname
)
5713 case SPELL_AURA_PERIODIC_DAMAGE
:
5714 case SPELL_AURA_PERIODIC_DAMAGE_PERCENT
:
5716 Unit
*pCaster
= GetCaster();
5720 if( GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA
&&
5721 pCaster
->SpellHitResult(m_target
,GetSpellProto(),false)!=SPELL_MISS_NONE
)
5724 // Check for immune (not use charges)
5725 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
5728 // some auras remove at specific health level or more
5729 if(m_modifier
.m_auraname
==SPELL_AURA_PERIODIC_DAMAGE
)
5733 case 43093: case 31956: case 38801:
5734 case 35321: case 38363: case 39215:
5735 if(m_target
->GetHealth() == m_target
->GetMaxHealth() )
5737 m_target
->RemoveAurasDueToSpell(GetId());
5744 GetEffIndex() < 2 && GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_DUMMY
?
5745 pCaster
->CalculateSpellDamage(GetSpellProto(),GetEffIndex()+1,GetSpellProto()->EffectBasePoints
[GetEffIndex()+1],m_target
) :
5747 if(m_target
->GetHealth()*100 >= m_target
->GetMaxHealth()*percent
)
5749 m_target
->RemoveAurasDueToSpell(GetId());
5761 CleanDamage cleanDamage
= CleanDamage(0, BASE_ATTACK
, MELEE_HIT_NORMAL
);
5763 // ignore non positive values (can be result apply spellmods to aura damage
5764 uint32 amount
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
5768 if(m_modifier
.m_auraname
== SPELL_AURA_PERIODIC_DAMAGE
)
5772 // Calculate armor mitigation if it is a physical spell
5773 // But not for bleed mechanic spells
5774 if ( GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL
&&
5775 GetEffectMechanic(GetSpellProto(), m_effIndex
) != MECHANIC_BLEED
)
5777 uint32 pdamageReductedArmor
= pCaster
->CalcArmorReducedDamage(m_target
, pdamage
);
5778 cleanDamage
.damage
+= pdamage
- pdamageReductedArmor
;
5779 pdamage
= pdamageReductedArmor
;
5782 pdamage
= pCaster
->SpellDamageBonus(m_target
, GetSpellProto(), pdamage
, DOT
, GetStackAmount());
5784 // Curse of Agony damage-per-tick calculation
5785 if (GetSpellProto()->SpellFamilyName
==SPELLFAMILY_WARLOCK
&& (GetSpellProto()->SpellFamilyFlags
& 0x0000000000000400LL
) && GetSpellProto()->SpellIconID
==544)
5787 // 1..4 ticks, 1/2 from normal tick damage
5788 if (m_duration
>=((m_maxduration
-m_modifier
.periodictime
)*2/3))
5789 pdamage
= pdamage
/2;
5790 // 9..12 ticks, 3/2 from normal tick damage
5791 else if(m_duration
<((m_maxduration
-m_modifier
.periodictime
)/3))
5792 pdamage
+= (pdamage
+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
5793 // 5..8 ticks have normal tick damage
5797 pdamage
= uint32(m_target
->GetMaxHealth()*amount
/100);
5799 //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
5800 // Reduce dot damage from resilience for players
5801 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
5802 pdamage
-=((Player
*)m_target
)->GetDotDamageReduction(pdamage
);
5804 pCaster
->CalcAbsorbResist(m_target
, GetSpellSchoolMask(GetSpellProto()), DOT
, pdamage
, &absorb
, &resist
);
5806 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
5807 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId(),absorb
);
5809 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
5810 data
.append(m_target
->GetPackGUID());
5811 data
.appendPackGUID(GetCasterGUID());
5812 data
<< uint32(GetId());
5814 data
<< uint32(m_modifier
.m_auraname
);
5815 data
<< (uint32
)pdamage
;
5816 data
<< uint32(0); // overkill
5817 data
<< (uint32
)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x
5818 data
<< (uint32
)absorb
;
5819 data
<< (uint32
)resist
;
5820 m_target
->SendMessageToSet(&data
,true);
5822 Unit
* target
= m_target
; // aura can be deleted in DealDamage
5823 SpellEntry
const* spellProto
= GetSpellProto();
5826 uint32 procAttacker
= PROC_FLAG_ON_DO_PERIODIC
;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
5827 uint32 procVictim
= PROC_FLAG_ON_TAKE_PERIODIC
;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
5828 pdamage
= (pdamage
<= absorb
+resist
) ? 0 : (pdamage
-absorb
-resist
);
5830 procVictim
|=PROC_FLAG_TAKEN_ANY_DAMAGE
;
5831 pCaster
->ProcDamageAndSpell(target
, procAttacker
, procVictim
, PROC_EX_NORMAL_HIT
, pdamage
, BASE_ATTACK
, spellProto
);
5833 pCaster
->DealDamage(target
, pdamage
, &cleanDamage
, DOT
, GetSpellSchoolMask(spellProto
), spellProto
, true);
5836 case SPELL_AURA_PERIODIC_LEECH
:
5837 case SPELL_AURA_PERIODIC_HEALTH_FUNNEL
:
5839 Unit
*pCaster
= GetCaster();
5843 if(!pCaster
->isAlive())
5846 if( GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA
&&
5847 pCaster
->SpellHitResult(m_target
,GetSpellProto(),false)!=SPELL_MISS_NONE
)
5851 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
5856 CleanDamage cleanDamage
= CleanDamage(0, BASE_ATTACK
, MELEE_HIT_NORMAL
);
5858 uint32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
5860 //Calculate armor mitigation if it is a physical spell
5861 if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL
)
5863 uint32 pdamageReductedArmor
= pCaster
->CalcArmorReducedDamage(m_target
, pdamage
);
5864 cleanDamage
.damage
+= pdamage
- pdamageReductedArmor
;
5865 pdamage
= pdamageReductedArmor
;
5868 pdamage
= pCaster
->SpellDamageBonus(m_target
, GetSpellProto(), pdamage
, DOT
, GetStackAmount());
5870 //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit
5871 // Reduce dot damage from resilience for players
5872 if (m_target
->GetTypeId()==TYPEID_PLAYER
)
5873 pdamage
-=((Player
*)m_target
)->GetDotDamageReduction(pdamage
);
5875 pCaster
->CalcAbsorbResist(m_target
, GetSpellSchoolMask(GetSpellProto()), DOT
, pdamage
, &absorb
, &resist
);
5877 if(m_target
->GetHealth() < pdamage
)
5878 pdamage
= uint32(m_target
->GetHealth());
5880 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
5881 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId(),absorb
);
5883 pCaster
->SendSpellNonMeleeDamageLog(m_target
, GetId(), pdamage
, GetSpellSchoolMask(GetSpellProto()), absorb
, resist
, false, 0);
5886 Unit
* target
= m_target
; // aura can be deleted in DealDamage
5887 SpellEntry
const* spellProto
= GetSpellProto();
5888 float multiplier
= spellProto
->EffectMultipleValue
[GetEffIndex()] > 0 ? spellProto
->EffectMultipleValue
[GetEffIndex()] : 1;
5889 int32 stackAmount
= GetStackAmount();
5892 uint32 procAttacker
= PROC_FLAG_ON_DO_PERIODIC
;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
5893 uint32 procVictim
= PROC_FLAG_ON_TAKE_PERIODIC
;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
5894 pdamage
= (pdamage
<= absorb
+resist
) ? 0 : (pdamage
-absorb
-resist
);
5896 procVictim
|=PROC_FLAG_TAKEN_ANY_DAMAGE
;
5897 pCaster
->ProcDamageAndSpell(target
, procAttacker
, procVictim
, PROC_EX_NORMAL_HIT
, pdamage
, BASE_ATTACK
, spellProto
);
5898 int32 new_damage
= pCaster
->DealDamage(target
, pdamage
, &cleanDamage
, DOT
, GetSpellSchoolMask(spellProto
), spellProto
, false);
5900 if (!target
->isAlive() && pCaster
->IsNonMeleeSpellCasted(false))
5902 for (uint32 i
= CURRENT_FIRST_NON_MELEE_SPELL
; i
< CURRENT_MAX_SPELL
; i
++)
5904 if (pCaster
->m_currentSpells
[i
] && pCaster
->m_currentSpells
[i
]->m_spellInfo
->Id
== spellProto
->Id
)
5905 pCaster
->m_currentSpells
[i
]->cancel();
5910 if(Player
*modOwner
= pCaster
->GetSpellModOwner())
5911 modOwner
->ApplySpellMod(spellProto
->Id
, SPELLMOD_MULTIPLE_VALUE
, multiplier
);
5913 uint32 heal
= pCaster
->SpellHealingBonus(pCaster
, spellProto
, uint32(new_damage
* multiplier
), DOT
, stackAmount
);
5915 int32 gain
= pCaster
->DealHeal(pCaster
, heal
, spellProto
);
5916 pCaster
->getHostilRefManager().threatAssist(pCaster
, gain
* 0.5f
, spellProto
);
5919 case SPELL_AURA_PERIODIC_HEAL
:
5920 case SPELL_AURA_OBS_MOD_HEALTH
:
5922 Unit
*pCaster
= GetCaster();
5926 // heal for caster damage (must be alive)
5927 if(m_target
!= pCaster
&& GetSpellProto()->SpellVisual
[0]==163 && !pCaster
->isAlive())
5930 // ignore non positive values (can be result apply spellmods to aura damage
5931 uint32 amount
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
5935 if(m_modifier
.m_auraname
==SPELL_AURA_OBS_MOD_HEALTH
)
5936 pdamage
= uint32(m_target
->GetMaxHealth() * amount
/100);
5940 pdamage
= pCaster
->SpellHealingBonus(m_target
, GetSpellProto(), pdamage
, DOT
, GetStackAmount());
5942 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
5943 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
5945 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
5946 data
.append(m_target
->GetPackGUID());
5947 data
.appendPackGUID(GetCasterGUID());
5948 data
<< uint32(GetId());
5950 data
<< uint32(m_modifier
.m_auraname
);
5951 data
<< (uint32
)pdamage
;
5952 data
<< uint32(0); // wotlk
5953 m_target
->SendMessageToSet(&data
,true);
5955 int32 gain
= m_target
->ModifyHealth(pdamage
);
5957 // add HoTs to amount healed in bgs
5958 if( pCaster
->GetTypeId() == TYPEID_PLAYER
)
5959 if( BattleGround
*bg
= ((Player
*)pCaster
)->GetBattleGround() )
5960 bg
->UpdatePlayerScore(((Player
*)pCaster
), SCORE_HEALING_DONE
, gain
);
5962 m_target
->getHostilRefManager().threatAssist(pCaster
, float(gain
) * 0.5f
, GetSpellProto());
5964 SpellEntry
const* spellProto
= GetSpellProto();
5966 // heal for caster damage
5967 if(m_target
!=pCaster
&& spellProto
->SpellVisual
[0]==163)
5969 uint32 dmg
= spellProto
->manaPerSecond
;
5970 if(pCaster
->GetHealth() <= dmg
&& pCaster
->GetTypeId()==TYPEID_PLAYER
)
5972 pCaster
->RemoveAurasDueToSpell(GetId());
5974 // finish current generic/channeling spells, don't affect autorepeat
5975 if(pCaster
->m_currentSpells
[CURRENT_GENERIC_SPELL
])
5977 pCaster
->m_currentSpells
[CURRENT_GENERIC_SPELL
]->finish();
5979 if(pCaster
->m_currentSpells
[CURRENT_CHANNELED_SPELL
])
5981 pCaster
->m_currentSpells
[CURRENT_CHANNELED_SPELL
]->SendChannelUpdate(0);
5982 pCaster
->m_currentSpells
[CURRENT_CHANNELED_SPELL
]->finish();
5987 pCaster
->SendSpellNonMeleeDamageLog(pCaster
, GetId(), gain
, GetSpellSchoolMask(GetSpellProto()), 0, 0, false, 0, false);
5989 CleanDamage cleanDamage
= CleanDamage(0, BASE_ATTACK
, MELEE_HIT_NORMAL
);
5990 pCaster
->DealDamage(pCaster
, gain
, &cleanDamage
, NODAMAGE
, GetSpellSchoolMask(GetSpellProto()), GetSpellProto(), true);
5994 // uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HEAL;
5995 // uint32 procVictim = 0;//ROC_FLAG_ON_TAKE_PERIODIC | PROC_FLAG_TAKEN_HEAL;
5996 // ignore item heals
5997 // if(procSpell && !haveCastItem)
5998 // pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
6001 case SPELL_AURA_PERIODIC_MANA_LEECH
:
6003 if(m_modifier
.m_miscvalue
< 0 || m_modifier
.m_miscvalue
>= MAX_POWERS
)
6006 Powers power
= Powers(m_modifier
.m_miscvalue
);
6008 // power type might have changed between aura applying and tick (druid's shapeshift)
6009 if(m_target
->getPowerType() != power
)
6012 Unit
*pCaster
= GetCaster();
6016 if(!pCaster
->isAlive())
6019 if( GetSpellProto()->Effect
[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA
&&
6020 pCaster
->SpellHitResult(m_target
,GetSpellProto(),false)!=SPELL_MISS_NONE
)
6023 // Check for immune (not use charges)
6024 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
6027 // ignore non positive values (can be result apply spellmods to aura damage
6028 uint32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6030 // Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
6031 // It's mana percent cost spells, m_modifier.m_amount is percent drain from target
6032 if (m_spellProto
->ManaCostPercentage
)
6035 uint32 maxmana
= pCaster
->GetMaxPower(power
) * pdamage
* 2 / 100;
6036 pdamage
= m_target
->GetMaxPower(power
) * pdamage
/ 100;
6037 if(pdamage
> maxmana
)
6041 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
6042 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
6044 int32 drain_amount
= m_target
->GetPower(power
) > pdamage
? pdamage
: m_target
->GetPower(power
);
6046 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6047 if (power
== POWER_MANA
&& m_target
->GetTypeId() == TYPEID_PLAYER
)
6048 drain_amount
-= ((Player
*)m_target
)->GetSpellCritDamageReduction(drain_amount
);
6050 m_target
->ModifyPower(power
, -drain_amount
);
6052 float gain_multiplier
= 0;
6054 if(pCaster
->GetMaxPower(power
) > 0)
6056 gain_multiplier
= GetSpellProto()->EffectMultipleValue
[GetEffIndex()];
6058 if(Player
*modOwner
= pCaster
->GetSpellModOwner())
6059 modOwner
->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE
, gain_multiplier
);
6062 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
6063 data
.append(m_target
->GetPackGUID());
6064 data
.appendPackGUID(GetCasterGUID());
6065 data
<< uint32(GetId());
6067 data
<< uint32(m_modifier
.m_auraname
);
6068 data
<< (uint32
)power
; // power type
6069 data
<< (uint32
)drain_amount
;
6070 data
<< (float)gain_multiplier
;
6071 m_target
->SendMessageToSet(&data
,true);
6073 int32 gain_amount
= int32(drain_amount
*gain_multiplier
);
6077 int32 gain
= pCaster
->ModifyPower(power
,gain_amount
);
6078 m_target
->AddThreat(pCaster
, float(gain
) * 0.5f
, GetSpellSchoolMask(GetSpellProto()), GetSpellProto());
6082 case SPELL_AURA_PERIODIC_ENERGIZE
:
6084 // ignore non positive values (can be result apply spellmods to aura damage
6085 uint32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6087 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
6088 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
6090 if(m_modifier
.m_miscvalue
< 0 || m_modifier
.m_miscvalue
>= MAX_POWERS
)
6093 Powers power
= Powers(m_modifier
.m_miscvalue
);
6095 if(m_target
->GetMaxPower(power
) == 0)
6098 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
6099 data
.append(m_target
->GetPackGUID());
6100 data
.appendPackGUID(GetCasterGUID());
6101 data
<< uint32(GetId());
6103 data
<< uint32(m_modifier
.m_auraname
);
6104 data
<< (uint32
)power
; // power type
6105 data
<< (uint32
)pdamage
;
6106 m_target
->SendMessageToSet(&data
,true);
6108 int32 gain
= m_target
->ModifyPower(power
,pdamage
);
6110 if(Unit
* pCaster
= GetCaster())
6111 m_target
->getHostilRefManager().threatAssist(pCaster
, float(gain
) * 0.5f
, GetSpellProto());
6114 case SPELL_AURA_OBS_MOD_MANA
:
6116 // ignore non positive values (can be result apply spellmods to aura damage
6117 uint32 amount
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6119 uint32 pdamage
= uint32(m_target
->GetMaxPower(POWER_MANA
) * amount
/100);
6121 sLog
.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u mana inflicted by %u",
6122 GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target
->GetGUIDLow(), m_target
->GetTypeId(), pdamage
, GetId());
6124 if(m_target
->GetMaxPower(POWER_MANA
) == 0)
6127 WorldPacket
data(SMSG_PERIODICAURALOG
, (21+16));// we guess size
6128 data
.append(m_target
->GetPackGUID());
6129 data
.appendPackGUID(GetCasterGUID());
6130 data
<< uint32(GetId());
6132 data
<< uint32(m_modifier
.m_auraname
);
6133 data
<< (uint32
)0; // ?
6134 data
<< (uint32
)pdamage
;
6135 m_target
->SendMessageToSet(&data
,true);
6137 int32 gain
= m_target
->ModifyPower(POWER_MANA
, pdamage
);
6139 if(Unit
* pCaster
= GetCaster())
6140 m_target
->getHostilRefManager().threatAssist(pCaster
, float(gain
) * 0.5f
, GetSpellProto());
6143 case SPELL_AURA_POWER_BURN_MANA
:
6145 Unit
*pCaster
= GetCaster();
6149 // Check for immune (not use charges)
6150 if(m_target
->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
6153 int32 pdamage
= m_modifier
.m_amount
> 0 ? m_modifier
.m_amount
: 0;
6155 Powers powerType
= Powers(m_modifier
.m_miscvalue
);
6157 if(!m_target
->isAlive() || m_target
->getPowerType() != powerType
)
6160 // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
6161 if (powerType
== POWER_MANA
&& m_target
->GetTypeId() == TYPEID_PLAYER
)
6162 pdamage
-= ((Player
*)m_target
)->GetSpellCritDamageReduction(pdamage
);
6164 uint32 gain
= uint32(-m_target
->ModifyPower(powerType
, -pdamage
));
6166 gain
= uint32(gain
* GetSpellProto()->EffectMultipleValue
[GetEffIndex()]);
6168 SpellEntry
const* spellProto
= GetSpellProto();
6169 //maybe has to be sent different to client, but not by SMSG_PERIODICAURALOG
6170 SpellNonMeleeDamage
damageInfo(pCaster
, m_target
, spellProto
->Id
, spellProto
->SchoolMask
);
6171 pCaster
->CalculateSpellDamage(&damageInfo
, gain
, spellProto
);
6172 pCaster
->SendSpellNonMeleeDamageLog(&damageInfo
);
6175 uint32 procAttacker
= PROC_FLAG_ON_DO_PERIODIC
;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
6176 uint32 procVictim
= PROC_FLAG_ON_TAKE_PERIODIC
;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
6177 uint32 procEx
= createProcExtendMask(&damageInfo
, SPELL_MISS_NONE
);
6178 if (damageInfo
.damage
)
6179 procVictim
|=PROC_FLAG_TAKEN_ANY_DAMAGE
;
6181 pCaster
->ProcDamageAndSpell(damageInfo
.target
, procAttacker
, procVictim
, procEx
, damageInfo
.damage
, BASE_ATTACK
, spellProto
);
6183 pCaster
->DealSpellDamage(&damageInfo
, true);
6186 case SPELL_AURA_MOD_REGEN
:
6188 int32 gain
= m_target
->ModifyHealth(m_modifier
.m_amount
);
6189 if (Unit
*caster
= GetCaster())
6190 m_target
->getHostilRefManager().threatAssist(caster
, float(gain
) * 0.5f
, GetSpellProto());
6193 case SPELL_AURA_MOD_POWER_REGEN
:
6195 Powers pt
= m_target
->getPowerType();
6196 if(int32(pt
) != m_modifier
.m_miscvalue
)
6199 if ( GetSpellProto()->AuraInterruptFlags
& AURA_INTERRUPT_FLAG_NOT_SEATED
)
6202 m_target
->HandleEmoteCommand(EMOTE_ONESHOT_EAT
);
6204 else if( GetId() == 20577 )
6207 m_target
->HandleEmoteCommand(EMOTE_STATE_CANNIBALIZE
);
6211 // amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3
6212 // so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec
6213 if(pt
== POWER_RAGE
)
6214 m_target
->ModifyPower(pt
, m_modifier
.m_amount
*3/5);
6217 // Here tick dummy auras
6218 case SPELL_AURA_PERIODIC_DUMMY
:
6220 PeriodicDummyTick();
6223 case SPELL_AURA_PERIODIC_TRIGGER_SPELL
:
6228 case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
:
6230 TriggerSpellWithValue();
6238 void Aura::PeriodicDummyTick()
6240 Unit
*caster
= GetCaster();
6241 SpellEntry
const* spell
= GetSpellProto();
6242 switch (spell
->SpellFamilyName
)
6244 case SPELLFAMILY_GENERIC
:
6260 case 49472: // Drink Coffee
6263 if (m_target
->GetTypeId() != TYPEID_PLAYER
)
6265 // Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus
6266 Unit::AuraList
const& aura
= m_target
->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN
);
6267 for(Unit::AuraList::const_iterator i
= aura
.begin(); i
!= aura
.end(); ++i
)
6269 if ((*i
)->GetId() == GetId())
6271 (*i
)->GetModifier()->m_amount
= m_modifier
.m_amount
;
6272 ((Player
*)m_target
)->UpdateManaRegen();
6274 m_isPeriodic
= false;
6283 // Possibly need cast one of them (but
6284 // 7038 Forsaken Skill: Swords
6285 // 7039 Forsaken Skill: Axes
6286 // 7040 Forsaken Skill: Daggers
6287 // 7041 Forsaken Skill: Maces
6288 // 7042 Forsaken Skill: Staves
6289 // 7043 Forsaken Skill: Bows
6290 // 7044 Forsaken Skill: Guns
6291 // 7045 Forsaken Skill: 2H Axes
6292 // 7046 Forsaken Skill: 2H Maces
6293 // 7047 Forsaken Skill: 2H Swords
6294 // 7048 Forsaken Skill: Defense
6295 // 7049 Forsaken Skill: Fire
6296 // 7050 Forsaken Skill: Frost
6297 // 7051 Forsaken Skill: Holy
6298 // 7053 Forsaken Skill: Shadow
6302 // case 19230: break;
6303 // // Gossip NPC Periodic - Talk
6304 // case 33208: break;
6305 // // Gossip NPC Periodic - Despawn
6306 // case 33209: break;
6308 // case 36207: break;
6309 // // Simon Game START timer, (DND)
6310 // case 39993: break;
6311 // // Knockdown Fel Cannon: break; The Aggro Burst
6312 // case 40119: break;
6313 // // Old Mount Spell
6314 // case 40154: break;
6316 // case 40581: break;
6317 // // Ethereal Ring: break; The Bolt Burst
6318 // case 40801: break;
6319 // // Crystal Prison
6320 // case 40846: break;
6322 // case 41054: break;
6324 // case 41404: break;
6325 // // Ethereal Ring Visual, Lightning Aura
6326 // case 41477: break;
6327 // // Ethereal Ring Visual, Lightning Aura (Fork)
6328 // case 41525: break;
6329 // // Ethereal Ring Visual, Lightning Jumper Aura
6330 // case 41567: break;
6332 // case 41955: break;
6333 // // Headless Horseman - Fire
6334 // case 42074: break;
6335 // // Headless Horseman - Visual - Large Fire
6336 // case 42075: break;
6337 // // Headless Horseman - Start Fire, Periodic Aura
6338 // case 42140: break;
6339 // // Ram Speed Boost
6340 // case 42152: break;
6341 // // Headless Horseman - Fires Out Victory Aura
6342 // case 42235: break;
6343 // // Pumpkin Life Cycle
6344 // case 42280: break;
6345 // // Brewfest Request Chick Chuck Mug Aura
6346 // case 42537: break;
6348 // case 42596: break;
6349 // // Headless Horseman Climax, Head: Periodic
6350 // case 42603: break;
6352 // case 42621: break;
6353 // // Headless Horseman - Conflagrate, Periodic Aura
6354 // case 42637: break;
6355 // // Headless Horseman - Create Pumpkin Treats Aura
6356 // case 42774: break;
6357 // // Headless Horseman Climax - Summoning Rhyme Aura
6358 // case 42879: break;
6360 // case 42919: break;
6362 // case 42924: break;
6364 // case 42992: break;
6366 // case 42993: break;
6368 // case 42994: break;
6369 // // Ram Level - Neutral
6370 // case 43310: break;
6371 // // Headless Horseman - Maniacal Laugh, Maniacal, Delayed 17
6372 // case 43884: break;
6374 // case 43963: break;
6375 // // Headless Horseman - Maniacal Laugh, Maniacal, other, Delayed 17
6376 // case 44000: break;
6377 // // Energy Feedback
6378 // case 44328: break;
6379 // // Romantic Picnic
6380 // case 45102: break;
6381 // // Romantic Picnic
6382 // case 45123: break;
6383 // // Looking for Love
6384 // case 45124: break;
6385 // // Kite - Lightning Strike Kite Aura
6386 // case 45197: break;
6387 // // Rocket Chicken
6388 // case 45202: break;
6389 // // Copy Offhand Weapon
6390 // case 45205: break;
6391 // // Upper Deck - Kite - Lightning Periodic Aura
6392 // case 45207: break;
6393 // // Kite -Sky Lightning Strike Kite Aura
6394 // case 45251: break;
6395 // // Ribbon Pole Dancer Check Aura
6396 // case 45390: break;
6397 // // Holiday - Midsummer, Ribbon Pole Periodic Visual
6398 // case 45406: break;
6400 // case 45472: break;
6401 // // Alliance Flag, Extra Damage Debuff
6402 // case 45898: break;
6403 // // Horde Flag, Extra Damage Debuff
6404 // case 45899: break;
6405 // // Ahune - Summoning Rhyme Aura
6406 // case 45926: break;
6407 // // Ahune - Slippery Floor
6408 // case 45945: break;
6409 // // Ahune's Shield
6410 // case 45954: break;
6411 // // Nether Vapor Lightning
6412 // case 45960: break;
6414 // case 45996: break;
6415 // // Summon Blood Elves Periodic
6416 // case 46041: break;
6417 // // Transform Visual Missile Periodic
6418 // case 46205: break;
6419 // // Find Opening Beam End
6420 // case 46333: break;
6421 // // Ice Spear Control Aura
6422 // case 46371: break;
6423 // // Hailstone Chill
6424 // case 46458: break;
6425 // // Hailstone Chill, Internal
6426 // case 46465: break;
6427 // // Chill, Internal Shifter
6428 // case 46549: break;
6429 // // Summon Ice Spear Knockback Delayer
6430 // case 46878: break;
6431 // // Burninate Effect
6432 // case 47214: break;
6433 // // Fizzcrank Practice Parachute
6434 // case 47228: break;
6435 // // Send Mug Control Aura
6436 // case 47369: break;
6437 // // Direbrew's Disarm (precast)
6438 // case 47407: break;
6439 // // Mole Machine Port Schedule
6440 // case 47489: break;
6441 // case 47941: break; // Crystal Spike
6442 // case 48200: break; // Healer Aura
6443 // case 48630: break; // Summon Gauntlet Mobs Periodic
6444 // case 49313: break; // Proximity Mine Area Aura
6445 // // Mole Machine Portal Schedule
6446 // case 49466: break;
6447 // case 49555: break; // Corpse Explode
6448 // case 49592: break; // Temporal Rift
6449 // case 49957: break; // Cutting Laser
6450 // case 50085: break; // Slow Fall
6451 // // Listening to Music
6452 // case 50493: break;
6453 // // Love Rocket Barrage
6454 // case 50530: break;
6455 // Exist more after, need add later
6460 case SPELLFAMILY_MAGE
:
6463 // if (spell->Id == 55342)
6467 case SPELLFAMILY_WARRIOR
:
6469 // Armored to the Teeth
6470 if (spell
->SpellIconID
== 3516)
6472 // Increases your attack power by $s1 for every $s2 armor value you have.
6473 // Calculate AP bonus (from 1 efect of this spell)
6474 int32 apBonus
= m_modifier
.m_amount
* m_target
->GetArmor() / m_target
->CalculateSpellDamage(spell
, 1, spell
->EffectBasePoints
[1], m_target
);
6475 m_target
->CastCustomSpell(m_target
, 61217, &apBonus
, &apBonus
, 0, true, 0, this);
6480 case SPELLFAMILY_DRUID
:
6484 // Frenzied Regeneration
6487 // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
6488 // Should be manauser
6489 if (m_target
->getPowerType()!=POWER_RAGE
)
6491 uint32 rage
= m_target
->GetPower(POWER_RAGE
);
6495 int32 mod
= (rage
< 100) ? rage
: 100;
6496 int32 points
= m_target
->CalculateSpellDamage(spell
, 1, spell
->EffectBasePoints
[1], m_target
);
6497 int32 regen
= m_target
->GetMaxHealth() * (mod
* points
/ 10) / 1000;
6498 m_target
->CastCustomSpell(m_target
, 22845, ®en
, 0, 0, true, 0, this);
6499 m_target
->SetPower(POWER_RAGE
, rage
-mod
);
6510 case SPELLFAMILY_ROGUE
:
6512 // switch (spell->Id)
6514 // Master of Subtlety
6515 // case 31666: break;
6517 // case 51690: break;
6519 // case 58428: break;
6525 case SPELLFAMILY_HUNTER
:
6528 if (spell
->SpellFamilyFlags
& 0x8000000000000000LL
)
6532 int32 damage
= m_modifier
.m_amount
;
6533 // Full damage to target at 0 tick
6534 if (m_duration
> m_modifier
.periodictime
)
6536 caster
->CastCustomSpell(m_target
, 53352, &damage
, 0, 0, true, 0, this);
6540 caster
->CastCustomSpell(m_target
, 56298, &damage
, 0, 0, true, 0, this);
6548 // Feeding Frenzy Rank 1
6550 if ( m_target
->GetHealth() * 100 < m_target
->GetMaxHealth() * 35 )
6551 m_target
->CastSpell(m_target
, 60096, true, 0, this);
6553 // Feeding Frenzy Rank 2
6555 if ( m_target
->GetHealth() * 100 < m_target
->GetMaxHealth() * 35 )
6556 m_target
->CastSpell(m_target
, 60097, true, 0, this);
6563 case SPELLFAMILY_SHAMAN
:
6566 if (spell
->Id
== 52179)
6568 // Periodic need for remove visual on stun/fear/silence lost
6569 if (!(m_target
->GetUInt32Value(UNIT_FIELD_FLAGS
)&(UNIT_FLAG_STUNNED
|UNIT_FLAG_FLEEING
|UNIT_FLAG_SILENCED
)))
6570 m_target
->RemoveAurasDueToSpell(52179);
6575 case SPELLFAMILY_DEATHKNIGHT
:
6578 if (spell
->SpellFamilyFlags
& 0x0000000000000020LL
)
6581 caster
->CastCustomSpell(m_target
, 52212, &m_modifier
.m_amount
, NULL
, NULL
, true, 0, this);
6585 // if (spell->SpellFamilyFlags & 0x0000000000001000LL)
6588 if (spell
->SpellFamilyFlags
& 0x0000400000000000LL
)
6590 // Get 0 effect aura
6591 Aura
*slow
= m_target
->GetAura(GetId(), 0);
6594 slow
->ApplyModifier(false, true);
6595 Modifier
*mod
= slow
->GetModifier();
6596 mod
->m_amount
+= m_modifier
.m_amount
;
6597 if (mod
->m_amount
> 0) mod
->m_amount
= 0;
6598 slow
->ApplyModifier(true, true);
6603 // if (spell->SpellFamilyFlags & 0x0000008000000000LL)
6605 // Death Rune Mastery
6606 // if (spell->SpellFamilyFlags & 0x0000000000004000LL)
6609 if (spell
->SpellIconID
== 2653)
6611 // Increases your attack power by $s1 for every $s2 armor value you have.
6612 // Calculate AP bonus (from 1 efect of this spell)
6613 int32 apBonus
= m_modifier
.m_amount
* m_target
->GetArmor() / m_target
->CalculateSpellDamage(spell
, 1, spell
->EffectBasePoints
[1], m_target
);
6614 m_target
->CastCustomSpell(m_target
, 61217, &apBonus
, &apBonus
, 0, true, 0, this);
6618 // if (spell->SpellIconID == 22)
6620 // Blood of the North
6621 // if (spell->SpellIconID == 30412)
6630 void Aura::HandlePreventFleeing(bool apply
, bool Real
)
6635 Unit::AuraList
const& fearAuras
= m_target
->GetAurasByType(SPELL_AURA_MOD_FEAR
);
6636 if( !fearAuras
.empty() )
6639 m_target
->SetFeared(false, fearAuras
.front()->GetCasterGUID());
6641 m_target
->SetFeared(true);
6645 void Aura::HandleManaShield(bool apply
, bool Real
)
6650 // prevent double apply bonuses
6651 if(apply
&& (m_target
->GetTypeId()!=TYPEID_PLAYER
|| !((Player
*)m_target
)->GetSession()->PlayerLoading()))
6653 if(Unit
* caster
= GetCaster())
6655 float DoneActualBenefit
= 0.0f
;
6656 switch(m_spellProto
->SpellFamilyName
)
6658 case SPELLFAMILY_MAGE
:
6659 if(m_spellProto
->SpellFamilyFlags
& 0x8000)
6662 // +50% from +spd bonus
6663 DoneActualBenefit
= caster
->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellProto
)) * 0.5f
;
6671 DoneActualBenefit
*= caster
->CalculateLevelPenalty(GetSpellProto());
6673 m_modifier
.m_amount
+= (int32
)DoneActualBenefit
;
6678 void Aura::HandleArenaPreparation(bool apply
, bool Real
)
6684 m_target
->SetFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PREPARATION
);
6686 m_target
->RemoveFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_PREPARATION
);
6690 * Such auras are applied from a caster(=player) to a vehicle.
6691 * This has been verified using spell #49256
6693 void Aura::HandleAuraControlVehicle(bool apply
, bool Real
)
6698 Unit
*player
= GetCaster();
6699 Vehicle
*vehicle
= dynamic_cast<Vehicle
*>(m_target
);
6700 if(!player
|| player
->GetTypeId()!=TYPEID_PLAYER
|| !vehicle
)
6705 if(Pet
*pet
= player
->GetPet())
6706 pet
->Remove(PET_SAVE_AS_CURRENT
);
6707 ((Player
*)player
)->EnterVehicle(vehicle
);
6711 SpellEntry
const *spell
= GetSpellProto();
6713 // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
6714 player
->RemoveAurasDueToSpell(spell
->Id
);
6716 ((Player
*)player
)->ExitVehicle(vehicle
);
6720 void Aura::HandleAuraConvertRune(bool apply
, bool Real
)
6725 if(m_target
->GetTypeId() != TYPEID_PLAYER
)
6728 Player
*plr
= (Player
*)m_target
;
6730 if(plr
->getClass() != CLASS_DEATH_KNIGHT
)
6733 // how to determine what rune need to be converted?
6734 for(uint32 i
= 0; i
< MAX_RUNES
; ++i
)
6738 if(!plr
->GetRuneCooldown(i
))
6740 plr
->ConvertRune(i
, GetSpellProto()->EffectMiscValueB
[m_effIndex
]);
6746 if(plr
->GetCurrentRune(i
) == GetSpellProto()->EffectMiscValueB
[m_effIndex
])
6748 plr
->ConvertRune(i
, plr
->GetBaseRune(i
));
6755 void Aura::HandlePhase(bool apply
, bool Real
)
6760 // always non stackable
6763 Unit::AuraList
const& phases
= m_target
->GetAurasByType(SPELL_AURA_PHASE
);
6765 m_target
->RemoveAurasDueToSpell(phases
.front()->GetId(),this);
6768 // no-phase is also phase state so same code for apply and remove
6770 // phase auras normally not expected at BG but anyway better check
6771 if(m_target
->GetTypeId()==TYPEID_PLAYER
)
6773 // drop flag at invisible in bg
6774 if(((Player
*)m_target
)->InBattleGround())
6775 if(BattleGround
*bg
= ((Player
*)m_target
)->GetBattleGround())
6776 bg
->EventPlayerDroppedFlag((Player
*)m_target
);
6778 // GM-mode have mask 0xFFFFFFFF
6779 if(!((Player
*)m_target
)->isGameMaster())
6780 m_target
->SetPhaseMask(apply
? GetMiscValue() : PHASEMASK_NORMAL
,false);
6782 ((Player
*)m_target
)->GetSession()->SendSetPhaseShift(apply
? GetMiscValue() : PHASEMASK_NORMAL
);
6784 if(GetEffIndex()==0)
6786 SpellAreaForAreaMapBounds saBounds
= spellmgr
.GetSpellAreaForAuraMapBounds(GetId());
6787 if(saBounds
.first
!= saBounds
.second
)
6790 m_target
->GetZoneAndAreaId(zone
,area
);
6792 for(SpellAreaForAreaMap::const_iterator itr
= saBounds
.first
; itr
!= saBounds
.second
; ++itr
)
6794 // some auras remove at aura remove
6795 if(!itr
->second
->IsFitToRequirements((Player
*)m_target
,zone
,area
))
6796 m_target
->RemoveAurasDueToSpell(itr
->second
->spellId
);
6797 // some auras applied at aura apply
6798 else if(itr
->second
->autocast
)
6800 if( !m_target
->HasAura(itr
->second
->spellId
,0) )
6801 m_target
->CastSpell(m_target
,itr
->second
->spellId
,true);
6808 m_target
->SetPhaseMask(apply
? GetMiscValue() : PHASEMASK_NORMAL
,false);
6810 // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
6811 if(m_target
->GetVisibility()!=VISIBILITY_OFF
)
6812 m_target
->SetVisibility(m_target
->GetVisibility());
6815 void Aura::UnregisterSingleCastAura()
6817 if (IsSingleTarget())
6819 Unit
* caster
= NULL
;
6820 caster
= GetCaster();
6823 caster
->GetSingleCastAuras().remove(this);
6827 sLog
.outError("Couldn't find the caster of the single target aura, may crash later!");
6830 m_isSingleTargetAura
= false;
6834 void Aura::HandleAuraSafeFall( bool Apply
, bool Real
)
6836 // implemented in WorldSession::HandleMovementOpcodes
6838 // only special case
6839 if(Apply
&& Real
&& GetId()==32474 && m_target
->GetTypeId()==TYPEID_PLAYER
)
6840 ((Player
*)m_target
)->ActivateTaxiPathTo(506,GetId());