Hide unavailable species for PLA saves (similar to LGPE)

This commit is contained in:
Kurt 2022-02-05 22:02:26 -08:00
parent a3595d1429
commit 9137a03b50
2 changed files with 18 additions and 0 deletions

View file

@ -46,6 +46,8 @@ namespace PKHeX.Core
{
SAV7b => source.SpeciesDataSource // LGPE: Kanto 151, Meltan/Melmetal
.Where(s => s.Value is <= (int)Core.Species.Mew or (int)Core.Species.Meltan or (int)Core.Species.Melmetal),
SAV8LA => source.SpeciesDataSource
.Where(s => PersonalTable.LA.IsSpeciesInGame(s.Value)),
_ => source.SpeciesDataSource.Where(s => s.Value <= sav.MaxSpeciesID),
};
}

View file

@ -380,5 +380,21 @@ namespace PKHeX.Core
{
return Table.Any(p => p.IsValidTypeCombination(type1, type2));
}
public bool IsSpeciesInGame(int species)
{
if ((uint)species > MaxSpeciesID)
return false;
var form0 = Table[species];
if (form0.HP != 0)
return true;
var fc = form0.FormCount;
for (int i = 1; i < fc; i++)
{
if (GetFormEntry(species, i).HP != 0)
return true;
}
return false;
}
}
}