From 58981dcaaba4c15531f675d1683b5f434dc6bb0e Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 22 Oct 2016 10:38:33 -0700 Subject: [PATCH] Add unown form editing gen2 Also add in some sun/moon form info (may not trigger) Passing eventargs feels janky but works. Should resolve query in #334 --- PKHeX/MainWindow/Main.cs | 31 +++++++++++++++++-------------- PKHeX/PKM/PKX.cs | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index d8c12694e..851f55cd7 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -1620,10 +1620,6 @@ private void setForms() return; CB_Form.DataSource = PKX.getFormList(species, types, forms, gendersymbols, SAV.Generation).ToList(); - if (SAV.Generation < 3) - { - Label_Form.Visible = CB_Form.Visible = CB_Form.Enabled = false; - } } private void setAbilityList() { @@ -1980,7 +1976,8 @@ private void updateIVs(object sender, EventArgs e) Label_Gender.ForeColor = pkm.Gender == 2 ? Label_Species.ForeColor : (pkm.Gender == 1 ? Color.Red : Color.Blue); - CB_Form.SelectedIndex = pkm.AltForm; + if (pkm.Species == 201 && e != null) // Unown + CB_Form.SelectedIndex = pkm.AltForm; setIsShiny(null); getQuickFiller(dragout); } @@ -2052,15 +2049,15 @@ private void updateRandomIVs(object sender, EventArgs e) } else { - TB_HPIV.Text = (Util.rnd32() & SAV.MaxIV).ToString(); - TB_ATKIV.Text = (Util.rnd32() & SAV.MaxIV).ToString(); - TB_DEFIV.Text = (Util.rnd32() & SAV.MaxIV).ToString(); - TB_SPAIV.Text = (Util.rnd32() & SAV.MaxIV).ToString(); - TB_SPDIV.Text = (Util.rnd32() & SAV.MaxIV).ToString(); - TB_SPEIV.Text = (Util.rnd32() & SAV.MaxIV).ToString(); + TB_HPIV.Text = (Util.rnd32() % SAV.MaxIV).ToString(); + TB_ATKIV.Text = (Util.rnd32() % SAV.MaxIV).ToString(); + TB_DEFIV.Text = (Util.rnd32() % SAV.MaxIV).ToString(); + TB_SPAIV.Text = (Util.rnd32() % SAV.MaxIV).ToString(); + TB_SPDIV.Text = (Util.rnd32() % SAV.MaxIV).ToString(); + TB_SPEIV.Text = (Util.rnd32() % SAV.MaxIV).ToString(); } changingFields = false; - updateIVs(null, null); + updateIVs(null, e); } private void updateRandomEVs(object sender, EventArgs e) { @@ -2163,13 +2160,19 @@ private void updateForm(object sender, EventArgs e) setAbilityList(); // Gender Forms - if (Util.getIndex(CB_Species) == 201) + if (Util.getIndex(CB_Species) == 201 && fieldsLoaded) { - if (fieldsLoaded && SAV.Generation == 3) + if (SAV.Generation == 3) { pkm.setPIDUnown3(CB_Form.SelectedIndex); TB_PID.Text = pkm.PID.ToString("X8"); } + else if (SAV.Generation == 2) + { + int desiredForm = CB_Form.SelectedIndex; + while (pkm.AltForm != desiredForm) + updateRandomIVs(null, null); + } } else if (PKX.getGender(CB_Form.Text) < 2) Label_Gender.Text = CB_Form.Text; diff --git a/PKHeX/PKM/PKX.cs b/PKHeX/PKM/PKX.cs index 4aef4f662..c0ba5722c 100644 --- a/PKHeX/PKM/PKX.cs +++ b/PKHeX/PKM/PKX.cs @@ -624,6 +624,17 @@ public static string[] getFormList(int species, string[] t, string[] f, string[] f[000], // Spiky }; case 201: + if (generation == 2) + return new[] + { + "A", "B", "C", "D", "E", + "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", + "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", + "Z", + // "!", "?", not in Gen II + }; return new[] { "A", "B", "C", "D", "E", @@ -708,7 +719,8 @@ public static string[] getFormList(int species, string[] t, string[] f, string[] f[823], // Sky }; - case 493: + case 493: // Arceus + case 773: // Silvally if (generation == 4) return new[] { @@ -940,6 +952,27 @@ public static string[] getFormList(int species, string[] t, string[] f, string[] t[000], // Normal f[912], // Unbound }; + + case 741: // Oricorio + return new[] + { + "RED", // Baile + "YLW", // Pom-Pom + "PNK", // Pa'u + "BLU", // Sensu + }; + + case 744: // Minior + return new[] + { + "R", // Red + "O", // Orange + "Y", // Yellow + "G", // Green + "B", // Blue + "I", // Indigo + "V", // Violet + }; } return new[] {""}; }