mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-28 06:50:23 +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 } };
|
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!
|
for (int i = Chain.Count-1; i >= 0; i--) // reverse evolution!
|
||||||
{
|
{
|
||||||
|
bool oneValid = false;
|
||||||
foreach (var evo in Chain[i].StageEntryMethods)
|
foreach (var evo in Chain[i].StageEntryMethods)
|
||||||
{
|
{
|
||||||
if (!evo.Valid(pkm, lvl))
|
if (!evo.Valid(pkm, lvl))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
oneValid = true;
|
||||||
if (evo.Species > maxSpecies) // Gen7 Personal Formes -- unmap the forme personal entry to the actual species ID since species are consecutive
|
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));
|
dl.Add(evo.GetDexLevel(pkm.Species - Chain.Count + i, lvl));
|
||||||
else
|
else
|
||||||
|
@ -366,6 +368,8 @@ namespace PKHeX
|
||||||
lvl--;
|
lvl--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!oneValid)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return dl;
|
return dl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue