Esempio n. 1
0
        private static void BattleLoop()
        {
            const int maxLevel = 20;
            const int minLevel = 1;

            Pokemon poke1    = null;
            Pokemon poke2    = null;
            bool    gameOver = false;

            do
            {
                int stand;

                // Pokemon init or Check if a pokemon was purged
                if (poke1 == null)
                {
                    poke1      = Pokemon.GeneratorPokemon(Pokemon.AantalLevelverhogingen + minLevel);
                    poke1.Name = "Pokemon " + Pokemon.AantalGegenereerdePokemon;
                }
                if (poke2 == null)
                {
                    poke2      = Pokemon.GeneratorPokemon(Pokemon.AantalLevelverhogingen + minLevel);
                    poke2.Name = "Pokemon " + Pokemon.AantalGegenereerdePokemon;
                }

                // Battle happens
                stand = Pokemon.Battle(poke1, poke2);
                BattleResult(poke1, poke2, stand);

                // Game over condition
                if (poke1.Level >= maxLevel || poke2.Level >= maxLevel)
                {
                    gameOver = true;
                }

                // Loser gets purged
                if (stand == 1)
                {
                    poke2 = null;
                }
                else if (stand == 2)
                {
                    poke1 = null;
                }

                Console.ReadLine();
            } while (!gameOver);

            // Winner/Result screen
            if (poke1 != null)
            {
                WinnerResult(poke1);
            }
            else
            {
                WinnerResult(poke2);
            }
        }