Fix levelup->evo fetching of next levelup move

Correctly fixes #1163 (test cases added), eg wooper->quagsire would
learn yawn at 31 before evolving; the getmoves wouldn't provide yawn
(stopped at 30) with the old code; the lvl decrement was removed in the
incorrect commit, providing a legal verdict which was obtained
incorrectly (dexlevels were inaccurate)
This commit is contained in:
Kurt 2018-04-17 19:49:33 -07:00
parent f767b2db0f
commit 8250bc58cd
4 changed files with 7 additions and 2 deletions

View File

@ -1590,8 +1590,9 @@ private static IEnumerable<int> GetValidMoves(PKM pkm, GameVersion Version, DexL
return r.Distinct();
}
foreach (DexLevel evo in vs)
for (var i = 0; i < vs.Length; i++)
{
DexLevel evo = vs[i];
var minlvlevo1 = 1;
var minlvlevo2 = 1;
if (Generation == 1)
@ -1608,7 +1609,11 @@ private static IEnumerable<int> GetValidMoves(PKM pkm, GameVersion Version, DexL
if (evo.MinLevel > 1)
minlvlevo2 = Math.Min(pkm.CurrentLevel, evo.MinLevel);
}
r.AddRange(GetMoves(pkm, evo.Species, minlvlevo1, minlvlevo2, evo.Level, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation));
var maxLevel = evo.Level;
if (i != 0 && vs[i - 1].RequiresLvlUp) // evolution
++maxLevel; // allow lvlmoves from the level it evolved to the next species
r.AddRange(GetMoves(pkm, evo.Species, minlvlevo1, minlvlevo2, maxLevel, pkm.AltForm, moveTutor, Version,
LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation));
}
if (pkm.Format <= 3)