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