//ACCIONES EN PC

        /// <summary>
        /// Inicia la PC y carga toda la información relevante del juego, como también inicializa y carga las boxes.
        /// </summary>
        public static void IniciarPC()
        {
            PCDAL.CargarData();
            BoxSeleccionada = PC.Boxes[0];

            LogicaBox caja1 = new LogicaBox(BoxSeleccionada);

            caja1.CargaInicial();
        }
        //ESTADISTICAS

        public static int TotalPokemonCapturados()
        {
            int cantCapturados = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                cantCapturados += boxBL.ObtenerTodosLosCapturados().Length;
            }

            return(cantCapturados);
        }
        public static int CantPokemonesPorNivel(byte nivelMin, byte nivelMax)
        {
            int pokemonesDeLvl = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                pokemonesDeLvl += boxBL.ObtenerPorRangoNivel(nivelMin, nivelMax).Length;
            }

            return(pokemonesDeLvl);
        }
        public static int NroCapturasPorDex(short nroDex)
        {
            int capturasPorDex = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                capturasPorDex += boxBL.ObtenerPorNroPokedex(nroDex).Length;
            }

            return(capturasPorDex);
        }
        public static int CantPokemonesPorPokebola(Pokebola pokebola)
        {
            int pokemonesPorPokebola = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                pokemonesPorPokebola += boxBL.ObtenerPorPokebola(pokebola).Length;
            }

            return(pokemonesPorPokebola);
        }
        public static int CantPokemonesPorGenero(Genero genero)
        {
            int pokemonesPorGenero = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                pokemonesPorGenero += boxBL.ObtenerPorGenero(genero).Length;
            }

            return(pokemonesPorGenero);
        }
        public static int CantPokemonesPorTipo(Tipo tipo)
        {
            int pokemonesPorTipo = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                pokemonesPorTipo += boxBL.ObtenerPorTipo(tipo).Length;
            }

            return(pokemonesPorTipo);
        }
        public static int CantHuevosEncontrados()
        {
            int cantHuevos = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);
                cantHuevos += boxBL.ObtenerHuevos().Length;
            }

            return(cantHuevos);
        }
        public static Pokemon PokemonAtrapadoConMasterball()
        {
            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);

                foreach (Pokemon pokemon in boxBL.ObtenerTodosLosCapturados())
                {
                    if (pokemon.AtrapadoCon == Pokebola.Masterball)
                    {
                        return(pokemon);
                    }
                }
            }

            return(null);
        }
        public static int CantPokemonesIntercambiados()
        {
            int cantIntercambiados = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);

                foreach (Pokemon pokemon in boxBL.ObtenerTodosLosCapturados())
                {
                    if (pokemon.Entrenador.NombreOT.ToLower().Trim() != PC.Jugador.NombreOT.ToLower().Trim())
                    {
                        cantIntercambiados++;
                    }
                }
            }

            return(cantIntercambiados);
        }
        /// <summary>
        /// Devuelve una lista de los legendarios atrapados
        /// </summary>
        /// <returns></returns>
        public static List <Pokemon> LegendariosCapturados()
        {
            //El array de legendarios capturados no puede ser más de 5 porque hay un ejemplar por legendario

            List <Pokemon> legendariosCapturados = new List <Pokemon>();

            int[] dexLegendarios = new int[PC.Legendarios.Length];

            #region Obtener el nroDex de los pokemons legendarios
            for (int pos = 0; pos < dexLegendarios.Length; pos++)
            {
                dexLegendarios[pos] = PC.Legendarios[pos].NroDex;
            }
            #endregion

            #region Obtener los pokemones que coincidan con el dex de los legendarios

            for (int posPC = 0; posPC < PC.Boxes.Length; posPC++)
            {
                //Quiero obtener todos los pokemon de cada uno de las boxes
                LogicaBox boxBL          = new LogicaBox(PC.Boxes[posPC]);
                Pokemon[] pokemonesEnBox = boxBL.ObtenerTodosLosCapturados();

                for (int posBOX = 0; posBOX < pokemonesEnBox.Length; posBOX++)
                {
                    //Voy a recorrer cada una de las boxes y me fijo si el pokemon de esa box
                    if (dexLegendarios.Contains(pokemonesEnBox[posBOX].NroDex))
                    {
                        legendariosCapturados.Add(pokemonesEnBox[posBOX]);
                    }
                }
            }


            #endregion

            return(legendariosCapturados);
        }
        /// <summary>
        /// Calcula el nivel promedio de todos los pokemones capturados.
        /// </summary>
        /// <returns>Un entero que nos indica el nivel promedio</returns>
        public static int NivelPromedioCapturados()
        {
            int totalNivel    = 0;
            int promedioNivel = 0;

            foreach (Box box in PC.Boxes)
            {
                LogicaBox boxBL = new LogicaBox(box);

                foreach (Pokemon pokemon in boxBL.ObtenerTodosLosCapturados())
                {
                    totalNivel += pokemon.Nivel;
                }
            }

            //Evitar que arroje excepcion por dividir por 0, si no se capturaron pokemones
            if (totalNivel != 0)
            {
                promedioNivel = (int)Math.Floor((decimal)totalNivel / (TotalPokemonCapturados() - CantHuevosEncontrados()));
            }


            return(promedioNivel);
        }