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
This commit is contained in:
Kurt
2017-04-16 23:41:08 -07:00
parent f60a981c65
commit d0d31374e3
2 changed files with 4 additions and 24 deletions

View File

@@ -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

View File

@@ -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