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
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"
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
87 SPELLMOD_DURATION
= 1,
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,
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,
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
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,
147 FORM_FLIGHT_EPIC
= 0x1B,
152 FORM_SPIRITOFREDEMPTION
= 0x20
155 // low byte ( 0 from 0..3 ) of UNIT_FIELD_BYTES_2
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_PVP
= 0x01,
167 UNIT_BYTE2_FLAG_UNK1
= 0x02,
168 UNIT_BYTE2_FLAG_FFA_PVP
= 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
179 UNIT_RENAME_NOT_ALLOWED
= 0x02,
180 UNIT_RENAME_ALLOWED
= 0x03
183 #define CREATURE_MAX_SPELLS 4
188 SINGLEHANDEDSWING
= 1,
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
207 HITINFO_NORMALSWING
= 0x00000000,
208 HITINFO_UNK1
= 0x00000001, // req correct packet structure
209 HITINFO_NORMALSWING2
= 0x00000002,
210 HITINFO_LEFTSWING
= 0x00000004,
211 HITINFO_UNK2
= 0x00000008,
212 HITINFO_MISS
= 0x00000010,
213 HITINFO_ABSORB
= 0x00000020, // absorbed damage
214 HITINFO_ABSORB2
= 0x00000040, // absorbed damage
215 HITINFO_RESIST
= 0x00000080, // resisted atleast some damage
216 HITINFO_RESIST2
= 0x00000100, // resisted atleast some damage
217 HITINFO_CRITICALHIT
= 0x00000200, // critical hit
221 HITINFO_BLOCK
= 0x00002000, // blocked damage
224 HITINFO_GLANCING
= 0x00010000,
225 HITINFO_CRUSHING
= 0x00020000,
226 HITINFO_NOACTION
= 0x00040000, // guessed
229 HITINFO_SWINGNOHITSOUND
= 0x00200000, // guessed
231 HITINFO_UNK3
= 0x00800000
234 //i would like to remove this: (it is defined in item.h
241 struct FactionTemplateEntry
;
244 struct SpellEntryExt
;
262 typedef std::list
<SpellImmune
> SpellImmuneList
;
264 enum UnitModifierType
270 MODIFIER_TYPE_END
= 4
273 enum WeaponDamageRange
279 enum DamageTypeToSchool
288 AURA_REMOVE_BY_DEFAULT
,
289 AURA_REMOVE_BY_STACK
, // at replace by semillar aura
290 AURA_REMOVE_BY_CANCEL
,
291 AURA_REMOVE_BY_DISPEL
,
297 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.
298 UNIT_MOD_STAT_AGILITY
,
299 UNIT_MOD_STAT_STAMINA
,
300 UNIT_MOD_STAT_INTELLECT
,
301 UNIT_MOD_STAT_SPIRIT
,
303 UNIT_MOD_MANA
, // UNIT_MOD_MANA..UNIT_MOD_HAPPINESS must be in existed order, it's accessed by index values of Powers enum.
308 UNIT_MOD_ARMOR
, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum.
309 UNIT_MOD_RESISTANCE_HOLY
,
310 UNIT_MOD_RESISTANCE_FIRE
,
311 UNIT_MOD_RESISTANCE_NATURE
,
312 UNIT_MOD_RESISTANCE_FROST
,
313 UNIT_MOD_RESISTANCE_SHADOW
,
314 UNIT_MOD_RESISTANCE_ARCANE
,
315 UNIT_MOD_ATTACK_POWER
,
316 UNIT_MOD_ATTACK_POWER_RANGED
,
317 UNIT_MOD_DAMAGE_MAINHAND
,
318 UNIT_MOD_DAMAGE_OFFHAND
,
319 UNIT_MOD_DAMAGE_RANGED
,
322 UNIT_MOD_STAT_START
= UNIT_MOD_STAT_STRENGTH
,
323 UNIT_MOD_STAT_END
= UNIT_MOD_STAT_SPIRIT
+ 1,
324 UNIT_MOD_RESISTANCE_START
= UNIT_MOD_ARMOR
,
325 UNIT_MOD_RESISTANCE_END
= UNIT_MOD_RESISTANCE_ARCANE
+ 1,
326 UNIT_MOD_POWER_START
= UNIT_MOD_MANA
,
327 UNIT_MOD_POWER_END
= UNIT_MOD_HAPPINESS
+ 1
333 RANGED_CRIT_PERCENTAGE
,
334 OFFHAND_CRIT_PERCENTAGE
,
345 #define MOD_END (PCT_MOD+1)
358 UNIT_STAT_DIED
= 0x0001,
359 UNIT_STAT_MELEE_ATTACKING
= 0x0002, // player is melee attacking someone
360 //UNIT_STAT_MELEE_ATTACK_BY = 0x0004, // player is melee attack by someone
361 UNIT_STAT_STUNNED
= 0x0008,
362 UNIT_STAT_ROAMING
= 0x0010,
363 UNIT_STAT_CHASE
= 0x0020,
364 UNIT_STAT_SEARCHING
= 0x0040,
365 UNIT_STAT_FLEEING
= 0x0080,
366 UNIT_STAT_MOVING
= (UNIT_STAT_ROAMING
| UNIT_STAT_CHASE
| UNIT_STAT_SEARCHING
| UNIT_STAT_FLEEING
),
367 UNIT_STAT_IN_FLIGHT
= 0x0100, // player is in flight mode
368 UNIT_STAT_FOLLOW
= 0x0200,
369 UNIT_STAT_ROOT
= 0x0400,
370 UNIT_STAT_CONFUSED
= 0x0800,
371 UNIT_STAT_DISTRACTED
= 0x1000,
372 UNIT_STAT_ISOLATED
= 0x2000, // area auras do not affect other players
373 UNIT_STAT_ATTACK_PLAYER
= 0x4000,
374 UNIT_STAT_ALL_STATE
= 0xffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT)
390 #define MAX_MOVE_TYPE 9
392 extern float baseMoveSpeed
[MAX_MOVE_TYPE
];
394 enum WeaponAttackType
406 CR_DEFENSE_SKILL
= 1,
416 CR_HIT_TAKEN_MELEE
= 11,
417 CR_HIT_TAKEN_RANGED
= 12,
418 CR_HIT_TAKEN_SPELL
= 13,
419 CR_CRIT_TAKEN_MELEE
= 14,
420 CR_CRIT_TAKEN_RANGED
= 15,
421 CR_CRIT_TAKEN_SPELL
= 16,
423 CR_HASTE_RANGED
= 18,
425 CR_WEAPON_SKILL_MAINHAND
= 20,
426 CR_WEAPON_SKILL_OFFHAND
= 21,
427 CR_WEAPON_SKILL_RANGED
= 22,
429 CR_ARMOR_PENETRATION
= 24
432 #define MAX_COMBAT_RATING 25
434 enum DamageEffectType
436 DIRECT_DAMAGE
= 0, // used for normal weapon damage (not for class abilities or spells)
437 SPELL_DIRECT_DAMAGE
= 1, // spell/class abilities damage
440 NODAMAGE
= 4, // used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc
446 VISIBILITY_OFF
= 0, // absolute, not detectable, GM-like, can see all other
448 VISIBILITY_GROUP_STEALTH
= 2, // detect chance, seen and can see group members
449 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)
450 VISIBILITY_GROUP_NO_DETECT
= 4, // state just at stealth apply for update Grid state. Don't remove, otherwise stealth spells will break
451 VISIBILITY_RESPAWN
= 5 // special totally not detectable visibility for force delete object at respawn command
454 // Value masks for UNIT_FIELD_FLAGS
457 UNIT_FLAG_UNKNOWN7
= 0x00000001,
458 UNIT_FLAG_NON_ATTACKABLE
= 0x00000002, // not attackable
459 UNIT_FLAG_DISABLE_MOVE
= 0x00000004,
460 UNIT_FLAG_PVP_ATTACKABLE
= 0x00000008, // allow apply pvp rules to attackable state in addition to faction dependent state
461 UNIT_FLAG_RENAME
= 0x00000010,
462 UNIT_FLAG_PREPARATION
= 0x00000020, // don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
463 UNIT_FLAG_UNKNOWN9
= 0x00000040,
464 UNIT_FLAG_NOT_ATTACKABLE_1
= 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
465 UNIT_FLAG_UNKNOWN2
= 0x00000100, // 2.0.8
466 UNIT_FLAG_UNKNOWN11
= 0x00000200, // 3.0.3 - makes you unable to attack everything
467 UNIT_FLAG_LOOTING
= 0x00000400, // loot animation
468 UNIT_FLAG_PET_IN_COMBAT
= 0x00000800, // in combat?, 2.0.8
469 UNIT_FLAG_PVP
= 0x00001000, // changed in 3.0.3
470 UNIT_FLAG_SILENCED
= 0x00002000, // silenced, 2.1.1
471 UNIT_FLAG_UNKNOWN4
= 0x00004000, // 2.0.8
472 UNIT_FLAG_UNKNOWN13
= 0x00008000,
473 UNIT_FLAG_UNKNOWN14
= 0x00010000,
474 UNIT_FLAG_PACIFIED
= 0x00020000, // 3.0.3 ok
475 UNIT_FLAG_STUNNED
= 0x00040000, // 3.0.3 ok
476 UNIT_FLAG_IN_COMBAT
= 0x00080000,
477 UNIT_FLAG_TAXI_FLIGHT
= 0x00100000, // disable casting at client side spell not allowed by taxi flight (mounted?), probably used with 0x4 flag
478 UNIT_FLAG_DISARMED
= 0x00200000, // 3.0.3, disable melee spells casting..., "Required melee weapon" added to melee spells tooltip.
479 UNIT_FLAG_CONFUSED
= 0x00400000,
480 UNIT_FLAG_FLEEING
= 0x00800000,
481 UNIT_FLAG_UNKNOWN5
= 0x01000000, // used in spell Eyes of the Beast for pet...
482 UNIT_FLAG_NOT_SELECTABLE
= 0x02000000,
483 UNIT_FLAG_SKINNABLE
= 0x04000000,
484 UNIT_FLAG_MOUNT
= 0x08000000,
485 UNIT_FLAG_UNKNOWN17
= 0x10000000,
486 UNIT_FLAG_UNKNOWN6
= 0x20000000, // used in Feing Death spell
487 UNIT_FLAG_SHEATHE
= 0x40000000
490 // Value masks for UNIT_FIELD_FLAGS_2
493 UNIT_FLAG2_FEIGN_DEATH
= 0x00000001,
494 UNIT_FLAG2_COMPREHEND_LANG
= 0x00000008,
495 UNIT_FLAG2_FORCE_MOVE
= 0x00000040,
496 UNIT_FLAG2_UNKNOWN1
= 0x00000800
499 /// Non Player Character flags
502 UNIT_NPC_FLAG_NONE
= 0x00000000,
503 UNIT_NPC_FLAG_GOSSIP
= 0x00000001, // 100%
504 UNIT_NPC_FLAG_QUESTGIVER
= 0x00000002, // guessed, probably ok
505 UNIT_NPC_FLAG_UNK1
= 0x00000004,
506 UNIT_NPC_FLAG_UNK2
= 0x00000008,
507 UNIT_NPC_FLAG_TRAINER
= 0x00000010, // 100%
508 UNIT_NPC_FLAG_TRAINER_CLASS
= 0x00000020, // 100%
509 UNIT_NPC_FLAG_TRAINER_PROFESSION
= 0x00000040, // 100%
510 UNIT_NPC_FLAG_VENDOR
= 0x00000080, // 100%
511 UNIT_NPC_FLAG_VENDOR_AMMO
= 0x00000100, // 100%, general goods vendor
512 UNIT_NPC_FLAG_VENDOR_FOOD
= 0x00000200, // 100%
513 UNIT_NPC_FLAG_VENDOR_POISON
= 0x00000400, // guessed
514 UNIT_NPC_FLAG_VENDOR_REAGENT
= 0x00000800, // 100%
515 UNIT_NPC_FLAG_REPAIR
= 0x00001000, // 100%
516 UNIT_NPC_FLAG_FLIGHTMASTER
= 0x00002000, // 100%
517 UNIT_NPC_FLAG_SPIRITHEALER
= 0x00004000, // guessed
518 UNIT_NPC_FLAG_SPIRITGUIDE
= 0x00008000, // guessed
519 UNIT_NPC_FLAG_INNKEEPER
= 0x00010000, // 100%
520 UNIT_NPC_FLAG_BANKER
= 0x00020000, // 100%
521 UNIT_NPC_FLAG_PETITIONER
= 0x00040000, // 100% 0xC0000 = guild petitions, 0x40000 = arena team petitions
522 UNIT_NPC_FLAG_TABARDDESIGNER
= 0x00080000, // 100%
523 UNIT_NPC_FLAG_BATTLEMASTER
= 0x00100000, // 100%
524 UNIT_NPC_FLAG_AUCTIONEER
= 0x00200000, // 100%
525 UNIT_NPC_FLAG_STABLEMASTER
= 0x00400000, // 100%
526 UNIT_NPC_FLAG_GUILD_BANKER
= 0x00800000, // cause client to send 997 opcode
527 UNIT_NPC_FLAG_SPELLCLICK
= 0x01000000, // cause client to send 1015 opcode (spell click)
528 UNIT_NPC_FLAG_GUARD
= 0x10000000, // custom flag for guards
533 MOVEMENTFLAG_NONE
= 0x00000000,
534 MOVEMENTFLAG_FORWARD
= 0x00000001,
535 MOVEMENTFLAG_BACKWARD
= 0x00000002,
536 MOVEMENTFLAG_STRAFE_LEFT
= 0x00000004,
537 MOVEMENTFLAG_STRAFE_RIGHT
= 0x00000008,
538 MOVEMENTFLAG_LEFT
= 0x00000010,
539 MOVEMENTFLAG_RIGHT
= 0x00000020,
540 MOVEMENTFLAG_PITCH_UP
= 0x00000040,
541 MOVEMENTFLAG_PITCH_DOWN
= 0x00000080,
542 MOVEMENTFLAG_WALK_MODE
= 0x00000100, // Walking
543 MOVEMENTFLAG_ONTRANSPORT
= 0x00000200, // Used for flying on some creatures
544 MOVEMENTFLAG_LEVITATING
= 0x00000400,
545 MOVEMENTFLAG_FLY_UNK1
= 0x00000800,
546 MOVEMENTFLAG_JUMPING
= 0x00001000,
547 MOVEMENTFLAG_UNK4
= 0x00002000,
548 MOVEMENTFLAG_FALLING
= 0x00004000,
549 // 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000
550 MOVEMENTFLAG_SWIMMING
= 0x00200000, // appears with fly flag also
551 MOVEMENTFLAG_FLY_UP
= 0x00400000,
552 MOVEMENTFLAG_CAN_FLY
= 0x00800000,
553 MOVEMENTFLAG_FLYING
= 0x01000000,
554 MOVEMENTFLAG_FLYING2
= 0x02000000, // Actual flying mode
555 MOVEMENTFLAG_SPLINE
= 0x04000000, // used for flight paths
556 MOVEMENTFLAG_SPLINE2
= 0x08000000, // used for flight paths
557 MOVEMENTFLAG_WATERWALKING
= 0x10000000, // prevent unit from falling through water
558 MOVEMENTFLAG_SAFE_FALL
= 0x20000000, // active rogue safe fall spell (passive)
559 MOVEMENTFLAG_UNK3
= 0x40000000
562 enum DiminishingLevels
564 DIMINISHING_LEVEL_1
= 0,
565 DIMINISHING_LEVEL_2
= 1,
566 DIMINISHING_LEVEL_3
= 2,
567 DIMINISHING_LEVEL_IMMUNE
= 3
570 struct DiminishingReturn
572 DiminishingReturn(DiminishingGroup group
, uint32 t
, uint32 count
) : DRGroup(group
), hitTime(t
), hitCount(count
), stack(0) {}
574 DiminishingGroup DRGroup
:16;
582 MELEE_HIT_EVADE
, MELEE_HIT_MISS
, MELEE_HIT_DODGE
, MELEE_HIT_BLOCK
, MELEE_HIT_PARRY
,
583 MELEE_HIT_GLANCING
, MELEE_HIT_CRIT
, MELEE_HIT_CRUSHING
, MELEE_HIT_NORMAL
, MELEE_HIT_BLOCK_CRIT
587 CleanDamage(uint32 _damage
, WeaponAttackType _attackType
, MeleeHitOutcome _hitOutCome
) :
588 damage(_damage
), attackType(_attackType
), hitOutCome(_hitOutCome
) {}
591 WeaponAttackType attackType
;
592 MeleeHitOutcome hitOutCome
;
595 struct UnitActionBarEntry
601 uint16 SpellOrAction
;
611 #define MAX_DECLINED_NAME_CASES 5
615 std::string name
[MAX_DECLINED_NAME_CASES
];
618 enum CurrentSpellTypes
620 CURRENT_MELEE_SPELL
= 0,
621 CURRENT_FIRST_NON_MELEE_SPELL
= 1, // just counter
622 CURRENT_GENERIC_SPELL
= 1,
623 CURRENT_AUTOREPEAT_SPELL
= 2,
624 CURRENT_CHANNELED_SPELL
= 3,
625 CURRENT_MAX_SPELL
= 4 // just counter
630 ACT_PASSIVE
= 0x0100, // 0x0100 - passive
631 ACT_DISABLED
= 0x8100, // 0x8000 - castable
632 ACT_ENABLED
= 0xC100, // 0x4000 | 0x8000 - auto cast + castable
633 ACT_COMMAND
= 0x0700, // 0x0100 | 0x0200 | 0x0400
634 ACT_REACTION
= 0x0600, // 0x0200 | 0x0400
635 ACT_DECIDE
= 0x0001 // what is it?
653 struct CharmSpellEntry
662 explicit CharmInfo(Unit
* unit
);
663 uint32
GetPetNumber() const { return m_petnumber
; }
664 void SetPetNumber(uint32 petnumber
, bool statwindow
);
666 void SetCommandState(CommandStates st
) { m_CommandState
= st
; }
667 CommandStates
GetCommandState() { return m_CommandState
; }
668 bool HasCommandState(CommandStates state
) { return (m_CommandState
== state
); }
669 void SetReactState(ReactStates st
) { m_reactState
= st
; }
670 ReactStates
GetReactState() { return m_reactState
; }
671 bool HasReactState(ReactStates state
) { return (m_reactState
== state
); }
673 void InitPossessCreateSpells();
674 void InitCharmCreateSpells();
675 void InitPetActionBar();
676 void InitEmptyActionBar();
677 //return true if successful
678 bool AddSpellToAB(uint32 oldid
, uint32 newid
, ActiveStates newstate
= ACT_DECIDE
);
679 void ToggleCreatureAutocast(uint32 spellid
, bool apply
);
681 UnitActionBarEntry
* GetActionBarEntry(uint8 index
) { return &(PetActionBar
[index
]); }
682 CharmSpellEntry
* GetCharmSpell(uint8 index
) { return &(m_charmspells
[index
]); }
685 UnitActionBarEntry PetActionBar
[10];
686 CharmSpellEntry m_charmspells
[4];
687 CommandStates m_CommandState
;
688 ReactStates m_reactState
;
692 // for clearing special attacks
693 #define REACTIVE_TIMER_START 4000
697 REACTIVE_DEFENSE
= 1,
698 REACTIVE_HUNTER_PARRY
= 2,
700 REACTIVE_HUNTER_CRIT
= 4,
701 REACTIVE_OVERPOWER
= 5
704 #define MAX_REACTIVE 6
707 // delay time next attack to prevent client attack animation problems
708 #define ATTACK_DISPLAY_DELAY 200
710 class MANGOS_DLL_SPEC Unit
: public WorldObject
713 typedef std::set
<Unit
*> AttackerSet
;
714 typedef std::pair
<uint32
, uint8
> spellEffectPair
;
715 typedef std::multimap
< spellEffectPair
, Aura
*> AuraMap
;
716 typedef std::list
<Aura
*> AuraList
;
717 typedef std::list
<DiminishingReturn
> Diminishing
;
718 typedef std::set
<AuraType
> AuraTypeSet
;
719 typedef std::set
<uint32
> ComboPointHolderSet
;
720 typedef std::map
<uint8
, uint32
> VisibleAuraMap
;
725 void RemoveFromWorld();
727 void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
729 DiminishingLevels
GetDiminishing(DiminishingGroup group
);
730 void IncrDiminishing(DiminishingGroup group
);
731 void ApplyDiminishingToDuration(DiminishingGroup group
, int32
&duration
,Unit
* caster
, DiminishingLevels Level
);
732 void ApplyDiminishingAura(DiminishingGroup group
, bool apply
);
733 void ClearDiminishings() { m_Diminishing
.clear(); }
735 virtual void Update( uint32 time
);
737 void setAttackTimer(WeaponAttackType type
, uint32 time
) { m_attackTimer
[type
] = time
; }
738 void resetAttackTimer(WeaponAttackType type
= BASE_ATTACK
);
739 uint32
getAttackTimer(WeaponAttackType type
) const { return m_attackTimer
[type
]; }
740 bool isAttackReady(WeaponAttackType type
= BASE_ATTACK
) const { return m_attackTimer
[type
] == 0; }
741 bool haveOffhandWeapon() const;
742 bool canReachWithAttack(Unit
*pVictim
) const;
743 uint32 m_extraAttacks
;
745 void _addAttacker(Unit
*pAttacker
) // must be called only from Unit::Attack(Unit*)
747 AttackerSet::iterator itr
= m_attackers
.find(pAttacker
);
748 if(itr
== m_attackers
.end())
749 m_attackers
.insert(pAttacker
);
751 void _removeAttacker(Unit
*pAttacker
) // must be called only from Unit::AttackStop()
753 AttackerSet::iterator itr
= m_attackers
.find(pAttacker
);
754 if(itr
!= m_attackers
.end())
755 m_attackers
.erase(itr
);
757 Unit
* getAttackerForHelper() // If someone wants to help, who to give them
759 if (getVictim() != NULL
)
762 if (!m_attackers
.empty())
763 return *(m_attackers
.begin());
767 bool Attack(Unit
*victim
, bool meleeAttack
);
768 void CastStop(uint32 except_spellid
= 0);
770 void RemoveAllAttackers();
771 AttackerSet
const& getAttackers() const { return m_attackers
; }
772 bool isAttackingPlayer() const;
773 Unit
* getVictim() const { return m_attacking
; }
774 void CombatStop(bool cast
= false);
775 void CombatStopWithPets(bool cast
= false);
776 Unit
* SelectNearbyTarget() const;
778 void addUnitState(uint32 f
) { m_state
|= f
; }
779 bool hasUnitState(const uint32 f
) const { return (m_state
& f
); }
780 void clearUnitState(uint32 f
) { m_state
&= ~f
; }
781 bool CanFreeMove() const
783 return !hasUnitState(UNIT_STAT_CONFUSED
| UNIT_STAT_FLEEING
| UNIT_STAT_IN_FLIGHT
|
784 UNIT_STAT_ROOT
| UNIT_STAT_STUNNED
| UNIT_STAT_DISTRACTED
) && GetOwnerGUID()==0;
787 uint32
getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL
); }
788 virtual uint32
getLevelForTarget(Unit
const* /*target*/) const { return getLevel(); }
789 void SetLevel(uint32 lvl
);
790 uint8
getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0
, 0); }
791 uint32
getRaceMask() const { return 1 << (getRace()-1); }
792 uint8
getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0
, 1); }
793 uint32
getClassMask() const { return 1 << (getClass()-1); }
794 uint8
getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0
, 2); }
796 float GetStat(Stats stat
) const { return float(GetUInt32Value(UNIT_FIELD_STAT0
+stat
)); }
797 void SetStat(Stats stat
, int32 val
) { SetStatInt32Value(UNIT_FIELD_STAT0
+stat
, val
); }
798 uint32
GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL
) ; }
799 void SetArmor(int32 val
) { SetResistance(SPELL_SCHOOL_NORMAL
, val
); }
801 uint32
GetResistance(SpellSchools school
) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES
+school
); }
802 void SetResistance(SpellSchools school
, int32 val
) { SetStatInt32Value(UNIT_FIELD_RESISTANCES
+school
,val
); }
804 uint32
GetHealth() const { return GetUInt32Value(UNIT_FIELD_HEALTH
); }
805 uint32
GetMaxHealth() const { return GetUInt32Value(UNIT_FIELD_MAXHEALTH
); }
806 void SetHealth( uint32 val
);
807 void SetMaxHealth(uint32 val
);
808 int32
ModifyHealth(int32 val
);
810 Powers
getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0
, 3)); }
811 void setPowerType(Powers power
);
812 uint32
GetPower( Powers power
) const { return GetUInt32Value(UNIT_FIELD_POWER1
+power
); }
813 uint32
GetMaxPower(Powers power
) const { return GetUInt32Value(UNIT_FIELD_MAXPOWER1
+power
); }
814 void SetPower( Powers power
, uint32 val
);
815 void SetMaxPower(Powers power
, uint32 val
);
816 int32
ModifyPower(Powers power
, int32 val
);
817 void ApplyPowerMod(Powers power
, uint32 val
, bool apply
);
818 void ApplyMaxPowerMod(Powers power
, uint32 val
, bool apply
);
820 uint32
GetAttackTime(WeaponAttackType att
) const { return (uint32
)(GetFloatValue(UNIT_FIELD_BASEATTACKTIME
+att
)/m_modAttackSpeedPct
[att
]); }
821 void SetAttackTime(WeaponAttackType att
, uint32 val
) { SetFloatValue(UNIT_FIELD_BASEATTACKTIME
+att
,val
*m_modAttackSpeedPct
[att
]); }
822 void ApplyAttackTimePercentMod(WeaponAttackType att
,float val
, bool apply
);
823 void ApplyCastTimePercentMod(float val
, bool apply
);
825 // faction template id
826 uint32
getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
); }
827 void setFaction(uint32 faction
) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE
, faction
); }
828 FactionTemplateEntry
const* getFactionTemplateEntry() const;
829 bool IsHostileTo(Unit
const* unit
) const;
830 bool IsHostileToPlayers() const;
831 bool IsFriendlyTo(Unit
const* unit
) const;
832 bool IsNeutralToAll() const;
833 bool IsContestedGuard() const
835 if(FactionTemplateEntry
const* entry
= getFactionTemplateEntry())
836 return entry
->IsContestedGuardFaction();
840 bool IsPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2
, 1, UNIT_BYTE2_FLAG_PVP
); }
841 void SetPvP(bool state
)
844 SetByteFlag(UNIT_FIELD_BYTES_2
, 1, UNIT_BYTE2_FLAG_PVP
);
846 RemoveByteFlag(UNIT_FIELD_BYTES_2
, 1, UNIT_BYTE2_FLAG_PVP
);
848 uint32
GetCreatureType() const;
849 uint32
GetCreatureTypeMask() const
851 uint32 creatureType
= GetCreatureType();
852 return (creatureType
>= 1) ? (1 << (creatureType
- 1)) : 0;
855 uint8
getStandState() const { return GetByteValue(UNIT_FIELD_BYTES_1
, 0); }
856 bool IsSitState() const;
857 bool IsStandState() const;
858 void SetStandState(uint8 state
);
860 bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_MOUNT
); }
861 uint32
GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID
); }
862 void Mount(uint32 mount
);
865 uint16
GetMaxSkillValueForLevel(Unit
const* target
= NULL
) const { return (target
? getLevelForTarget(target
) : getLevel()) * 5; }
866 uint32
DealDamage(Unit
*pVictim
, uint32 damage
, CleanDamage
const* cleanDamage
, DamageEffectType damagetype
, SpellSchoolMask damageSchoolMask
, SpellEntry
const *spellProto
, bool durabilityLoss
);
867 void DealFlatDamage(Unit
*pVictim
, SpellEntry
const *spellInfo
, uint32
*damage
, CleanDamage
*cleanDamage
, bool *crit
= false, bool isTriggeredSpell
= false);
868 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);
870 void CastMeleeProcDamageAndSpell(Unit
* pVictim
, uint32 damage
, SpellSchoolMask damageSchoolMask
, WeaponAttackType attType
, MeleeHitOutcome outcome
, SpellEntry
const *spellCasted
= NULL
, bool isTriggeredSpell
= false);
871 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
);
872 void HandleEmoteCommand(uint32 anim_id
);
873 void AttackerStateUpdate (Unit
*pVictim
, WeaponAttackType attType
= BASE_ATTACK
, bool extra
= false );
875 float MeleeMissChanceCalc(const Unit
*pVictim
, WeaponAttackType attType
) const;
876 SpellMissInfo
MagicSpellHitResult(Unit
*pVictim
, SpellEntry
const *spell
);
877 SpellMissInfo
SpellHitResult(Unit
*pVictim
, SpellEntry
const *spell
, bool canReflect
= false);
879 float GetUnitDodgeChance() const;
880 float GetUnitParryChance() const;
881 float GetUnitBlockChance() const;
882 float GetUnitCriticalChance(WeaponAttackType attackType
, const Unit
*pVictim
) const;
884 virtual uint32
GetShieldBlockValue() const =0;
885 uint32
GetUnitMeleeSkill(Unit
const* target
= NULL
) const { return (target
? getLevelForTarget(target
) : getLevel()) * 5; }
886 uint32
GetDefenseSkillValue(Unit
const* target
= NULL
) const;
887 uint32
GetWeaponSkillValue(WeaponAttackType attType
, Unit
const* target
= NULL
) const;
888 float GetWeaponProcChance() const;
889 float GetPPMProcChance(uint32 WeaponSpeed
, float PPM
) const;
890 MeleeHitOutcome
RollPhysicalOutcomeAgainst (const Unit
*pVictim
, WeaponAttackType attType
, SpellEntry
const *spellInfo
);
891 MeleeHitOutcome
RollMeleeOutcomeAgainst (const Unit
*pVictim
, WeaponAttackType attType
) const;
892 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;
894 bool isVendor() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_VENDOR
); }
895 bool isTrainer() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_TRAINER
); }
896 bool isQuestGiver() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_QUESTGIVER
); }
897 bool isGossip() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_GOSSIP
); }
898 bool isTaxi() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_FLIGHTMASTER
); }
899 bool isGuildMaster() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_PETITIONER
); }
900 bool isBattleMaster() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_BATTLEMASTER
); }
901 bool isBanker() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_BANKER
); }
902 bool isInnkeeper() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_INNKEEPER
); }
903 bool isSpiritHealer() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_SPIRITHEALER
); }
904 bool isSpiritGuide() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_SPIRITGUIDE
); }
905 bool isTabardDesigner()const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_TABARDDESIGNER
); }
906 bool isAuctioner() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_AUCTIONEER
); }
907 bool isArmorer() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_REPAIR
); }
908 bool isServiceProvider() const
910 return HasFlag( UNIT_NPC_FLAGS
,
911 UNIT_NPC_FLAG_VENDOR
| UNIT_NPC_FLAG_TRAINER
| UNIT_NPC_FLAG_FLIGHTMASTER
|
912 UNIT_NPC_FLAG_PETITIONER
| UNIT_NPC_FLAG_BATTLEMASTER
| UNIT_NPC_FLAG_BANKER
|
913 UNIT_NPC_FLAG_INNKEEPER
| UNIT_NPC_FLAG_GUARD
| UNIT_NPC_FLAG_SPIRITHEALER
|
914 UNIT_NPC_FLAG_SPIRITGUIDE
| UNIT_NPC_FLAG_TABARDDESIGNER
| UNIT_NPC_FLAG_AUCTIONEER
);
916 bool isSpiritService() const { return HasFlag( UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_SPIRITHEALER
| UNIT_NPC_FLAG_SPIRITGUIDE
); }
918 //Need fix or use this
919 bool isGuard() const { return HasFlag(UNIT_NPC_FLAGS
, UNIT_NPC_FLAG_GUARD
); }
921 bool isInFlight() const { return hasUnitState(UNIT_STAT_IN_FLIGHT
); }
923 bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS
, UNIT_FLAG_IN_COMBAT
); }
924 void SetInCombatState(bool PvP
);
925 void SetInCombatWith(Unit
* enemy
);
926 void ClearInCombat();
927 uint32
GetCombatTimer() const { return m_CombatTimer
; }
929 bool HasAuraType(AuraType auraType
) const;
930 bool HasAura(uint32 spellId
, uint32 effIndex
) const
931 { return m_Auras
.find(spellEffectPair(spellId
, effIndex
)) != m_Auras
.end(); }
933 bool virtual HasSpell(uint32
/*spellID*/) const { return false; }
935 bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH
); }
936 bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY
); }
937 bool isFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR
); }
938 bool isInRoots() const { return HasAuraType(SPELL_AURA_MOD_ROOT
); }
939 bool IsPolymorphed() const;
941 bool isFrozen() const;
943 void RemoveSpellbyDamageTaken(AuraType auraType
, uint32 damage
);
945 bool isTargetableForAttack() const;
946 virtual bool IsInWater() const;
947 virtual bool IsUnderWater() const;
948 bool isInAccessablePlaceFor(Creature
const* c
) const;
950 void SendHealSpellLog(Unit
*pVictim
, uint32 SpellID
, uint32 Damage
, bool critical
= false);
951 void SendEnergizeSpellLog(Unit
*pVictim
, uint32 SpellID
, uint32 Damage
,Powers powertype
);
952 uint32
SpellNonMeleeDamageLog(Unit
*pVictim
, uint32 spellID
, uint32 damage
, bool isTriggeredSpell
= false, bool useSpellDamage
= true);
953 void CastSpell(Unit
* Victim
, uint32 spellId
, bool triggered
, Item
*castItem
= NULL
, Aura
* triggeredByAura
= NULL
, uint64 originalCaster
= 0);
954 void CastSpell(Unit
* Victim
,SpellEntry
const *spellInfo
, bool triggered
, Item
*castItem
= NULL
, Aura
* triggeredByAura
= NULL
, uint64 originalCaster
= 0);
955 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);
956 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);
957 void CastSpell(float x
, float y
, float z
, uint32 spellId
, bool triggered
, Item
*castItem
= NULL
, Aura
* triggeredByAura
= NULL
, uint64 originalCaster
= 0);
958 void CastSpell(float x
, float y
, float z
, SpellEntry
const *spellInfo
, bool triggered
, Item
*castItem
= NULL
, Aura
* triggeredByAura
= NULL
, uint64 originalCaster
= 0);
960 bool IsDamageToThreatSpell(SpellEntry
const * spellInfo
) const;
964 void SendAttackStateUpdate(uint32 HitInfo
, Unit
*target
, uint8 SwingType
, SpellSchoolMask damageSchoolMask
, uint32 Damage
, uint32 AbsorbDamage
, uint32 Resist
, VictimState TargetState
, uint32 BlockedAmount
);
965 void SendSpellNonMeleeDamageLog(Unit
*target
,uint32 SpellID
,uint32 Damage
, SpellSchoolMask damageSchoolMask
,uint32 AbsorbedDamage
, uint32 Resist
,bool PhysicalDamage
, uint32 Blocked
, bool CriticalHit
= false);
966 void SendSpellMiss(Unit
*target
, uint32 spellID
, SpellMissInfo missInfo
);
968 void SendMonsterMove(float NewPosX
, float NewPosY
, float NewPosZ
, uint8 type
, uint32 MovementFlags
, uint32 Time
, Player
* player
= NULL
);
969 void SendMonsterMoveByPath(Path
const& path
, uint32 start
, uint32 end
, uint32 MovementFlags
);
970 void SendMonsterMoveWithSpeed(float x
, float y
, float z
, uint32 MovementFlags
, uint32 transitTime
= 0, Player
* player
= NULL
);
971 void SendMonsterMoveWithSpeedToCurrentDestination(Player
* player
= NULL
);
973 virtual void MoveOutOfRange(Player
&) { };
975 bool isAlive() const { return (m_deathState
== ALIVE
); };
976 bool isDead() const { return ( m_deathState
== DEAD
|| m_deathState
== CORPSE
); };
977 DeathState
getDeathState() { return m_deathState
; };
978 virtual void setDeathState(DeathState s
); // overwrited in Creature/Player/Pet
980 uint64
GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY
); }
981 void SetOwnerGUID(uint64 owner
) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY
, owner
); }
982 uint64
GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY
); }
983 void SetCreatorGUID(uint64 creator
) { SetUInt64Value(UNIT_FIELD_CREATEDBY
, creator
); }
984 uint64
GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON
); }
985 uint64
GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY
); }
986 void SetCharmerGUID(uint64 owner
) { SetUInt64Value(UNIT_FIELD_CHARMEDBY
, owner
); }
987 uint64
GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM
); }
989 uint64
GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); }
990 uint64
GetCharmerOrOwnerOrOwnGUID() const
992 if(uint64 guid
= GetCharmerOrOwnerGUID())
996 bool isCharmedOwnedByPlayerOrPlayer() const { return IS_PLAYER_GUID(GetCharmerOrOwnerOrOwnGUID()); }
998 Player
* GetSpellModOwner();
1000 Unit
* GetOwner() const;
1001 Pet
* GetPet() const;
1002 Unit
* GetCharmer() const;
1003 Unit
* GetCharm() const;
1004 Unit
* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); }
1005 Unit
* GetCharmerOrOwnerOrSelf()
1007 if(Unit
* u
= GetCharmerOrOwner())
1012 Player
* GetCharmerOrOwnerPlayerOrPlayerItself();
1014 void SetPet(Pet
* pet
);
1015 void SetCharm(Unit
* pet
);
1017 bool isCharmed() const { return GetCharmerGUID() != 0; }
1019 CharmInfo
* GetCharmInfo() { return m_charmInfo
; }
1020 CharmInfo
* InitCharmInfo(Unit
* charm
);
1022 Pet
* CreateTamedPetFrom(Creature
* creatureTarget
,uint32 spell_id
= 0);
1024 bool AddAura(Aura
*aur
);
1026 void RemoveAura(AuraMap::iterator
&i
, AuraRemoveMode mode
= AURA_REMOVE_BY_DEFAULT
);
1027 void RemoveAura(uint32 spellId
, uint32 effindex
, Aura
* except
= NULL
);
1028 void RemoveSingleAuraFromStack(uint32 spellId
, uint32 effindex
);
1029 void RemoveAurasDueToSpell(uint32 spellId
, Aura
* except
= NULL
);
1030 void RemoveAurasDueToItemSpell(Item
* castItem
,uint32 spellId
);
1031 void RemoveAurasDueToSpellByDispel(uint32 spellId
, uint64 casterGUID
, Unit
*dispeler
);
1032 void RemoveAurasDueToSpellBySteal(uint32 spellId
, uint64 casterGUID
, Unit
*stealer
);
1033 void RemoveAurasDueToSpellByCancel(uint32 spellId
);
1034 void RemoveNotOwnSingleTargetAuras();
1036 void RemoveSpellsCausingAura(AuraType auraType
);
1037 void RemoveRankAurasDueToSpell(uint32 spellId
);
1038 bool RemoveNoStackAurasDueToAura(Aura
*Aur
);
1039 void RemoveAurasWithInterruptFlags(uint32 flags
);
1040 void RemoveAurasWithDispelType( DispelType type
);
1042 void RemoveAllAuras();
1043 void RemoveAllAurasOnDeath();
1044 void DelayAura(uint32 spellId
, uint32 effindex
, int32 delaytime
);
1046 float GetResistanceBuffMods(SpellSchools school
, bool positive
) const { return GetFloatValue(positive
? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
+school
: UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
+school
); }
1047 void SetResistanceBuffMods(SpellSchools school
, bool positive
, float val
) { SetFloatValue(positive
? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
+school
: UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
+school
,val
); }
1048 void ApplyResistanceBuffModsMod(SpellSchools school
, bool positive
, float val
, bool apply
) { ApplyModSignedFloatValue(positive
? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
+school
: UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
+school
, val
, apply
); }
1049 void ApplyResistanceBuffModsPercentMod(SpellSchools school
, bool positive
, float val
, bool apply
) { ApplyPercentModFloatValue(positive
? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
+school
: UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
+school
, val
, apply
); }
1050 void InitStatBuffMods()
1052 for(int i
= STAT_STRENGTH
; i
< MAX_STATS
; ++i
) SetFloatValue(UNIT_FIELD_POSSTAT0
+i
, 0);
1053 for(int i
= STAT_STRENGTH
; i
< MAX_STATS
; ++i
) SetFloatValue(UNIT_FIELD_NEGSTAT0
+i
, 0);
1055 void ApplyStatBuffMod(Stats stat
, float val
, bool apply
) { ApplyModSignedFloatValue((val
> 0 ? UNIT_FIELD_POSSTAT0
+stat
: UNIT_FIELD_NEGSTAT0
+stat
), val
, apply
); }
1056 void ApplyStatPercentBuffMod(Stats stat
, float val
, bool apply
)
1058 ApplyPercentModFloatValue(UNIT_FIELD_POSSTAT0
+stat
, val
, apply
);
1059 ApplyPercentModFloatValue(UNIT_FIELD_NEGSTAT0
+stat
, val
, apply
);
1061 void SetCreateStat(Stats stat
, float val
) { m_createStats
[stat
] = val
; }
1062 void SetCreateHealth(uint32 val
) { SetUInt32Value(UNIT_FIELD_BASE_HEALTH
, val
); }
1063 uint32
GetCreateHealth() const { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH
); }
1064 void SetCreateMana(uint32 val
) { SetUInt32Value(UNIT_FIELD_BASE_MANA
, val
); }
1065 uint32
GetCreateMana() const { return GetUInt32Value(UNIT_FIELD_BASE_MANA
); }
1066 uint32
GetCreatePowers(Powers power
) const;
1067 float GetPosStat(Stats stat
) const { return GetFloatValue(UNIT_FIELD_POSSTAT0
+stat
); }
1068 float GetNegStat(Stats stat
) const { return GetFloatValue(UNIT_FIELD_NEGSTAT0
+stat
); }
1069 float GetCreateStat(Stats stat
) const { return m_createStats
[stat
]; }
1071 void SetCurrentCastedSpell(Spell
* pSpell
);
1072 virtual void ProhibitSpellScholl(SpellSchoolMask
/*idSchoolMask*/, uint32
/*unTimeMs*/ ) { }
1073 void InterruptSpell(uint32 spellType
, bool withDelayed
= true);
1075 // set withDelayed to true to account delayed spells as casted
1076 // delayed+channeled spells are always accounted as casted
1077 // we can skip channeled or delayed checks using flags
1078 bool IsNonMeleeSpellCasted(bool withDelayed
, bool skipChanneled
= false, bool skipAutorepeat
= false) const;
1080 // set withDelayed to true to interrupt delayed spells too
1081 // delayed+channeled spells are always interrupted
1082 void InterruptNonMeleeSpells(bool withDelayed
, uint32 spellid
= 0);
1084 Spell
* FindCurrentSpellBySpellId(uint32 spell_id
) const;
1086 Spell
* m_currentSpells
[CURRENT_MAX_SPELL
];
1088 uint32 m_addDmgOnce
;
1089 uint64 m_TotemSlot
[MAX_TOTEM
];
1090 uint64 m_ObjectSlot
[4];
1091 uint32 m_detectInvisibilityMask
;
1092 uint32 m_invisibilityMask
;
1093 uint32 m_ShapeShiftFormSpellId
;
1094 ShapeshiftForm m_form
;
1095 float m_modMeleeHitChance
;
1096 float m_modRangedHitChance
;
1097 float m_modSpellHitChance
;
1098 int32 m_baseSpellCritChance
;
1100 float m_threatModifier
[MAX_SPELL_SCHOOL
];
1101 float m_modAttackSpeedPct
[3];
1104 EventProcessor m_Events
;
1107 bool HandleStatModifier(UnitMods unitMod
, UnitModifierType modifierType
, float amount
, bool apply
);
1108 void SetModifierValue(UnitMods unitMod
, UnitModifierType modifierType
, float value
) { m_auraModifiersGroup
[unitMod
][modifierType
] = value
; }
1109 float GetModifierValue(UnitMods unitMod
, UnitModifierType modifierType
) const;
1110 float GetTotalStatValue(Stats stat
) const;
1111 float GetTotalAuraModValue(UnitMods unitMod
) const;
1112 SpellSchools
GetSpellSchoolByAuraGroup(UnitMods unitMod
) const;
1113 Stats
GetStatByAuraGroup(UnitMods unitMod
) const;
1114 Powers
GetPowerTypeByAuraGroup(UnitMods unitMod
) const;
1115 bool CanModifyStats() const { return m_canModifyStats
; }
1116 void SetCanModifyStats(bool modifyStats
) { m_canModifyStats
= modifyStats
; }
1117 virtual bool UpdateStats(Stats stat
) = 0;
1118 virtual bool UpdateAllStats() = 0;
1119 virtual void UpdateResistances(uint32 school
) = 0;
1120 virtual void UpdateArmor() = 0;
1121 virtual void UpdateMaxHealth() = 0;
1122 virtual void UpdateMaxPower(Powers power
) = 0;
1123 virtual void UpdateAttackPowerAndDamage(bool ranged
= false) = 0;
1124 virtual void UpdateDamagePhysical(WeaponAttackType attType
) = 0;
1125 float GetTotalAttackPowerValue(WeaponAttackType attType
) const;
1126 float GetWeaponDamageRange(WeaponAttackType attType
,WeaponDamageRange type
) const;
1127 void SetBaseWeaponDamage(WeaponAttackType attType
,WeaponDamageRange damageRange
, float value
) { m_weaponDamage
[attType
][damageRange
] = value
; }
1129 bool isInFront(Unit
const* target
,float distance
, float arc
= M_PI
) const;
1130 void SetInFront(Unit
const* target
);
1131 bool isInBack(Unit
const* target
, float distance
, float arc
= M_PI
) const;
1133 // Visibility system
1134 UnitVisibility
GetVisibility() const { return m_Visibility
; }
1135 void SetVisibility(UnitVisibility x
);
1137 // common function for visibility checks for player/creatures with detection code
1138 bool isVisibleForOrDetect(Unit
const* u
, bool detect
, bool inVisibleList
= false) const;
1139 bool canDetectInvisibilityOf(Unit
const* u
) const;
1141 // virtual functions for all world objects types
1142 bool isVisibleForInState(Player
const* u
, bool inVisibleList
) const;
1143 // function for low level grid visibility checks in player/creature cases
1144 virtual bool IsVisibleInGridForPlayer(Player
* pl
) const = 0;
1147 AuraList
& GetSingleCastAuras() { return m_scAuras
; }
1148 AuraList
const& GetSingleCastAuras() const { return m_scAuras
; }
1149 SpellImmuneList m_spellImmune
[MAX_SPELL_IMMUNITY
];
1151 // Threat related methodes
1152 bool CanHaveThreatList() const;
1153 void AddThreat(Unit
* pVictim
, float threat
, SpellSchoolMask schoolMask
= SPELL_SCHOOL_MASK_NORMAL
, SpellEntry
const *threatSpell
= NULL
);
1154 float ApplyTotalThreatModifier(float threat
, SpellSchoolMask schoolMask
= SPELL_SCHOOL_MASK_NORMAL
);
1155 void DeleteThreatList();
1156 bool SelectHostilTarget();
1157 void TauntApply(Unit
* pVictim
);
1158 void TauntFadeOut(Unit
*taunter
);
1159 ThreatManager
& getThreatManager() { return m_ThreatManager
; }
1160 void addHatedBy(HostilReference
* pHostilReference
) { m_HostilRefManager
.insertFirst(pHostilReference
); };
1161 void removeHatedBy(HostilReference
* /*pHostilReference*/ ) { /* nothing to do yet */ }
1162 HostilRefManager
& getHostilRefManager() { return m_HostilRefManager
; }
1164 uint32
GetVisibleAura(uint8 slot
)
1166 VisibleAuraMap::iterator itr
= m_visibleAuras
.find(slot
);
1167 if(itr
!= m_visibleAuras
.end())
1171 void SetVisibleAura(uint8 slot
, uint32 spellid
)
1175 VisibleAuraMap::iterator itr
= m_visibleAuras
.find(slot
);
1176 if(itr
!= m_visibleAuras
.end())
1178 m_visibleAuras
.erase(itr
);
1183 m_visibleAuras
[slot
] = spellid
;
1185 VisibleAuraMap
const *GetVisibleAuras() { return &m_visibleAuras
; }
1186 uint8
GetVisibleAurasCount() { return m_visibleAuras
.size(); }
1188 Aura
* GetAura(uint32 spellId
, uint32 effindex
);
1189 AuraMap
& GetAuras() { return m_Auras
; }
1190 AuraMap
const& GetAuras() const { return m_Auras
; }
1191 AuraList
const& GetAurasByType(AuraType type
) const { return m_modAuras
[type
]; }
1192 void ApplyAuraProcTriggerDamage(Aura
* aura
, bool apply
);
1194 int32
GetTotalAuraModifier(AuraType auratype
) const;
1195 float GetTotalAuraMultiplier(AuraType auratype
) const;
1196 int32
GetMaxPositiveAuraModifier(AuraType auratype
) const;
1197 int32
GetMaxNegativeAuraModifier(AuraType auratype
) const;
1199 int32
GetTotalAuraModifierByMiscMask(AuraType auratype
, uint32 misc_mask
) const;
1200 float GetTotalAuraMultiplierByMiscMask(AuraType auratype
, uint32 misc_mask
) const;
1201 int32
GetMaxPositiveAuraModifierByMiscMask(AuraType auratype
, uint32 misc_mask
) const;
1202 int32
GetMaxNegativeAuraModifierByMiscMask(AuraType auratype
, uint32 misc_mask
) const;
1204 int32
GetTotalAuraModifierByMiscValue(AuraType auratype
, int32 misc_value
) const;
1205 float GetTotalAuraMultiplierByMiscValue(AuraType auratype
, int32 misc_value
) const;
1206 int32
GetMaxPositiveAuraModifierByMiscValue(AuraType auratype
, int32 misc_value
) const;
1207 int32
GetMaxNegativeAuraModifierByMiscValue(AuraType auratype
, int32 misc_value
) const;
1209 Aura
* GetDummyAura(uint32 spell_id
) const;
1211 uint32
GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID
); }
1212 void SetDisplayId(uint32 modelId
);
1213 uint32
GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID
); }
1214 void SetNativeDisplayId(uint32 modelId
) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID
, modelId
); }
1215 void setTransForm(uint32 spellid
) { m_transform
= spellid
;}
1216 uint32
getTransForm() const { return m_transform
;}
1217 void AddDynObject(DynamicObject
* dynObj
);
1218 void RemoveDynObject(uint32 spellid
);
1219 void RemoveDynObjectWithGUID(uint64 guid
) { m_dynObjGUIDs
.remove(guid
); }
1220 void RemoveAllDynObjects();
1221 void AddGameObject(GameObject
* gameObj
);
1222 void RemoveGameObject(GameObject
* gameObj
, bool del
);
1223 void RemoveGameObject(uint32 spellid
, bool del
);
1224 void RemoveAllGameObjects();
1225 DynamicObject
*GetDynObject(uint32 spellId
, uint32 effIndex
);
1226 DynamicObject
*GetDynObject(uint32 spellId
);
1227 uint32
CalculateDamage(WeaponAttackType attType
, bool normalized
);
1228 float GetAPMultiplier(WeaponAttackType attType
, bool normalized
);
1229 void ModifyAuraState(AuraState flag
, bool apply
);
1230 bool HasAuraState(AuraState flag
) const { return HasFlag(UNIT_FIELD_AURASTATE
, 1<<(flag
-1)); }
1231 void UnsummonAllTotems();
1232 int32
SpellBaseDamageBonus(SpellSchoolMask schoolMask
);
1233 int32
SpellBaseHealingBonus(SpellSchoolMask schoolMask
);
1234 int32
SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask
, Unit
*pVictim
);
1235 int32
SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask
, Unit
*pVictim
);
1236 uint32
SpellDamageBonus(Unit
*pVictim
, SpellEntry
const *spellProto
, uint32 damage
, DamageEffectType damagetype
);
1237 uint32
SpellHealingBonus(SpellEntry
const *spellProto
, uint32 healamount
, DamageEffectType damagetype
, Unit
*pVictim
);
1238 bool isSpellCrit(Unit
*pVictim
, SpellEntry
const *spellProto
, SpellSchoolMask schoolMask
, WeaponAttackType attackType
);
1239 uint32
SpellCriticalBonus(SpellEntry
const *spellProto
, uint32 damage
, Unit
*pVictim
);
1241 void SetLastManaUse(uint32 spellCastTime
) { m_lastManaUse
= spellCastTime
; }
1242 bool IsUnderLastManaUseEffect() const;
1244 void SetContestedPvP(Player
*attackedPlayer
= NULL
);
1246 void MeleeDamageBonus(Unit
*pVictim
, uint32
*damage
, WeaponAttackType attType
, SpellEntry
const *spellProto
= NULL
);
1247 uint32
GetCastingTimeForBonus( SpellEntry
const *spellProto
, DamageEffectType damagetype
, uint32 CastingTime
);
1249 void ApplySpellImmune(uint32 spellId
, uint32 op
, uint32 type
, bool apply
);
1250 void ApplySpellDispelImmunity(const SpellEntry
* spellProto
, DispelType type
, bool apply
);
1251 virtual bool IsImmunedToSpell(SpellEntry
const* spellInfo
, bool useCharges
= false);
1252 // redefined in Creature
1253 bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask
, bool useCharges
= false);
1254 virtual bool IsImmunedToSpellEffect(uint32 effect
, uint32 mechanic
) const;
1255 // redefined in Creature
1257 uint32
CalcArmorReducedDamage(Unit
* pVictim
, const uint32 damage
);
1258 void CalcAbsorbResist(Unit
*pVictim
, SpellSchoolMask schoolMask
, DamageEffectType damagetype
, const uint32 damage
, uint32
*absorb
, uint32
*resist
);
1260 void UpdateSpeed(UnitMoveType mtype
, bool forced
);
1261 float GetSpeed( UnitMoveType mtype
) const;
1262 float GetSpeedRate( UnitMoveType mtype
) const { return m_speed_rate
[mtype
]; }
1263 void SetSpeed(UnitMoveType mtype
, float rate
, bool forced
= false);
1265 void SetHover(bool on
);
1266 bool isHover() const { return HasAuraType(SPELL_AURA_HOVER
); }
1268 void _RemoveAllAuraMods();
1269 void _ApplyAllAuraMods();
1271 int32
CalculateSpellDamage(SpellEntry
const* spellProto
, uint8 effect_index
, int32 basePoints
, Unit
const* target
);
1272 int32
CalculateSpellDuration(SpellEntry
const* spellProto
, uint8 effect_index
, Unit
const* target
);
1273 float CalculateLevelPenalty(SpellEntry
const* spellProto
) const;
1275 void addFollower(FollowerReference
* pRef
) { m_FollowingRefManager
.insertFirst(pRef
); }
1276 void removeFollower(FollowerReference
* /*pRef*/ ) { /* nothing to do yet */ }
1277 static Unit
* GetUnit(WorldObject
& object
, uint64 guid
);
1279 MotionMaster
* GetMotionMaster() { return &i_motionMaster
; }
1281 bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING
)); }
1284 void AddUnitMovementFlag(uint32 f
) { m_unit_movement_flags
|= f
; }
1285 void RemoveUnitMovementFlag(uint32 f
)
1287 uint32 oldval
= m_unit_movement_flags
;
1288 m_unit_movement_flags
= oldval
& ~f
;
1290 uint32
HasUnitMovementFlag(uint32 f
) const { return m_unit_movement_flags
& f
; }
1291 uint32
GetUnitMovementFlags() const { return m_unit_movement_flags
; }
1292 void SetUnitMovementFlags(uint32 f
) { m_unit_movement_flags
= f
; }
1294 void SetFeared(bool apply
, uint64 casterGUID
= 0, uint32 spellID
= 0);
1295 void SetConfused(bool apply
, uint64 casterGUID
= 0, uint32 spellID
= 0);
1297 void AddComboPointHolder(uint32 lowguid
) { m_ComboPointHolders
.insert(lowguid
); }
1298 void RemoveComboPointHolder(uint32 lowguid
) { m_ComboPointHolders
.erase(lowguid
); }
1299 void ClearComboPointHolders();
1301 ///----------Pet responses methods-----------------
1302 void SendPetCastFail(uint32 spellid
, uint8 msg
);
1303 void SendPetActionFeedback (uint8 msg
);
1304 void SendPetTalk (uint32 pettalk
);
1305 void SendPetSpellCooldown (uint32 spellid
, time_t cooltime
);
1306 void SendPetClearCooldown (uint32 spellid
);
1307 void SendPetAIReaction(uint64 guid
);
1308 ///----------End of Pet responses methods----------
1310 void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); }
1313 void ClearAllReactives();
1314 void StartReactiveTimer( ReactiveType reactive
) { m_reactiveTimer
[reactive
] = REACTIVE_TIMER_START
;}
1315 void UpdateReactives(uint32 p_time
);
1318 void UpdateAuraForGroup(uint8 slot
);
1321 typedef std::set
<PetAura
const*> PetAuraSet
;
1322 PetAuraSet m_petAuras
;
1323 void AddPetAura(PetAura
const* petSpell
);
1324 void RemovePetAura(PetAura
const* petSpell
);
1329 void _UpdateSpells(uint32 time
);
1331 void _UpdateAutoRepeatSpell();
1332 bool m_AutoRepeatFirstCast
;
1334 uint32 m_attackTimer
[MAX_ATTACK
];
1336 float m_createStats
[MAX_STATS
];
1338 AttackerSet m_attackers
;
1341 DeathState m_deathState
;
1345 std::list
<Aura
*> m_scAuras
; // casted singlecast auras
1347 typedef std::list
<uint64
> DynObjectGUIDs
;
1348 DynObjectGUIDs m_dynObjGUIDs
;
1350 std::list
<GameObject
*> m_gameObj
;
1353 uint32 m_removedAuras
;
1355 AuraList m_modAuras
[TOTAL_AURAS
];
1356 float m_auraModifiersGroup
[UNIT_MOD_END
][MODIFIER_TYPE_END
];
1357 float m_weaponDamage
[MAX_ATTACK
][2];
1358 bool m_canModifyStats
;
1359 //std::list< spellEffectPair > AuraSpells[TOTAL_AURAS]; // TODO: use this if ok for mem
1360 VisibleAuraMap m_visibleAuras
;
1362 float m_speed_rate
[MAX_MOVE_TYPE
];
1364 CharmInfo
*m_charmInfo
;
1366 virtual SpellSchoolMask
GetMeleeDamageSchoolMask() const;
1368 MotionMaster i_motionMaster
;
1369 uint32 m_unit_movement_flags
;
1371 uint32 m_reactiveTimer
[MAX_REACTIVE
];
1374 void SendAttackStop(Unit
* victim
); // only from AttackStop(Unit*)
1375 void SendAttackStart(Unit
* pVictim
); // only from Unit::AttackStart(Unit*)
1377 void ProcDamageAndSpellFor( bool isVictim
, Unit
* pTarget
, uint32 procFlag
, AuraTypeSet
const& procAuraTypes
, WeaponAttackType attType
, SpellEntry
const * procSpell
, uint32 damage
, SpellSchoolMask damageSchoolMask
);
1378 bool IsTriggeredAtSpellProcEvent( SpellEntry
const* spellProto
, SpellEntry
const* procSpell
, uint32 procFlag
, WeaponAttackType attType
, bool isVictim
, uint32
& cooldown
);
1379 bool HandleDummyAuraProc( Unit
*pVictim
, uint32 damage
, Aura
* triggeredByAura
, SpellEntry
const* procSpell
, uint32 procFlag
, uint32 cooldown
);
1380 bool HandleProcTriggerSpell(Unit
*pVictim
, uint32 damage
, Aura
* triggeredByAura
, SpellEntry
const* procSpell
, uint32 procFlag
, WeaponAttackType attType
, uint32 cooldown
);
1381 bool HandleHasteAuraProc( Unit
*pVictim
, uint32 damage
, Aura
* triggeredByAura
, SpellEntry
const* procSpell
, uint32 procFlag
, uint32 cooldown
);
1382 bool HandleOverrideClassScriptAuraProc(Unit
*pVictim
, Aura
* triggeredByAura
, SpellEntry
const *procSpell
, uint32 cooldown
);
1383 bool HandleMeandingAuraProc(Aura
* triggeredByAura
);
1385 uint32 m_state
; // Even derived shouldn't modify
1386 uint32 m_CombatTimer
;
1387 uint32 m_lastManaUse
; // msecs
1389 UnitVisibility m_Visibility
;
1391 Diminishing m_Diminishing
;
1392 // Manage all Units threatening us
1393 ThreatManager m_ThreatManager
;
1394 // Manage all Units that are threatened by us
1395 HostilRefManager m_HostilRefManager
;
1397 FollowerRefManager m_FollowingRefManager
;
1399 ComboPointHolderSet m_ComboPointHolders
;