[sql/updates/2008_11_11_01_mangos_db_script_string.sql sql/updates/2008_11_11_02_mang...
[auctionmangos.git] / src / game / Unit.h
blob3ebab693290e73d1b6835af7ac5955663f2232dd
1 /*
2 * Copyright (C) 2005-2008 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
19 #ifndef __UNIT_H
20 #define __UNIT_H
22 #include "Common.h"
23 #include "Object.h"
24 #include "Opcodes.h"
25 #include "SpellAuraDefines.h"
26 #include "UpdateFields.h"
27 #include "SharedDefines.h"
28 #include "ThreatManager.h"
29 #include "HostilRefManager.h"
30 #include "FollowerReference.h"
31 #include "FollowerRefManager.h"
32 #include "Utilities/EventProcessor.h"
33 #include "MotionMaster.h"
34 #include "Database/DBCStructure.h"
35 #include <list>
37 enum SpellInterruptFlags
39 SPELL_INTERRUPT_FLAG_MOVEMENT = 0x01,
40 SPELL_INTERRUPT_FLAG_DAMAGE = 0x02,
41 SPELL_INTERRUPT_FLAG_INTERRUPT = 0x04,
42 SPELL_INTERRUPT_FLAG_AUTOATTACK = 0x08,
43 //SPELL_INTERRUPT_FLAG_TURNING = 0x10 // not turning - maybe _complete_ interrupt on direct damage?
46 enum SpellChannelInterruptFlags
48 CHANNEL_FLAG_DAMAGE = 0x0002,
49 CHANNEL_FLAG_MOVEMENT = 0x0008,
50 CHANNEL_FLAG_TURNING = 0x0010,
51 CHANNEL_FLAG_DAMAGE2 = 0x0080,
52 CHANNEL_FLAG_DELAY = 0x4000
55 enum SpellAuraInterruptFlags
57 AURA_INTERRUPT_FLAG_UNK0 = 0x00000001, // 0 removed when getting hit by a negative spell?
58 AURA_INTERRUPT_FLAG_DAMAGE = 0x00000002, // 1 removed by any damage
59 AURA_INTERRUPT_FLAG_UNK2 = 0x00000004, // 2
60 AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement
61 AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning
62 AURA_INTERRUPT_FLAG_ENTER_COMBAT = 0x00000020, // 5 removed by entering combat
63 AURA_INTERRUPT_FLAG_NOT_MOUNTED = 0x00000040, // 6 removed by unmounting
64 AURA_INTERRUPT_FLAG_NOT_ABOVEWATER = 0x00000080, // 7 removed by entering water
65 AURA_INTERRUPT_FLAG_NOT_UNDERWATER = 0x00000100, // 8 removed by leaving water
66 AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing
67 AURA_INTERRUPT_FLAG_UNK10 = 0x00000400, // 10
68 AURA_INTERRUPT_FLAG_UNK11 = 0x00000800, // 11
69 AURA_INTERRUPT_FLAG_UNK12 = 0x00001000, // 12 removed by attack?
70 AURA_INTERRUPT_FLAG_UNK13 = 0x00002000, // 13
71 AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14
72 AURA_INTERRUPT_FLAG_UNK15 = 0x00008000, // 15 removed by casting a spell?
73 AURA_INTERRUPT_FLAG_UNK16 = 0x00010000, // 16
74 AURA_INTERRUPT_FLAG_MOUNTING = 0x00020000, // 17 removed by mounting
75 AURA_INTERRUPT_FLAG_NOT_SEATED = 0x00040000, // 18 removed by standing up
76 AURA_INTERRUPT_FLAG_CHANGE_MAP = 0x00080000, // 19 leaving map/getting teleported
77 AURA_INTERRUPT_FLAG_UNK20 = 0x00100000, // 20
78 AURA_INTERRUPT_FLAG_UNK21 = 0x00200000, // 21
79 AURA_INTERRUPT_FLAG_UNK22 = 0x00400000, // 22
80 AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat
81 AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000 // 24 removed by any direct damage
84 enum SpellModOp
86 SPELLMOD_DAMAGE = 0,
87 SPELLMOD_DURATION = 1,
88 SPELLMOD_THREAT = 2,
89 SPELLMOD_EFFECT1 = 3,
90 SPELLMOD_CHARGES = 4,
91 SPELLMOD_RANGE = 5,
92 SPELLMOD_RADIUS = 6,
93 SPELLMOD_CRITICAL_CHANCE = 7,
94 SPELLMOD_ALL_EFFECTS = 8,
95 SPELLMOD_NOT_LOSE_CASTING_TIME = 9,
96 SPELLMOD_CASTING_TIME = 10,
97 SPELLMOD_COOLDOWN = 11,
98 SPELLMOD_EFFECT2 = 12,
99 // spellmod 13 unused
100 SPELLMOD_COST = 14,
101 SPELLMOD_CRIT_DAMAGE_BONUS = 15,
102 SPELLMOD_RESIST_MISS_CHANCE = 16,
103 SPELLMOD_JUMP_TARGETS = 17,
104 SPELLMOD_CHANCE_OF_SUCCESS = 18,
105 SPELLMOD_ACTIVATION_TIME = 19,
106 SPELLMOD_EFFECT_PAST_FIRST = 20,
107 SPELLMOD_CASTING_TIME_OLD = 21,
108 SPELLMOD_DOT = 22,
109 SPELLMOD_EFFECT3 = 23,
110 SPELLMOD_SPELL_BONUS_DAMAGE = 24,
111 // spellmod 25, 26 unused
112 SPELLMOD_MULTIPLE_VALUE = 27,
113 SPELLMOD_RESIST_DISPEL_CHANCE = 28
116 #define MAX_SPELLMOD 32
118 enum SpellFacingFlags
120 SPELL_FACING_FLAG_INFRONT = 0x0001
123 #define BASE_MINDAMAGE 1.0f
124 #define BASE_MAXDAMAGE 2.0f
125 #define BASE_ATTACK_TIME 2000
127 // high byte (3 from 0..3) of UNIT_FIELD_BYTES_2
128 enum ShapeshiftForm
130 FORM_NONE = 0x00,
131 FORM_CAT = 0x01,
132 FORM_TREE = 0x02,
133 FORM_TRAVEL = 0x03,
134 FORM_AQUA = 0x04,
135 FORM_BEAR = 0x05,
136 FORM_AMBIENT = 0x06,
137 FORM_GHOUL = 0x07,
138 FORM_DIREBEAR = 0x08,
139 FORM_CREATUREBEAR = 0x0E,
140 FORM_CREATURECAT = 0x0F,
141 FORM_GHOSTWOLF = 0x10,
142 FORM_BATTLESTANCE = 0x11,
143 FORM_DEFENSIVESTANCE = 0x12,
144 FORM_BERSERKERSTANCE = 0x13,
145 FORM_TEST = 0x14,
146 FORM_ZOMBIE = 0x15,
147 FORM_FLIGHT_EPIC = 0x1B,
148 FORM_SHADOW = 0x1C,
149 FORM_FLIGHT = 0x1D,
150 FORM_STEALTH = 0x1E,
151 FORM_MOONKIN = 0x1F,
152 FORM_SPIRITOFREDEMPTION = 0x20
155 // low byte ( 0 from 0..3 ) of UNIT_FIELD_BYTES_2
156 enum SheathState
158 SHEATH_STATE_UNARMED = 0, // non prepared weapon
159 SHEATH_STATE_MELEE = 1, // prepared melee weapon
160 SHEATH_STATE_RANGED = 2 // prepared ranged weapon
163 // byte (1 from 0..3) of UNIT_FIELD_BYTES_2
164 enum UnitBytes2_Flags
166 UNIT_BYTE2_FLAG_UNK0 = 0x01,
167 UNIT_BYTE2_FLAG_UNK1 = 0x02,
168 UNIT_BYTE2_FLAG_UNK2 = 0x04,
169 UNIT_BYTE2_FLAG_UNK3 = 0x08,
170 UNIT_BYTE2_FLAG_AURAS = 0x10, // show possitive auras as positive, and allow its dispel
171 UNIT_BYTE2_FLAG_UNK5 = 0x20,
172 UNIT_BYTE2_FLAG_UNK6 = 0x40,
173 UNIT_BYTE2_FLAG_UNK7 = 0x80
176 // byte (2 from 0..3) of UNIT_FIELD_BYTES_2
177 enum UnitRename
179 UNIT_RENAME_NOT_ALLOWED = 0x02,
180 UNIT_RENAME_ALLOWED = 0x03
183 #define CREATURE_MAX_SPELLS 4
185 enum Swing
187 NOSWING = 0,
188 SINGLEHANDEDSWING = 1,
189 TWOHANDEDSWING = 2
192 enum VictimState
194 VICTIMSTATE_UNKNOWN1 = 0,
195 VICTIMSTATE_NORMAL = 1,
196 VICTIMSTATE_DODGE = 2,
197 VICTIMSTATE_PARRY = 3,
198 VICTIMSTATE_INTERRUPT = 4,
199 VICTIMSTATE_BLOCKS = 5,
200 VICTIMSTATE_EVADES = 6,
201 VICTIMSTATE_IS_IMMUNE = 7,
202 VICTIMSTATE_DEFLECTS = 8
205 enum HitInfo
207 HITINFO_NORMALSWING = 0x00000000,
208 HITINFO_UNK1 = 0x00000001, // req correct packet structure
209 HITINFO_NORMALSWING2 = 0x00000002,
210 HITINFO_LEFTSWING = 0x00000004,
211 HITINFO_MISS = 0x00000010,
212 HITINFO_ABSORB = 0x00000020, // plays absorb sound
213 HITINFO_RESIST = 0x00000040, // resisted atleast some damage
214 HITINFO_CRITICALHIT = 0x00000080,
215 HITINFO_UNK2 = 0x00000100, // wotlk?
216 HITINFO_UNK3 = 0x00002000, // wotlk?
217 HITINFO_GLANCING = 0x00004000,
218 HITINFO_CRUSHING = 0x00008000,
219 HITINFO_NOACTION = 0x00010000,
220 HITINFO_SWINGNOHITSOUND = 0x00080000
223 //i would like to remove this: (it is defined in item.h
224 enum InventorySlot
226 NULL_BAG = 0,
227 NULL_SLOT = 255
230 struct FactionTemplateEntry;
231 struct Modifier;
232 struct SpellEntry;
233 struct SpellEntryExt;
235 class Aura;
236 class Creature;
237 class Spell;
238 class DynamicObject;
239 class GameObject;
240 class Item;
241 class Pet;
242 class Path;
243 class PetAura;
245 struct SpellImmune
247 uint32 type;
248 uint32 spellId;
251 typedef std::list<SpellImmune> SpellImmuneList;
253 enum UnitModifierType
255 BASE_VALUE = 0,
256 BASE_PCT = 1,
257 TOTAL_VALUE = 2,
258 TOTAL_PCT = 3,
259 MODIFIER_TYPE_END = 4
262 enum WeaponDamageRange
264 MINDAMAGE,
265 MAXDAMAGE
268 enum DamageTypeToSchool
270 RESISTANCE,
271 DAMAGE_DEALT,
272 DAMAGE_TAKEN
275 enum AuraRemoveMode
277 AURA_REMOVE_BY_DEFAULT,
278 AURA_REMOVE_BY_STACK, // at replace by semillar aura
279 AURA_REMOVE_BY_CANCEL,
280 AURA_REMOVE_BY_DISPEL,
281 AURA_REMOVE_BY_DEATH
284 enum UnitMods
286 UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_SPIRIT must be in existed order, it's accessed by index values of Stats enum.
287 UNIT_MOD_STAT_AGILITY,
288 UNIT_MOD_STAT_STAMINA,
289 UNIT_MOD_STAT_INTELLECT,
290 UNIT_MOD_STAT_SPIRIT,
291 UNIT_MOD_HEALTH,
292 UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_HAPPINESS must be in existed order, it's accessed by index values of Powers enum.
293 UNIT_MOD_RAGE,
294 UNIT_MOD_FOCUS,
295 UNIT_MOD_ENERGY,
296 UNIT_MOD_HAPPINESS,
297 UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum.
298 UNIT_MOD_RESISTANCE_HOLY,
299 UNIT_MOD_RESISTANCE_FIRE,
300 UNIT_MOD_RESISTANCE_NATURE,
301 UNIT_MOD_RESISTANCE_FROST,
302 UNIT_MOD_RESISTANCE_SHADOW,
303 UNIT_MOD_RESISTANCE_ARCANE,
304 UNIT_MOD_ATTACK_POWER,
305 UNIT_MOD_ATTACK_POWER_RANGED,
306 UNIT_MOD_DAMAGE_MAINHAND,
307 UNIT_MOD_DAMAGE_OFFHAND,
308 UNIT_MOD_DAMAGE_RANGED,
309 UNIT_MOD_END,
310 // synonyms
311 UNIT_MOD_STAT_START = UNIT_MOD_STAT_STRENGTH,
312 UNIT_MOD_STAT_END = UNIT_MOD_STAT_SPIRIT + 1,
313 UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR,
314 UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1,
315 UNIT_MOD_POWER_START = UNIT_MOD_MANA,
316 UNIT_MOD_POWER_END = UNIT_MOD_HAPPINESS + 1
319 enum BaseModGroup
321 CRIT_PERCENTAGE,
322 RANGED_CRIT_PERCENTAGE,
323 OFFHAND_CRIT_PERCENTAGE,
324 SHIELD_BLOCK_VALUE,
325 BASEMOD_END
328 enum BaseModType
330 FLAT_MOD,
331 PCT_MOD
334 #define MOD_END (PCT_MOD+1)
336 enum DeathState
338 ALIVE = 0,
339 JUST_DIED = 1,
340 CORPSE = 2,
341 DEAD = 3,
342 JUST_ALIVED = 4
345 enum UnitState
347 UNIT_STAT_DIED = 0x0001,
348 UNIT_STAT_MELEE_ATTACKING = 0x0002, // player is melee attacking someone
349 //UNIT_STAT_MELEE_ATTACK_BY = 0x0004, // player is melee attack by someone
350 UNIT_STAT_STUNNED = 0x0008,
351 UNIT_STAT_ROAMING = 0x0010,
352 UNIT_STAT_CHASE = 0x0020,
353 UNIT_STAT_SEARCHING = 0x0040,
354 UNIT_STAT_FLEEING = 0x0080,
355 UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING),
356 UNIT_STAT_IN_FLIGHT = 0x0100, // player is in flight mode
357 UNIT_STAT_FOLLOW = 0x0200,
358 UNIT_STAT_ROOT = 0x0400,
359 UNIT_STAT_CONFUSED = 0x0800,
360 UNIT_STAT_DISTRACTED = 0x1000,
361 UNIT_STAT_ISOLATED = 0x2000, // area auras do not affect other players
362 UNIT_STAT_ATTACK_PLAYER = 0x4000,
363 UNIT_STAT_ALL_STATE = 0xffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT)
366 enum UnitMoveType
368 MOVE_WALK = 0,
369 MOVE_RUN = 1,
370 MOVE_WALKBACK = 2,
371 MOVE_SWIM = 3,
372 MOVE_SWIMBACK = 4,
373 MOVE_TURN = 5,
374 MOVE_FLY = 6,
375 MOVE_FLYBACK = 7
378 #define MAX_MOVE_TYPE 8
380 extern float baseMoveSpeed[MAX_MOVE_TYPE];
382 enum WeaponAttackType
384 BASE_ATTACK = 0,
385 OFF_ATTACK = 1,
386 RANGED_ATTACK = 2
389 #define MAX_ATTACK 3
391 enum CombatRating
393 CR_WEAPON_SKILL = 0,
394 CR_DEFENSE_SKILL = 1,
395 CR_DODGE = 2,
396 CR_PARRY = 3,
397 CR_BLOCK = 4,
398 CR_HIT_MELEE = 5,
399 CR_HIT_RANGED = 6,
400 CR_HIT_SPELL = 7,
401 CR_CRIT_MELEE = 8,
402 CR_CRIT_RANGED = 9,
403 CR_CRIT_SPELL = 10,
404 CR_HIT_TAKEN_MELEE = 11,
405 CR_HIT_TAKEN_RANGED = 12,
406 CR_HIT_TAKEN_SPELL = 13,
407 CR_CRIT_TAKEN_MELEE = 14,
408 CR_CRIT_TAKEN_RANGED = 15,
409 CR_CRIT_TAKEN_SPELL = 16,
410 CR_HASTE_MELEE = 17,
411 CR_HASTE_RANGED = 18,
412 CR_HASTE_SPELL = 19,
413 CR_WEAPON_SKILL_MAINHAND = 20,
414 CR_WEAPON_SKILL_OFFHAND = 21,
415 CR_WEAPON_SKILL_RANGED = 22,
416 CR_EXPERTISE = 23
419 #define MAX_COMBAT_RATING 24
421 enum DamageEffectType
423 DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells)
424 SPELL_DIRECT_DAMAGE = 1, // spell/class abilities damage
425 DOT = 2,
426 HEAL = 3,
427 NODAMAGE = 4, // used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc
428 SELF_DAMAGE = 5
431 enum UnitVisibility
433 VISIBILITY_OFF = 0, // absolute, not detectable, GM-like, can see all other
434 VISIBILITY_ON = 1,
435 VISIBILITY_GROUP_STEALTH = 2, // detect chance, seen and can see group members
436 VISIBILITY_GROUP_INVISIBILITY = 3, // invisibility, can see and can be seen only another invisible unit or invisible detection unit, set only if not stealthed, and in checks not used (mask used instead)
437 VISIBILITY_GROUP_NO_DETECT = 4, // state just at stealth apply for update Grid state. Don't remove, otherwise stealth spells will break
438 VISIBILITY_RESPAWN = 5 // special totally not detectable visibility for force delete object at respawn command
441 // Value masks for UNIT_FIELD_FLAGS
442 enum UnitFlags
444 UNIT_FLAG_UNKNOWN7 = 0x00000001,
445 UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable
446 UNIT_FLAG_DISABLE_MOVE = 0x00000004,
447 UNIT_FLAG_PVP_ATTACKABLE = 0x00000008, // allow apply pvp rules to attackable state in addition to faction dependent state
448 UNIT_FLAG_RENAME = 0x00000010,
449 UNIT_FLAG_PREPARATION = 0x00000020, // don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
450 UNIT_FLAG_UNKNOWN9 = 0x00000040,
451 UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
452 UNIT_FLAG_UNKNOWN2 = 0x00000100, // 2.0.8
453 UNIT_FLAG_UNKNOWN11 = 0x00000200,
454 UNIT_FLAG_LOOTING = 0x00000400, // loot animation
455 UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8
456 UNIT_FLAG_PVP = 0x00001000,
457 UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1
458 UNIT_FLAG_UNKNOWN4 = 0x00004000, // 2.0.8
459 UNIT_FLAG_UNKNOWN13 = 0x00008000,
460 UNIT_FLAG_UNKNOWN14 = 0x00010000,
461 UNIT_FLAG_PACIFIED = 0x00020000,
462 UNIT_FLAG_DISABLE_ROTATE = 0x00040000, // stunned, 2.1.1
463 UNIT_FLAG_IN_COMBAT = 0x00080000,
464 UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // disable casting at client side spell not allowed by taxi flight (mounted?), probably used with 0x4 flag
465 UNIT_FLAG_DISARMED = 0x00200000, // disable melee spells casting..., "Required melee weapon" added to melee spells tooltip.
466 UNIT_FLAG_CONFUSED = 0x00400000,
467 UNIT_FLAG_FLEEING = 0x00800000,
468 UNIT_FLAG_UNKNOWN5 = 0x01000000, // used in spell Eyes of the Beast for pet...
469 UNIT_FLAG_NOT_SELECTABLE = 0x02000000,
470 UNIT_FLAG_SKINNABLE = 0x04000000,
471 UNIT_FLAG_MOUNT = 0x08000000,
472 UNIT_FLAG_UNKNOWN17 = 0x10000000,
473 UNIT_FLAG_UNKNOWN6 = 0x20000000, // used in Feing Death spell
474 UNIT_FLAG_SHEATHE = 0x40000000
477 // Value masks for UNIT_FIELD_FLAGS_2
478 enum UnitFlags2
480 UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
481 UNIT_FLAG2_COMPREHEND_LANG= 0x00000008,
482 UNIT_FLAG2_FORCE_MOVE = 0x00000040
485 /// Non Player Character flags
486 enum NPCFlags
488 UNIT_NPC_FLAG_NONE = 0x00000000,
489 UNIT_NPC_FLAG_GOSSIP = 0x00000001, // 100%
490 UNIT_NPC_FLAG_QUESTGIVER = 0x00000002, // guessed, probably ok
491 UNIT_NPC_FLAG_UNK1 = 0x00000004,
492 UNIT_NPC_FLAG_UNK2 = 0x00000008,
493 UNIT_NPC_FLAG_TRAINER = 0x00000010, // 100%
494 UNIT_NPC_FLAG_TRAINER_CLASS = 0x00000020, // 100%
495 UNIT_NPC_FLAG_TRAINER_PROFESSION = 0x00000040, // 100%
496 UNIT_NPC_FLAG_VENDOR = 0x00000080, // 100%
497 UNIT_NPC_FLAG_VENDOR_AMMO = 0x00000100, // 100%, general goods vendor
498 UNIT_NPC_FLAG_VENDOR_FOOD = 0x00000200, // 100%
499 UNIT_NPC_FLAG_VENDOR_POISON = 0x00000400, // guessed
500 UNIT_NPC_FLAG_VENDOR_REAGENT = 0x00000800, // 100%
501 UNIT_NPC_FLAG_REPAIR = 0x00001000, // 100%
502 UNIT_NPC_FLAG_FLIGHTMASTER = 0x00002000, // 100%
503 UNIT_NPC_FLAG_SPIRITHEALER = 0x00004000, // guessed
504 UNIT_NPC_FLAG_SPIRITGUIDE = 0x00008000, // guessed
505 UNIT_NPC_FLAG_INNKEEPER = 0x00010000, // 100%
506 UNIT_NPC_FLAG_BANKER = 0x00020000, // 100%
507 UNIT_NPC_FLAG_PETITIONER = 0x00040000, // 100% 0xC0000 = guild petitions, 0x40000 = arena team petitions
508 UNIT_NPC_FLAG_TABARDDESIGNER = 0x00080000, // 100%
509 UNIT_NPC_FLAG_BATTLEMASTER = 0x00100000, // 100%
510 UNIT_NPC_FLAG_AUCTIONEER = 0x00200000, // 100%
511 UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
512 UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
513 UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click)
514 UNIT_NPC_FLAG_GUARD = 0x10000000, // custom flag for guards
517 enum MovementFlags
519 MOVEMENTFLAG_NONE = 0x00000000,
520 MOVEMENTFLAG_FORWARD = 0x00000001,
521 MOVEMENTFLAG_BACKWARD = 0x00000002,
522 MOVEMENTFLAG_STRAFE_LEFT = 0x00000004,
523 MOVEMENTFLAG_STRAFE_RIGHT = 0x00000008,
524 MOVEMENTFLAG_LEFT = 0x00000010,
525 MOVEMENTFLAG_RIGHT = 0x00000020,
526 MOVEMENTFLAG_PITCH_UP = 0x00000040,
527 MOVEMENTFLAG_PITCH_DOWN = 0x00000080,
528 MOVEMENTFLAG_WALK_MODE = 0x00000100, // Walking
529 MOVEMENTFLAG_ONTRANSPORT = 0x00000200, // Used for flying on some creatures
530 MOVEMENTFLAG_LEVITATING = 0x00000400,
531 MOVEMENTFLAG_FLY_UNK1 = 0x00000800,
532 MOVEMENTFLAG_JUMPING = 0x00001000,
533 MOVEMENTFLAG_UNK4 = 0x00002000,
534 MOVEMENTFLAG_FALLING = 0x00004000,
535 // 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000
536 MOVEMENTFLAG_SWIMMING = 0x00200000, // appears with fly flag also
537 MOVEMENTFLAG_FLY_UP = 0x00400000,
538 MOVEMENTFLAG_CAN_FLY = 0x00800000,
539 MOVEMENTFLAG_FLYING = 0x01000000,
540 MOVEMENTFLAG_FLYING2 = 0x02000000, // Actual flying mode
541 MOVEMENTFLAG_SPLINE = 0x04000000, // used for flight paths
542 MOVEMENTFLAG_SPLINE2 = 0x08000000, // used for flight paths
543 MOVEMENTFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water
544 MOVEMENTFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive)
545 MOVEMENTFLAG_UNK3 = 0x40000000
548 enum DiminishingLevels
550 DIMINISHING_LEVEL_1 = 0,
551 DIMINISHING_LEVEL_2 = 1,
552 DIMINISHING_LEVEL_3 = 2,
553 DIMINISHING_LEVEL_IMMUNE = 3
556 struct DiminishingReturn
558 DiminishingReturn(DiminishingGroup group, uint32 t, uint32 count) : DRGroup(group), hitTime(t), hitCount(count), stack(0) {}
560 DiminishingGroup DRGroup:16;
561 uint16 stack:16;
562 uint32 hitTime;
563 uint32 hitCount;
566 enum MeleeHitOutcome
568 MELEE_HIT_EVADE, MELEE_HIT_MISS, MELEE_HIT_DODGE, MELEE_HIT_BLOCK, MELEE_HIT_PARRY,
569 MELEE_HIT_GLANCING, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_NORMAL, MELEE_HIT_BLOCK_CRIT
571 struct CleanDamage
573 CleanDamage(uint32 _damage, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
574 damage(_damage), attackType(_attackType), hitOutCome(_hitOutCome) {}
576 uint32 damage;
577 WeaponAttackType attackType;
578 MeleeHitOutcome hitOutCome;
581 struct UnitActionBarEntry
583 uint32 Type;
584 uint32 SpellOrAction;
587 #define MAX_DECLINED_NAME_CASES 5
589 struct DeclinedName
591 std::string name[MAX_DECLINED_NAME_CASES];
594 enum CurrentSpellTypes
596 CURRENT_MELEE_SPELL = 0,
597 CURRENT_FIRST_NON_MELEE_SPELL = 1, // just counter
598 CURRENT_GENERIC_SPELL = 1,
599 CURRENT_AUTOREPEAT_SPELL = 2,
600 CURRENT_CHANNELED_SPELL = 3,
601 CURRENT_MAX_SPELL = 4 // just counter
604 enum ActiveStates
606 ACT_ENABLED = 0xC100,
607 ACT_DISABLED = 0x8100,
608 ACT_COMMAND = 0x0700,
609 ACT_REACTION = 0x0600,
610 ACT_CAST = 0x0100,
611 ACT_PASSIVE = 0x0000,
612 ACT_DECIDE = 0x0001
615 enum ReactStates
617 REACT_PASSIVE = 0,
618 REACT_DEFENSIVE = 1,
619 REACT_AGGRESSIVE = 2
622 enum CommandStates
624 COMMAND_STAY = 0,
625 COMMAND_FOLLOW = 1,
626 COMMAND_ATTACK = 2,
627 COMMAND_ABANDON = 3
630 struct CharmSpellEntry
632 uint16 spellId;
633 uint16 active;
636 struct CharmInfo
638 public:
639 explicit CharmInfo(Unit* unit);
640 uint32 GetPetNumber() const { return m_petnumber; }
641 void SetPetNumber(uint32 petnumber, bool statwindow);
643 void SetCommandState(CommandStates st) { m_CommandState = st; }
644 CommandStates GetCommandState() { return m_CommandState; }
645 bool HasCommandState(CommandStates state) { return (m_CommandState == state); }
646 void SetReactState(ReactStates st) { m_reactState = st; }
647 ReactStates GetReactState() { return m_reactState; }
648 bool HasReactState(ReactStates state) { return (m_reactState == state); }
650 void InitPossessCreateSpells();
651 void InitCharmCreateSpells();
652 void InitPetActionBar();
653 void InitEmptyActionBar();
654 //return true if successful
655 bool AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate = ACT_DECIDE);
656 void ToggleCreatureAutocast(uint32 spellid, bool apply);
658 UnitActionBarEntry* GetActionBarEntry(uint8 index) { return &(PetActionBar[index]); }
659 CharmSpellEntry* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
660 private:
661 Unit* m_unit;
662 UnitActionBarEntry PetActionBar[10];
663 CharmSpellEntry m_charmspells[4];
664 CommandStates m_CommandState;
665 ReactStates m_reactState;
666 uint32 m_petnumber;
669 // for clearing special attacks
670 #define REACTIVE_TIMER_START 4000
672 enum ReactiveType
674 REACTIVE_DEFENSE = 1,
675 REACTIVE_HUNTER_PARRY = 2,
676 REACTIVE_CRIT = 3,
677 REACTIVE_HUNTER_CRIT = 4,
678 REACTIVE_OVERPOWER = 5
681 #define MAX_REACTIVE 6
682 #define MAX_TOTEM 4
684 // delay time next attack to prevent client attack animation problems
685 #define ATTACK_DISPLAY_DELAY 200
687 class MANGOS_DLL_SPEC Unit : public WorldObject
689 public:
690 typedef std::set<Unit*> AttackerSet;
691 typedef std::pair<uint32, uint8> spellEffectPair;
692 typedef std::multimap< spellEffectPair, Aura*> AuraMap;
693 typedef std::list<Aura *> AuraList;
694 typedef std::list<DiminishingReturn> Diminishing;
695 typedef std::set<AuraType> AuraTypeSet;
696 typedef std::set<uint32> ComboPointHolderSet;
698 virtual ~Unit ( );
700 void AddToWorld();
701 void RemoveFromWorld();
703 void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
705 DiminishingLevels GetDiminishing(DiminishingGroup group);
706 void IncrDiminishing(DiminishingGroup group);
707 void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level);
708 void ApplyDiminishingAura(DiminishingGroup group, bool apply);
709 void ClearDiminishings() { m_Diminishing.clear(); }
711 virtual void Update( uint32 time );
713 void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; }
714 void resetAttackTimer(WeaponAttackType type = BASE_ATTACK);
715 uint32 getAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; }
716 bool isAttackReady(WeaponAttackType type = BASE_ATTACK) const { return m_attackTimer[type] == 0; }
717 bool haveOffhandWeapon() const;
718 bool canReachWithAttack(Unit *pVictim) const;
719 uint32 m_extraAttacks;
721 void _addAttacker(Unit *pAttacker) // must be called only from Unit::Attack(Unit*)
723 AttackerSet::iterator itr = m_attackers.find(pAttacker);
724 if(itr == m_attackers.end())
725 m_attackers.insert(pAttacker);
727 void _removeAttacker(Unit *pAttacker) // must be called only from Unit::AttackStop()
729 AttackerSet::iterator itr = m_attackers.find(pAttacker);
730 if(itr != m_attackers.end())
731 m_attackers.erase(itr);
733 Unit * getAttackerForHelper() // If someone wants to help, who to give them
735 if (getVictim() != NULL)
736 return getVictim();
738 if (!m_attackers.empty())
739 return *(m_attackers.begin());
741 return NULL;
743 bool Attack(Unit *victim, bool meleeAttack);
744 void CastStop(uint32 except_spellid = 0);
745 bool AttackStop();
746 void RemoveAllAttackers();
747 AttackerSet const& getAttackers() const { return m_attackers; }
748 bool isAttackingPlayer() const;
749 Unit* getVictim() const { return m_attacking; }
750 void CombatStop(bool cast = false);
751 void CombatStopWithPets(bool cast = false);
752 Unit* SelectNearbyTarget() const;
754 void addUnitState(uint32 f) { m_state |= f; }
755 bool hasUnitState(const uint32 f) const { return (m_state & f); }
756 void clearUnitState(uint32 f) { m_state &= ~f; }
757 bool CanFreeMove() const
759 return !hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_IN_FLIGHT |
760 UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED ) && GetOwnerGUID()==0;
763 uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); }
764 virtual uint32 getLevelForTarget(Unit const* /*target*/) const { return getLevel(); }
765 void SetLevel(uint32 lvl);
766 uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); }
767 uint32 getRaceMask() const { return 1 << (getRace()-1); }
768 uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
769 uint32 getClassMask() const { return 1 << (getClass()-1); }
770 uint8 getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0, 2); }
772 float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); }
773 void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); }
774 uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL) ; }
775 void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); }
777 uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); }
778 void SetResistance(SpellSchools school, int32 val) { SetStatInt32Value(UNIT_FIELD_RESISTANCES+school,val); }
780 uint32 GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH); }
781 uint32 GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH); }
782 void SetHealth( uint32 val);
783 void SetMaxHealth(uint32 val);
784 int32 ModifyHealth(int32 val);
786 Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
787 void setPowerType(Powers power);
788 uint32 GetPower( Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 +power); }
789 uint32 GetMaxPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1+power); }
790 void SetPower( Powers power, uint32 val);
791 void SetMaxPower(Powers power, uint32 val);
792 int32 ModifyPower(Powers power, int32 val);
793 void ApplyPowerMod(Powers power, uint32 val, bool apply);
794 void ApplyMaxPowerMod(Powers power, uint32 val, bool apply);
796 uint32 GetAttackTime(WeaponAttackType att) const { return (uint32)(GetFloatValue(UNIT_FIELD_BASEATTACKTIME+att)/m_modAttackSpeedPct[att]); }
797 void SetAttackTime(WeaponAttackType att, uint32 val) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att,val*m_modAttackSpeedPct[att]); }
798 void ApplyAttackTimePercentMod(WeaponAttackType att,float val, bool apply);
799 void ApplyCastTimePercentMod(float val, bool apply);
801 // faction template id
802 uint32 getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); }
803 void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction ); }
804 FactionTemplateEntry const* getFactionTemplateEntry() const;
805 bool IsHostileTo(Unit const* unit) const;
806 bool IsHostileToPlayers() const;
807 bool IsFriendlyTo(Unit const* unit) const;
808 bool IsNeutralToAll() const;
809 bool IsContestedGuard() const
811 if(FactionTemplateEntry const* entry = getFactionTemplateEntry())
812 return entry->IsContestedGuardFaction();
814 return false;
816 bool IsPvP() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); }
817 void SetPvP(bool state) { if(state) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); else RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); }
818 uint32 GetCreatureType() const;
819 uint32 GetCreatureTypeMask() const
821 uint32 creatureType = GetCreatureType();
822 return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
825 uint8 getStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1, 0); }
826 bool IsSitState() const;
827 bool IsStandState() const;
828 void SetStandState(uint8 state);
830 bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); }
831 uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
832 void Mount(uint32 mount);
833 void Unmount();
835 uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
836 uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss);
837 void DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit = false, bool isTriggeredSpell = false);
838 void DoAttackDamage(Unit *pVictim, uint32 *damage, CleanDamage *cleanDamage, uint32 *blocked_amount, SpellSchoolMask damageSchoolMask, uint32 *hitInfo, VictimState *victimState, uint32 *absorbDamage, uint32 *resistDamage, WeaponAttackType attType, SpellEntry const *spellCasted = NULL, bool isTriggeredSpell = false);
840 void CastMeleeProcDamageAndSpell(Unit* pVictim, uint32 damage, SpellSchoolMask damageSchoolMask, WeaponAttackType attType, MeleeHitOutcome outcome, SpellEntry const *spellCasted = NULL, bool isTriggeredSpell = false);
841 void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 damage = 0, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NONE, SpellEntry const *procSpell = NULL, bool isTriggeredSpell = false, WeaponAttackType attType = BASE_ATTACK);
842 void HandleEmoteCommand(uint32 anim_id);
843 void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false );
845 float MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const;
846 SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell);
847 SpellMissInfo SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool canReflect = false);
849 float GetUnitDodgeChance() const;
850 float GetUnitParryChance() const;
851 float GetUnitBlockChance() const;
852 float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const;
854 virtual uint32 GetShieldBlockValue() const =0;
855 uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
856 uint32 GetDefenseSkillValue(Unit const* target = NULL) const;
857 uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const;
858 float GetWeaponProcChance() const;
859 float GetPPMProcChance(uint32 WeaponSpeed, float PPM) const;
860 MeleeHitOutcome RollPhysicalOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, SpellEntry const *spellInfo);
861 MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType) const;
862 MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance, bool SpellCasted ) const;
864 bool isVendor() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ); }
865 bool isTrainer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER ); }
866 bool isQuestGiver() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ); }
867 bool isGossip() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP ); }
868 bool isTaxi() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER ); }
869 bool isGuildMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PETITIONER ); }
870 bool isBattleMaster() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BATTLEMASTER ); }
871 bool isBanker() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER ); }
872 bool isInnkeeper() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER ); }
873 bool isSpiritHealer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER ); }
874 bool isSpiritGuide() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITGUIDE ); }
875 bool isTabardDesigner()const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TABARDDESIGNER ); }
876 bool isAuctioner() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER ); }
877 bool isArmorer() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_REPAIR ); }
878 bool isServiceProvider() const
880 return HasFlag( UNIT_NPC_FLAGS,
881 UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_FLIGHTMASTER |
882 UNIT_NPC_FLAG_PETITIONER | UNIT_NPC_FLAG_BATTLEMASTER | UNIT_NPC_FLAG_BANKER |
883 UNIT_NPC_FLAG_INNKEEPER | UNIT_NPC_FLAG_GUARD | UNIT_NPC_FLAG_SPIRITHEALER |
884 UNIT_NPC_FLAG_SPIRITGUIDE | UNIT_NPC_FLAG_TABARDDESIGNER | UNIT_NPC_FLAG_AUCTIONEER );
886 bool isSpiritService() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE ); }
888 //Need fix or use this
889 bool isGuard() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GUARD); }
891 bool isInFlight() const { return hasUnitState(UNIT_STAT_IN_FLIGHT); }
893 bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
894 void SetInCombatState(bool PvP);
895 void SetInCombatWith(Unit* enemy);
896 void ClearInCombat();
897 uint32 GetCombatTimer() const { return m_CombatTimer; }
899 bool HasAuraType(AuraType auraType) const;
900 bool HasAura(uint32 spellId, uint32 effIndex) const
901 { return m_Auras.find(spellEffectPair(spellId, effIndex)) != m_Auras.end(); }
903 bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
905 bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
906 bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
907 bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
908 bool isInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT); }
909 bool IsPolymorphed() const;
911 bool isFrozen() const;
913 void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage);
915 bool isTargetableForAttack() const;
916 virtual bool IsInWater() const;
917 virtual bool IsUnderWater() const;
918 bool isInAccessablePlaceFor(Creature const* c) const;
920 void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical = false);
921 void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
922 uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
923 void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
924 void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
925 void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
926 void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
927 void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
928 void CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
930 bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;
932 void DeMorph();
934 void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount);
935 void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false);
936 void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
938 void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
939 void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags);
940 void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 MovementFlags, uint32 transitTime = 0, Player* player = NULL);
941 void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
943 virtual void MoveOutOfRange(Player &) { };
945 bool isAlive() const { return (m_deathState == ALIVE); };
946 bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); };
947 DeathState getDeathState() { return m_deathState; };
948 virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet
950 uint64 const& GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); }
951 uint64 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); }
952 uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); }
953 uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); }
954 void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); }
956 uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); }
957 uint64 GetCharmerOrOwnerOrOwnGUID() const
959 if(uint64 guid = GetCharmerOrOwnerGUID())
960 return guid;
961 return GetGUID();
963 bool isCharmedOwnedByPlayerOrPlayer() const { return IS_PLAYER_GUID(GetCharmerOrOwnerOrOwnGUID()); }
965 Player* GetSpellModOwner();
967 Unit* GetOwner() const;
968 Pet* GetPet() const;
969 Unit* GetCharmer() const;
970 Unit* GetCharm() const;
971 Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); }
972 Unit* GetCharmerOrOwnerOrSelf()
974 if(Unit* u = GetCharmerOrOwner())
975 return u;
977 return this;
979 Player* GetCharmerOrOwnerPlayerOrPlayerItself();
981 void SetPet(Pet* pet);
982 void SetCharm(Unit* pet);
983 bool isCharmed() const { return GetCharmerGUID() != 0; }
985 CharmInfo* GetCharmInfo() { return m_charmInfo; }
986 CharmInfo* InitCharmInfo(Unit* charm);
988 Pet* CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id = 0);
990 bool AddAura(Aura *aur);
992 void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
993 void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL);
994 void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex);
995 void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL);
996 void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
997 void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
998 void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
999 void RemoveAurasDueToSpellByCancel(uint32 spellId);
1000 void RemoveNotOwnSingleTargetAuras();
1002 void RemoveSpellsCausingAura(AuraType auraType);
1003 void RemoveRankAurasDueToSpell(uint32 spellId);
1004 bool RemoveNoStackAurasDueToAura(Aura *Aur);
1005 void RemoveAurasWithInterruptFlags(uint32 flags);
1006 void RemoveAurasWithDispelType( DispelType type );
1008 void RemoveAllAuras();
1009 void RemoveAllAurasOnDeath();
1010 void DelayAura(uint32 spellId, uint32 effindex, int32 delaytime);
1012 float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school ); }
1013 void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school,val); }
1014 void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply) { ApplyModSignedFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); }
1015 void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply) { ApplyPercentModFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); }
1016 void InitStatBuffMods()
1018 for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_POSSTAT0+i, 0);
1019 for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_NEGSTAT0+i, 0);
1021 void ApplyStatBuffMod(Stats stat, float val, bool apply) { ApplyModSignedFloatValue((val > 0 ? UNIT_FIELD_POSSTAT0+stat : UNIT_FIELD_NEGSTAT0+stat), val, apply); }
1022 void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)
1024 ApplyPercentModFloatValue(UNIT_FIELD_POSSTAT0+stat, val, apply);
1025 ApplyPercentModFloatValue(UNIT_FIELD_NEGSTAT0+stat, val, apply);
1027 void SetCreateStat(Stats stat, float val) { m_createStats[stat] = val; }
1028 void SetCreateHealth(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_HEALTH, val); }
1029 uint32 GetCreateHealth() const { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH); }
1030 void SetCreateMana(uint32 val) { SetUInt32Value(UNIT_FIELD_BASE_MANA, val); }
1031 uint32 GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA); }
1032 uint32 GetCreatePowers(Powers power) const;
1033 float GetPosStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_POSSTAT0+stat); }
1034 float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0+stat); }
1035 float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
1037 void SetCurrentCastedSpell(Spell * pSpell);
1038 virtual void ProhibitSpellScholl(SpellSchoolMask /*idSchoolMask*/, uint32 /*unTimeMs*/ ) { }
1039 void InterruptSpell(uint32 spellType, bool withDelayed = true);
1041 // set withDelayed to true to account delayed spells as casted
1042 // delayed+channeled spells are always accounted as casted
1043 // we can skip channeled or delayed checks using flags
1044 bool IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled = false, bool skipAutorepeat = false) const;
1046 // set withDelayed to true to interrupt delayed spells too
1047 // delayed+channeled spells are always interrupted
1048 void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0);
1050 Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
1052 Spell* m_currentSpells[CURRENT_MAX_SPELL];
1054 uint32 m_addDmgOnce;
1055 uint64 m_TotemSlot[MAX_TOTEM];
1056 uint64 m_ObjectSlot[4];
1057 uint32 m_detectInvisibilityMask;
1058 uint32 m_invisibilityMask;
1059 uint32 m_ShapeShiftFormSpellId;
1060 ShapeshiftForm m_form;
1061 float m_modMeleeHitChance;
1062 float m_modRangedHitChance;
1063 float m_modSpellHitChance;
1064 int32 m_baseSpellCritChance;
1066 float m_threatModifier[MAX_SPELL_SCHOOL];
1067 float m_modAttackSpeedPct[3];
1069 // Event handler
1070 EventProcessor m_Events;
1072 // stat system
1073 bool HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply);
1074 void SetModifierValue(UnitMods unitMod, UnitModifierType modifierType, float value) { m_auraModifiersGroup[unitMod][modifierType] = value; }
1075 float GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) const;
1076 float GetTotalStatValue(Stats stat) const;
1077 float GetTotalAuraModValue(UnitMods unitMod) const;
1078 SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const;
1079 Stats GetStatByAuraGroup(UnitMods unitMod) const;
1080 Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const;
1081 bool CanModifyStats() const { return m_canModifyStats; }
1082 void SetCanModifyStats(bool modifyStats) { m_canModifyStats = modifyStats; }
1083 virtual bool UpdateStats(Stats stat) = 0;
1084 virtual bool UpdateAllStats() = 0;
1085 virtual void UpdateResistances(uint32 school) = 0;
1086 virtual void UpdateArmor() = 0;
1087 virtual void UpdateMaxHealth() = 0;
1088 virtual void UpdateMaxPower(Powers power) = 0;
1089 virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0;
1090 virtual void UpdateDamagePhysical(WeaponAttackType attType) = 0;
1091 float GetTotalAttackPowerValue(WeaponAttackType attType) const;
1092 float GetWeaponDamageRange(WeaponAttackType attType ,WeaponDamageRange type) const;
1093 void SetBaseWeaponDamage(WeaponAttackType attType ,WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
1095 bool isInFront(Unit const* target,float distance, float arc = M_PI) const;
1096 void SetInFront(Unit const* target);
1097 bool isInBack(Unit const* target, float distance, float arc = M_PI) const;
1099 // Visibility system
1100 UnitVisibility GetVisibility() const { return m_Visibility; }
1101 void SetVisibility(UnitVisibility x);
1103 // common function for visibility checks for player/creatures with detection code
1104 bool isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList = false) const;
1105 bool canDetectInvisibilityOf(Unit const* u) const;
1107 // virtual functions for all world objects types
1108 bool isVisibleForInState(Player const* u, bool inVisibleList) const;
1109 // function for low level grid visibility checks in player/creature cases
1110 virtual bool IsVisibleInGridForPlayer(Player* pl) const = 0;
1112 bool waterbreath;
1113 AuraList & GetSingleCastAuras() { return m_scAuras; }
1114 AuraList const& GetSingleCastAuras() const { return m_scAuras; }
1115 SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY];
1117 // Threat related methodes
1118 bool CanHaveThreatList() const;
1119 void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
1120 float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
1121 void DeleteThreatList();
1122 bool SelectHostilTarget();
1123 void TauntApply(Unit* pVictim);
1124 void TauntFadeOut(Unit *taunter);
1125 ThreatManager& getThreatManager() { return m_ThreatManager; }
1126 void addHatedBy(HostilReference* pHostilReference) { m_HostilRefManager.insertFirst(pHostilReference); };
1127 void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ }
1128 HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
1130 Aura* GetAura(uint32 spellId, uint32 effindex);
1131 AuraMap & GetAuras() { return m_Auras; }
1132 AuraMap const& GetAuras() const { return m_Auras; }
1133 AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }
1134 void ApplyAuraProcTriggerDamage(Aura* aura, bool apply);
1136 int32 GetTotalAuraModifier(AuraType auratype) const;
1137 float GetTotalAuraMultiplier(AuraType auratype) const;
1138 int32 GetMaxPositiveAuraModifier(AuraType auratype) const;
1139 int32 GetMaxNegativeAuraModifier(AuraType auratype) const;
1141 int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
1142 float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const;
1143 int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
1144 int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
1146 int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
1147 float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const;
1148 int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
1149 int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
1151 Aura* GetDummyAura(uint32 spell_id) const;
1153 uint32 GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }
1154 void SetDisplayId(uint32 modelId);
1155 uint32 GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }
1156 void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); }
1157 void setTransForm(uint32 spellid) { m_transform = spellid;}
1158 uint32 getTransForm() const { return m_transform;}
1159 void AddDynObject(DynamicObject* dynObj);
1160 void RemoveDynObject(uint32 spellid);
1161 void RemoveDynObjectWithGUID(uint64 guid) { m_dynObjGUIDs.remove(guid); }
1162 void RemoveAllDynObjects();
1163 void AddGameObject(GameObject* gameObj);
1164 void RemoveGameObject(GameObject* gameObj, bool del);
1165 void RemoveGameObject(uint32 spellid, bool del);
1166 void RemoveAllGameObjects();
1167 DynamicObject *GetDynObject(uint32 spellId, uint32 effIndex);
1168 DynamicObject *GetDynObject(uint32 spellId);
1169 uint32 CalculateDamage(WeaponAttackType attType, bool normalized);
1170 float GetAPMultiplier(WeaponAttackType attType, bool normalized);
1171 void ModifyAuraState(AuraState flag, bool apply);
1172 bool HasAuraState(AuraState flag) const { return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1)); }
1173 void UnsummonAllTotems();
1174 int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask);
1175 int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask);
1176 int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
1177 int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
1178 uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype);
1179 uint32 SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, Unit *pVictim);
1180 bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType);
1181 uint32 SpellCriticalBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
1183 void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
1184 bool IsUnderLastManaUseEffect() const;
1186 void SetContestedPvP(Player *attackedPlayer = NULL);
1188 void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);
1189 uint32 GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime );
1191 void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
1192 void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply);
1193 virtual bool IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges = false);
1194 // redefined in Creature
1195 bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask, bool useCharges = false);
1196 virtual bool IsImmunedToSpellEffect(uint32 effect, uint32 mechanic) const;
1197 // redefined in Creature
1199 uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage);
1200 void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist);
1202 void UpdateSpeed(UnitMoveType mtype, bool forced);
1203 float GetSpeed( UnitMoveType mtype ) const;
1204 float GetSpeedRate( UnitMoveType mtype ) const { return m_speed_rate[mtype]; }
1205 void SetSpeed(UnitMoveType mtype, float rate, bool forced = false);
1207 void SetHover(bool on);
1208 bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
1210 void _RemoveAllAuraMods();
1211 void _ApplyAllAuraMods();
1213 int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
1214 int32 CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target);
1215 float CalculateLevelPenalty(SpellEntry const* spellProto) const;
1217 void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
1218 void removeFollower(FollowerReference* /*pRef*/ ) { /* nothing to do yet */ }
1219 static Unit* GetUnit(WorldObject& object, uint64 guid);
1221 MotionMaster* GetMotionMaster() { return &i_motionMaster; }
1223 bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING)); }
1224 void StopMoving();
1226 void AddUnitMovementFlag(uint32 f) { m_unit_movement_flags |= f; }
1227 void RemoveUnitMovementFlag(uint32 f)
1229 uint32 oldval = m_unit_movement_flags;
1230 m_unit_movement_flags = oldval & ~f;
1232 uint32 HasUnitMovementFlag(uint32 f) const { return m_unit_movement_flags & f; }
1233 uint32 GetUnitMovementFlags() const { return m_unit_movement_flags; }
1234 void SetUnitMovementFlags(uint32 f) { m_unit_movement_flags = f; }
1236 void SetFeared(bool apply, uint64 casterGUID = 0, uint32 spellID = 0);
1237 void SetConfused(bool apply, uint64 casterGUID = 0, uint32 spellID = 0);
1239 void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); }
1240 void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); }
1241 void ClearComboPointHolders();
1243 ///----------Pet responses methods-----------------
1244 void SendPetCastFail(uint32 spellid, uint8 msg);
1245 void SendPetActionFeedback (uint8 msg);
1246 void SendPetTalk (uint32 pettalk);
1247 void SendPetSpellCooldown (uint32 spellid, time_t cooltime);
1248 void SendPetClearCooldown (uint32 spellid);
1249 void SendPetAIReaction(uint64 guid);
1250 ///----------End of Pet responses methods----------
1252 void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); }
1254 // reactive attacks
1255 void ClearAllReactives();
1256 void StartReactiveTimer( ReactiveType reactive ) { m_reactiveTimer[reactive] = REACTIVE_TIMER_START;}
1257 void UpdateReactives(uint32 p_time);
1259 // group updates
1260 void UpdateAuraForGroup(uint8 slot);
1262 // pet auras
1263 typedef std::set<PetAura const*> PetAuraSet;
1264 PetAuraSet m_petAuras;
1265 void AddPetAura(PetAura const* petSpell);
1266 void RemovePetAura(PetAura const* petSpell);
1268 protected:
1269 explicit Unit ();
1271 void _UpdateSpells(uint32 time);
1273 void _UpdateAutoRepeatSpell();
1274 bool m_AutoRepeatFirstCast;
1276 uint32 m_attackTimer[MAX_ATTACK];
1278 float m_createStats[MAX_STATS];
1280 AttackerSet m_attackers;
1281 Unit* m_attacking;
1283 DeathState m_deathState;
1285 AuraMap m_Auras;
1287 std::list<Aura *> m_scAuras; // casted singlecast auras
1289 typedef std::list<uint64> DynObjectGUIDs;
1290 DynObjectGUIDs m_dynObjGUIDs;
1292 std::list<GameObject*> m_gameObj;
1293 bool m_isSorted;
1294 uint32 m_transform;
1295 uint32 m_removedAuras;
1297 AuraList m_modAuras[TOTAL_AURAS];
1298 float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END];
1299 float m_weaponDamage[MAX_ATTACK][2];
1300 bool m_canModifyStats;
1301 //std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem
1303 float m_speed_rate[MAX_MOVE_TYPE];
1305 CharmInfo *m_charmInfo;
1307 virtual SpellSchoolMask GetMeleeDamageSchoolMask() const;
1309 MotionMaster i_motionMaster;
1310 uint32 m_unit_movement_flags;
1312 uint32 m_reactiveTimer[MAX_REACTIVE];
1314 private:
1315 void SendAttackStop(Unit* victim); // only from AttackStop(Unit*)
1316 void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*)
1318 void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, AuraTypeSet const& procAuraTypes, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage, SpellSchoolMask damageSchoolMask );
1319 bool HandleDummyAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown);
1320 bool HandleProcTriggerSpell(Unit *pVictim,uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags,WeaponAttackType attType,uint32 cooldown);
1321 bool HandleHasteAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown);
1322 bool HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell,uint32 cooldown);
1324 uint32 m_state; // Even derived shouldn't modify
1325 uint32 m_CombatTimer;
1326 uint32 m_lastManaUse; // msecs
1328 UnitVisibility m_Visibility;
1330 Diminishing m_Diminishing;
1331 // Manage all Units threatening us
1332 ThreatManager m_ThreatManager;
1333 // Manage all Units that are threatened by us
1334 HostilRefManager m_HostilRefManager;
1336 FollowerRefManager m_FollowingRefManager;
1338 ComboPointHolderSet m_ComboPointHolders;
1340 #endif