diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 7804d5417..5e35b38ae 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -135,7 +135,37 @@ internal static int GetMaxSpeciesOrigin(PKM pkm) internal static bool HasVisitedB2W2(this PKM pkm, int species) => pkm.InhabitedGeneration(5, species); internal static bool HasVisitedORAS(this PKM pkm, int species) => pkm.InhabitedGeneration(6, species) && (pkm.AO || !pkm.IsUntraded); internal static bool HasVisitedUSUM(this PKM pkm, int species) => pkm.InhabitedGeneration(7, species) && (pkm.USUM || !pkm.IsUntraded); - internal static bool IsMovesetRestricted(this PKM pkm, int gen) => (gen == 7 && pkm.Version is (int)GameVersion.GO or (int)GameVersion.GP or (int)GameVersion.GE) || pkm.IsUntraded; + + /// + /// Indicates if the moveset is restricted to only the original version. + /// + /// Entity to check + /// + internal static bool IsMovesetRestricted(this PKM pkm) + { + if (pkm.IsUntraded) + return true; + if (pkm.BDSP) + return true; + return false; + } + + /// + /// Indicates if the moveset is restricted to only the original version. + /// + /// Entity to check + /// Generation the move check is for + /// + internal static bool IsMovesetRestricted(this PKM pkm, int gen) + { + if (pkm.IsMovesetRestricted()) + return true; + return gen switch + { + 7 when pkm.Version is (int)GameVersion.GO or (int)GameVersion.GP or (int)GameVersion.GE => true, + _ => false, + }; + } public static int GetMaxLengthOT(int generation, LanguageID language) => language switch { diff --git a/PKHeX.Core/Legality/MoveList.cs b/PKHeX.Core/Legality/MoveList.cs index 0f002042e..b4133d5f0 100644 --- a/PKHeX.Core/Legality/MoveList.cs +++ b/PKHeX.Core/Legality/MoveList.cs @@ -173,20 +173,11 @@ internal static IReadOnlyList[] GetValidMovesAllGens(PKM pkm, IReadOnlyList internal static IEnumerable GetValidMoves(PKM pkm, IReadOnlyList evoChain, int generation, MoveSourceType types = MoveSourceType.ExternalSources, bool RemoveTransferHM = true) { GameVersion version = (GameVersion)pkm.Version; - if (!pkm.IsUntraded && !IsLandlockedFormat(pkm)) + if (!pkm.IsMovesetRestricted(generation)) version = Any; return GetValidMoves(pkm, version, evoChain, generation, types: types, RemoveTransferHM: RemoveTransferHM); } - private static bool IsLandlockedFormat(PKM pkm) - { - if (pkm.BDSP) - return true; - if (pkm.LGPE) - return pkm.Format == 7; - return false; - } - internal static IEnumerable GetValidRelearn(PKM pkm, int species, int form, GameVersion version = Any) { return GetValidRelearn(pkm, species, form, Breeding.GetCanInheritMoves(species), version); diff --git a/PKHeX.Core/Legality/MoveListSuggest.cs b/PKHeX.Core/Legality/MoveListSuggest.cs index d0edd06ce..d14841089 100644 --- a/PKHeX.Core/Legality/MoveListSuggest.cs +++ b/PKHeX.Core/Legality/MoveListSuggest.cs @@ -33,7 +33,7 @@ private static int[] GetSuggestedMoves(PKM pkm, IReadOnlyList GetValidMoves(PKM pkm, IReadOnlyList> evoChains, MoveSourceType types = MoveSourceType.ExternalSources, bool RemoveTransferHM = true) { GameVersion version = (GameVersion)pkm.Version; - if (!pkm.IsUntraded) + if (!pkm.IsMovesetRestricted()) version = GameVersion.Any; return GetValidMoves(pkm, version, evoChains, types: types, RemoveTransferHM: RemoveTransferHM); }