Пример #1
0
 internal static int GetRandomForme(int species, bool mega, bool alola, PersonalInfo[] stats = null)
 {
     if (stats == null)
     {
         return(0);
     }
     if (stats[species].FormeCount <= 1)
     {
         return(0);
     }
     if (species == 664 || species == 665 || species == 666) // vivillon
     {
         return(30);                                         // save file specific
     }
     if (species == 774)                                     // minior
     {
         return((int)(Util.Random32() % 7));
     }
     if (alola && Legal.EvolveToAlolanForms.Contains(species))
     {
         return((int)(Util.Random32() % 2));
     }
     if (!Legal.Mega_ORAS.Contains((ushort)species) || mega)
     {
         return((int)(Util.Random32() % stats[species].FormeCount)); // Slot-Random
     }
     return(0);
 }
Пример #2
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;
            }

            var formrand = new FormRandomizer(Main.Config)
            {
                AllowMega = false, AllowAlolanForm = false
            };
            var specrand = new SpeciesRandomizer(Main.Config)
            {
                G1 = CHK_G1.Checked,
                G2 = CHK_G2.Checked,
                G3 = CHK_G3.Checked,
                G4 = CHK_G4.Checked,
                G5 = CHK_G5.Checked,
                G6 = CHK_G6.Checked,
                G7 = false,

                E = CHK_E.Checked,
                L = CHK_L.Checked,

                rBST = CHK_BST.Checked,
            };

            specrand.Initialize();

            // add Legendary/Mythical to final evolutions if checked
            if (CHK_L.Checked)
            {
                FinalEvo = FinalEvo.Concat(Legendary).ToArray();
            }
            if (CHK_E.Checked)
            {
                FinalEvo = FinalEvo.Concat(Mythical).ToArray();
            }

            var items = Randomizer.GetRandomItemList();

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

                // replace Legendaries with another Legendary
                if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(species))
                {
                    int randLegend() => (int)(Util.Random32() % ReplaceLegend.Length);

                    species = ReplaceLegend[randLegend()];
                }

                // every other entry
                else
                {
                    species = specrand.GetRandomSpecies(species);
                }

                if (CHK_AllowMega.Checked)
                {
                    formrand.AllowMega = true;
                }

                if (CHK_Item.Checked)
                {
                    CB_HeldItem.SelectedIndex = items[Util.Random32() % items.Length];
                }

                if (CHK_Level.Checked)
                {
                    NUD_Level.Value = Randomizer.GetModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value);
                }

                if (CHK_RemoveShinyLock.Checked)
                {
                    CHK_ShinyLock.Checked = false;
                }

                if (CHK_RandomAbility.Checked)
                {
                    CB_Ability.SelectedIndex = (Util.Rand.Next(1, 4)); // 1, 2 , or H
                }
                if (CHK_ForceFullyEvolved.Checked && NUD_Level.Value >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(species))
                {
                    int randFinalEvo() => (int)(Util.Random32() % FinalEvo.Length);

                    species = FinalEvo[randFinalEvo()];
                }

                CB_Species.SelectedIndex = species;
                NUD_Form.Value           = formrand.GetRandomForme(species);
                CB_Gender.SelectedIndex  = 0; // random
            }
            WinFormsUtil.Alert("Randomized all Static Encounters according to specification!");
        }
Пример #3
0
 internal static uint Random32() => Util.Random32();
Пример #4
0
 static int randFinalEvo() => (int)(Util.Random32() % FinalEvo.Length);
Пример #5
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;
            }

            var formrand = new FormRandomizer(Main.Config)
            {
                AllowMega = false, AllowAlolanForm = false
            };
            var specrand = new SpeciesRandomizer(Main.Config)
            {
                G1 = CHK_G1.Checked,
                G2 = CHK_G2.Checked,
                G3 = CHK_G3.Checked,
                G4 = CHK_G4.Checked,
                G5 = CHK_G5.Checked,
                G6 = CHK_G6.Checked,
                G7 = false,

                E = CHK_E.Checked,
                L = CHK_L.Checked,

                rBST = CHK_BST.Checked,
            };

            specrand.Initialize();

            // add Legendary/Mythical to final evolutions if checked
            if (CHK_L.Checked)
            {
                FinalEvo = FinalEvo.Concat(Legendary).ToArray();
            }
            if (CHK_E.Checked)
            {
                FinalEvo = FinalEvo.Concat(Mythical).ToArray();
            }

            var helditems = Randomizer.GetRandomItemList();

            for (int i = 0; i < LB_Gifts.Items.Count; i++)
            {
                LB_Gifts.SelectedIndex = i;
                int species = CB_Species.SelectedIndex;

                if (MegaDictionary.Values.Any(z => z.Contains(CB_HeldItem.SelectedIndex))) // Mega Stone Gifts (Lucario, Latias/Latios)
                {
                    if (!CHK_ReplaceMega.Checked)
                    {
                        continue; // skip Lucario, battle needs to Mega Evolve
                    }
                    int[] items = GetRandomMega(out species);
                    CB_HeldItem.SelectedIndex = items[Util.Rand.Next(0, items.Length)];
                }
                else
                {
                    species = specrand.GetRandomSpecies(species);
                    if (CHK_Item.Checked)
                    {
                        CB_HeldItem.SelectedIndex = helditems[Util.Random32() % helditems.Length];
                    }
                }

                if (CHK_AllowMega.Checked)
                {
                    formrand.AllowMega = true;
                }

                if (CHK_RemoveShinyLock.Checked)
                {
                    CHK_ShinyLock.Checked = false;
                }

                if (CHK_Level.Checked)
                {
                    NUD_Level.Value = Randomizer.GetModifiedLevel((int)NUD_Level.Value, NUD_LevelBoost.Value);
                }

                if (CHK_RandomAbility.Checked)
                {
                    CB_Ability.SelectedIndex = (Util.Rand.Next(1, 4)); // 1, 2 , or H
                }
                if (CHK_ForceFullyEvolved.Checked && NUD_Level.Value >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(species))
                {
Пример #6
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] + "");
                var rand = new SpeciesRandomizer(Main.Config)
                {
                    G1 = !CHK_Gen.Checked || gen == 1,
                    G2 = !CHK_Gen.Checked || gen == 2,
                    G3 = !CHK_Gen.Checked || gen == 3,
                    G4 = !CHK_Gen.Checked || gen == 4,
                    G5 = !CHK_Gen.Checked || gen == 5,
                    G6 = !CHK_Gen.Checked || gen == 6,

                    L        = CHK_L.Checked,
                    E        = CHK_E.Checked,
                    Shedinja = false,
                };
                rand.Initialize();
                // Assign Species
                for (int j = 0; j < 3; j++)
                {
                    // int oldSpecies = BitConverter.ToUInt16(Data, offset + (((i * 3) + j) * 0x54));
                    if (CHK_BasicStarter.Checked)
                    {
                        if (CHK_Gen.Checked)
                        {
                            int basic() => (int)(Util.Random32() % BasicStarterPerGen[gen - 1].Length);

                            Choices[i][j].SelectedIndex = BasicStarterPerGen[gen - 1][basic()];
                        }
                        else
                        {
                            int basic() => (int)(Util.Random32() % BasicStarter.Length);

                            Choices[i][j].SelectedIndex = BasicStarter[basic()];
                        }
                    }
                    else
                    {
                        Choices[i][j].SelectedIndex = rand.GetRandomSpecies(i);
                    }
                }
            }

            if (blind)
            {
                SaveData();
                Close();
            }
        }