public AIHeroClient GetTarget(Vector3 Position, float Range, Func <AIHeroClient, float> damage = null) { var list = Enemies.FindAll((x) => x.IsValidTarget(Range) && IsValid(x)); AIHeroClient result = null; if (menu.Get <MenuCheckbox>("selected").Checked) { var ts = GetSelectedTarget(Position, Range); if (ts != null) { return(ts); } } switch (menu.Get <MenuCombo>("TSMode").CurrentValue) { case 0: { foreach (var enemy in list) { if (result == null || (GetRealPriority(menu.Get <MenuSlider>(enemy.ChampionName).CurrentValue) * damage(enemy) / enemy.ADHealth() > GetRealPriority(menu.Get <MenuSlider>(result.ChampionName).CurrentValue) * damage(result) / result.ADHealth())) { result = enemy; } } break; } case 1: { foreach (var enemy in list) { if (result == null || (enemy.ADHealth() < result.ADHealth())) { result = enemy; } } break; } case 2: { foreach (var enemy in list) { if (result == null || (enemy.APHealth() - damage(enemy) < result.APHealth() - damage(result))) { result = enemy; } } break; } case 3: { foreach (var enemy in list) { if (result == null || (enemy.TotalAttackDamage > result.TotalAttackDamage)) { result = enemy; } } break; } case 4: { foreach (var enemy in list) { if (result == null || (enemy.BonusAbilityPower > result.BonusAbilityPower)) { result = enemy; } } break; } case 5: { foreach (var enemy in list) { if (result == null || (enemy.Distance(Position) < result.Distance(Position))) { result = enemy; } } break; } case 6: { foreach (var enemy in list) { if (result == null || (enemy.Distance(Game.CursorPosition) < result.Distance(Game.CursorPosition))) { result = enemy; } } break; } default: break; } return(result); }