mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-20 12:48:30 -05:00
parent
8a1691eb91
commit
d19b83000d
|
|
@ -895,5 +895,27 @@ public void TransferPropertiesWithReflection(PKM Source, PKM Destination)
|
|||
ReflectUtil.SetValue(Destination, property, prop);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears moves that a <see cref="PKM"/> may have, possibly from a future generation.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user