mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 13:03:06 +00:00
Fix disjointed evolution chains
Track if any of the evolution methods in the stage are valid; if none then the chain is broken => return.
This commit is contained in:
parent
cfe5b25bfb
commit
dd5eebc5b2
1 changed files with 4 additions and 0 deletions
|
@ -352,11 +352,13 @@ namespace PKHeX
|
|||
List<DexLevel> dl = new List<DexLevel> { new DexLevel { Species = pkm.Species, Level = lvl, Form = pkm.AltForm } };
|
||||
for (int i = Chain.Count-1; i >= 0; i--) // reverse evolution!
|
||||
{
|
||||
bool oneValid = false;
|
||||
foreach (var evo in Chain[i].StageEntryMethods)
|
||||
{
|
||||
if (!evo.Valid(pkm, lvl))
|
||||
continue;
|
||||
|
||||
oneValid = true;
|
||||
if (evo.Species > maxSpecies) // Gen7 Personal Formes -- unmap the forme personal entry to the actual species ID since species are consecutive
|
||||
dl.Add(evo.GetDexLevel(pkm.Species - Chain.Count + i, lvl));
|
||||
else
|
||||
|
@ -366,6 +368,8 @@ namespace PKHeX
|
|||
lvl--;
|
||||
break;
|
||||
}
|
||||
if (!oneValid)
|
||||
break;
|
||||
}
|
||||
return dl;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue