From e290443d4ea18264b3a2ba4acd8e8d7c33ad51c0 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 1 Sep 2016 20:48:38 -0700 Subject: [PATCH 1/9] Fix bad input exception handling Matches the other implementation --- PKHeX/PKM/ShowdownSet.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/PKHeX/PKM/ShowdownSet.cs b/PKHeX/PKM/ShowdownSet.cs index 736bb93ec..840ca3112 100644 --- a/PKHeX/PKM/ShowdownSet.cs +++ b/PKHeX/PKM/ShowdownSet.cs @@ -185,6 +185,7 @@ public ShowdownSet(string input = null) ) { string[] tmp = spec.Split(new[] { "-" }, StringSplitOptions.None); + if (tmp.Length < 2) return; Species = Array.IndexOf(species, tmp[0].Replace(" ", "")); Form = tmp[1].Trim(); if (tmp.Length > 2) From 829867d275095467c6017a7b4acecacf6c870f0e Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 1 Sep 2016 20:51:58 -0700 Subject: [PATCH 2/9] Fix gen4 HM07/HM08 Gen5/6 had dummied these items; since they aren't dummied in G4 we need to manually override the value from ??? to HM06+1 and HM06+2 Thanks msbhvn & Liger0! --- PKHeX/MainWindow/Main.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 09b2dcfc7..54fdf30fd 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -1080,6 +1080,9 @@ private void InitializeStrings() } // Fix Item Names (Duplicate entries) + int len = itemlist[425].Length; + itemlist[426] = itemlist[425].Substring(0, len-1) + (char)(itemlist[425][len-1]+1) + " (G4)"; + itemlist[427] = itemlist[425].Substring(0, len-1) + (char)(itemlist[425][len-1]+2) + " (G4)"; itemlist[456] += " (HG/SS)"; // S.S. Ticket itemlist[736] += " (OR/AS)"; // S.S. Ticket itemlist[463] += " (DPPt)"; // Storage Key From 0ca4339169360e3a9893ca95fa0d2019495e0d9a Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 1 Sep 2016 20:59:10 -0700 Subject: [PATCH 3/9] Fix gen4 mail item names Could be less lazy and manually update the Item text resources, but we'll re-evaluate this decision after S&M. --- PKHeX/MainWindow/Main.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 54fdf30fd..0891b187a 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -1079,6 +1079,10 @@ private void InitializeStrings() puffs = Util.getStringList("puff", l); } + // Gen4 Mail names not stored in future games. No clever solution like for HM's, so improvise. + for (int i = 137; i <= 148; i++) + itemlist[i] = $"Mail #{i-137+1} (G4)"; + // Fix Item Names (Duplicate entries) int len = itemlist[425].Length; itemlist[426] = itemlist[425].Substring(0, len-1) + (char)(itemlist[425][len-1]+1) + " (G4)"; From 13669ef7d7cd9630a0f9001cf620edea569efafd Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 2 Sep 2016 09:54:17 -0700 Subject: [PATCH 4/9] GiveAll medals 0->30->36 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #213 Distribution medals only given if the Pokémon has Secret Training unlocked. Clicking Give All with no medals will give 30, then clicking again will give the final 6. Of course if the Pokémon already had it unlocked but not 30 it will bump to 36, but it's up to the user to None/Give as desired. --- PKHeX/Subforms/PKM Editors/SuperTrainingEditor.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PKHeX/Subforms/PKM Editors/SuperTrainingEditor.cs b/PKHeX/Subforms/PKM Editors/SuperTrainingEditor.cs index d80df49e2..87fbbde09 100644 --- a/PKHeX/Subforms/PKM Editors/SuperTrainingEditor.cs +++ b/PKHeX/Subforms/PKM Editors/SuperTrainingEditor.cs @@ -134,12 +134,14 @@ public RegimenInfo(string name, bool completedRegimen) private void B_All_Click(object sender, EventArgs e) { + if (CHK_SecretUnlocked.Checked) // only give dist if Secret is Unlocked (None -> All -> All*) + foreach (var c in TLP_DistSuperTrain.Controls.OfType()) + c.Checked = true; + CHK_SecretUnlocked.Checked = true; CHK_SecretComplete.Checked = true; foreach (var c in TLP_SuperTrain.Controls.OfType()) c.Checked = true; - foreach (var c in TLP_DistSuperTrain.Controls.OfType()) - c.Checked = true; } private void B_None_Click(object sender, EventArgs e) { From d16ffddad49158d0b8227edd1222d869f7210656 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 3 Sep 2016 08:10:22 -0700 Subject: [PATCH 5/9] Add Egg & Super Training legality checks Closes #220 Thanks @sora10pls ! --- PKHeX/Legality/Checks.cs | 42 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 2903566c0..5c293e490 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -175,8 +175,10 @@ private LegalityCheck verifyEVs() { var evs = pk6.EVs; int sum = evs.Sum(); + if (pk6.IsEgg && sum > 0) + return new LegalityCheck(Severity.Invalid, "Eggs cannot receive EVs."); if (sum == 0 && pk6.Stat_Level - pk6.Met_Level > 0) - return new LegalityCheck(Severity.Fishy, "All EVs are zero, but leveled above Met Level"); + return new LegalityCheck(Severity.Fishy, "All EVs are zero, but leveled above Met Level."); if (sum == 508) return new LegalityCheck(Severity.Fishy, "2 EVs remaining."); if (sum > 510) @@ -349,6 +351,8 @@ private LegalityCheck verifyLevel() return new LegalityCheck(Severity.Invalid, "Met Level does not match Wonder Card level."); int lvl = pk6.CurrentLevel; + if (lvl > 1 && pk6.IsEgg) + return new LegalityCheck(Severity.Invalid, "Current level for an egg is invalid."); if (lvl < pk6.Met_Level) return new LegalityCheck(Severity.Invalid, "Current level is below met level."); if ((pk6.WasEgg || EncounterMatch == null) && !Legal.getEvolutionValid(pk6) && pk6.Species != 350) @@ -365,6 +369,28 @@ private LegalityCheck verifyRibbons() List missingRibbons = new List(); List invalidRibbons = new List(); + + if (pk6.IsEgg) + { + var RibbonNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "Ribbon"); + foreach (object RibbonValue in RibbonNames.Select(RibbonName => ReflectUtil.GetValue(pk6, RibbonName))) + { + if ((RibbonValue as int?) > 0) + return new LegalityCheck(Severity.Invalid, "Eggs should not have ribbons."); + if (RibbonValue as bool? == true) + return new LegalityCheck(Severity.Invalid, "Eggs should not have ribbons."); + } + + var DistNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "DistSuperTrain"); + if (DistNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) + return new LegalityCheck(Severity.Invalid, "Distribution Super Training missions on Egg."); + + var TrainNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "SuperTrain"); + if (TrainNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) + return new LegalityCheck(Severity.Fishy, "Super Training missions on Egg."); + + return new LegalityCheck(); + } // Check Event Ribbons bool[] EventRib = @@ -420,7 +446,13 @@ private LegalityCheck verifyRibbons() invalidRibbons.Add("Battle Memory"); // Gen3/4 Battle if (missingRibbons.Count + invalidRibbons.Count == 0) + { + var DistNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "DistSuperTrain"); + if (DistNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) + return new LegalityCheck(Severity.Fishy, "Distribution Super Training missions are not released."); + return new LegalityCheck(Severity.Valid, "All ribbons accounted for."); + } string[] result = new string[2]; if (missingRibbons.Count > 0) @@ -820,6 +852,14 @@ private LegalityCheck verifyForm() } private LegalityCheck verifyMisc() { + if (pk6.IsEgg) + { + if (new[] { pk6.Move1_PPUps, pk6.Move2_PPUps, pk6.Move3_PPUps, pk6.Move4_PPUps }.Any(ppup => ppup > 0)) + return new LegalityCheck(Severity.Invalid, "Cannot apply PP Ups to an Egg."); + if (pk6.CNTs.Any(stat => stat > 0)) + return new LegalityCheck(Severity.Invalid, "Cannot increase Contest Stats of an Egg."); + } + if (pk6.Gen6 && Encounter.Valid && EncounterType == typeof(WC6) ^ pk6.FatefulEncounter) { if (EncounterType == typeof(EncounterStatic) && pk6.Species == 386) // Deoxys Matched @ Sky Pillar From 6113ce39299571aa4d47dd01bf598328c59e35bd Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 3 Sep 2016 13:36:09 -0700 Subject: [PATCH 6/9] Super Training species suggestion Not a bug, just not a feature. Closes #224 --- PKHeX/Subforms/Save Editors/Gen6/SAV_SuperTrain.Designer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PKHeX/Subforms/Save Editors/Gen6/SAV_SuperTrain.Designer.cs b/PKHeX/Subforms/Save Editors/Gen6/SAV_SuperTrain.Designer.cs index 1e2c51459..bcccc2442 100644 --- a/PKHeX/Subforms/Save Editors/Gen6/SAV_SuperTrain.Designer.cs +++ b/PKHeX/Subforms/Save Editors/Gen6/SAV_SuperTrain.Designer.cs @@ -207,6 +207,8 @@ private void InitializeComponent() // CB_Species // this.CB_Species.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.CB_Species.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Species.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Species.FormattingEnabled = true; this.CB_Species.Location = new System.Drawing.Point(176, 38); this.CB_Species.Name = "CB_Species"; From 9c961e6bec9775b4754db035aafdc852c8c115a9 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 3 Sep 2016 22:27:05 -0700 Subject: [PATCH 7/9] Add spiky eared pichu sprite look mom im an artist --- PKHeX/PKHeX.csproj | 3 +++ PKHeX/Properties/Resources.Designer.cs | 10 ++++++++++ PKHeX/Properties/Resources.resx | 3 +++ PKHeX/Resources/img/Pokemon Sprites/172_1.png | Bin 0 -> 383 bytes 4 files changed, 16 insertions(+) create mode 100644 PKHeX/Resources/img/Pokemon Sprites/172_1.png diff --git a/PKHeX/PKHeX.csproj b/PKHeX/PKHeX.csproj index ca856033b..1e84d97fe 100644 --- a/PKHeX/PKHeX.csproj +++ b/PKHeX/PKHeX.csproj @@ -2746,6 +2746,9 @@ + + +