mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-25 07:56:18 -05:00
Add egg level check
Catches level 12 charizards and level 50 tyranitars that were bred
This commit is contained in:
@@ -292,6 +292,8 @@ private LegalityCheck verifyLevel()
|
||||
int lvl = pk6.CurrentLevel;
|
||||
if (lvl < pk6.Met_Level)
|
||||
return new LegalityCheck(Severity.Invalid, "Current level is below met level.");
|
||||
if (pk6.WasEgg && !Legal.getEvolutionValid(pk6))
|
||||
return new LegalityCheck(Severity.Invalid, "Level is below evolution requirements.");
|
||||
if (lvl > pk6.Met_Level && lvl > 1 && lvl != 100 && pk6.EXP == PKX.getEXP(pk6.Stat_Level, pk6.Species))
|
||||
return new LegalityCheck(Severity.Fishy, "Current experience matches level threshold.");
|
||||
|
||||
|
||||
@@ -351,6 +351,15 @@ internal static bool getIsFossil(PK6 pk6)
|
||||
|
||||
return false;
|
||||
}
|
||||
internal static bool getEvolutionValid(PK6 pk6)
|
||||
{
|
||||
var curr = getValidPreEvolutions(pk6);
|
||||
var poss = getValidPreEvolutions(pk6, 100);
|
||||
|
||||
if (SplitBreed.Contains(getBaseSpecies(pk6, 1)))
|
||||
return curr.Count() >= poss.Count() - 1;
|
||||
return curr.Count() >= poss.Count();
|
||||
}
|
||||
internal static IEnumerable<int> getLineage(PK6 pk6)
|
||||
{
|
||||
List<int> res = new List<int>();
|
||||
@@ -453,9 +462,10 @@ private static IEnumerable<EncounterArea> getSlots(PK6 pk6, IEnumerable<Encounte
|
||||
}
|
||||
return slotLocations;
|
||||
}
|
||||
private static IEnumerable<DexLevel> getValidPreEvolutions(PK6 pk6)
|
||||
private static IEnumerable<DexLevel> getValidPreEvolutions(PK6 pk6, int lvl = -1)
|
||||
{
|
||||
int lvl = pk6.CurrentLevel;
|
||||
if (lvl < 0)
|
||||
lvl = pk6.CurrentLevel;
|
||||
if (pk6.Species == 292 && pk6.Met_Level + 1 <= lvl && lvl >= 20)
|
||||
return new List<DexLevel>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user