aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2018-08-27 19:08:17 +0200
committerShauren <shauren.trinity@gmail.com>2021-10-23 02:14:04 +0200
commit392a644dc8562ea54b9c185a2776fceb1006e2cd (patch)
treeeec4d04885e582c39f0b88ea1cf0d87b4bb1015a /src/server/game/Entities/Unit
parent395f58d651c7c370522ead6ba9a3c684d91e3a66 (diff)
Core/Threat: Threat system adjustments:
* Online states are now re-evaluated before victim update instead of continuously. Closes #22226. Tagging #21501. * Victim update now happens every 1s as opposed to every server tick unless current target goes away. * Suppressed threat is no longer re-established until the victim gains additional threat (by hitting the target, for instance). * Assistance threat is now split between non-controlled units threatened by target, as opposed to all units threatened by target. (cherry picked from commit 5cea572a9ad524c6f28ff8519bee61d1ff4357d0)
Diffstat (limited to 'src/server/game/Entities/Unit')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp22
-rw-r--r--src/server/game/Entities/Unit/Unit.h1
2 files changed, 3 insertions, 20 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index fe94238f9ed..bd512988fb0 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -7713,16 +7713,11 @@ void Unit::SetImmuneToAll(bool apply, bool keepCombat)
{
AddUnitFlag(UnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC));
ValidateAttackersAndOwnTarget();
- if (keepCombat)
- m_threatManager.UpdateOnlineStates(true, true);
- else
+ if (!keepCombat)
m_combatManager.EndAllCombat();
}
else
- {
RemoveUnitFlag(UnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC));
- m_threatManager.UpdateOnlineStates(true, true);
- }
}
void Unit::SetImmuneToPC(bool apply, bool keepCombat)
@@ -7731,9 +7726,7 @@ void Unit::SetImmuneToPC(bool apply, bool keepCombat)
{
AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
ValidateAttackersAndOwnTarget();
- if (keepCombat)
- m_threatManager.UpdateOnlineStates(true, true);
- else
+ if (!keepCombat)
{
std::list<CombatReference*> toEnd;
for (auto const& pair : m_combatManager.GetPvECombatRefs())
@@ -7747,10 +7740,7 @@ void Unit::SetImmuneToPC(bool apply, bool keepCombat)
}
}
else
- {
RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
- m_threatManager.UpdateOnlineStates(true, true);
- }
}
void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
@@ -7759,9 +7749,7 @@ void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
{
AddUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
ValidateAttackersAndOwnTarget();
- if (keepCombat)
- m_threatManager.UpdateOnlineStates(true, true);
- else
+ if (!keepCombat)
{
std::list<CombatReference*> toEnd;
for (auto const& pair : m_combatManager.GetPvECombatRefs())
@@ -7775,10 +7763,7 @@ void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
}
}
else
- {
RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
- m_threatManager.UpdateOnlineStates(true, true);
- }
}
bool Unit::IsThreatened() const
@@ -11527,7 +11512,6 @@ void Unit::UpdateObjectVisibility(bool forced)
AddToNotify(NOTIFY_VISIBILITY_CHANGED);
else
{
- m_threatManager.UpdateOnlineStates(true, true);
WorldObject::UpdateObjectVisibility(true);
// call MoveInLineOfSight for nearby creatures
Trinity::AIRelocationNotifier notifier(*this);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 3035bc2fa2b..e6bd72cf6e7 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1127,7 +1127,6 @@ class TC_GAME_API Unit : public WorldObject
ThreatManager const& GetThreatManager() const { return m_threatManager; }
void SendClearTarget();
- void SendThreatListUpdate() { m_threatManager.SendThreatListToClients(); }
bool HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, flag128 familyFlags) const;
bool virtual HasSpell(uint32 /*spellID*/) const { return false; }