diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-09-09 23:31:33 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-09-09 23:32:21 +0200 |
commit | e0b2bad7d50a6f44d56ab51d882a8d5bd604c37d (patch) | |
tree | 2e61bf0ca32feaae73b2549f2b5b75c611fb35bd /src | |
parent | 22d784aaa8aee2f7b247a6bfeb8e43fec4c6c03b (diff) |
Core/Creatures: Changed NearestAttackableUnitInObjectRangeCheck to only consider neutral units as targets if they are already in combat with target searching unit
Closes #13630
Closes #20205
(cherry picked from commit c8fdda7f86f5dbe90525636a7291186fe603f61d)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/TotemAI.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Grids/Notifiers/GridNotifiers.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 38f49c9389f..b5ee6b9c517 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -72,7 +72,7 @@ void TotemAI::UpdateAI(uint32 /*diff*/) me->IsFriendlyTo(victim) || !me->CanSeeOrDetect(victim)) { victim = NULL; - Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range); + Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me->GetCharmerOrOwnerOrSelf(), max_range); Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check); Cell::VisitAllObjects(me, checker, max_range); } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 7aeb6ead6ff..f9f6596a847 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -967,7 +967,7 @@ namespace Trinity bool operator()(Unit* u) { if (u->isTargetableForAttack() && 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; |