diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 999343290..5f4d2f91a 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -814,9 +814,9 @@ private static ICollection GetSplitBreedGeneration(int generation) } internal static int GetMaxSpeciesOrigin(PKM pkm) { - if (pkm.Format == 1 || pkm.VC1) // Gen1 VC could not trade with gen 2 yet + if (pkm.Format == 1) return GetMaxSpeciesOrigin(1); - if (pkm.Format == 2 || pkm.VC2) + if (pkm.Format == 2 || pkm.VC) return GetMaxSpeciesOrigin(2); return GetMaxSpeciesOrigin(pkm.GenNumber); } diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs index 684046a22..9796e850b 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator.cs @@ -41,9 +41,8 @@ public static IEnumerable GetEncounters(PKM pkm, LegalInfo info) private static IEnumerable GetEncounters12(PKM pkm, LegalInfo info) { int baseSpecies = GetBaseSpecies(pkm); - bool g1 = pkm.VC1 || pkm.Format == 1; - if (g1 && baseSpecies > MaxSpeciesID_1 || baseSpecies > MaxSpeciesID_2) + if ((pkm.Format == 1 && baseSpecies > MaxSpeciesID_1) || baseSpecies > MaxSpeciesID_2) yield break; foreach (var z in GenerateFilteredEncounters(pkm)) diff --git a/PKHeX.Core/Legality/Moves/MoveEgg.cs b/PKHeX.Core/Legality/Moves/MoveEgg.cs index dc4cd0b14..1a49d5c88 100644 --- a/PKHeX.Core/Legality/Moves/MoveEgg.cs +++ b/PKHeX.Core/Legality/Moves/MoveEgg.cs @@ -7,11 +7,12 @@ internal static class MoveEgg { internal static int[] GetEggMoves(PKM pkm, int species, int formnum, GameVersion version) { - if (!pkm.InhabitedGeneration(pkm.GenNumber, species) || pkm.PersonalInfo.Gender == 255 && !FixedGenderFromBiGender.Contains(species)) + int gen = pkm.Format <= 2 || pkm.VC ? 2 : pkm.GenNumber; + if (!pkm.InhabitedGeneration(gen, species) || pkm.PersonalInfo.Gender == 255 && !FixedGenderFromBiGender.Contains(species)) return new int[0]; if (version == GameVersion.Any) version = (GameVersion)pkm.Version; - return GetEggMoves(pkm.GenNumber, species, formnum, version); + return GetEggMoves(gen, species, formnum, version); } private static int[] GetEggMoves(int gen, int species, int formnum, GameVersion version) { diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index de222f47d..0f463f40b 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -569,8 +569,8 @@ public bool InhabitedGeneration(int Generation, int species = -1) int gen = GenNumber; switch (Generation) { - case 1: return Format == 1 || VC1; - case 2: return Format == 2 || VC2; + case 1: return Format == 1 || VC; // species compat checked via sanity above + case 2: return Format == 2 || VC; case 3: return Gen3; case 4: return 3 <= gen && gen <= 4; case 5: return 3 <= gen && gen <= 5; diff --git a/Tests/PKHeX.Tests/Legality/Legal/Generation 1 Tradeback/107 ★ - エビワラー - 68EC Gen2 Future-Gen Evo Egg.pk1 b/Tests/PKHeX.Tests/Legality/Legal/Generation 1 Tradeback/107 ★ - エビワラー - 68EC Gen2 Future-Gen Evo Egg.pk1 new file mode 100644 index 000000000..1d30b8d3a Binary files /dev/null and b/Tests/PKHeX.Tests/Legality/Legal/Generation 1 Tradeback/107 ★ - エビワラー - 68EC Gen2 Future-Gen Evo Egg.pk1 differ diff --git a/Tests/PKHeX.Tests/Legality/Legal/Generation 7 Transfer/107 ★ - エビワラー - F5486DD483CC.pk7 b/Tests/PKHeX.Tests/Legality/Legal/Generation 7 Transfer/107 ★ - エビワラー - F5486DD483CC.pk7 new file mode 100644 index 000000000..87e39090f Binary files /dev/null and b/Tests/PKHeX.Tests/Legality/Legal/Generation 7 Transfer/107 ★ - エビワラー - F5486DD483CC.pk7 differ diff --git a/Tests/PKHeX.Tests/Legality/LegalityTests.cs b/Tests/PKHeX.Tests/Legality/LegalityTests.cs index e252c7a18..5323ae459 100644 --- a/Tests/PKHeX.Tests/Legality/LegalityTests.cs +++ b/Tests/PKHeX.Tests/Legality/LegalityTests.cs @@ -61,6 +61,8 @@ private static void VerifyAll(string folder, string name, bool IsValid) var pkm = PKMConverter.GetPKMfromBytes(data, prefer: format); Assert.IsNotNull(pkm, $"Failed to load PKM: {new FileInfo(file).Name}."); + Legal.AllowGBCartEra = fi.DirectoryName.Contains("GBCartEra"); + Legal.AllowGen1Tradeback = fi.DirectoryName.Contains("1 Tradeback"); var legality = new LegalityAnalysis(pkm); Assert.IsTrue(legality.Valid == IsValid, $"Failed to validate PKM as {(IsValid ? "Valid" : "Invalid")}: {fi.Directory.Name}\\{fi.Name}."); }