Ejemplo n.º 1
0
        public static void ApplyMove(ref Pokemon activePokemon, ref Move currentMove, ref Pokemon target)
        {
            int    critHitMultiplier = 1;
            int    damage;
            Random random = new Random();

            if (activePokemon.sleepCounter > 0)
            {
                activePokemon.sleepCounter--;
                if (activePokemon.sleepCounter > 0)
                {
                    Methods.WriteType(activePokemon.name, activePokemon.type); Console.WriteLine(" is fast asleep!"); Console.ReadKey();
                }
                if (activePokemon.sleepCounter == 0)
                {
                    activePokemon.WriteName(); Console.WriteLine("woke up!"); Console.ReadKey();
                }
                return;
            }
            if (activePokemon.isParalyzed == true && random.Next(0, 4) == 3)
            {
                Methods.WriteType(activePokemon.name, activePokemon.type); Console.WriteLine(" is paralyzed! It can't move!"); Console.ReadKey();
                return;
            }
            if (activePokemon.isFlinching == true)
            {
                activePokemon.isFlinching = false;
                Methods.WriteType(activePokemon.name, activePokemon.type); Console.WriteLine(" flinched!"); Console.ReadKey();
                return;
            }

            Console.Write("\n"); Methods.WriteType(activePokemon.name, activePokemon.type); Console.WriteLine($" used {currentMove.name}!"); Console.ReadKey();

            for (int i = currentMove.numberTimesHit; i > 0; i--)
            {
                if (random.Next(0, 101) <= (currentMove.accuracy * (Math.Pow(.66, activePokemon.accuracyMod))) || currentMove.name == "Swift")
                {
                    //SPECIAL CASES

                    if (currentMove.name == "Dream Eater")
                    {
                        if (currentMove.critChance != 0 && random.NextDouble() <= (currentMove.critChance * activePokemon.critMod))
                        {
                            critHitMultiplier = 2;
                        }
                        damage = (((((2 * activePokemon.level) / 5) * currentMove.damage * (activePokemon.attackStat + activePokemon.attackMod) / (target.defenseStat + target.defenseMod)) / 50) + 2) * critHitMultiplier;
                        target.currentHitPoints -= damage;
                        currentMove.currentPowerPoints--;
                        Console.WriteLine($"It dealt {damage} damage!"); Console.ReadKey();
                        critHitMultiplier = 1;
                        activePokemon.currentHitPoints += damage / 2;
                        if (activePokemon.currentHitPoints >= activePokemon.maxHitPoints)
                        {
                            activePokemon.currentHitPoints = activePokemon.maxHitPoints;
                        }
                        activePokemon.WriteName(); Console.Write(" healed itself by eating "); target.WriteName(); Console.WriteLine("'s dream!"); Console.ReadKey();
                        return;
                    }

                    if (currentMove.name == "Guillotine" || currentMove.name == "Horn Drill")
                    {
                        target.currentHitPoints = 0;
                        currentMove.currentPowerPoints--;
                        target.isFainted = true;
                        Console.WriteLine("It's a one-hit KO!"); Console.ReadKey();
                        return;
                    }

                    if (currentMove.name == "Night Shade")
                    {
                        currentMove.damage = target.level;
                    }

                    if (currentMove.name == "Splash")
                    {
                        currentMove.currentPowerPoints--; Console.WriteLine("But nothing happened!"); Console.ReadKey(); return;
                    }

                    if (currentMove.name == "Super Fang")
                    {
                        currentMove.currentPowerPoints--;
                        Console.WriteLine($"It dealt {target.currentHitPoints / 2} damage!"); Console.ReadKey();
                        target.currentHitPoints /= 2;
                        return;
                    }

                    if (currentMove.name == "Transform")
                    {
                        activePokemon.WriteName(); Console.Write(" transformed into "); target.WriteName(); Console.WriteLine(); Console.Write("."); Console.ReadKey();
                        activePokemon.type    = target.type;
                        activePokemon.move[0] = target.move[0];
                        activePokemon.move[1] = target.move[1];
                        activePokemon.move[0].currentPowerPoints = 5;
                        activePokemon.move[1].currentPowerPoints = 5;
                        activePokemon.attackStat  = target.attackStat;
                        activePokemon.attackMod   = target.attackMod;
                        activePokemon.defenseStat = target.defenseStat;
                        activePokemon.defenseMod  = target.defenseMod;
                        activePokemon.critMod     = target.critMod;
                        activePokemon.speedStat   = target.speedStat;
                        activePokemon.speedMod    = target.speedMod;
                        activePokemon.hpStat      = target.hpStat;
                        activePokemon.hpMod       = target.hpMod;
                    }

                    //NORMAL CASES

                    if (currentMove.critChance != 0 && random.NextDouble() <= (currentMove.critChance * activePokemon.critMod))
                    {
                        critHitMultiplier = 2;
                    }
                    if (currentMove.damage != 0)
                    {
                        damage = Convert.ToInt32((((((2 * activePokemon.level) / 5) * currentMove.damage * (activePokemon.attackStat + activePokemon.attackMod) / (target.defenseStat + target.defenseMod)) / 50) + 2) * critHitMultiplier * (Convert.ToDouble(random.Next(85, 101)) / 100));
                        target.currentHitPoints = (target.currentHitPoints - damage);
                        currentMove.currentPowerPoints--;
                        Console.WriteLine($"It dealt {damage} damage!"); Console.ReadKey();
                        if (critHitMultiplier == 2)
                        {
                            Console.WriteLine("A critical hit!"); Console.ReadKey();
                        }
                    }
                    else
                    {
                        damage = 0;
                    }
                    critHitMultiplier = 1;

                    if (currentMove.causeBurn == true && random.NextDouble() < currentMove.effectChance && target.isBurned == false)
                    {
                        target.isBurned = true; target.WriteName(); Console.WriteLine(" was burned!"); Console.ReadKey();
                    }
                    if (currentMove.causePoison == true && random.NextDouble() < currentMove.effectChance && target.isPoisoned == false)
                    {
                        target.isPoisoned = true; target.WriteName(); Console.WriteLine(" was poisoned!"); Console.ReadKey();
                    }
                    if (currentMove.causeSleep == true && random.NextDouble() < currentMove.effectChance && target.sleepCounter == 0)
                    {
                        target.sleepCounter = random.Next(2, 6); target.WriteName(); Console.WriteLine(" fell asleep!"); Console.ReadKey();
                    }
                    if (currentMove.causeParalysis == true && random.NextDouble() < currentMove.effectChance && target.isParalyzed == false)
                    {
                        target.isPoisoned = true; target.WriteName(); Console.WriteLine(" was paralyzed!"); Console.ReadKey();
                    }
                    if (currentMove.causeFlinch == true && random.NextDouble() < currentMove.effectChance && target.isFlinching == false)
                    {
                        target.isFlinching = true;
                    }
                    if (currentMove.gripDamage != 0 && random.NextDouble() < currentMove.effectChance && target.gripCounter == 0)
                    {
                        target.gripCounter = random.Next(2, 6); target.WriteName(); Console.WriteLine(" has been gripped!"); Console.ReadKey();
                    }
                    if (currentMove.recoilDamage != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        if (currentMove.recoilDamage == 1)
                        {
                            activePokemon.WriteName(); Console.WriteLine($" dealt {activePokemon.currentHitPoints} damage to itself!"); activePokemon.currentHitPoints = 0; Console.ReadKey();
                        }
                        else
                        {
                            activePokemon.WriteName(); Console.WriteLine($" dealt {damage * currentMove.recoilDamage} to itself!"); activePokemon.currentHitPoints -= Convert.ToInt16(Math.Floor((damage * currentMove.recoilDamage))); Console.ReadKey();
                        }
                    }
                    if (currentMove.hpGain != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        if (currentMove.name == "Recover")
                        {
                            activePokemon.currentHitPoints += (activePokemon.maxHitPoints / 2);
                            if (activePokemon.currentHitPoints > activePokemon.maxHitPoints)
                            {
                                activePokemon.currentHitPoints = activePokemon.maxHitPoints;
                            }
                            activePokemon.WriteName(); Console.WriteLine(" healed itself!"); Console.ReadKey();
                        }
                        if (currentMove.name == "Rest")
                        {
                            activePokemon.currentHitPoints = activePokemon.maxHitPoints;
                            activePokemon.isBurned         = false;
                            activePokemon.isParalyzed      = false;
                            activePokemon.isPoisoned       = false;
                            activePokemon.sleepCounter     = random.Next(2, 6);
                            activePokemon.WriteName(); Console.WriteLine(" fully healed itself!"); Console.ReadKey();
                            activePokemon.WriteName(); Console.WriteLine(" fell asleep!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.attackBoost != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        activePokemon.attackMod += currentMove.attackBoost;
                        activePokemon.WriteName(); Console.WriteLine("'s attack rose!"); Console.ReadKey();
                        if (activePokemon.attackMod > 6)
                        {
                            activePokemon.attackMod = 6; Console.WriteLine("Its attack can't go any higher!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.defenseBoost != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        activePokemon.defenseMod += currentMove.defenseBoost;
                        activePokemon.WriteName(); Console.WriteLine("'s defense rose!"); Console.ReadKey();
                        if (activePokemon.defenseMod > 6)
                        {
                            activePokemon.defenseMod = 6; Console.WriteLine("Its defense can't go any higher!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.critBoost != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        activePokemon.critMod += currentMove.critBoost;
                        activePokemon.WriteName(); Console.WriteLine(" is getting pumped!"); Console.ReadKey();
                        if (activePokemon.critMod > 7)
                        {
                            activePokemon.critMod = 7; Console.WriteLine("It can't get any more pumped!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.speedBoost != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        activePokemon.speedMod += currentMove.speedBoost;
                        activePokemon.WriteName(); Console.WriteLine("'s speed rose!"); Console.ReadKey();
                        if (activePokemon.speedMod > 6)
                        {
                            activePokemon.speedMod = 6; Console.WriteLine("Its speed can't go any higher!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.attackPenalty != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        target.attackMod -= currentMove.attackPenalty;
                        if (target.attackMod + target.attackStat <= 0)
                        {
                            target.attackMod = target.attackStat - 1;
                            target.WriteName(); Console.WriteLine("'s attack can't go any lower!"); Console.ReadKey();
                        }
                        target.WriteName(); Console.WriteLine("'s attack fell!"); Console.ReadKey();
                        if (target.attackMod < -6)
                        {
                            activePokemon.attackMod = 6; Console.WriteLine("Its attack can't go any lower!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.defensePenalty != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        target.defenseMod -= currentMove.defensePenalty;
                        if (target.attackMod + target.attackStat <= 0)
                        {
                            target.defenseMod = target.defenseStat - 1;
                            target.WriteName(); Console.WriteLine("'s defense can't go any lower!"); Console.ReadKey();
                        }
                        target.WriteName(); Console.WriteLine("'s defense fell!"); Console.ReadKey();
                        if (target.defenseMod < -6)
                        {
                            activePokemon.defenseMod = 6; Console.WriteLine("Its defense can't go any lower!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.speedPenalty != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        target.speedMod -= currentMove.speedPenalty;
                        if (target.speedMod + target.speedStat <= 0)
                        {
                            target.attackMod = target.attackStat - 1;
                            target.WriteName(); Console.WriteLine("'s speed can't go any lower!"); Console.ReadKey();
                        }
                        target.WriteName(); Console.WriteLine("'s speed fell!"); Console.ReadKey();
                        if (target.speedMod < -6)
                        {
                            activePokemon.speedMod = 6; Console.WriteLine("Its speed can't go any lower!"); Console.ReadKey();
                        }
                    }
                    if (currentMove.accuracyPenalty != 0 && random.NextDouble() < currentMove.effectChance)
                    {
                        target.accuracyMod -= currentMove.accuracyPenalty;
                        target.WriteName(); Console.WriteLine("'s accuracy fell!"); Console.ReadKey();
                        if (target.accuracyMod < -6)
                        {
                            activePokemon.accuracyMod = 6; Console.WriteLine("Its accuracy can't go any lower!"); Console.ReadKey();
                        }
                    }
                }
                else
                {
                    Console.WriteLine("The attack missed!"); Console.ReadKey();
                    currentMove.currentPowerPoints--;
                }
                Console.ReadLine();
            }
        }
Ejemplo n.º 2
0
        public static bool WildBattle(ref Player _player, Pokemon _opposingPokemon, Move _struggle)
        {
            Pokemon activePokemon = _player.party[0];
            Move    chosenMove;
            Move    transform = _struggle;
            string  currentCommand;
            bool    ppOut;
            bool    useMove;

            activePokemon.maxHitPoints = (20 * activePokemon.hpStat * activePokemon.level) / 100 + activePokemon.level + 10;
            foreach (Pokemon pokemon in _player.party)
            {
                if (pokemon.name == "Ditto")
                {
                    transform = pokemon.move[0];
                }
            }

            Console.Write("A wild "); WriteType(_opposingPokemon.name, _opposingPokemon.type); Console.WriteLine(" appeared!"); Console.ReadKey();
            Console.Write("Go, "); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();

            while (_opposingPokemon.isFainted == false)
            {
                if ((_player.party[0].isFainted == true || _player.party[0].id == 0) && (_player.party[1].isFainted == true || _player.party[1].id == 0) && (_player.party[2].isFainted == true || _player.party[2].id == 0))
                {
                    goto PartyFainted;
                }

                //Switches in a new Pokemon if the active one fainted last turn
                if (activePokemon.isFainted == true)
                {
                    Console.WriteLine("\nWhich Pokémon would you like to put in?");
                    if (_player.party[0].isFainted == false && _player.party[0].id != 0)
                    {
                        Console.Write("1. "); _player.party[0].WriteName(); Console.Write("\n");
                    }
                    if (_player.party[1].isFainted == false && _player.party[1].id != 0)
                    {
                        Console.Write("2. "); _player.party[1].WriteName(); Console.Write("\n");
                    }
                    if (_player.party[2].isFainted == false && _player.party[2].id != 0)
                    {
                        Console.Write("3. "); _player.party[2].WriteName(); Console.Write("\n");
                    }

                    currentCommand = Console.ReadLine();

                    switch (currentCommand)
                    {
                    case "1":
                        if (_player.party[0].isFainted == false && _player.party[0].id != 0)
                        {
                            activePokemon = _player.party[0];
                            Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();
                        }
                        continue;

                    case "2":
                        if (_player.party[1].isFainted == false && _player.party[1].id != 0)
                        {
                            activePokemon = _player.party[1];
                            Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();
                        }
                        continue;

                    case "3":
                        if (_player.party[2].isFainted == false && _player.party[2].id != 0)
                        {
                            activePokemon = _player.party[2];
                            Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();
                        }
                        continue;

                    default:
                        Console.Write("Command not recognized."); Console.ReadKey();
                        continue;
                    }
                }

                ppOut      = false;
                useMove    = false;
                chosenMove = _struggle;
                activePokemon.didParticipate = true;
                activePokemon.isFlinching    = false;
                _opposingPokemon.isFlinching = false;

                //Displays all the Pokemons' information and asks what to do
                Console.Clear();
                Console.Write("\n\n\n");
                Console.WriteLine("+-----------------------+".PadLeft(53));
                Console.Write("| ".PadLeft(30)); Methods.WriteType(_opposingPokemon.name.PadRight(13), _opposingPokemon.type); Console.Write($"{_opposingPokemon.currentHitPoints}/{_opposingPokemon.maxHitPoints}".PadRight(9) + "|\n");
                Console.WriteLine("+-----------------------+\n".PadLeft(54));

                Console.WriteLine("+-----------------------+");
                Console.Write("| "); Methods.WriteType(activePokemon.name.PadRight(13), activePokemon.type); Console.Write($"{activePokemon.currentHitPoints}/{activePokemon.maxHitPoints}".PadRight(9) + "|\n");
                Console.WriteLine("+-----------------------+\n");

                Console.WriteLine("What would you like to do?");
                if (activePokemon.move[0].currentPowerPoints == 0 && activePokemon.move[1].currentPowerPoints == 0)
                {
                    ppOut = true;
                    Console.WriteLine("1. Use Struggle");
                    Console.WriteLine("3. Switch Pokémon");
                    Console.WriteLine("4. Throw a Pokéball");
                }
                else
                {
                    Console.WriteLine($"1. Use {activePokemon.move[0].name} | {activePokemon.move[0].currentPowerPoints} / {activePokemon.move[0].powerPoints} PP");
                    Console.WriteLine($"2. Use {activePokemon.move[1].name} | {activePokemon.move[1].currentPowerPoints} / {activePokemon.move[1].powerPoints} PP");
                    Console.WriteLine("3. Switch Pokémon");
                    Console.WriteLine("4. Throw a Pokéball");
                }

                currentCommand = Console.ReadLine();
                switch (currentCommand)
                {
                case "1":     //Move 1
                    chosenMove = activePokemon.move[0];
                    if (ppOut == true || chosenMove.currentPowerPoints == 0)
                    {
                        chosenMove = _struggle;
                    }
                    useMove = true;
                    break;

                case "2":     //Move 2
                    chosenMove = activePokemon.move[1];
                    if (ppOut == true || chosenMove.currentPowerPoints == 0)
                    {
                        chosenMove = _struggle;
                    }
                    useMove = true;
                    break;

                case "3":     //Switch Pokemon
                    activePokemon.WriteName(); Console.WriteLine(", return!\n"); Console.ReadKey();
                    Console.WriteLine("\nWhich Pokémon would you like to put in?");
                    if (_player.party[0].isFainted == false && _player.party[0].id != 0)
                    {
                        Console.Write("1. "); _player.party[0].WriteName(); Console.Write("\n");
                    }
                    if (_player.party[1].isFainted == false && _player.party[1].id != 0)
                    {
                        Console.Write("2. "); _player.party[1].WriteName(); Console.Write("\n");
                    }
                    if (_player.party[2].isFainted == false && _player.party[2].id != 0)
                    {
                        Console.Write("3. "); _player.party[2].WriteName(); Console.Write("\n");
                    }

                    currentCommand = Console.ReadLine();

                    switch (currentCommand)
                    {
                    case "1":
                        if (_player.party[0].isFainted == false && _player.party[0].id != 0)
                        {
                            activePokemon = _player.party[0];
                            Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n");
                        }
                        continue;

                    case "2":
                        if (_player.party[1].isFainted == false && _player.party[1].id != 0)
                        {
                            activePokemon = _player.party[1];
                            Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n");
                        }
                        continue;

                    case "3":
                        if (_player.party[2].isFainted == false && _player.party[2].id != 0)
                        {
                            activePokemon = _player.party[2];
                            Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n");
                        }
                        continue;

                    default:
                        Console.Write("\nCommand not recognized.\n"); Console.ReadKey();
                        continue;
                    }

                case "4":     //Catch Pokemon
                    Console.WriteLine($"{_player.name} threw a Pokéball!"); Console.ReadKey();
                    Random randomOne = new Random();
                    if (randomOne.Next(101) > Convert.ToInt32((Convert.ToDouble(_opposingPokemon.currentHitPoints) / Convert.ToDouble(_opposingPokemon.maxHitPoints)) * 100))
                    {
                        Console.Write("Gotcha! The enemy "); _opposingPokemon.WriteName(); Console.WriteLine(" was caught!"); Console.ReadKey();
                        if (_player.party[1].id == 0)
                        {
                            _player.party[1] = _opposingPokemon;
                            _player.party[1].WriteName(); Console.WriteLine(" has been added to your party."); Console.ReadKey();
                            return(true);
                        }
                        else if (_player.party[2].id == 0)
                        {
                            _player.party[1] = _opposingPokemon;
                            _player.party[1].WriteName(); Console.WriteLine(" has been added to your party."); Console.ReadKey();
                            return(true);
                        }
                        else
                        {
                            _opposingPokemon.Heal();
                            _player.pcPokemon.Add(_opposingPokemon);
                            _opposingPokemon.WriteName(); Console.WriteLine(" was sent to your PC.");
                            return(true);
                        }
                    }
                    else
                    {
                        Console.Write("The enemy "); _opposingPokemon.WriteName(); Console.WriteLine(" broke free!");
                    }
                    break;

                default:
                    Console.WriteLine("\nCommand not recognized.\n"); Console.ReadKey();
                    break;
                }

                Random random       = new Random();
                Move   opposingMove = _opposingPokemon.move[random.Next(0, 2)];
                while (opposingMove.currentPowerPoints == 0)
                {
                    opposingMove = _opposingPokemon.move[random.Next(0, 2)];
                }

                if (chosenMove.restBefore == true && useMove == true)
                {
                    Console.Write("\n"); activePokemon.WriteName(); Console.WriteLine($" is charging up!"); Console.ReadKey();
                    ApplyMove(ref opposingMove, ref _opposingPokemon, ref activePokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }

                if (chosenMove.name == "Quick Attack" && useMove == true)
                {
                    ApplyMove(ref activePokemon, ref chosenMove, ref _opposingPokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }

                if (opposingMove.name == "Quick Attack")
                {
                    ApplyMove(ref opposingMove, ref _opposingPokemon, ref activePokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }

                if (_opposingPokemon.speedStat + _opposingPokemon.speedMod > activePokemon.speedStat + activePokemon.speedMod && opposingMove.name != "Quick Attack")
                {
                    ApplyMove(ref opposingMove, ref _opposingPokemon, ref activePokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }

                if (chosenMove.name != "Quick Attack" && chosenMove.name != "Mirror Move" && useMove == true)
                {
                    ApplyMove(ref activePokemon, ref chosenMove, ref _opposingPokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }

                if (_opposingPokemon.speedStat + _opposingPokemon.speedMod <= activePokemon.speedStat + activePokemon.speedMod && opposingMove.name != "Quick Attack")
                {
                    ApplyMove(ref opposingMove, ref _opposingPokemon, ref activePokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }

                if (chosenMove.name == "Mirror Move" && useMove == true)
                {
                    Console.Write("\n"); Methods.WriteType(activePokemon.name, activePokemon.type); Console.WriteLine($" used Mirror Move!"); Console.ReadKey();
                    ApplyMove(ref activePokemon, ref opposingMove, ref _opposingPokemon);
                    if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref _opposingPokemon) == true)
                    {
                        continue;
                    }
                }



                if (_opposingPokemon.isBurned == true)
                {
                    Console.Write("The enemy "); _opposingPokemon.WriteName(); Console.WriteLine($" took {_opposingPokemon.maxHitPoints / 8} damage from its burn!"); _opposingPokemon.currentHitPoints -= (_opposingPokemon.maxHitPoints / 8); Console.ReadLine();
                }
                if (_opposingPokemon.isPoisoned == true)
                {
                    Console.Write("The enemy "); _opposingPokemon.WriteName(); Console.WriteLine($" took {_opposingPokemon.maxHitPoints / 16} damage from the poison!"); _opposingPokemon.currentHitPoints -= (_opposingPokemon.maxHitPoints / 16); Console.ReadLine();
                }
                if (_opposingPokemon.gripCounter != 0)
                {
                    Console.Write("The enemy "); _opposingPokemon.WriteName(); Console.WriteLine($" took damage from being gripped!"); _opposingPokemon.currentHitPoints -= (((((2 * activePokemon.level) / 5) * 15 * (activePokemon.attackStat + activePokemon.attackMod) / (_opposingPokemon.defenseStat + _opposingPokemon.defenseMod)) / 50) + 2); Console.ReadLine();
                }
                CheckIfFainted(ref _opposingPokemon);

                if (activePokemon.isBurned == true)
                {
                    activePokemon.WriteName(); Console.WriteLine($" took {activePokemon.maxHitPoints / 8} damage from its burn!"); activePokemon.currentHitPoints -= (activePokemon.maxHitPoints / 8); Console.ReadLine();
                }
                if (activePokemon.isPoisoned == true)
                {
                    activePokemon.WriteName(); Console.WriteLine($" took {activePokemon.maxHitPoints / 16} damage from the poison!"); activePokemon.currentHitPoints -= (activePokemon.maxHitPoints / 16); Console.ReadLine();
                }
                if (activePokemon.gripCounter != 0)
                {
                    activePokemon.WriteName(); Console.WriteLine($" took damage from being gripped!"); activePokemon.currentHitPoints -= (((((2 * activePokemon.level) / 5) * 15 * (_opposingPokemon.attackStat + _opposingPokemon.attackMod) / (activePokemon.defenseStat + activePokemon.defenseMod)) / 50) + 2); Console.ReadLine();
                }
                CheckIfFainted(ref activePokemon);
            }

            if (_opposingPokemon.isFainted == true)
            {
                foreach (Pokemon pokemon in _player.party)
                {
                    if (pokemon.name == "Ditto")
                    {
                        pokemon.type    = "normal";
                        pokemon.move[0] = transform;
                        pokemon.move[1] = transform;
                        pokemon.move[0].currentPowerPoints = 10;
                        pokemon.move[1].currentPowerPoints = 10;
                        pokemon.attackStat  = 3;
                        pokemon.defenseStat = 2;
                        pokemon.speedStat   = 3;
                        pokemon.hpStat      = 2;
                    }
                    if (pokemon.didParticipate == true && pokemon.isFainted == false && pokemon.level != 100)
                    {
                        pokemon.level++; pokemon.WriteName(); Console.WriteLine(" gained a level!"); Console.ReadKey();
                    }
                    pokemon.hpMod          = 0;
                    pokemon.attackMod      = 0;
                    pokemon.defenseMod     = 0;
                    pokemon.speedMod       = 0;
                    pokemon.accuracyMod    = 0;
                    pokemon.didParticipate = false;
                    pokemon.isFlinching    = false;
                    pokemon.gripCounter    = 0;
                    if (pokemon.level >= pokemon.evolvesAt && pokemon.id != 0)
                    {
                        pokemon.WriteName(); Console.Write(" evolved into a "); Methods.WriteType(pokemon.evolvesTo, pokemon.type); Console.WriteLine("!");
                        pokemon.hasEvolved = true;
                        Console.ReadKey();
                    }
                }
                return(true);
            }
PartyFainted:
            Console.WriteLine($"{_player.name} has no more usable Pokémon!"); Console.ReadKey();
            Console.WriteLine($"{_player.name} whited out!");
            return(false);
        }
        public static bool TrainerBattle(ref Player player, Trainer trainer, Move _struggle)
        {
            Pokemon activePokemon = player.party[0];
            Move    chosenMove;
            Move    transform = _struggle;
            string  currentCommand;
            bool    ppOut;
            bool    useMove;

            foreach (Pokemon pokemon in player.party)
            {
                if (pokemon.name == "Ditto")
                {
                    transform = pokemon.move[0];
                }
                else
                {
                    transform = _struggle;
                }
            }
            Console.WriteLine($"{trainer.name.ToUpper()}: {trainer.challengeMessage}"); Console.Read();
            Console.WriteLine($"{trainer.type} {trainer.name} challenged you to a battle!"); Console.ReadKey();
            Console.Write("Go, "); activePokemon.WriteName(); Console.WriteLine("!\n"); Console.ReadKey();
            while (trainer.trainerParty[0].name == "Missingno")
            {
                trainer.trainerParty.Remove(trainer.trainerParty[0]);
            }

            for (int i = 0; i < trainer.trainerParty.Count; i++)
            {
                Pokemon opposingPokemon = trainer.trainerParty[i];
                activePokemon.maxHitPoints = (20 * activePokemon.hpStat * activePokemon.level) / 100 + activePokemon.level + 10;

                Console.Write($"{trainer.type} {trainer.name} sent out "); opposingPokemon.WriteName(); Console.WriteLine("!"); Console.ReadKey();


                while (opposingPokemon.isFainted == false)
                {
                    if ((player.party[0].isFainted == true || player.party[0].id == 0) && (player.party[1].isFainted == true || player.party[1].id == 0) && (player.party[2].isFainted == true || player.party[2].id == 0))
                    {
                        goto PartyFainted;
                    }

                    //Switches in a new Pokemon if the active one fainted last turn
                    if (activePokemon.isFainted == true)
                    {
                        Console.WriteLine("\nWhich Pokémon would you like to put in?");
                        if (player.party[0].isFainted == false && player.party[0].id != 0)
                        {
                            Console.Write("1. "); player.party[0].WriteName(); Console.Write("\n");
                        }
                        if (player.party[1].isFainted == false && player.party[1].id != 0)
                        {
                            Console.Write("2. "); player.party[1].WriteName(); Console.Write("\n");
                        }
                        if (player.party[2].isFainted == false && player.party[2].id != 0)
                        {
                            Console.Write("3. "); player.party[2].WriteName(); Console.Write("\n");
                        }

                        currentCommand = Console.ReadLine();

                        switch (currentCommand)
                        {
                        case "1":
                            if (player.party[0].isFainted == false && player.party[0].id != 0)
                            {
                                activePokemon = player.party[0];
                                Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();
                            }
                            continue;

                        case "2":
                            if (player.party[1].isFainted == false && player.party[1].id != 0)
                            {
                                activePokemon = player.party[1];
                                Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();
                            }
                            continue;

                        case "3":
                            if (player.party[2].isFainted == false && player.party[2].id != 0)
                            {
                                activePokemon = player.party[2];
                                Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n"); Console.ReadKey();
                            }
                            continue;

                        default:
                            Console.Write("Command not recognized."); Console.ReadKey();
                            continue;
                        }
                    }

                    ppOut      = false;
                    useMove    = false;
                    chosenMove = _struggle;
                    activePokemon.didParticipate = true;
                    activePokemon.isFlinching    = false;
                    opposingPokemon.isFlinching  = false;

                    //Displays all the Pokemons' information and asks what to do
                    Console.Clear();
                    Console.Write("\n\n\n");
                    Console.WriteLine("+-----------------------+".PadLeft(53));
                    Console.Write("| ".PadLeft(30)); Methods.WriteType(opposingPokemon.name.PadRight(13), opposingPokemon.type); Console.Write($"{opposingPokemon.currentHitPoints}/{opposingPokemon.maxHitPoints}".PadRight(9) + "|\n");
                    Console.WriteLine("+-----------------------+\n".PadLeft(54));

                    Console.WriteLine("+-----------------------+");
                    Console.Write("| "); Methods.WriteType(activePokemon.name.PadRight(13), activePokemon.type); Console.Write($"{activePokemon.currentHitPoints}/{activePokemon.maxHitPoints}".PadRight(9) + "|\n");
                    Console.WriteLine("+-----------------------+\n");

                    Console.WriteLine("What would you like to do?");
                    if (activePokemon.move[0].currentPowerPoints == 0 && activePokemon.move[1].currentPowerPoints == 0)
                    {
                        ppOut = true;
                        Console.WriteLine("1. Use Struggle");
                        Console.WriteLine("3. Switch Pokémon");
                        Console.WriteLine("4. Throw a Pokéball");
                    }
                    else
                    {
                        Console.WriteLine($"1. Use {activePokemon.move[0].name} | {activePokemon.move[0].currentPowerPoints} / {activePokemon.move[0].powerPoints} PP");
                        Console.WriteLine($"2. Use {activePokemon.move[1].name} | {activePokemon.move[1].currentPowerPoints} / {activePokemon.move[1].powerPoints} PP");
                        Console.WriteLine("3. Switch Pokémon");
                        Console.WriteLine("4. Throw a Pokéball");
                    }


                    currentCommand = Console.ReadLine();
                    switch (currentCommand)
                    {
                    case "1":     //Move 1
                        chosenMove = activePokemon.move[0];
                        if (ppOut == true || chosenMove.currentPowerPoints == 0)
                        {
                            chosenMove = _struggle;
                        }
                        useMove = true;
                        break;

                    case "2":     //Move 2

                        chosenMove = activePokemon.move[1];
                        if (ppOut == true || chosenMove.currentPowerPoints == 0)
                        {
                            chosenMove = _struggle;
                        }
                        useMove = true;
                        break;

                    case "3":     //Switch Pokemon
                        activePokemon.WriteName(); Console.WriteLine(", return!\n"); Console.ReadKey();
                        Console.WriteLine("\nWhich Pokémon would you like to put in?");
                        if (player.party[0].isFainted == false && player.party[0].id != 0)
                        {
                            Console.Write("1. "); player.party[0].WriteName(); Console.Write("\n");
                        }
                        if (player.party[1].isFainted == false && player.party[1].id != 0)
                        {
                            Console.Write("2. "); player.party[1].WriteName(); Console.Write("\n");
                        }
                        if (player.party[2].isFainted == false && player.party[2].id != 0)
                        {
                            Console.Write("3. "); player.party[2].WriteName(); Console.Write("\n");
                        }

                        currentCommand = Console.ReadLine();

                        switch (currentCommand)
                        {
                        case "1":
                            if (player.party[0].isFainted == false && player.party[0].id != 0)
                            {
                                activePokemon = player.party[0];
                                Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n");
                            }
                            continue;

                        case "2":
                            if (player.party[1].isFainted == false && player.party[1].id != 0)
                            {
                                activePokemon = player.party[1];
                                Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n");
                            }
                            continue;

                        case "3":
                            if (player.party[2].isFainted == false && player.party[2].id != 0)
                            {
                                activePokemon = player.party[2];
                                Console.Write("\nGo,"); WriteType(activePokemon.name, activePokemon.type); Console.WriteLine("!\n");
                            }
                            continue;

                        default:
                            Console.Write("\nCommand not recognized.\n"); Console.ReadKey();
                            continue;
                        }

                    case "4":     //Catch Pokemon

                        break;

                    default:
                        Console.WriteLine("\nCommand not recognized.\n"); Console.ReadKey();
                        break;
                    }
                    Random random       = new Random();
                    Move   opposingMove = opposingPokemon.move[random.Next(0, 2)];
                    while (opposingMove.currentPowerPoints == 0)
                    {
                        opposingMove = opposingPokemon.move[random.Next(0, 2)];
                    }

                    if (chosenMove.restBefore == true && useMove == true)
                    {
                        Console.Write("\n"); activePokemon.WriteName(); Console.WriteLine($" is charging up!"); Console.ReadKey();
                        ApplyMove(ref opposingMove, ref opposingPokemon, ref activePokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (chosenMove.name == "Quick Attack" && useMove == true)
                    {
                        ApplyMove(ref activePokemon, ref chosenMove, ref opposingPokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (opposingMove.name == "Quick Attack")
                    {
                        ApplyMove(ref opposingMove, ref opposingPokemon, ref activePokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (opposingPokemon.speedStat + opposingPokemon.speedMod > activePokemon.speedStat + activePokemon.speedMod && opposingMove.name != "Quick Attack")
                    {
                        ApplyMove(ref opposingMove, ref opposingPokemon, ref activePokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (chosenMove.name != "Quick Attack" && chosenMove.name != "Mirror Move" && useMove == true)
                    {
                        ApplyMove(ref activePokemon, ref chosenMove, ref opposingPokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (opposingPokemon.speedStat + opposingPokemon.speedMod <= activePokemon.speedStat + activePokemon.speedMod && opposingMove.name != "Quick Attack")
                    {
                        ApplyMove(ref opposingMove, ref opposingPokemon, ref activePokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (chosenMove.name == "Mirror Move" && useMove == true)
                    {
                        Console.Write("\n"); Methods.WriteType(activePokemon.name, activePokemon.type); Console.WriteLine($" used Mirror Move!"); Console.ReadKey();
                        ApplyMove(ref activePokemon, ref opposingMove, ref opposingPokemon);
                        if (CheckIfFainted(ref activePokemon) == true || CheckIfFainted(ref opposingPokemon) == true)
                        {
                            continue;
                        }
                    }

                    if (opposingPokemon.isBurned == true)
                    {
                        Console.Write("The enemy "); opposingPokemon.WriteName(); Console.WriteLine($" took {opposingPokemon.maxHitPoints / 8} damage from its burn!"); opposingPokemon.currentHitPoints -= (opposingPokemon.maxHitPoints / 8); Console.ReadLine();
                    }
                    if (opposingPokemon.isPoisoned == true)
                    {
                        Console.Write("The enemy "); opposingPokemon.WriteName(); Console.WriteLine($" took {opposingPokemon.maxHitPoints / 16} damage from the poison!"); opposingPokemon.currentHitPoints -= (opposingPokemon.maxHitPoints / 16); Console.ReadLine();
                    }
                    if (opposingPokemon.gripCounter != 0)
                    {
                        Console.Write("The enemy "); opposingPokemon.WriteName(); Console.WriteLine($" took damage from being gripped!"); opposingPokemon.currentHitPoints -= (((((2 * activePokemon.level) / 5) * 15 * (activePokemon.attackStat + activePokemon.attackMod) / (opposingPokemon.defenseStat + opposingPokemon.defenseMod)) / 50) + 2); Console.ReadLine();
                    }
                    CheckIfFainted(ref opposingPokemon);

                    if (activePokemon.isBurned == true)
                    {
                        activePokemon.WriteName(); Console.WriteLine($" took {activePokemon.maxHitPoints / 8} damage from its burn!"); activePokemon.currentHitPoints -= (activePokemon.maxHitPoints / 8); Console.ReadLine();
                    }
                    if (activePokemon.isPoisoned == true)
                    {
                        activePokemon.WriteName(); Console.WriteLine($" took {activePokemon.maxHitPoints / 16} damage from the poison!"); activePokemon.currentHitPoints -= (activePokemon.maxHitPoints / 16); Console.ReadLine();
                    }
                    if (activePokemon.gripCounter != 0)
                    {
                        activePokemon.WriteName(); Console.WriteLine($" took damage from being gripped!"); activePokemon.currentHitPoints -= (((((2 * activePokemon.level) / 5) * 15 * (opposingPokemon.attackStat + opposingPokemon.attackMod) / (activePokemon.defenseStat + activePokemon.defenseMod)) / 50) + 2); Console.ReadLine();
                    }
                    CheckIfFainted(ref activePokemon);
                }

                if (opposingPokemon.isFainted == true)
                {
                    foreach (Pokemon pokemon in player.party)
                    {
                        if (pokemon.didParticipate == true && pokemon.isFainted == false && pokemon.level < 100)
                        {
                            pokemon.level++; pokemon.WriteName(); Console.WriteLine(" gained a level!"); Console.ReadKey();
                        }
                        pokemon.didParticipate = false;
                    }
                }
            }

            Console.WriteLine($"{trainer.type} {trainer.name} was defeated!"); Console.ReadKey();
            Console.WriteLine($"{trainer.name}: {trainer.defeatMessage}"); Console.ReadKey();

            foreach (Pokemon pokemon in player.party)
            {
                if (pokemon.name == "Ditto")
                {
                    pokemon.type    = "normal";
                    pokemon.move[0] = transform;
                    pokemon.move[1] = transform;
                    pokemon.move[0].currentPowerPoints = 10;
                    pokemon.move[1].currentPowerPoints = 10;
                    pokemon.attackStat  = 3;
                    pokemon.defenseStat = 2;
                    pokemon.speedStat   = 3;
                    pokemon.hpStat      = 2;
                }

                pokemon.hpMod          = 0;
                pokemon.attackMod      = 0;
                pokemon.defenseMod     = 0;
                pokemon.speedMod       = 0;
                pokemon.accuracyMod    = 0;
                pokemon.critMod        = 1;
                pokemon.didParticipate = false;
                pokemon.isFlinching    = false;
                pokemon.gripCounter    = 0;
                if (pokemon.level >= pokemon.evolvesAt && pokemon.id != 0)
                {
                    pokemon.WriteName(); Console.Write(" evolved into a "); Methods.WriteType(pokemon.evolvesTo, pokemon.type); Console.WriteLine("!");
                    pokemon.hasEvolved = true;
                    Console.ReadKey();
                }
            }
            return(true);

PartyFainted:
            Console.WriteLine($"{player.name} has no more usable Pokémon!"); Console.ReadKey();
            Console.WriteLine($"{player.name} whited out!");
            return(false);
        }
        static void Main(string[] args)
        {
            bool   shouldExit = false;
            string currentCommandOne;
            string path = @"C:\PokemonTextAdventure";

            if (!File.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            Dictionary <string, Pokemon>  pokedex     = new Dictionary <string, Pokemon>();
            Dictionary <string, Move>     movedex     = new Dictionary <string, Move>();
            Dictionary <int, Trainer>     trainerdex  = new Dictionary <int, Trainer>();
            Dictionary <string, Location> locationdex = new Dictionary <string, Location>();
            Player player = new Player();

            Methods.Populate(ref movedex, ref pokedex);
            Methods.Populate(ref trainerdex, pokedex);

            Console.WriteLine("                                  ,'\\");
            Console.WriteLine("    _.----.        ____         ,'  _\\   ___    ___     ____");
            Console.WriteLine("_,-'       `.     |    |  /`.   \\,-'    |   \\  /   |   |    \\  |`.");
            Console.WriteLine("\\      __    \\    '-.  | /   `.  ___    |    \\/    |   '-.   \\ |  |");
            Console.WriteLine(" \\.    \\ \\   |  __  |  |/    ,','_  `.  |          | __  |    \\|  |");
            Console.WriteLine("   \\    \\/   /,' _`.|      ,' / / / /   |          ,' _`.|     |  |");
            Console.WriteLine("    \\     ,-'/  /   \\    ,'   | \\/ / ,`.|         /  /   \\  |     |");
            Console.WriteLine("     \\    \\ |   \\_/  |   `-.  \\    `'  /|  |    ||   \\_/  | |\\    |");
            Console.WriteLine("      \\    \\ \\      /       `-.`.___,-' |  |\\  /| \\      /  | |   |");
            Console.WriteLine("       \\    \\ `.__,'|  |`-._    `|      |__| \\/ |  `.__,'|  | |   |");
            Console.WriteLine("        \\_.-'       |__|    `-._ |              '-.|     '-.| |   |");
            Console.WriteLine("                                `'                            ' -._|");
            Console.WriteLine("                     R E D / B L U E   D E M A K E");
            Console.WriteLine("                          by Daniel Sampson");
            Console.WriteLine("\n                      (press enter to continue)");
            Console.ReadLine();

            Console.WriteLine("To start a new save, enter 'n'. To load a previous one, enter 'l'.");
            currentCommandOne = Console.ReadLine();
            if (currentCommandOne == "debug")
            {
                player.party[0] = new Pokemon("Scyther", 50, pokedex);
                player.party[1] = new Pokemon("Missingno", 50, pokedex);
                player.party[2] = new Pokemon("Missingno", pokedex);
                Methods.WildBattle(ref player, new Pokemon("Mewtwo", 30, pokedex), movedex["Struggle"]);
                Console.ReadLine();
            }

            if (currentCommandOne == "l")
            {
                bool shouldRun = true;
                while (shouldRun == true)
                {
                    Console.WriteLine("Enter the name you used for your save file.");
                    currentCommandOne = Console.ReadLine().ToLower();
                    path = path + "/" + currentCommandOne + ".txt";
                    if (File.Exists(path))
                    {
                        shouldRun = false;
                        string[] substrings = File.ReadAllText(path).Split(new string[] { "&&&" }, StringSplitOptions.None);
                        player             = JsonConvert.DeserializeObject <Player>(substrings[0]);
                        locationdex        = JsonConvert.DeserializeObject <Dictionary <string, Location> >(substrings[1]);
                        player.gameRunning = true;
                        Console.WriteLine("Game loaded!");
                        Console.ReadKey();
                        Console.Clear();
                        Console.WriteLine(player.currentLocation.name.ToUpper());
                        Console.WriteLine("-------------------------------------------------------\n");
                        Console.WriteLine(player.currentLocation.description);
                    }
                    else
                    {
                        Console.WriteLine("That name was not recognized. Check your spelling and try again.");
                    }
                }
            }

            if (currentCommandOne == "n")
            {
                Console.WriteLine("OAK: Hello there! Welcome to the world of Pokémon! My name is Professor Oak."); Console.ReadLine();
                Console.WriteLine("OAK: This world is inhabited by creatures called Pokémon! For some people, Pokémon are pets. Others use them for fights. \nMyself... I study Pokémon as a profession.\n"); Console.ReadLine();
                Console.WriteLine("First, what is your name?");

                player.name = Console.ReadLine();
                if (player.name == "")
                {
                    player.name = "Red";
                }
                path = path + "/" + player.name.ToLower() + ".txt";
                var fileCreate = File.Create(path);
                fileCreate.Close();

                Console.WriteLine($"\nWelcome, {player.name}!");
                Console.WriteLine("I'll give you a Pokémon to start you on your journey."); Console.ReadLine();
                Console.Write("Would you like ");
                Methods.WriteType("Bulbasaur", "grass");
                Console.Write(", a grass-type Pokémon, ");
                Methods.WriteType("Charmander", "fire");
                Console.Write(", a fire-type Pokémon, or ");
                Methods.WriteType("Squirtle", "water");
                Console.WriteLine(", a water-type Pokémon?");

                string bluesStarter     = "";
                string bluesStarterType = "";
                while (shouldExit == false)
                {
                    currentCommandOne = Console.ReadLine();


                    switch (currentCommandOne.ToLower())
                    {
                    case "squirtle":
                    case "s":
                        player.party[0] = new Pokemon("Squirtle", 5, pokedex);
                        Methods.WriteType("Squirtle", "water"); Console.WriteLine("! A fine choice!");
                        bluesStarter     = "Bulbasaur";
                        bluesStarterType = "grass";
                        shouldExit       = true;
                        break;

                    case "charmander":
                    case "c":
                        player.party[0] = new Pokemon("Charmander", 5, pokedex);
                        Methods.WriteType("Charmander", "fire"); Console.WriteLine("! A fine choice!");
                        bluesStarter     = "Squirtle";
                        bluesStarterType = "water";
                        shouldExit       = true;
                        break;

                    case "bulbasaur":
                    case "b":
                        player.party[0] = new Pokemon("Bulbasaur", 5, pokedex);
                        Methods.WriteType("Bulbasaur", "grass"); Console.WriteLine("! A fine choice!");
                        bluesStarter     = "Charmander";
                        bluesStarterType = "fire";
                        shouldExit       = true;
                        break;

                    default:
                        Console.WriteLine("I'm sorry, I didn't understand that. Could you tell me again?");
                        break;
                    }
                }
                Console.WriteLine("OAK: Oh! Here's Blue, my grandson! He's been your rival since you were a baby."); Console.ReadLine();
                Console.WriteLine("BLUE: What about me, Gramps?"); Console.ReadLine();
                Console.WriteLine("OAK: Be patient! You can have one!"); Console.ReadLine();
                Console.Write("BLUE: I'll choose "); Methods.WriteType(bluesStarter, bluesStarterType); Console.WriteLine(", then!");
                trainerdex[1].trainerParty[2] = new Pokemon(bluesStarter, 5, pokedex);
                player.party[1] = new Pokemon("Missingno", pokedex);
                player.party[2] = new Pokemon("Missingno", pokedex);
                if (!Methods.TrainerBattle(ref player, trainerdex[1], movedex["Struggle"]))
                {
                    Console.WriteLine("BLUE: Yeah! Am I great or what?");
                    player.party[0].Heal();
                    Console.ReadKey();
                }
                Console.WriteLine($"I'll make my Pokémon battle to level it up! Smell ya later, {player.name}, Gramps!"); Console.ReadKey();
                Console.WriteLine("OAK: That kid... Anyway, good luck on your adventure! Try training on Route 1!"); Console.ReadKey();
                Methods.Populate(ref locationdex, trainerdex);
                player.currentLocation  = locationdex["palletTown"];
                player.previousLocation = locationdex["palletTown"];
                player.gameRunning      = true;

                using (StreamWriter sw = new StreamWriter(path))
                {
                    sw.Write(JsonConvert.SerializeObject(player));
                    sw.Write("&&&");
                    sw.Write(JsonConvert.SerializeObject(locationdex));
                }
                Console.Clear();
                Console.WriteLine(player.currentLocation.name.ToUpper());
                Console.WriteLine("-------------------------------------------------------\n");
                Console.WriteLine(player.currentLocation.description);
            }

            while (player.gameRunning)
            {
                string currentCommand = "";
                currentCommand = Console.ReadLine();
                Methods.DoAction(currentCommand, ref player, player.currentLocation, ref locationdex, pokedex, movedex);
            }
            using (StreamWriter sw = new StreamWriter(path))
            {
                Console.WriteLine("Saving...");
                sw.Write(JsonConvert.SerializeObject(player));
                sw.Write("&&&");
                sw.Write(JsonConvert.SerializeObject(locationdex));
                Console.WriteLine("Saved. Quitting now.");
                Console.ReadKey();
            }
        }