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