TrinityCore
Unit.h
Go to the documentation of this file.
1 /*
2  * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __UNIT_H
19 #define __UNIT_H
20 
21 #include "Object.h"
22 #include "CombatManager.h"
23 #include "OptionalFwd.h"
24 #include "SpellAuraDefines.h"
25 #include "ThreatManager.h"
26 #include "Timer.h"
27 #include "UnitDefines.h"
28 #include "Util.h"
29 #include <boost/container/flat_set.hpp>
30 #include <array>
31 #include <map>
32 #include <stack>
33 
34 #define VISUAL_WAYPOINT 1 // Creature Entry ID used for waypoints show, visible only for GMs
35 #define WORLD_TRIGGER 12999
36 #define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE 197886
37 #define SPELL_DH_DOUBLE_JUMP 196055
38 #define DISPLAYID_HIDDEN_MOUNT 73200
39 
40 #define MAX_SPELL_CHARM 4
41 #define MAX_SPELL_VEHICLE 6
42 #define MAX_SPELL_POSSESS 8
43 #define MAX_SPELL_CONTROL_BAR 10
44 
45 #define MAX_AGGRO_RESET_TIME 10 // in seconds
46 #define MAX_AGGRO_RADIUS 45.0f // yards
47 
49 {
50  VICTIMSTATE_INTACT = 0, // set when attacker misses
51  VICTIMSTATE_HIT = 1, // victim got clear/blocked hit
55  VICTIMSTATE_BLOCKS = 5, // unused? not set when blocked, even on full block
59 };
60 
61 //i would like to remove this: (it is defined in item.h
63 {
64  NULL_BAG = 0,
65  NULL_SLOT = 255
66 };
67 
68 struct AbstractFollower;
70 struct LiquidData;
71 struct LiquidTypeEntry;
73 struct SpellValue;
74 
75 class Aura;
76 class AuraApplication;
77 class AuraEffect;
78 class Creature;
79 class DynamicObject;
80 class GameObject;
81 class Guardian;
82 class Item;
83 class Minion;
84 class MotionMaster;
85 class Pet;
86 class Spell;
87 class SpellCastTargets;
88 class SpellEffectInfo;
89 class SpellHistory;
90 class SpellInfo;
91 class Totem;
92 class Transport;
93 class TransportBase;
94 class UnitAI;
95 class UnitAura;
96 class Vehicle;
97 class VehicleJoinEvent;
98 
99 enum class PetActionFeedback : uint8;
100 enum ZLiquidStatus : uint32;
102 
103 namespace Movement
104 {
105  class MoveSpline;
106  struct SpellEffectExtraData;
107 }
108 
109 typedef std::list<Unit*> UnitList;
110 
112 {
113  public:
114  DispelableAura(Aura* aura, int32 dispelChance, uint8 dispelCharges);
115  ~DispelableAura();
116 
117  Aura* GetAura() const { return _aura; }
118  bool RollDispel() const;
119  uint8 GetDispelCharges() const { return _charges; }
120 
121  void IncrementCharges() { ++_charges; }
123  {
124  if (!_charges)
125  return false;
126 
127  --_charges;
128  return _charges > 0;
129  }
130 
131  private:
135 };
136 typedef std::vector<DispelableAura> DispelChargesList;
137 
138 typedef std::unordered_multimap<uint32 /*type*/, uint32 /*spellId*/> SpellImmuneContainer;
139 
141 {
143  BASE_PCT_EXCLUDE_CREATE = 1, // percent modifier affecting all stat values from auras and gear but not player base for level
146 };
147 
149 {
150  BASE_PCT = 0,
153 };
154 
156 {
159 };
160 
162 {
163  UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_INTELLECT must be in existed order, it's accessed by index values of Stats enum.
168  UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_PAIN must be listed in existing order, it is accessed by index values of Powers enum.
187  UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum.
200  // synonyms
207 };
208 
209 static_assert(UNIT_MOD_POWER_END - UNIT_MOD_POWER_START == MAX_POWERS, "UnitMods powers section does not match Powers enum!");
210 
212 {
218 };
219 
221 {
225 };
226 
228 {
229  ALIVE = 0,
231  CORPSE = 2,
232  DEAD = 3,
234 };
235 
237 {
238  UNIT_STATE_DIED = 0x00000001, // player has fake death aura
239  UNIT_STATE_MELEE_ATTACKING = 0x00000002, // player is melee attacking someone
240  UNIT_STATE_CHARMED = 0x00000004, // having any kind of charm aura on self
241  UNIT_STATE_STUNNED = 0x00000008,
242  UNIT_STATE_ROAMING = 0x00000010,
243  UNIT_STATE_CHASE = 0x00000020,
244  UNIT_STATE_FOCUSING = 0x00000040,
245  UNIT_STATE_FLEEING = 0x00000080,
246  UNIT_STATE_IN_FLIGHT = 0x00000100, // player is in flight mode
247  UNIT_STATE_FOLLOW = 0x00000200,
248  UNIT_STATE_ROOT = 0x00000400,
249  UNIT_STATE_CONFUSED = 0x00000800,
250  UNIT_STATE_DISTRACTED = 0x00001000,
251  UNIT_STATE_ISOLATED = 0x00002000, // area auras do not affect other players
253  UNIT_STATE_CASTING = 0x00008000,
254  UNIT_STATE_POSSESSED = 0x00010000, // being possessed by another unit
255  UNIT_STATE_CHARGING = 0x00020000,
256  UNIT_STATE_JUMPING = 0x00040000,
257  UNIT_STATE_MOVE = 0x00100000,
258  UNIT_STATE_ROTATING = 0x00200000,
259  UNIT_STATE_EVADE = 0x00400000,
263  UNIT_STATE_CHASE_MOVE = 0x04000000,
265  UNIT_STATE_IGNORE_PATHFINDING = 0x10000000, // do not use pathfinding in any MovementGenerator
266 
273 
283 
285  UNIT_STATE_ALL_STATE = 0xffffffff
286 };
287 
290 
292 {
295  CR_DODGE = 2,
296  CR_PARRY = 3,
297  CR_BLOCK = 4,
306  CR_SPEED = 13,
320  CR_CLEAVE = 27,
325 };
326 
327 #define MAX_COMBAT_RATING 32
328 
330 {
331  DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells)
332  SPELL_DIRECT_DAMAGE = 1, // spell/class abilities damage
333  DOT = 2,
334  HEAL = 3,
335  NODAMAGE = 4, // used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc
337 };
338 
340 {
341  UNIT_MASK_NONE = 0x00000000,
342  UNIT_MASK_SUMMON = 0x00000001,
343  UNIT_MASK_MINION = 0x00000002,
344  UNIT_MASK_GUARDIAN = 0x00000004,
345  UNIT_MASK_TOTEM = 0x00000008,
346  UNIT_MASK_PET = 0x00000010,
347  UNIT_MASK_VEHICLE = 0x00000020,
348  UNIT_MASK_PUPPET = 0x00000040,
349  UNIT_MASK_HUNTER_PET = 0x00000080,
351  UNIT_MASK_ACCESSORY = 0x00000200
352 };
353 
355 {
356  DiminishingReturn() : stack(0), hitTime(0), hitCount(DIMINISHING_LEVEL_1) { }
357 
358  void Clear()
359  {
360  stack = 0;
361  hitTime = 0;
362  hitCount = DIMINISHING_LEVEL_1;
363  }
364 
368 };
369 
371 {
374 };
375 
377 {
378  public:
379  explicit DispelInfo(WorldObject* dispeller, uint32 dispellerSpellId, uint8 chargesRemoved) :
380  _dispeller(dispeller), _dispellerSpell(dispellerSpellId), _chargesRemoved(chargesRemoved) { }
381 
382  WorldObject* GetDispeller() const { return _dispeller; }
383  uint32 GetDispellerSpellId() const { return _dispellerSpell; }
384  uint8 GetRemovedCharges() const { return _chargesRemoved; }
385  void SetRemovedCharges(uint8 amount) { _chargesRemoved = amount; }
386  private:
390 };
391 
393 {
394  CleanDamage(uint32 mitigated, uint32 absorbed, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome) :
395  absorbed_damage(absorbed), mitigated_damage(mitigated), attackType(_attackType), hitOutCome(_hitOutCome) { }
396 
399 
402 };
403 
404 struct CalcDamageInfo;
405 struct SpellNonMeleeDamage;
406 
408 {
409  private:
410  Unit* const m_attacker;
411  Unit* const m_victim;
414  SpellInfo const* const m_spellInfo;
422  public:
423  DamageInfo(Unit* attacker, Unit* victim, uint32 damage, SpellInfo const* spellInfo, SpellSchoolMask schoolMask, DamageEffectType damageType, WeaponAttackType attackType);
424  explicit DamageInfo(CalcDamageInfo const& dmgInfo);
425  DamageInfo(SpellNonMeleeDamage const& spellNonMeleeDamage, DamageEffectType damageType, WeaponAttackType attackType, uint32 hitMask);
426 
427  void ModifyDamage(int32 amount);
428  void AbsorbDamage(uint32 amount);
429  void ResistDamage(uint32 amount);
430  void BlockDamage(uint32 amount);
431 
432  Unit* GetAttacker() const { return m_attacker; }
433  Unit* GetVictim() const { return m_victim; }
434  SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
435  SpellSchoolMask GetSchoolMask() const { return m_schoolMask; }
436  DamageEffectType GetDamageType() const { return m_damageType; }
437  WeaponAttackType GetAttackType() const { return m_attackType; }
438  uint32 GetDamage() const { return m_damage; }
439  uint32 GetOriginalDamage() const { return m_originalDamage; }
440  uint32 GetAbsorb() const { return m_absorb; }
441  uint32 GetResist() const { return m_resist; }
442  uint32 GetBlock() const { return m_block; }
443 
444  uint32 GetHitMask() const;
445 };
446 
448 {
449  private:
450  Unit* const _healer;
451  Unit* const _target;
456  SpellInfo const* const _spellInfo;
459 
460  public:
461  HealInfo(Unit* healer, Unit* target, uint32 heal, SpellInfo const* spellInfo, SpellSchoolMask schoolMask);
462 
463  void AbsorbHeal(uint32 amount);
464  void SetEffectiveHeal(uint32 amount) { _effectiveHeal = amount; }
465 
466  Unit* GetHealer() const { return _healer; }
467  Unit* GetTarget() const { return _target; }
468  uint32 GetHeal() const { return _heal; }
469  uint32 GetOriginalHeal() const { return _originalHeal; }
470  uint32 GetEffectiveHeal() const { return _effectiveHeal; }
471  uint32 GetAbsorb() const { return _absorb; }
472  SpellInfo const* GetSpellInfo() const { return _spellInfo; };
473  SpellSchoolMask GetSchoolMask() const { return _schoolMask; };
474 
475  uint32 GetHitMask() const;
476 };
477 
479 {
480  public:
481  ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask,
482  uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask,
483  Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo);
484 
485  Unit* GetActor() { return _actor; }
486  Unit* GetActionTarget() const { return _actionTarget; }
487  Unit* GetProcTarget() const { return _procTarget; }
488 
489  uint32 GetTypeMask() const { return _typeMask; }
490  uint32 GetSpellTypeMask() const { return _spellTypeMask; }
491  uint32 GetSpellPhaseMask() const { return _spellPhaseMask; }
492  uint32 GetHitMask() const { return _hitMask; }
493 
494  SpellInfo const* GetSpellInfo() const;
495  SpellSchoolMask GetSchoolMask() const;
496 
497  DamageInfo* GetDamageInfo() const { return _damageInfo; }
498  HealInfo* GetHealInfo() const { return _healInfo; }
499 
500  Spell const* GetProcSpell() const { return _spell; }
501 
502  private:
503  Unit* const _actor;
513 };
514 
515 // Struct for use in Unit::CalculateMeleeDamage
516 // Need create structure like in SMSG_ATTACKERSTATEUPDATE opcode
518 {
529 
530  // Helpers
534  uint32 CleanDamage; // Used only for rage calculation
536 };
537 
538 // Spell damage info structure based on structure sending in SMSG_SPELLNONMELEEDAMAGELOG opcode
540 {
541  SpellNonMeleeDamage(Unit* _attacker, Unit* _target, SpellInfo const* _spellInfo, SpellCastVisual spellVisual, uint32 _schoolMask, ObjectGuid _castId = ObjectGuid::Empty);
542 
546  SpellInfo const* Spell;
556  // Used for help
558  bool fullBlock;
560 };
561 
563 {
564  SpellPeriodicAuraLogInfo(AuraEffect const* _auraEff, uint32 _damage, uint32 _originalDamage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical)
565  : auraEff(_auraEff), damage(_damage), originalDamage(_originalDamage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier), critical(_critical){ }
566 
570  uint32 overDamage; // overkill/overheal
573  float multiplier;
574  bool critical;
575 };
576 
577 uint32 createProcHitMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition);
578 
580 {
585 };
586 
587 #define CURRENT_FIRST_NON_MELEE_SPELL 1
588 #define CURRENT_MAX_SPELL 4
589 
590 #define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
591 #define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
592 #define MAKE_UNIT_ACTION_BUTTON(A, T) (uint32(A) | (uint32(T) << 24))
593 
595 {
596  UnitActionBarEntry() : packedData(uint32(ACT_DISABLED) << 24) { }
597 
599 
600  // helper
601  ActiveStates GetType() const { return ActiveStates(UNIT_ACTION_BUTTON_TYPE(packedData)); }
602  uint32 GetAction() const { return UNIT_ACTION_BUTTON_ACTION(packedData); }
603  bool IsActionBarForSpell() const
604  {
605  ActiveStates Type = GetType();
606  return Type == ACT_DISABLED || Type == ACT_ENABLED || Type == ACT_PASSIVE;
607  }
608 
610  {
611  packedData = MAKE_UNIT_ACTION_BUTTON(action, type);
612  }
613 
615  {
616  packedData = MAKE_UNIT_ACTION_BUTTON(UNIT_ACTION_BUTTON_ACTION(packedData), type);
617  }
618 
619  void SetAction(uint32 action)
620  {
621  packedData = (packedData & 0xFF000000) | UNIT_ACTION_BUTTON_ACTION(action);
622  }
623 };
624 
625 typedef std::list<Player*> SharedVisionList;
626 
628 {
633 };
634 
636 
638 {
643 };
644 
645 #define MAX_UNIT_ACTION_BAR_INDEX (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START)
646 
648 {
649  public:
650  explicit CharmInfo(Unit* unit);
651  ~CharmInfo();
652  void RestoreState();
653  uint32 GetPetNumber() const { return _petnumber; }
654  void SetPetNumber(uint32 petnumber, bool statwindow);
655 
656  void SetCommandState(CommandStates st) { _CommandState = st; }
657  CommandStates GetCommandState() const { return _CommandState; }
658  bool HasCommandState(CommandStates state) const { return (_CommandState == state); }
659 
660  void InitPossessCreateSpells();
661  void InitCharmCreateSpells();
662  void InitPetActionBar();
663  void InitEmptyActionBar(bool withAttack = true);
664 
665  //return true if successful
666  bool AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate = ACT_DECIDE, uint8 preferredSlot = 0);
667  bool RemoveSpellFromActionBar(uint32 spell_id);
668  void LoadPetActionBar(const std::string& data);
669  void BuildActionBar(WorldPacket* data);
670  void SetSpellAutocast(SpellInfo const* spellInfo, bool state);
671  void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
672  {
673  PetActionBar[index].SetActionAndType(spellOrAction, type);
674  }
675  UnitActionBarEntry const* GetActionBarEntry(uint8 index) const { return &(PetActionBar[index]); }
676 
677  void ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply);
678 
679  CharmSpellInfo* GetCharmSpell(uint8 index) { return &(_charmspells[index]); }
680 
681  void SetIsCommandAttack(bool val);
682  bool IsCommandAttack();
683  void SetIsCommandFollow(bool val);
684  bool IsCommandFollow();
685  void SetIsAtStay(bool val);
686  bool IsAtStay();
687  void SetIsFollowing(bool val);
688  bool IsFollowing();
689  void SetIsReturning(bool val);
690  bool IsReturning();
691  void SaveStayPosition();
692  void GetStayPosition(float &x, float &y, float &z);
693 
694  private:
695 
698  CharmSpellInfo _charmspells[4];
701 
702  //for restoration after charmed
704 
707  bool _isAtStay;
710  float _stayX;
711  float _stayY;
712  float _stayZ;
713 };
714 
715 // for clearing special attacks
716 #define REACTIVE_TIMER_START 4000
717 
719 {
722 };
723 
724 #define MAX_REACTIVE 2
725 #define SUMMON_SLOT_PET 0
726 #define SUMMON_SLOT_TOTEM 1
727 #define MAX_TOTEM_SLOT 5
728 #define SUMMON_SLOT_MINIPET 5
729 #define SUMMON_SLOT_QUEST 6
730 #define MAX_SUMMON_SLOT 7
731 
732 #define MAX_GAMEOBJECT_SLOT 4
733 
734 // delay time next attack to prevent client attack animation problems
735 #define ATTACK_DISPLAY_DELAY 200
736 #define MAX_PLAYER_STEALTH_DETECT_RANGE 30.0f // max distance for detection targets by player
737 
739 {
740  public:
741  typedef std::set<Unit*> AttackerSet;
742  typedef std::set<Unit*> ControlList;
743  typedef std::vector<Unit*> UnitVector;
744 
745  typedef std::multimap<uint32, Aura*> AuraMap;
746  typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> AuraMapBounds;
747  typedef std::pair<AuraMap::iterator, AuraMap::iterator> AuraMapBoundsNonConst;
748 
749  typedef std::multimap<uint32, AuraApplication*> AuraApplicationMap;
750  typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> AuraApplicationMapBounds;
751  typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> AuraApplicationMapBoundsNonConst;
752 
753  typedef std::multimap<AuraStateType, AuraApplication*> AuraStateAurasMap;
754  typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> AuraStateAurasMapBounds;
755 
756  typedef std::list<AuraEffect*> AuraEffectList;
757  typedef std::list<Aura*> AuraList;
758  typedef std::list<AuraApplication*> AuraApplicationList;
759  typedef std::array<DiminishingReturn, DIMINISHING_MAX> Diminishing;
760 
761  typedef std::vector<std::pair<uint32 /*procEffectMask*/, AuraApplication*>> AuraApplicationProcContainer;
762 
763  struct VisibleAuraSlotCompare { bool operator()(AuraApplication* left, AuraApplication* right) const; };
764  typedef std::set<AuraApplication*, VisibleAuraSlotCompare> VisibleAuraContainer;
765 
766  virtual ~Unit();
767 
768  bool IsAIEnabled() const { return (i_AI != nullptr); }
769  void AIUpdateTick(uint32 diff);
770  UnitAI* GetAI() const { return i_AI.get(); }
771  void ScheduleAIChange();
772  void PushAI(UnitAI* newAI);
773  bool PopAI();
774  protected:
775  void SetAI(UnitAI* newAI);
776  UnitAI* GetTopAI() const { return i_AIs.empty() ? nullptr : i_AIs.top().get(); }
777  void RefreshAI();
778  public:
779 
780  void AddToWorld() override;
781  void RemoveFromWorld() override;
782 
783  void CleanupBeforeRemoveFromMap(bool finalCleanup);
784  void CleanupsBeforeDelete(bool finalCleanup = true) override; // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
785 
786  virtual bool IsAffectedByDiminishingReturns() const { return (GetCharmerOrOwnerPlayerOrPlayerItself() != nullptr); }
787  DiminishingLevels GetDiminishing(DiminishingGroup group) const;
788  void IncrDiminishing(SpellInfo const* auraSpellInfo);
789  bool ApplyDiminishingToDuration(SpellInfo const* auraSpellInfo, int32& duration, WorldObject* caster, DiminishingLevels previousLevel) const;
790  void ApplyDiminishingAura(DiminishingGroup group, bool apply);
791  void ClearDiminishings();
792 
793  virtual void Update(uint32 time) override;
794 
795  void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; }
796  void resetAttackTimer(WeaponAttackType type = BASE_ATTACK);
797  uint32 getAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; }
798  bool isAttackReady(WeaponAttackType type = BASE_ATTACK) const { return m_attackTimer[type] == 0; }
799  bool haveOffhandWeapon() const;
800  bool CanDualWield() const { return m_canDualWield; }
801  virtual void SetCanDualWield(bool value) { m_canDualWield = value; }
802  float GetCombatReach() const override { return m_unitData->CombatReach; }
803  void SetCombatReach(float combatReach) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::CombatReach), combatReach); }
804  float GetBoundingRadius() const { return m_unitData->BoundingRadius; }
805  void SetBoundingRadius(float boundingRadius) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BoundingRadius), boundingRadius); }
806  bool IsWithinCombatRange(Unit const* obj, float dist2compare) const;
807  bool IsWithinMeleeRange(Unit const* obj) const { return IsWithinMeleeRangeAt(GetPosition(), obj); }
808  bool IsWithinMeleeRangeAt(Position const& pos, Unit const* obj) const;
809  float GetMeleeRange(Unit const* target) const;
810  virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = BASE_ATTACK) const = 0;
811  bool IsWithinBoundaryRadius(const Unit* obj) const;
814 
815  void _addAttacker(Unit* pAttacker); // must be called only from Unit::Attack(Unit*)
816  void _removeAttacker(Unit* pAttacker); // must be called only from Unit::AttackStop()
817  Unit* getAttackerForHelper() const; // If someone wants to help, who to give them
818  bool Attack(Unit* victim, bool meleeAttack);
819  void CastStop(uint32 except_spellid = 0);
820  bool AttackStop();
821  void RemoveAllAttackers();
822  AttackerSet const& getAttackers() const { return m_attackers; }
823  bool isAttackingPlayer() const;
824  Unit* GetVictim() const { return m_attacking; }
825  // Use this only when 100% sure there is a victim
827  {
828  ASSERT(m_attacking);
829  return m_attacking;
830  }
831 
832  void ValidateAttackersAndOwnTarget();
833  void CombatStop(bool includingCast = false, bool mutualPvP = true);
834  void CombatStopWithPets(bool includingCast = false);
835  void StopAttackFaction(uint32 faction_id);
836  Unit* SelectNearbyTarget(Unit* exclude = nullptr, float dist = NOMINAL_MELEE_RANGE) const;
837  void SendMeleeAttackStop(Unit* victim = nullptr);
838  void SendMeleeAttackStart(Unit* victim);
839 
840  void AddUnitState(uint32 f) { m_state |= f; }
841  bool HasUnitState(const uint32 f) const { return (m_state & f) != 0; }
842  void ClearUnitState(uint32 f) { m_state &= ~f; }
843  bool CanFreeMove() const;
844 
845  uint32 HasUnitTypeMask(uint32 mask) const { return mask & m_unitTypeMask; }
846  void AddUnitTypeMask(uint32 mask) { m_unitTypeMask |= mask; }
847  bool IsSummon() const { return (m_unitTypeMask & UNIT_MASK_SUMMON) != 0; }
848  bool IsGuardian() const { return (m_unitTypeMask & UNIT_MASK_GUARDIAN) != 0; }
849  bool IsPet() const { return (m_unitTypeMask & UNIT_MASK_PET) != 0; }
850  bool IsHunterPet() const{ return (m_unitTypeMask & UNIT_MASK_HUNTER_PET) != 0; }
851  bool IsTotem() const { return (m_unitTypeMask & UNIT_MASK_TOTEM) != 0; }
852  bool IsVehicle() const { return (m_unitTypeMask & UNIT_MASK_VEHICLE) != 0; }
853 
854  uint8 getLevel() const { return uint8(m_unitData->Level); }
855  uint8 GetLevelForTarget(WorldObject const* /*target*/) const override { return getLevel(); }
856  void SetLevel(uint8 lvl);
857  uint8 getRace() const { return m_unitData->Race; }
858  void SetRace(uint8 race) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Race), race); }
859  uint64 getRaceMask() const { return UI64LIT(1) << (getRace() - 1); }
860  uint8 getClass() const { return m_unitData->ClassId; }
861  void SetClass(uint8 classId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ClassId), classId); }
862  uint32 getClassMask() const { return 1 << (getClass()-1); }
863  uint8 getGender() const { return m_unitData->Sex; }
864  void SetGender(uint8 sex) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Sex), sex); }
865 
866  float GetStat(Stats stat) const { return float(m_unitData->Stats[stat]); }
867  void SetStat(Stats stat, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Stats, stat), val); }
868  uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); }
869  void SetArmor(int32 val, int32 bonusVal)
870  {
871  SetResistance(SPELL_SCHOOL_NORMAL, val);
872  SetBonusResistanceMod(SPELL_SCHOOL_NORMAL, bonusVal);
873  }
874 
875  int32 GetResistance(SpellSchools school) const { return m_unitData->Resistances[school]; }
876  int32 GetBonusResistanceMod(SpellSchools school) const { return m_unitData->BonusResistanceMods[school]; }
877  int32 GetResistance(SpellSchoolMask mask) const;
878  void SetResistance(SpellSchools school, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Resistances, school), val); }
879  void SetBonusResistanceMod(SpellSchools school, int32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BonusResistanceMods, school), val); }
880  static float CalculateAverageResistReduction(WorldObject const* caster, SpellSchoolMask schoolMask, Unit const* victim, SpellInfo const* spellInfo = nullptr);
881 
882  uint64 GetHealth() const { return m_unitData->Health; }
883  uint64 GetMaxHealth() const { return m_unitData->MaxHealth; }
884 
885  bool IsFullHealth() const { return GetHealth() == GetMaxHealth(); }
886  bool HealthBelowPct(int32 pct) const { return GetHealth() < CountPctFromMaxHealth(pct); }
887  bool HealthBelowPctDamaged(int32 pct, uint32 damage) const { return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
888  bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); }
889  bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); }
890  float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; }
891  uint64 CountPctFromMaxHealth(int32 pct) const { return CalculatePct(GetMaxHealth(), pct); }
892  uint64 CountPctFromCurHealth(int32 pct) const { return CalculatePct(GetHealth(), pct); }
893 
894  void SetHealth(uint64 val);
895  void SetMaxHealth(uint64 val);
896  inline void SetFullHealth() { SetHealth(GetMaxHealth()); }
897  int64 ModifyHealth(int64 val);
898  int64 GetHealthGain(int64 dVal);
899 
900  virtual float GetHealthMultiplierForTarget(WorldObject const* /*target*/) const { return 1.0f; }
901  virtual float GetDamageMultiplierForTarget(WorldObject const* /*target*/) const { return 1.0f; }
902  virtual float GetArmorMultiplierForTarget(WorldObject const* /*target*/) const { return 1.0f; }
903 
904  Powers GetPowerType() const { return Powers(*m_unitData->DisplayPower); }
905  void SetPowerType(Powers power);
906  void SetOverrideDisplayPowerId(uint32 powerDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::OverrideDisplayPowerID), powerDisplayId); }
907  void UpdateDisplayPower();
908  int32 GetPower(Powers power) const;
909  int32 GetMinPower(Powers power) const { return power == POWER_LUNAR_POWER ? -100 : 0; }
910  int32 GetMaxPower(Powers power) const;
911  float GetPowerPct(Powers power) const { return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
912  int32 CountPctFromMaxPower(Powers power, int32 pct) const { return CalculatePct(GetMaxPower(power), pct); }
913  void SetPower(Powers power, int32 val, bool withPowerUpdate = true);
914  void SetMaxPower(Powers power, int32 val);
915  void TriggerOnPowerChangeAuras(Powers power, int32 oldVal, int32 newVal);
916  inline void SetFullPower(Powers power) { SetPower(power, GetMaxPower(power)); }
917  // returns the change in power
918  int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate = true);
919 
920  void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostMultiplier), manaCostMultiplier, apply); }
921  void ApplyModManaCostModifier(SpellSchools school, int32 mod, bool apply) { ApplyModUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ManaCostModifier, school), mod, apply); }
922 
923  uint32 GetBaseAttackTime(WeaponAttackType att) const;
924  void SetBaseAttackTime(WeaponAttackType att, uint32 val);
925  void UpdateAttackTimeField(WeaponAttackType att);
926  void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply);
927  void ApplyCastTimePercentMod(float val, bool apply);
928 
929  void SetModCastingSpeed(float castingSpeed) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ModCastingSpeed), castingSpeed); }
930  void SetModSpellHaste(float spellHaste) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ModSpellHaste), spellHaste); }
931  void SetModHaste(float haste) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ModHaste), haste); }
932  void SetModRangedHaste(float rangedHaste) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ModRangedHaste), rangedHaste); }
933  void SetModHasteRegen(float hasteRegen) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ModHasteRegen), hasteRegen); }
934  void SetModTimeRate(float timeRate) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ModTimeRate), timeRate); }
935 
936  bool HasUnitFlag(UnitFlags flags) const { return (*m_unitData->Flags & flags) != 0; }
937  void AddUnitFlag(UnitFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Flags), flags); }
938  void RemoveUnitFlag(UnitFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Flags), flags); }
940  bool HasUnitFlag2(UnitFlags2 flags) const { return (*m_unitData->Flags2 & flags) != 0; }
941  void AddUnitFlag2(UnitFlags2 flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Flags2), flags); }
942  void RemoveUnitFlag2(UnitFlags2 flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Flags2), flags); }
944  bool HasUnitFlag3(UnitFlags3 flags) const { return (*m_unitData->Flags3 & flags) != 0; }
945  void AddUnitFlag3(UnitFlags3 flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Flags3), flags); }
946  void RemoveUnitFlag3(UnitFlags3 flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Flags3), flags); }
948 
949  void SetCreatedBySpell(int32 spellId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::CreatedBySpell), spellId); }
950 
951  Emote GetEmoteState() const { return Emote(*m_unitData->EmoteState); }
952  void SetEmoteState(Emote emote) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::EmoteState), emote); }
953 
954  SheathState GetSheath() const { return SheathState(*m_unitData->SheatheState); }
955  void SetSheath(SheathState sheathed);
956 
957  // faction template id
958  uint32 GetFaction() const override { return m_unitData->FactionTemplate; }
959  void SetFaction(uint32 faction) override { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::FactionTemplate), faction); }
960 
961  bool IsInPartyWith(Unit const* unit) const;
962  bool IsInRaidWith(Unit const* unit) const;
963  void GetPartyMembers(std::list<Unit*> &units);
964  bool IsContestedGuard() const;
965  UnitPVPStateFlags GetPvpFlags() const { return UnitPVPStateFlags(*m_unitData->PvpFlags); }
966  bool HasPvpFlag(UnitPVPStateFlags flags) const { return (*m_unitData->PvpFlags & flags) != 0; }
967  void AddPvpFlag(UnitPVPStateFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PvpFlags), flags); }
968  void RemovePvpFlag(UnitPVPStateFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PvpFlags), flags); }
970  bool IsInSanctuary() const { return HasPvpFlag(UNIT_BYTE2_FLAG_SANCTUARY); }
971  bool IsPvP() const { return HasPvpFlag(UNIT_BYTE2_FLAG_PVP); }
972  bool IsFFAPvP() const { return HasPvpFlag(UNIT_BYTE2_FLAG_FFA_PVP); }
973  virtual void SetPvP(bool state);
974 
975  UnitPetFlag GetPetFlags() const { return UnitPetFlag(*m_unitData->PetFlags); }
976  bool HasPetFlag(UnitPetFlag flags) const { return (*m_unitData->PetFlags & flags) != 0; }
977  void AddPetFlag(UnitPetFlag flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PetFlags), flags); }
978  void RemovePetFlag(UnitPetFlag flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PetFlags), flags); }
980 
981  uint32 GetCreatureType() const;
982  uint32 GetCreatureTypeMask() const;
983 
984  UnitStandStateType GetStandState() const { return UnitStandStateType(*m_unitData->StandState); }
985  bool IsSitState() const;
986  bool IsStandState() const;
987  void SetStandState(UnitStandStateType state, uint32 animKitID = 0);
988 
989  void AddVisFlags(UnitVisFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::VisFlags), flags); }
990  void RemoveVisFlags(UnitVisFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::VisFlags), flags); }
992 
993  void SetAnimTier(UnitBytes1_Flags animTier, bool notifyClient);
994 
995  bool IsMounted() const { return HasUnitFlag(UNIT_FLAG_MOUNT); }
996  uint32 GetMountDisplayId() const { return m_unitData->MountDisplayID; }
997  void SetMountDisplayId(uint32 mountDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::MountDisplayID), mountDisplayId); }
998  uint32 GetCosmeticMountDisplayId() const { return m_unitData->CosmeticMountDisplayID; }
999  void SetCosmeticMountDisplayId(uint32 mountDisplayId) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::CosmeticMountDisplayID), mountDisplayId); }
1000  void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0);
1001  void Dismount();
1002  MountCapabilityEntry const* GetMountCapability(uint32 mountType) const;
1003  void UpdateMountCapability();
1004 
1005  void SendDurabilityLoss(Player* receiver, uint32 percent);
1006  void PlayOneShotAnimKitId(uint16 animKitId);
1007  void SetAIAnimKitId(uint16 animKitId);
1008  uint16 GetAIAnimKitId() const override { return _aiAnimKitId; }
1009  void SetMovementAnimKitId(uint16 animKitId);
1010  uint16 GetMovementAnimKitId() const override { return _movementAnimKitId; }
1011  void SetMeleeAnimKitId(uint16 animKitId);
1012  uint16 GetMeleeAnimKitId() const override { return _meleeAnimKitId; }
1013 
1014  uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? GetLevelForTarget(target) : getLevel()) * 5; }
1015  static void DealDamageMods(Unit const* attacker, Unit const* victim, uint32& damage, uint32* absorb);
1016  static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true);
1017  static void Kill(Unit* attacker, Unit* victim, bool durabilityLoss = true, bool skipSettingDeathState = false);
1018  void KillSelf(bool durabilityLoss = true, bool skipSettingDeathState = false) { Unit::Kill(this, this, durabilityLoss, skipSettingDeathState); }
1019  static void DealHeal(HealInfo& healInfo);
1020 
1021  static void ProcSkillsAndAuras(Unit* actor, Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget,
1022  uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell,
1023  DamageInfo* damageInfo, HealInfo* healInfo);
1024 
1025  void GetProcAurasTriggeredOnEvent(AuraApplicationProcContainer& aurasTriggeringProc, AuraApplicationList* procAuras, ProcEventInfo& eventInfo);
1026  void TriggerAurasProcOnEvent(AuraApplicationList* myProcAuras, AuraApplicationList* targetProcAuras,
1027  Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget,
1028  uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell,
1029  DamageInfo* damageInfo, HealInfo* healInfo);
1030  void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationProcContainer& procAuras);
1031 
1032  void HandleEmoteCommand(uint32 anim_id, Player* target = nullptr, Trinity::IteratorPair<int32 const*> spellVisualKitIds = {});
1033  void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false);
1034  void FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType = BASE_ATTACK);
1035 
1036  void CalculateMeleeDamage(Unit* victim, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK);
1037  void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss);
1038  void HandleProcExtraAttackFor(Unit* victim);
1039 
1040  void CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
1041  void DealSpellDamage(SpellNonMeleeDamage const* damageInfo, bool durabilityLoss);
1042 
1043  // player or player's pet resilience (-1%)
1044  uint32 GetDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_RESILIENCE_PLAYER_DAMAGE, 1.0f, 100.0f, damage); }
1045 
1046  virtual bool CanApplyResilience() const;
1047  static void ApplyResilience(Unit const* victim, int32* damage);
1048 
1049  int32 CalculateAOEAvoidance(int32 damage, uint32 schoolMask, ObjectGuid const& casterGuid) const;
1050 
1051  float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, SpellInfo const* spellInfo) const override;
1052  SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo) const override;
1053 
1054  float GetUnitDodgeChance(WeaponAttackType attType, Unit const* victim) const;
1055  float GetUnitParryChance(WeaponAttackType attType, Unit const* victim) const;
1056  float GetUnitBlockChance(WeaponAttackType attType, Unit const* victim) const;
1057  float GetUnitMissChance() const;
1058  float GetUnitCriticalChanceDone(WeaponAttackType attackType) const;
1059  float GetUnitCriticalChanceTaken(Unit const* attacker, WeaponAttackType attackType, float critDone) const;
1060  float GetUnitCriticalChanceAgainst(WeaponAttackType attackType, Unit const* victim) const;
1061  int32 GetMechanicResistChance(SpellInfo const* spellInfo) const;
1062  bool CanUseAttackType(uint8 attacktype) const;
1063 
1064  virtual float GetBlockPercent(uint8 /*attackerLevel*/) const { return 30.0f; }
1065 
1066  float GetWeaponProcChance() const;
1067  float GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const* spellProto) const;
1068 
1069  MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackType attType) const;
1070 
1071  bool HasNpcFlag(NPCFlags flags) const { return (m_unitData->NpcFlags[0] & flags) != 0; }
1072  void AddNpcFlag(NPCFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NpcFlags, 0), flags); }
1073  void RemoveNpcFlag(NPCFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NpcFlags, 0), flags); }
1074  void SetNpcFlags(NPCFlags flags) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NpcFlags, 0), flags); }
1075  bool HasNpcFlag2(NPCFlags2 flags) const { return (m_unitData->NpcFlags[1] & flags) != 0; }
1076  void AddNpcFlag2(NPCFlags2 flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NpcFlags, 1), flags); }
1077  void RemoveNpcFlag2(NPCFlags2 flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NpcFlags, 1), flags); }
1078  void SetNpcFlags2(NPCFlags2 flags) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NpcFlags, 1), flags); }
1079  bool IsVendor() const { return HasNpcFlag(UNIT_NPC_FLAG_VENDOR); }
1080  bool IsTrainer() const { return HasNpcFlag(UNIT_NPC_FLAG_TRAINER); }
1081  bool IsQuestGiver() const { return HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); }
1082  bool IsGossip() const { return HasNpcFlag(UNIT_NPC_FLAG_GOSSIP); }
1083  bool IsTaxi() const { return HasNpcFlag(UNIT_NPC_FLAG_FLIGHTMASTER); }
1084  bool IsGuildMaster() const { return HasNpcFlag(UNIT_NPC_FLAG_PETITIONER); }
1085  bool IsBattleMaster() const { return HasNpcFlag(UNIT_NPC_FLAG_BATTLEMASTER); }
1086  bool IsBanker() const { return HasNpcFlag(UNIT_NPC_FLAG_BANKER); }
1087  bool IsInnkeeper() const { return HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER); }
1088  bool IsSpiritHealer() const { return HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER); }
1089  bool IsSpiritGuide() const { return HasNpcFlag(UNIT_NPC_FLAG_SPIRITGUIDE); }
1090  bool IsTabardDesigner() const { return HasNpcFlag(UNIT_NPC_FLAG_TABARDDESIGNER); }
1091  bool IsAuctioner() const { return HasNpcFlag(UNIT_NPC_FLAG_AUCTIONEER); }
1092  bool IsArmorer() const { return HasNpcFlag(UNIT_NPC_FLAG_REPAIR); }
1093  bool IsWildBattlePet() const { return HasNpcFlag(UNIT_NPC_FLAG_WILD_BATTLE_PET); }
1094  bool IsServiceProvider() const;
1096  bool IsCritter() const { return GetCreatureType() == CREATURE_TYPE_CRITTER; }
1097 
1098  bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
1099 
1101  bool CanHaveThreatList() const { return m_threatManager.CanHaveThreatList(); }
1102  // For NPCs with threat list: Whether there are any enemies on our threat list
1103  // For other units: Whether we're in combat
1104  // This value is different from IsInCombat when a projectile spell is midair (combat on launch - threat+aggro on impact)
1105  bool IsEngaged() const { return CanHaveThreatList() ? m_threatManager.IsEngaged() : IsInCombat(); }
1106  bool IsEngagedBy(Unit const* who) const { return CanHaveThreatList() ? IsThreatenedBy(who) : IsInCombatWith(who); }
1107  void EngageWithTarget(Unit* who); // Adds target to threat list if applicable, otherwise just sets combat state
1108  // Combat handling
1109  CombatManager& GetCombatManager() { return m_combatManager; }
1110  CombatManager const& GetCombatManager() const { return m_combatManager; }
1111  void AttackedTarget(Unit* target, bool canInitialAggro);
1112 
1113  bool IsImmuneToAll() const { return IsImmuneToPC() && IsImmuneToNPC(); }
1114  void SetImmuneToAll(bool apply, bool keepCombat);
1115  virtual void SetImmuneToAll(bool apply) { SetImmuneToAll(apply, false); }
1116  bool IsImmuneToPC() const { return HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); }
1117  void SetImmuneToPC(bool apply, bool keepCombat);
1118  virtual void SetImmuneToPC(bool apply) { SetImmuneToPC(apply, false); }
1119  bool IsImmuneToNPC() const { return HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); }
1120  void SetImmuneToNPC(bool apply, bool keepCombat);
1121  virtual void SetImmuneToNPC(bool apply) { SetImmuneToNPC(apply, false); }
1122 
1123  bool IsInCombat() const { return HasUnitFlag(UNIT_FLAG_IN_COMBAT); }
1124  bool IsInCombatWith(Unit const* who) const { return who && m_combatManager.IsInCombatWith(who); }
1125  void SetInCombatWith(Unit* enemy) { if (enemy) m_combatManager.SetInCombatWith(enemy); }
1126  void ClearInCombat() { m_combatManager.EndAllCombat(); }
1127  void UpdatePetCombatState();
1128  // Threat handling
1129  bool IsThreatened() const;
1130  bool IsThreatenedBy(Unit const* who) const { return who && m_threatManager.IsThreatenedBy(who, true); }
1131  // Exposes the threat manager directly - be careful when interfacing with this
1132  // As a general rule of thumb, any unit pointer MUST be null checked BEFORE passing it to threatmanager methods
1133  // threatmanager will NOT null check your pointers for you - misuse = crash
1134  ThreatManager& GetThreatManager() { return m_threatManager; }
1135  ThreatManager const& GetThreatManager() const { return m_threatManager; }
1136 
1137  void SendClearTarget();
1138 
1139  bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, flag128 familyFlags) const;
1140  bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
1141  bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura = 0) const;
1142  bool HasBreakableByDamageCrowdControlAura(Unit* excludeCasterChannel = nullptr) const;
1143 
1144  bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
1145  bool HasInvisibilityAura() const { return HasAuraType(SPELL_AURA_MOD_INVISIBILITY); }
1146  bool IsFeared() const { return HasAuraType(SPELL_AURA_MOD_FEAR); }
1147  bool HasRootAura() const { return HasAuraType(SPELL_AURA_MOD_ROOT) || HasAuraType(SPELL_AURA_MOD_ROOT_2); }
1148  bool IsPolymorphed() const;
1149  bool IsFrozen() const { return HasAuraState(AURA_STATE_FROZEN); }
1150 
1151  bool isTargetableForAttack(bool checkFakeDeath = true) const;
1152 
1153  virtual bool IsInWater() const;
1154  virtual bool IsUnderWater() const;
1155  bool isInAccessiblePlaceFor(Creature const* c) const;
1156 
1157  void SendHealSpellLog(HealInfo& healInfo, bool critical = false);
1158  int32 HealBySpell(HealInfo& healInfo, bool critical = false);
1159  void SendEnergizeSpellLog(Unit* victim, uint32 spellId, int32 damage, int32 overEnergize, Powers powerType);
1160  void EnergizeBySpell(Unit* victim, SpellInfo const* spellInfo, int32 damage, Powers powerType);
1161 
1162  Aura* AddAura(uint32 spellId, Unit* target);
1163  Aura* AddAura(SpellInfo const* spellInfo, uint32 effMask, Unit* target);
1164  void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
1165 
1166  void SendCancelOrphanSpellVisual(uint32 id);
1167  void SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
1168  void SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
1169  void SendCancelSpellVisual(uint32 id);
1170  void SendPlaySpellVisual(Unit* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
1171  void SendPlaySpellVisual(Position const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
1172  void SendCancelSpellVisualKit(uint32 id);
1173  void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const;
1174  void CancelSpellMissiles(uint32 spellId, bool reverseMissile = false);
1175 
1176  void DeMorph();
1177 
1178  void SendAttackStateUpdate(CalcDamageInfo* damageInfo);
1179  void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount);
1180  void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const* log);
1181  void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo);
1182  void SendSpellDamageResist(Unit* target, uint32 spellId);
1183  void SendSpellDamageImmune(Unit* target, uint32 spellId, bool isPeriodic);
1184 
1185  void NearTeleportTo(Position const& pos, bool casting = false);
1186  void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false) { NearTeleportTo(Position(x, y, z, orientation), casting); }
1187  void SendTeleportPacket(Position const& pos);
1188  virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport = false);
1189  // returns true if unit's position really changed
1190  virtual bool UpdatePosition(Position const& pos, bool teleport = false);
1191  void UpdateOrientation(float orientation);
1192  void UpdateHeight(float newZ);
1193 
1194  void SendMoveKnockBack(Player* player, float speedXY, float speedZ, float vcos, float vsin);
1195  void KnockbackFrom(Position const& origin, float speedXY, float speedZ, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
1196  void JumpTo(float speedXY, float speedZ, bool forward = true);
1197  void JumpTo(WorldObject* obj, float speedZ, bool withOrientation = false);
1198 
1199  void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false);
1200 
1201  void SendSetPlayHoverAnim(bool enable);
1202  void SetHoverHeight(float hoverHeight) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::HoverHeight), hoverHeight); }
1203 
1204  bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); }
1205  bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); }
1206  bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); }
1207  bool SetWalk(bool enable);
1208  bool SetDisableGravity(bool disable);
1209  bool SetFall(bool enable);
1210  bool SetSwim(bool enable);
1211  bool SetCanFly(bool enable);
1212  bool SetWaterWalking(bool enable);
1213  bool SetFeatherFall(bool enable);
1214  bool SetHover(bool enable);
1215  bool SetCollision(bool disable);
1216  bool SetCanTransitionBetweenSwimAndFly(bool enable);
1217  bool SetCanTurnWhileFalling(bool enable);
1218  bool SetCanDoubleJump(bool enable);
1219  void SendSetVehicleRecId(uint32 vehicleId);
1220 
1221  MovementForces const* GetMovementForces() const { return _movementForces.get(); }
1222  void ApplyMovementForce(ObjectGuid id, Position origin, float magnitude, uint8 type, Position direction = {}, ObjectGuid transportGuid = ObjectGuid::Empty);
1223  void RemoveMovementForce(ObjectGuid id);
1224  bool SetIgnoreMovementForces(bool ignore);
1225  void UpdateMovementForcesModMagnitude();
1226 
1227  void SetInFront(WorldObject const* target);
1228  void SetFacingTo(float const ori, bool force = true);
1229  void SetFacingToObject(WorldObject const* object, bool force = true);
1230 
1231  bool IsAlive() const { return (m_deathState == ALIVE); }
1232  bool isDying() const { return (m_deathState == JUST_DIED); }
1233  bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }
1234  DeathState getDeathState() const { return m_deathState; }
1235  virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet
1236 
1237  ObjectGuid GetOwnerGUID() const override { return m_unitData->SummonedBy; }
1238  void SetOwnerGUID(ObjectGuid owner);
1239  ObjectGuid GetCreatorGUID() const { return m_unitData->CreatedBy; }
1240  void SetCreatorGUID(ObjectGuid creator) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::CreatedBy), creator); }
1241  ObjectGuid GetMinionGUID() const { return m_unitData->Summon; }
1242  void SetMinionGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Summon), guid); }
1243  ObjectGuid GetPetGUID() const { return m_SummonSlot[SUMMON_SLOT_PET]; }
1244  void SetPetGUID(ObjectGuid guid) { m_SummonSlot[SUMMON_SLOT_PET] = guid; }
1245  ObjectGuid GetCritterGUID() const { return m_unitData->Critter; }
1246  void SetCritterGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::Critter), guid); }
1247  ObjectGuid GetBattlePetCompanionGUID() const { return m_unitData->BattlePetCompanionGUID; }
1249  ObjectGuid GetDemonCreatorGUID() const { return m_unitData->DemonCreator; }
1250  void SetDemonCreatorGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::DemonCreator), guid); }
1251 
1252  ObjectGuid GetCharmerGUID() const { return m_unitData->CharmedBy; }
1253  Unit* GetCharmer() const { return m_charmer; }
1254 
1255  ObjectGuid GetCharmedGUID() const { return m_unitData->Charm; }
1256  Unit* GetCharmed() const { return m_charmed; }
1257 
1258  bool IsControlledByPlayer() const { return m_ControlledByPlayer; }
1259  Player* GetControllingPlayer() const;
1260  ObjectGuid GetCharmerOrOwnerGUID() const override { return IsCharmed() ? GetCharmerGUID() : GetOwnerGUID(); }
1261  bool IsCharmedOwnedByPlayerOrPlayer() const { return GetCharmerOrOwnerOrOwnGUID().IsPlayer(); }
1262 
1263  Guardian* GetGuardianPet() const;
1264  Minion* GetFirstMinion() const;
1265  Unit* GetCharmerOrOwner() const { return IsCharmed() ? GetCharmer() : GetOwner(); }
1266 
1267  void SetMinion(Minion *minion, bool apply);
1268  void GetAllMinionsByEntry(std::list<TempSummon*>& Minions, uint32 entry);
1269  void RemoveAllMinionsByEntry(uint32 entry);
1270  void SetCharm(Unit* target, bool apply);
1271  Unit* GetNextRandomRaidMemberOrPet(float radius);
1272  bool SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* aurApp = nullptr);
1273  void RemoveCharmedBy(Unit* charmer);
1274  void RestoreFaction();
1275 
1276  ControlList m_Controlled;
1277  Unit* GetFirstControlled() const;
1278  void RemoveAllControlled();
1279 
1280  bool IsCharmed() const { return !GetCharmerGUID().IsEmpty(); }
1281  bool isPossessed() const { return HasUnitState(UNIT_STATE_POSSESSED); }
1282  bool isPossessedByPlayer() const;
1283  bool isPossessing() const;
1284  bool isPossessing(Unit* u) const;
1285 
1286  CharmInfo* GetCharmInfo() { return m_charmInfo; }
1287  CharmInfo* InitCharmInfo();
1288  void DeleteCharmInfo();
1289  void SetPetNumberForClient(uint32 petNumber) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PetNumber), petNumber); }
1290  void SetPetNameTimestamp(uint32 timestamp) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::PetNameTimestamp), timestamp); }
1291  // returns the unit that this player IS CONTROLLING
1292  Unit* GetUnitBeingMoved() const;
1293  // returns the player that this player IS CONTROLLING
1294  Player* GetPlayerBeingMoved() const;
1295  // returns the player that this unit is BEING CONTROLLED BY
1296  Player* GetPlayerMovingMe() const { return m_playerMovingMe; }
1297  // only set for direct client control (possess effects, vehicles and similar)
1299  SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
1300  void AddPlayerToVision(Player* player);
1301  void RemovePlayerFromVision(Player* player);
1302  bool HasSharedVision() const { return !m_sharedVision.empty(); }
1303  void RemoveBindSightAuras();
1304  void RemoveCharmAuras();
1305 
1306  Pet* CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id = 0);
1307  Pet* CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id = 0);
1308  bool InitTamedPet(Pet* pet, uint8 level, uint32 spell_id);
1309 
1310  uint32 GetBattlePetCompanionNameTimestamp() const { return m_unitData->BattlePetCompanionNameTimestamp; }
1311  void SetBattlePetCompanionNameTimestamp(uint32 timestamp) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BattlePetCompanionNameTimestamp), timestamp); }
1312  uint32 GetWildBattlePetLevel() const { return m_unitData->WildBattlePetLevel; }
1313  void SetWildBattlePetLevel(uint32 wildBattlePetLevel) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::WildBattlePetLevel), wildBattlePetLevel); }
1314 
1315  // aura apply/remove helpers - you should better not use these
1316  Aura* _TryStackingOrRefreshingExistingAura(AuraCreateInfo& createInfo);
1317  void _AddAura(UnitAura* aura, Unit* caster);
1318  AuraApplication* _CreateAuraApplication(Aura* aura, uint32 effMask);
1319  void _ApplyAuraEffect(Aura* aura, uint8 effIndex);
1320  void _ApplyAura(AuraApplication* aurApp, uint32 effMask);
1321  void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMode);
1322  void _UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode);
1323  void _RemoveNoStackAurasDueToAura(Aura* aura);
1324  void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);
1325 
1326  // m_ownedAuras container management
1327  AuraMap & GetOwnedAuras() { return m_ownedAuras; }
1328  AuraMap const& GetOwnedAuras() const { return m_ownedAuras; }
1329 
1330  void RemoveOwnedAura(AuraMap::iterator& i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
1331  void RemoveOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
1332  void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
1333 
1334  Aura* GetOwnedAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, Aura* except = nullptr) const;
1335 
1336  // m_appliedAuras container management
1337  AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; }
1338  AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; }
1339 
1340  void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
1341  void RemoveAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
1342  void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
1343  void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
1344 
1345  // Convenience methods removing auras by predicate
1346  void RemoveAppliedAuras(std::function<bool(AuraApplication const*)> const& check);
1347  void RemoveOwnedAuras(std::function<bool(Aura const*)> const& check);
1348 
1349  // Optimized overloads taking advantage of map key
1350  void RemoveAppliedAuras(uint32 spellId, std::function<bool(AuraApplication const*)> const& check);
1351  void RemoveOwnedAuras(uint32 spellId, std::function<bool(Aura const*)> const& check);
1352 
1353  void RemoveAurasByType(AuraType auraType, std::function<bool(AuraApplication const*)> const& check);
1354 
1355  void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
1356  void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT, uint16 num = 1);
1357  void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, WorldObject* dispeller, uint8 chargesRemoved = 1);
1358  void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject* stealer);
1359  void RemoveAurasDueToItemSpell(uint32 spellId, ObjectGuid castItemGuid);
1360  void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID = ObjectGuid::Empty, Aura* except = nullptr, bool negative = true, bool positive = true);
1361  void RemoveNotOwnSingleTargetAuras(bool onPhaseChange = false);
1362  template <typename InterruptFlags>
1363  void RemoveAurasWithInterruptFlags(InterruptFlags flag, uint32 except = 0);
1364  void RemoveAurasWithAttribute(uint32 flags);
1365  void RemoveAurasWithFamily(SpellFamilyNames family, flag128 const& familyFlag, ObjectGuid casterGUID);
1366  void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except = 0);
1367  void RemoveMovementImpairingAuras(bool withRoot);
1368  void RemoveAurasByShapeShift();
1369 
1370  void RemoveAreaAurasDueToLeaveWorld();
1371  void RemoveAllAuras();
1372  void RemoveArenaAuras();
1373  void RemoveAurasOnEvade();
1374  void RemoveAllAurasOnDeath();
1375  void RemoveAllAurasRequiringDeadTarget();
1376  void RemoveAllAurasExceptType(AuraType type);
1377  void RemoveAllAurasExceptType(AuraType type1, AuraType type2);
1378  void RemoveAllGroupBuffsFromCaster(ObjectGuid casterGUID);
1379  void DelayOwnedAuras(uint32 spellId, ObjectGuid caster, int32 delaytime);
1380 
1381  void _RemoveAllAuraStatMods();
1382  void _ApplyAllAuraStatMods();
1383 
1384  AuraEffectList const& GetAuraEffectsByType(AuraType type) const { return m_modAuras[type]; }
1385  AuraEffectList& GetAuraEffectsByType(AuraType type) { return m_modAuras[type]; }
1386  AuraList & GetSingleCastAuras() { return m_scAuras; }
1387  AuraList const& GetSingleCastAuras() const { return m_scAuras; }
1388 
1389  AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const;
1390  AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID = ObjectGuid::Empty) const;
1391  AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, flag128 const& familyFlag, ObjectGuid casterGUID = ObjectGuid::Empty) const;
1392 
1393  AuraApplication* GetAuraApplication(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraApplication* except = nullptr) const;
1394  AuraApplication* GetAuraApplication(uint32 spellId, std::function<bool(AuraApplication const*)> const& predicate) const;
1395  AuraApplication* GetAuraApplication(uint32 spellId, std::function<bool(Aura const*)> const& predicate) const;
1396  AuraApplication* GetAuraApplication(std::function<bool(AuraApplication const*)> const& predicate) const;
1397  AuraApplication* GetAuraApplication(std::function<bool(Aura const*)> const& predicate) const;
1398 
1399  Aura* GetAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0) const;
1400  Aura* GetAura(uint32 spellId, std::function<bool(Aura const*)> const& predicate) const;
1401  Aura* GetAura(std::function<bool(Aura const*)> const& predicate) const;
1402 
1403  AuraApplication* GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0, AuraApplication* except = nullptr) const;
1404  Aura* GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0) const;
1405 
1406  void GetDispellableAuraList(WorldObject const* caster, uint32 dispelMask, DispelChargesList& dispelList, bool isReflect = false) const;
1407 
1408  bool HasAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid caster = ObjectGuid::Empty) const;
1409  uint32 GetAuraCount(uint32 spellId) const;
1410  bool HasAura(uint32 spellId, ObjectGuid casterGUID = ObjectGuid::Empty, ObjectGuid itemCasterGUID = ObjectGuid::Empty, uint32 reqEffMask = 0) const;
1411  bool HasAura(std::function<bool(Aura const*)> const& predicate) const;
1412  bool HasAuraType(AuraType auraType) const;
1413  bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster) const;
1414  bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const;
1415  bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo const* affectedSpell) const;
1416  bool HasAuraTypeWithValue(AuraType auraType, int32 value) const;
1417  template <typename InterruptFlags>
1418  bool HasNegativeAuraWithInterruptFlag(InterruptFlags flag, ObjectGuid guid = ObjectGuid::Empty) const;
1419  bool HasAuraWithMechanic(uint32 mechanicMask) const;
1420  bool HasStrongerAuraWithDR(SpellInfo const* auraSpellInfo, Unit* caster) const;
1421 
1422  AuraEffect* IsScriptOverriden(SpellInfo const* spell, int32 script) const;
1423  uint32 GetDiseasesByCaster(ObjectGuid casterGUID, bool remove = false);
1424  uint32 GetDoTsByCaster(ObjectGuid casterGUID) const;
1425 
1426  int32 GetTotalAuraModifier(AuraType auraType) const;
1427  float GetTotalAuraMultiplier(AuraType auraType) const;
1428  int32 GetMaxPositiveAuraModifier(AuraType auraType) const;
1429  int32 GetMaxNegativeAuraModifier(AuraType auraType) const;
1430 
1431  int32 GetTotalAuraModifier(AuraType auraType, std::function<bool(AuraEffect const*)> const& predicate) const;
1432  float GetTotalAuraMultiplier(AuraType auraType, std::function<bool(AuraEffect const*)> const& predicate) const;
1433  int32 GetMaxPositiveAuraModifier(AuraType auraType, std::function<bool(AuraEffect const*)> const& predicate) const;
1434  int32 GetMaxNegativeAuraModifier(AuraType auraType, std::function<bool(AuraEffect const*)> const& predicate) const;
1435 
1436  int32 GetTotalAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask) const;
1437  float GetTotalAuraMultiplierByMiscMask(AuraType auraType, uint32 misc_mask) const;
1438  int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask, AuraEffect const* except = nullptr) const;
1439  int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auraType, uint32 misc_mask) const;
1440 
1441  int32 GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const;
1442  float GetTotalAuraMultiplierByMiscValue(AuraType auraType, int32 misc_value) const;
1443  int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const;
1444  int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const;
1445 
1446  int32 GetTotalAuraModifierByAffectMask(AuraType auraType, SpellInfo const* affectedSpell) const;
1447  float GetTotalAuraMultiplierByAffectMask(AuraType auraType, SpellInfo const* affectedSpell) const;
1448  int32 GetMaxPositiveAuraModifierByAffectMask(AuraType auraType, SpellInfo const* affectedSpell) const;
1449  int32 GetMaxNegativeAuraModifierByAffectMask(AuraType auraType, SpellInfo const* affectedSpell) const;
1450 
1451  void InitStatBuffMods();
1452  void UpdateStatBuffMod(Stats stat);
1453  void UpdateStatBuffModForClient(Stats stat);
1454  void SetCreateStat(Stats stat, float val) { m_createStats[stat] = val; }
1455  void SetCreateHealth(uint32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BaseHealth), val); }
1456  uint32 GetCreateHealth() const { return m_unitData->BaseHealth; }
1457  void SetCreateMana(uint32 val) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::BaseMana), val); }
1458  uint32 GetCreateMana() const { return m_unitData->BaseMana; }
1459  int32 GetCreatePowerValue(Powers power) const;
1460  float GetPosStat(Stats stat) const { return m_unitData->StatPosBuff[stat]; }
1461  float GetNegStat(Stats stat) const { return m_unitData->StatNegBuff[stat]; }
1462  float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
1463 
1464  uint32 GetChannelSpellId() const { return m_unitData->ChannelData->SpellID; }
1465  void SetChannelSpellId(uint32 channelSpellId)
1466  {
1467  SetUpdateFieldValue(m_values
1468  .ModifyValue(&Unit::m_unitData)
1469  .ModifyValue(&UF::UnitData::ChannelData)
1470  .ModifyValue(&UF::UnitChannel::SpellID), channelSpellId);
1471  }
1472  uint32 GetChannelSpellXSpellVisualId() const { return m_unitData->ChannelData->SpellVisual.SpellXSpellVisualID; }
1473  uint32 GetChannelScriptVisualId() const { return m_unitData->ChannelData->SpellVisual.ScriptVisualID; }
1474  void SetChannelVisual(SpellCastVisual channelVisual)
1475  {
1476  SetUpdateFieldValue(m_values
1477  .ModifyValue(&Unit::m_unitData)
1478  .ModifyValue(&UF::UnitData::ChannelData)
1479  .ModifyValue(&UF::UnitChannel::SpellVisual), channelVisual);
1480  }
1481  void AddChannelObject(ObjectGuid guid) { AddDynamicUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ChannelObjects)) = guid; }
1482  void SetChannelObject(uint32 slot, ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ChannelObjects, slot), guid); }
1484  {
1485  int32 index = m_unitData->ChannelObjects.FindIndex(guid);
1486  if (index >= 0)
1487  RemoveDynamicUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::ChannelObjects), index);
1488  }
1490 
1491  void SetCurrentCastSpell(Spell* pSpell);
1492  void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true);
1493  void FinishSpell(CurrentSpellTypes spellType, bool ok = true);
1494 
1495  // set withDelayed to true to account delayed spells as cast
1496  // delayed+channeled spells are always accounted as cast
1497  // we can skip channeled or delayed checks using flags
1498  bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled = false, bool skipAutorepeat = false, bool isAutoshoot = false, bool skipInstant = true) const;
1499 
1500  // set withDelayed to true to interrupt delayed spells too
1501  // delayed+channeled spells are always interrupted
1502  void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid = 0, bool withInstant = true);
1503 
1504  Spell* GetCurrentSpell(CurrentSpellTypes spellType) const { return m_currentSpells[spellType]; }
1505  Spell* GetCurrentSpell(uint32 spellType) const { return m_currentSpells[spellType]; }
1506  Spell* FindCurrentSpellBySpellId(uint32 spell_id) const;
1507  int32 GetCurrentSpellCastTime(uint32 spell_id) const;
1508  virtual SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const;
1509  uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const override;
1510 
1511  virtual bool IsFocusing(Spell const* /*focusSpell*/ = nullptr, bool /*withDelay*/ = false) { return false; }
1512  virtual bool IsMovementPreventedByCasting() const;
1513  bool CanCastSpellWhileMoving(SpellInfo const* spellInfo) const;
1514 
1515  SpellHistory* GetSpellHistory() { return _spellHistory; }
1516  SpellHistory const* GetSpellHistory() const { return _spellHistory; }
1517 
1520 
1521  ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(*m_unitData->ShapeshiftForm); }
1522  void SetShapeshiftForm(ShapeshiftForm form);
1523 
1524  bool IsInFeralForm() const;
1525 
1526  bool IsInDisallowedMountForm() const;
1527  bool IsDisallowedMountForm(uint32 spellId, ShapeshiftForm form, uint32 displayId) const;
1528 
1533 
1534 
1535  uint32 m_baseAttackSpeed[MAX_ATTACK];
1536  float m_modAttackSpeedPct[MAX_ATTACK];
1537  uint32 m_attackTimer[MAX_ATTACK];
1538 
1539  // stat system
1540  void HandleStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float amount, bool apply);
1541  void ApplyStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float amount);
1542 
1543  void SetStatFlatModifier(UnitMods unitMod, UnitModifierFlatType modifierType, float val);
1544  void SetStatPctModifier(UnitMods unitMod, UnitModifierPctType modifierType, float val);
1545 
1546  float GetFlatModifierValue(UnitMods unitMod, UnitModifierFlatType modifierType) const;
1547  float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const;
1548 
1549  void UpdateUnitMod(UnitMods unitMod);
1550 
1551  // only players have item requirements
1552  virtual bool CheckAttackFitToAuraRequirement(WeaponAttackType /*attackType*/, AuraEffect const* /*aurEff*/) const { return true; }
1553 
1554  virtual void UpdateDamageDoneMods(WeaponAttackType attackType, int32 skipEnchantSlot = -1);
1555  void UpdateAllDamageDoneMods();
1556 
1557  void UpdateDamagePctDoneMods(WeaponAttackType attackType);
1558  void UpdateAllDamagePctDoneMods();
1559 
1560  float GetTotalStatValue(Stats stat) const;
1561  float GetTotalAuraModValue(UnitMods unitMod) const;
1562  SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const;
1563  Stats GetStatByAuraGroup(UnitMods unitMod) const;
1564  bool CanModifyStats() const { return m_canModifyStats; }
1565  void SetCanModifyStats(bool modifyStats) { m_canModifyStats = modifyStats; }
1566  virtual bool UpdateStats(Stats stat) = 0;
1567  virtual bool UpdateAllStats() = 0;
1568  virtual void UpdateResistances(uint32 school);
1569  virtual void UpdateAllResistances();
1570  virtual void UpdateArmor() = 0;
1571  virtual void UpdateMaxHealth() = 0;
1572  virtual void UpdateMaxPower(Powers power) = 0;
1573  virtual uint32 GetPowerIndex(Powers power) const = 0;
1574  virtual void UpdateAttackPowerAndDamage(bool ranged = false) = 0;
1575  void SetAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::AttackPower), attackPower); }
1576  void SetAttackPowerModPos(int32 attackPowerMod) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::AttackPowerModPos), attackPowerMod); }
1577  void SetAttackPowerModNeg(int32 attackPowerMod) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::AttackPowerModNeg), attackPowerMod); }
1578  void SetAttackPowerMultiplier(float attackPowerMult) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::AttackPowerMultiplier), attackPowerMult); }
1579  void SetRangedAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPower), attackPower); }
1580  void SetRangedAttackPowerModPos(int32 attackPowerMod) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPowerModPos), attackPowerMod); }
1581  void SetRangedAttackPowerModNeg(int32 attackPowerMod) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPowerModNeg), attackPowerMod); }
1582  void SetRangedAttackPowerMultiplier(float attackPowerMult) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedAttackPowerMultiplier), attackPowerMult); }
1583  void SetMainHandWeaponAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::MainHandWeaponAttackPower), attackPower); }
1584  void SetOffHandWeaponAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::OffHandWeaponAttackPower), attackPower); }
1585  void SetRangedWeaponAttackPower(int32 attackPower) { SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::RangedWeaponAttackPower), attackPower); }
1586  virtual void UpdateDamagePhysical(WeaponAttackType attType);
1587  float GetTotalAttackPowerValue(WeaponAttackType attType, bool includeWeapon = true) const;
1588  float GetWeaponDamageRange(WeaponAttackType attType, WeaponDamageRange type) const;
1589  void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; }
1590  virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& minDamage, float& maxDamage) const = 0;
1591  uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct) const;
1592  float GetAPMultiplier(WeaponAttackType attType, bool normalized) const;
1593 
1594  bool isInFrontInMap(Unit const* target, float distance, float arc = float(M_PI)) const;
1595  bool isInBackInMap(Unit const* target, float distance, float arc = float(M_PI)) const;
1596 
1597  // Visibility system
1598  bool IsVisible() const;
1599  void SetVisible(bool x);
1600 
1601  // common function for visibility checks for player/creatures with detection code
1602  void OnPhaseChange();
1603  void UpdateObjectVisibility(bool forced = true) override;
1604 
1607 
1608  VisibleAuraContainer const& GetVisibleAuras() const { return m_visibleAuras; }
1609  bool HasVisibleAura(AuraApplication* aurApp) const { return m_visibleAuras.count(aurApp) > 0; }
1610  void SetVisibleAura(AuraApplication* aurApp);
1611  void SetVisibleAuraUpdate(AuraApplication* aurApp) { m_visibleAurasToUpdate.insert(aurApp); }
1612  void RemoveVisibleAura(AuraApplication* aurApp);
1613 
1614  bool HasInterruptFlag(SpellAuraInterruptFlags flags) const { return m_interruptMask.HasFlag(flags); }
1615  bool HasInterruptFlag(SpellAuraInterruptFlags2 flags) const { return m_interruptMask2.HasFlag(flags); }
1617  {
1618  m_interruptMask |= flags;
1619  m_interruptMask2 |= flags2;
1620  }
1621  void UpdateInterruptMask();
1622 
1623  uint32 GetDisplayId() const { return m_unitData->DisplayID; }
1624  virtual void SetDisplayId(uint32 modelId, float displayScale = 1.f);
1625  uint32 GetNativeDisplayId() const { return m_unitData->NativeDisplayID; }
1626  float GetNativeDisplayScale() const { return m_unitData->NativeXDisplayScale; }
1627  void RestoreDisplayId(bool ignorePositiveAurasPreventingMounting = false);
1628  void SetNativeDisplayId(uint32 displayId, float displayScale = 1.f)
1629  {
1630  SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NativeDisplayID), displayId);
1631  SetUpdateFieldValue(m_values.ModifyValue(&Unit::m_unitData).ModifyValue(&UF::UnitData::NativeXDisplayScale), displayScale);
1632  }
1633  void SetTransformSpell(uint32 spellid) { m_transformSpell = spellid;}
1634  uint32 GetTransformSpell() const { return m_transformSpell;}
1635 
1636  // DynamicObject management
1637  void _RegisterDynObject(DynamicObject* dynObj);
1638  void _UnregisterDynObject(DynamicObject* dynObj);
1639  DynamicObject* GetDynObject(uint32 spellId) const;
1640  std::vector<DynamicObject*> GetDynObjects(uint32 spellId) const;
1641  void RemoveDynObject(uint32 spellId);
1642  void RemoveAllDynObjects();
1643 
1644  GameObject* GetGameObject(uint32 spellId) const;
1645  std::vector<GameObject*> GetGameObjects(uint32 spellId) const;
1646  void AddGameObject(GameObject* gameObj);
1647  void RemoveGameObject(GameObject* gameObj, bool del);
1648  void RemoveGameObject(uint32 spellid, bool del);
1649  void RemoveAllGameObjects();
1650 
1651  // AreaTrigger management
1652  void _RegisterAreaTrigger(AreaTrigger* areaTrigger);
1653  void _UnregisterAreaTrigger(AreaTrigger* areaTrigger);
1654  AreaTrigger* GetAreaTrigger(uint32 spellId) const;
1655  std::vector<AreaTrigger*> GetAreaTriggers(uint32 spellId) const;
1656  void RemoveAreaTrigger(uint32 spellId);
1657  void RemoveAreaTrigger(AuraEffect const* aurEff);
1658  void RemoveAllAreaTriggers();
1659 
1660  void ModifyAuraState(AuraStateType flag, bool apply);
1661  uint32 BuildAuraStateUpdateForTarget(Unit const* target) const;
1662  bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = nullptr, Unit const* Caster = nullptr) const;
1663  void UnsummonAllTotems();
1664  bool IsMagnet() const;
1665  Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = nullptr);
1666 
1667  int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const;
1668  uint32 SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const& spellEffectInfo, uint32 stack = 1) const;
1669  float SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, DamageEffectType damagetype) const;
1670  uint32 SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 pdamage, DamageEffectType damagetype) const;
1671  int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const;
1672  uint32 SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const& spellEffectInfo, uint32 stack = 1) const;
1673  float SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const;
1674  uint32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype) const;
1675 
1676  uint32 MeleeDamageBonusDone(Unit* pVictim, uint32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto = nullptr, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL);
1677  uint32 MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const* spellProto = nullptr, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL);
1678 
1679  bool isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK);
1680  bool isBlockCritical();
1681  float SpellCritChanceDone(Spell* spell, AuraEffect const* aurEff, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
1682  float SpellCritChanceTaken(Unit const* caster, Spell* spell, AuraEffect const* aurEff, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType = BASE_ATTACK) const;
1683  static uint32 SpellCriticalDamageBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim);
1684  static uint32 SpellCriticalHealingBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim);
1685 
1686  void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
1687  virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, WorldObject const* caster) const;
1688  uint32 GetSchoolImmunityMask() const;
1689  uint32 GetDamageImmunityMask() const;
1690  uint32 GetMechanicImmunityMask() const;
1691 
1692  bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const;
1693  bool IsImmunedToDamage(SpellInfo const* spellInfo) const;
1694  virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, WorldObject const* caster) const;
1695 
1696  static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = nullptr);
1697  static uint32 CalcArmorReducedDamage(Unit const* attacker, Unit* victim, uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType = MAX_ATTACK, uint8 attackerLevel = 0);
1698  static uint32 CalcSpellResistedDamage(Unit const* attacker, Unit* victim, uint32 damage, SpellSchoolMask schoolMask, SpellInfo const* spellInfo);
1699  static void CalcAbsorbResist(DamageInfo& damageInfo);
1700  static void CalcHealAbsorb(HealInfo& healInfo);
1701 
1702  void UpdateSpeed(UnitMoveType mtype);
1703  float GetSpeed(UnitMoveType mtype) const;
1704  float GetSpeedRate(UnitMoveType mtype) const { return m_speed_rate[mtype]; }
1705  void SetSpeed(UnitMoveType mtype, float newValue);
1706  void SetSpeedRate(UnitMoveType mtype, float rate);
1707 
1708  void FollowerAdded(AbstractFollower* f) { m_followingMe.insert(f); }
1709  void FollowerRemoved(AbstractFollower* f) { m_followingMe.erase(f); }
1710  void RemoveAllFollowers();
1711 
1712  MotionMaster* GetMotionMaster() { return i_motionMaster; }
1713  MotionMaster const* GetMotionMaster() const { return i_motionMaster; }
1714  virtual MovementGeneratorType GetDefaultMovementType() const;
1715 
1716  bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); }
1717  void StopMoving();
1718  void PauseMovement(uint32 timer = 0, uint8 slot = 0, bool forced = true); // timer in ms
1719  void ResumeMovement(uint32 timer = 0, uint8 slot = 0); // timer in ms
1720 
1721  void AddUnitMovementFlag(uint32 f) { m_movementInfo.AddMovementFlag(f); }
1722  void RemoveUnitMovementFlag(uint32 f) { m_movementInfo.RemoveMovementFlag(f); }
1723  bool HasUnitMovementFlag(uint32 f) const { return m_movementInfo.HasMovementFlag(f); }
1724  uint32 GetUnitMovementFlags() const { return m_movementInfo.GetMovementFlags(); }
1725  void SetUnitMovementFlags(uint32 f) { m_movementInfo.SetMovementFlags(f); }
1726 
1727  void AddExtraUnitMovementFlag(uint32 f) { m_movementInfo.AddExtraMovementFlag(f); }
1728  void RemoveExtraUnitMovementFlag(uint32 f) { m_movementInfo.RemoveExtraMovementFlag(f); }
1729  bool HasExtraUnitMovementFlag(uint32 f) const { return m_movementInfo.HasExtraMovementFlag(f); }
1730  uint32 GetExtraUnitMovementFlags() const { return m_movementInfo.GetExtraMovementFlags(); }
1731  void SetExtraUnitMovementFlags(uint32 f) { m_movementInfo.SetExtraMovementFlags(f); }
1732  bool IsSplineEnabled() const;
1733 
1734  void SetControlled(bool apply, UnitState state);
1735  void ApplyControlStatesIfNeeded();
1736 
1738  uint32 GetComboPoints() const { return uint32(GetPower(POWER_COMBO_POINTS)); }
1739  void AddComboPoints(int8 count, Spell* spell = nullptr);
1740  void GainSpellComboPoints(int8 count);
1741  void ClearComboPoints();
1742 
1744  void SendPetActionFeedback(PetActionFeedback msg, uint32 spellId);
1745  void SendPetTalk(uint32 pettalk);
1746  void SendPetAIReaction(ObjectGuid guid);
1748 
1749  void PropagateSpeedChange();
1750 
1751  // reactive attacks
1752  void ClearAllReactives();
1753  void StartReactiveTimer(ReactiveType reactive) { m_reactiveTimer[reactive] = REACTIVE_TIMER_START;}
1754  void UpdateReactives(uint32 p_time);
1755 
1756  // group updates
1757  void UpdateAuraForGroup();
1758 
1759  // proc trigger system
1760  bool CanProc() const { return !m_procDeep; }
1761  void SetCantProc(bool apply);
1762 
1763  uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const;
1764 
1765  friend class VehicleJoinEvent;
1767  bool CreateVehicleKit(uint32 id, uint32 creatureEntry, bool loading = false);
1768  void RemoveVehicleKit(bool onRemoveFromWorld = false);
1769  Vehicle* GetVehicleKit()const { return m_vehicleKit; }
1770  Vehicle* GetVehicle() const { return m_vehicle; }
1771  void SetVehicle(Vehicle* vehicle) { m_vehicle = vehicle; }
1772  bool IsOnVehicle(Unit const* vehicle) const;
1773  Unit* GetVehicleBase() const;
1774  Creature* GetVehicleCreatureBase() const;
1775  ObjectGuid GetTransGUID() const override;
1777  TransportBase* GetDirectTransport() const;
1778 
1779  void HandleSpellClick(Unit* clicker, int8 seatId = -1);
1780  void EnterVehicle(Unit* base, int8 seatId = -1);
1781  void ExitVehicle(Position const* exitPosition = nullptr);
1782  void ChangeSeat(int8 seatId, bool next = true);
1783 
1784  // Should only be called by AuraEffect::HandleAuraControlVehicle(AuraApplication const* auraApp, uint8 mode, bool apply) const;
1785  void _ExitVehicle(Position const* exitPosition = nullptr);
1786  void _EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp = nullptr);
1787 
1788  bool isMoving() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING); }
1789  bool isTurning() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_TURNING); }
1790  virtual bool CanFly() const = 0;
1791  bool IsFlying() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_DISABLE_GRAVITY); }
1792  bool IsFalling() const;
1793  virtual bool CanSwim() const;
1794 
1795  float GetHoverOffset() const
1796  {
1797  return HasUnitMovementFlag(MOVEMENTFLAG_HOVER) ? *m_unitData->HoverHeight : 0.0f;
1798  }
1799 
1800  void RewardRage(uint32 baseRage);
1801 
1802  virtual float GetFollowAngle() const { return static_cast<float>(M_PI/2); }
1803 
1804  void OutDebugInfo() const;
1805  virtual bool IsLoading() const { return false; }
1806  bool IsDuringRemoveFromWorld() const {return m_duringRemoveFromWorld;}
1807 
1808  Pet* ToPet() { if (IsPet()) return reinterpret_cast<Pet*>(this); else return nullptr; }
1809  Pet const* ToPet() const { if (IsPet()) return reinterpret_cast<Pet const*>(this); else return nullptr; }
1810 
1811  Totem* ToTotem() { if (IsTotem()) return reinterpret_cast<Totem*>(this); else return nullptr; }
1812  Totem const* ToTotem() const { if (IsTotem()) return reinterpret_cast<Totem const*>(this); else return nullptr; }
1813 
1814  TempSummon* ToTempSummon() { if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return nullptr; }
1815  TempSummon const* ToTempSummon() const { if (IsSummon()) return reinterpret_cast<TempSummon const*>(this); else return nullptr; }
1816 
1817  ObjectGuid GetTarget() const { return m_unitData->Target; }
1818  virtual void SetTarget(ObjectGuid const& /*guid*/) = 0;
1819 
1820  void SetInstantCast(bool set) { _instantCast = set; }
1821  bool CanInstantCast() const { return _instantCast; }
1822 
1823  // Movement info
1825 
1826  int32 GetHighestExclusiveSameEffectSpellGroupValue(AuraEffect const* aurEff, AuraType auraType, bool checkMiscValue = false, int32 miscValue = 0) const;
1827  bool IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications = false);
1828 
1829  virtual void Talk(std::string const& text, ChatMsg msgType, Language language, float textRange, WorldObject const* target);
1830  virtual void Say(std::string const& text, Language language, WorldObject const* target = nullptr);
1831  virtual void Yell(std::string const& text, Language language, WorldObject const* target = nullptr);
1832  virtual void TextEmote(std::string const& text, WorldObject const* target = nullptr, bool isBossEmote = false);
1833  virtual void Whisper(std::string const& text, Language language, Player* target, bool isBossWhisper = false);
1834  virtual void Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject const* target);
1835  virtual void Say(uint32 textId, WorldObject const* target = nullptr);
1836  virtual void Yell(uint32 textId, WorldObject const* target = nullptr);
1837  virtual void TextEmote(uint32 textId, WorldObject const* target = nullptr, bool isBossEmote = false);
1838  virtual void Whisper(uint32 textId, Player* target, bool isBossWhisper = false);
1839 
1840  float GetCollisionHeight() const override;
1841  uint32 GetVirtualItemId(uint32 slot) const;
1842  uint16 GetVirtualItemAppearanceMod(uint32 slot) const;
1843  void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId = 0, uint16 itemVisual = 0);
1844 
1845  std::string GetDebugInfo() const override;
1846 
1848 
1849  protected:
1850  explicit Unit (bool isWorldObject);
1851 
1852  UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const* target) const override;
1853  void BuildValuesCreate(ByteBuffer* data, Player const* target) const override;
1854  void BuildValuesUpdate(ByteBuffer* data, Player const* target) const override;
1855 
1856  public:
1857  void BuildValuesUpdateWithFlag(ByteBuffer* data, UF::UpdateFieldFlag flags, Player const* target) const override;
1858  void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask,
1859  UF::UnitData::Mask const& requestedUnitMask, Player const* target) const;
1860 
1861  protected:
1862  void DestroyForPlayer(Player* target) const override;
1863  void ClearUpdateMask(bool remove) override;
1864 
1865  void _UpdateSpells(uint32 time);
1866  void _DeleteRemovedAuras();
1867 
1868  void _UpdateAutoRepeatSpell();
1869 
1871 
1873 
1874  float m_createStats[MAX_STATS];
1875  float m_floatStatPosBuff[MAX_STATS];
1876  float m_floatStatNegBuff[MAX_STATS];
1877 
1878  AttackerSet m_attackers;
1880 
1882 
1884 
1885  typedef std::list<DynamicObject*> DynObjectList;
1886  DynObjectList m_dynObj;
1887 
1888  typedef std::list<GameObject*> GameObjectList;
1889  GameObjectList m_gameObj;
1890 
1891  typedef std::vector<AreaTrigger*> AreaTriggerList;
1892  AreaTriggerList m_areaTrigger;
1893 
1895 
1896  Spell* m_currentSpells[CURRENT_MAX_SPELL];
1897 
1898  AuraMap m_ownedAuras;
1899  AuraApplicationMap m_appliedAuras;
1900  AuraList m_removedAuras;
1901  AuraMap::iterator m_auraUpdateIterator;
1903 
1904  AuraEffectList m_modAuras[TOTAL_AURAS];
1905  AuraList m_scAuras; // cast singlecast auras
1906  AuraApplicationList m_interruptableAuras; // auras which have interrupt mask applied on unit
1907  AuraStateAurasMap m_auraStateAuras; // Used for improve performance of aura state checks on aura apply/remove
1910 
1911  float m_auraFlatModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_FLAT_END];
1912  float m_auraPctModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_PCT_END];
1913  float m_weaponDamage[MAX_ATTACK][2];
1915 
1916  VisibleAuraContainer m_visibleAuras;
1917  boost::container::flat_set<AuraApplication*, VisibleAuraSlotCompare> m_visibleAurasToUpdate;
1918 
1919  float m_speed_rate[MAX_MOVE_TYPE];
1920 
1921  Unit* m_charmer; // Unit that is charming ME
1922  Unit* m_charmed; // Unit that is being charmed BY ME
1925 
1927 
1928  uint32 m_reactiveTimer[MAX_REACTIVE];
1930 
1933 
1936 
1937  bool IsAlwaysVisibleFor(WorldObject const* seer) const override;
1938  bool IsAlwaysDetectableFor(WorldObject const* seer) const override;
1939 
1940  void DisableSpline();
1941 
1942  void ProcessPositionDataChanged(PositionFullTerrainStatus const& data) override;
1943  virtual void ProcessTerrainStatusUpdate(ZLiquidStatus status, Optional<LiquidData> const& liquidData);
1944  virtual void SetInWater(bool inWater);
1945 
1946  virtual void AtEnterCombat();
1947  virtual void AtExitCombat();
1948 
1949  private:
1950 
1951  void UpdateSplineMovement(uint32 t_diff);
1952  void UpdateSplinePosition();
1953 
1954  // player or player's pet
1955  float GetCombatRatingReduction(CombatRating cr) const;
1956  uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const;
1957 
1958  void ProcSkillsAndReactives(bool isVictim, Unit* procTarget, uint32 typeMask, uint32 hitMask, WeaponAttackType attType);
1959 
1960  protected:
1961  void SetFeared(bool apply);
1962  void SetConfused(bool apply);
1963  void SetStunned(bool apply);
1964  void SetRooted(bool apply, bool packetOnly = false);
1965 
1967 
1968  private:
1969 
1970  uint32 m_state; // Even derived shouldn't modify
1972 
1973  Diminishing m_Diminishing;
1974  // Manage all Units that are threatened by us
1975  friend class CombatManager;
1977  friend class ThreatManager;
1979 
1980  void UpdateCharmAI();
1981  void RestoreDisabledAI();
1982  typedef std::stack<std::shared_ptr<UnitAI>> UnitAIStack;
1983  UnitAIStack i_AIs;
1984  std::shared_ptr<UnitAI> i_AI;
1986 
1987  std::unordered_set<AbstractFollower*> m_followingMe;
1988 
1989  bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
1990  bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
1992 
1993  uint32 _oldFactionId;
1995 
1999 
2001 
2002  std::unique_ptr<MovementForces> _movementForces;
2003 };
2004 
2005 namespace Trinity
2006 {
2007  // Binary predicate for sorting Units based on percent value of a power
2009  {
2010  public:
2011  PowerPctOrderPred(Powers power, bool ascending = true) : _power(power), _ascending(ascending) { }
2012 
2013  bool operator()(WorldObject const* objA, WorldObject const* objB) const
2014  {
2015  Unit const* a = objA->ToUnit();
2016  Unit const* b = objB->ToUnit();
2017  float rA = a ? a->GetPowerPct(_power) : 0.0f;
2018  float rB = b ? b->GetPowerPct(_power) : 0.0f;
2019  return _ascending ? rA < rB : rA > rB;
2020  }
2021 
2022  bool operator()(Unit const* a, Unit const* b) const
2023  {
2024  float rA = a->GetPowerPct(_power);
2025  float rB = b->GetPowerPct(_power);
2026  return _ascending ? rA < rB : rA > rB;
2027  }
2028 
2029  private:
2031  bool const _ascending;
2032  };
2033 
2034  // Binary predicate for sorting Units based on percent value of health
2036  {
2037  public:
2038  HealthPctOrderPred(bool ascending = true) : _ascending(ascending) { }
2039 
2040  bool operator()(WorldObject const* objA, WorldObject const* objB) const
2041  {
2042  Unit const* a = objA->ToUnit();
2043  Unit const* b = objB->ToUnit();
2044  float rA = (a && a->GetMaxHealth()) ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
2045  float rB = (b && b->GetMaxHealth()) ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
2046  return _ascending ? rA < rB : rA > rB;
2047  }
2048 
2049  bool operator() (Unit const* a, Unit const* b) const
2050  {
2051  float rA = a->GetMaxHealth() ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
2052  float rB = b->GetMaxHealth() ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
2053  return _ascending ? rA < rB : rA > rB;
2054  }
2055 
2056  private:
2057  bool const _ascending;
2058  };
2059 }
2060 
2061 inline void SetUnitCurrentCastSpell(Unit* unit, Spell* spell)
2062 {
2063  unit->SetCurrentCastSpell(spell);
2064 }
2065 
2066 #endif
float GetNegStat(Stats stat) const
Definition: Unit.h:1461
AuraList m_removedAuras
Definition: Unit.h:1900
Definition: Unit.h:183
Definition: Unit.h:178
void SetVisibleAuraUpdate(AuraApplication *aurApp)
Definition: Unit.h:1611
Definition: MoveSpline.h:49
Definition: SpellAuraEffects.h:28
uint32 createProcHitMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition)
Definition: Unit.cpp:9541
bool IsPvP() const
Definition: Unit.h:971
Definition: Unit.h:244
uint32 DamageSchoolMask
Definition: Unit.h:521
float GetCombatReach() const override
Definition: Unit.h:802
UnitPetFlag
Definition: UnitDefines.h:94
bool IsSpiritHealer() const
Definition: Unit.h:1088
UpdateField< float, 64, 76 > ModTimeRate
Definition: UpdateFields.h:334
void setAttackTimer(WeaponAttackType type, uint32 time)
Definition: Unit.h:795
Powers
Definition: SharedDefines.h:265
void SetOffHandWeaponAttackPower(int32 attackPower)
Definition: Unit.h:1584
uint32 ProcAttacker
Definition: Unit.h:532
Definition: TemporarySummon.h:106
Definition: UnitDefines.h:208
Unit * Attacker
Definition: Unit.h:519
BaseModGroup
Definition: Unit.h:211
SheathState
Definition: UnitDefines.h:70
uint32 GetSpellPhaseMask() const
Definition: Unit.h:491
Definition: Unit.h:164
uint32 GetTypeMask() const
Definition: Unit.h:489
UnitPetFlag GetPetFlags() const
Definition: Unit.h:975
Definition: Unit.h:320
Definition: Unit.h:297
Definition: Unit.h:349
UnitModifierFlatType
Definition: Unit.h:140
void SetCreatedBySpell(int32 spellId)
Definition: Unit.h:949
Definition: Unit.h:582
void SetActionAndType(uint32 action, ActiveStates type)
Definition: Unit.h:609
UpdateField< float, 64, 72 > ModSpellHaste
Definition: UpdateFields.h:330
Spell * _spell
Definition: Unit.h:510
bool CanInstantCast() const
Definition: Unit.h:1821
Definition: Unit.h:206
Unit * GetVictim() const
Definition: Unit.h:433
Definition: Unit.h:304
UpdateField< float, 64, 92 > RangedAttackPowerMultiplier
Definition: UpdateFields.h:351
uint32 m_removedAurasCount
Definition: Unit.h:1902
SpellInfo const * Spell
Definition: Unit.h:546
void SetTransformSpell(uint32 spellid)
Definition: Unit.h:1633
bool IsTotem() const
Definition: Unit.h:851
Definition: SpellAuraDefines.h:95
UpdateField< ObjectGuid, 0, 12 > Summon
Definition: UpdateFields.h:269
Definition: Unit.h:232
Definition: Unit.h:254
bool operator()(WorldObject const *objA, WorldObject const *objB) const
Definition: Unit.h:2013
Definition: Vehicle.h:31
DamageInfo * GetDamageInfo() const
Definition: Unit.h:497
Definition: Unit.h:295
uint32 GetUnitMovementFlags() const
Definition: Unit.h:1724
Definition: Unit.h:163
Definition: UnitDefines.h:367
void SetStat(Stats stat, int32 val)
Definition: Unit.h:867
bool IsImmuneToAll() const
Definition: Unit.h:1113
UpdateField< uint32, 32, 45 > Flags3
Definition: UpdateFields.h:303
AuraEffectList & GetAuraEffectsByType(AuraType type)
Definition: Unit.h:1385
Utility class to enable range for loop syntax for multimap.equal_range uses.
Definition: IteratorPair.h:32
bool IsCharmedOwnedByPlayerOrPlayer() const
Definition: Unit.h:1261
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:938
EnumFlag< SpellAuraInterruptFlags2 > m_interruptMask2
Definition: Unit.h:1909
uint16 _meleeAnimKitId
Definition: Unit.h:1998
void SetUnitCurrentCastSpell(Unit *unit, Spell *spell)
Definition: Unit.h:2061
ThreatManager const & GetThreatManager() const
Definition: Unit.h:1135
uint32 GetFaction() const override
Definition: Unit.h:958
ChatMsg
Definition: SharedDefines.h:5625
ReactStates
Definition: UnitDefines.h:373
bool m_aiLocked
Definition: Unit.h:1985
Definition: SharedDefines.h:272
#define MAX_GAMEOBJECT_SLOT
Definition: Unit.h:732
uint8 getGender() const
Definition: Unit.h:863
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:1806
static ObjectGuid const Empty
Definition: ObjectGuid.h:255
Definition: ByteBuffer.h:53
int8_t int8
Definition: Define.h:150
Definition: Unit.h:372
Definition: Unit.h:581
Definition: TemporarySummon.h:43
UpdateField< float, 64, 70 > ModCastingSpeed
Definition: UpdateFields.h:328
uint32 Damage
Definition: Unit.h:522
UnitPVPStateFlags
Definition: UnitDefines.h:80
UnitFlags2
Definition: UnitDefines.h:156
Definition: Unit.h:186
Definition: Unit.h:321
bool IsFullHealth() const
Definition: Unit.h:885
bool m_ControlledByPlayer
Definition: Unit.h:1870
float m_modMeleeHitChance
Definition: Unit.h:1529
Definition: Unit.h:331
virtual void SetImmuneToPC(bool apply)
Definition: Unit.h:1118
void SetUnitFlags2(UnitFlags2 flags)
Definition: Unit.h:943
UpdateField< int32, 64, 91 > RangedAttackPowerModNeg
Definition: UpdateFields.h:350
uint8 _chargesRemoved
Definition: Unit.h:389
void SetBattlePetCompanionNameTimestamp(uint32 timestamp)
Definition: Unit.h:1311
#define UNIT_ACTION_BUTTON_TYPE(X)
Definition: Unit.h:591
Definition: Unit.h:188
UpdateField< int32, 64, 90 > RangedAttackPowerModPos
Definition: UpdateFields.h:349
Unit * GetAttacker() const
Definition: Unit.h:432
bool IsSummon() const
Definition: Unit.h:847
void SetBoundingRadius(float boundingRadius)
Definition: Unit.h:805
EnumFlag< SpellAuraInterruptFlags > m_interruptMask
Definition: Unit.h:1908
AuraMap m_ownedAuras
Definition: Unit.h:1898
UnitBytes1_Flags
Definition: UnitDefines.h:60
bool const _ascending
Definition: Unit.h:2057
bool isTurning() const
Definition: Unit.h:1789
std::list< DynamicObject * > DynObjectList
Definition: Unit.h:1885
bool _isCommandAttack
Definition: Unit.h:705
Definition: UnitDefines.h:206
bool IsHunterPet() const
Definition: Unit.h:850
void RemoveVisFlags(UnitVisFlags flags)
Definition: Unit.h:990
void SetRace(uint8 race)
Definition: Unit.h:858
Definition: SpellAuraDefines.h:114
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition: Unit.h:1101
Definition: Unit.h:65
UpdateField< int32, 64, 94 > OffHandWeaponAttackPower
Definition: UpdateFields.h:353
std::list< GameObject * > GameObjectList
Definition: Unit.h:1888
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1723
Talk
Definition: boss_hadronox.cpp:128
uint32 _absorb
Definition: Unit.h:455
Definition: UnitDefines.h:211
UpdateField< int32, 64, 89 > RangedAttackPower
Definition: UpdateFields.h:348
AuraApplicationMap const & GetAppliedAuras() const
Definition: Unit.h:1338
Definition: Unit.h:300
uint32 GetWildBattlePetLevel() const
Definition: Unit.h:1312
uint64 CountPctFromCurHealth(int32 pct) const
Definition: Unit.h:892
uint16 flags
Definition: DisableMgr.cpp:48
Definition: Unit.h:721
void SetCurrentCastSpell(Spell *pSpell)
Definition: Unit.cpp:2783
void ClearInCombat()
Definition: Unit.h:1126
bool IsCharmed() const
Definition: Unit.h:1280
ThreatManager m_threatManager
Definition: Unit.h:1978
AuraEffect const * auraEff
Definition: Unit.h:567
Spell * GetCurrentSpell(uint32 spellType) const
Definition: Unit.h:1505
bool IsMounted() const
Definition: Unit.h:995
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1252
void SetMinionGUID(ObjectGuid guid)
Definition: Unit.h:1242
ObjectGuid GetCritterGUID() const
Definition: Unit.h:1245
int32 CountPctFromMaxPower(Powers power, int32 pct) const
Definition: Unit.h:912
UnitMods
Definition: Unit.h:161
Unit * m_charmer
Definition: Unit.h:1921
Definition: Unit.h:196
int64_t int64
Definition: Define.h:147
Definition: SpellInfo.h:335
Definition: Unit.h:157
virtual float GetBlockPercent(uint8) const
Definition: Unit.h:1064
SpellHistory * _spellHistory
Definition: Unit.h:2000
bool IsThreatenedBy(Unit const *who) const
Definition: Unit.h:1130
Definition: Unit.h:213
Emote
Definition: SharedDefines.h:3082
void SetUnitFlags(UnitFlags flags)
Definition: Unit.h:939
uint8 getLevel() const
Definition: Unit.h:854
uint32 _effectiveHeal
Definition: Unit.h:454
bool HealthAbovePctHealed(int32 pct, uint32 heal) const
Definition: Unit.h:889
boost::container::flat_set< AuraApplication *, VisibleAuraSlotCompare > m_visibleAurasToUpdate
Definition: Unit.h:1917
void AddUnitState(uint32 f)
Definition: Unit.h:840
Definition: Unit.h:347
Unit * GetHealer() const
Definition: Unit.h:466
UnitStandStateType GetStandState() const
Definition: Unit.h:984
uint16 GetMovementAnimKitId() const override
Definition: Unit.h:1010
Definition: Unit.h:265
DamageInfo * _damageInfo
Definition: Unit.h:511
Definition: Unit.h:344
bool CanModifyStats() const
Definition: Unit.h:1564
Definition: Unit.h:2008
UpdateField< UF::UnitChannel, 0, 22 > ChannelData
Definition: UpdateFields.h:279
uint32 HitInfo
Definition: Unit.h:527
uint32 GetChannelSpellXSpellVisualId() const
Definition: Unit.h:1472
#define MAX_MOVE_TYPE
Definition: UnitDefines.h:114
bool IsHovering() const
Definition: Unit.h:1206
bool m_duringRemoveFromWorld
Definition: Unit.h:1990
Definition: Unit.h:230
Definition: Unit.h:372
bool IsTaxi() const
Definition: Unit.h:1083
Definition: Unit.h:316
float _stayY
Definition: Unit.h:711
Definition: Unit.h:170
SpellMissInfo
Definition: SharedDefines.h:2652
void SetRangedAttackPower(int32 attackPower)
Definition: Unit.h:1579
bool operator()(Unit const *a, Unit const *b) const
Definition: Unit.h:2022
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1299
uint32 Resist
Definition: Unit.h:525
CharmSpellInfo * GetCharmSpell(uint8 index)
Definition: Unit.h:679
Definition: Unit.h:241
Definition: Unit.h:351
Pet * ToPet()
Definition: Unit.h:1808
void SetRangedAttackPowerModNeg(int32 attackPowerMod)
Definition: Unit.h:1581
constexpr auto data(C &c)
Definition: advstd.h:97
Unit * attacker
Definition: Unit.h:544
CleanDamage(uint32 mitigated, uint32 absorbed, WeaponAttackType _attackType, MeleeHitOutcome _hitOutCome)
Definition: Unit.h:394
Definition: Unit.h:332
Definition: Map.h:97
UnitAIStack i_AIs
Definition: Unit.h:1983
void RemovePetFlag(UnitPetFlag flags)
Definition: Unit.h:978
Definition: Unit.h:594
NPCFlags
Non Player Character flags.
Definition: UnitDefines.h:189
int32 m_baseSpellCritChance
Definition: Unit.h:1532
bool const _ascending
Definition: Unit.h:2031
void SetModTimeRate(float timeRate)
Definition: Unit.h:934
ZLiquidStatus
Definition: Map.h:85
Movement::MoveSpline * movespline
Definition: Unit.h:1824
uint32 hitTime
Definition: Unit.h:366
uint32 overDamage
Definition: Unit.h:570
SharedVisionList m_sharedVision
Definition: Unit.h:1924
uint32 originalDamage
Definition: Unit.h:569
WeaponAttackType attackType
Definition: Unit.h:400
bool periodicLog
Definition: Unit.h:553
uint8 getRace() const
Definition: Unit.h:857
AuraMap & GetOwnedAuras()
Definition: Unit.h:1327
Definition: UnitDefines.h:274
void RemoveExtraUnitMovementFlag(uint32 f)
Definition: Unit.h:1728
Definition: Unit.h:263
AuraStateType
Definition: SharedDefines.h:2380
Definition: Unit.h:280
AuraStateAurasMap m_auraStateAuras
Definition: Unit.h:1907
Vehicle * GetVehicleKit() const
Definition: Unit.h:1769
Definition: Unit.h:144
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:891
MotionMaster * GetMotionMaster()
Definition: Unit.h:1712
Definition: SpellAuras.h:54
bool IsInCombat() const
Definition: Unit.h:1123
uint32 GetCosmeticMountDisplayId() const
Definition: Unit.h:998
Definition: Unit.h:311
Definition: Unit.h:180
uint32 GetSpellTypeMask() const
Definition: Unit.h:490
Powers const _power
Definition: Unit.h:2030
Definition: Unit.h:243
bool IsArmorer() const
Definition: Unit.h:1092
CharmInfo * m_charmInfo
Definition: Unit.h:1923
bool IsSpiritService() const
Definition: Unit.h:1095
Definition: Unit.h:312
Definition: Unit.h:238
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:756
UnitActionBarEntry()
Definition: Unit.h:596
bool IsTrainer() const
Definition: Unit.h:1080
float GetPowerPct(Powers power) const
Definition: Unit.h:911
Vehicle * m_vehicleKit
Definition: Unit.h:1932
void SetCreateHealth(uint32 val)
Definition: Unit.h:1455
Definition: Unit.h:229
#define UI64LIT(N)
Definition: Define.h:140
Definition: Unit.h:194
UpdateField< ObjectGuid, 0, 16 > CreatedBy
Definition: UpdateFields.h:273
uint32 m_hitMask
Definition: Unit.h:421
Definition: UnitDefines.h:199
Definition: Unit.h:299
Stats
Definition: SharedDefines.h:254
int32 _chance
Definition: Unit.h:133
Definition: UnitDefines.h:222
uint32 GetArmor() const
Definition: Unit.h:868
uint32 m_lastSanctuaryTime
Definition: Unit.h:1606
Unit * GetActionTarget() const
Definition: Unit.h:486
UnitState
Definition: Unit.h:236
uint32 mitigated_damage
Definition: Unit.h:398
void SetCanModifyStats(bool modifyStats)
Definition: Unit.h:1565
Definition: Unit.h:293
bool IsEngagedBy(Unit const *who) const
Definition: Unit.h:1106
UpdateField< float, 64, 75 > ModHasteRegen
Definition: UpdateFields.h:333
UnitTypeMask
Definition: Unit.h:339
virtual bool IsAffectedByDiminishingReturns() const
Definition: Unit.h:786
uint16 GetMeleeAnimKitId() const override
Definition: Unit.h:1012
Definition: Unit.h:203
#define UNIT_ACTION_BUTTON_ACTION(X)
Definition: Unit.h:590
Definition: boss_warbringer_omrogg.cpp:71
Definition: Unit.h:259
Diminishing m_Diminishing
Definition: Unit.h:1973
void SetModCastingSpeed(float castingSpeed)
Definition: Unit.h:929
ObjectGuid GetDemonCreatorGUID() const
Definition: Unit.h:1249
SpellSchools
Definition: SharedDefines.h:294
std::list< Aura * > AuraList
Definition: Unit.h:757
AuraType
Definition: SpellAuraDefines.h:86
TC_GAME_API float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Definition: Unit.cpp:101
uint32 m_absorb
Definition: Unit.h:418
WeaponAttackType m_attackType
Definition: Unit.h:417
uint32 _hitMask
Definition: Unit.h:458
Definition: Unit.h:302
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:887
Definition: Spell.h:201
uint16 _aiAnimKitId
Definition: Unit.h:1996
Definition: Transport.h:28
CommandStates _CommandState
Definition: Unit.h:699
void SetRemovedCharges(uint8 amount)
Definition: Unit.h:385
Definition: Unit.h:198
Definition: Unit.h:631
void SetAttackPowerModPos(int32 attackPowerMod)
Definition: Unit.h:1576
SpellCastVisual SpellVisual
Definition: Unit.h:547
UpdateFieldArray< int32, 7, 173, 174 > Resistances
Definition: UpdateFields.h:390
bool m_AutoRepeatFirstCast
Definition: Unit.h:1872
void SetDemonCreatorGUID(ObjectGuid guid)
Definition: Unit.h:1250
UpdateField< uint32, 96, 110 > BattlePetCompanionNameTimestamp
Definition: UpdateFields.h:368
UnitPVPStateFlags GetPvpFlags() const
Definition: Unit.h:965
Definition: SharedDefines.h:287
MeleeHitOutcome HitOutCome
Definition: Unit.h:535
uint32 packedData
Definition: Unit.h:598
Vehicle * m_vehicle
Definition: Unit.h:1931
bool m_cleanupDone
Definition: Unit.h:1989
Definition: ThreatManager.h:86
Definition: Unit.h:447
void SetBonusResistanceMod(SpellSchools school, int32 val)
Definition: Unit.h:879
Definition: AbstractFollower.h:23
Definition: Unit.h:251
uint32 GetComboPoints() const
--------—Combo point system----------------—
Definition: Unit.h:1738
Definition: Object.h:412
bool SetUpdateFieldValue(UpdateFieldSetter< T > &setter, typename UpdateFieldSetter< T >::value_type &&value)
Definition: Object.h:106
TimeTrackerSmall m_movesplineTimer
Definition: Unit.h:1971
Definition: Unit.h:199
Definition: Unit.h:642
Definition: Creature.h:69
uint32 GetMountDisplayId() const
Definition: Unit.h:996
Definition: Unit.h:249
UnitVisFlags
Definition: UnitDefines.h:49
bool critical
Definition: Unit.h:574
Definition: UnitDefines.h:139
Definition: UnitDefines.h:83
Aura * _aura
Definition: Unit.h:132
Definition: SpellDefines.h:473
Definition: Timer.h:134
float GetStat(Stats stat) const
Definition: Unit.h:866
#define NOMINAL_MELEE_RANGE
Definition: ObjectDefines.h:42
#define M_PI
Definition: Common.h:157
Definition: Unit.h:231
Definition: SharedDefines.h:6433
ObjectGuid castId
Definition: Unit.h:545
bool _isAtStay
Definition: Unit.h:707
Definition: Unit.h:197
uint16 stack
Definition: Unit.h:365
Definition: Unit.h:184
Unit * m_charmed
Definition: Unit.h:1922
uint32 cleanDamage
Definition: Unit.h:557
Definition: Unit.h:179
HealInfo * GetHealInfo() const
Definition: Unit.h:498
Definition: Unit.h:257
Definition: Unit.h:333
void SetAttackPower(int32 attackPower)
Definition: Unit.h:1575
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:940
Definition: Unit.h:253
uint32 const _originalHeal
Definition: Unit.h:453
Definition: Unit.h:248
UpdateFieldArray< uint32, 2, 121, 122 > NpcFlags
Definition: UpdateFields.h:379
Definition: UnitDefines.h:366
bool IsVendor() const
Definition: Unit.h:1079
Definition: Unit.h:252
std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
Definition: Unit.h:747
Spell const * GetProcSpell() const
Definition: Unit.h:500
Definition: Unit.h:350
Vehicle * GetVehicle() const
Definition: Unit.h:1770
UpdateField< uint32, 64, 67 > PetNameTimestamp
Definition: UpdateFields.h:325
bool IsEngaged() const
Definition: Unit.h:1105
AuraApplicationList m_interruptableAuras
Definition: Unit.h:1906
uint32 _hitMask
Definition: Unit.h:509
CharmInfo * GetCharmInfo()
Definition: Unit.h:1286
MotionMaster const * GetMotionMaster() const
Definition: Unit.h:1713
Definition: Unit.h:111
uint32 absorb
Definition: Unit.h:571
UpdateField< int32, 64, 80 > BaseHealth
Definition: UpdateFields.h:338
Definition: UpdateData.h:36
Definition: Unit.h:343
Definition: SpellAuras.h:351
void SetEffectiveHeal(uint32 amount)
Definition: Unit.h:464
Definition: Unit.h:336
TempSummon const * ToTempSummon() const
Definition: Unit.h:1815
void AddVisFlags(UnitVisFlags flags)
Definition: Unit.h:989
Definition: Unit.h:215
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:936
Definition: MovementInfo.h:124
Definition: SharedDefines.h:2387
Definition: Unit.h:174
void SetMountDisplayId(uint32 mountDisplayId)
Definition: Unit.h:997
uint32 _oldFactionId
faction before charm
Definition: Unit.h:1993
uint32 Blocked
Definition: Unit.h:526
uint32 m_state
Definition: Unit.h:1970
uint32 const m_originalDamage
Definition: Unit.h:413
bool IsInSanctuary() const
Definition: Unit.h:970
UpdateField< int32, 64, 85 > AttackPower
Definition: UpdateFields.h:344
Definition: Unit.h:204
void AddNpcFlag(NPCFlags flags)
Definition: Unit.h:1072
uint32 GetTransformSpell() const
Definition: Unit.h:1634
virtual float GetArmorMultiplierForTarget(WorldObject const *) const
Definition: Unit.h:902
void FollowerRemoved(AbstractFollower *f)
Definition: Unit.h:1709
uint32 GetDamageReduction(uint32 damage) const
Definition: Unit.h:1044
CombatManager const & GetCombatManager() const
Definition: Unit.h:1110
R apply(R(*func)(Ts...), apply_tuple_type< Ts... > &&args)
Definition: advstd.h:38
uint8 GetRemovedCharges() const
Definition: Unit.h:384
Definition: Unit.h:335
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:1721
Definition: Unit.h:285
void SetBattlePetCompanionGUID(ObjectGuid guid)
Definition: Unit.h:1248
bool IsAuctioner() const
Definition: Unit.h:1091
Definition: VehicleDefines.h:127
void SetChannelObject(uint32 slot, ObjectGuid guid)
Definition: Unit.h:1482
void SetResistance(SpellSchools school, int32 val)
Definition: Unit.h:878
Unit * GetCharmed() const
Definition: Unit.h:1256
void SetPetFlags(UnitPetFlag flags)
Definition: Unit.h:979
Definition: Unit.h:315
bool isPossessed() const
Definition: Unit.h:1281
Unit *const m_victim
Definition: Unit.h:411
bool HasStealthAura() const
Definition: Unit.h:1144
Unit * EnsureVictim() const
Definition: Unit.h:826
WeaponAttackType GetAttackType() const
Definition: Unit.h:437
std::vector< Unit * > UnitVector
Definition: Unit.h:743
TC_GAME_API AreaTrigger * GetAreaTrigger(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:203
SpellSchoolMask
Definition: SharedDefines.h:306
uint32 GetHitMask() const
Definition: Unit.h:492
virtual float GetHealthMultiplierForTarget(WorldObject const *) const
Definition: Unit.h:900
Definition: Unit.h:277
void SetAttackPowerMultiplier(float attackPowerMult)
Definition: Unit.h:1578
void SetCommandState(CommandStates st)
Definition: Unit.h:656
#define MAX_STATS
Definition: SharedDefines.h:262
void SetOverrideDisplayPowerId(uint32 powerDisplayId)
Definition: Unit.h:906
Definition: Totem.h:30
Definition: Unit.h:145
void AddNpcFlag2(NPCFlags2 flags)
Definition: Unit.h:1076
Definition: Unit.h:305
UpdateField< uint32, 64, 66 > PetNumber
Definition: UpdateFields.h:324
UpdateField< int32, 64, 86 > AttackPowerModPos
Definition: UpdateFields.h:345
int32 m_procDeep
Definition: Unit.h:1883
uint16 GetAIAnimKitId() const override
Definition: Unit.h:1008
Definition: UnitDefines.h:129
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:434
CommandStates GetCommandState() const
Definition: Unit.h:657
TempSummon * ToTempSummon()
Definition: Unit.h:1814
float GetPosStat(Stats stat) const
Definition: Unit.h:1460
Definition: Unit.h:372
Definition: Unit.h:202
bool HasInterruptFlag(SpellAuraInterruptFlags2 flags) const
Definition: Unit.h:1615
std::shared_ptr< UnitAI > i_AI
Definition: Unit.h:1984
bool IsWithinMeleeRange(Unit const *obj) const
Definition: Unit.h:807
CharmType
Definition: Unit.h:627
Definition: Unit.h:240
Definition: DynamicObject.h:35
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1521
Definition: Unit.h:165
Definition: Unit.h:250
float m_modSpellHitChance
Definition: Unit.h:1531
void ClearUnitState(uint32 f)
Definition: Unit.h:842
ObjectGuid GetTarget() const
Definition: Unit.h:1817
Definition: Unit.h:279
Definition: Unit.h:373
Totem * ToTotem()
Definition: Unit.h:1811
Unit *const m_attacker
Definition: Unit.h:410
Definition: Unit.h:478
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:798
UpdateField< uint8, 0, 27 > Sex
Definition: UpdateFields.h:284
Definition: CombatManager.h:97
Definition: UnitDefines.h:209
void SetModHasteRegen(float hasteRegen)
Definition: Unit.h:933
SpellInfo const *const _spellInfo
Definition: Unit.h:456
bool HasPvpFlag(UnitPVPStateFlags flags) const
Definition: Unit.h:966
uint32 GetNativeDisplayId() const
Definition: Unit.h:1625
Definition: SpellHistory.h:46
Definition: Unit.h:173
Definition: TemporarySummon.h:72
void SetVehicle(Vehicle *vehicle)
Definition: Unit.h:1771
bool isDying() const
Definition: Unit.h:1232
void AddUnitFlag3(UnitFlags3 flags)
Definition: Unit.h:945
UpdateField< float, 64, 73 > ModHaste
Definition: UpdateFields.h:331
Definition: Unit.h:334
void SetVisFlags(UnitVisFlags flags)
Definition: Unit.h:991
Definition: Unit.h:298
Definition: UnitDefines.h:365
uint32 m_block
Definition: Unit.h:420
UpdateField< int32, 32, 55 > MountDisplayID
Definition: UpdateFields.h:314
Definition: Unit.h:151
uint32 CleanDamage
Definition: Unit.h:534
SpellHistory * GetSpellHistory()
Definition: Unit.h:1515
Definition: Unit.h:222
uint32 resist
Definition: Unit.h:552
uint64 getRaceMask() const
Definition: Unit.h:859
void RemoveChannelObject(ObjectGuid guid)
Definition: Unit.h:1483
Definition: Unit.h:224
bool IsWalking() const
Definition: Unit.h:1205
DiminishingReturn()
Definition: Unit.h:356
Unit * GetTarget() const
Definition: Unit.h:467
uint64 GetHealth() const
Definition: Unit.h:882
bool HasRootAura() const
Definition: Unit.h:1147
Unit *const _actor
Definition: Unit.h:503
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:472
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition: Unit.h:750
Definition: Unit.h:55
Definition: Unit.h:64
Unit * GetProcTarget() const
Definition: Unit.h:487
ObjectGuid GetMinionGUID() const
Definition: Unit.h:1241
bool _isReturning
Definition: Unit.h:709
Language
Definition: SharedDefines.h:1073
Definition: Unit.h:539
GameObjectList m_gameObj
Definition: Unit.h:1889
Definition: UnitDefines.h:212
uint32 GetResist() const
Definition: Unit.h:441
SpellPeriodicAuraLogInfo(AuraEffect const *_auraEff, uint32 _damage, uint32 _originalDamage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical)
Definition: Unit.h:564
UnitFlags
Definition: UnitDefines.h:118
bool isDead() const
Definition: Unit.h:1233
Definition: Unit.h:261
Definition: Unit.h:282
Definition: Unit.h:640
Definition: Unit.h:233
ObjectGuid GetCreatorGUID() const
Definition: Unit.h:1239
Definition: Unit.h:372
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1265
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1384
std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
Definition: Unit.h:746
UpdateField< float, 96, 101 > ManaCostMultiplier
Definition: UpdateFields.h:359
Definition: Unit.h:52
void RemovePvpFlag(UnitPVPStateFlags flags)
Definition: Unit.h:968
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1337
WeaponAttackType AttackType
Definition: Unit.h:531
bool HasVisibleAura(AuraApplication *aurApp) const
Definition: Unit.h:1609
Definition: SharedDefines.h:276
UpdateField< uint8, 64, 82 > PvpFlags
Definition: UpdateFields.h:340
uint8 GetDispelCharges() const
Definition: Unit.h:119
virtual bool IsFocusing(Spell const *=nullptr, bool=false)
Definition: Unit.h:1511
uint32 _spellTypeMask
Definition: Unit.h:507
Definition: MotionMaster.h:97
Definition: Unit.h:323
UpdateField< float, 96, 103 > HoverHeight
Definition: UpdateFields.h:361
void ApplyModManaCostModifier(SpellSchools school, int32 mod, bool apply)
Definition: Unit.h:921
Definition: Unit.h:281
Definition: DB2Structure.h:2429
void NearTeleportTo(float x, float y, float z, float orientation, bool casting=false)
Definition: Unit.h:1186
std::unordered_set< AbstractFollower * > m_followingMe
Definition: Unit.h:1987
Definition: Unit.h:190
UnitStandStateType
Definition: UnitDefines.h:34
Definition: Unit.h:306
std::unique_ptr< MovementForces > _movementForces
Definition: Unit.h:2002
Definition: Unit.h:51
bool IsAlive() const
Definition: Unit.h:1231
std::set< Unit * > AttackerSet
Definition: Unit.h:741
virtual void SetCanDualWield(bool value)
Definition: Unit.h:801
Definition: Map.h:105
MotionMaster * i_motionMaster
Definition: Unit.h:1926
CommandStates
Definition: UnitDefines.h:393
uint32 ProcVictim
Definition: Unit.h:533
Definition: Unit.h:143
Player * m_playerMovingMe
Definition: Unit.h:1298
Definition: Unit.h:517
uint32 GetAbsorb() const
Definition: Unit.h:440
void SetCreateMana(uint32 val)
Definition: Unit.h:1457
Unit * _unit
Definition: Unit.h:696
bool fullBlock
Definition: Unit.h:558
UnitAI * GetTopAI() const
Definition: Unit.h:776
MeleeHitOutcome hitOutCome
Definition: Unit.h:401
void FollowerAdded(AbstractFollower *f)
Definition: Unit.h:1708
BaseModType
Definition: Unit.h:220
Definition: Unit.h:308
uint32 damage
Definition: Unit.h:568
bool HasUnitState(const uint32 f) const
Definition: Unit.h:841
void SetRangedAttackPowerModPos(int32 attackPowerMod)
Definition: Unit.h:1580
Definition: Unit.h:318
Definition: SpellAuraDefines.h:651
DeathState m_deathState
Definition: Unit.h:1881
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.cpp:10344
Definition: Unit.h:189
uint32 GetExtraUnitMovementFlags() const
Definition: Unit.h:1730
SheathState GetSheath() const
Definition: Unit.h:954
bool IsInnkeeper() const
Definition: Unit.h:1087
Definition: Unit.h:284
Definition: Unit.h:142
Unit * m_attacking
Definition: Unit.h:1879
virtual float GetFollowAngle() const
Definition: Unit.h:1802
Definition: Unit.h:216
void SetArmor(int32 val, int32 bonusVal)
Definition: Unit.h:869
Definition: AreaTrigger.h:35
UpdateField< int32, 64, 87 > AttackPowerModNeg
Definition: UpdateFields.h:346
virtual bool HasSpell(uint32) const
Definition: Unit.h:1140
bool IsImmuneToNPC() const
Definition: Unit.h:1119
uint8 getClass() const
Definition: Unit.h:860
Definition: Item.h:169
ObjectGuid GetBattlePetCompanionGUID() const
Definition: Unit.h:1247
Definition: Unit.h:217
UpdateField< uint8, 0, 24 > Race
Definition: UpdateFields.h:281
Definition: Util.h:406
Definition: Unit.h:584
bool IsVehicle() const
Definition: Unit.h:852
Definition: Unit.h:260
UpdateField< uint32, 32, 44 > Flags2
Definition: UpdateFields.h:302
bool IsPet() const
Definition: Unit.h:849
std::vector< AreaTrigger * > AreaTriggerList
Definition: Unit.h:1891
void SetChannelVisual(SpellCastVisual channelVisual)
Definition: Unit.h:1474
Definition: MoveSplineInitArgs.h:45
Definition: SharedDefines.h:296
std::set< Unit * > ControlList
Definition: Unit.h:742
UpdateField< int32, 64, 79 > BaseMana
Definition: UpdateFields.h:337
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1847
WeaponDamageRange
Definition: Unit.h:155
Definition: SpellInfo.h:227
Definition: Unit.h:720
SpellSchoolMask const _schoolMask
Definition: Unit.h:457
void SetCreateStat(Stats stat, float val)
Definition: Unit.h:1454
Definition: Unit.h:313
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition: Unit.h:1994
std::multimap< uint32, Aura * > AuraMap
Definition: Unit.h:745
uint32 absorbed_damage
Definition: Unit.h:397
virtual void SetImmuneToAll(bool apply)
Definition: Unit.h:1115
std::array< DiminishingReturn, DIMINISHING_MAX > Diminishing
Definition: Unit.h:759
Unit *const _procTarget
Definition: Unit.h:505
int32_t int32
Definition: Define.h:148
TC_GAME_API float baseMoveSpeed[MAX_MOVE_TYPE]
Definition: Unit.cpp:88
MeleeHitOutcome
Definition: Unit.h:370
uint32 GetOriginalHeal() const
Definition: Unit.h:469
UpdateFieldArray< int32, 7, 173, 188 > ManaCostModifier
Definition: UpdateFields.h:392
AuraList m_scAuras
Definition: Unit.h:1905
void RemoveUnitFlag3(UnitFlags3 flags)
Definition: Unit.h:946
UnitMoveType
Definition: UnitDefines.h:101
virtual bool CheckAttackFitToAuraRequirement(WeaponAttackType, AuraEffect const *) const
Definition: Unit.h:1552
DynamicUpdateField< ObjectGuid, 0, 4 > ChannelObjects
Definition: UpdateFields.h:260
int32 GetMinPower(Powers power) const
Definition: Unit.h:909
uint32_t uint32
Definition: Define.h:152
bool HasUnitFlag3(UnitFlags3 flags) const
Definition: Unit.h:944
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:845
uint32 GetAbsorb() const
Definition: Unit.h:471
Definition: Unit.h:53
uint32 blocked
Definition: Unit.h:554
void SetExtraUnitMovementFlags(uint32 f)
Definition: Unit.h:1731
Definition: Unit.h:373
ActionBarIndex
Definition: Unit.h:637
uint64_t uint64
Definition: Define.h:151
void AddUnitTypeMask(uint32 mask)
Definition: Unit.h:846
Definition: Unit.h:182
Definition: Unit.h:166
void SetHoverHeight(float hoverHeight)
Definition: Unit.h:1202
bool HasInvisibilityAura() const
Definition: Unit.h:1145
void SetNativeDisplayId(uint32 displayId, float displayScale=1.f)
Definition: Unit.h:1628
void SetUnitMovementFlags(uint32 f)
Definition: Unit.h:1725
uint32 TargetState
Definition: Unit.h:528
bool IsFrozen() const
Definition: Unit.h:1149
uint32 GetEffectiveHeal() const
Definition: Unit.h:470
UpdateMask< Bits > Mask
Definition: UpdateField.h:466
uint16_t uint16
Definition: Define.h:153
Definition: UnitDefines.h:370
Definition: UnitDefines.h:281
Definition: Unit.h:181
ShapeshiftForm
Definition: SpellAuraDefines.h:604
UnitActionBarEntry CharmSpellInfo
Definition: Unit.h:635
uint8 _charges
Definition: Unit.h:134
Definition: UnitDefines.h:193
uint32 m_movementCounter
Incrementing counter used in movement packets.
Definition: Unit.h:1966
AuraMap const & GetOwnedAuras() const
Definition: Unit.h:1328
Definition: GameObject.h:81
void SetCosmeticMountDisplayId(uint32 mountDisplayId)
Definition: Unit.h:999
uint32 resist
Definition: Unit.h:572
bool CanDualWield() const
Definition: Unit.h:800
Definition: Unit.h:303
Definition: Unit.h:152
UpdateField< int32, 64, 93 > MainHandWeaponAttackPower
Definition: UpdateFields.h:352
bool HasCommandState(CommandStates state) const
Definition: Unit.h:658
Player * GetPlayerMovingMe() const
Definition: Unit.h:1296
Definition: Unit.h:310
UpdateField< float, 64, 74 > ModRangedHaste
Definition: UpdateFields.h:332
Definition: Unit.h:583
AuraList & GetSingleCastAuras()
Definition: Unit.h:1386
void SetRangedAttackPowerMultiplier(float attackPowerMult)
Definition: Unit.h:1582
WorldObject * _dispeller
Definition: Unit.h:387
uint32 GetCreateMana() const
Definition: Unit.h:1458
bool IsGuardian() const
Definition: Unit.h:848
CombatManager m_combatManager
Definition: Unit.h:1976
Definition: Unit.h:372
#define REACTIVE_TIMER_START
Definition: Unit.h:716
Definition: Unit.h:2035
Definition: UnitDefines.h:86
void SetNpcFlags2(NPCFlags2 flags)
Definition: Unit.h:1078
ReactiveType
Definition: Unit.h:718
UnitAI * GetAI() const
Definition: Unit.h:770
bool HasSharedVision() const
Definition: Unit.h:1302
uint32 GetPetNumber() const
Definition: Unit.h:653
ActiveStates GetType() const
Definition: Unit.h:601
UpdateField< float, 32, 49 > CombatReach
Definition: UpdateFields.h:308
Definition: Unit.h:342
void SetAction(uint32 action)
Definition: Unit.h:619
Definition: Unit.h:150
void SetRangedWeaponAttackPower(int32 attackPower)
Definition: Unit.h:1585
bool operator()(WorldObject const *objA, WorldObject const *objB) const
Definition: Unit.h:2040
void SetType(ActiveStates type)
Definition: Unit.h:614
bool IsStopped() const
Definition: Unit.h:1716
void SetNpcFlags(NPCFlags flags)
Definition: Unit.h:1074
void RemoveNpcFlag2(NPCFlags2 flags)
Definition: Unit.h:1077
DiminishingLevels
Definition: SharedDefines.h:6431
UpdateField< int32, 96, 108 > WildBattlePetLevel
Definition: UpdateFields.h:366
bool HasPetFlag(UnitPetFlag flags) const
Definition: Unit.h:976
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition: Unit.h:751
Definition: Unit.h:641
UpdateField< int32, 64, 78 > EmoteState
Definition: UpdateFields.h:336
Definition: SharedDefines.h:6446
Definition: SpellDefines.h:316
Definition: UnitDefines.h:254
UpdateField< int32, 32, 56 > CosmeticMountDisplayID
Definition: UpdateFields.h:315
#define MAX_REACTIVE
Definition: Unit.h:724
uint32 _petnumber
Definition: Unit.h:700
VictimState
Definition: Unit.h:48
bool IsGuildMaster() const
Definition: Unit.h:1084
void SetCritterGUID(ObjectGuid guid)
Definition: Unit.h:1246
bool IsTabardDesigner() const
Definition: Unit.h:1090
T CalculatePct(T base, U pct)
Definition: Util.h:69
void RemoveUnitMovementFlag(uint32 f)
Definition: Unit.h:1722
DamageEffectType GetDamageType() const
Definition: Unit.h:436
Emote GetEmoteState() const
Definition: Unit.h:951
uint32 GetBattlePetCompanionNameTimestamp() const
Definition: Unit.h:1310
UpdateField< ObjectGuid, 0, 20 > BattlePetCompanionGUID
Definition: UpdateFields.h:277
uint32 schoolMask
Definition: Unit.h:550
Definition: Unit.h:57
Aura * GetAura() const
Definition: Unit.h:117
Definition: Unit.h:258
HitInfo
Definition: UnitDefines.h:326
void SetBaseWeaponDamage(WeaponAttackType attType, WeaponDamageRange damageRange, float value)
Definition: Unit.h:1589
UpdateField< int32, 64, 77 > CreatedBySpell
Definition: UpdateFields.h:335
SpellFamilyNames
Definition: SharedDefines.h:6143
ControlList m_Controlled
Definition: Unit.h:1276
bool IsBattleMaster() const
Definition: Unit.h:1085
Definition: UnitDefines.h:85
uint32 _heal
Definition: Unit.h:452
void SetModRangedHaste(float rangedHaste)
Definition: Unit.h:932
Definition: DB2Structure.h:1454
uint32 m_extraAttacks
Definition: Unit.h:812
float GetHoverOffset() const
Definition: Unit.h:1795
UpdateField< uint8, 64, 83 > PetFlags
Definition: UpdateFields.h:342
Unit * GetVictim() const
Definition: Unit.h:824
Definition: UnitDefines.h:210
Definition: SharedDefines.h:2495
bool IsInFlight() const
Definition: Unit.h:1098
void SetPvpFlags(UnitPVPStateFlags flags)
Definition: Unit.h:969
Unit *const _actionTarget
Definition: Unit.h:504
DeathState getDeathState() const
Definition: Unit.h:1234
uint32 HitInfo
Definition: Unit.h:555
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1504
Definition: Unit.h:647
UpdateField< int32, 64, 95 > RangedWeaponAttackPower
Definition: UpdateFields.h:354
Unit * GetActor()
Definition: Unit.h:485
Definition: SharedDefines.h:6443
ThreatManager & GetThreatManager()
Definition: Unit.h:1134
Definition: UnitDefines.h:204
uint32 GetCreateHealth() const
Definition: Unit.h:1456
UpdateField< uint8, 0, 25 > ClassId
Definition: UpdateFields.h:282
DeathState
Definition: Unit.h:227
float multiplier
Definition: Unit.h:573
bool IsFlying() const
Definition: Unit.h:1791
#define SUMMON_SLOT_PET
Definition: Unit.h:725
float _stayZ
Definition: Unit.h:712
uint32 hitCount
Definition: Unit.h:367
Unit * Target
Definition: Unit.h:520
UnitModifierPctType
Definition: Unit.h:148
SpellAuraInterruptFlags
Definition: SpellDefines.h:70
std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
Definition: Unit.h:753
uint32 GetHeal() const
Definition: Unit.h:468
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:942
int32 GetBonusResistanceMod(SpellSchools school) const
Definition: Unit.h:876
Definition: Unit.h:629
bool IsSpiritGuide() const
Definition: Unit.h:1089
void IncrementCharges()
Definition: Unit.h:121
VisibleAuraContainer const & GetVisibleAuras() const
Definition: Unit.h:1608
Definition: Unit.h:168
DiminishingGroup
Definition: SharedDefines.h:5770
UpdateFieldArray< int32, 7, 173, 181 > BonusResistanceMods
Definition: UpdateFields.h:391
bool IsImmuneToPC() const
Definition: Unit.h:1116
Definition: Unit.h:562
bool IsWildBattlePet() const
Definition: Unit.h:1093
uint32 damage
Definition: Unit.h:548
UpdateField< float, 32, 48 > BoundingRadius
Definition: UpdateFields.h:307
void SetPetNameTimestamp(uint32 timestamp)
Definition: Unit.h:1290
UpdateField< uint8, 32, 63 > VisFlags
Definition: UpdateFields.h:322
uint32 GetDisplayId() const
Definition: Unit.h:1623
AuraRemoveMode
Definition: SpellAuraDefines.h:62
Definition: Unit.h:275
Definition: UnitDefines.h:128
Definition: Unit.h:167
bool IsAIEnabled() const
Definition: Unit.h:768
bool IsBanker() const
Definition: Unit.h:1086
void ClearChannelObjects()
Definition: Unit.h:1489
Definition: Unit.h:158
void SetEmoteState(Emote emote)
Definition: Unit.h:952
uint32 GetChannelSpellId() const
Definition: Unit.h:1464
ObjectGuid GetPetGUID() const
Definition: Unit.h:1243
Definition: Unit.h:322
void ClearDynamicUpdateFieldValues(DynamicUpdateFieldSetter< T > &setter)
Definition: Object.h:130
float GetHealthPct() const
Definition: Unit.h:890
#define CURRENT_MAX_SPELL
Definition: Unit.h:588
Unit * target
Definition: Unit.h:543
#define MAKE_UNIT_ACTION_BUTTON(A, T)
Definition: Unit.h:592
bool IsActionBarForSpell() const
Definition: Unit.h:603
void SetAttackPowerModNeg(int32 attackPowerMod)
Definition: Unit.h:1577
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:888
Definition: Unit.h:324
Definition: UnitDefines.h:277
float GetNativeDisplayScale() const
Definition: Unit.h:1626
uint32 originalDamage
Definition: Unit.h:549
Unit *const _target
Definition: Unit.h:451
uint32 GetBlock() const
Definition: Unit.h:442
Definition: Unit.h:630
DynObjectList m_dynObj
Definition: Unit.h:1886
Definition: Unit.h:354
uint16 _movementAnimKitId
Definition: Unit.h:1997
void SetWildBattlePetLevel(uint32 wildBattlePetLevel)
Definition: Unit.h:1313
AuraMap::iterator m_auraUpdateIterator
Definition: Unit.h:1901
bool HasInterruptFlag(SpellAuraInterruptFlags flags) const
Definition: Unit.h:1614
bool m_canDualWield
Definition: Unit.h:813
AttackerSet m_attackers
Definition: Unit.h:1878
bool HasExtraUnitMovementFlag(uint32 f) const
Definition: Unit.h:1729
Definition: Unit.h:201
Definition: Unit.h:376
UnitActionBarEntry const * GetActionBarEntry(uint8 index) const
Definition: Unit.h:675
UpdateField< int32, 32, 42 > FactionTemplate
Definition: UpdateFields.h:298
Definition: SpellAuraDefines.h:543
Definition: Unit.h:192
bool HasNpcFlag2(NPCFlags2 flags) const
Definition: Unit.h:1075
std::vector< DispelableAura > DispelChargesList
Definition: Unit.h:136
Definition: Unit.h:317
void StartReactiveTimer(ReactiveType reactive)
Definition: Unit.h:1753
MovementGeneratorType
Definition: MovementDefines.h:27
Definition: UnitDefines.h:147
Definition: Unit.h:373
Definition: Unit.h:205
virtual void SetImmuneToNPC(bool apply)
Definition: Unit.h:1121
MovementForces const * GetMovementForces() const
Definition: Unit.h:1221
#define TC_GAME_API
Definition: Define.h:136
Definition: Unit.h:278
void Clear()
Definition: Unit.h:358
std::list< Player * > SharedVisionList
Definition: Unit.h:625
#define MAX_UNIT_ACTION_BAR_INDEX
Definition: Unit.h:645
std::unordered_multimap< uint32, uint32 > SpellImmuneContainer
Definition: Unit.h:138
float GetBoundingRadius() const
Definition: Unit.h:804
DispelInfo(WorldObject *dispeller, uint32 dispellerSpellId, uint8 chargesRemoved)
Definition: Unit.h:379
Pet const * ToPet() const
Definition: Unit.h:1809
Definition: Vehicle.h:122
uint32 m_unitTypeMask
Definition: Unit.h:1934
Definition: Unit.h:176
DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue(DynamicUpdateFieldSetter< T > &setter)
Definition: Object.h:112
uint8 GetLevelForTarget(WorldObject const *) const override
Definition: Unit.h:855
Definition: Unit.h:264
Definition: Unit.h:262
int32 SpellID
Definition: UpdateFields.h:223
uint32 _typeMask
Definition: Unit.h:506
uint32 GetChannelScriptVisualId() const
Definition: Unit.h:1473
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:183
float _stayX
Definition: Unit.h:710
ObjectGuid GetOwnerGUID() const override
Definition: Unit.h:1237
uint32 m_transformSpell
Definition: Unit.h:1894
void SetFullPower(Powers power)
Definition: Unit.h:916
Definition: Unit.h:632
Definition: Unit.h:193
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
Definition: Unit.h:671
Definition: Unit.h:177
void SetModSpellHaste(float spellHaste)
Definition: Unit.h:930
Definition: Unit.h:223
Definition: Unit.h:195
#define MAX_SUMMON_SLOT
Definition: Unit.h:730
UpdateField< uint32, 32, 43 > Flags
Definition: UpdateFields.h:300
Definition: Unit.h:296
Definition: Unit.h:169
uint8_t uint8
Definition: Define.h:154
Definition: SpellAuraDefines.h:106
Definition: Position.h:27
bool CanProc() const
Definition: Unit.h:1760
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1240
HealthPctOrderPred(bool ascending=true)
Definition: Unit.h:2038
void SetMainHandWeaponAttackPower(int32 attackPower)
Definition: Unit.h:1583
#define ASSERT
Definition: Errors.h:66
uint32 preHitHealth
Definition: Unit.h:559
ReactStates _oldReactState
Definition: Unit.h:703
WorldObject * GetDispeller() const
Definition: Unit.h:382
Definition: Unit.h:175
bool IsGossip() const
Definition: Unit.h:1082
Definition: Unit.h:309
Definition: Unit.h:319
ObjectGuid GetCharmerOrOwnerGUID() const override
Definition: Unit.h:1260
std::list< Unit * > UnitList
Definition: Unit.h:109
Definition: Unit.h:54
NPCFlags2
Definition: UnitDefines.h:227
SpellSchoolMask const m_schoolMask
Definition: Unit.h:415
SpellSchoolMask GetSchoolMask() const
Definition: Unit.h:435
Definition: Unit.h:171
Definition: UnitDefines.h:213
void AddChannelObject(ObjectGuid guid)
Definition: Unit.h:1481
Definition: Unit.h:214
SpellHistory const * GetSpellHistory() const
Definition: Unit.h:1516
Definition: Unit.h:345
Definition: SpellAuraDefines.h:65
DamageEffectType const m_damageType
Definition: Unit.h:416
uint32 m_damage
Definition: Unit.h:412
bool DecrementCharge()
Definition: Unit.h:122
Definition: UnitDefines.h:205
bool IsCritter() const
Definition: Unit.h:1096
Definition: Unit.h:763
Definition: Unit.h:185
Definition: Unit.h:242
void AddUnitFlag(UnitFlags flags)
Definition: Unit.h:937
float m_modRangedHitChance
Definition: Unit.h:1530
void SetCombatReach(float combatReach)
Definition: Unit.h:803
void SetFullHealth()
Definition: Unit.h:896
void AddPetFlag(UnitPetFlag flags)
Definition: Unit.h:977
AuraList const & GetSingleCastAuras() const
Definition: Unit.h:1387
void SetUnitFlags3(UnitFlags3 flags)
Definition: Unit.h:947
Definition: ObjectGuid.h:248
void SetClass(uint8 classId)
Definition: Unit.h:861
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition: Unit.h:1014
Definition: UnitDefines.h:207
std::string GetDebugInfo()
Definition: Errors.cpp:141
Definition: UnitDefines.h:192
WeaponAttackType
Definition: SharedDefines.h:6441
Definition: AsioHacksFwd.h:52
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:749
Definition: Unit.h:191
Definition: SharedDefines.h:4397
CombatManager & GetCombatManager()
Definition: Unit.h:1109
std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
Definition: Unit.h:754
Definition: Unit.h:307
Definition: DB2Structure.h:2614
Definition: Unit.h:245
uint32 getAttackTimer(WeaponAttackType type) const
Definition: Unit.h:797
int32 GetResistance(SpellSchools school) const
Definition: Unit.h:875
Definition: Unit.h:172
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.h:1018
VisibleAuraContainer m_visibleAuras
Definition: Unit.h:1916
bool IsInCombatWith(Unit const *who) const
Definition: Unit.h:1124
UF::SpellCastVisual SpellVisual
Definition: UpdateFields.h:224
Definition: Unit.h:276
Definition: SpellAuraDefines.h:104
uint64 GetMaxHealth() const
Definition: Unit.h:883
DamageEffectType
Definition: Unit.h:329
void SetPetNumberForClient(uint32 petNumber)
Definition: Unit.h:1289
bool _isCommandFollow
Definition: Unit.h:706
Definition: SpellAuras.h:119
Definition: Unit.h:346
Definition: Unit.h:392
void SetChannelSpellId(uint32 channelSpellId)
Definition: Unit.h:1465
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:886
Type
Definition: Trainer.h:32
std::set< AuraApplication *, VisibleAuraSlotCompare > VisibleAuraContainer
Definition: Unit.h:764
ActiveStates
Definition: UnitDefines.h:363
void SetFaction(uint32 faction) override
Definition: Unit.h:959
void AddUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:941
UpdateFieldArray< int32, 4, 160, 161 > Stats
Definition: UpdateFields.h:387
void AddPvpFlag(UnitPVPStateFlags flags)
Definition: Unit.h:967
bool IsQuestGiver() const
Definition: Unit.h:1081
UpdateField< float, 32, 54 > NativeXDisplayScale
Definition: UpdateFields.h:313
void AddExtraUnitMovementFlag(uint32 f)
Definition: Unit.h:1727
std::list< AuraApplication * > AuraApplicationList
Definition: Unit.h:758
SpellInfo const *const m_spellInfo
Definition: Unit.h:414
virtual float GetDamageMultiplierForTarget(WorldObject const *) const
Definition: Unit.h:901
HealInfo * _healInfo
Definition: Unit.h:512
Definition: Unit.h:274
uint32 getClassMask() const
Definition: Unit.h:862
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:1071
Definition: Unit.h:294
float GetCreateStat(Stats stat) const
Definition: Unit.h:1462
uint32 Absorb
Definition: Unit.h:524
AttackerSet const & getAttackers() const
Definition: Unit.h:822
void ApplyModManaCostMultiplier(float manaCostMultiplier, bool apply)
Definition: Unit.h:920
UpdateField< uint32, 0, 29 > OverrideDisplayPowerID
Definition: UpdateFields.h:286
Definition: UnitDefines.h:255
Definition: Unit.h:738
CombatRating
Definition: Unit.h:291
Definition: Unit.h:239
Definition: Unit.h:341
Unit * GetCharmer() const
Definition: Unit.h:1253
void RemoveDynamicUpdateFieldValue(DynamicUpdateFieldSetter< T > &setter, uint32 index)
Definition: Object.h:124
Definition: Unit.h:56
Definition: Unit.h:247
virtual bool IsLoading() const
Definition: Unit.h:1805
Say
Definition: boss_broodlord_lashlayer.cpp:22
void SetPetGUID(ObjectGuid guid)
Definition: Unit.h:1244
bool _instantCast
Definition: Unit.h:1991
Definition: Unit.h:58
PetActionFeedback
Definition: PetDefines.h:64
Definition: OptionalFwd.h:24
Definition: Unit.h:639
Definition: Unit.h:246
AuraApplicationMap m_appliedAuras
Definition: Unit.h:1899
uint32 _dispellerSpell
Definition: Unit.h:388
Definition: Player.h:1088
Definition: UnitDefines.h:196
LiquidTypeEntry const * _lastLiquid
Definition: Unit.h:1935
Definition: Unit.h:267
bool isMoving() const
Definition: Unit.h:1788
uint32 OriginalDamage
Definition: Unit.h:523
uint32 m_resist
Definition: Unit.h:419
Definition: WorldPacket.h:24
UpdateField< ObjectGuid, 0, 13 > Critter
Definition: UpdateFields.h:270
Definition: Unit.h:348
SpellAuraInterruptFlags2
Definition: SpellDefines.h:111
SpellSchoolMask GetSchoolMask() const
Definition: Unit.h:473
Definition: Unit.h:301
UpdateFieldFlag
Definition: UpdateField.h:33
bool _isFollowing
Definition: Unit.h:708
CurrentSpellTypes
Definition: Unit.h:579
Unit * ToUnit()
Definition: Object.h:200
void SetGender(uint8 sex)
Definition: Unit.h:864
uint32 _spellPhaseMask
Definition: Unit.h:508
bool IsFeared() const
Definition: Unit.h:1146
ObjectGuid GetCharmedGUID() const
Definition: Unit.h:1255
Definition: Unit.h:187
void SetInstantCast(bool set)
Definition: Unit.h:1820
Unit *const _healer
Definition: Unit.h:450
UpdateField< float, 64, 88 > AttackPowerMultiplier
Definition: UpdateFields.h:347
Totem const * ToTotem() const
Definition: Unit.h:1812
AreaTriggerList m_areaTrigger
Definition: Unit.h:1892
std::stack< std::shared_ptr< UnitAI > > UnitAIStack
Definition: Unit.h:1982
float GetSpeedRate(UnitMoveType mtype) const
Definition: Unit.h:1704
PowerPctOrderPred(Powers power, bool ascending=true)
Definition: Unit.h:2011
Definition: Pet.h:45
uint32 absorb
Definition: Unit.h:551
void SetInCombatWith(Unit *enemy)
Definition: Unit.h:1125
Definition: SpellAuraDefines.h:594
Definition: AreaTrigger.h:41
Definition: Unit.h:256
std::vector< std::pair< uint32, AuraApplication * > > AuraApplicationProcContainer
Definition: Unit.h:761
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:1073
bool m_canModifyStats
Definition: Unit.h:1914
Definition: Unit.h:50
uint32 m_regenTimer
Definition: Unit.h:1929
bool IsLevitating() const
Definition: Unit.h:1204
uint32 GetDamage() const
Definition: Unit.h:438
UpdateField< int32, 32, 53 > NativeDisplayID
Definition: UpdateFields.h:312
bool IsFFAPvP() const
Definition: Unit.h:972
bool IsControlledByPlayer() const
Definition: Unit.h:1258
InventorySlot
Definition: Unit.h:62
void SetModHaste(float haste)
Definition: Unit.h:931
Definition: Unit.h:373
uint32 GetOriginalDamage() const
Definition: Unit.h:439
Definition: UnitAI.h:131
Definition: Unit.h:255
ObjectGuid LastCharmerGUID
Definition: Unit.h:1766
uint32 GetDispellerSpellId() const
Definition: Unit.h:383
Definition: SharedDefines.h:309
Definition: Unit.h:314
Definition: Unit.h:407
Definition: UnitDefines.h:270
uint32 GetAction() const
Definition: Unit.h:602
Powers GetPowerType() const
Definition: Unit.h:904
UpdateField< ObjectGuid, 0, 17 > DemonCreator
Definition: UpdateFields.h:274
UnitFlags3
Definition: UnitDefines.h:182
void AddInterruptMask(SpellAuraInterruptFlags flags, SpellAuraInterruptFlags2 flags2)
Definition: Unit.h:1616
Definition: Spell.h:236