Core/AI: AreaBoundary refactor

Port From (https://github.com/TrinityCore/TrinityCore/commit/3f79c9f69674618a7d7e2bf8484f9ec6ce15b2df)
This commit is contained in:
hondacrx
2020-05-06 15:15:21 -04:00
parent db1873492d
commit ffe569ffb7
3 changed files with 50 additions and 68 deletions
@@ -470,16 +470,6 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
_backstabTimer = 6 * Time.InMilliseconds;
}
bool IsInBounds(Position jumpTo, List<AreaBoundary> boundary)
{
if (boundary == null)
return true;
foreach (var it in boundary)
if (!it.IsWithinBoundary(jumpTo))
return false;
return true;
}
Position GetRandomPositionAround(Creature anubarak)
{
float DISTANCE_MIN = 10.0f;
@@ -498,7 +488,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Anubarak
Position jumpTo;
do
jumpTo = GetRandomPositionAround(anubarak);
while (!IsInBounds(jumpTo, boundary));
while (!IsInBounds(boundary, jumpTo));
me.GetMotionMaster().MoveJump(jumpTo, 40.0f, 40.0f);
DoCastSelf(SpellIds.AssassinVisual, true);
}