Exemple #1
0
        private void OnSetPokemon(object sender, RoutedEventArgs e)
        {
            IPokemon pokemon = SendPokemonToWindow.ShowSelectDialog(this, true);

            if (pokemon != null)
            {
                for (int i = 0; i < newPokemonTeam.Count; i++)
                {
                    if (i == teamIndex)
                    {
                        continue;
                    }
                    if (pokemon.Personality == newPokemonTeam[i].Personality &&
                        PokemonDatabase.GetStartingEvolutionDexID(pokemon.DexID) == PokemonDatabase.GetStartingEvolutionDexID(newPokemonTeam[i].DexID))
                    {
                        TriggerMessageBox.Show(this, "Cannot use more than one Pokémon with the same personality and family.", "Duplicate Pokémon Detected");
                        return;
                    }
                }
                if (teamIndex < newPokemonTeam.Count)
                {
                    newPokemonTeam[teamIndex] = pokemon.CreateGBAPokemon(GameTypes.Any, false);
                }
                else
                {
                    newPokemonTeam.Add(pokemon.CreateGBAPokemon(GameTypes.Any, false));
                }
                RefreshTeam();
            }
        }