From 3b2bd96d3c58d17e1341f1417c518ea1702af855 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 10 Dec 2016 18:05:17 -0800 Subject: [PATCH] Finish SMTE randomization functionality --- pk3DS/Legality/Legal.cs | 45 ++++++ pk3DS/Structures/Gen7/trdata7.cs | 9 +- pk3DS/Subforms/Gen7/SMTE.Designer.cs | 191 ++++------------------ pk3DS/Subforms/Gen7/SMTE.cs | 100 ++++++++---- pk3DS/Subforms/Gen7/SMTE.resx | 228 --------------------------- 5 files changed, 159 insertions(+), 414 deletions(-) diff --git a/pk3DS/Legality/Legal.cs b/pk3DS/Legality/Legal.cs index 55f48cd..d4af29e 100644 --- a/pk3DS/Legality/Legal.cs +++ b/pk3DS/Legality/Legal.cs @@ -214,6 +214,51 @@ class Legal 279, // Pokémon Trainer #endregion }; + + internal static readonly int[] SpecialClasses_SM = + { + 030, // Pokémon Trainer: Hau + 031, // Island Kahuna: Hala + 038, // Captain: Ilima + 042, // Trial Guide: Ben + 044, // Captain: Lana + 045, // Captain: Mallow + 049, // Island Kahuna: Olivia + 051, // Island Kahuna: Hapu + 071, // Aether President: Lusamine + 072, // Aether Branch Chief: Faba + 076, // Team Skull Boss: Guzma + 078, // Team Skull Admin: Plumeria + 079, // Pokémon Trainer: Plumeria + 080, // Elite Four: Kahili + 081, // Pokémon Trainer: [~ 157] + 082, // Aether President: Lusamine + 083, // Pokémon Trainer: Red + 084, // Pokémon Trainer: Blue + 085, // Pokémon Trainer: Sina + 086, // Pokémon Trainer: Dexio + 088, // Pokémon Trainer: Anabel + 092, // Pro Wrestler: The Royal + 093, // Pokémon Trainer: Molayne + 099, // Pokémon Trainer: Molayne + 100, // Pokémon Trainer: Hau + 101, // Pokémon Trainer: Hau + 102, // Pokémon Trainer: Gladion + 103, // Pokémon Trainer: Gladion + 107, // Elite Four: Acerola + 109, // Elite Four: Hala + 110, // Elite Four: Olivia + 111, // Pokémon Professor: Kukui + 139, // GAME FREAK: Morimoto + 141, // Island Kahuna: Nanu + 142, // Captain: Sophocles + 143, // Pokémon Trainer: Ryuki + 153, // Captain: Mina + 162, // Aether Foundation: Faba + 164, // Island Kahuna: Hapu + 165, // Pokémon Professor: Kukui + 185, // Aether Foundation: Faba + }; internal static readonly int[] Z_Moves = { 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, diff --git a/pk3DS/Structures/Gen7/trdata7.cs b/pk3DS/Structures/Gen7/trdata7.cs index 06088d2..190835d 100644 --- a/pk3DS/Structures/Gen7/trdata7.cs +++ b/pk3DS/Structures/Gen7/trdata7.cs @@ -25,8 +25,15 @@ public trdata7(byte[] tr = null, byte[] tp = null) } public byte TrainerClass { get { return trdata[0]; } set { trdata[0] = value; } } - public int NumPokemon { get { return trdata[3]; } set { trdata[3] = (byte)(value%7); } } + public int Item1 { get { return BitConverter.ToUInt16(trdata, 0x04); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x04); } } + public int Item2 { get { return BitConverter.ToUInt16(trdata, 0x06); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x06); } } + public int Item3 { get { return BitConverter.ToUInt16(trdata, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x08); } } + public int Item4 { get { return BitConverter.ToUInt16(trdata, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x0A); } } + + public int AI { get { return trdata[0x0C]; } set { trdata[0x0C] = (byte)value; } } + public bool Flag { get { return trdata[0x0D] == 1; } set { trdata[0x0D] = (byte)(value ? 1 : 0); } } + public int Money { get { return trdata[0x11]; } set { trdata[0x11] = (byte)value; } } public void Write(out byte[] tr, out byte[] pk) { diff --git a/pk3DS/Subforms/Gen7/SMTE.Designer.cs b/pk3DS/Subforms/Gen7/SMTE.Designer.cs index 10a7687..cc66136 100644 --- a/pk3DS/Subforms/Gen7/SMTE.Designer.cs +++ b/pk3DS/Subforms/Gen7/SMTE.Designer.cs @@ -30,13 +30,9 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.CB_TrainerID = new System.Windows.Forms.ComboBox(); - this.L_TPrize = new System.Windows.Forms.Label(); - this.CB_Prize = new System.Windows.Forms.ComboBox(); this.L_AI = new System.Windows.Forms.Label(); this.L_Money = new System.Windows.Forms.Label(); this.CB_Money = new System.Windows.Forms.ComboBox(); - this.L_Battle_Type = new System.Windows.Forms.Label(); - this.CB_Battle_Type = new System.Windows.Forms.ComboBox(); this.L_Trainer_Class = new System.Windows.Forms.Label(); this.CB_Trainer_Class = new System.Windows.Forms.ComboBox(); this.L_Item_4 = new System.Windows.Forms.Label(); @@ -183,19 +179,15 @@ private void InitializeComponent() this.CHK_RandomItems = new System.Windows.Forms.CheckBox(); this.CHK_STAB = new System.Windows.Forms.CheckBox(); this.Tab_Trainer1 = new System.Windows.Forms.TabPage(); - this.CHK_OnlyDoubles = new System.Windows.Forms.CheckBox(); - this.CHK_RandomGift = new System.Windows.Forms.CheckBox(); - this.L_GiftPCT = new System.Windows.Forms.Label(); - this.NUD_GiftPercent = new System.Windows.Forms.NumericUpDown(); this.L_MinPKM = new System.Windows.Forms.Label(); this.L_MaxPKM = new System.Windows.Forms.Label(); this.NUD_RMin = new System.Windows.Forms.NumericUpDown(); this.NUD_RMax = new System.Windows.Forms.NumericUpDown(); this.CHK_RandomMegaForm = new System.Windows.Forms.CheckBox(); this.CHK_TypeTheme = new System.Windows.Forms.CheckBox(); - this.CHK_OnlySingles = new System.Windows.Forms.CheckBox(); this.CHK_IgnoreSpecialClass = new System.Windows.Forms.CheckBox(); this.CHK_RandomClass = new System.Windows.Forms.CheckBox(); + this.CHK_Flag = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team1)).BeginInit(); this.mnuVSD.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Team2)).BeginInit(); @@ -243,7 +235,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit(); this.Tab_Trainer1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).BeginInit(); this.SuspendLayout(); @@ -261,30 +252,9 @@ private void InitializeComponent() this.CB_TrainerID.TabIndex = 64; this.CB_TrainerID.SelectedIndexChanged += new System.EventHandler(this.changeTrainerIndex); // - // L_TPrize - // - this.L_TPrize.AutoSize = true; - this.L_TPrize.Location = new System.Drawing.Point(167, 116); - this.L_TPrize.Name = "L_TPrize"; - this.L_TPrize.Size = new System.Drawing.Size(33, 13); - this.L_TPrize.TabIndex = 57; - this.L_TPrize.Text = "Prize:"; - // - // CB_Prize - // - this.CB_Prize.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; - this.CB_Prize.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Prize.Enabled = false; - this.CB_Prize.FormattingEnabled = true; - this.CB_Prize.Location = new System.Drawing.Point(206, 113); - this.CB_Prize.Name = "CB_Prize"; - this.CB_Prize.Size = new System.Drawing.Size(99, 21); - this.CB_Prize.TabIndex = 56; - // // L_AI // this.L_AI.AutoSize = true; - this.L_AI.Enabled = false; this.L_AI.Location = new System.Drawing.Point(217, 54); this.L_AI.Name = "L_AI"; this.L_AI.Size = new System.Drawing.Size(38, 13); @@ -294,8 +264,7 @@ private void InitializeComponent() // L_Money // this.L_Money.AutoSize = true; - this.L_Money.Enabled = false; - this.L_Money.Location = new System.Drawing.Point(181, 94); + this.L_Money.Location = new System.Drawing.Point(40, 54); this.L_Money.Name = "L_Money"; this.L_Money.Size = new System.Drawing.Size(42, 13); this.L_Money.TabIndex = 53; @@ -305,40 +274,12 @@ private void InitializeComponent() // this.CB_Money.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.CB_Money.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Money.Enabled = false; this.CB_Money.FormattingEnabled = true; - this.CB_Money.Location = new System.Drawing.Point(231, 91); + this.CB_Money.Location = new System.Drawing.Point(90, 51); this.CB_Money.Name = "CB_Money"; - this.CB_Money.Size = new System.Drawing.Size(74, 21); + this.CB_Money.Size = new System.Drawing.Size(70, 21); this.CB_Money.TabIndex = 52; // - // L_Battle_Type - // - this.L_Battle_Type.AutoSize = true; - this.L_Battle_Type.Enabled = false; - this.L_Battle_Type.Location = new System.Drawing.Point(20, 54); - this.L_Battle_Type.Name = "L_Battle_Type"; - this.L_Battle_Type.Size = new System.Drawing.Size(64, 13); - this.L_Battle_Type.TabIndex = 51; - this.L_Battle_Type.Text = "Battle Type:"; - // - // CB_Battle_Type - // - this.CB_Battle_Type.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this.CB_Battle_Type.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Battle_Type.Enabled = false; - this.CB_Battle_Type.FormattingEnabled = true; - this.CB_Battle_Type.Items.AddRange(new object[] { - "Single Battle", - "Double Battle", - "Triple Battle", - "Rotation Battle", - "Horde Battle"}); - this.CB_Battle_Type.Location = new System.Drawing.Point(90, 51); - this.CB_Battle_Type.Name = "CB_Battle_Type"; - this.CB_Battle_Type.Size = new System.Drawing.Size(116, 21); - this.CB_Battle_Type.TabIndex = 50; - // // L_Trainer_Class // this.L_Trainer_Class.AutoSize = true; @@ -362,7 +303,6 @@ private void InitializeComponent() // L_Item_4 // this.L_Item_4.AutoSize = true; - this.L_Item_4.Enabled = false; this.L_Item_4.Location = new System.Drawing.Point(16, 160); this.L_Item_4.Name = "L_Item_4"; this.L_Item_4.Size = new System.Drawing.Size(39, 13); @@ -373,7 +313,6 @@ private void InitializeComponent() // this.CB_Item_4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Item_4.Enabled = false; this.CB_Item_4.FormattingEnabled = true; this.CB_Item_4.Location = new System.Drawing.Point(61, 157); this.CB_Item_4.Name = "CB_Item_4"; @@ -383,7 +322,6 @@ private void InitializeComponent() // L_Item_3 // this.L_Item_3.AutoSize = true; - this.L_Item_3.Enabled = false; this.L_Item_3.Location = new System.Drawing.Point(16, 138); this.L_Item_3.Name = "L_Item_3"; this.L_Item_3.Size = new System.Drawing.Size(39, 13); @@ -394,7 +332,6 @@ private void InitializeComponent() // this.CB_Item_3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Item_3.Enabled = false; this.CB_Item_3.FormattingEnabled = true; this.CB_Item_3.Location = new System.Drawing.Point(61, 135); this.CB_Item_3.Name = "CB_Item_3"; @@ -404,7 +341,6 @@ private void InitializeComponent() // L_Item_2 // this.L_Item_2.AutoSize = true; - this.L_Item_2.Enabled = false; this.L_Item_2.Location = new System.Drawing.Point(16, 116); this.L_Item_2.Name = "L_Item_2"; this.L_Item_2.Size = new System.Drawing.Size(39, 13); @@ -415,7 +351,6 @@ private void InitializeComponent() // this.CB_Item_2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Item_2.Enabled = false; this.CB_Item_2.FormattingEnabled = true; this.CB_Item_2.Location = new System.Drawing.Point(61, 113); this.CB_Item_2.Name = "CB_Item_2"; @@ -425,7 +360,6 @@ private void InitializeComponent() // L_Item_1 // this.L_Item_1.AutoSize = true; - this.L_Item_1.Enabled = false; this.L_Item_1.Location = new System.Drawing.Point(16, 94); this.L_Item_1.Name = "L_Item_1"; this.L_Item_1.Size = new System.Drawing.Size(39, 13); @@ -436,7 +370,6 @@ private void InitializeComponent() // this.CB_Item_1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.CB_Item_1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Item_1.Enabled = false; this.CB_Item_1.FormattingEnabled = true; this.CB_Item_1.Location = new System.Drawing.Point(61, 91); this.CB_Item_1.Name = "CB_Item_1"; @@ -1532,9 +1465,11 @@ private void InitializeComponent() // TB_TrainerName // this.TB_TrainerName.Location = new System.Drawing.Point(90, 8); + this.TB_TrainerName.MaxLength = 50; this.TB_TrainerName.Name = "TB_TrainerName"; this.TB_TrainerName.Size = new System.Drawing.Size(116, 20); this.TB_TrainerName.TabIndex = 35; + this.TB_TrainerName.TextChanged += new System.EventHandler(this.updateTrainerName); // // NUD_NumPoke // @@ -1563,14 +1498,11 @@ private void InitializeComponent() // // Tab_Trainer // + this.Tab_Trainer.Controls.Add(this.CHK_Flag); this.Tab_Trainer.Controls.Add(this.NUD_AI); this.Tab_Trainer.Controls.Add(this.L_AI); this.Tab_Trainer.Controls.Add(this.TB_TrainerName); - this.Tab_Trainer.Controls.Add(this.CB_Battle_Type); - this.Tab_Trainer.Controls.Add(this.L_Battle_Type); - this.Tab_Trainer.Controls.Add(this.L_TPrize); this.Tab_Trainer.Controls.Add(this.L_Trainer_Class); - this.Tab_Trainer.Controls.Add(this.CB_Prize); this.Tab_Trainer.Controls.Add(this.CB_Item_1); this.Tab_Trainer.Controls.Add(this.CB_Trainer_Class); this.Tab_Trainer.Controls.Add(this.L_Money); @@ -1688,6 +1620,7 @@ private void InitializeComponent() this.CHK_RandomShiny.TabIndex = 303; this.CHK_RandomShiny.Text = "Random Shinies"; this.CHK_RandomShiny.UseVisualStyleBackColor = true; + this.CHK_RandomShiny.CheckedChanged += new System.EventHandler(this.CHK_RandomShiny_CheckedChanged); // // CHK_E // @@ -1822,6 +1755,7 @@ private void InitializeComponent() this.CHK_Level.TabIndex = 300; this.CHK_Level.Text = "Level Boost Multiplier"; this.CHK_Level.UseVisualStyleBackColor = true; + this.CHK_Level.CheckedChanged += new System.EventHandler(this.CHK_Level_CheckedChanged); // // CHK_G1 // @@ -1858,6 +1792,7 @@ private void InitializeComponent() this.CHK_RandomPKM.TabIndex = 299; this.CHK_RandomPKM.Text = "Random Pokemon"; this.CHK_RandomPKM.UseVisualStyleBackColor = true; + this.CHK_RandomPKM.CheckedChanged += new System.EventHandler(this.CHK_RandomPKM_CheckedChanged); // // Tab_PKM2 // @@ -1916,6 +1851,7 @@ private void InitializeComponent() this.CB_Moves.Name = "CB_Moves"; this.CB_Moves.Size = new System.Drawing.Size(121, 21); this.CB_Moves.TabIndex = 337; + this.CB_Moves.SelectedIndexChanged += new System.EventHandler(this.CB_Moves_SelectedIndexChanged); // // CHK_MaxDiffPKM // @@ -1991,6 +1927,7 @@ private void InitializeComponent() this.CHK_Damage.TabIndex = 334; this.CHK_Damage.Text = "Ensure at least # Damaging Moves"; this.CHK_Damage.UseVisualStyleBackColor = true; + this.CHK_Damage.CheckedChanged += new System.EventHandler(this.CHK_Damage_CheckedChanged); // // CHK_RandomItems // @@ -2017,20 +1954,16 @@ private void InitializeComponent() this.CHK_STAB.TabIndex = 335; this.CHK_STAB.Text = "Ensure at least # STAB Moves"; this.CHK_STAB.UseVisualStyleBackColor = true; + this.CHK_STAB.CheckedChanged += new System.EventHandler(this.CHK_STAB_CheckedChanged); // // Tab_Trainer1 // - this.Tab_Trainer1.Controls.Add(this.CHK_OnlyDoubles); - this.Tab_Trainer1.Controls.Add(this.CHK_RandomGift); - this.Tab_Trainer1.Controls.Add(this.L_GiftPCT); - this.Tab_Trainer1.Controls.Add(this.NUD_GiftPercent); this.Tab_Trainer1.Controls.Add(this.L_MinPKM); this.Tab_Trainer1.Controls.Add(this.L_MaxPKM); this.Tab_Trainer1.Controls.Add(this.NUD_RMin); this.Tab_Trainer1.Controls.Add(this.NUD_RMax); this.Tab_Trainer1.Controls.Add(this.CHK_RandomMegaForm); this.Tab_Trainer1.Controls.Add(this.CHK_TypeTheme); - this.Tab_Trainer1.Controls.Add(this.CHK_OnlySingles); this.Tab_Trainer1.Controls.Add(this.CHK_IgnoreSpecialClass); this.Tab_Trainer1.Controls.Add(this.CHK_RandomClass); this.Tab_Trainer1.Location = new System.Drawing.Point(4, 22); @@ -2040,58 +1973,9 @@ private void InitializeComponent() this.Tab_Trainer1.Text = "Trainer"; this.Tab_Trainer1.UseVisualStyleBackColor = true; // - // CHK_OnlyDoubles - // - this.CHK_OnlyDoubles.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.CHK_OnlyDoubles.AutoSize = true; - this.CHK_OnlyDoubles.Checked = true; - this.CHK_OnlyDoubles.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_OnlyDoubles.Location = new System.Drawing.Point(6, 45); - this.CHK_OnlyDoubles.Name = "CHK_OnlyDoubles"; - this.CHK_OnlyDoubles.Size = new System.Drawing.Size(119, 17); - this.CHK_OnlyDoubles.TabIndex = 342; - this.CHK_OnlyDoubles.Text = "Only Double Battles"; - this.CHK_OnlyDoubles.UseVisualStyleBackColor = true; - // - // CHK_RandomGift - // - this.CHK_RandomGift.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - 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(6, 116); - this.CHK_RandomGift.Name = "CHK_RandomGift"; - this.CHK_RandomGift.Size = new System.Drawing.Size(145, 17); - this.CHK_RandomGift.TabIndex = 339; - this.CHK_RandomGift.Text = "Random After-Battle Gifts"; - this.CHK_RandomGift.UseVisualStyleBackColor = true; - // - // L_GiftPCT - // - this.L_GiftPCT.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.L_GiftPCT.AutoSize = true; - this.L_GiftPCT.Location = new System.Drawing.Point(196, 117); - this.L_GiftPCT.Name = "L_GiftPCT"; - this.L_GiftPCT.Size = new System.Drawing.Size(15, 13); - this.L_GiftPCT.TabIndex = 341; - this.L_GiftPCT.Text = "%"; - // - // NUD_GiftPercent - // - this.NUD_GiftPercent.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.NUD_GiftPercent.Location = new System.Drawing.Point(151, 115); - this.NUD_GiftPercent.Name = "NUD_GiftPercent"; - this.NUD_GiftPercent.Size = new System.Drawing.Size(43, 20); - this.NUD_GiftPercent.TabIndex = 340; - this.NUD_GiftPercent.Value = new decimal(new int[] { - 15, - 0, - 0, - 0}); - // // L_MinPKM // - this.L_MinPKM.Location = new System.Drawing.Point(178, 14); + this.L_MinPKM.Location = new System.Drawing.Point(191, 1); this.L_MinPKM.Name = "L_MinPKM"; this.L_MinPKM.Size = new System.Drawing.Size(60, 20); this.L_MinPKM.TabIndex = 338; @@ -2100,7 +1984,7 @@ private void InitializeComponent() // // L_MaxPKM // - this.L_MaxPKM.Location = new System.Drawing.Point(178, 36); + this.L_MaxPKM.Location = new System.Drawing.Point(191, 23); this.L_MaxPKM.Name = "L_MaxPKM"; this.L_MaxPKM.Size = new System.Drawing.Size(60, 20); this.L_MaxPKM.TabIndex = 337; @@ -2109,7 +1993,7 @@ private void InitializeComponent() // // NUD_RMin // - this.NUD_RMin.Location = new System.Drawing.Point(244, 16); + this.NUD_RMin.Location = new System.Drawing.Point(257, 3); this.NUD_RMin.Maximum = new decimal(new int[] { 6, 0, @@ -2131,7 +2015,7 @@ private void InitializeComponent() // // NUD_RMax // - this.NUD_RMax.Location = new System.Drawing.Point(244, 38); + this.NUD_RMax.Location = new System.Drawing.Point(257, 25); this.NUD_RMax.Maximum = new decimal(new int[] { 6, 0, @@ -2155,7 +2039,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(161, 73); + this.CHK_RandomMegaForm.Location = new System.Drawing.Point(6, 55); this.CHK_RandomMegaForm.Name = "CHK_RandomMegaForm"; this.CHK_RandomMegaForm.Size = new System.Drawing.Size(103, 30); this.CHK_RandomMegaForm.TabIndex = 333; @@ -2166,26 +2050,15 @@ private void InitializeComponent() // this.CHK_TypeTheme.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.CHK_TypeTheme.AutoSize = true; - this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 80); + this.CHK_TypeTheme.Checked = true; + this.CHK_TypeTheme.CheckState = System.Windows.Forms.CheckState.Checked; + this.CHK_TypeTheme.Location = new System.Drawing.Point(6, 32); this.CHK_TypeTheme.Name = "CHK_TypeTheme"; this.CHK_TypeTheme.Size = new System.Drawing.Size(127, 17); this.CHK_TypeTheme.TabIndex = 329; this.CHK_TypeTheme.Text = "Type Theme Trainers"; this.CHK_TypeTheme.UseVisualStyleBackColor = true; // - // CHK_OnlySingles - // - this.CHK_OnlySingles.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.CHK_OnlySingles.AutoSize = true; - this.CHK_OnlySingles.Checked = true; - this.CHK_OnlySingles.CheckState = System.Windows.Forms.CheckState.Checked; - this.CHK_OnlySingles.Location = new System.Drawing.Point(6, 31); - this.CHK_OnlySingles.Name = "CHK_OnlySingles"; - this.CHK_OnlySingles.Size = new System.Drawing.Size(114, 17); - this.CHK_OnlySingles.TabIndex = 328; - this.CHK_OnlySingles.Text = "Only Single Battles"; - this.CHK_OnlySingles.UseVisualStyleBackColor = true; - // // CHK_IgnoreSpecialClass // this.CHK_IgnoreSpecialClass.Anchor = System.Windows.Forms.AnchorStyles.Bottom; @@ -2211,6 +2084,17 @@ private void InitializeComponent() this.CHK_RandomClass.TabIndex = 326; this.CHK_RandomClass.Text = "Random Trainer Classes"; this.CHK_RandomClass.UseVisualStyleBackColor = true; + this.CHK_RandomClass.CheckedChanged += new System.EventHandler(this.CHK_RandomClass_CheckedChanged); + // + // CHK_Flag + // + this.CHK_Flag.AutoSize = true; + this.CHK_Flag.Location = new System.Drawing.Point(166, 53); + this.CHK_Flag.Name = "CHK_Flag"; + this.CHK_Flag.Size = new System.Drawing.Size(46, 17); + this.CHK_Flag.TabIndex = 451; + this.CHK_Flag.Text = "Flag"; + this.CHK_Flag.UseVisualStyleBackColor = true; // // SMTE // @@ -2289,7 +2173,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit(); this.Tab_Trainer1.ResumeLayout(false); this.Tab_Trainer1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_GiftPercent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_RMax)).EndInit(); this.ResumeLayout(false); @@ -2298,13 +2181,9 @@ private void InitializeComponent() #endregion private System.Windows.Forms.ComboBox CB_TrainerID; - private System.Windows.Forms.Label L_TPrize; - private System.Windows.Forms.ComboBox CB_Prize; private System.Windows.Forms.Label L_AI; private System.Windows.Forms.Label L_Money; private System.Windows.Forms.ComboBox CB_Money; - private System.Windows.Forms.Label L_Battle_Type; - private System.Windows.Forms.ComboBox CB_Battle_Type; private System.Windows.Forms.Label L_Trainer_Class; private System.Windows.Forms.ComboBox CB_Trainer_Class; private System.Windows.Forms.Label L_Item_4; @@ -2422,17 +2301,12 @@ private void InitializeComponent() private System.Windows.Forms.TabPage Tab_Misc; private System.Windows.Forms.CheckBox CHK_RandomClass; private System.Windows.Forms.CheckBox CHK_IgnoreSpecialClass; - private System.Windows.Forms.CheckBox CHK_OnlySingles; private System.Windows.Forms.CheckBox CHK_TypeTheme; private System.Windows.Forms.CheckBox CHK_RandomMegaForm; private System.Windows.Forms.NumericUpDown NUD_RMax; private System.Windows.Forms.NumericUpDown NUD_RMin; private System.Windows.Forms.Label L_MaxPKM; private System.Windows.Forms.Label L_MinPKM; - private System.Windows.Forms.NumericUpDown NUD_GiftPercent; - private System.Windows.Forms.Label L_GiftPCT; - private System.Windows.Forms.CheckBox CHK_RandomGift; - private System.Windows.Forms.CheckBox CHK_OnlyDoubles; private System.Windows.Forms.TabPage Tab_Trainer1; private System.Windows.Forms.CheckBox CHK_STAB; private System.Windows.Forms.CheckBox CHK_RandomItems; @@ -2464,6 +2338,7 @@ private void InitializeComponent() private System.Windows.Forms.TabControl TC_rand; private System.Windows.Forms.CheckBox CHK_Damage; private System.Windows.Forms.NumericUpDown NUD_Damage; + private System.Windows.Forms.CheckBox CHK_Flag; } } diff --git a/pk3DS/Subforms/Gen7/SMTE.cs b/pk3DS/Subforms/Gen7/SMTE.cs index 45a6a91..d965321 100644 --- a/pk3DS/Subforms/Gen7/SMTE.cs +++ b/pk3DS/Subforms/Gen7/SMTE.cs @@ -233,25 +233,18 @@ private void Setup() CB_Item_2.Items.Clear(); CB_Item_3.Items.Clear(); CB_Item_4.Items.Clear(); - CB_Prize.Items.Clear(); foreach (string s in itemlist) { CB_Item_1.Items.Add(s); CB_Item_2.Items.Add(s); CB_Item_3.Items.Add(s); CB_Item_4.Items.Add(s); - CB_Prize.Items.Add(s); } CB_Money.Items.Clear(); for (int i = 0; i < 256; i++) { CB_Money.Items.Add(i.ToString()); } - CB_Battle_Type.Items.Clear(); - CB_Battle_Type.Items.Add("Single"); - CB_Battle_Type.Items.Add("Double"); - CB_Battle_Type.Items.Add("Royal"); - CB_TrainerID.SelectedIndex = 0; index = 0; pkm = new trpoke7(); @@ -283,11 +276,14 @@ private void loadEntry() index = CB_TrainerID.SelectedIndex; var tr = Trainers[index]; + loading = true; TB_TrainerName.Text = trName[index]; populateFieldsTD7(tr); + loading = false; } + private bool loading; private trpoke7 pkm; private void populateFieldsTP7(trpoke7 pk) { @@ -365,12 +361,26 @@ private void populateFieldsTD7(trdata7 tr) // Load Trainer Data CB_Trainer_Class.SelectedIndex = tr.TrainerClass; NUD_NumPoke.Value = tr.NumPokemon; + CB_Item_1.SelectedIndex = tr.Item1; + CB_Item_2.SelectedIndex = tr.Item2; + CB_Item_3.SelectedIndex = tr.Item3; + CB_Item_4.SelectedIndex = tr.Item4; + CB_Money.SelectedIndex = tr.Money; + NUD_AI.Value = tr.AI; + CHK_Flag.Checked = tr.Flag; populateTeam(tr); } private void prepareTR7(trdata7 tr) { tr.TrainerClass = (byte)CB_Trainer_Class.SelectedIndex; tr.NumPokemon = (byte)NUD_NumPoke.Value; + tr.Item1 = CB_Item_1.SelectedIndex; + tr.Item2 = CB_Item_2.SelectedIndex; + tr.Item3 = CB_Item_3.SelectedIndex; + tr.Item4 = CB_Item_4.SelectedIndex; + tr.Money = CB_Money.SelectedIndex; + tr.AI = (int)NUD_AI.Value; + tr.Flag = CHK_Flag.Checked; } private static int[] getHighAttacks(trpoke7 pk) { @@ -442,6 +452,12 @@ private void updateNumPokemon(object sender, EventArgs e) return; Trainers[index].NumPokemon = (int) (NUD_NumPoke.Value); } + private void updateTrainerName(object sender, EventArgs e) + { + if (loading) + return; + CB_TrainerID.Items[index] = $"{TB_TrainerName.Text} - {index:000}"; + } private static bool updatingStats; @@ -569,25 +585,18 @@ private void B_Randomize_Click(object sender, EventArgs e) }; var items = Randomizer.getRandomItemList(); - foreach (var tr in Trainers) + foreach (var tr in Trainers.Where(tr => tr.Pokemon.Count != 0)) { - if (tr.Pokemon.Count == 0) - continue; // Trainer Properties - if (CHK_OnlyDoubles.Checked) - { } - else if (CHK_OnlySingles.Checked) - { } - - if (CHK_RandomGift.Checked && Util.rnd32() < NUD_GiftPercent.Value) - { } - if (CHK_RandomClass.Checked) { - if (CHK_IgnoreSpecialClass.Checked) - { } - else - { } + int rv; + do + { + rv = (int) (Util.rnd32()%CB_Trainer_Class.Items.Count); + } while (/*trClass[rv].StartsWith("[~") || */(Legal.SpecialClasses_SM.Contains(rv) && !CHK_IgnoreSpecialClass.Checked)); + // don't allow disallowed classes + tr.TrainerClass = (byte) rv; } if (tr.NumPokemon < NUD_RMin.Value) @@ -613,6 +622,7 @@ private void B_Randomize_Click(object sender, EventArgs e) int Type = CHK_TypeTheme.Checked ? (int)Util.rnd32()%17 : -1; pk.Species = rnd.getRandomSpecies(pk.Species, Type); pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat); + pk.Gender = 0; // Random Gender } if (CHK_Level.Checked) pk.Level = (int)(pk.Level*(100 + NUD_LevelBoost.Value))/100; @@ -652,11 +662,6 @@ private void B_HighAttack_Click(object sender, EventArgs e) var moves = getHighAttacks(pkm); setMoves(moves); } - private void B_Clear_Click(object sender, EventArgs e) - { - setMoves(new int[0]); - } - private void B_CurrentAttack_Click(object sender, EventArgs e) { pkm.Species = CB_Species.SelectedIndex; @@ -665,11 +670,52 @@ private void B_CurrentAttack_Click(object sender, EventArgs e) var moves = getCurrentAttacks(pkm); setMoves(moves); } + private void B_Clear_Click(object sender, EventArgs e) + { + setMoves(new int[4]); + } private void setMoves(int[] moves) { var mcb = new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 }; for (int i = 0; i < mcb.Length; i++) mcb[i].SelectedIndex = moves[i]; } + + // Randomization UI + private void CB_Moves_SelectedIndexChanged(object sender, EventArgs e) + { + CHK_Damage.Visible = CHK_STAB.Visible = NUD_Damage.Visible = NUD_STAB.Visible = CB_Moves.SelectedIndex == 1; // Randomized + } + private void CHK_Damage_CheckedChanged(object sender, EventArgs e) + { + NUD_Damage.Enabled = CHK_Damage.Checked; + } + private void CHK_STAB_CheckedChanged(object sender, EventArgs e) + { + NUD_STAB.Enabled = CHK_STAB.Checked; + } + private void CHK_RandomPKM_CheckedChanged(object sender, EventArgs e) + { + CHK_BST.Visible = CHK_RandomPKM.Checked; + if (CHK_RandomPKM.Checked) + return; + foreach (CheckBox c in new[] { CHK_G1, CHK_G2, CHK_G3, CHK_G4, CHK_G5, CHK_G6, CHK_G7, CHK_L, CHK_E }) + { + c.Visible = false; + c.Checked = true; + } + } + private void CHK_RandomClass_CheckedChanged(object sender, EventArgs e) + { + CHK_IgnoreSpecialClass.Visible = CHK_RandomClass.Checked; + } + private void CHK_RandomShiny_CheckedChanged(object sender, EventArgs e) + { + NUD_Shiny.Enabled = CHK_RandomShiny.Checked; + } + private void CHK_Level_CheckedChanged(object sender, EventArgs e) + { + NUD_LevelBoost.Enabled = CHK_Level.Checked; + } } } diff --git a/pk3DS/Subforms/Gen7/SMTE.resx b/pk3DS/Subforms/Gen7/SMTE.resx index 05589a3..0161958 100644 --- a/pk3DS/Subforms/Gen7/SMTE.resx +++ b/pk3DS/Subforms/Gen7/SMTE.resx @@ -150,54 +150,12 @@ True - - True - - - True - - - True - - - True - True True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - True @@ -213,12 +171,6 @@ True - - True - - - True - True @@ -228,12 +180,6 @@ True - - True - - - True - True @@ -243,12 +189,6 @@ True - - True - - - True - True @@ -258,12 +198,6 @@ True - - True - - - True - True @@ -273,12 +207,6 @@ True - - True - - - True - True @@ -288,12 +216,6 @@ True - - True - - - True - True @@ -303,54 +225,15 @@ True - - True - - - True - True True - - True - True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - True @@ -363,15 +246,6 @@ True - - True - - - True - - - True - True @@ -387,18 +261,6 @@ True - - True - - - True - - - True - - - True - True @@ -414,18 +276,6 @@ True - - True - - - True - - - True - - - True - True @@ -441,18 +291,6 @@ True - - True - - - True - - - True - - - True - True @@ -468,18 +306,6 @@ True - - True - - - True - - - True - - - True - True @@ -495,18 +321,6 @@ True - - True - - - True - - - True - - - True - True @@ -522,18 +336,6 @@ True - - True - - - True - - - True - - - True - True @@ -546,15 +348,6 @@ True - - True - - - True - - - True - True @@ -564,33 +357,12 @@ True - - True - - - True - True True - - True - - - True - - - True - - - True - - - True - True