Core/Spells: Increase search radius for avoid problems with some spells that can't find units with huge combat reach

Port From (https://github.com/TrinityCore/TrinityCore/commit/b52ce8e65e8998df1b243b854129d359ee2d25ae)
This commit is contained in:
hondacrx
2022-06-15 16:09:33 -04:00
parent f91230ae33
commit 0224d95b91
4 changed files with 12 additions and 4 deletions
+2 -1
View File
@@ -54,9 +54,10 @@ namespace Game.AI
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
if (victim == null || !victim.IsTargetableForAttack() || !me.IsWithinDistInMap(victim, max_range) || me.IsFriendlyTo(victim) || !me.CanSeeOrDetect(victim))
{
float extraSearchRadius = max_range > 0.0f ? SharedConst.ExtraCellSearchRadius : 0.0f;
var u_check = new NearestAttackableUnitInObjectRangeCheck(me, me.GetCharmerOrOwnerOrSelf(), max_range);
var checker = new UnitLastSearcher(me, u_check);
Cell.VisitAllObjects(me, checker, max_range);
Cell.VisitAllObjects(me, checker, max_range + extraSearchRadius);
victim = checker.GetTarget();
}