private void B_ModifyAll(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes) { return; } for (int i = 1; i < CB_Species.Items.Count; i++) { CB_Species.SelectedIndex = i; // Get new Species if (CHK_NoEV.Checked) { for (int z = 0; z < 6; z++) { ev_boxes[z].Text = 0.ToString(); } } if (CHK_Growth.Checked) { CB_EXPGroup.SelectedIndex = 5; } if (CHK_EXP.Checked) { TB_BaseExp.Text = ((float)NUD_EXP.Value * (Convert.ToUInt16(TB_BaseExp.Text) / 100f)).ToString("000"); } if (CHK_NoTutor.Checked) { foreach (int tm in CLB_TM.CheckedIndices) { CLB_TM.SetItemCheckState(tm, CheckState.Unchecked); } foreach (int mt in CLB_MoveTutors.CheckedIndices) { CLB_MoveTutors.SetItemCheckState(mt, CheckState.Unchecked); } foreach (int ao in CLB_BeachTutors.CheckedIndices) { CLB_BeachTutors.SetItemCheckState(ao, CheckState.Unchecked); } } if (CHK_QuickHatch.Checked) { TB_HatchCycles.Text = 1.ToString(); } if (CHK_CallRate.Checked) { TB_CallRate.Text = ((int)NUD_CallRate.Value).ToString(); } if (CHK_CatchRateMod.Checked) { TB_CatchRate.Text = ((int)NUD_CatchRateMod.Value).ToString(); } } CB_Species.SelectedIndex = 1; WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!"); }
private void B_Randomize_Click(object sender, EventArgs e) { Random rnd = new Random(); const int TMPercent = 35; // Average Learnable TMs is 35.260. const int TutorPercent = 2; //136 special tutor moves learnable by species in Untouched ORAS. ushort[] itemlist = Main.Config.ORAS ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY; ushort[] berrylist = Legal.Pouch_Berry_XY; Array.Resize(ref itemlist, itemlist.Length + berrylist.Length); Array.Copy(berrylist, 0, itemlist, itemlist.Length - berrylist.Length, berrylist.Length); int itemlen = itemlist.Length; int abillen = CB_Ability1.Items.Count; int typelen = CB_Type1.Items.Count; for (int i = 1; i < CB_Species.Items.Count; i++) { CB_Species.SelectedIndex = i; // Get new Species // Fiddle with TM Learnsets if (CHK_TM.Checked) { for (int t = 0; t < 100; t++) { CLB_TM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked); } } if (CHK_HM.Checked) { for (int t = 100; t < CLB_TM.Items.Count; t++) { CLB_TM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked); } } if (CHK_Tutors.Checked) { for (int t = 0; t < CLB_MoveTutors.Items.Count; t++) { CLB_MoveTutors.SetItemCheckState(t, rnd.Next(0, 100) < TutorPercent ? CheckState.Checked : CheckState.Unchecked); } if (Main.Config.ORAS && (CB_Species.SelectedIndex == 384 || CB_Species.SelectedIndex == 814)) //Make sure Rayquaza can learn Dragon Ascent. { CLB_MoveTutors.SetItemCheckState(CLB_MoveTutors.Items.Count - 1, CheckState.Checked); } } // Abilities: if (CHK_Ability.Checked) { ComboBox[] abils = { CB_Ability1, CB_Ability2, CB_Ability3 }; for (int a = 0; a < 3; a++) // Set 3 New Abilities, none being Wonder Guard (25) unless CHK_WGuard is checked. { int newabil = rnd.Next(1, abillen); while (newabil == 25 && !CHK_WGuard.Checked) { newabil = rnd.Next(1, abillen); } if (abils[a].SelectedIndex != 25 || CHK_WGuard.Checked) { abils[a].SelectedIndex = newabil; } } } // Fiddle with Base Stats, don't muck with Shedinja. if (CHK_Stats.Checked) { if (Convert.ToByte(byte_boxes[0].Text) != 1) { for (int z = 0; z < 6; z++) { if (rstat_boxes[z].Checked) { byte_boxes[z].Text = Math.Max(5, rnd.Next( Math.Min(255, (int)(Convert.ToByte(byte_boxes[z].Text) * (1 - NUD_StatDev.Value / 100))), Math.Min(255, (int)(Convert.ToByte(byte_boxes[z].Text) * (1 + NUD_StatDev.Value / 100))) )).ToString("000"); } } } } // EV yield stays the same... if (CHK_CatchRate.Checked) { TB_CatchRate.Text = rnd.Next(3, 251).ToString("000"); //Random Catch Rate between 3 and 250. Should I make this normally distributed? } if (CHK_EggGroup.Checked) { if (rnd.Next(0, 100) < NUD_Egg.Value) // 50% chance to have either One or Two Egg Groups { CB_EggGroup1.SelectedIndex = CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count); } else { CB_EggGroup1.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count); CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count); } } // Items if (CHK_Item.Checked) { CB_HeldItem1.SelectedIndex = itemlist[rnd.Next(1, itemlen)]; CB_HeldItem2.SelectedIndex = itemlist[rnd.Next(1, itemlen)]; CB_HeldItem3.SelectedIndex = itemlist[rnd.Next(1, itemlen)]; } // Type if (CHK_Type.Checked) { if (rnd.Next(0, 100) < NUD_TypePercent.Value) // 50% chance to have either Single or Dual Typing { CB_Type1.SelectedIndex = CB_Type2.SelectedIndex = rnd.Next(0, typelen); } else { CB_Type1.SelectedIndex = rnd.Next(0, typelen); CB_Type2.SelectedIndex = rnd.Next(0, typelen); } } } saveEntry(); Util.Alert("All relevant Pokemon Personal Entries have been randomized!"); }