Move shedinja/egg evo chain short circuit

Some routes use the evolutiontree directly instead of this method (with the same name); should probably consolidate but meh

This causes Shedinja to yield the correct evolution chain when called directly (because nothing naturally evolves to shedinja; it's created out of thin air as a clone)

Take the egg short circuit with it to keep things simple
This commit is contained in:
Kurt
2020-01-11 21:43:58 -08:00
parent 0eca1bbd1c
commit f6fb54aecc
2 changed files with 18 additions and 17 deletions

View File

@@ -235,23 +235,6 @@ internal static List<EvoCriteria> GetValidPreEvolutions(PKM pkm, int maxspecieso
{
if (lvl < 0)
lvl = pkm.CurrentLevel;
if (pkm.IsEgg && !skipChecks)
{
return new List<EvoCriteria>(1)
{
new EvoCriteria(pkm.Species, pkm.AltForm) { Level = lvl, MinLevel = lvl },
};
}
// Shedinja's evolution case can be a little tricky; hard-code handling.
if (pkm.Species == (int)Species.Shedinja && lvl >= 20 && (!pkm.HasOriginalMetLocation || pkm.Met_Level + 1 <= lvl))
{
return new List<EvoCriteria>(2)
{
new EvoCriteria((int)Species.Shedinja, 0) { Level = lvl, MinLevel = 20 },
new EvoCriteria((int)Species.Nincada, 0) { Level = lvl, MinLevel = 1 },
};
}
if (maxspeciesorigin == -1 && pkm.InhabitedGeneration(2) && pkm.Format <= 2 && pkm.GenNumber == 1)
maxspeciesorigin = MaxSpeciesID_2;

View File

@@ -206,6 +206,24 @@ public List<EvoCriteria> GetValidPreEvolutions(PKM pkm, int maxLevel, int maxSpe
{
if (maxSpeciesOrigin <= 0)
maxSpeciesOrigin = Legal.GetMaxSpeciesOrigin(pkm);
if (pkm.IsEgg && !skipChecks)
{
return new List<EvoCriteria>(1)
{
new EvoCriteria(pkm.Species, pkm.AltForm) { Level = maxLevel, MinLevel = maxLevel },
};
}
// Shedinja's evolution case can be a little tricky; hard-code handling.
if (pkm.Species == (int)Species.Shedinja && maxLevel >= 20 && (!pkm.HasOriginalMetLocation || pkm.Met_Level + 1 <= maxLevel))
{
return new List<EvoCriteria>(2)
{
new EvoCriteria((int)Species.Shedinja, 0) { Level = maxLevel, MinLevel = 20 },
new EvoCriteria((int)Species.Nincada, 0) { Level = maxLevel, MinLevel = 1 },
};
}
return GetExplicitLineage(pkm, maxLevel, skipChecks, maxSpeciesOrigin, minLevel);
}