[2771] Applied MaNGOS coding style (see trunk/bcpp.cfg).
[mangos-git.git] / src / game / SpellAuras.h
blobf3692ab90689762c140f5eb3ae4a9fe4dd4b599f
1 /*
2 * Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
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
18 #ifndef MANGOS_SPELLAURAS_H
19 #define MANGOS_SPELLAURAS_H
21 #include "Spell.h"
22 #include "SpellAuraDefines.h"
24 struct DamageManaShield
26 uint32 m_spellId;
27 uint32 m_modType;
28 int32 m_schoolType;
29 uint32 m_totalAbsorb;
30 uint32 m_currAbsorb;
33 struct Modifier
35 uint8 m_auraname;
36 int32 m_amount;
37 int32 m_miscvalue;
38 uint32 m_miscvalue2;
39 uint32 periodictime;
42 class Unit;
43 struct SpellEntry;
44 struct ProcTriggerSpell;
46 class Aura
48 public:
49 //aura handlers
50 void HandleNULL(bool Apply);
51 void HandleBindSight(bool apply);
52 void HandleModPossess(bool apply);
53 void HandlePeriodicDamage(bool apply);
54 void HandleAuraDummy(bool apply);
55 void HandleModConfuse(bool apply);
56 void HandleModCharm(bool apply);
57 void HandleModFear(bool Apply);
58 void HandlePeriodicHeal(bool apply);
59 void HandleModAttackSpeed(bool apply);
60 void HandleModThreat(bool apply);
61 void HandleAuraWaterWalk(bool Apply);
62 void HandleAuraFeatherFall(bool Apply);
63 void HandleAddModifier(bool Apply);
64 void HandleAuraModStun(bool Apply);
65 void HandleModDamageDone(bool Apply);
66 void HandleModDamageTaken(bool Apply);
67 void HandleAuraModRangedAttackPower(bool Apply);
68 void HandleAuraModIncreaseSpeedAlways(bool Apply);
69 void HandleAuraModIncreaseEnergyPercent(bool Apply);
70 void HandleAuraModIncreaseHealthPercent(bool Apply);
71 void HandleHaste(bool Apply);
72 void HandlePeriodicTriggerSpell(bool apply);
73 void HandlePeriodicEnergize(bool apply);
74 void HandleAuraModResistanceExclusive(bool Apply);
75 void HandleAuraSafeFall(bool Apply);
76 void HandleAuraDamageShield(bool Apply);
77 void HandleModStealth(bool Apply);
78 void HandleModDetect(bool Apply);
79 void HandleInvisibility(bool Apply);
80 void HandleInvisibilityDetect(bool Apply);
81 void HandleAuraModTotalHealthPercentRegen(bool Apply);
82 void HandleAuraModTotalManaPercentRegen(bool Apply);
83 void HandleAuraModResistance(bool Apply);
84 void HandleAuraModRoot(bool Apply);
85 void HandleAuraModSilence(bool Apply);
86 void HandleReflectSpells(bool Apply);
87 void HandleAuraModStat(bool Apply);
88 void HandleAuraModIncreaseSpeed(bool Apply);
89 void HandleAuraModIncreaseMountedSpeed(bool Apply);
90 void HandleAuraModDecreaseSpeed(bool Apply);
91 void HandleAuraModIncreaseHealth(bool Apply);
92 void HandleAuraModIncreaseEnergy(bool Apply);
93 void HandleAuraModShapeshift(bool Apply);
94 void HandleAuraModEffectImmunity(bool Apply);
95 void HandleAuraModStateImmunity(bool Apply);
96 void HandleAuraModSchoolImmunity(bool Apply);
97 void HandleAuraModDmgImmunity(bool Apply);
98 void HandleAuraModDispelImmunity(bool Apply);
99 void HandleAuraProcTriggerSpell(bool Apply);
100 void HandleAuraProcTriggerDamage(bool Apply);
101 void HandleAuraTracCreatures(bool Apply);
102 void HandleAuraTracResources(bool Apply);
103 void HandleAuraModParryPercent(bool Apply);
104 void HandleAuraModDodgePercent(bool Apply);
105 void HandleAuraModBlockPercent(bool Apply);
106 void HandleAuraModCritPercent(bool Apply);
107 void HandlePeriodicLeech(bool Apply);
108 void HandleModHitChance(bool Apply);
109 void HandleModSpellHitChance(bool Apply);
110 void HandleAuraModScale(bool Apply);
111 void HandlePeriodicManaLeech(bool Apply);
112 void HandleModCastingSpeed(bool Apply);
113 void HandleAuraMounted(bool Apply);
114 void HandleWaterBreathing(bool apply);
115 void HandleModBaseResistance(bool apply);
116 void HandleModRegen(bool apply);
117 void HandleModPowerRegen(bool apply);
118 void HandleChannelDeathItem(bool apply);
119 void HandleModDamagePCTTaken(bool apply);
120 void HandleModPCTRegen(bool Apply);
121 void HandlePeriodicDamagePCT(bool Apply);
122 void HandleAuraModAttackPower(bool Apply);
123 void HandleAuraTransform(bool Apply);
124 void HandleModSpellCritChance(bool Apply);
125 void HandleAuraModIncreaseSwimSpeed(bool Apply);
126 void HandleModDamageDoneCreature(bool Apply);
127 void HandleAuraManaShield(bool Apply);
128 void HandleAuraSchoolAbsorb(bool Apply);
129 void HandleModSpellCritChanceShool(bool Apply);
130 void HandleModPowerCost(bool Apply);
131 void HandleModPowerCostSchool(bool Apply);
132 void HandleReflectSpellsSchool(bool Apply);
133 void HandleFarSight(bool Apply);
134 void HandleModMechanicImmunity(bool Apply);
135 void HandleAuraModSkill(bool Apply);
136 void HandleModCreatureAttackPower(bool Apply);
137 void HandleModDamagePercentDone(bool Apply);
138 void HandleModPercentStat(bool Apply);
139 void HandleModResistancePercent(bool Apply);
140 void HandleAuraModBaseResistancePCT(bool Apply);
141 void HandleModShieldBlock(bool Apply);
142 void HandleModReputationGain(bool Apply);
143 void HandleForceReaction(bool Apply);
144 void HandleRangedAmmoHaste(bool Apply);
145 void HandleModTotalPercentStat(bool Apply);
147 Aura(SpellEntry* spellproto, uint32 eff, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
148 virtual ~Aura();
150 void SetModifier(uint8 t, int32 a, uint32 pt, int32 miscValue, uint32 miscValue2);
151 Modifier* GetModifier() {return &m_modifier;}
153 SpellEntry* GetSpellProto() const { return sSpellStore.LookupEntry( m_spellId ); }
154 uint32 GetId() const{ return m_spellId; }
155 uint32 GetEffIndex() const{ return m_effIndex; }
156 void SetEffIndex(uint32 eff) { m_effIndex = eff; }
157 int32 GetAuraDuration() const { return m_duration; }
158 void SetAuraDuration(int32 duration) { m_duration = duration; }
159 time_t GetAuraApplyTime() { return m_applyTime; }
160 void UpdateAuraDuration();
162 uint64 const& GetCasterGUID() const { return m_caster_guid; }
163 Unit* GetCaster() const;
164 Unit* GetTarget() const { return m_target; }
165 void SetTarget(Unit* target) { m_target = target; }
167 uint8 GetAuraSlot() const { return m_auraSlot; }
168 void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
170 bool IsPositive() { return m_positive; }
171 void SetNegative() { m_positive = false; }
172 void SetPositive() { m_positive = true; }
174 bool IsPermanent() const { return m_permanent; }
175 void SetPermanent(bool value) { m_permanent = value; }
176 bool IsAreaAura() const { return m_isAreaAura; }
177 bool IsPeriodic() const { return m_isPeriodic; }
178 bool IsTrigger() const { return m_isTrigger; }
179 bool IsPassive() const { return m_isPassive; }
180 bool IsPersistent() const { return m_isPersistent; }
182 virtual void Update(uint32 diff);
183 void ApplyModifier(bool Apply);
185 void _AddAura();
186 void _RemoveAura();
187 uint32 CalculateDamage();
189 void TriggerSpell();
190 void SendCoolDownEvent();
191 bool IsUpdated() { return m_updated; }
192 void SetUpdated(bool val) { m_updated = val; }
193 void SetRemoveOnDeath(bool rod) { m_removeOnDeath = rod; }
194 void DelayPeriodicTimer(int32 delaytime);
196 int32 m_procCharges;
197 int32 m_absorbDmg;
199 protected:
200 Modifier m_modifier;
201 SpellModifier *m_spellmod;
202 uint32 m_spellId;
203 uint32 m_effIndex;
204 //SpellEntry *m_spellProto;
205 uint64 m_caster_guid;
206 Unit* m_target;
207 int32 m_duration;
208 int32 m_timeCla;
209 Item* m_castItem;
210 time_t m_applyTime;
212 uint8 m_auraSlot;
214 bool m_positive;
215 bool m_permanent;
216 bool m_isPeriodic;
217 bool m_isTrigger;
218 bool m_isAreaAura;
219 bool m_isPassive;
220 bool m_isPersistent;
222 int32 m_periodicTimer;
223 uint32 m_PeriodicEventId;
224 bool m_updated;
225 bool m_removeOnDeath;
228 class AreaAura : public Aura
230 public:
231 AreaAura(SpellEntry* spellproto, uint32 eff, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
232 ~AreaAura();
233 void Update(uint32 diff);
236 class PersistentAreaAura : public Aura
238 public:
239 PersistentAreaAura(SpellEntry* spellproto, uint32 eff, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
240 ~PersistentAreaAura();
241 void Update(uint32 diff);
244 typedef void(Aura::*pAuraHandler)(bool Apply);
245 #endif