From d0d31374e38754bc97241a7eb0c76e319e0817a1 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 16 Apr 2017 23:41:08 -0700 Subject: [PATCH] Fix gen6 gift/static form randomization if BST wasn't selected then it'd do a simple loop and return; added code was missing from that section simplify the code a little to only use one loop. #127 --- pk3DS/Subforms/Gen6/GiftEditor6.cs | 15 ++------------- pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs | 13 ++----------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/pk3DS/Subforms/Gen6/GiftEditor6.cs b/pk3DS/Subforms/Gen6/GiftEditor6.cs index de59be5..d1a219b 100644 --- a/pk3DS/Subforms/Gen6/GiftEditor6.cs +++ b/pk3DS/Subforms/Gen6/GiftEditor6.cs @@ -159,20 +159,9 @@ private void B_RandAll_Click(object sender, EventArgs e) "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 + bool bst = ync == DialogResult.Yes; 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; @@ -183,7 +172,7 @@ private void B_RandAll_Click(object sender, EventArgs e) if (species == 448) continue; // skip Lucario, battle needs to mega evolve - species = Randomizer.getRandomSpecies(ref sL, ref ctr, species, true, Main.SpeciesStat); + 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 diff --git a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs index 8b856ca..14e71dc 100644 --- a/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs +++ b/pk3DS/Subforms/Gen6/StaticEncounterEditor6.cs @@ -122,18 +122,9 @@ private void B_RandAll_Click(object sender, EventArgs e) "Abort: Cancel"); if (ync != DialogResult.Yes && ync != DialogResult.No) return; - if (ync == DialogResult.No) - { - for (int i = 0; i < LB_Encounters.Items.Count; i++) - { - LB_Encounters.SelectedIndex = i; - int species = Util.rand.Next(1, 721); - CB_Species.SelectedIndex = species; - } - return; - } // Randomize by BST + bool bst = ync == DialogResult.Yes; 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; @@ -142,7 +133,7 @@ private void B_RandAll_Click(object sender, EventArgs e) LB_Encounters.SelectedIndex = i; int species = CB_Species.SelectedIndex; - species = Randomizer.getRandomSpecies(ref sL, ref ctr, species, true, Main.SpeciesStat); + 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