diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 366d256c0..18510fa5a 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -2163,6 +2163,7 @@ private GameVersion[] getBaseMovesIsEggGames() private CheckResult[] verifyMovesIsEggPreRelearn(int[] Moves, int[] SpecialMoves, bool allowinherited) { CheckResult[] res = new CheckResult[4]; + var ValidSpecialMoves = SpecialMoves.Where(m => m > 0); // Some games can have different egg movepools. Have to check all situations. GameVersion[] Games = getBaseMovesIsEggGames(); int splitctr = Legal.getSplitBreedGeneration(pkm).Contains(pkm.Species) ? 1 : 0; @@ -2182,14 +2183,14 @@ private CheckResult[] verifyMovesIsEggPreRelearn(int[] Moves, int[] SpecialMoves { // For gen 2 is not possible to difference normal eggs from event eggs // If there is no special moves assume normal egg - res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, SpecialMoves, allowinherited, ver); + res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, ValidSpecialMoves, allowinherited, ver); if (res.All(r => r.Valid)) // moves is satisfactory return res; } if(pkm.Format == 2) { // For gen 2 if does not match special egg check for normal egg too - res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, new int[0], true, ver); + res = verifyPreRelearnEggBase(Moves, baseEggMoves, EggMoves, InheritedLvlMoves, InheritedTMHMMoves, InheritedTutorMoves, new List(), true, ver); if (res.All(r => r.Valid)) // moves is satisfactory return res; } @@ -2679,7 +2680,7 @@ private CheckResult[] verifyRelearnEggBase(int[] RelearnMoves, int skipOption, G /* Similar to verifyRelearnEgg but in pre relearn generation is the moves what should match the expected order but only if the pokemon is inside an egg */ - private CheckResult[] verifyPreRelearnEggBase(int[] Moves, List baseMoves, List eggmoves, IEnumerable lvlmoves, IEnumerable tmhmmoves, IEnumerable tutormoves, int[] specialmoves, bool AllowInherited, GameVersion ver) + private CheckResult[] verifyPreRelearnEggBase(int[] Moves, List baseMoves, List eggmoves, IEnumerable lvlmoves, IEnumerable tmhmmoves, IEnumerable tutormoves, IEnumerable specialmoves, bool AllowInherited, GameVersion ver) { CheckResult[] res = new CheckResult[4]; @@ -2704,7 +2705,7 @@ private CheckResult[] verifyPreRelearnEggBase(int[] Moves, List baseMoves, { if (baseMoves.Contains(Moves[i])) res[i] = new CheckResult(Severity.Valid, V179, CheckIdentifier.Move); - else if (specialmoves.Length == 0) + else { // mark remaining base egg moves missing for (int z = i; z < reqBase; z++) @@ -2719,31 +2720,34 @@ private CheckResult[] verifyPreRelearnEggBase(int[] Moves, List baseMoves, moveoffset += reqBase; // Check also if the required amount of Special Egg Moves are present, ir are after base moves - for (int i = moveoffset; i < moveoffset + specialmoves.Length; i++) + for (int i = moveoffset; i < moveoffset + specialmoves.Count(); i++) { if (specialmoves.Contains(Moves[i])) res[i] = new CheckResult(Severity.Valid, V333, CheckIdentifier.Move); else { // mark remaining special egg moves missing - for (int z = i; z < specialmoves.Length; z++) + for (int z = i; z < moveoffset + specialmoves.Count(); z++) res[z] = new CheckResult(Severity.Invalid, V342, CheckIdentifier.Move); - // provide the list of suggested base moves for the last required slot - em = string.Join(", ", baseMoves.Union(specialmoves).Select(m => m >= movelist.Length ? V190 : movelist[m])); + // provide the list of suggested base moves and specia moves for the last required slot + if (!string.IsNullOrEmpty(em)) em += ","; + else + em = string.Join(", ", baseMoves.Select(m => m >= movelist.Length ? V190 : movelist[m])) + ","; + em += string.Join(", ", specialmoves.Select(m => m >= movelist.Length ? V190 : movelist[m])); break; } } if(!string.IsNullOrEmpty(em)) - res[reqBase > 0 ? reqBase - 1 : 0].Comment += string.Format(Environment.NewLine + V343, em); + res[reqBase > 0 ? reqBase - 1 : 0].Comment = string.Format(Environment.NewLine + V343, em); // Non-Base moves that can magically appear in the regular movepool if (pkm.GenNumber >=3 && Legal.LightBall.Contains(pkm.Species)) eggmoves.Add(344); // Inherited moves appear after the required base moves. var AllowInheritedSeverity = AllowInherited ? Severity.Valid : Severity.Invalid; - for (int i = reqBase + specialmoves.Length; i < 4; i++) + for (int i = reqBase + specialmoves.Count(); i < 4; i++) { if (Moves[i] == 0) // empty res[i] = new CheckResult(Severity.Valid, V167, CheckIdentifier.Move); diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 5f8d11bbe..1501ac315 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -121,7 +121,8 @@ private static EncounterStatic[] getStaticEncounters(GameVersion Game) default: return null; } - return table?.Where(s => s.Version == GameVersion.Any || s.Version == Game).ToArray(); + // Temp until wwwwwwzx Contains extension is merged into the master branch + return table?.Where(s => s.Version == GameVersion.Any || s.Version == Game || s.Version == GameVersion.RSBOX).ToArray(); } private static EncounterArea[] getEncounterTables(GameVersion Game) { @@ -1674,6 +1675,8 @@ internal static int getMaxLevelGeneration(PKM pkm, int generation) } internal static int getMinLevelEncounter(PKM pkm) { + if (pkm.Format == 3 && pkm.WasEgg) + return 5; return pkm.HasOriginalMetLocation ? pkm.Met_Level : getMaxLevelGeneration(pkm); } internal static int getMinLevelGeneration(PKM pkm)