From bfe8667299a431e38508bd84c5309a86e4c37cd4 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 22 Aug 2020 13:02:41 -0400 Subject: [PATCH] Core/Combat: Fixed issues with creatures sometimes entering combat with friendly targets Port From (https://github.com/TrinityCore/TrinityCore/commit/67ffe7bcf02bc03061ae06285ea55b7eeeb76eff) --- Source/Game/Combat/ThreatManager.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Game/Combat/ThreatManager.cs b/Source/Game/Combat/ThreatManager.cs index 7139ed92a..5972d44d6 100644 --- a/Source/Game/Combat/ThreatManager.cs +++ b/Source/Game/Combat/ThreatManager.cs @@ -46,6 +46,14 @@ namespace Game.Combat if (!Owner.CanHaveThreatList() || Owner.HasUnitState(UnitState.Evade)) return; + if (Owner.IsControlledByPlayer() || victim.IsControlledByPlayer()) + { + if (Owner.IsFriendlyTo(victim) || victim.IsFriendlyTo(Owner)) + return; + } + else if (!Owner.IsHostileTo(victim) && !victim.IsHostileTo(Owner)) + return; + Owner.SetInCombatWith(victim); victim.SetInCombatWith(Owner); AddThreat(victim, amount, spell != null ? spell.GetSchoolMask() : victim.GetMeleeDamageSchoolMask(), spell);