private void UpdateLeader() { var totalShips = 0; var leaderShipCount = Leader.GetShips().Count(s => s.Value.GetHealth() > 0); var leaderPlanetCount = ClaimedPlanets.Count(p => p.GetOwner() == Leader.GetId()); foreach (var player in GameMap.GetAllPlayers()) { var shipCount = GetPlayerShipCount(player); totalShips += shipCount; var planetCount = ClaimedPlanets.Count(p => p.GetOwner() == player.GetId()); if (leaderShipCount < shipCount && leaderPlanetCount <= planetCount) { Leader = player; leaderShipCount = shipCount; leaderPlanetCount = planetCount; } } MyShipsOverEnemyPercentage = (double)MyShips.Count / totalShips; }