Weaken gen2 egg species checks for pre-evos in gen1

VC can inhabit both gens

Add Tradeback setting setter for legality tests
Add GBCartEra setting setter for legality tests

Thanks @iiippppk !
This commit is contained in:
Kurt 2018-06-12 18:46:31 -07:00
parent 64a64b8ce1
commit b9652a835d
7 changed files with 10 additions and 8 deletions

View file

@ -814,9 +814,9 @@ namespace PKHeX.Core
}
internal static int GetMaxSpeciesOrigin(PKM pkm)
{
if (pkm.Format == 1 || pkm.VC1) // Gen1 VC could not trade with gen 2 yet
if (pkm.Format == 1)
return GetMaxSpeciesOrigin(1);
if (pkm.Format == 2 || pkm.VC2)
if (pkm.Format == 2 || pkm.VC)
return GetMaxSpeciesOrigin(2);
return GetMaxSpeciesOrigin(pkm.GenNumber);
}

View file

@ -41,9 +41,8 @@ namespace PKHeX.Core
private static IEnumerable<IEncounterable> GetEncounters12(PKM pkm, LegalInfo info)
{
int baseSpecies = GetBaseSpecies(pkm);
bool g1 = pkm.VC1 || pkm.Format == 1;
if (g1 && baseSpecies > MaxSpeciesID_1 || baseSpecies > MaxSpeciesID_2)
if ((pkm.Format == 1 && baseSpecies > MaxSpeciesID_1) || baseSpecies > MaxSpeciesID_2)
yield break;
foreach (var z in GenerateFilteredEncounters(pkm))

View file

@ -7,11 +7,12 @@ namespace PKHeX.Core
{
internal static int[] GetEggMoves(PKM pkm, int species, int formnum, GameVersion version)
{
if (!pkm.InhabitedGeneration(pkm.GenNumber, species) || pkm.PersonalInfo.Gender == 255 && !FixedGenderFromBiGender.Contains(species))
int gen = pkm.Format <= 2 || pkm.VC ? 2 : pkm.GenNumber;
if (!pkm.InhabitedGeneration(gen, species) || pkm.PersonalInfo.Gender == 255 && !FixedGenderFromBiGender.Contains(species))
return new int[0];
if (version == GameVersion.Any)
version = (GameVersion)pkm.Version;
return GetEggMoves(pkm.GenNumber, species, formnum, version);
return GetEggMoves(gen, species, formnum, version);
}
private static int[] GetEggMoves(int gen, int species, int formnum, GameVersion version)
{

View file

@ -569,8 +569,8 @@ namespace PKHeX.Core
int gen = GenNumber;
switch (Generation)
{
case 1: return Format == 1 || VC1;
case 2: return Format == 2 || VC2;
case 1: return Format == 1 || VC; // species compat checked via sanity above
case 2: return Format == 2 || VC;
case 3: return Gen3;
case 4: return 3 <= gen && gen <= 4;
case 5: return 3 <= gen && gen <= 5;

View file

@ -61,6 +61,8 @@ namespace PKHeX.Tests.Legality
var pkm = PKMConverter.GetPKMfromBytes(data, prefer: format);
Assert.IsNotNull(pkm, $"Failed to load PKM: {new FileInfo(file).Name}.");
Legal.AllowGBCartEra = fi.DirectoryName.Contains("GBCartEra");
Legal.AllowGen1Tradeback = fi.DirectoryName.Contains("1 Tradeback");
var legality = new LegalityAnalysis(pkm);
Assert.IsTrue(legality.Valid == IsValid, $"Failed to validate PKM as {(IsValid ? "Valid" : "Invalid")}: {fi.Directory.Name}\\{fi.Name}.");
}