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