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.

# Conflicts:
#	src/server/game/Combat/ThreatManager.cpp
This commit is contained in:
Treeston authored and Ovahlord committed 2020-07-22 17:44:05 +02:00
1 parent 1020d1995f
commit 7df7dcca7d
11 files changed
+196 -176

No files matched your search

+3 -19
View File
@@ -8434,16 +8434,11 @@ void Unit::SetImmuneToAll(bool apply, bool keepCombat)
{
SetFlag(UNIT_FIELD_FLAGS, 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
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
m_threatManager.UpdateOnlineStates(true, true);
}
}
void Unit::SetImmuneToPC(bool apply, bool keepCombat)
@@ -8452,9 +8447,7 @@ void Unit::SetImmuneToPC(bool apply, bool keepCombat)
{
SetFlag(UNIT_FIELD_FLAGS, 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())
@@ -8468,10 +8461,7 @@ void Unit::SetImmuneToPC(bool apply, bool keepCombat)
}
}
else
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
m_threatManager.UpdateOnlineStates(true, true);
}
}
void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
@@ -8480,9 +8470,7 @@ void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
{
SetFlag(UNIT_FIELD_FLAGS, 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())
@@ -8496,10 +8484,7 @@ void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
}
}
else
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
m_threatManager.UpdateOnlineStates(true, true);
}
}
bool Unit::IsThreatened() const
@@ -12600,7 +12585,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);