Combat/Threat: Split ThreatManager::NotifyDisengaged off from ThreatManager::ClearAllThreat. NotifyDisengaged signifies intent to clear the engagement flag, and should only be called from AI.
Port From (https://github.com/TrinityCore/TrinityCore/commit/38d7c1530a65a7ff1bd10775c4a35269b2416538)
This commit is contained in:
@@ -224,18 +224,15 @@ namespace Game.AI
|
|||||||
me.RemoveAurasOnEvade();
|
me.RemoveAurasOnEvade();
|
||||||
|
|
||||||
// sometimes bosses stuck in combat?
|
// sometimes bosses stuck in combat?
|
||||||
me.GetThreatManager().ClearAllThreat();
|
|
||||||
me.CombatStop(true);
|
me.CombatStop(true);
|
||||||
|
me.GetThreatManager().NotifyDisengaged();
|
||||||
me.SetLootRecipient(null);
|
me.SetLootRecipient(null);
|
||||||
me.ResetPlayerDamageReq();
|
me.ResetPlayerDamageReq();
|
||||||
me.SetLastDamagedTime(0);
|
me.SetLastDamagedTime(0);
|
||||||
me.SetCannotReachTarget(false);
|
me.SetCannotReachTarget(false);
|
||||||
me.DoNotReacquireTarget();
|
me.DoNotReacquireTarget();
|
||||||
|
|
||||||
if (me.IsInEvadeMode())
|
return !me.IsInEvadeMode();
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CypherStrings VisualizeBoundary(int duration, Unit owner = null, bool fill = false)
|
public CypherStrings VisualizeBoundary(int duration, Unit owner = null, bool fill = false)
|
||||||
|
|||||||
@@ -48,15 +48,15 @@ namespace Game.AI
|
|||||||
{
|
{
|
||||||
me.GetMotionMaster().MoveIdle();
|
me.GetMotionMaster().MoveIdle();
|
||||||
me.CombatStop(true);
|
me.CombatStop(true);
|
||||||
me.GetThreatManager().ClearAllThreat();
|
me.GetThreatManager().NotifyDisengaged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outDebug(LogFilter.Unit, "Guard entry: {0} enters evade mode.", me.GetEntry());
|
Log.outDebug(LogFilter.Unit, "Guard entry: {0} enters evade mode.", me.GetEntry());
|
||||||
|
|
||||||
me.RemoveAllAuras();
|
me.RemoveAllAuras();
|
||||||
me.GetThreatManager().ClearAllThreat();
|
|
||||||
me.CombatStop(true);
|
me.CombatStop(true);
|
||||||
|
me.GetThreatManager().NotifyDisengaged();
|
||||||
|
|
||||||
me.GetMotionMaster().MoveTargetedHome();
|
me.GetMotionMaster().MoveTargetedHome();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ namespace Game.AI
|
|||||||
public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other)
|
public override void EnterEvadeMode(EvadeReason why = EvadeReason.Other)
|
||||||
{
|
{
|
||||||
me.RemoveAllAuras();
|
me.RemoveAllAuras();
|
||||||
me.GetThreatManager().ClearAllThreat();
|
|
||||||
me.CombatStop(true);
|
me.CombatStop(true);
|
||||||
|
me.GetThreatManager().NotifyDisengaged();
|
||||||
me.SetLootRecipient(null);
|
me.SetLootRecipient(null);
|
||||||
|
|
||||||
if (HasEscortState(EscortState.Escorting))
|
if (HasEscortState(EscortState.Escorting))
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ namespace Game.AI
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
me.RemoveAllAuras();
|
me.RemoveAllAuras();
|
||||||
me.GetThreatManager().ClearAllThreat();
|
|
||||||
me.CombatStop(true);
|
me.CombatStop(true);
|
||||||
|
me.GetThreatManager().NotifyDisengaged();
|
||||||
me.SetLootRecipient(null);
|
me.SetLootRecipient(null);
|
||||||
me.SetCannotReachTarget(false);
|
me.SetCannotReachTarget(false);
|
||||||
me.DoNotReacquireTarget();
|
me.DoNotReacquireTarget();
|
||||||
|
|||||||
@@ -396,6 +396,14 @@ namespace Game.Combat
|
|||||||
_myThreatListEntries.FirstOrDefault().Value.UnregisterAndFree();
|
_myThreatListEntries.FirstOrDefault().Value.UnregisterAndFree();
|
||||||
while (!_myThreatListEntries.Empty());
|
while (!_myThreatListEntries.Empty());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// THIS SHOULD ONLY BE CALLED FROM A CREATURE'S AI (typically in EnterEvadeMode)
|
||||||
|
/// notify the unit that the AI has disengaged
|
||||||
|
/// </summary>
|
||||||
|
public void NotifyDisengaged()
|
||||||
|
{
|
||||||
// note: i don't really like having this here
|
// note: i don't really like having this here
|
||||||
// (maybe engage flag should be in creature ai? it's inherently an AI property...)
|
// (maybe engage flag should be in creature ai? it's inherently an AI property...)
|
||||||
if (_owner.IsEngaged())
|
if (_owner.IsEngaged())
|
||||||
|
|||||||
@@ -1405,7 +1405,6 @@ namespace Game.Entities
|
|||||||
if (s != DeathState.Alive && s != DeathState.JustRespawned)
|
if (s != DeathState.Alive && s != DeathState.JustRespawned)
|
||||||
{
|
{
|
||||||
CombatStop();
|
CombatStop();
|
||||||
GetThreatManager().ClearAllThreat();
|
|
||||||
|
|
||||||
if (IsNonMeleeSpellCast(false))
|
if (IsNonMeleeSpellCast(false))
|
||||||
InterruptNonMeleeSpells(false);
|
InterruptNonMeleeSpells(false);
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ namespace Game.Maps
|
|||||||
if (creature.IsInCombat())
|
if (creature.IsInCombat())
|
||||||
{
|
{
|
||||||
creature.CombatStop();
|
creature.CombatStop();
|
||||||
creature.GetThreatManager().ClearAllThreat();
|
|
||||||
if (creature.IsAIEnabled())
|
if (creature.IsAIEnabled())
|
||||||
creature.GetAI().EnterEvadeMode();
|
creature.GetAI().EnterEvadeMode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ namespace Scripts.Pets
|
|||||||
if (!me.IsAlive())
|
if (!me.IsAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
me.GetThreatManager().ClearAllThreat();
|
|
||||||
me.CombatStop(true);
|
me.CombatStop(true);
|
||||||
|
me.GetThreatManager().NotifyDisengaged();
|
||||||
me.ResetPlayerDamageReq();
|
me.ResetPlayerDamageReq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user