mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
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);
|
||||
}
|
||||
|
||||
|
||||
if (!victim && me->GetCharmerOrOwnerOrSelf()->IsInCombat())
|
||||
{
|
||||
victim = me->GetCharmerOrOwnerOrSelf()->GetVictim();
|
||||
}
|
||||
|
||||
// If have target
|
||||
if (victim)
|
||||
{
|
||||
|
||||
@@ -931,7 +931,7 @@ namespace acore
|
||||
bool operator()(Unit* u)
|
||||
{
|
||||
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
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user