80 firstAI->JustExitedCombat();
83 secondAI->JustExitedCombat();
91 bool needFirstAI =
false, needSecondAI =
false;
114 ai->JustExitedCombat();
154 for (
auto const& [guid, ref] :
_pveRefs)
155 if (!ref->IsSuppressedFor(
_owner))
162 for (std::pair<ObjectGuid const, CombatReference*>
const& reference :
_pveRefs)
172 if (!pair.second->IsSuppressedFor(
_owner))
180 if (!pair.second->IsSuppressedFor(
_owner))
181 return pair.second->GetOther(
_owner);
183 if (!pair.second->IsSuppressedFor(
_owner))
184 return pair.second->GetOther(
_owner);
193 existingPvpRef->RefreshTimer();
194 existingPvpRef->Refresh();
199 existingPveRef->Refresh();
214 if (addSecondUnitSuppressed)
250 Unit* target = ref.second->GetOther(who);
259 Unit* target = ref.second->GetOther(who);
302 pair.second->Suppress(
_owner);
305 ownerAI->JustExitedCombat();
314 _pveRefs.begin()->second->EndCombat();
349 _pvpRefs.begin()->second->EndCombat();
355 ai->JustEnteredCombat(other);
404 master->UpdatePetCombatState();
@ UNIT_FLAG_PLAYER_CONTROLLED
std::unordered_map< ObjectGuid, PvPCombatReference * > _pvpRefs
void PutReference(ObjectGuid const &guid, CombatReference *ref)
static bool CanBeginCombat(Unit const *a, Unit const *b)
Unit * GetAnyTarget() const
void InheritCombatStatesFrom(Unit const *who)
friend struct CombatReference
std::unordered_map< ObjectGuid, CombatReference * > _pveRefs
void Update(uint32 tdiff)
void EndCombatBeyondRange(float range, bool includingPvP=false)
bool HasPvECombat() const
static void NotifyAICombat(Unit *me, Unit *other)
bool HasPvECombatWithPlayers() const
bool UpdateOwnerCombatState() const
bool HasPvPCombat() const
friend struct PvPCombatReference
bool SetInCombatWith(Unit *who, bool addSecondUnitSuppressed=false)
bool IsInCombatWith(ObjectGuid const &who) const
void PurgeReference(ObjectGuid const &guid, bool pvp)
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
bool IsGameMaster() const
void RemoveMeFromThreatLists()
void ClearThreat(Unit *target)
ThreatManager & GetThreatManager()
virtual void AtExitCombat()
bool HasUnitFlag(UnitFlags flags) const
virtual void AtDisengage()
bool IsImmuneToNPC() const
Unit * GetCharmerOrOwner() const
virtual void AtEnterCombat()
bool HasUnitState(const uint32 f) const
bool IsControlledByPlayer() const
bool IsCombatDisallowed() const
virtual void AtEngage(Unit *target)
CombatManager & GetCombatManager()
void SetUnitFlag(UnitFlags flags)
bool IsImmuneToPC() const
void RemoveUnitFlag(UnitFlags flags)
bool InSamePhase(uint32 phasemask) const
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
bool IsFriendlyTo(WorldObject const *target) const
auto MapGetValuePtr(M &map, typename M::key_type const &key)
void SuppressFor(Unit *who)
Unit * GetOther(Unit const *me) const
bool Update(uint32 tdiff)
static const uint32 PVP_COMBAT_TIMEOUT