From 0e690d77ddc4f2a6636456c6bac2a6159bf7f663 Mon Sep 17 00:00:00 2001 From: SciresM Date: Sat, 28 Mar 2015 22:47:17 -0700 Subject: [PATCH] Implement Type Theming Option in RSTE --- pk3DS/Subforms/RSTE.cs | 327 ++++++++++++++++++++++++- pk3DS/Subforms/TrainerRand.Designer.cs | 81 ++++-- pk3DS/Subforms/TrainerRand.cs | 33 +++ 3 files changed, 418 insertions(+), 23 deletions(-) diff --git a/pk3DS/Subforms/RSTE.cs b/pk3DS/Subforms/RSTE.cs index cfa45b4..72b4d74 100644 --- a/pk3DS/Subforms/RSTE.cs +++ b/pk3DS/Subforms/RSTE.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Media; @@ -508,13 +509,22 @@ private void Setup() CB_Battle_Type.Items.Add("Rotation"); CB_Battle_Type.Items.Add("Horde"); + megaEvos = (Main.oras) ? new int[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 } : new int[] { 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 }; + CB_TrainerID.SelectedIndex = 1; start = false; readFile(); SystemSounds.Asterisk.Play(); } - public static bool rPKM, rSmart, rLevel, rMove, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand; + public static bool rPKM, rSmart, rLevel, rMove, rAbility, rDiffAI, rDiffIV, rClass, rGift, rItem, rDoRand, rTypeTheme, rTypeGymTrainers; + public static bool[] rThemedClasses = new bool[] {}; + public static string[] rTags; + public static int[] megaEvos; + public static int[] rEnsureMEvo; + private int[] mEvoTypes; + private List Tags = new List(); + private Dictionary TagTypes = new Dictionary(); public static int[] sL; // Random Species List public static decimal rGiftPercent, rLevelPercent; private void B_Randomize_Click(object sender, EventArgs e) @@ -527,6 +537,60 @@ private void B_Randomize_Click(object sender, EventArgs e) } private void Randomize() { + rTags = (Main.oras) ? GetTagsORAS() : GetTagsXY(); + mEvoTypes = GetMegaEvolvableTypes(); + List GymE4Types = new List(); + if (rEnsureMEvo.Length > 0) + { + if (mEvoTypes.Length < 13 && rTypeTheme) + { + Util.Alert("There are insufficient types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.", "Re-Randomize Personal or don't choose both options."); + return; + } + GymE4Types.AddRange(mEvoTypes); + } + else + { + GymE4Types.AddRange(Enumerable.Range(0, types.Length).ToArray()); + } + for (int i = 0; i < rEnsureMEvo.Length; i++) // Ensure Story MEvo Trainers have MEvoable Mons + { + if (rTags[rEnsureMEvo[i]] != "" && !TagTypes.Keys.Contains(rTags[rEnsureMEvo[i]])) + { + int t; + if (rTags[rEnsureMEvo[i]].Contains("GYM") || rTags[rEnsureMEvo[i]].Contains("ELITE") || rTags[rEnsureMEvo[i]].Contains("CHAMPION")) + { + int roll = (int)(rnd32() % GymE4Types.Count); + t = GymE4Types[roll]; + GymE4Types.Remove(t); + } + else + { + t = mEvoTypes[rnd32() % mEvoTypes.Length]; + } + TagTypes[rTags[rEnsureMEvo[i]]] = t; + + } + } + for (int i = 0; i < Tags.Count; i++) + { + if (!TagTypes.Keys.Contains(Tags[i]) && Tags[i] != "") + { + int t; + if (Tags[i].Contains("GYM") || Tags[i].Contains("ELITE") || Tags[i].Contains("CHAMPION")) + { + int roll = (int)(rnd32() % GymE4Types.Count); + t = GymE4Types[roll]; + GymE4Types.Remove(t); + } + else + { + t = (int)(rnd32() % types.Length); + } + TagTypes[Tags[i]] = t; + } + Console.WriteLine(Tags[i] + ": "+types[TagTypes[Tags[i]]]); + } for (int i = 1; i < CB_TrainerID.Items.Count; i++) { CB_TrainerID.SelectedIndex = i; // data is loaded @@ -569,6 +633,9 @@ private void Randomize() int itemC = itemvals.Length; int ctr = 0; + int type = GetRandomType(i); + bool mevo = rEnsureMEvo.Contains(i); + // Randomize Pokemon for (int p = 0; p < CB_numPokemon.SelectedIndex; p++) { @@ -576,19 +643,48 @@ private void Randomize() { // randomize pokemon int species = Randomizer.getRandomSpecies(ref sL, ref ctr); - if (rSmart) // Get a new Pokemon with a close BST + if (rTypeTheme) + { + while (personal[species][6] != type && personal[species][7] != type || (mevo && p == CB_numPokemon.SelectedIndex-1 && !megaEvos.Contains(species))) + { + if (p == CB_numPokemon.SelectedIndex - 1 && mevo) + { + species = GetRandomMegaEvolvablePokemon(type); + } + else if (rSmart) // Get a new Pokemon with a close BST + { + int oldBST = personal[trpk_pkm[p].SelectedIndex].Take(6).Sum(b => (ushort)b); + int newBST = personal[species].Take(6).Sum(b => (ushort)b); + while (!(newBST * 5 / 6 < oldBST && newBST * 6 / 5 > oldBST)) + { species = sL[rand.Next(1, sL.Length)]; newBST = personal[species].Take(6).Sum(b => (ushort)b); } + } + else + { + species = Randomizer.getRandomSpecies(ref sL, ref ctr); + } + } + } + else if (p == CB_numPokemon.SelectedIndex - 1 && mevo) + { + species = megaEvos[rnd32() % megaEvos.Length]; + } + else if (rSmart) // Get a new Pokemon with a close BST { int oldBST = personal[trpk_pkm[p].SelectedIndex].Take(6).Sum(b => (ushort)b); int newBST = personal[species].Take(6).Sum(b => (ushort)b); while (!(newBST * 5 / 6 < oldBST && newBST * 6 / 5 > oldBST)) { species = sL[rand.Next(1, sL.Length)]; newBST = personal[species].Take(6).Sum(b => (ushort)b); } } + trpk_pkm[p].SelectedIndex = species; // Set Gender to Random trpk_gender[p].SelectedIndex = 0; + if (trpk_form[p].Items.Count > 0) + trpk_form[p].SelectedIndex = 0; // Randomize form - trpk_form[p].SelectedIndex = (int)(rnd32() % trpk_form[p].Items.Count); + if (trpk_form[p].Items.Count > 0 && !megaEvos.Contains(species)) + trpk_form[p].SelectedIndex = (int)(rnd32() % trpk_form[p].Items.Count); } if (rLevel) trpk_lvl[p].SelectedIndex = Math.Max(1, Math.Min((int)(trpk_lvl[p].SelectedIndex * ((100 + rLevelPercent) / 100)), 100)); @@ -596,10 +692,16 @@ private void Randomize() trpk_abil[p].SelectedIndex = (int)(1 + rnd32() % 3); if (rDiffIV) trpk_IV[p].SelectedIndex = 255; - if (rItem) + if (mevo && p == CB_numPokemon.SelectedIndex - 1) + { + int[] megastones = GetMegaStones(trpk_pkm[p].SelectedIndex); + trpk_item[p].SelectedIndex = megastones[rnd32() % megastones.Length]; + } + else if (rItem) #region RandomItem trpk_item[p].SelectedIndex = itemvals[(rnd32() % itemC)]; #endregion + if (rMove) { trpk_m1[p].SelectedIndex = (int)(rnd32() % (moves)); @@ -612,5 +714,222 @@ private void Randomize() CB_TrainerID.SelectedIndex = 1; Util.Alert("Randomized all trainers according to specification!", "Press the Dump to TXT to view the new trainer information!"); } + + private string[] GetTagsORAS() + { + string[] tags = Enumerable.Repeat("", trdatapaths.Length).ToArray(); + + //Rival Battles + TagTrainer(tags, "RIVAL1", 1, 4, 289, 292, 295, 298, 527, 530, 674, 677, 699, 906); // Rival w/ Grass Starter + TagTrainer(tags, "RIVAL2", 2, 5, 290, 293, 296, 299, 528, 531, 675, 678, 700, 907); // Rival w/ Fire Starter + TagTrainer(tags, "RIVAL3", 3, 6, 291, 294, 297, 300, 529, 532, 676, 679, 701, 908); // Rival w/ Water Starter + + //Aqua Admins + TagTrainer(tags, "AQUA1", 178, 231, 266); // Archie + TagTrainer(tags, "AQUA2", 683, 684, 685, 686, 687); // Matt + TagTrainer(tags, "AQUA3", 688, 689, 690); // Shelly + + //Magma Admins + TagTrainer(tags, "MAGMA1", 235, 236, 271); // Maxie + TagTrainer(tags, "MAGMA2", 694, 695, 696, 697, 698); // Courney + TagTrainer(tags, "MAGMA3", 691, 692, 693); // Tabitha + + //Gym Leaders + TagTrainer(tags, "GYM1", 561); // Roxanne + TagTrainer(tags, "GYM2", 563); // Brawly + TagTrainer(tags, "GYM3", 567); // Wattson + TagTrainer(tags, "GYM4", 569); // Flannery + TagTrainer(tags, "GYM5", 570); // Norman + TagTrainer(tags, "GYM6", 571); // Winona + TagTrainer(tags, "GYM7", 552); // Liza & Tate + TagTrainer(tags, "GYM8", 572, 943); // Wallace + + //Elite 4 + TagTrainer(tags, "ELITE1", 553, 909); // Sidney + TagTrainer(tags, "ELITE2", 554, 910); // Phoebe + TagTrainer(tags, "ELITE3", 555, 911); // Glacia + TagTrainer(tags, "ELITE4", 556, 912); // Drake + TagTrainer(tags, "CHAMPION", 557, 680, 913, 942); // Champion Steven + + //Wally + TagTrainer(tags, "WALLY", 518, 583, 944, 945, 946, 947); + + //Zinnia + TagTrainer(tags, "LOREKEEPER", 713, 898); + + //Gym Trainers (Tagged in order of appearance on Bulbapedia's lists) + if (rTypeGymTrainers) + { + TagTrainer(tags, "GYM1", 562, 22, 667); + TagTrainer(tags, "GYM2", 60, 56, 59); + TagTrainer(tags, "GYM3", 34, 568, 614, 35); + TagTrainer(tags, "GYM4", 81, 824, 83, 615, 823, 613, 85); + TagTrainer(tags, "GYM5", 63, 67, 64, 68, 65, 69, 66); + TagTrainer(tags, "GYM6", 115, 517, 516, 118, 730); + TagTrainer(tags, "GYM7", 157, 226, 320, 159, 225, 158); + TagTrainer(tags, "GYM8", 647, 342, 594, 646, 338, 339, 340, 341); + } + return tags; + } + private string[] GetTagsXY() + { + string[] tags = new string[CB_TrainerID.Items.Count]; + + return tags; + } + + private void TagTrainer(string[] rTags, string tag, params int[] ids) + { + foreach (int id in ids) + { + if (id < rTags.Length) + rTags[id] = tag; + } + if (!Tags.Contains(tag)) + Tags.Add(tag); + } + + private int[] GetMegaStones(int species) // This is horrible. + { + switch (species) + { + case 3: + return new int[] { 659 }; + case 6: + return new int[] { 660, 678 }; + case 9: + return new int[] { 661 }; + case 15: + return new int[] { 770 }; + case 18: + return new int[] { 762 }; + case 65: + return new int[] { 679 }; + case 80: + return new int[] { 760 }; + case 94: + return new int[] { 656 }; + case 115: + return new int[] { 675 }; + case 127: + return new int[] { 671 }; + case 130: + return new int[] { 676 }; + case 142: + return new int[] { 672 }; + case 150: + return new int[] { 662, 663 }; + case 181: + return new int[] { 658 }; + case 208: + return new int[] { 761 }; + case 212: + return new int[] { 670 }; + case 214: + return new int[] { 680 }; + case 229: + return new int[] { 666 }; + case 248: + return new int[] { 669 }; + case 254: + return new int[] { 753 }; + case 257: + return new int[] { 664 }; + case 260: + return new int[] { 752 }; + case 282: + return new int[] { 657 }; + case 302: + return new int[] { 754 }; + case 303: + return new int[] { 681 }; + case 306: + return new int[] { 667 }; + case 308: + return new int[] { 665 }; + case 310: + return new int[] { 682 }; + case 319: + return new int[] { 759 }; + case 323: + return new int[] { 767 }; + case 334: + return new int[] { 755 }; + case 354: + return new int[] { 668 }; + case 359: + return new int[] { 677 }; + case 362: + return new int[] { 763 }; + case 373: + return new int[] { 769 }; + case 376: + return new int[] { 758 }; + case 380: + return new int[] { 684 }; + case 381: + return new int[] { 685 }; + case 428: + return new int[] { 768 }; + case 445: + return new int[] { 683 }; + case 448: + return new int[] { 673 }; + case 460: + return new int[] { 674 }; + case 475: + return new int[] { 756 }; + case 531: + return new int[] { 757 }; + case 719: + return new int[] { 764 }; + default: + return new int[] { }; + } + } + + private int GetRandomType(int trainer) + { + if (rTags[trainer] == "") + { + if (rEnsureMEvo.Contains(trainer)) + { + int t = mEvoTypes[rnd32() % mEvoTypes.Length]; + return t; + } + else + return (int)(rnd32() % types.Length); + } + else + { + return TagTypes[rTags[trainer]]; + } + } + + private int[] GetMegaEvolvableTypes() + { + List MEvoTypes = new List(); + foreach (int spec in megaEvos) + { + if (!MEvoTypes.Contains((int)personal[spec][6])) + MEvoTypes.Add((int)personal[spec][6]); + if (!MEvoTypes.Contains((int)personal[spec][7])) + MEvoTypes.Add((int)personal[spec][7]); + } + MEvoTypes.Sort(); + Console.WriteLine("There are " + MEvoTypes.Count + " types capable of mega evolution."); + return MEvoTypes.ToArray(); + } + + private int GetRandomMegaEvolvablePokemon(int type) + { + List valids = new List(); + foreach (int spec in megaEvos) + { + if ((int)personal[spec][6] == type || (int)personal[spec][7] == type) + valids.Add(spec); + } + return valids[(int)(rnd32() % valids.Count)]; + } } } \ No newline at end of file diff --git a/pk3DS/Subforms/TrainerRand.Designer.cs b/pk3DS/Subforms/TrainerRand.Designer.cs index f12ce4c..0cc3f6f 100644 --- a/pk3DS/Subforms/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/TrainerRand.Designer.cs @@ -53,6 +53,9 @@ private void InitializeComponent() this.CHK_G3 = new System.Windows.Forms.CheckBox(); this.CHK_G2 = new System.Windows.Forms.CheckBox(); this.CHK_G1 = new System.Windows.Forms.CheckBox(); + this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); + this.CHK_StoryMEvos = new System.Windows.Forms.CheckBox(); + this.CHK_GymTrainers = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit(); this.GB_Tweak.SuspendLayout(); @@ -77,7 +80,7 @@ private void InitializeComponent() this.CHK_RandomItems.AutoSize = true; this.CHK_RandomItems.Checked = true; this.CHK_RandomItems.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomItems.Location = new System.Drawing.Point(12, 156); + this.CHK_RandomItems.Location = new System.Drawing.Point(12, 265); this.CHK_RandomItems.Name = "CHK_RandomItems"; this.CHK_RandomItems.Size = new System.Drawing.Size(119, 17); this.CHK_RandomItems.TabIndex = 6; @@ -90,7 +93,7 @@ private void InitializeComponent() this.CHK_RandomMoves.AutoSize = true; this.CHK_RandomMoves.Checked = true; this.CHK_RandomMoves.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomMoves.Location = new System.Drawing.Point(12, 141); + this.CHK_RandomMoves.Location = new System.Drawing.Point(12, 250); this.CHK_RandomMoves.Name = "CHK_RandomMoves"; this.CHK_RandomMoves.Size = new System.Drawing.Size(101, 17); this.CHK_RandomMoves.TabIndex = 5; @@ -103,7 +106,7 @@ private void InitializeComponent() this.CHK_RandomAbilities.AutoSize = true; this.CHK_RandomAbilities.Checked = true; this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomAbilities.Location = new System.Drawing.Point(12, 171); + this.CHK_RandomAbilities.Location = new System.Drawing.Point(12, 280); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); this.CHK_RandomAbilities.TabIndex = 7; @@ -116,7 +119,7 @@ private void InitializeComponent() this.CHK_RandomGift.AutoSize = true; this.CHK_RandomGift.Checked = true; this.CHK_RandomGift.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomGift.Location = new System.Drawing.Point(12, 235); + this.CHK_RandomGift.Location = new System.Drawing.Point(12, 330); this.CHK_RandomGift.Name = "CHK_RandomGift"; this.CHK_RandomGift.Size = new System.Drawing.Size(145, 17); this.CHK_RandomGift.TabIndex = 10; @@ -130,7 +133,7 @@ private void InitializeComponent() this.CHK_RandomClass.AutoSize = true; this.CHK_RandomClass.Checked = true; this.CHK_RandomClass.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_RandomClass.Location = new System.Drawing.Point(12, 220); + this.CHK_RandomClass.Location = new System.Drawing.Point(12, 315); this.CHK_RandomClass.Name = "CHK_RandomClass"; this.CHK_RandomClass.Size = new System.Drawing.Size(141, 17); this.CHK_RandomClass.TabIndex = 9; @@ -143,7 +146,7 @@ private void InitializeComponent() this.CHK_MaxDiffAI.AutoSize = true; this.CHK_MaxDiffAI.Checked = true; this.CHK_MaxDiffAI.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffAI.Location = new System.Drawing.Point(12, 250); + this.CHK_MaxDiffAI.Location = new System.Drawing.Point(12, 345); this.CHK_MaxDiffAI.Name = "CHK_MaxDiffAI"; this.CHK_MaxDiffAI.Size = new System.Drawing.Size(144, 17); this.CHK_MaxDiffAI.TabIndex = 13; @@ -156,7 +159,7 @@ private void InitializeComponent() this.CHK_MaxDiffPKM.AutoSize = true; this.CHK_MaxDiffPKM.Checked = true; this.CHK_MaxDiffPKM.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(12, 186); + this.CHK_MaxDiffPKM.Location = new System.Drawing.Point(12, 295); this.CHK_MaxDiffPKM.Name = "CHK_MaxDiffPKM"; this.CHK_MaxDiffPKM.Size = new System.Drawing.Size(161, 17); this.CHK_MaxDiffPKM.TabIndex = 8; @@ -166,7 +169,7 @@ private void InitializeComponent() // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.button1.Location = new System.Drawing.Point(222, 225); + this.button1.Location = new System.Drawing.Point(222, 320); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(50, 23); this.button1.TabIndex = 14; @@ -177,7 +180,7 @@ private void InitializeComponent() // button2 // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.button2.Location = new System.Drawing.Point(222, 247); + this.button2.Location = new System.Drawing.Point(222, 342); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(50, 23); this.button2.TabIndex = 15; @@ -188,7 +191,7 @@ private void InitializeComponent() // NUD_GiftPercent // this.NUD_GiftPercent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.NUD_GiftPercent.Location = new System.Drawing.Point(155, 232); + this.NUD_GiftPercent.Location = new System.Drawing.Point(155, 327); this.NUD_GiftPercent.Name = "NUD_GiftPercent"; this.NUD_GiftPercent.Size = new System.Drawing.Size(43, 20); this.NUD_GiftPercent.TabIndex = 11; @@ -203,7 +206,7 @@ private void InitializeComponent() // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(200, 234); + this.label1.Location = new System.Drawing.Point(200, 329); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(15, 13); this.label1.TabIndex = 12; @@ -251,6 +254,9 @@ private void InitializeComponent() // // GB_Tweak // + this.GB_Tweak.Controls.Add(this.CHK_GymTrainers); + this.GB_Tweak.Controls.Add(this.CHK_StoryMEvos); + this.GB_Tweak.Controls.Add(this.CHK_TypeTheme); this.GB_Tweak.Controls.Add(this.CHK_BST); this.GB_Tweak.Controls.Add(this.CHK_E); this.GB_Tweak.Controls.Add(this.CHK_L); @@ -262,7 +268,7 @@ private void InitializeComponent() this.GB_Tweak.Controls.Add(this.CHK_G1); this.GB_Tweak.Location = new System.Drawing.Point(12, 54); this.GB_Tweak.Name = "GB_Tweak"; - this.GB_Tweak.Size = new System.Drawing.Size(256, 78); + this.GB_Tweak.Size = new System.Drawing.Size(270, 120); this.GB_Tweak.TabIndex = 323; this.GB_Tweak.TabStop = false; this.GB_Tweak.Text = "Options"; @@ -270,7 +276,7 @@ private void InitializeComponent() // CHK_BST // this.CHK_BST.AutoSize = true; - this.CHK_BST.Location = new System.Drawing.Point(136, 51); + this.CHK_BST.Location = new System.Drawing.Point(141, 51); this.CHK_BST.Name = "CHK_BST"; this.CHK_BST.Size = new System.Drawing.Size(117, 17); this.CHK_BST.TabIndex = 288; @@ -282,7 +288,7 @@ private void InitializeComponent() this.CHK_E.AutoSize = true; this.CHK_E.Checked = true; this.CHK_E.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_E.Location = new System.Drawing.Point(136, 36); + this.CHK_E.Location = new System.Drawing.Point(141, 36); this.CHK_E.Name = "CHK_E"; this.CHK_E.Size = new System.Drawing.Size(98, 17); this.CHK_E.TabIndex = 287; @@ -294,7 +300,7 @@ private void InitializeComponent() this.CHK_L.AutoSize = true; this.CHK_L.Checked = true; this.CHK_L.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_L.Location = new System.Drawing.Point(136, 21); + this.CHK_L.Location = new System.Drawing.Point(141, 21); this.CHK_L.Name = "CHK_L"; this.CHK_L.Size = new System.Drawing.Size(98, 17); this.CHK_L.TabIndex = 286; @@ -342,7 +348,7 @@ private void InitializeComponent() this.CHK_G3.AutoSize = true; this.CHK_G3.Checked = true; this.CHK_G3.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G3.Location = new System.Drawing.Point(17, 51); + this.CHK_G3.Location = new System.Drawing.Point(9, 51); this.CHK_G3.Name = "CHK_G3"; this.CHK_G3.Size = new System.Drawing.Size(55, 17); this.CHK_G3.TabIndex = 282; @@ -354,7 +360,7 @@ private void InitializeComponent() this.CHK_G2.AutoSize = true; this.CHK_G2.Checked = true; this.CHK_G2.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G2.Location = new System.Drawing.Point(17, 36); + this.CHK_G2.Location = new System.Drawing.Point(9, 36); this.CHK_G2.Name = "CHK_G2"; this.CHK_G2.Size = new System.Drawing.Size(55, 17); this.CHK_G2.TabIndex = 281; @@ -366,18 +372,52 @@ private void InitializeComponent() this.CHK_G1.AutoSize = true; this.CHK_G1.Checked = true; this.CHK_G1.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_G1.Location = new System.Drawing.Point(17, 21); + this.CHK_G1.Location = new System.Drawing.Point(9, 21); this.CHK_G1.Name = "CHK_G1"; this.CHK_G1.Size = new System.Drawing.Size(55, 17); this.CHK_G1.TabIndex = 280; this.CHK_G1.Text = "Gen 1"; this.CHK_G1.UseVisualStyleBackColor = true; // + // CHK_TypeTheme + // + this.CHK_TypeTheme.AutoSize = true; + this.CHK_TypeTheme.Location = new System.Drawing.Point(8, 74); + this.CHK_TypeTheme.Name = "CHK_TypeTheme"; + this.CHK_TypeTheme.Size = new System.Drawing.Size(130, 17); + this.CHK_TypeTheme.TabIndex = 289; + this.CHK_TypeTheme.Text = "Type Theme Trainers:"; + this.CHK_TypeTheme.UseVisualStyleBackColor = true; + this.CHK_TypeTheme.CheckedChanged += new System.EventHandler(this.CHK_TypeTheme_CheckedChanged); + // + // CHK_StoryMEvos + // + this.CHK_StoryMEvos.AutoSize = true; + this.CHK_StoryMEvos.Checked = true; + this.CHK_StoryMEvos.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_StoryMEvos.Location = new System.Drawing.Point(141, 73); + this.CHK_StoryMEvos.Name = "CHK_StoryMEvos"; + this.CHK_StoryMEvos.Size = new System.Drawing.Size(122, 17); + this.CHK_StoryMEvos.TabIndex = 291; + this.CHK_StoryMEvos.Text = "Ensure Story MEvos"; + this.CHK_StoryMEvos.UseVisualStyleBackColor = true; + // + // CHK_GymTrainers + // + this.CHK_GymTrainers.AutoSize = true; + this.CHK_GymTrainers.Enabled = false; + this.CHK_GymTrainers.Location = new System.Drawing.Point(8, 92); + this.CHK_GymTrainers.Name = "CHK_GymTrainers"; + this.CHK_GymTrainers.Size = new System.Drawing.Size(124, 17); + this.CHK_GymTrainers.TabIndex = 292; + this.CHK_GymTrainers.Text = "Theme Gym Trainers"; + this.CHK_GymTrainers.UseVisualStyleBackColor = true; + // // TrainerRand // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 282); + this.ClientSize = new System.Drawing.Size(294, 377); this.Controls.Add(this.GB_Tweak); this.Controls.Add(this.NUD_GiftPercent); this.Controls.Add(this.CHK_MaxDiffAI); @@ -437,5 +477,8 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_G3; private System.Windows.Forms.CheckBox CHK_G2; private System.Windows.Forms.CheckBox CHK_G1; + private System.Windows.Forms.CheckBox CHK_TypeTheme; + private System.Windows.Forms.CheckBox CHK_StoryMEvos; + private System.Windows.Forms.CheckBox CHK_GymTrainers; } } \ No newline at end of file diff --git a/pk3DS/Subforms/TrainerRand.cs b/pk3DS/Subforms/TrainerRand.cs index 09a5099..6cc113f 100644 --- a/pk3DS/Subforms/TrainerRand.cs +++ b/pk3DS/Subforms/TrainerRand.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Windows.Forms; namespace pk3DS @@ -8,8 +9,19 @@ public partial class TrainerRand : Form public TrainerRand() { InitializeComponent(); + trClassnorep = new List(); + foreach (string tclass in trClass) + { + if (!trClassnorep.Contains(tclass) && !tclass.StartsWith("[~")) + trClassnorep.Add(tclass); + } + trClassnorep.Sort(); } + private string[] trName = Main.getText((Main.oras) ? 22 : 21); + private string[] trClass = Main.getText((Main.oras) ? 21 : 20); + private List trClassnorep; + private void B_Close_Click(object sender, EventArgs e) { Close(); @@ -31,6 +43,19 @@ private void B_Save_Click(object sender, EventArgs e) 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[] { 557, 913, 942, 178, 235, 583, 713, 687, 698, 909, 910, 911, 912, 913 }) : (new int[] { }); + } + else + { + RSTE.rEnsureMEvo = new int[] { }; + } + + RSTE.rThemedClasses = new bool[trClass.Length]; RSTE.rDoRand = true; Close(); @@ -64,5 +89,13 @@ private void changeGiftPercent(object sender, EventArgs e) { CHK_RandomGift.Checked = (NUD_GiftPercent.Value != 0); } + + private void CHK_TypeTheme_CheckedChanged(object sender, EventArgs e) + { + CHK_BST.Enabled = !CHK_TypeTheme.Checked; + CHK_GymTrainers.Enabled = CHK_GymTrainers.Checked = CHK_TypeTheme.Checked; + if (CHK_TypeTheme.Checked) + CHK_BST.Checked = false; + } } } \ No newline at end of file