Fix an overly strict check that was causing guardians to evade loop. Also make players properly enter combat when their pets are engaged by a creature.

Port From (https://github.com/TrinityCore/TrinityCore/commit/09027e5ccc9618e5fae45a354bcd01cd04ee0aa1)
This commit is contained in:
hondacrx
2020-07-24 16:35:22 -04:00
parent e4e8ee5e02
commit 5cc8c0dadf
2 changed files with 10 additions and 2 deletions
-1
View File
@@ -52,7 +52,6 @@ namespace Game.AI
{
if (!me.IsAlive())
{
Log.outDebug(LogFilter.Server, "Creature stoped attacking cuz his dead [{0}]", me.GetGUID().ToString());
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveIdle();
me.CombatStop();
+10 -1
View File
@@ -450,6 +450,15 @@ namespace Game.Entities
if (victim.IsTypeId(TypeId.Player))
victim.SetInCombatWith(this);
Unit owner = victim.GetOwner();
if (owner != null)
{
AddThreat(owner, 0.0f);
SetInCombatWith(owner);
if (owner.GetTypeId() == TypeId.Player)
owner.SetInCombatWith(this);
}
creature.SendAIReaction(AiReaction.Hostile);
creature.CallAssistance();
@@ -546,7 +555,7 @@ namespace Game.Entities
{
Unit victim = GetVictim();
if (victim != null)
if (!IsControlledByPlayer() || IsInCombatWith(victim) || victim.IsInCombatWith(this))
if ((!IsPet() && GetPlayerMovingMe() == null) || IsInCombatWith(victim) || victim.IsInCombatWith(this))
return victim;
if (!attackerList.Empty())