Core/Combat: Fixed issues with creatures sometimes entering combat with friendly targets
Port From (https://github.com/TrinityCore/TrinityCore/commit/67ffe7bcf02bc03061ae06285ea55b7eeeb76eff)
This commit is contained in:
@@ -46,6 +46,14 @@ namespace Game.Combat
|
|||||||
if (!Owner.CanHaveThreatList() || Owner.HasUnitState(UnitState.Evade))
|
if (!Owner.CanHaveThreatList() || Owner.HasUnitState(UnitState.Evade))
|
||||||
return;
|
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);
|
Owner.SetInCombatWith(victim);
|
||||||
victim.SetInCombatWith(Owner);
|
victim.SetInCombatWith(Owner);
|
||||||
AddThreat(victim, amount, spell != null ? spell.GetSchoolMask() : victim.GetMeleeDamageSchoolMask(), spell);
|
AddThreat(victim, amount, spell != null ? spell.GetSchoolMask() : victim.GetMeleeDamageSchoolMask(), spell);
|
||||||
|
|||||||
Reference in New Issue
Block a user