Minor tweaks

This commit is contained in:
Kurt 2021-02-18 17:26:06 -08:00
parent 83c61a2515
commit d61e646ca9
2 changed files with 9 additions and 14 deletions

View File

@ -41,9 +41,9 @@ public static IEnumerable<IEncounterable> GetEncounters(PKM pkm)
if (partial != null)
yield return partial;
}
yield break;
yield break;
}
}
if (pkm.WasBredEgg)

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using static PKHeX.Core.Species;
namespace PKHeX.Core
@ -77,20 +76,16 @@ private static IReadOnlyList<EvoCriteria> GetOriginChain(PKM pkm, int maxSpecies
var tempMax = pkm.CurrentLevel;
var chain = EvolutionChain.GetValidPreEvolutions(pkm, maxSpecies, tempMax, minLevel);
for (int i = chain.Count - 1; i >= 0; i--)
foreach (var evo in chain)
{
var evo = chain[i];
if (evo.MinLevel > maxLevel)
{
chain.RemoveAt(i);
if (chain.Any(z => z.Level >= maxLevel))
continue;
chain.Clear();
break;
}
// Check for invalid evolutions, or cases where they may be under-leveled encounters of an evolution.
if (evo.Level > maxLevel)
evo.Level = maxLevel;
if (evo.MinLevel <= maxLevel)
continue;
evo.MinLevel = maxLevel;
if (evo.RequiresLvlUp)
maxLevel--;
}
return chain;
}