Core/Threat: Threat system adjustments

Port From (https://github.com/TrinityCore/TrinityCore/commit/392a644dc8562ea54b9c185a2776fceb1006e2cd)
This commit is contained in:
hondacrx
2021-11-01 12:04:49 -04:00
parent 9b99019d44
commit 3f684eadf9
6 changed files with 176 additions and 158 deletions
-2
View File
@@ -152,8 +152,6 @@ namespace Game.Entities
public bool CanHaveThreatList() { return m_threatManager.CanHaveThreatList(); }
void SendThreatListUpdate() { m_threatManager.SendThreatListToClients(); }
// For NPCs with threat list: Whether there are any enemies on our threat list
// For other units: Whether we're in combat
// This value is different from IsInCombat when a projectile spell is midair (combat on launch - threat+aggro on impact)
+3 -19
View File
@@ -419,7 +419,6 @@ namespace Game.Entities
AddToNotify(NotifyFlags.VisibilityChanged);
else
{
m_threatManager.UpdateOnlineStates(true, true);
base.UpdateObjectVisibility(true);
// call MoveInLineOfSight for nearby creatures
AIRelocationNotifier notifier = new(this);
@@ -2882,16 +2881,11 @@ namespace Game.Entities
{
AddUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc);
ValidateAttackersAndOwnTarget();
if (keepCombat)
m_threatManager.UpdateOnlineStates(true, true);
else
if (!keepCombat)
m_combatManager.EndAllCombat();
}
else
{
RemoveUnitFlag(UnitFlags.ImmuneToPc | UnitFlags.ImmuneToNpc);
m_threatManager.UpdateOnlineStates(true, true);
}
}
public virtual void SetImmuneToAll(bool apply) { SetImmuneToAll(apply, false); }
@@ -2904,9 +2898,7 @@ namespace Game.Entities
{
AddUnitFlag(UnitFlags.ImmuneToPc);
ValidateAttackersAndOwnTarget();
if (keepCombat)
m_threatManager.UpdateOnlineStates(true, true);
else
if (!keepCombat)
{
List<CombatReference> toEnd = new();
foreach (var pair in m_combatManager.GetPvECombatRefs())
@@ -2922,10 +2914,7 @@ namespace Game.Entities
}
}
else
{
RemoveUnitFlag(UnitFlags.ImmuneToPc);
m_threatManager.UpdateOnlineStates(true, true);
}
}
public virtual void SetImmuneToPC(bool apply) { SetImmuneToPC(apply, false); }
@@ -2938,9 +2927,7 @@ namespace Game.Entities
{
AddUnitFlag(UnitFlags.ImmuneToNpc);
ValidateAttackersAndOwnTarget();
if (keepCombat)
m_threatManager.UpdateOnlineStates(true, true);
else
if (!keepCombat)
{
List<CombatReference> toEnd = new();
foreach (var pair in m_combatManager.GetPvECombatRefs())
@@ -2956,10 +2943,7 @@ namespace Game.Entities
}
}
else
{
RemoveUnitFlag(UnitFlags.ImmuneToNpc);
m_threatManager.UpdateOnlineStates(true, true);
}
}
public virtual void SetImmuneToNPC(bool apply) { SetImmuneToNPC(apply, false); }