コード例 #1
0
        private Trainer PcSpecialAttack(Trainer Player, Trainer PC) //PC usa ataque especial contra Jugador
        {
            switch (PC.currentPokemon.Type)
            {
            case "fire":
                PokemonFire fire = PC.currentPokemon as PokemonFire;
                fire.SpAttacking(Player.currentPokemon);
                break;

            case "flying":
                PokemonFlying fly = PC.currentPokemon as PokemonFlying;
                fly.SpAttacking(Player.currentPokemon);
                break;

            case "grass":
                PokemonGrass grass = PC.currentPokemon as PokemonGrass;
                grass.SpAttacking(Player.currentPokemon);
                break;

            case "normal":
                PokemonNormal normal = PC.currentPokemon as PokemonNormal;
                normal.SpAttacking(Player.currentPokemon);
                break;

            case "water":
                PokemonWater water = PC.currentPokemon as PokemonWater;
                water.SpAttacking(Player.currentPokemon);
                break;

            default:
                break;
            }
            MessageBox.Show(PC.currentPokemon.Name + " used " + PC.currentPokemon.MoveSet[0] + "!");

            return(Player);
        }
コード例 #2
0
        public Trainer PlayerNormalAttack(Trainer Player, Trainer PC) //Jugador usa ataque normal contra PC
        {
            switch (Player.currentPokemon.Type)
            {
            case "fire":
                PokemonFire fire = Player.currentPokemon as PokemonFire;
                fire.Attacking(PC.currentPokemon);
                break;

            case "flying":
                PokemonFlying fly = Player.currentPokemon as PokemonFlying;
                fly.Attacking(PC.currentPokemon);
                break;

            case "grass":
                PokemonGrass grass = Player.currentPokemon as PokemonGrass;
                grass.Attacking(PC.currentPokemon);
                break;

            case "normal":
                PokemonNormal normal = Player.currentPokemon as PokemonNormal;
                normal.Attacking(PC.currentPokemon);
                break;

            case "water":
                PokemonWater water = Player.currentPokemon as PokemonWater;
                water.Attacking(PC.currentPokemon);
                break;

            default:
                break;
            }
            MessageBox.Show(Player.currentPokemon.Name + " used " + Player.currentPokemon.MoveSet[0] + "!");

            return(PC);
        }
コード例 #3
0
        public void CreatePokedex(XmlWriterSettings settings) //Crea archivo de Pokedex
        {
            if (!File.Exists(pokedexFilePath))
            {
                List <Pokemon> Pokedex = new List <Pokemon>();
                //Adding starting pokemons...
                Pokemon bulbasaur = new PokemonGrass()
                {
                    Name      = "Bulbasaur",
                    Health    = 45,
                    MaxHealth = 45,
                    Attack    = 49,
                    Defense   = 49,
                    SpAttack  = 65,
                    Id        = 1
                };

                Pokemon charmander = new PokemonFire()
                {
                    Name      = "Charmander",
                    Health    = 39,
                    MaxHealth = 39,
                    Attack    = 52,
                    Defense   = 43,
                    SpAttack  = 60,
                    Id        = 2
                };

                Pokemon squirtle = new PokemonWater()
                {
                    Name      = "Squirtle",
                    Health    = 44,
                    MaxHealth = 44,
                    Attack    = 48,
                    Defense   = 55,
                    SpAttack  = 50,
                    Id        = 3
                };

                Pokemon pidgey = new PokemonFlying()
                {
                    Name      = "Pidgey",
                    Health    = 40,
                    MaxHealth = 40,
                    Attack    = 45,
                    Defense   = 40,
                    SpAttack  = 35,
                    Id        = 4
                };

                Pokemon rattata = new PokemonNormal()
                {
                    Name      = "Rattata",
                    Health    = 30,
                    MaxHealth = 30,
                    Attack    = 56,
                    Defense   = 35,
                    SpAttack  = 25,
                    Id        = 5
                };

                Pokemon spearow = new PokemonFlying()
                {
                    Name      = "Spearow",
                    Health    = 40,
                    MaxHealth = 40,
                    Attack    = 60,
                    Defense   = 30,
                    SpAttack  = 31,
                    Id        = 6
                };

                Pokedex.Add(bulbasaur);
                Pokedex.Add(charmander);
                Pokedex.Add(squirtle);
                Pokedex.Add(pidgey);
                Pokedex.Add(rattata);
                Pokedex.Add(spearow);

                XmlWriter pokedexFile = XmlWriter.Create(pokedexFilePath, settings);
                pokedexSerializer.WriteObject(pokedexFile, Pokedex);
                pokedexFile.Close();
            }
        }