mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-10 16:06:06 -05:00
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:
@@ -814,9 +814,9 @@ private static ICollection<int> GetSplitBreedGeneration(int generation)
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -41,9 +41,8 @@ public static IEnumerable<IEncounterable> GetEncounters(PKM pkm, LegalInfo info)
|
||||
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))
|
||||
|
||||
@@ -7,11 +7,12 @@ internal static class MoveEgg
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -569,8 +569,8 @@ public bool InhabitedGeneration(int Generation, int species = -1)
|
||||
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;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -61,6 +61,8 @@ private static void VerifyAll(string folder, string name, bool IsValid)
|
||||
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}.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user