diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 39cf09dd9..a2972d0e7 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -895,5 +895,27 @@ public void TransferPropertiesWithReflection(PKM Source, PKM Destination) ReflectUtil.SetValue(Destination, property, prop); } } + + /// + /// Clears moves that a may have, possibly from a future generation. + /// + public void ClearInvalidMoves() + { + uint invalid = 0; + var moves = Moves; + for (var i = 0; i < moves.Length; i++) + { + if (moves[i] <= MaxMoveID) + continue; + + invalid++; + moves[i] = 0; + } + if (invalid == 0) + return; + + Moves = moves; + FixMoves(); + } } } diff --git a/PKHeX.Core/PKM/PKMConverter.cs b/PKHeX.Core/PKM/PKMConverter.cs index fc9225750..fbcb91e0f 100644 --- a/PKHeX.Core/PKM/PKMConverter.cs +++ b/PKHeX.Core/PKM/PKMConverter.cs @@ -227,6 +227,7 @@ public static PKM convertToFormat(PKM pk, Type PKMType, out string comment) return null; } pkm = ((PK2) pk).convertToPK1(); + pkm.ClearInvalidMoves(); } else pkm = null;