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