diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 5289627f0..cf2a3e392 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -521,8 +521,8 @@ private CheckResult verifyEncounterEgg3Native() return new CheckResult(Severity.Invalid, string.Format(V52, 0), CheckIdentifier.Encounter); if (pkm.IsEgg) { - var loc = pkm.FRLG ? 146 /* Four Island */ : 32; /* RSE: Route 117 */ - if (pkm.Met_Location != loc) + var loc = pkm.FRLG ? Legal.ValidEggMet_FRLG : Legal.ValidEggMet_RSE; + if (!loc.Contains(pkm.Met_Location)) return new CheckResult(Severity.Invalid, V55, CheckIdentifier.Encounter); } else @@ -2149,7 +2149,7 @@ private CheckResult[] parseMovesGetGift(int[] Moves, int[][] validLevelMoves, in private CheckResult[] parseMovesRegular(int[] Moves, int[][] validLevelMoves, int[][] validTMHM, int[][] validTutor, int[] baseEggMoves, GameVersion game) { int[] EggMoves = pkm.WasEgg ? Legal.getEggMoves(pkm, game).ToArray() : new int[0]; - int[] EventEggMoves = new int[0]; + int[] EventEggMoves = pkm.WasEgg ? Legal.getSpecialEggMoves(pkm, game).ToArray() : new int[0]; int[] RelearnMoves = pkm.RelearnMoves; int[] SpecialMoves = (EncounterMatch as MysteryGift)?.Moves ?? (EncounterMatch as EncounterStatic)?.Moves ?? @@ -2240,7 +2240,7 @@ private CheckResult[] parseMoves(int[] moves, int[][] learn, int[] relearn, int[ } } - if (gen == generations.Length - 1) + if (gen == generations.Last()) { // Check egg moves after all the generations and all the moves, every move that can be learned in another source should have preference // the moves that can only be learned from egg moves should in the future check if the move combinations can be breed in gens 2 to 5 diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index a1bdaec23..ebb2cc059 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -715,7 +715,12 @@ internal static IEnumerable getBaseEggMoves(PKM pkm, int skipOption, GameVe internal static IEnumerable getEggMoves(PKM pkm, GameVersion Version) { return getEggMoves(pkm, getBaseSpecies(pkm), 0, Version); - } + } + + internal static IEnumerable getSpecialEggMoves(PKM pkm, GameVersion Version) + { + return getSpecialEggMoves(pkm, getBaseSpecies(pkm), 0, Version); + } // Encounter internal static EncounterLink getValidLinkGifts(PKM pkm) @@ -2394,6 +2399,22 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form } return r; } + private static IEnumerable getSpecialEggMoves(PKM pkm, int species, int alform, GameVersion Version = GameVersion.Any) + { + if (!pkm.InhabitedGeneration(pkm.GenNumber, species)) + return new List(); + switch (pkm.GenNumber) + { + case 3: + { + var boxencounter = Encounter_Box.Where(e => e.Species == species).FirstOrDefault(); + if (boxencounter != null) + return boxencounter.Moves; + break; + } + } + return new List(); + } private static IEnumerable getEggMoves(PKM pkm, int species, int formnum, GameVersion Version = GameVersion.Any) { if (!pkm.InhabitedGeneration(pkm.GenNumber, species)) diff --git a/PKHeX/Legality/Tables3.cs b/PKHeX/Legality/Tables3.cs index 208e5683c..9379346fc 100644 --- a/PKHeX/Legality/Tables3.cs +++ b/PKHeX/Legality/Tables3.cs @@ -202,6 +202,13 @@ public static partial class Legal 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, }; + internal static readonly EncounterStatic[] Encounter_Box = + { + new EncounterStatic { Species = 333, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{206} }, // Swablu Egg with False Swipe + new EncounterStatic { Species = 263, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{245} }, // Zigzagoon Egg with Extreme Speed + new EncounterStatic { Species = 300, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{6} }, // Skitty Egg with Pay Day + new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{57} }, // Pichu Egg with Surf + }; internal static readonly EncounterStatic[] Encounter_RSE_Roam = { @@ -303,8 +310,8 @@ public static partial class Legal new EncounterStatic { Species = 386, Level = 30, Location = 187, Version = GameVersion.LG, Form = 2 }, // Deoxys @ Birth Island }; - internal static readonly EncounterStatic[] Encounter_RSE = Encounter_RSE_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_RSE)).Concat(Encounter_RSE_Regular).ToArray(); - internal static readonly EncounterStatic[] Encounter_FRLG = Encounter_FRLG_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_FRLG)).Concat(Encounter_FRLG_Stationary).ToArray(); + internal static readonly EncounterStatic[] Encounter_RSE = Encounter_RSE_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_RSE)).Concat(Encounter_RSE_Regular).Concat(Encounter_Box).ToArray(); + internal static readonly EncounterStatic[] Encounter_FRLG = Encounter_FRLG_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_FRLG)).Concat(Encounter_FRLG_Stationary).Concat(Encounter_Box).ToArray(); private static readonly int[] TradeContest_Cool = {30, 05, 05, 05, 05, 10}; private static readonly int[] TradeContest_Beauty = {05, 30, 05, 05, 05, 10}; @@ -480,7 +487,18 @@ public static partial class Legal },} }; #endregion - + internal static readonly int[] ValidEggMet_RSE = + { + 32, //Route 117 + 253, //Ingame egg gift + 255 // event/pokemon box + }; + internal static readonly int[] ValidEggMet_FRLG = + { + 146, //Four Island + 253, //Ingame egg gift + 255 // event/pokemon box + }; // 064 is an unused location for metor falls // 084 is Inside of a truck, no possible pokemon can be hatched there internal static readonly int[] ValidMet_RS =