public static int Battle(Pokémon poke1, Pokémon poke2) { battles++; if (poke1 == null && poke2 == null) { return(0); } else if (poke1 == null) { return(1); } else if (poke2 == null) { return(2); } if (poke1.Average == poke2.Average) { battleGelijk++; return(0); } else if (poke1.Average > poke2.Average) { return(1); } else { return(2); } }
public static Pokémon GeneratorPokemon() { Pokémon randomPokemon = new Pokémon(); Random rand = new Random(); generatorPokemonTotal++; string[] names = new string[5] { "random1", "random2", "random3", "random4", "random5" }; string[] type = new string[5] { "gras", "electric", "water", "zand", "steen" }; randomPokemon.Name = names[rand.Next(0, 5)]; randomPokemon.Number = rand.Next(1, 100); randomPokemon.Type = type[rand.Next(0, 5)]; randomPokemon.HP_Base = rand.Next(1, 101); randomPokemon.Attack_Base = rand.Next(1, 101); randomPokemon.Defense_Base = rand.Next(1, 101); randomPokemon.SpecialAttack_Base = rand.Next(1, 101); randomPokemon.SpecialDefense_Base = rand.Next(1, 101); randomPokemon.Speed_Base = rand.Next(1, 101); return(randomPokemon); }
static void Main(string[] args) { Pokémon randomPokemon1; Pokémon randomPokemon2; randomPokemon1 = Pokémon.GeneratorPokemon(); randomPokemon2 = Pokémon.GeneratorPokemon(); Pokémon mewto = new Pokémon(45, 42, 50, 65, 34, 67); Pokémon ditto = new Pokémon() { HP_Base = 40, Name = "Ditto" }; mewto.ShowInfo(); ditto.ShowInfo(); Pokémon.NoLevelingAllowed = true; for (int i = 0; i < 10; i++) { randomPokemon1.ShowInfo(); randomPokemon2.ShowInfo(); int resultBattle = Pokémon.Battle(randomPokemon1, randomPokemon2); if (resultBattle == 1 && resultBattle != 0) { randomPokemon1.IncreaseLevel(); } else if (resultBattle == 2 && resultBattle != 0) { randomPokemon2.IncreaseLevel(); } } Pokémon.Info(); }