diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index a2bd17b..a1f6f95 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -302,5 +302,10 @@ public static partial class Legal { 804, 805, 806, 807, }).ToArray(); + public static readonly int[] Legendary_Mythical = + { + 144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638, + 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 804, 805, 806, 807 + }; } } diff --git a/pk3DS/Subforms/Gen6/RSTE.Designer.cs b/pk3DS/Subforms/Gen6/RSTE.Designer.cs index f82f0fe..d67155d 100644 --- a/pk3DS/Subforms/Gen6/RSTE.Designer.cs +++ b/pk3DS/Subforms/Gen6/RSTE.Designer.cs @@ -303,7 +303,7 @@ private void InitializeComponent() // checkBox_Healer // this.checkBox_Healer.AutoSize = true; - this.checkBox_Healer.Location = new System.Drawing.Point(7, 35); + this.checkBox_Healer.Location = new System.Drawing.Point(7, 49); this.checkBox_Healer.Name = "checkBox_Healer"; this.checkBox_Healer.Size = new System.Drawing.Size(57, 17); this.checkBox_Healer.TabIndex = 58; @@ -415,7 +415,7 @@ private void InitializeComponent() // checkBox_Moves // this.checkBox_Moves.AutoSize = true; - this.checkBox_Moves.Location = new System.Drawing.Point(7, 58); + this.checkBox_Moves.Location = new System.Drawing.Point(7, 65); this.checkBox_Moves.Name = "checkBox_Moves"; this.checkBox_Moves.Size = new System.Drawing.Size(58, 17); this.checkBox_Moves.TabIndex = 40; diff --git a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs index eeab75a..751dcce 100644 --- a/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs +++ b/pk3DS/Subforms/Gen6/TrainerRand.Designer.cs @@ -113,9 +113,9 @@ private void InitializeComponent() this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_RandomAbilities.Location = new System.Drawing.Point(21, 339); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; - this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); + this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 7; - this.CHK_RandomAbilities.Text = "Random Abilities (Including Hidden)"; + this.CHK_RandomAbilities.Text = "Random Abilities (1, 2, or Hidden)"; this.CHK_RandomAbilities.UseVisualStyleBackColor = true; // // CHK_RandomGift diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 969d2e4..d35c328 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -168,6 +168,8 @@ private void InitializeComponent() this.CHK_BST = new System.Windows.Forms.CheckBox(); this.CHK_RandomPKM = new System.Windows.Forms.CheckBox(); this.Tab_PKM2 = new System.Windows.Forms.TabPage(); + this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); + this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); this.CHK_NoFixedDamage = new System.Windows.Forms.CheckBox(); this.CHK_BeneficialEVs = new System.Windows.Forms.CheckBox(); this.L_Moves = new System.Windows.Forms.Label(); @@ -191,8 +193,8 @@ private void InitializeComponent() this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); - this.NUD_ForceHighPower = new System.Windows.Forms.NumericUpDown(); - this.CHK_ForceHighPower = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox(); + this.CHK_ReplaceMega = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -237,13 +239,13 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Shiny)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit(); this.Tab_PKM2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); this.Tab_Trainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).BeginInit(); this.SuspendLayout(); // // CB_TrainerID @@ -1832,6 +1834,35 @@ private void InitializeComponent() this.Tab_PKM2.Text = "Stats/Moves"; this.Tab_PKM2.UseVisualStyleBackColor = true; // + // CHK_ForceHighPower + // + this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.CHK_ForceHighPower.AutoSize = true; + this.CHK_ForceHighPower.Location = new System.Drawing.Point(6, 26); + this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; + this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); + this.CHK_ForceHighPower.TabIndex = 342; + this.CHK_ForceHighPower.Text = "Force High-Powered Attacks at Level"; + this.CHK_ForceHighPower.UseVisualStyleBackColor = true; + // + // NUD_ForceHighPower + // + this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.NUD_ForceHighPower.Location = new System.Drawing.Point(211, 24); + this.NUD_ForceHighPower.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; + this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); + this.NUD_ForceHighPower.TabIndex = 341; + this.NUD_ForceHighPower.Value = new decimal(new int[] { + 50, + 0, + 0, + 0}); + // // CHK_NoFixedDamage // this.CHK_NoFixedDamage.AutoSize = true; @@ -1921,9 +1952,9 @@ private void InitializeComponent() this.CHK_RandomAbilities.CheckState = System.Windows.Forms.CheckState.Checked; this.CHK_RandomAbilities.Location = new System.Drawing.Point(6, 118); this.CHK_RandomAbilities.Name = "CHK_RandomAbilities"; - this.CHK_RandomAbilities.Size = new System.Drawing.Size(193, 17); + this.CHK_RandomAbilities.Size = new System.Drawing.Size(183, 17); this.CHK_RandomAbilities.TabIndex = 331; - this.CHK_RandomAbilities.Text = "Random Abilities (Including Hidden)"; + this.CHK_RandomAbilities.Text = "Random Abilities (1, 2, or Hidden)"; this.CHK_RandomAbilities.UseVisualStyleBackColor = true; // // NUD_STAB @@ -1987,6 +2018,8 @@ private void InitializeComponent() // // Tab_Trainer1 // + this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceMega); + this.Tab_Trainer1.Controls.Add(this.CHK_ReplaceLegend); this.Tab_Trainer1.Controls.Add(this.CHK_6PKM); this.Tab_Trainer1.Controls.Add(this.NUD_ForceFullyEvolved); this.Tab_Trainer1.Controls.Add(this.CHK_ForceFullyEvolved); @@ -2009,7 +2042,7 @@ private void InitializeComponent() // this.CHK_6PKM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_6PKM.AutoSize = true; - this.CHK_6PKM.Location = new System.Drawing.Point(6, 94); + this.CHK_6PKM.Location = new System.Drawing.Point(6, 104); this.CHK_6PKM.Name = "CHK_6PKM"; this.CHK_6PKM.Size = new System.Drawing.Size(183, 17); this.CHK_6PKM.TabIndex = 341; @@ -2018,7 +2051,7 @@ private void InitializeComponent() // // NUD_ForceFullyEvolved // - this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 111); + this.NUD_ForceFullyEvolved.Location = new System.Drawing.Point(165, 71); this.NUD_ForceFullyEvolved.Minimum = new decimal(new int[] { 1, 0, @@ -2037,7 +2070,7 @@ private void InitializeComponent() // this.CHK_ForceFullyEvolved.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_ForceFullyEvolved.AutoSize = true; - this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 113); + this.CHK_ForceFullyEvolved.Location = new System.Drawing.Point(6, 73); this.CHK_ForceFullyEvolved.Name = "CHK_ForceFullyEvolved"; this.CHK_ForceFullyEvolved.Size = new System.Drawing.Size(160, 17); this.CHK_ForceFullyEvolved.TabIndex = 339; @@ -2110,7 +2143,7 @@ private void InitializeComponent() // this.CHK_RandomMegaForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_RandomMegaForm.AutoSize = true; - this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 76); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 89); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(127, 17); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2157,34 +2190,31 @@ private void InitializeComponent() this.CHK_RandomClass.UseVisualStyleBackColor = true; this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); // - // NUD_ForceHighPower + // CHK_ReplaceLegend // - this.NUD_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_ForceHighPower.Location = new System.Drawing.Point(211, 24); - this.NUD_ForceHighPower.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.NUD_ForceHighPower.Name = "NUD_ForceHighPower"; - this.NUD_ForceHighPower.Size = new System.Drawing.Size(35, 20); - this.NUD_ForceHighPower.TabIndex = 341; - this.NUD_ForceHighPower.Value = new decimal(new int[] { - 50, - 0, - 0, - 0}); + this.CHK_ReplaceLegend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ReplaceLegend.AutoSize = true; + this.CHK_ReplaceLegend.Checked = true; + this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceLegend.Location = new System.Drawing.Point(6, 53); + this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend"; + this.CHK_ReplaceLegend.Size = new System.Drawing.Size(257, 17); + this.CHK_ReplaceLegend.TabIndex = 342; + this.CHK_ReplaceLegend.Text = "Team Rainbow Rocket Legendary-for-Legendary"; + this.CHK_ReplaceLegend.UseVisualStyleBackColor = true; // - // CHK_ForceHighPower + // CHK_ReplaceMega // - this.CHK_ForceHighPower.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.CHK_ForceHighPower.AutoSize = true; - this.CHK_ForceHighPower.Location = new System.Drawing.Point(6, 26); - this.CHK_ForceHighPower.Name = "CHK_ForceHighPower"; - this.CHK_ForceHighPower.Size = new System.Drawing.Size(203, 17); - this.CHK_ForceHighPower.TabIndex = 342; - this.CHK_ForceHighPower.Text = "Force High-Powered Attacks at Level"; - this.CHK_ForceHighPower.UseVisualStyleBackColor = true; + this.CHK_ReplaceMega.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.CHK_ReplaceMega.AutoSize = true; + this.CHK_ReplaceMega.Checked = true; + this.CHK_ReplaceMega.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_ReplaceMega.Location = new System.Drawing.Point(6, 119); + this.CHK_ReplaceMega.Name = "CHK_ReplaceMega"; + this.CHK_ReplaceMega.Size = new System.Drawing.Size(196, 17); + this.CHK_ReplaceMega.TabIndex = 343; + this.CHK_ReplaceMega.Text = "Ensure Post-Game Mega Evolutions"; + this.CHK_ReplaceMega.UseVisualStyleBackColor = true; // // SMTE // @@ -2259,6 +2289,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit(); this.Tab_PKM2.ResumeLayout(false); this.Tab_PKM2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); this.Tab_Trainer1.ResumeLayout(false); @@ -2266,7 +2297,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceFullyEvolved)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ForceHighPower)).EndInit(); this.ResumeLayout(false); } @@ -2436,6 +2466,8 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_6PKM; private System.Windows.Forms.CheckBox CHK_ForceHighPower; private System.Windows.Forms.NumericUpDown NUD_ForceHighPower; + private System.Windows.Forms.CheckBox CHK_ReplaceLegend; + private System.Windows.Forms.CheckBox CHK_ReplaceMega; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index a8eaf71..b93f979 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -21,6 +21,8 @@ public partial class SMTE : Form private static int[] TrainerClasses; private static int[] ImportantTrainers; private static int[] FinalEvo; + private static int[] ReplaceLegend; + private static Dictionary MegaDictionary; private int index = -1; private PictureBox[] pba; @@ -56,10 +58,13 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp) CB_TrainerID.SelectedIndex = 0; CB_Moves.SelectedIndex = 0; + CHK_ReplaceLegend.Visible = Main.Config.USUM; // Team Rainbow Rocket only in USUM + MegaDictionary = GiftEditor6.GetMegaDictionary(Main.Config); TrainerClasses = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM; ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM; FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM; + ReplaceLegend = Legal.Legendary_Mythical; RandSettings.GetFormSettings(this, Tab_Misc.Controls); } @@ -671,8 +676,33 @@ private void B_Randomize_Click(object sender, EventArgs e) if (CHK_RandomPKM.Checked) { int Type = CHK_TypeTheme.Checked ? (int)Util.rnd32() % 17 : -1; - pk.Species = rnd.GetRandomSpeciesType(pk.Species, Type); - pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + + // replaces Megas with another Mega (Dexio and Lysandre in USUM) + if (MegaDictionary.Values.Any(z => z.Contains(pk.Item))) + { + int species = pk.Species; + int[] mega = GetRandomMega(out species); + pk.Species = species; + pk.Item = mega[Util.rand.Next(0, mega.Length)]; + pk.Form = 0; // allow it to Mega Evolve naturally + } + + // replaces Team Rainbow Rocket Legendaries with another Legendary + else if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(pk.Species)) + { + int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); + pk.Species = ReplaceLegend[randLegend()]; + pk.Item = items[Util.rnd32() % items.Length]; + pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + } + + // every other pkm + else + { + pk.Species = rnd.GetRandomSpeciesType(pk.Species, Type); + pk.Item = items[Util.rnd32() % items.Length]; + pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + } pk.Gender = 0; // random pk.Nature = (int)(Util.rnd32() % CB_Nature.Items.Count); // random } @@ -680,10 +710,8 @@ private void B_Randomize_Click(object sender, EventArgs e) pk.Level = Randomizer.getModifiedLevel(pk.Level, NUD_LevelBoost.Value); if (CHK_RandomShiny.Checked) pk.Shiny = Util.rand.Next(0, 100 + 1) < NUD_Shiny.Value; - if (CHK_RandomItems.Checked) - pk.Item = items[Util.rnd32()%items.Length]; if (CHK_RandomAbilities.Checked) - pk.Ability = (int)Util.rnd32()%4; + pk.Ability = (int)Util.rnd32() % 4; if (CHK_MaxDiffPKM.Checked) pk.IVs = new[] {31, 31, 31, 31, 31, 31}; @@ -783,5 +811,11 @@ private void CHK_Level_CheckedChanged(object sender, EventArgs e) { NUD_LevelBoost.Enabled = CHK_Level.Checked; } + private int[] GetRandomMega(out int species) + { + int rnd = Util.rand.Next(0, MegaDictionary.Count - 1); + species = MegaDictionary.Keys.ElementAt(rnd); + return MegaDictionary.Values.ElementAt(rnd); + } } }