Пример #1
0
        public static void Gen4Shiny(this PKM pkm, Shiny shinyType)
        {
            if (pkm.GenNumber == 3)
            {
                if (pkm.Met_Location == 55 && pkm.Ball == 4)
                {
                    pkm.SetPIDGender(pkm.Gender);
                    CommonEdits.SetShiny(pkm, shinyType);
                    return;
                }
                Gen3Shiny(pkm, shinyType);
                return;
            }

            RNG     rng  = RNG.LCRNG;
            PIDType type = PIDType.Method_1;

            if (pkm.Met_Location == 233)
            {
                type = PIDType.Pokewalker;
            }

            IEnumerable <uint> seeds;

            do
            {
                pkm.SetPIDGender(pkm.Gender);
                CommonEdits.SetShiny(pkm, shinyType);
                seeds = GetSeedsFromPID(pkm.PID, rng);
            } while (!pkm.IsShiny || seeds == null);

            PIDGenerator.SetValuesFromSeed(pkm, type, seeds.ElementAt(0));
        }
Пример #2
0
        public static void Gen345Shiny(this PKM pkm, Shiny type)
        {
            bool flag = pkm.IsEgg || pkm.WasEgg || pkm.Met_Level <= 1;

            if (flag)
            {
                pkm.SetPIDGender(pkm.Gender);
                CommonEdits.SetShiny(pkm, type);
                return;
            }

            if (pkm.Format == 3)
            {
                pkm.Gen3Shiny(type);
            }
            if (pkm.Format == 4)
            {
                pkm.Gen4Shiny(type);
            }
            if (pkm.Format == 5)
            {
                pkm.Gen5Shiny(type);
            }

            SetBasicData(pkm);
        }
Пример #3
0
 public static void ModifyPKM(PKM pkm)
 {
     // Make everything Bulbasaur!
     pkm.Species  = (int)Species.Bulbasaur;
     pkm.Move1    = 1; // pound
     pkm.Move1_PP = 40;
     CommonEdits.SetShiny(pkm);
 }
Пример #4
0
        public static void Gen3Shiny(this PKM pkm, Shiny shinyType)
        {
            RNG     rng  = RNG.LCRNG;
            PIDType type = PIDType.Method_1;

            if (pkm.Species == 201)
            {
                type = PIDType.Method_1_Unown;
            }

            IEnumerable <uint> seeds;

            do
            {
                pkm.SetPIDGender(pkm.Gender);
                CommonEdits.SetShiny(pkm, shinyType);
                seeds = GetSeedsFromPID(pkm.PID, rng);
            } while (!pkm.IsShiny || seeds == null);

            PIDGenerator.SetValuesFromSeed(pkm, type, seeds.ElementAt(0));
        }
Пример #5
0
        public async Task EggRollAsync()
        {
            if (!Info.Hub.Config.Trade.EggRollChannels.Contains(Context.Channel.Id.ToString()) && !Info.Hub.Config.Trade.EggRollChannels.Equals(""))
            {
                await ReplyAsync($"You're typing the command in the wrong channel!").ConfigureAwait(false);

                return;
            }

            if (Info.Hub.Config.Trade.EggRollCooldown < 0)
            {
                Info.Hub.Config.Trade.EggRollCooldown = default;
            }

            var id   = Context.User.Id.ToString();
            var line = TradeExtensions.EggRollCooldown.FirstOrDefault(z => z.Contains(id));

            System.DateTime.TryParse(line != null ? line.Split(',')[1] : string.Empty, out System.DateTime time);
            var timer         = time.AddHours(Info.Hub.Config.Trade.EggRollCooldown);
            var timeRemaining = timer - System.DateTime.Now;

            if (System.DateTime.Now < timer)
            {
                await ReplyAsync($"{Context.User.Mention}, please try again in {timeRemaining.Hours:N0}h : {timeRemaining.Minutes:N0}m : {timeRemaining.Seconds:N0}s!").ConfigureAwait(false);

                return;
            }

            var code       = Info.GetRandomTradeCode();
            var rng        = new System.Random();
            int shinyRng   = rng.Next(0, TradeExtensions.shinyOdds.Length);
            int abilityRng = rng.Next(0, TradeExtensions.abilityIndex.Length);
            var set        = new ShowdownSet($"Egg({SpeciesName.GetSpeciesName((int)TradeExtensions.validEgg.GetValue(rng.Next(0, TradeExtensions.validEgg.Length)), 2)})");
            var template   = AutoLegalityWrapper.GetTemplate(set);
            var sav        = AutoLegalityWrapper.GetTrainerInfo(8);
            var pkm        = (PK8)sav.GetLegal(template, out _);

            if (TradeExtensions.regional.ToList().Contains(pkm.Species))
            {
                int formRng  = rng.Next(0, TradeExtensions.formIndex1.Length);
                int formRng2 = rng.Next(0, TradeExtensions.formIndex2.Length);

                if (pkm.Species != 52)
                {
                    pkm.SetAltForm(TradeExtensions.formIndex1[formRng]);
                }
                else
                {
                    pkm.SetAltForm(TradeExtensions.formIndex2[formRng2]);
                }

                if (pkm.AltForm != 0)
                {
                    switch (pkm.Species)
                    {
                    case 27: pkm.RelearnMove3 = 10; break;

                    case 37: pkm.RelearnMove4 = 39; break;

                    case 52: pkm.RelearnMove2 = 252; pkm.RelearnMove3 = 45; break;

                    case 83: pkm.RelearnMove1 = 64; pkm.RelearnMove4 = 28; break;

                    case 222: pkm.RelearnMove1 = 33; break;

                    case 263: pkm.RelearnMove2 = 43; pkm.RelearnMove3 = 0; pkm.RelearnMove4 = 0; break;
                    }
                    ;
                }
            }

            TradeExtensions.EggTrade(pkm);
            pkm.Nature     = rng.Next(0, 24);
            pkm.StatNature = pkm.Nature;
            pkm.SetAbilityIndex(TradeExtensions.abilityIndex[abilityRng]);
            pkm.IVs = pkm.SetRandomIVs(3);
            BallApplicator.ApplyBallLegalRandom(pkm);

            switch (TradeExtensions.shinyOdds[shinyRng])
            {
            case 3: CommonEdits.SetShiny(pkm, Shiny.Never); pkm.SetUnshiny(); break;

            case 5: CommonEdits.SetShiny(pkm, Shiny.AlwaysStar); break;

            case 6: CommonEdits.SetShiny(pkm, Shiny.AlwaysSquare); break;
            }
            ;

            var la      = new LegalityAnalysis(pkm);
            var spec    = GameInfo.Strings.Species[template.Species];
            var invalid = !(pkm is PK8) || (!la.Valid && SysCordInstance.Self.Hub.Config.Legality.VerifyLegality);

            if (invalid)
            {
                var imsg = $"Oops! I scrambled your egg! Don't tell Ramsay! Here's my best attempt for that {spec}!";
                await Context.Channel.SendPKMAsync(pkm, imsg).ConfigureAwait(false);

                return;
            }

            pkm.ResetPartyStats();
            var sudo = Context.User.GetIsSudo();
            await Context.AddToQueueAsync(code, Context.User.Username, sudo, pkm, PokeRoutineType.EggRoll, PokeTradeType.EggRoll).ConfigureAwait(false);
        }
Пример #6
0
        private static void LanRollTrade(PK8 pkm)
        {
            int[] regional = { 26,   27,  28,  37,  38,  50,  51,  52,  53,  77,  78,  79,  80, 83, 103,
                               105, 110, 122, 144, 145, 146, 199, 222, 263, 264, 554, 555, 562, 618 };

            int[] shinyOdds = { 3, 3, 3, 3, 3, 5, 5, 5, 5, 5,
                                5, 5, 5, 5, 5, 6, 6, 6, 6, 6 };

            int[] formIndex1 = { 0, 1 };
            int[] formIndex2 = { 0, 1, 2 };

            var rng      = new System.Random();
            int shinyRng = rng.Next(0, shinyOdds.Length);

            if (regional.ToList().Contains(pkm.Species)) // Randomize Regional Form
            {
                int formRng  = rng.Next(0, formIndex1.Length);
                int formRng2 = rng.Next(0, formIndex2.Length);

                if (pkm.Species != 52) // Checks for Meowth because he's got 2 regional forms
                {
                    pkm.SetAltForm(formIndex1[formRng]);
                }
                else
                {
                    pkm.SetAltForm(formIndex2[formRng2]);
                }
            }

            pkm.Nature     = rng.Next(0, 24);
            pkm.StatNature = pkm.Nature;
            pkm.IVs        = pkm.SetRandomIVs(4);

            int randomBall = rng.Next(0, pkm.MaxBallID);

            pkm.Ball = randomBall;

            // Source: https://bulbapedia.bulbagarden.net/wiki/Ability#List_of_Abilities
            // https://game8.co/games/pokemon-sword-shield/archives/271828 to see if it exists in the game.
            int[] vaildAbilities =
            { 1,         2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  17,  18,  19, 20, 21, 22,
              23,   24,  25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  41, 42,
              43,   44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  60,  61, 62,
              63,   64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  75,  77,  78,  79,  80,  81,  82, 83,
              84,   85,  86,  87,  88,  89,  91,  92,  93,  94,  95,  97,  98,  99, 100, 101, 102, 103,
              104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
              119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
              135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
              151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
              166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 180, 181, 182,
              183, 186, 187, 188, 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, 203,
              204, 205, 207, 208, 209, 211, 212, 214, 215, 217, 218, 220, 221, 222, 224,
              225, 226, 227, 228, 229, 230, 231, 232, 234, 235, 236, 237, 238, 239, 240,
              241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
              256, 257, 258, 259, 260, 261, 262, 263, 264, 265 };     // 266/267 (As One) is not on here because it's meh...

            int abilityNum = rng.Next(0, vaildAbilities.Length);

            pkm.Ability = vaildAbilities[abilityNum];

            // Source: https://bulbapedia.bulbagarden.net/wiki/List_of_moves
            int[] invalidMoves =
            { 2,         3,   4,  13,  26,  27,  41,  49,  82,  96,  99, 112, 117, 119, 121, 125, 128, 131,
              132, 134, 140, 145, 146, 148, 149, 159, 169, 171, 185, 193, 216, 218, 222,
              228, 237, 265, 274, 287, 289, 290, 293, 300, 301, 302, 316, 318, 320, 324,
              327, 346, 357, 358, 363, 373, 376, 377, 378, 381, 382, 386, 426, 429, 431,
              443, 445, 456, 466, 477, 481, 485, 498, 507, 516, 531, 537, 563, 569, 622,
              623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637,
              638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652,
              653, 654, 655, 656, 657, 658, 695, 696, 697, 698, 699, 700, 701, 702, 703,
              717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731,
              732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 757, 758, 759,
              760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774 };

            int moveRng1 = rng.Next(0, pkm.MaxMoveID);
            int moveRng2 = rng.Next(0, pkm.MaxMoveID);
            int moveRng3 = rng.Next(0, pkm.MaxMoveID);
            int moveRng4 = rng.Next(0, pkm.MaxMoveID);

            while (invalidMoves.ToList().Contains(moveRng1)) // Keeps selecting moves until it picks one that exists in Sword and Shield
            {
                moveRng1 = rng.Next(0, pkm.MaxMoveID);
            }

            while (invalidMoves.ToList().Contains(moveRng2) || moveRng1 == moveRng2) // the OR operand is for duplicate moves
            {
                moveRng2 = rng.Next(0, pkm.MaxMoveID);
            }

            while (invalidMoves.ToList().Contains(moveRng3) || moveRng1 == moveRng3 || moveRng2 == moveRng3)
            {
                moveRng3 = rng.Next(0, pkm.MaxMoveID);
            }

            while (invalidMoves.ToList().Contains(moveRng4) || moveRng1 == moveRng4 || moveRng2 == moveRng4 || moveRng3 == moveRng4)
            {
                moveRng4 = rng.Next(0, pkm.MaxMoveID);
            }

            pkm.Move1 = moveRng1;
            pkm.Move2 = moveRng2;
            pkm.Move3 = moveRng3;
            pkm.Move4 = moveRng4;
            MoveApplicator.SetMaximumPPCurrent(pkm);

            pkm.HeldItem = rng.Next(1, pkm.MaxItemID);       // random held item
            while (!ItemRestrictions.IsHeldItemAllowed(pkm)) // checks for non-existing items
            {
                pkm.HeldItem = rng.Next(1, pkm.MaxItemID);
            }

            pkm.CurrentLevel   = rng.Next(1, 101);
            pkm.IsEgg          = true;
            pkm.Egg_Location   = 60002;
            pkm.EggMetDate     = System.DateTime.Now.Date;
            pkm.DynamaxLevel   = 0;
            pkm.Met_Level      = 1;
            pkm.Met_Location   = 0;
            pkm.MetDate        = System.DateTime.Now.Date;
            pkm.CurrentHandler = 0;
            pkm.OT_Friendship  = 1;
            pkm.HT_Name        = "";
            pkm.HT_Friendship  = 0;
            pkm.HT_Language    = 0;
            pkm.HT_Gender      = 0;
            pkm.HT_Memory      = 0;
            pkm.HT_Feeling     = 0;
            pkm.HT_Intensity   = 0;
            pkm.EVs            = new int[] { 0, 0, 0, 0, 0, 0 };
            pkm.Markings       = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
            pkm.SetRibbon(rng.Next(53, 98), true); //ribbons 53-97 are marks

            switch (shinyOdds[shinyRng])
            {
            case 3: pkm.SetUnshiny(); break;

            case 5: CommonEdits.SetShiny(pkm, Shiny.AlwaysStar); break;

            case 6: CommonEdits.SetShiny(pkm, Shiny.AlwaysSquare); break;
            }
        }
Пример #7
0
        public async Task EggRaffleAsync()
        {
            if (!Info.Hub.Config.Trade.EggRaffle)
            {
                await ReplyAsync($"EggRaffle is currently disabled!").ConfigureAwait(false);

                return;
            }
            else if (!Info.Hub.Config.Trade.EggRaffleChannels.Contains(Context.Channel.Id.ToString()) && !Info.Hub.Config.Trade.EggRaffleChannels.Equals(""))
            {
                await ReplyAsync($"You're typing the command in the wrong channel!").ConfigureAwait(false);

                return;
            }

            if (Info.Hub.Config.Trade.EggRaffleCooldown < 0)
            {
                Info.Hub.Config.Trade.EggRaffleCooldown = default;
            }

            if (!System.IO.File.Exists("EggRngBlacklist.txt"))
            {
                System.IO.File.Create("EggRngBlacklist.txt").Close();
            }

            System.IO.StreamReader reader = new System.IO.StreamReader("EggRngBlacklist.txt");
            var content = reader.ReadToEnd();

            reader.Close();

            var id    = $"{Context.Message.Author.Id}";
            var parse = System.Text.RegularExpressions.Regex.Match(content, @"(" + id + @") - (\S*\ \S*\ \w*)", System.Text.RegularExpressions.RegexOptions.Multiline);

            if (content.Contains($"{Context.Message.Author.Id}"))
            {
                var timer         = System.DateTime.Parse(parse.Groups[2].Value).AddHours(Info.Hub.Config.Trade.EggRaffleCooldown);
                var timeremaining = timer - System.DateTime.Now;
                if (System.DateTime.Now >= timer)
                {
                    content = content.Replace(parse.Groups[0].Value, $"{id} - {System.DateTime.Now}").TrimEnd();
                    System.IO.StreamWriter writer = new System.IO.StreamWriter("EggRngBlacklist.txt");
                    writer.WriteLine(content);
                    writer.Close();
                }
                else
                {
                    await ReplyAsync($"{Context.User.Mention}, please try again in {timeremaining.Hours:N0}h : {timeremaining.Minutes:N0}m : {timeremaining.Seconds:N0}s!").ConfigureAwait(false);

                    return;
                }
            }
            else
            {
                System.IO.File.AppendAllText("EggRngBlacklist.txt", $"{Context.Message.Author.Id} - {System.DateTime.Now}{System.Environment.NewLine}");
            }

            var code = Info.GetRandomTradeCode();

            int[] validEgg = { 1,     4,   7,  10,  27,  37,  43,  50,  52,  54,  58,  60,  63,  66,  72,
                               77,   79,  81,  83,  90,  92,  95,  98, 102, 104, 108, 109, 111, 114, 115,
                               116, 118, 120, 122, 123, 127, 128, 129, 131, 133, 137, 163, 170, 172, 173,
                               174, 175, 177, 194, 206, 211, 213, 214, 215, 220, 222, 223, 225, 227, 236,
                               241, 246, 263, 270, 273, 278, 280, 290, 293, 298, 302, 303, 309, 318, 320,
                               324, 328, 337, 338, 339, 341, 343, 349, 355, 360, 361, 403, 406, 415, 420,
                               422, 425, 427, 434, 436, 438, 439, 440, 446, 447, 449, 451, 453, 458, 459,
                               479, 506, 509, 517, 519, 524, 527, 529, 532, 535, 538, 539, 543, 546, 548,
                               550, 551, 554, 556, 557, 559, 561, 562, 568, 570, 572, 574, 577, 582, 587,
                               588, 590, 592, 595, 597, 599, 605, 606, 607, 610, 613, 616, 618, 619, 621,
                               622, 624, 626, 627, 629, 631, 632, 633, 636, 659, 661, 674, 677, 679, 682,
                               684, 686, 688, 690, 692, 694, 701, 702, 704, 707, 708, 710, 712, 714, 722,
                               725, 728, 736, 742, 744, 746, 747, 749, 751, 753, 755, 757, 759, 761, 764,
                               765, 766, 767, 769, 771, 776, 777, 778, 780, 781, 782, 810, 813, 816, 819,
                               821, 824, 827, 829, 831, 833, 835, 837, 840, 843, 845, 846, 848, 850, 852,
                               854, 856, 859, 868, 870, 871, 872, 874, 875, 876, 877, 878, 884, 885 };

            int[] regional = { 27, 37, 50, 52, 77, 79, 83, 122, 222, 263, 554, 562, 618 };

            int[] shinyOdds = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
                                3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
                                3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
                                5, 5, 5, 5, 5, 5, 5, 6, 6, 6 };

            int[] abilityIndex = { 0, 1, 2 };
            int[] formIndex1   = { 0, 1 };
            int[] formIndex2   = { 0, 1, 2 };

            var rng        = new System.Random();
            int shinyRng   = rng.Next(0, shinyOdds.Length);
            int abilityRng = rng.Next(0, abilityIndex.Length);
            var set        = new ShowdownSet($"Egg({SpeciesName.GetSpeciesName(rng.Next(new Zukan8Index(Zukan8Type.None, 1).Index, GameUtil.GetMaxSpeciesID(GameVersion.SWSH)), 2)})");

            while (!validEgg.ToList().Contains(set.Species))
            {
                set = new ShowdownSet($"Egg({SpeciesName.GetSpeciesName(rng.Next(new Zukan8Index(Zukan8Type.None, 1).Index, GameUtil.GetMaxSpeciesID(GameVersion.SWSH)), 2)})");
            }

            var template = AutoLegalityWrapper.GetTemplate(set);
            var sav      = AutoLegalityWrapper.GetTrainerInfo(8);
            var pkm      = (PK8)sav.GetLegal(template, out _);

            if (regional.ToList().Contains(pkm.Species))
            {
                int formRng  = rng.Next(0, formIndex1.Length);
                int formRng2 = rng.Next(0, formIndex2.Length);

                if (pkm.Species != 52)
                {
                    pkm.SetAltForm(formIndex1[formRng]);
                }
                else
                {
                    pkm.SetAltForm(formIndex2[formRng2]);
                }

                if (pkm.AltForm != 0)
                {
                    if (pkm.Species == 27)
                    {
                        pkm.RelearnMove3 = 10;
                    }
                    else if (pkm.Species == 37)
                    {
                        pkm.RelearnMove4 = 39;
                    }
                    else if (pkm.Species == 52)
                    {
                        pkm.RelearnMove2 = 252;
                        pkm.RelearnMove3 = 45;
                    }
                    else if (pkm.Species == 83)
                    {
                        pkm.RelearnMove1 = 64;
                        pkm.RelearnMove4 = 28;
                    }
                    else if (pkm.Species == 222)
                    {
                        pkm.RelearnMove1 = 33;
                    }
                    else if (pkm.Species == 263)
                    {
                        pkm.RelearnMove2 = 43;
                        pkm.RelearnMove3 = 0;
                        pkm.RelearnMove4 = 0;
                    }
                }
            }

            EggTrade(pkm);
            pkm.Nature     = rng.Next(0, 24);
            pkm.StatNature = pkm.Nature;
            pkm.SetAbilityIndex(abilityIndex[abilityRng]);
            pkm.IVs = pkm.SetRandomIVs(3);
            BallApplicator.ApplyBallLegalRandom(pkm);

            if (shinyOdds[shinyRng] == 3)
            {
                CommonEdits.SetShiny(pkm, Shiny.Never);
                pkm.SetUnshiny();
            }
            else if (shinyOdds[shinyRng] == 5)
            {
                CommonEdits.SetShiny(pkm, Shiny.AlwaysStar);
            }
            else
            {
                CommonEdits.SetShiny(pkm, Shiny.AlwaysSquare);
            }

            var la      = new LegalityAnalysis(pkm);
            var spec    = GameInfo.Strings.Species[template.Species];
            var invalid = !(pkm is PK8) || (!la.Valid && SysCordInstance.Self.Hub.Config.Legality.VerifyLegality);

            if (invalid)
            {
                var imsg = $"Oops! I scrambled your egg! Don't tell Ramsay! Here's my best attempt for that {spec}!";
                await Context.Channel.SendPKMAsync(pkm, imsg).ConfigureAwait(false);

                return;
            }

            pkm.ResetPartyStats();
            var sudo = Context.User.GetIsSudo();

            await AddTradeToQueueAsync(code, Context.User.Username, pkm, sudo).ConfigureAwait(false);
        }
Пример #8
0
 public static void Gen678Shiny(this PKM pkm, Shiny type)
 {
     pkm.SetPIDGender(pkm.Gender);
     CommonEdits.SetShiny(pkm, type);
     pkm.SetRandomEC();
 }
Пример #9
0
        public void AddToBoxesButtonClick(Object sender, EventArgs events)
        {
            var        sav          = SaveFileEditor.SAV;                                        // current save
            int        generation   = sav.Generation;                                            // the generation of the current save -- used to determine the PK save format
            List <PKM> pokemonList  = new List <PKM>();                                          // list of all Pokemon that will be added to the sav
            string     showdownData = this.input.Text;                                           // user's input

            var pokemonArray = JsonConvert.DeserializeObject <List <RawPokemon> >(showdownData); //jsonify the data

            foreach (RawPokemon rawPokemon in pokemonArray)
            {
                PKM pokemon = new PK2();

                //Determine save format
                switch (generation)
                {
                case 1:
                    pokemon = new PK1();
                    break;

                case 2:
                    pokemon = new PK2();
                    break;

                case 3:
                    pokemon = new PK3();
                    break;

                case 4:
                    pokemon = new PK4();
                    break;

                case 5:
                    pokemon = new PK5();
                    break;

                case 6:
                    pokemon = new PK6();
                    break;

                case 7:
                    pokemon = new PK7();
                    break;

                case 8:
                    pokemon = new PK8();
                    break;
                }

                // Set the species according to the Species enum
                int speciesAsNumber = 0;

                //Check if the Pokemon is Alolan or not; if it is, do some extra logic to set the proper form
                if (rawPokemon.Species.Contains("Alolan"))
                {
                    string[] pokemon_name = rawPokemon.Species.Split('_');
                    speciesAsNumber = (int)(Species)Enum.Parse(typeof(Species), pokemon_name[1]);
                    pokemon.SetForm(810);
                    pokemon.Species = speciesAsNumber;
                }
                else
                {
                    speciesAsNumber = (int)(Species)Enum.Parse(typeof(Species), rawPokemon.Species);
                    pokemon.Species = speciesAsNumber;
                }

                // Check to see if the Pokemon has forms (i.e. Flabebe, Shellos, etc.), and if it does, randomly generate one
                if (rawPokemon.Species.Contains("Burmy"))
                {
                    int form = random.Next(0, burmyForms.Length - 1);
                    pokemon.SetForm(form);
                }
                else if (rawPokemon.Species.Contains("Shellos"))
                {
                    int form = random.Next(0, shellosForms.Length - 1);
                    pokemon.SetForm(form);
                }
                else if (rawPokemon.Species.Contains("Scatterbug"))
                {
                    int form = random.Next(0, scatterbugForms.Length - 1);
                    pokemon.SetForm(form);
                }
                else if (rawPokemon.Species.Contains("Flabébé"))
                {
                    int form = random.Next(0, flabebeForms.Length - 1);
                    pokemon.SetForm(form);
                }
                else if (rawPokemon.Species.Contains("Oricorio"))
                {
                    int form = random.Next(0, oricorioForms.Length - 1);
                    pokemon.SetForm(form);
                }
                else if (rawPokemon.Species.Contains("Minior"))
                {
                    int form = random.Next(0, miniorForms.Length - 1);
                    pokemon.SetForm(form);
                }

                GameVersion  game         = (GameVersion)sav.Game;
                EncounterEgg encounterEgg = new EncounterEgg(speciesAsNumber, pokemon.Form, 1, sav.Generation, game);
                PKM          pokemonAsEgg = encounterEgg.ConvertToPKM(sav);
                pokemonAsEgg.IsEgg  = true;
                pokemon.IsNicknamed = true;
                pokemon.Nickname    = "Egg";

                // Set the ability
                string ability         = rawPokemon.Ability.Replace(" ", "");
                int    abilityAsNumber = (int)(Ability)Enum.Parse(typeof(Ability), ability);
                pokemonAsEgg.SetAbility(abilityAsNumber);

                //Set gender
                switch (rawPokemon.Gender)
                {
                case "M":
                    pokemonAsEgg.SetGender(0);
                    break;

                case "F":
                    pokemonAsEgg.SetGender(1);
                    break;

                case "N":
                    pokemonAsEgg.SetGender(2);
                    break;
                }

                // Set Nature via the Nature enum
                int natureAsNumber = (int)(Nature)Enum.Parse(typeof(Nature), rawPokemon.Nature);
                pokemonAsEgg.Nature = natureAsNumber;

                // Set the IVs
                pokemonAsEgg.IV_HP  = rawPokemon.HP;
                pokemonAsEgg.IV_ATK = rawPokemon.Atk;
                pokemonAsEgg.IV_DEF = rawPokemon.Def;
                pokemonAsEgg.IV_SPA = rawPokemon.SpA;
                pokemonAsEgg.IV_SPD = rawPokemon.SpD;
                pokemonAsEgg.IV_SPE = rawPokemon.Spe;

                // Set moves and make sure they have the proper PP
                string move = "";
                if (string.IsNullOrEmpty(rawPokemon.MoveOne) == false)
                {
                    move = rawPokemon.MoveOne.Replace("-", "");
                    move = move.Replace(" ", "");
                    pokemonAsEgg.Move1        = (int)(Move)Enum.Parse(typeof(Move), move);
                    pokemonAsEgg.RelearnMove1 = pokemonAsEgg.Move1;
                }
                if (string.IsNullOrEmpty(rawPokemon.MoveTwo) == false)
                {
                    move = rawPokemon.MoveTwo.Replace("-", "");
                    move = move.Replace(" ", "");
                    pokemonAsEgg.Move2        = (int)(Move)Enum.Parse(typeof(Move), move);
                    pokemonAsEgg.RelearnMove2 = pokemonAsEgg.Move2;
                }
                if (string.IsNullOrEmpty(rawPokemon.MoveThree) == false)
                {
                    move = rawPokemon.MoveThree.Replace("-", "");
                    move = move.Replace(" ", "");
                    pokemonAsEgg.Move3        = (int)(Move)Enum.Parse(typeof(Move), move);
                    pokemonAsEgg.RelearnMove3 = pokemonAsEgg.Move3;
                }
                if (string.IsNullOrEmpty(rawPokemon.MoveFour) == false)
                {
                    move = rawPokemon.MoveFour.Replace("-", "");
                    move = move.Replace(" ", "");
                    pokemonAsEgg.Move4        = (int)(Move)Enum.Parse(typeof(Move), move);
                    pokemonAsEgg.RelearnMove4 = pokemonAsEgg.Move4;
                }

                pokemonAsEgg.SetMaximumPPCurrent();

                //Finally, if the Pokemon is supposed to be shiny, make it so
                if (rawPokemon.IsShiny == "true")
                {
                    CommonEdits.SetShiny(pokemonAsEgg);
                }
                else
                {
                    CommonEdits.SetUnshiny(pokemonAsEgg);
                }

                pokemonAsEgg.Met_Location = 0;

                if (generation == 7 || generation == 6 || generation == 5)
                {
                    pokemonAsEgg.Egg_Location = Locations.Daycare5;
                }
                else
                {
                    pokemonAsEgg.Egg_Location = Locations.Daycare4;
                }

                pokemonAsEgg.IsNicknamed = true;
                pokemonAsEgg.Nickname    = SpeciesName.GetSpeciesNameGeneration(0, sav.Language, generation);

                //Hatch counter is for some reason called "CurrentFriendship".  Don't ask me why, I don't know.
                pokemonAsEgg.CurrentFriendship = 1;

                pokemonList.Add(pokemonAsEgg);
            }

            // Import Pokemon, reload the boxes so they can be seen, show a message and close the window
            sav.ImportPKMs(pokemonList);
            SaveFileEditor.ReloadSlots();
            MessageBox.Show("Done!");
            this.input.Clear();
            this.form.Close();
        }