diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 435acfb12..b98029b02 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -503,11 +503,11 @@ internal static bool IsTradeEvolved(IReadOnlyList[] chain, int pkmF internal static bool IsEvolutionValid(PKM pkm, int minSpecies = -1, int minLevel = -1) { - var curr = EvolutionChain.GetValidPreEvolutions(pkm); + var curr = EvolutionChain.GetValidPreEvolutions(pkm, minLevel: minLevel); var min = curr.FindLast(z => z.Species == minSpecies); if (min != null && min.Level < minLevel) return false; - var poss = EvolutionChain.GetValidPreEvolutions(pkm, lvl: 100, skipChecks: true); + var poss = EvolutionChain.GetValidPreEvolutions(pkm, lvl: 100, minLevel: minLevel, skipChecks: true); if (minSpecies != -1) { diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs b/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs index 63b6826d8..3e2a0a6f2 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionChain.cs @@ -160,7 +160,7 @@ internal static int GetEvoChainSpeciesIndex(IReadOnlyList chain, in private static List GetEvolutionChain(PKM pkm, IEncounterable Encounter, int maxspec, int maxlevel) { - var vs = GetValidPreEvolutions(pkm); + var vs = GetValidPreEvolutions(pkm, minLevel: Encounter.LevelMin); if (Encounter.Species == maxspec) { if (vs.Count != 1) @@ -231,7 +231,7 @@ private static void CheckLastEncounterRemoval(IEncounterable Encounter, IReadOnl } } - internal static List GetValidPreEvolutions(PKM pkm, int maxspeciesorigin = -1, int lvl = -1, bool skipChecks = false) + internal static List GetValidPreEvolutions(PKM pkm, int maxspeciesorigin = -1, int lvl = -1, int minLevel = 1, bool skipChecks = false) { if (lvl < 0) lvl = pkm.CurrentLevel; @@ -257,7 +257,7 @@ internal static List GetValidPreEvolutions(PKM pkm, int maxspecieso int tree = maxspeciesorigin == MaxSpeciesID_2 ? 2 : pkm.Format; var et = EvolutionTree.GetEvolutionTree(pkm, tree); - return et.GetValidPreEvolutions(pkm, maxLevel: lvl, maxSpeciesOrigin: maxspeciesorigin, skipChecks: skipChecks); + return et.GetValidPreEvolutions(pkm, maxLevel: lvl, maxSpeciesOrigin: maxspeciesorigin, skipChecks: skipChecks, minLevel: minLevel); } private static int GetMinLevelGeneration(PKM pkm, int generation) diff --git a/Tests/PKHeX.Core.Tests/Legality/Illegal/Evolution/196 ★ - ESPEON - 20386C1C9080.pk4 b/Tests/PKHeX.Core.Tests/Legality/Illegal/Evolution/196 ★ - ESPEON - 20386C1C9080.pk4 new file mode 100644 index 000000000..4dd32cebb Binary files /dev/null and b/Tests/PKHeX.Core.Tests/Legality/Illegal/Evolution/196 ★ - ESPEON - 20386C1C9080.pk4 differ