public static void DrawEnemyZone() { var currentPath = TumblePositioning.GetEnemyPoints().Select(v2 => new IntPoint(v2.X, v2.Y)).ToList(); var currentPoly = Helpers.Geometry.ToPolygon(currentPath); currentPoly.Draw(Color.White); }
public static Vector3 GetVHRQPosition() { var positions = GetRotatedQPositions(); var enemyPositions = TumblePositioning.GetEnemyPoints(); var safePositions = positions.Where(pos => !enemyPositions.Contains(pos.LSTo2D())).ToList(); var BestPosition = ObjectManager.Player.ServerPosition.LSExtend(Game.CursorPos, 300f); var AverageDistanceWeight = .65f; var ClosestDistanceWeight = .35f; var bestWeightedAvg = 0f; if (ObjectManager.Player.LSCountEnemiesInRange(1300f) <= 1) { var position = ObjectManager.Player.ServerPosition.LSExtend(Game.CursorPos, 300f); return(position.IsSafe(true) ? position : Vector3.Zero); } foreach (var position in safePositions) { //Start le calculations var enemy = GetClosestEnemy(position); if (enemy == null) { continue; } if (ObjectManager.Player.LSDistance(enemy) < enemy.AttackRange - 85 && !enemy.IsMelee) { return(ObjectManager.Player.ServerPosition.LSExtend(Game.CursorPos, 300f)); } var avgDist = GetAvgDistance(position); if (avgDist > -1) { var closestDist = ObjectManager.Player.ServerPosition.Distance(enemy.ServerPosition); var weightedAvg = closestDist * ClosestDistanceWeight + avgDist * AverageDistanceWeight; if (weightedAvg > bestWeightedAvg && position.IsSafe()) { bestWeightedAvg = weightedAvg; BestPosition = position; } } } return((BestPosition.IsSafe(true) && IsSafeEx(BestPosition)) ? BestPosition : Vector3.Zero); }