Prefer form match for suggested encounters

Closes #3038
This commit is contained in:
Kurt 2020-10-19 11:54:59 -07:00
parent 3dd47dc898
commit 8c4b7e9060
2 changed files with 9 additions and 3 deletions

View file

@ -122,7 +122,10 @@ namespace PKHeX.Core
internal static EncounterSlot? GetCaptureLocation(PKM pkm)
{
var chain = EvolutionChain.GetValidPreEvolutions(pkm, maxLevel: 100, skipChecks: true);
return GetPossible(pkm, chain).OrderBy(z => z.LevelMin).FirstOrDefault();
return GetPossible(pkm, chain)
.OrderBy(z => !chain.Any(s => s.Species == z.Species && s.Form == z.Form))
.ThenBy(z => z.LevelMin)
.FirstOrDefault();
}
private static IEnumerable<EncounterArea> GetEncounterTable(PKM pkm, GameVersion gameSource = GameVersion.Any)

View file

@ -118,8 +118,11 @@ namespace PKHeX.Core
case 2:
return EncounterStatic7.GetVC2(species, pkm.Met_Level);
default:
var dl = EvolutionChain.GetValidPreEvolutions(pkm, maxLevel: 100, skipChecks: true);
return GetPossible(pkm, dl).FirstOrDefault();
var chain = EvolutionChain.GetValidPreEvolutions(pkm, maxLevel: 100, skipChecks: true);
return GetPossible(pkm, chain)
.OrderBy(z => !chain.Any(s => s.Species == z.Species && s.Form == z.Form))
.ThenBy(z => z.LevelMin)
.FirstOrDefault();
}
}