Fix move parsing for eggs

no encounter provided => moves not parsed correctly.
Just do the same loop without writing the encounter (as it will only
iterate once).
This commit is contained in:
Kurt
2017-04-05 21:28:03 -07:00
parent 17c682df58
commit 92ed589900

View File

@@ -2329,8 +2329,8 @@ private CheckResult[] verifyMoves(GameVersion game = GameVersion.Any)
}
private CheckResult[] parseMovesForEncounters(GameVersion game, List<int>[] validLevelMoves, List<int>[] validTMHM, List<int>[] validTutor, int[] Moves)
{
if (pkm.Species == 235) // special handling for smeargle
return parseMovesForSmeargle(Moves, validLevelMoves); // smeargle can have any moves except a few
if (pkm.Species == 235) // special handling for Smeargle
return parseMovesForSmeargle(Moves, validLevelMoves); // Smeargle can have any moves except a few
// Gather Encounters
var encounters = new List<object>();
@@ -2338,20 +2338,16 @@ private CheckResult[] parseMovesForEncounters(GameVersion game, List<int>[] vali
encounters.AddRange(EventGiftMatch);
if (null != EncounterStaticMatch)
encounters.AddRange(EncounterStaticMatch);
if (null != EncounterMatch)
encounters.Add(EncounterMatch);
if (!encounters.Any())
return parseMoves(pkm.Moves, validLevelMoves, pkm.RelearnMoves, validTMHM, validTutor, new int[0], new int[0], new int[0], new int[0]);
encounters.Add(EncounterMatch); // can be null
// Iterate over encounters
CheckResult[] res = new CheckResult[4];
bool pre3DS = pkm.GenNumber < 6;
CheckResult[] res = new CheckResult[4];
foreach (var enc in encounters)
{
EncounterMatch = enc;
res = pre3DS
? parseMovesPre3DS(game, validLevelMoves, validTMHM, validTutor, Moves)
? parseMovesPre3DS(game, validLevelMoves, validTMHM, validTutor, Moves)
: parseMoves3DS(game, validLevelMoves, validTMHM, validTutor, Moves);
if (res.All(x => x.Valid))