public static TumblePosition GetBestPosition(AttackableUnit target) { // we want positions with less melee enemies in range var positions = GetPossiblePositions().Where(p => p.AlliesInRange >= p.EnemiesInRange).ToList(); if (target != null) { // remove all posible positions where my current target is not in range positions.RemoveAll(p => !target.IsInRange(p.Position, Variables._Player.GetAutoAttackRange())); } // can Q to E? if (MenuManager.UseQE) { // check positions by condemn var condemn = positions.FirstOrDefault(p => p.CanCondemn); if (condemn != null) { return(condemn); } } var best = positions.OrderBy(p => p.AttackableEnemies) .ThenBy(p => p.Position.Distance(Game.CursorPos, true)) .FirstOrDefault(); return(best != null ? best : new TumblePosition(Game.CursorPos)); }
/// <summary> /// Gets the best position to Q /// </summary> /// <returns></returns> public static TumblePosition GetBestPosition(AttackableUnit target) { // we want positions with less melee enemies in range var positions = GetPossiblePositions().Where(p => p.AlliesInRange >= p.EnemiesInRange).ToList(); if (target != null) { // remove all posible positions where my current target is not in range positions.RemoveAll(p => !target.IsInRange(p.Position, ObjectManager.Player.GetAutoAttackRange())); } if (Config.Settings.Tumble.TumbleAvoidTurrets) { positions.RemoveAll(p => p.UnderEnemyTurret); } // can Q to E? if (Config.Settings.Tumble.TumbleToCondemn) { // check positions by condemn var condemn = positions.FirstOrDefault(p => p.CanCondemn); if (condemn != null) { return condemn; } } var best = positions.OrderBy(p => p.AttackableEnemies) .ThenBy(p => p.Position.Distance(Game.CursorPos, true)) .FirstOrDefault(); return best != null ? best : new TumblePosition(Game.CursorPos); }