diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs
index 0f7b04f4c..2abb8c35f 100644
--- a/PKHeX.Core/Editing/CommonEdits.cs
+++ b/PKHeX.Core/Editing/CommonEdits.cs
@@ -282,9 +282,15 @@ public static void SetGender(this PKM pk, int gender)
/// Fetches based on the provided .
///
/// Pokémon to modify.
+ /// best suited for the current data.
+ public static IReadOnlyList GetSuggestedRelearnMoves(this PKM pk) => new LegalityAnalysis(pk).GetSuggestedRelearnMoves();
+
+ ///
+ /// Fetches based on the provided .
+ ///
/// which contains parsed information pertaining to legality.
/// best suited for the current data.
- public static IReadOnlyList GetSuggestedRelearnMoves(this PKM pk, LegalityAnalysis legal)
+ public static IReadOnlyList GetSuggestedRelearnMoves(this LegalityAnalysis legal)
{
var m = legal.GetSuggestedRelearn();
if (m.Any(z => z != 0))
@@ -361,7 +367,7 @@ public static void ApplySetDetails(this PKM pk, ShowdownSet Set)
var legal = new LegalityAnalysis(pk);
if (legal.Parsed && legal.Info.Relearn.Any(z => !z.Valid))
- pk.SetRelearnMoves(pk.GetSuggestedRelearnMoves(legal));
+ pk.SetRelearnMoves(legal.GetSuggestedRelearnMoves());
pk.RefreshChecksum();
}
@@ -606,7 +612,17 @@ public static void MaximizeLevel(this PKM pkm)
public static int[] GetMoveSet(this PKM pkm, bool random = false)
{
var la = new LegalityAnalysis(pkm);
- return pkm.GetMoveSet(la, random);
+ var moves = pkm.GetMoveSet(la, random);
+
+ if (random)
+ return moves;
+
+ var clone = pkm.Clone();
+ clone.SetMoves(moves);
+ var newLa = new LegalityAnalysis(pkm);
+
+ // ReSharper disable once TailRecursiveCall
+ return newLa.Valid ? moves : GetMoveSet(pkm, true);
}
///
@@ -630,7 +646,7 @@ public static int[] GetMoveSet(this PKM pkm, LegalityAnalysis la, bool random =
const int count = 4;
if (m.Length > count)
- return m.Skip(m.Length - count).ToArray();
+ return m.SliceEnd(m.Length - count);
Array.Resize(ref m, count);
return m;
}
diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
index 9c22c1dd8..98be563c4 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
@@ -671,7 +671,7 @@ private bool SetSuggestedRelearnMoves(bool silent = false)
if (pkm.Format < 6)
return false;
- var m = pkm.GetSuggestedRelearnMoves(Legality);
+ var m = Legality.GetSuggestedRelearnMoves();
if (pkm.RelearnMoves.SequenceEqual(m))
return false;