diff --git a/PKHeX/Legality/Structures/EvolutionTree.cs b/PKHeX/Legality/Structures/EvolutionTree.cs index 178792890..6b14c3491 100644 --- a/PKHeX/Legality/Structures/EvolutionTree.cs +++ b/PKHeX/Legality/Structures/EvolutionTree.cs @@ -206,12 +206,12 @@ public bool Valid(PKM pkm, int lvl) case 4: if (pkm.Format > pkm.GenNumber) // Pal Park / PokeTransfer updates Met Level return true; - return pkm.Met_Level < Level; + return pkm.Met_Level < lvl; case 5: // Bank keeps current level case 6: case 7: - return lvl >= Level && (!pkm.IsNative || pkm.Met_Level < Level); + return lvl >= Level && (!pkm.IsNative || pkm.Met_Level < lvl); } return false; @@ -228,6 +228,17 @@ public DexLevel GetDexLevel(int lvl) Flag = Method, }; } + public DexLevel GetDexLevel(int species, int lvl) + { + + return new DexLevel + { + Species = species, + Level = lvl, + Form = Form, + Flag = Method, + }; + } public EvolutionMethod Copy(int species) { @@ -274,7 +285,11 @@ public IEnumerable getExplicitLineage(PKM pkm, int lvl) if (!evo.Valid(pkm, lvl)) continue; - dl.Add(evo.GetDexLevel(lvl)); + if (evo.Species > 802) // Gen7 Personal Formes -- unmap the forme personal entry to the actual species ID since species are consecutive + dl.Add(evo.GetDexLevel(pkm.Species - Chain.Count + i, lvl)); + else + dl.Add(evo.GetDexLevel(lvl)); + if (evo.RequiresLevelUp) lvl--; break;