Misc database fixes

Initialize move array for WC3 if none are present
Closes #1472
More gracefully handle invalid version pkms in a given format (gen5
origin version pkm on gen4 format no longer throws an exception).
This commit is contained in:
Kurt 2017-09-20 09:04:30 -07:00
parent b63e53af95
commit 1149845db5
2 changed files with 2 additions and 2 deletions

View File

@ -241,7 +241,7 @@ private static CheckMoveResult[] ParseMoves(PKM pkm, MoveParseSource source, Leg
if (pkm.Format <= 2)
generations = generations.Where(z => z < info.EncounterMoves.LevelUpMoves.Length).ToArray();
int lastgen = generations.Last();
int lastgen = generations.LastOrDefault();
foreach (var gen in generations)
{
ParseMovesByGeneration(pkm, res, gen, info, moveInfo, lastgen);

View File

@ -20,7 +20,7 @@ public class WC3 : MysteryGift, IRibbonSetEvent3
public int Language { get; set; } = -1;
public override int Species { get; set; }
public override bool IsEgg { get; set; }
public override int[] Moves { get; set; }
public override int[] Moves { get; set; } = new int[0];
public bool NotDistributed { get; set; }
public bool? Shiny { get; set; } // null = allow, false = never, true = always
public bool Fateful { get; set; } // Obedience Flag