fix(Core/TotemAI): Totems should not attack neutral unless owner is in combat (#5434)
This commit is contained in:
@@ -76,6 +76,12 @@ void TotemAI::UpdateAI(uint32 /*diff*/)
|
|||||||
me->VisitNearbyObject(max_range, checker);
|
me->VisitNearbyObject(max_range, checker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!victim && me->GetCharmerOrOwnerOrSelf()->IsInCombat())
|
||||||
|
{
|
||||||
|
victim = me->GetCharmerOrOwnerOrSelf()->GetVictim();
|
||||||
|
}
|
||||||
|
|
||||||
// If have target
|
// If have target
|
||||||
if (victim)
|
if (victim)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -931,7 +931,7 @@ namespace acore
|
|||||||
bool operator()(Unit* u)
|
bool operator()(Unit* u)
|
||||||
{
|
{
|
||||||
if (u->isTargetableForAttack(true, i_funit) && i_obj->IsWithinDistInMap(u, i_range) &&
|
if (u->isTargetableForAttack(true, i_funit) && i_obj->IsWithinDistInMap(u, i_range) &&
|
||||||
!i_funit->IsFriendlyTo(u) && i_funit->CanSeeOrDetect(u))
|
(i_funit->IsInCombatWith(u) || i_funit->IsHostileTo(u)) && i_obj->CanSeeOrDetect(u))
|
||||||
{
|
{
|
||||||
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
|
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user