diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index d2e840b46..91dc7f116 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -204,7 +204,6 @@ public Main() } catch (Exception ex) { - // Todo: translate this ErrorWindow.ShowErrorDialog("An error occurred while attempting to auto-load your save file.", ex, true); } @@ -894,7 +893,17 @@ private void openSAV(SaveFile sav, string path) } } // Finish setting up the save file. - if (sav.Generation == 3 && (sav.IndeterminateGame || ModifierKeys == Keys.Control)) + if (sav.Generation == 1) + { + // Ask the user if it is a VC save file or if it is from a physical cartridge. + // Necessary for legality checking possibilities that are only obtainable on GSC (non VC) or event distributions. + var drVC = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, $"{sav.Version} Save File detected. Is this a Virtual Console Save File?", + "Yes: Virtual Console" + Environment.NewLine + "No: Physical Cartridge"); + if (drVC == DialogResult.Cancel) + return; + Legal.AllowGBCartEra = drVC == DialogResult.No; // physical cart selected + } + else if (sav.Generation == 3 && (sav.IndeterminateGame || ModifierKeys == Keys.Control)) { // Hacky cheats invalidated the Game Code value. var drGame = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, @@ -1670,7 +1679,7 @@ private void setMarkings() } } // Clicked Label Shortcuts // - private bool QR6Notified = false; + private bool QR6Notified; private void clickQR(object sender, EventArgs e) { if (ModifierKeys == Keys.Alt) diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs index 463c0c611..98f7e08be 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs @@ -423,7 +423,10 @@ private void B_GenTID_Click(object sender, EventArgs e) {011, "Link Trades"}, {012, "Link Battles"}, {013, "Link Battle Wins"}, + {014, "Link Battle Losses"}, {015, "Battle Spot Battles"}, + {016, "Battle Spot Wins"}, + {017, "Battle Spot Losses"}, {018, "Mart Stack Purchases"}, {019, "Money Spent"}, {020, "Pokémon deposited at Nursery"}, diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 6df04e9a6..ff0357e64 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -209,7 +209,7 @@ private void verifyNickname() var et = EncounterOriginal as EncounterTrade; if (et?.TID == 0) // Gen1 Trade { - if (!Legal.getEncounterTrade1Valid(pkm, et)) + if (!Legal.getEncounterTrade1Valid(pkm)) AddLine(Severity.Invalid, "Incorrect OT name for RBY in-game trade.", CheckIdentifier.Trainer); } else // Gen2 @@ -567,7 +567,7 @@ private CheckResult verifyEncounterTrade() } private CheckResult verifyEncounterG12() { - var obj = Legal.getEncounter12(pkm, pkm.Format < 3); + var obj = Legal.getEncounter12(pkm, Legal.AllowGBCartEra && pkm.Format < 3); if (obj == null) return new CheckResult(Severity.Invalid, "Unknown encounter.", CheckIdentifier.Encounter); @@ -1619,11 +1619,18 @@ private void verifyHTMemory() if (!History.Valid) return; - if (pkm.GenNumber == 7 || pkm.GenNumber == 1) + if (pkm.Format >= 7) { - bool check = pkm.VC1 || pkm.HT_Memory != 0; - if (!check) + /* + * Bank Transfer adds in the Link Trade Memory. + * Trading 7<->7 between games (not Bank) clears this data. + */ + if (pkm.HT_Memory == 0) + { + if (pkm.HT_TextVar != 0 || pkm.HT_Intensity != 0 || pkm.HT_Feeling != 0) + AddLine(Severity.Invalid, "HT memory not cleared properly.", CheckIdentifier.Memory); return; + } if (pkm.HT_Memory != 4) AddLine(Severity.Invalid, "Should have a Link Trade HT Memory.", CheckIdentifier.Memory); diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 48f18f30d..e480f75cf 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -7,8 +7,11 @@ namespace PKHeX.Core { public static partial class Legal { - // Event Database(s) - public static MysteryGift[] MGDB_G6, MGDB_G7 = new MysteryGift[0]; + /// Event Database for a given Generation + public static MysteryGift[] MGDB_G4, MGDB_G5, MGDB_G6, MGDB_G7 = new MysteryGift[0]; + + /// Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games. + public static bool AllowGBCartEra = false; // Gen 1 private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rb, MaxSpeciesID_1); @@ -505,7 +508,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E return new Tuple(s, s.Level, 20); // special move if (game == GameVersion.GSC) { - if (t != null) + if (t != null && t.TID != 0) return new Tuple(t, t.Level, 10); // gen2 trade if (WasEgg && new[] { sm, em, tm }.Min(a => a) >= 5) return new Tuple(true, 5, 9); // gen2 egg @@ -527,7 +530,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E return g1 ?? g2; var t = g1.Item1 as EncounterTrade; - if (t != null && getEncounterTrade1Valid(pkm, t)) + if (t != null && getEncounterTrade1Valid(pkm)) return g1; // Both generations can provide an encounter. Return highest preference @@ -538,7 +541,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E // Return lowest level encounter return g1.Item2 < g2.Item2 ? g1 : g2; } - internal static bool getEncounterTrade1Valid(PKM pkm, EncounterTrade t) + internal static bool getEncounterTrade1Valid(PKM pkm) { string ot = pkm.OT_Name; string tr = pkm.Format <= 2 ? "TRAINER" : "Trainer"; // decaps on transfer diff --git a/PKHeX/Legality/Structures/Learnset.cs b/PKHeX/Legality/Structures/Learnset.cs index 4a973c7f0..1bceabb26 100644 --- a/PKHeX/Legality/Structures/Learnset.cs +++ b/PKHeX/Legality/Structures/Learnset.cs @@ -12,6 +12,8 @@ public abstract class Learnset public int[] getMoves(int level) { + if (level >= 100) + return Moves; for (int i = 0; i < Levels.Length; i++) if (Levels[i] > level) return Moves.Take(i).ToArray(); diff --git a/PKHeX/Resources/byte/evos_sm.pkl b/PKHeX/Resources/byte/evos_sm.pkl index f4004de53..5a8f1500b 100644 Binary files a/PKHeX/Resources/byte/evos_sm.pkl and b/PKHeX/Resources/byte/evos_sm.pkl differ