/// <summary> /// Gets a moveset for the provided <see cref="PKM"/> data. /// </summary> /// <param name="la">Precomputed optional</param> /// <param name="random">Full movepool & shuffling</param> /// <returns>4 moves</returns> public static int[] GetMoveSet(this LegalityAnalysis la, bool random = false) { int[] m = la.GetSuggestedCurrentMoves(random ? MoveSourceType.All : MoveSourceType.Encounter); var learn = la.GetSuggestedMovesAndRelearn(); if (!m.All(z => learn.Contains(z))) { m = m.Intersect(learn).ToArray(); } if (random && !la.Entity.IsEgg) { Util.Shuffle(m.AsSpan()); } const int count = 4; if (m.Length > count) { return(m.SliceEnd(m.Length - count)); } Array.Resize(ref m, count); return(m); }
private static IEnumerable <int> AllSuggestedMoves(this LegalityAnalysis analysis) { if (!analysis.Parsed) { return(new int[4]); } return(analysis.GetSuggestedCurrentMoves()); }