Beispiel #1
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Randomizer Options tab.") != DialogResult.Yes)
            {
                return;
            }

            // Randomize by BST
            bool bst = CHK_BST.Checked;

            int[] sL = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, false,
                                                 CHK_L.Checked, CHK_E.Checked);
            int ctr = 0;

            for (int i = 0; i < LB_Encounters.Items.Count; i++)
            {
                LB_Encounters.SelectedIndex = i;

                int species = CB_Species.SelectedIndex;
                species = Randomizer.getRandomSpecies(ref sL, ref ctr, species, bst, Main.SpeciesStat);
                CB_Species.SelectedIndex = species;
                NUD_Form.Value           = Randomizer.GetRandomForme(species, false, true);
                NUD_Gender.Value         = 0; // random

                if (CHK_Level.Checked)
                {
                    NUD_Level.Value = Randomizer.getModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value);
                }
            }
            WinFormsUtil.Alert("Randomized all Static Encounters according to specification!");
        }
Beispiel #2
0
        private void B_Save_Click(object sender, EventArgs e)
        {
            RSTE.rPKM          = CHK_RandomPKM.Checked;
            RSTE.sL            = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_L.Checked, CHK_E.Checked, ModifierKeys == Keys.Control);
            RSTE.rSmart        = CHK_BST.Checked;
            RSTE.rLevel        = CHK_Level.Checked;
            RSTE.rLevelPercent = NUD_Level.Value;

            RSTE.rMove    = CHK_RandomMoves.Checked;
            RSTE.rItem    = CHK_RandomItems.Checked;
            RSTE.rAbility = CHK_RandomAbilities.Checked;
            RSTE.rDiffIV  = CHK_MaxDiffPKM.Checked;

            RSTE.rClass           = CHK_RandomClass.Checked;
            RSTE.rGift            = CHK_RandomGift.Checked;
            RSTE.rGiftPercent     = NUD_GiftPercent.Value;
            RSTE.rDiffAI          = CHK_MaxDiffAI.Checked;
            RSTE.rTypeTheme       = CHK_TypeTheme.Checked;
            RSTE.rTypeGymTrainers = CHK_GymTrainers.Checked;

            if (CHK_StoryMEvos.Checked)
            {
                RSTE.rEnsureMEvo = Main.oras ? (new int[] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 }) : (new int[] { 188, 263, 276, 277, 519, 520, 521, 526, 599, 600, 601 });
            }
            else
            {
                RSTE.rEnsureMEvo = new int[] { };
            }

            RSTE.rThemedClasses = new bool[trClass.Length];

            RSTE.rDoRand = true;
            Close();
        }
Beispiel #3
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            DialogResult ync = Util.Prompt(MessageBoxButtons.YesNoCancel,
                                           "Randomize by BST: Yes" + Environment.NewLine +
                                           "Randomize Randomly: No" + Environment.NewLine +
                                           "Abort: Cancel");

            if (ync != DialogResult.Yes && ync != DialogResult.No)
            {
                return;
            }
            if (ync == DialogResult.No)
            {
                for (int i = 0; i < LB_Gifts.Items.Count; i++)
                {
                    LB_Gifts.SelectedIndex = i;
                    if (CB_Species.SelectedIndex == 448)
                    {
                        continue; // skip Lucario, battle needs to mega evolve
                    }
                    int species = Util.rand.Next(1, 721);
                    CB_Species.SelectedIndex = species;
                }
                return;
            }

            // Randomize by BST
            int[] sL  = Randomizer.getSpeciesList(G1: true, G2: true, G3: true, G4: true, G5: true, G6: true, G7: false, L: false, E: false, Shedinja: false);
            int   ctr = 0;

            for (int i = 0; i < LB_Gifts.Items.Count; i++)
            {
                LB_Gifts.SelectedIndex = i;
                int species = CB_Species.SelectedIndex;
                if (species == 448)
                {
                    continue; // skip Lucario, battle needs to mega evolve
                }
                int bst   = Main.SpeciesStat[species].BST;
                int tries = 0;
                var pkm   = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
                while (!((pkm.BST * (5 - ++tries / Main.Config.MaxSpeciesID) / 6 < bst) && pkm.BST * (6 + ++tries / Main.Config.MaxSpeciesID) / 5 > bst))
                {
                    pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
                }

                CB_Species.SelectedIndex = species;
            }
        }
Beispiel #4
0
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            bool blind = DialogResult.Yes ==
                         WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Hide randomization, save, and close?",
                                             "If you want the Starters to be a surprise :)");

            if (blind)
            {
                Hide();
            }

            // Iterate for each group of Starters
            for (int i = 0; i < Count; i++)
            {
                // Get Species List
                int   gen = int.Parse(Labels[i].Text[4] + "");
                int[] sL  = CHK_Gen.Checked
                    ? Randomizer.getSpeciesList(gen == 1, gen == 2, gen == 3, gen == 4, gen == 5, gen == 6, false, false, false)
                    : Randomizer.getSpeciesList(true, true, true, true, true, true, false, false, false);
                int ctr = 0;
                // Assign Species
                for (int j = 0; j < 3; j++)
                {
                    int species = Randomizer.getRandomSpecies(ref sL, ref ctr);

                    if (CHK_BST.Checked) // Enforce BST
                    {
                        int          oldSpecies = BitConverter.ToUInt16(Data, offset + (i * 3 + j) * 0x54);
                        PersonalInfo oldpkm     = Main.SpeciesStat[oldSpecies]; // Use original species cuz why not.
                        PersonalInfo pkm        = Main.SpeciesStat[species];

                        while (!(pkm.BST * 5 / 6 < oldpkm.BST && pkm.BST * 6 / 5 > oldpkm.BST))
                        {
                            species = Randomizer.getRandomSpecies(ref sL, ref ctr); pkm = Main.SpeciesStat[species];
                        }
                    }

                    Choices[i][j].SelectedIndex = species;
                }
            }

            if (blind)
            {
                saveData();
                Close();
            }
        }
 // Randomization
 private int[] getRandomSpeciesList()
 {
     return(Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_G7.Checked,
                                      CHK_L.Checked, CHK_E.Checked));
 }
Beispiel #6
0
        // Randomization
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            if (Util.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings @ Horde Tab.") != DialogResult.Yes)
            {
                return;
            }

            Enabled = false;

            // Calculate % diff we will apply to each level
            decimal leveldiff = (100 + NUD_LevelAmp.Value) / 100;

            // Nonrepeating List Start
            int[] sL = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked,
                                                 CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_L.Checked, CHK_E.Checked);

            int ctr = 0;

            int[] slotArray = Enumerable.Range(0, max.Length).Select(a => a).ToArray();

            for (int i = 0; i < CB_LocationID.Items.Count; i++) // for every location
            {
                CB_LocationID.SelectedIndex = i;
                if (!hasData())
                {
                    continue;             // Don't randomize if doesn't have data.
                }
                // Assign Levels
                if (CHK_Level.Checked)
                {
                    for (int l = 0; l < max.Length; l++)
                    {
                        min[l].Value = max[l].Value = (max[l].Value <= 1) ? max[l].Value : Math.Max(1, Math.Min(100, (int)((leveldiff) * max[l].Value)));
                    }
                }

                // Get a new list of Pokemon so that DexNav does not crash.
                int[] list = new int[max.Length];
                int   used = 19;

                // Count up how many slots are active.
                for (int s = 0; s < max.Length; s++)
                {
                    if (spec[s].SelectedIndex > 0)
                    {
                        list[s] = spec[s].SelectedIndex;
                    }
                }

                // At most 18, but don't chew if there's only a few slots.
                int   cons       = list.Count(a => a != 0);
                int[] RandomList = new int[(cons > 18) ? (18 - (cons / 8)) : cons];

                // Fill Location List
                if (!CHK_BST.Checked)
                {
                    for (int z = 0; z < RandomList.Length; z++)
                    {
                        RandomList[z] = Randomizer.getRandomSpecies(ref sL, ref ctr);
                    }
                }
                else
                {
                    int oldBST = 0;
                    for (int s = 0; s < max.Length; s++)
                    {
                        if (spec[s].SelectedIndex > 0)
                        {
                            oldBST = personal[spec[s + 2].SelectedIndex].Take(6).Sum(b => (ushort)b); break;
                        }
                    }

                    for (int z = 0; z < RandomList.Length; z++)
                    {
                        int species = Randomizer.getRandomSpecies(ref sL, ref ctr);
                        int newBST  = personal[species].Take(6).Sum(b => (ushort)b);
                        while (!(newBST * 4 / 5 < oldBST && newBST * 6 / 5 > oldBST))
                        {
                            species = sL[rand.Next(1, sL.Length)]; newBST = personal[species].Take(6).Sum(b => (ushort)b);
                        }
                        RandomList[z] = species;
                    }
                }

                // Assign Slots
                while (used < RandomList.Distinct().Count() || used > 18) // Can just arbitrarily assign slots.
                {
                    int ctrSingle = 0;
                    Util.Shuffle(slotArray);
                    for (int s = 0; s < max.Length; s++)
                    {
                        int slot = slotArray[s];
                        if (spec[slot].SelectedIndex != 0) // If the slot is in use
                        {
                            list[slot] = Randomizer.getRandomSpecies(ref RandomList, ref ctrSingle);
                        }
                    }
                    used = countUnique(list);
                    if (used != RandomList.Length)
                    {
                        ShuffleSlots(ref list, RandomList.Length);
                    }
                    used = countUnique(list);
                }

                // Fill Slots
                for (int slot = 0; slot < max.Length; slot++)
                {
                    if (spec[slot].SelectedIndex != 0)
                    {
                        spec[slot].SelectedIndex = list[slot];
                        setRandomForm(slot, spec[slot].SelectedIndex);
                    }
                }

                B_Save_Click(sender, e);
            }
            Enabled = true;
            Util.Alert("Randomized!");
        }
Beispiel #7
0
        private void B_Save_Click(object sender, EventArgs e)
        {
            RSTE.rPKM             = CHK_RandomPKM.Checked;
            RSTE.sL               = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, false, CHK_L.Checked, CHK_E.Checked, ModifierKeys == Keys.Control);
            RSTE.rSmart           = CHK_BST.Checked;
            RSTE.rLevel           = CHK_Level.Checked;
            RSTE.rLevelMultiplier = NUD_Level.Value;

            RSTE.rMove   = CB_Moves.SelectedIndex == 1;
            RSTE.rNoMove = CB_Moves.SelectedIndex == 2;
            if (RSTE.rMove)
            {
                RSTE.rDMG = CHK_Damage.Checked;
                if (RSTE.rDMG)
                {
                    RSTE.rDMGCount = (int)NUD_Damage.Value;
                }
                RSTE.rSTAB = CHK_STAB.Checked;
                if (RSTE.rSTAB)
                {
                    RSTE.rSTABCount = (int)NUD_STAB.Value;
                }
            }
            RSTE.rItem    = CHK_RandomItems.Checked;
            RSTE.rAbility = CHK_RandomAbilities.Checked;
            RSTE.rDiffIV  = CHK_MaxDiffPKM.Checked;

            RSTE.rClass = CHK_RandomClass.Checked;
            if (RSTE.rClass)
            {
                RSTE.rIgnoreClass = CHK_IgnoreSpecialClass.Checked
                    ? Main.Config.ORAS
                        ? Legal.SpecialClasses_ORAS
                        : Legal.SpecialClasses_XY
                    : new int[] {};
                RSTE.rOnlySingles = CHK_OnlySingles.Checked;
            }
            RSTE.rGift            = CHK_RandomGift.Checked;
            RSTE.rGiftPercent     = NUD_GiftPercent.Value;
            RSTE.rDiffAI          = CHK_MaxDiffAI.Checked;
            RSTE.rTypeTheme       = CHK_TypeTheme.Checked;
            RSTE.rTypeGymTrainers = CHK_GymTrainers.Checked;
            RSTE.rGymE4Only       = CHK_GymE4Only.Checked;
            RSTE.r6PKM            = CHK_6PKM.Checked;
            RSTE.rRandomMegas     = CHK_RandomMegaForm.Checked;

            if (CHK_StoryMEvos.Checked)
            {
                RSTE.rEnsureMEvo = Main.Config.ORAS
                    ? new [] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 }
                    : new [] { 188, 263, 276, 277, 519, 520, 521, 526, 599, 600, 601 };
            }
            else
            {
                RSTE.rEnsureMEvo = new int[] { };
            }

            RSTE.rThemedClasses = new bool[trClass.Length];

            if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings before continuing.") != DialogResult.Yes)
            {
                return;
            }
            if (!CHK_IgnoreSpecialClass.Checked)
            {
                if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Ignoring Special Trainer Classes has the chance of crashing your game in some battles!", "Continue anyway?") != DialogResult.Yes)
                {
                    return;
                }
            }
            RSTE.rDoRand = true;
            Close();
        }
Beispiel #8
0
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            if (Util.Prompt(MessageBoxButtons.YesNo, "Randomize all?", "Cannot undo.") != DialogResult.Yes)
            {
                return;
            }

            Enabled = false;

            // Calculate % diff we will apply to each level
            decimal leveldiff = (100 + NUD_LevelAmp.Value) / 100;

            // Nonrepeating List Start
            int[] sL = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked,
                                                 CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_L.Checked, CHK_E.Checked);

            int ctr = 0;

            for (int i = 0; i < CB_LocationID.Items.Count; i++) // for every location
            {
                CB_LocationID.SelectedIndex = i;
                if (!hasData())
                {
                    continue;             // Don't randomize if doesn't have data.
                }
                // Assign Levels
                if (CHK_Level.Checked)
                {
                    for (int l = 0; l < max.Length; l++)
                    {
                        min[l].Value = max[l].Value = max[l].Value <= 1 ? max[l].Value : Math.Max(1, Math.Min(100, (int)(leveldiff * max[l].Value)));
                    }
                }

                for (int slot = 0; slot < max.Length; slot++)
                {
                    if (spec[slot].SelectedIndex == 0)
                    {
                        continue;
                    }

                    int species = Randomizer.getRandomSpecies(ref sL, ref ctr);

                    if (CHK_BST.Checked)
                    {
                        int oldBST = personal[spec[slot].SelectedIndex].Take(6).Sum(b => (ushort)b);
                        int newBST = personal[species].Take(6).Sum(b => (ushort)b);
                        while (!(newBST * 4 / 5 < oldBST && newBST * 6 / 5 > oldBST))
                        {
                            species = sL[rand.Next(1, sL.Length)]; newBST = personal[species].Take(6).Sum(b => (ushort)b);
                        }
                    }

                    spec[slot].SelectedIndex = species;
                    setRandomForm(slot, spec[slot].SelectedIndex);
                }
                B_Save_Click(sender, e);
            }
            Enabled = true;
            Util.Alert("Randomized!");
        }
Beispiel #9
0
        // Randomization
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            if (Util.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings.") != DialogResult.Yes)
            {
                return;
            }

            Enabled = false;
            int setSkip = CHK_SOS.Checked ? 1 : 0;

            // Calculate % diff we will apply to each level
            decimal leveldiff = (100 + NUD_LevelAmp.Value) / 100;

            // Nonrepeating List Start
            int[] sL = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked,
                                                 CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_G7.Checked, CHK_L.Checked, CHK_E.Checked);

            int ctr = 0;

            foreach (var Map in Areas)
            {
                foreach (var Table in Map.Tables)
                {
                    if (CHK_Level.Checked)
                    {
                        Table.MinLevel = Math.Max(1, Math.Min(100, (int)(leveldiff * Table.MinLevel)));
                        Table.MaxLevel = Math.Max(1, Math.Min(100, (int)(leveldiff * Table.MaxLevel)));
                    }

                    foreach (var EncounterSet in Table.Encounters.Skip(setSkip)) // Skip regular slots if checked
                    {
                        foreach (var encounter in EncounterSet)
                        {
                            // Only modify slots that're used.
                            if (encounter.Species == 0)
                            {
                                continue;
                            }

                            if (!CHK_BST.Checked)
                            {
                                encounter.Species = (uint)Randomizer.getRandomSpecies(ref sL, ref ctr);
                            }
                            else
                            {
                                var old_ind = Main.SpeciesStat[encounter.Species].FormeIndex((int)encounter.Species, (int)encounter.Forme);
                                int oldBST  = Main.SpeciesStat[old_ind].BST;

                                int species = Randomizer.getRandomSpecies(ref sL, ref ctr);
                                int newBST  = Main.SpeciesStat[species].BST;
                                while (!(newBST * 4 / 5 < oldBST && newBST * 6 / 5 > oldBST))
                                {
                                    species = Randomizer.getRandomSpecies(ref sL, ref ctr);
                                    newBST  = Main.SpeciesStat[species].BST;
                                }
                                encounter.Species = (uint)species;
                            }
                            encounter.Forme = GetRandomForme((int)encounter.Species);
                        }
                    }

                    Table.Write();
                }
                encdata[Map.FileNumber] = getMapData(Map.Tables);
            }
            updatePanel(sender, e);
            Enabled = true;
            Util.Alert("Randomized!");
        }
Beispiel #10
0
        private void B_Save_Click(object sender, EventArgs e)
        {
            RSTE.rPKM          = CHK_RandomPKM.Checked;
            RSTE.sL            = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_L.Checked, CHK_E.Checked, ModifierKeys == Keys.Control);
            RSTE.rSmart        = CHK_BST.Checked;
            RSTE.rLevel        = CHK_Level.Checked;
            RSTE.rLevelPercent = NUD_Level.Value;

            RSTE.rMove   = CB_Moves.SelectedIndex == 1;
            RSTE.rNoMove = CB_Moves.SelectedIndex == 2;
            if (RSTE.rMove)
            {
                RSTE.rDMG = CHK_Damage.Checked;
                if (RSTE.rDMG)
                {
                    RSTE.rDMGCount = (int)NUD_Damage.Value;
                }
                RSTE.rSTAB = CHK_STAB.Checked;
                if (RSTE.rSTAB)
                {
                    RSTE.rSTABCount = (int)NUD_STAB.Value;
                }
            }
            RSTE.rItem    = CHK_RandomItems.Checked;
            RSTE.rAbility = CHK_RandomAbilities.Checked;
            RSTE.rDiffIV  = CHK_MaxDiffPKM.Checked;

            RSTE.rClass = CHK_RandomClass.Checked;
            if (RSTE.rClass)
            {
                RSTE.rIgnoreClass = CHK_IgnoreSpecialClass.Checked
                    ? Main.oras
                        ? Legal.SpecialClasses_ORAS
                        : Legal.SpecialClasses_XY
                    : new int[] {};
                RSTE.rOnlySingles = CHK_OnlySingles.Checked;
            }
            RSTE.rGift            = CHK_RandomGift.Checked;
            RSTE.rGiftPercent     = NUD_GiftPercent.Value;
            RSTE.rDiffAI          = CHK_MaxDiffAI.Checked;
            RSTE.rTypeTheme       = CHK_TypeTheme.Checked;
            RSTE.rTypeGymTrainers = CHK_GymTrainers.Checked;
            RSTE.rGymE4Only       = CHK_GymE4Only.Checked;
            RSTE.r6PKM            = CHK_6PKM.Checked;
            RSTE.rRandomMegas     = CHK_RandomMegaForm.Checked;

            if (CHK_StoryMEvos.Checked)
            {
                RSTE.rEnsureMEvo = Main.oras
                    ? new [] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 }
                    : new [] { 188, 263, 276, 277, 519, 520, 521, 526, 599, 600, 601 };
            }
            else
            {
                RSTE.rEnsureMEvo = new int[] { };
            }

            RSTE.rThemedClasses = new bool[trClass.Length];

            RSTE.rDoRand = true;
            Close();
        }
Beispiel #11
0
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            if (Util.Prompt(MessageBoxButtons.YesNo, "Randomize all?", "Cannot undo.") != DialogResult.Yes)
            {
                return;
            }

            Enabled = false;

            // Calculate % diff we will apply to each level
            decimal leveldiff = (100 + NUD_LevelAmp.Value) / 100;

            // Nonrepeating List Start
            int[] sL = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked,
                                                 CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_L.Checked, CHK_E.Checked);

            int ctr = 0;

            for (int i = 0; i < CB_LocationID.Items.Count; i++) // for every location
            {
                CB_LocationID.SelectedIndex = i;
                if (!hasData())
                {
                    continue;             // Don't randomize if doesn't have data.
                }
                // Assign Levels
                if (CHK_Level.Checked)
                {
                    for (int l = 0; l < max.Length; l++)
                    {
                        min[l].Value = max[l].Value = (max[l].Value <= 1) ? max[l].Value : Math.Max(1, Math.Min(100, (int)((leveldiff) * max[l].Value)));
                    }
                }

                for (int slot = 0; slot < max.Length; slot++)
                {
                    if (spec[slot].SelectedIndex == 0)
                    {
                        continue;
                    }

                    int species = Randomizer.getRandomSpecies(ref sL, ref ctr);

                    if (CHK_BST.Checked)
                    {
                        int oldBST = personal[spec[slot].SelectedIndex].Take(6).Sum(b => (ushort)b);
                        int newBST = personal[species].Take(6).Sum(b => (ushort)b);
                        while (!(newBST * 4 / 5 < oldBST && newBST * 6 / 5 > oldBST))
                        {
                            species = sL[rand.Next(1, sL.Length)]; newBST = personal[species].Take(6).Sum(b => (ushort)b);
                        }
                    }

                    spec[slot].SelectedIndex = species;

                    if (species == 666 || species == 665 || species == 664) // Vivillon
                    {
                        form[slot].Value = rnd32() % 20;
                    }
                    else if (species == 386) // Deoxys
                    {
                        form[slot].Value = rnd32() % 4;
                    }
                    else if (species == 201) // Unown
                    {
                        form[slot].Value = rnd32() % 28;
                    }
                    else if (species == 550) // Basculin
                    {
                        form[slot].Value = rnd32() % 2;
                    }
                    else if (species == 412 || species == 413) // Wormadam
                    {
                        form[slot].Value = rnd32() % 3;
                    }
                    else if (species == 422 || species == 423) // Gastrodon
                    {
                        form[slot].Value = rnd32() % 2;
                    }
                    else if (species == 585 || species == 586) // Sawsbuck
                    {
                        form[slot].Value = rnd32() % 4;
                    }
                    else if (species == 669 || species == 671) // Flabebe/Florges
                    {
                        form[slot].Value = rnd32() % 5;
                    }
                    else if (species == 670) // Floette
                    {
                        form[slot].Value = rnd32() % 6;
                    }
                    else if (species == 710 || species == 711) // Pumpkaboo
                    {
                        form[slot].Value = rnd32() % 4;
                    }
                    else
                    {
                        form[slot].Value = 0;
                    }
                }
                B_Save_Click(sender, e);
            }
            Enabled = true;
            Util.Alert("Randomized!");
        }