diff --git a/PKHeX.Core/Game/GameStrings/GameDataSource.cs b/PKHeX.Core/Game/GameStrings/GameDataSource.cs index a0783837f..a814b30f8 100644 --- a/PKHeX.Core/Game/GameStrings/GameDataSource.cs +++ b/PKHeX.Core/Game/GameStrings/GameDataSource.cs @@ -133,9 +133,9 @@ private static ComboItem[] GetVersionList(GameStrings s) return Util.GetUnsortedCBList(list, OrderedVersionArray); } - public List GetItemDataSource(GameVersion game, EntityContext context, ReadOnlySpan allowed, bool HaX = false) + public List GetItemDataSource(GameVersion version, EntityContext context, ReadOnlySpan allowed, bool HaX = false) { - var items = Strings.GetItemStrings(context, game); + var items = Strings.GetItemStrings(context, version); return HaX ? Util.GetCBList(items) : Util.GetCBList(items, allowed); } } diff --git a/PKHeX.Core/Game/GameStrings/GameStrings.cs b/PKHeX.Core/Game/GameStrings/GameStrings.cs index 52045d0e7..65e717543 100644 --- a/PKHeX.Core/Game/GameStrings/GameStrings.cs +++ b/PKHeX.Core/Game/GameStrings/GameStrings.cs @@ -729,11 +729,11 @@ private static void Deduplicate(Span arr, int group) } } - public string[] GetItemStrings(EntityContext context, GameVersion game = GameVersion.Any) => context switch + public string[] GetItemStrings(EntityContext context, GameVersion version = GameVersion.Any) => context switch { EntityContext.Gen1 => g1items, EntityContext.Gen2 => g2items, - EntityContext.Gen3 => GetItemStrings3(game), + EntityContext.Gen3 => GetItemStrings3(version), EntityContext.Gen4 => g4items, // mail names changed 4->5 EntityContext.Gen8b => GetItemStrings8b(), EntityContext.Gen9 => GetItemStrings9(), @@ -778,9 +778,9 @@ static void InsertZero(Span arr, string insert) } } - private string[] GetItemStrings3(GameVersion game) + private string[] GetItemStrings3(GameVersion version) { - switch (game) + switch (version) { case GameVersion.COLO: return g3coloitems; diff --git a/PKHeX.Core/Game/GameUtil.cs b/PKHeX.Core/Game/GameUtil.cs index 4beafa629..0c1a3e1f0 100644 --- a/PKHeX.Core/Game/GameUtil.cs +++ b/PKHeX.Core/Game/GameUtil.cs @@ -27,8 +27,8 @@ private static GameVersion[] GetValidGameVersions() /// /// Indicates if the value is a value used by the games or is an aggregate indicator. /// - /// Game to check - public static bool IsValidSavedVersion(this GameVersion game) => game is > 0 and <= HighestGameID; + /// Game to check + public static bool IsValidSavedVersion(this GameVersion version) => version is > 0 and <= HighestGameID; /// /// Most recent game ID utilized by official games. @@ -105,27 +105,27 @@ private static GameVersion[] GetValidGameVersions() /// /// Gets the Generation the belongs to. /// - /// Game to retrieve the generation for + /// Game to retrieve the generation for /// Generation ID - public static byte GetGeneration(this GameVersion game) + public static byte GetGeneration(this GameVersion version) { - if (game.IsValidSavedVersion()) - return game.GetGenerationFromSaved(); + if (version.IsValidSavedVersion()) + return version.GetGenerationFromSaved(); - if (Gen1.Contains(game)) return 1; - if (Gen2.Contains(game)) return 2; - if (Gen3.Contains(game)) return 3; - if (Gen4.Contains(game)) return 4; - if (Gen5.Contains(game)) return 5; - if (Gen6.Contains(game)) return 6; - if (Gen7.Contains(game)) return 7; - if (Gen7b.Contains(game)) return 7; - if (Gen8.Contains(game)) return 8; - if (Gen9.Contains(game)) return 9; + if (Gen1.Contains(version)) return 1; + if (Gen2.Contains(version)) return 2; + if (Gen3.Contains(version)) return 3; + if (Gen4.Contains(version)) return 4; + if (Gen5.Contains(version)) return 5; + if (Gen6.Contains(version)) return 6; + if (Gen7.Contains(version)) return 7; + if (Gen7b.Contains(version)) return 7; + if (Gen8.Contains(version)) return 8; + if (Gen9.Contains(version)) return 9; return 0; } - public static byte GetGenerationFromSaved(this GameVersion game) => game switch + public static byte GetGenerationFromSaved(this GameVersion version) => version switch { RD or GN or BU or YW => 1, GD or SI or C => 2, @@ -146,9 +146,9 @@ public static byte GetGeneration(this GameVersion game) /// /// Gets the Generation the belongs to. /// - /// Game to retrieve the generation for + /// Game to retrieve the generation for /// Generation ID - public static ushort GetMaxSpeciesID(this GameVersion game) => game switch + public static ushort GetMaxSpeciesID(this GameVersion version) => version switch { RD or GN or BU or YW => Legal.MaxSpeciesID_1, GD or SI or C => Legal.MaxSpeciesID_2, diff --git a/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3FRLG.cs b/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3FRLG.cs index 14ef3f93f..de5975dc7 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3FRLG.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3FRLG.cs @@ -15,7 +15,8 @@ internal static class Encounters3FRLG internal static readonly EncounterArea3[] SlotsFR = GetRegular("fr", "fr"u8, FR); internal static readonly EncounterArea3[] SlotsLG = GetRegular("lg", "lg"u8, LG); - private static EncounterArea3[] GetRegular([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan ident, [ConstantExpected] GameVersion game) => EncounterArea3.GetAreas(Get(resource, ident), game); + private static EncounterArea3[] GetRegular([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan ident, [ConstantExpected] GameVersion version) + => EncounterArea3.GetAreas(Get(resource, ident), version); private const string tradeFRLG = "tradefrlg"; private static readonly string[][] TradeNames = Util.GetLanguageStrings7(tradeFRLG); diff --git a/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3RSE.cs b/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3RSE.cs index 50639074c..3a22dce58 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3RSE.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Gen3/Encounters3RSE.cs @@ -17,10 +17,10 @@ internal static class Encounters3RSE internal static readonly EncounterArea3[] SlotsS = GetRegular("s", "sa"u8, S); internal static readonly EncounterArea3[] SlotsE = GetRegular("e", "em"u8, E); - private static EncounterArea3[] GetRegular([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan ident, [ConstantExpected] GameVersion game) - => EncounterArea3.GetAreas(Get(resource, ident), game); - private static EncounterArea3[] GetSwarm([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan ident, [ConstantExpected] GameVersion game) - => EncounterArea3.GetAreasSwarm(Get(resource, ident), game); + private static EncounterArea3[] GetRegular([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan ident, [ConstantExpected] GameVersion version) + => EncounterArea3.GetAreas(Get(resource, ident), version); + private static EncounterArea3[] GetSwarm([ConstantExpected] string resource, [Length(2, 2)] ReadOnlySpan ident, [ConstantExpected] GameVersion version) + => EncounterArea3.GetAreasSwarm(Get(resource, ident), version); private static readonly string[] TrainersPikachu = [string.Empty, "コロシアム", "COLOS", "COLOSSEUM", "ARENA", "COLOSSEUM", string.Empty, "CLAUDIO"]; private static readonly string[] TrainersCelebi = [string.Empty, "アゲト", "AGATE", "SAMARAGD", "SOFO", "EMERITAE", string.Empty, "ÁGATA"]; diff --git a/PKHeX.Core/Legality/Encounters/Data/Gen8/Encounters8Nest.cs b/PKHeX.Core/Legality/Encounters/Data/Gen8/Encounters8Nest.cs index 1b720d7a9..7b601ea94 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Gen8/Encounters8Nest.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Gen8/Encounters8Nest.cs @@ -306,7 +306,7 @@ public static bool IsInaccessibleRank12Nest(byte nestID, byte location) new(SWSH) { Species = 133, Level = 25, Ability = A2, IVs = new(31,31,31,-1,-1,-1), DynamaxLevel = 5, Moves = new(606,273,038,129), CanGigantamax = true }, // ★Sgr7194 Gigantamax Eevee ]; - private static EncounterStatic8N[] GetBase([Length(2, 2), ConstantExpected] string name, [ConstantExpected] GameVersion game) + private static EncounterStatic8N[] GetBase([Length(2, 2), ConstantExpected] string name, [ConstantExpected] GameVersion version) { var data = EncounterUtil.Get(name); const int size = 10; @@ -315,13 +315,13 @@ private static EncounterStatic8N[] GetBase([Length(2, 2), ConstantExpected] stri for (int i = 0; i < result.Length; i++) { var slice = data.Slice(i * size, size); - result[i] = EncounterStatic8N.Read(slice, game); + result[i] = EncounterStatic8N.Read(slice, version); } return result; } - private static EncounterStatic8ND[] GetDist([Length(2, 2), ConstantExpected] string name, [ConstantExpected] GameVersion game) + private static EncounterStatic8ND[] GetDist([Length(2, 2), ConstantExpected] string name, [ConstantExpected] GameVersion version) { var data = EncounterUtil.Get(name); const int size = 0x10; @@ -330,7 +330,7 @@ private static EncounterStatic8ND[] GetDist([Length(2, 2), ConstantExpected] str for (int i = 0; i < result.Length; i++) { var slice = data.Slice(i * size, size); - result[i] = EncounterStatic8ND.Read(slice, game); + result[i] = EncounterStatic8ND.Read(slice, version); } return result; diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator1.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator1.cs index 00e54b7df..2f0d188c0 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator1.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator1.cs @@ -8,9 +8,9 @@ public sealed class EncounterGenerator1 : IEncounterGenerator public static readonly EncounterGenerator1 Instance = new(); public bool CanGenerateEggs => false; - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible1(chain, groups, game); + var iterator = new EncounterPossible1(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator2.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator2.cs index e535aa1dc..d079209b5 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator2.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator2.cs @@ -9,9 +9,9 @@ public sealed class EncounterGenerator2 : IEncounterGenerator public static readonly EncounterGenerator2 Instance = new(); public bool CanGenerateEggs => true; - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible2(chain, groups, game, pk); + var iterator = new EncounterPossible2(chain, groups, version, pk); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator3.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator3.cs index 1f74126db..cac250ba9 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator3.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator3.cs @@ -10,9 +10,9 @@ public sealed class EncounterGenerator3 : IEncounterGenerator public static readonly EncounterGenerator3 Instance = new(); public bool CanGenerateEggs => true; - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible3(chain, groups, game); + var iterator = new EncounterPossible3(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator4.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator4.cs index 4f6de1ec8..e9673a8af 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator4.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator4.cs @@ -21,9 +21,9 @@ public IEnumerable GetEncounters(PKM pk, LegalInfo info) return GetEncounters(pk, chain, info); } - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible4(chain, groups, game, pk); + var iterator = new EncounterPossible4(chain, groups, version, pk); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator5.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator5.cs index 8e26f06b1..b70f8e999 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator5.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator5.cs @@ -17,9 +17,9 @@ public IEnumerable GetEncounters(PKM pk, LegalInfo info) return GetEncounters(pk, chain, info); } - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible5(chain, groups, game); + var iterator = new EncounterPossible5(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator6.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator6.cs index 7051aff86..6f5b29b2a 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator6.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator6.cs @@ -9,9 +9,9 @@ public sealed class EncounterGenerator6 : IEncounterGenerator public static readonly EncounterGenerator6 Instance = new(); public bool CanGenerateEggs => true; - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible6(chain, groups, game); + var iterator = new EncounterPossible6(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7.cs index 870b79ffc..ee4b665ad 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7.cs @@ -9,9 +9,9 @@ public sealed class EncounterGenerator7 : IEncounterGenerator public static readonly EncounterGenerator7 Instance = new(); public bool CanGenerateEggs => true; - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible7(chain, groups, game); + var iterator = new EncounterPossible7(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs index 12b29409a..42b4912c2 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs @@ -10,9 +10,9 @@ public sealed class EncounterGenerator7GG : IEncounterGenerator public static readonly EncounterGenerator7GG Instance = new(); public bool CanGenerateEggs => false; - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible7GG(chain, groups, game); + var iterator = new EncounterPossible7GG(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8.cs index af9baf42f..95ee1bc54 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8.cs @@ -9,9 +9,9 @@ public sealed class EncounterGenerator8 : IEncounterGenerator public static readonly EncounterGenerator8 Instance = new(); public bool CanGenerateEggs => true; - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible8(chain, groups, game); + var iterator = new EncounterPossible8(chain, groups, version); foreach (var enc in iterator) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8b.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8b.cs index 822a448be..3a0becf07 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8b.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator8b.cs @@ -4,14 +4,14 @@ namespace PKHeX.Core; -public sealed class EncounterGenerator8b : IEncounterGenerator +public sealed class EncounterGenerator8b : IEncounterGenerator, IEncounterGeneratorSWSH { public static readonly EncounterGenerator8b Instance = new(); public bool CanGenerateEggs => true; - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible8b(chain, groups, game, pk); + var iterator = new EncounterPossible8b(chain, groups, version, pk); foreach (var enc in iterator) yield return enc; } @@ -24,11 +24,11 @@ public IEnumerable GetEncounters(PKM pk, EvoCriteria[] chain, Le yield return enc.Encounter; } - public IEnumerable GetEncountersSWSH(PKM pk, EvoCriteria[] chain, GameVersion game) + public IEnumerable GetEncountersSWSH(PKM pk, EvoCriteria[] chain, GameVersion version) { if (pk is not PK8 pk8) yield break; - var iterator = new EncounterEnumerator8bSWSH(pk8, chain, game); + var iterator = new EncounterEnumerator8bSWSH(pk8, chain, version); foreach (var enc in iterator) yield return enc.Encounter; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator9.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator9.cs index b41dab634..af1d1979f 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator9.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator9.cs @@ -4,7 +4,7 @@ namespace PKHeX.Core; -public sealed class EncounterGenerator9 : IEncounterGenerator +public sealed class EncounterGenerator9 : IEncounterGenerator, IEncounterGeneratorSWSH { public static readonly EncounterGenerator9 Instance = new(); public bool CanGenerateEggs => true; @@ -23,18 +23,18 @@ public IEnumerable GetEncounters(PKM pk, LegalInfo info) }; } - public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var iterator = new EncounterPossible9(chain, groups, game); + var iterator = new EncounterPossible9(chain, groups, version); foreach (var enc in iterator) yield return enc; } - public IEnumerable GetEncountersSWSH(PKM pk, EvoCriteria[] chain, GameVersion game) + public IEnumerable GetEncountersSWSH(PKM pk, EvoCriteria[] chain, GameVersion version) { if (pk is not PK8 pk8) yield break; - var iterator = new EncounterEnumerator9SWSH(pk8, chain, game); + var iterator = new EncounterEnumerator9SWSH(pk8, chain, version); foreach (var enc in iterator) yield return enc.Encounter; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator12.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator12.cs index d9cadee3e..8e6ad1314 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator12.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator12.cs @@ -116,11 +116,11 @@ public IEnumerable GetEncounters(PKM pk, EvoCriteria[] chain, Le return GetEncounters(pk, info); } - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { // Don't call this method. - if (game.GetGeneration() == 1) - return EncounterGenerator1.Instance.GetPossible(pk, chain, game, groups); - return EncounterGenerator2.Instance.GetPossible(pk, chain, game, groups); + if (version.GetGeneration() == 1) + return EncounterGenerator1.Instance.GetPossible(pk, chain, version, groups); + return EncounterGenerator2.Instance.GetPossible(pk, chain, version, groups); } } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator7X.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator7X.cs index 64443e6aa..c923d0764 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator7X.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator7X.cs @@ -7,11 +7,11 @@ public sealed class EncounterGenerator7X : IEncounterGenerator public static readonly EncounterGenerator7X Instance = new(); public bool CanGenerateEggs => false; - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) => pk.Version switch + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) => pk.Version switch { - GameVersion.GO => EncounterGenerator7GO.Instance.GetPossible(pk, chain, game, groups), - > GameVersion.GO => EncounterGenerator7GG.Instance.GetPossible(pk, chain, game, groups), - _ => EncounterGenerator7.Instance.GetPossible(pk, chain, game, groups), + GameVersion.GO => EncounterGenerator7GO.Instance.GetPossible(pk, chain, version, groups), + > GameVersion.GO => EncounterGenerator7GG.Instance.GetPossible(pk, chain, version, groups), + _ => EncounterGenerator7.Instance.GetPossible(pk, chain, version, groups), }; public IEnumerable GetEncounters(PKM pk, LegalInfo info) diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator8X.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator8X.cs index ca2e4ebe8..f3839ca17 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator8X.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGenerator8X.cs @@ -8,12 +8,12 @@ public sealed class EncounterGenerator8X : IEncounterGenerator public static readonly EncounterGenerator8X Instance = new(); public bool CanGenerateEggs => false; - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) => game switch + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) => version switch { - GO => EncounterGenerator8GO.Instance.GetPossible(pk, chain, game, groups), - PLA => EncounterGenerator8a.Instance.GetPossible(pk, chain, game, groups), - BD or SP => EncounterGenerator8b.Instance.GetPossible(pk, chain, game, groups), - _ => EncounterGenerator8.Instance.GetPossible(pk, chain, game, groups), + GO => EncounterGenerator8GO.Instance.GetPossible(pk, chain, version, groups), + PLA => EncounterGenerator8a.Instance.GetPossible(pk, chain, version, groups), + BD or SP => EncounterGenerator8b.Instance.GetPossible(pk, chain, version, groups), + _ => EncounterGenerator8.Instance.GetPossible(pk, chain, version, groups), }; public IEnumerable GetEncounters(PKM pk, LegalInfo info) diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorDummy.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorDummy.cs index 00588760b..09e4d8da8 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorDummy.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorDummy.cs @@ -7,7 +7,7 @@ internal sealed class EncounterGeneratorDummy : IEncounterGenerator public static readonly EncounterGeneratorDummy Instance = new(); public bool CanGenerateEggs => false; - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) => []; + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) => []; public IEnumerable GetEncounters(PKM pk, EvoCriteria[] chain, LegalInfo info) => []; public IEnumerable GetEncounters(PKM _, LegalInfo __) => []; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorGO.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorGO.cs index b1563d2d6..c7791e2a5 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorGO.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/EncounterGeneratorGO.cs @@ -17,16 +17,16 @@ public IEnumerable GetEncounters(PKM pk, EvoCriteria[] chain, Le return []; } - public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) + public IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups) { - var lgpe = EncounterGenerator7GO.Instance.GetPossible(pk, chain, game, groups); + var lgpe = EncounterGenerator7GO.Instance.GetPossible(pk, chain, version, groups); foreach (var enc in lgpe) yield return enc; if (pk is PB7) yield break; - var home = EncounterGenerator8GO.Instance.GetPossible(pk, chain, game, groups); + var home = EncounterGenerator8GO.Instance.GetPossible(pk, chain, version, groups); foreach (var enc in home) yield return enc; } diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/IEncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/IEncounterGenerator.cs index 9262e98ae..456228bd1 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/IEncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/Lump/IEncounterGenerator.cs @@ -6,6 +6,11 @@ public interface IEncounterGenerator { IEnumerable GetEncounters(PKM pk, EvoCriteria[] chain, LegalInfo info); - IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups); + IEnumerable GetPossible(PKM pk, EvoCriteria[] chain, GameVersion version, EncounterTypeGroup groups); bool CanGenerateEggs { get; } } + +public interface IEncounterGeneratorSWSH +{ + IEnumerable GetEncountersSWSH(PKM pk, EvoCriteria[] chain, GameVersion version); +} diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterArea1.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterArea1.cs index edd3b6f67..ad0db6b7a 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterArea1.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterArea1.cs @@ -15,21 +15,21 @@ public sealed record EncounterArea1 : IEncounterArea public readonly SlotType1 Type; public readonly byte Rate; - public static EncounterArea1[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea1[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea1[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea1(input[i], game); + result[i] = new EncounterArea1(input[i], version); return result; } - private EncounterArea1(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea1(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = data[0]; // 1 byte unused Type = (SlotType1)data[2]; Rate = data[3]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterArea2.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterArea2.cs index 329d29a2c..922c7588a 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterArea2.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterArea2.cs @@ -30,22 +30,22 @@ public sealed record EncounterArea2 : IEncounterArea, IAreaLocat _ => Rates, }; - public static EncounterArea2[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea2[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea2[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea2(input[i], game); + result[i] = new EncounterArea2(input[i], version); return result; } - private EncounterArea2(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea2(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = data[0]; Time = (EncounterTime)data[1]; Type = (SlotType2)data[2]; Rate = data[3]; - Version = game; + Version = version; var slotData = data[4..]; if (Type > Surf) // Not Grass/Surf diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen3/Colo/EncounterGift3Colo.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen3/Colo/EncounterGift3Colo.cs index dc8c1b04a..d6e2822f4 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen3/Colo/EncounterGift3Colo.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen3/Colo/EncounterGift3Colo.cs @@ -31,12 +31,12 @@ public sealed record EncounterGift3Colo : IEncounterable, IEncounterMatch, IEnco public required ushort TID16 { get; init; } public required byte OriginalTrainerGender { get; init; } - public EncounterGift3Colo(ushort species, byte level, ReadOnlyMemory trainers, GameVersion game) + public EncounterGift3Colo(ushort species, byte level, ReadOnlyMemory trainers, GameVersion version) { Species = species; Level = level; TrainerNames = trainers; - Version = game; + Version = version; } public string Name => "Gift Encounter"; diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterArea3.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterArea3.cs index 449d63d34..b5b7a84f9 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterArea3.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterArea3.cs @@ -19,40 +19,40 @@ public sealed record EncounterArea3 : IEncounterArea, IAreaLocat public bool IsMatchLocation(ushort location) => location == Location; - public static EncounterArea3[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea3[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea3[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea3(input[i], game); + result[i] = new EncounterArea3(input[i], version); return result; } - public static EncounterArea3[] GetAreasSwarm(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea3[] GetAreasSwarm(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea3[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea3(input[i], game, SwarmGrass50); + result[i] = new EncounterArea3(input[i], version, SwarmGrass50); return result; } - private EncounterArea3(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea3(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = data[0]; // data[1] is unused because location is always <= 255. Type = (SlotType3)data[2]; Rate = data[3]; - Version = game; + Version = version; Slots = ReadRegularSlots(data[4..]); } - private EncounterArea3(ReadOnlySpan data, [ConstantExpected] GameVersion game, [ConstantExpected] SlotType3 type) + private EncounterArea3(ReadOnlySpan data, [ConstantExpected] GameVersion version, [ConstantExpected] SlotType3 type) { Location = data[0]; // data[1] is unused because location is always <= 255. Type = type; // data[2] but it's always the same value Rate = data[3]; - Version = game; + Version = version; Slots = ReadSwarmSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterTrade3.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterTrade3.cs index 382a9d841..1a8bef640 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterTrade3.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen3/EncounterTrade3.cs @@ -67,11 +67,11 @@ public sealed record EncounterTrade3 : IEncounterable, IEncounterMatch, IFixedTr } } - public EncounterTrade3(ReadOnlySpan names, byte index, GameVersion game, uint pid, ushort species, byte level) + public EncounterTrade3(ReadOnlySpan names, byte index, GameVersion version, uint pid, ushort species, byte level) { Nicknames = EncounterUtil.GetNamesForLanguage(names, index); TrainerNames = EncounterUtil.GetNamesForLanguage(names, (uint)(index + (names[1].Length >> 1))); - Version = game; + Version = version; PID = pid; Species = species; Level = level; diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterArea4.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterArea4.cs index fda55b063..5a21c893a 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterArea4.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterArea4.cs @@ -19,21 +19,21 @@ public sealed record EncounterArea4 : IEncounterArea, IGroundTyp public bool IsMatchLocation(ushort location) => location == Location; - public static EncounterArea4[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea4[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea4[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea4(input[i], game); + result[i] = new EncounterArea4(input[i], version); return result; } - private EncounterArea4(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea4(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = data[0]; // data[1] is unused because location is always <= 255. Type = (SlotType4)data[2]; Rate = data[3]; - Version = game; + Version = version; // although flags are 32bit, none have values > 16bit. GroundTile = (GroundTileAllowed)ReadUInt16LittleEndian(data[4..]); diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterTrade4PID.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterTrade4PID.cs index 25087596f..cca842af0 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterTrade4PID.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen4/EncounterTrade4PID.cs @@ -58,9 +58,9 @@ public sealed record EncounterTrade4PID : IEncounterable, IEncounterMatch, IEnco public byte ContestTough => Contest; public byte ContestSheen => 0; - public EncounterTrade4PID(ReadOnlySpan names, byte index, GameVersion game, uint pid, ushort species, byte level) + public EncounterTrade4PID(ReadOnlySpan names, byte index, GameVersion version, uint pid, ushort species, byte level) { - Version = game; + Version = version; Nicknames = EncounterUtil.GetNamesForLanguage(names, index); TrainerNames = EncounterUtil.GetNamesForLanguage(names, (uint)(index + (names[1].Length >> 1))); PID = pid; @@ -121,10 +121,10 @@ public PK4 ConvertToPKM(ITrainerInfo tr, EncounterCriteria criteria) return pk; } - private int GetReceivedLanguage(int lang, GameVersion game) + private int GetReceivedLanguage(int lang, GameVersion version) { if (Version == GameVersion.DPPt) - return GetLanguageDPPt(lang, game); + return GetLanguageDPPt(lang, version); // HG/SS // Has English Language ID for all except English origin, which is French @@ -133,13 +133,13 @@ private int GetReceivedLanguage(int lang, GameVersion game) return lang; } - private int GetLanguageDPPt(int lang, GameVersion game) + private int GetLanguageDPPt(int lang, GameVersion version) { // Has German Language ID for all except German origin, which is English if (Species == (int)Core.Species.Magikarp) return (int)(lang == (int)LanguageID.German ? LanguageID.English : LanguageID.German); // All other trades received (D/P only): English games have a Japanese language ID instead of English. - if (game is not GameVersion.Pt && lang == (int)LanguageID.English) + if (version is not GameVersion.Pt && lang == (int)LanguageID.English) return (int)LanguageID.Japanese; return lang; } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen5/DreamWorldEntry.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen5/DreamWorldEntry.cs index 47086341c..a037bc98c 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen5/DreamWorldEntry.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen5/DreamWorldEntry.cs @@ -9,26 +9,26 @@ namespace PKHeX.Core; { private int EntryCount => Move1 == 0 ? 1 : Move2 == 0 ? 1 : Move3 == 0 ? 2 : 3; - private void AddTo(GameVersion game, Span result, ref int ctr) + private void AddTo(GameVersion version, Span result, ref int ctr) { var p = PersonalTable.B2W2[Species]; var a = p.HasHiddenAbility ? AbilityPermission.OnlyHidden : AbilityPermission.OnlyFirst; if (Move1 == 0) { - result[ctr++] = new EncounterStatic5Entree(game, Species, Level, Form, Gender, a); + result[ctr++] = new EncounterStatic5Entree(version, Species, Level, Form, Gender, a); return; } - result[ctr++] = new EncounterStatic5Entree(game, Species, Level, Form, Gender, a, Move1); + result[ctr++] = new EncounterStatic5Entree(version, Species, Level, Form, Gender, a, Move1); if (Move2 == 0) return; - result[ctr++] = new EncounterStatic5Entree(game, Species, Level, Form, Gender, a, Move2); + result[ctr++] = new EncounterStatic5Entree(version, Species, Level, Form, Gender, a, Move2); if (Move3 == 0) return; - result[ctr++] = new EncounterStatic5Entree(game, Species, Level, Form, Gender, a, Move3); + result[ctr++] = new EncounterStatic5Entree(version, Species, Level, Form, Gender, a, Move3); } - public static EncounterStatic5Entree[] GetArray(GameVersion game, ReadOnlySpan t) + public static EncounterStatic5Entree[] GetArray(GameVersion version, ReadOnlySpan t) { // Split encounters with multiple permitted special moves -- a pk can only be obtained with 1 of the special moves! int count = 0; @@ -39,7 +39,7 @@ public static EncounterStatic5Entree[] GetArray(GameVersion game, ReadOnlySpan, IAreaLocat public bool IsMatchLocation(ushort location) => Location == location; - public static EncounterArea5[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea5[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea5[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea5(input[i], game); + result[i] = new EncounterArea5(input[i], version); return result; } - private EncounterArea5(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea5(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = ReadUInt16LittleEndian(data); Type = (SlotType5)data[2]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6AO.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6AO.cs index 4fcc66581..07a20301b 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6AO.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6AO.cs @@ -17,19 +17,19 @@ public sealed record EncounterArea6AO : IEncounterArea, IAreaL public bool IsMatchLocation(ushort location) => Location == location; - public static EncounterArea6AO[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea6AO[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea6AO[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea6AO(input[i], game); + result[i] = new EncounterArea6AO(input[i], version); return result; } - private EncounterArea6AO(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea6AO(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = ReadUInt16LittleEndian(data); Type = (SlotType6)data[2]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6XY.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6XY.cs index 2aef8f60f..8263a5aae 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6XY.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen6/EncounterArea6XY.cs @@ -31,12 +31,12 @@ public sealed record EncounterArea6XY : IEncounterArea, IAreaL public bool IsMatchLocation(ushort location) => Location == location; - public static EncounterArea6XY[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game, EncounterArea6XY safari) + public static EncounterArea6XY[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version, EncounterArea6XY safari) { int count = input.Length; var result = new EncounterArea6XY[count + 1]; for (int i = 0; i < count; i++) - result[i] = new EncounterArea6XY(input[i], game); + result[i] = new EncounterArea6XY(input[i], version); result[^1] = safari; return result; } @@ -50,11 +50,11 @@ public EncounterArea6XY() Slots = LoadSafariSlots(); } - private EncounterArea6XY(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea6XY(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = ReadUInt16LittleEndian(data); Type = (SlotType6)data[2]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen7/EncounterArea7.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen7/EncounterArea7.cs index 64b6e8cfe..72fa89ed7 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen7/EncounterArea7.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen7/EncounterArea7.cs @@ -23,19 +23,19 @@ public sealed record EncounterArea7 : IEncounterArea, IAreaLocat public bool IsMatchLocation(ushort location) => Location == location; - public static EncounterArea7[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea7[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea7[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea7(input[i], game); + result[i] = new EncounterArea7(input[i], version); return result; } - private EncounterArea7(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea7(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = ReadUInt16LittleEndian(data); Type = (SlotType7)data[2]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen7b/EncounterArea7b.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen7b/EncounterArea7b.cs index 8551202ac..a6d2a27a1 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen7b/EncounterArea7b.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen7b/EncounterArea7b.cs @@ -25,20 +25,20 @@ public bool IsMatchLocation(ushort location) return location == ToArea1 || location == ToArea2; } - public static EncounterArea7b[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea7b[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea7b[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea7b(input[i], game); + result[i] = new EncounterArea7b(input[i], version); return result; } - private EncounterArea7b(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea7b(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = data[0]; // Always < 255 ToArea1 = data[2]; ToArea2 = data[3]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterArea8.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterArea8.cs index bbe76dcee..91c449d34 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterArea8.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterArea8.cs @@ -308,19 +308,19 @@ public static bool IsWeatherBleedPossible(SlotType8 type, AreaWeather8 permit, b _ => None, }; - public static EncounterArea8[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game, [ConstantExpected] bool symbol = false) + public static EncounterArea8[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version, bool symbol = false) { var result = new EncounterArea8[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea8(input[i], symbol, game); + result[i] = new EncounterArea8(input[i], symbol, version); return result; } - private EncounterArea8(ReadOnlySpan areaData, [ConstantExpected] bool symbol, [ConstantExpected] GameVersion game) + private EncounterArea8(ReadOnlySpan areaData, bool symbol, [ConstantExpected] GameVersion version) { PermitCrossover = symbol; Location = areaData[0]; - Version = game; + Version = version; Slots = ReadSlots(areaData, areaData[1]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8N.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8N.cs index 75619e6da..2b0fa9e57 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8N.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8N.cs @@ -24,7 +24,7 @@ public sealed record EncounterStatic8N : EncounterStatic8Nest public override byte LevelMin => LevelCaps[MinRank * 2]; public override byte LevelMax => LevelCaps[(MaxRank * 2) + 1]; - public EncounterStatic8N(byte nestIndex, byte minRank, byte maxRank, byte flawless, [ConstantExpected] GameVersion game) : base(game) + public EncounterStatic8N(byte nestIndex, byte minRank, byte maxRank, byte flawless, [ConstantExpected] GameVersion version) : base(version) { NestIndex = nestIndex; MinRank = minRank; @@ -33,7 +33,7 @@ public EncounterStatic8N(byte nestIndex, byte minRank, byte maxRank, byte flawle FlawlessIVCount = flawless; } - public static EncounterStatic8N Read(ReadOnlySpan data, [ConstantExpected] GameVersion game) => new(data[6], data[7], data[8], data[9], game) + public static EncounterStatic8N Read(ReadOnlySpan data, [ConstantExpected] GameVersion version) => new(data[6], data[7], data[8], data[9], version) { Species = ReadUInt16LittleEndian(data), Form = data[2], diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8ND.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8ND.cs index adf32d3b2..4f384a525 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8ND.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterStatic8ND.cs @@ -17,7 +17,7 @@ public sealed record EncounterStatic8ND : EncounterStatic8Nest $"Distribution Raid Den Encounter - {Index:000}"; - public EncounterStatic8ND(byte lvl, byte dyna, byte flawless, byte index, [ConstantExpected] GameVersion game) : base(game) + public EncounterStatic8ND(byte lvl, byte dyna, byte flawless, byte index, [ConstantExpected] GameVersion version) : base(version) { Level = lvl; DynamaxLevel = dyna; @@ -25,7 +25,7 @@ public EncounterStatic8ND(byte lvl, byte dyna, byte flawless, byte index, [Const Index = index; } - public static EncounterStatic8ND Read(ReadOnlySpan data, [ConstantExpected] GameVersion game) + public static EncounterStatic8ND Read(ReadOnlySpan data, [ConstantExpected] GameVersion version) { var d = data[13]; var dlvl = (byte)(d & 0x7F); @@ -45,7 +45,7 @@ public static EncounterStatic8ND Read(ReadOnlySpan data, [ConstantExpected var move4 = ReadUInt16LittleEndian(data[10..]); var moves = new Moveset(move1, move2, move3, move4); - return new EncounterStatic8ND(data[12], dlvl, flawless, data[15], game) + return new EncounterStatic8ND(data[12], dlvl, flawless, data[15], version) { Species = ReadUInt16LittleEndian(data), Form = data[2], diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterTrade8.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterTrade8.cs index d2f5140b8..8f32ecbe7 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterTrade8.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8/EncounterTrade8.cs @@ -55,9 +55,9 @@ public sealed record EncounterTrade8 : IEncounterable, IEncounterMatch, IEncount public byte LevelMin => Level; public byte LevelMax => Level; - public EncounterTrade8(ReadOnlySpan names, byte index, GameVersion game, ushort species, byte level, byte memory, ushort arg, byte feel, byte intensity) + public EncounterTrade8(ReadOnlySpan names, byte index, GameVersion version, ushort species, byte level, byte memory, ushort arg, byte feel, byte intensity) { - Version = game; + Version = version; Nicknames = EncounterUtil.GetNamesForLanguage(names, index); TrainerNames = EncounterUtil.GetNamesForLanguage(names, (uint)(index + (names[1].Length >> 1))); Species = species; @@ -72,9 +72,9 @@ public EncounterTrade8(ReadOnlySpan names, byte index, GameVersion gam } [SetsRequiredMembers] - public EncounterTrade8(ReadOnlyMemory trainerNames, GameVersion game, ushort species, byte level, byte memory, ushort arg, byte feel, byte intensity) + public EncounterTrade8(ReadOnlyMemory trainerNames, GameVersion version, ushort species, byte level, byte memory, ushort arg, byte feel, byte intensity) { - Version = game; + Version = version; Nicknames = ReadOnlyMemory.Empty; TrainerNames = trainerNames; Species = species; diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterArea8b.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterArea8b.cs index 55df7e97e..c023303c8 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterArea8b.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterArea8b.cs @@ -16,19 +16,19 @@ public sealed record EncounterArea8b : IEncounterArea, IAreaLoc public readonly ushort Location; public readonly SlotType8b Type; - public static EncounterArea8b[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea8b[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea8b[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea8b(input[i], game); + result[i] = new EncounterArea8b(input[i], version); return result; } - private EncounterArea8b(ReadOnlySpan data, [ConstantExpected] GameVersion game) + private EncounterArea8b(ReadOnlySpan data, [ConstantExpected] GameVersion version) { Location = ReadUInt16LittleEndian(data); Type = (SlotType8b)data[2]; - Version = game; + Version = version; Slots = ReadSlots(data[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterTrade8b.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterTrade8b.cs index 5024bcc78..f0826a909 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterTrade8b.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen8b/EncounterTrade8b.cs @@ -58,9 +58,9 @@ public sealed record EncounterTrade8b : IEncounterable, IEncounterMatch, IEncoun public byte LevelMin => Level; public byte LevelMax => Level; - public EncounterTrade8b(ReadOnlySpan names, byte index, GameVersion game) + public EncounterTrade8b(ReadOnlySpan names, byte index, GameVersion version) { - Version = game; + Version = version; Nicknames = EncounterUtil.GetNamesForLanguage(names, index); TrainerNames = EncounterUtil.GetNamesForLanguage(names, (uint)(index + (names[1].Length >> 1))); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterArea9.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterArea9.cs index fc887d9dc..d677d7342 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterArea9.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterArea9.cs @@ -18,19 +18,19 @@ public sealed record EncounterArea9 : IEncounterArea, IAreaLocat public bool IsMatchLocation(ushort location) => Location == location; - public static EncounterArea9[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion game) + public static EncounterArea9[] GetAreas(BinLinkerAccessor input, [ConstantExpected] GameVersion version) { var result = new EncounterArea9[input.Length]; for (int i = 0; i < result.Length; i++) - result[i] = new EncounterArea9(input[i], game); + result[i] = new EncounterArea9(input[i], version); return result; } - private EncounterArea9(ReadOnlySpan areaData, [ConstantExpected] GameVersion game) + private EncounterArea9(ReadOnlySpan areaData, [ConstantExpected] GameVersion version) { Location = areaData[0]; CrossFrom = areaData[2]; - Version = game; + Version = version; Slots = ReadSlots(areaData[4..]); } diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterTrade9.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterTrade9.cs index 24179fb3f..996649e83 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterTrade9.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterTrade9.cs @@ -50,9 +50,9 @@ public sealed record EncounterTrade9 : IEncounterable, IEncounterMatch, IEncount public required GemType TeraType { get; init; } public bool RibbonPartner { get; } - public EncounterTrade9(ReadOnlySpan names, byte index, GameVersion game, ushort species, byte level) + public EncounterTrade9(ReadOnlySpan names, byte index, GameVersion version, ushort species, byte level) { - Version = game; + Version = version; bool partner = RibbonPartner = index is (>= 2 and <= 31); Nicknames = partner ? [] : EncounterUtil.GetNamesForLanguage(names, index); TrainerNames = EncounterUtil.GetNamesForLanguage(names, (uint)(index + (names[1].Length >> 1))); diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation3.cs b/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation3.cs index 83e632857..2bfbbdfc5 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation3.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation3.cs @@ -16,7 +16,7 @@ public static class EggHatchLocation3 /// /// Returns true if the hatch location is valid for the specified Generation 3 game. /// - public static bool IsValidMet3(ushort location, GameVersion game) => game switch + public static bool IsValidMet3(ushort location, GameVersion version) => version switch { R or S => IsValidMet3RS(location), E => IsValidMet3E(location), diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation4.cs b/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation4.cs index 817ac8b37..bc971919d 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation4.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation4.cs @@ -16,7 +16,7 @@ public static class EggHatchLocation4 /// /// Returns true if the hatch location is valid for the specified Generation 4 game. /// - public static bool IsValidMet4(ushort location, GameVersion game) => game switch + public static bool IsValidMet4(ushort location, GameVersion version) => version switch { D or P => IsValidMet4DP(location), Pt => IsValidMet4Pt(location), diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation5.cs b/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation5.cs index 3bbfe4c0f..2d1a622f0 100644 --- a/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation5.cs +++ b/PKHeX.Core/Legality/Encounters/Verifiers/EggHatchLocation5.cs @@ -16,9 +16,9 @@ public static class EggHatchLocation5 /// /// Returns true if the location is valid for the specified Generation 5 game. /// - public static bool IsValidMet5(ushort location, GameVersion game) + public static bool IsValidMet5(ushort location, GameVersion version) { - var shift = (uint)(game - W); + var shift = (uint)(version - W); if (shift >= 4) return false; diff --git a/PKHeX.Core/Legality/Formatting/LegalityFormatting.cs b/PKHeX.Core/Legality/Formatting/LegalityFormatting.cs index 3d7a14900..4d21a768d 100644 --- a/PKHeX.Core/Legality/Formatting/LegalityFormatting.cs +++ b/PKHeX.Core/Legality/Formatting/LegalityFormatting.cs @@ -320,10 +320,10 @@ private static void AppendFrameTimeStamp3(uint frame, StringBuilder sb, Encounte sb.AppendFormat(loc.SuffixDays, (int)time.TotalDays); } - private static (uint Seed, uint Advances) GetInitialSeed3(uint seed, GameVersion game) + private static (uint Seed, uint Advances) GetInitialSeed3(uint seed, GameVersion version) { // Emerald is always initial seed of 0 for startups other than E4/New Game. - if (game is GameVersion.E) + if (version is GameVersion.E) return (0, LCRNG.GetDistance(0, seed)); var nearest16 = seed; @@ -333,7 +333,7 @@ private static (uint Seed, uint Advances) GetInitialSeed3(uint seed, GameVersion nearest16 = LCRNG.Prev(nearest16); ctr++; } - if (game is GameVersion.R or GameVersion.S) + if (version is GameVersion.R or GameVersion.S) { const uint drySeed = 0x05A0; var advances = LCRNG.GetDistance(drySeed, seed); diff --git a/PKHeX.Core/Legality/Moves/Breeding/MoveBreed4.cs b/PKHeX.Core/Legality/Moves/Breeding/MoveBreed4.cs index 14a8128f7..acd7b5084 100644 --- a/PKHeX.Core/Legality/Moves/Breeding/MoveBreed4.cs +++ b/PKHeX.Core/Legality/Moves/Breeding/MoveBreed4.cs @@ -152,13 +152,13 @@ private static bool VerifyBaseMoves(in BreedInfo info) return true; } - private static void MarkMovesForOrigin(in BreedInfo value, ReadOnlySpan eggMoves, int count, bool inheritLevelUp, PersonalInfo4 info, GameVersion gameVersion) + private static void MarkMovesForOrigin(in BreedInfo value, ReadOnlySpan eggMoves, int count, bool inheritLevelUp, PersonalInfo4 info, GameVersion version) { var possible = value.Possible; var learn = value.Learnset; var baseEgg = value.Learnset.GetBaseEggMoves(value.Level); var tmlist = MachineMovesTechnical; - var hmlist = gameVersion is HG or SS ? MachineMovesHiddenHGSS : MachineMovesHiddenDPPt; + var hmlist = version is HG or SS ? MachineMovesHiddenHGSS : MachineMovesHiddenDPPt; var moves = value.Moves; for (int i = 0; i < count; i++) diff --git a/PKHeX.Core/Legality/Moves/GameData.cs b/PKHeX.Core/Legality/Moves/GameData.cs index 6b3742b3d..bf0b1fa12 100644 --- a/PKHeX.Core/Legality/Moves/GameData.cs +++ b/PKHeX.Core/Legality/Moves/GameData.cs @@ -11,16 +11,16 @@ public static class GameData /// /// Gets the Personal table for the specified game version. /// - /// The game version to retrieve data for. + /// The game version to retrieve data for. /// The Personal table for the specified game version. - public static IPersonalTable GetPersonal(GameVersion game) => Personal(game); + public static IPersonalTable GetPersonal(GameVersion version) => Personal(version); /// /// Gets the LearnSource for the specified game version. /// - /// The game version to retrieve data for. + /// The game version to retrieve data for. /// The LearnSource for the specified game version. - public static ILearnSource GetLearnSource(GameVersion game) => game switch + public static ILearnSource GetLearnSource(GameVersion version) => version switch { RD or GN or BU or RB => LearnSource1RB.Instance, YW or RBY => LearnSource1YW.Instance, @@ -66,15 +66,15 @@ public static class GameData Stadium => LearnSource1YW.Instance, Stadium2 => LearnSource2Stadium.Instance, - _ => throw new ArgumentOutOfRangeException(nameof(game), $"{game} is not a valid entry in the expression."), + _ => throw new ArgumentOutOfRangeException(nameof(version), $"{version} is not a valid entry in the expression."), }; /// /// Retrieves the personal table for the specified game version. /// - /// The game version to retrieve data for. + /// The game version to retrieve data for. /// The Personal table of the specified game version. - private static IPersonalTable Personal(GameVersion game) => game switch + private static IPersonalTable Personal(GameVersion version) => version switch { RD or GN or BU or RB => PersonalTable.RB, YW or RBY => PersonalTable.Y, @@ -119,6 +119,6 @@ public static class GameData Stadium => PersonalTable.Y, Stadium2 => PersonalTable.GS, - _ => throw new ArgumentOutOfRangeException(nameof(game), $"{game} is not a valid entry in the expression."), + _ => throw new ArgumentOutOfRangeException(nameof(version), $"{version} is not a valid entry in the expression."), }; } diff --git a/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext6.cs b/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext6.cs index a40ce7d09..f3a4a4d4c 100644 --- a/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext6.cs +++ b/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext6.cs @@ -32,18 +32,18 @@ private static bool GetCanBeCaptured(ushort species, ReadOnlySpan flags) return (flags[offset] & (1 << bitIndex)) != 0; } - private static ReadOnlySpan GetPokeCenterLocations(GameVersion game) + private static ReadOnlySpan GetPokeCenterLocations(GameVersion version) { - return game is GameVersion.X or GameVersion.Y ? LocationsWithPokeCenter_XY : LocationsWithPokeCenter_AO; + return version is GameVersion.X or GameVersion.Y ? LocationsWithPokeCenter_XY : LocationsWithPokeCenter_AO; } - public static bool GetHasPokeCenterLocation(GameVersion game, ushort loc) + public static bool GetHasPokeCenterLocation(GameVersion version, ushort loc) { - if (game == GameVersion.Any) + if (version == GameVersion.Any) return GetHasPokeCenterLocation(GameVersion.X, loc) || GetHasPokeCenterLocation(GameVersion.AS, loc); if (loc > byte.MaxValue) return false; - return GetPokeCenterLocations(game).Contains((byte)loc); + return GetPokeCenterLocations(version).Contains((byte)loc); } public static int GetMemoryRarity(byte memory) => memory >= MemoryRandChance.Length ? -1 : MemoryRandChance[memory]; diff --git a/PKHeX.Core/Legality/Verifiers/Ball/BallUseLegality.cs b/PKHeX.Core/Legality/Verifiers/Ball/BallUseLegality.cs index c7cb63e33..2ec60842c 100644 --- a/PKHeX.Core/Legality/Verifiers/Ball/BallUseLegality.cs +++ b/PKHeX.Core/Legality/Verifiers/Ball/BallUseLegality.cs @@ -23,18 +23,18 @@ public static bool IsBallPermitted(ulong permit, byte ball) return (permit & (1ul << ball)) != 0; } - public static ulong GetWildBalls(byte generation, GameVersion game) => generation switch + public static ulong GetWildBalls(byte generation, GameVersion version) => generation switch { 1 => WildPokeBalls1, 2 => WildPokeBalls2, 3 => WildPokeBalls3, - 4 => GameVersion.HGSS.Contains(game) ? WildPokeBalls4_HGSS : WildPokeBalls4_DPPt, + 4 => GameVersion.HGSS.Contains(version) ? WildPokeBalls4_HGSS : WildPokeBalls4_DPPt, 5 => WildPokeBalls5, 6 => WildPokeballs6, - 7 => GameVersion.Gen7b.Contains(game) ? WildPokeballs7b : WildPokeballs7, - 8 when GameVersion.BDSP.Contains(game) => WildPokeBalls4_HGSS, - 8 when GameVersion.PLA == game => WildPokeBalls8a, - 8 => GameVersion.GO == game ? WildPokeballs8g_WithRaid : WildPokeballs8, + 7 => GameVersion.Gen7b.Contains(version) ? WildPokeballs7b : WildPokeballs7, + 8 when GameVersion.BDSP.Contains(version) => WildPokeBalls4_HGSS, + 8 when GameVersion.PLA == version => WildPokeBalls8a, + 8 => GameVersion.GO == version ? WildPokeballs8g_WithRaid : WildPokeballs8, 9 => WildPokeballs9, _ => 0, }; diff --git a/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs b/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs index 17f75c291..a3af88ed6 100644 --- a/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs +++ b/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs @@ -128,11 +128,11 @@ public static int GetMaximumEggHatchCycles(PKM pk, IEncounterTemplate enc) /// /// Gets a valid for an egg hatched in the origin game, accounting for future format transfers altering the data. /// - public static ushort GetEggHatchLocation(GameVersion game, byte format) => game switch + public static ushort GetEggHatchLocation(GameVersion version, byte format) => version switch { R or S or E or FR or LG => format switch { - 3 => game is FR or LG ? Locations.HatchLocationFRLG : Locations.HatchLocationRSE, + 3 => version is FR or LG ? Locations.HatchLocationFRLG : Locations.HatchLocationRSE, 4 => Locations.Transfer3, // Pal Park _ => Locations.Transfer4, }, diff --git a/PKHeX.Core/PKM/Interfaces/Metadata/IVersion.cs b/PKHeX.Core/PKM/Interfaces/Metadata/IVersion.cs index a229e8c47..6c086928d 100644 --- a/PKHeX.Core/PKM/Interfaces/Metadata/IVersion.cs +++ b/PKHeX.Core/PKM/Interfaces/Metadata/IVersion.cs @@ -13,28 +13,28 @@ public interface IVersion public static partial class Extensions { - private static bool CanBeReceivedBy(this IVersion version, GameVersion game) => version.Version.Contains(game); + private static bool CanBeReceivedBy(this IVersion v, GameVersion version) => v.Version.Contains(version); /// /// Gets a compatible saved version value for the given . /// - /// Object requesting a saved version. + /// Object requesting a saved version. /// Preferred version to use, if possible. - public static GameVersion GetCompatibleVersion(this IVersion version, GameVersion prefer) + public static GameVersion GetCompatibleVersion(this IVersion v, GameVersion prefer) { - if (!version.CanBeReceivedBy(prefer)) - return version.GetSingleVersion(); + if (!v.CanBeReceivedBy(prefer)) + return v.GetSingleVersion(); if (!prefer.IsValidSavedVersion()) return prefer.GetSingleVersion(); return prefer; } - public static GameVersion GetSingleVersion(this IVersion version) + public static GameVersion GetSingleVersion(this IVersion v) { - var v = version.Version; - if (v.IsValidSavedVersion()) - return v; - return v.GetSingleVersion(); + var version = v.Version; + if (version.IsValidSavedVersion()) + return version; + return version.GetSingleVersion(); } public static GameVersion GetSingleVersion(this GameVersion lump) diff --git a/PKHeX.Core/PKM/Util/Language.cs b/PKHeX.Core/PKM/Util/Language.cs index 3c1132f1d..7feb54bd9 100644 --- a/PKHeX.Core/PKM/Util/Language.cs +++ b/PKHeX.Core/PKM/Util/Language.cs @@ -53,11 +53,11 @@ public static class Language /// /// Generation to check. /// Preferred language. - /// Game version to check. + /// Game version to check. /// Language that is safe to use for the given generation. - public static LanguageID GetSafeLanguage(byte generation, LanguageID prefer, GameVersion game) => generation switch + public static LanguageID GetSafeLanguage(byte generation, LanguageID prefer, GameVersion version) => generation switch { - 1 when game == GameVersion.BU => Japanese, + 1 when version == GameVersion.BU => Japanese, 1 => HasLanguage(Languages_3, (byte)prefer) ? prefer : SafeLanguage, 2 => HasLanguage(Languages_GB, (byte)prefer) ? prefer : SafeLanguage, 3 => HasLanguage(Languages_3 , (byte)prefer) ? prefer : SafeLanguage, diff --git a/PKHeX.Core/Saves/Abstractions/SimpleTrainerInfo.cs b/PKHeX.Core/Saves/Abstractions/SimpleTrainerInfo.cs index 43357e645..6888c9c9d 100644 --- a/PKHeX.Core/Saves/Abstractions/SimpleTrainerInfo.cs +++ b/PKHeX.Core/Saves/Abstractions/SimpleTrainerInfo.cs @@ -25,9 +25,9 @@ public sealed record SimpleTrainerInfo : ITrainerInfo, IRegionOriginReadOnly, IT public byte Generation { get; init; } = Latest.Generation; public EntityContext Context { get; init; } = Latest.Context; - public SimpleTrainerInfo(GameVersion game = Latest.Version) + public SimpleTrainerInfo(GameVersion version = Latest.Version) { - Version = game; + Version = version; Context = Version.GetContext(); Generation = Context.Generation(); if (Context is not (EntityContext.Gen6 or EntityContext.Gen7)) @@ -80,9 +80,9 @@ public sealed record MutableTrainerInfo : ITrainerInfo, IRegionOrigin, ITrainerI public byte Generation { get; set; } = Latest.Generation; public EntityContext Context { get; set; } = Latest.Context; - public MutableTrainerInfo(GameVersion game = Latest.Version) + public MutableTrainerInfo(GameVersion version = Latest.Version) { - Version = game; + Version = version; Context = Version.GetContext(); Generation = Context.Generation(); if (Context is not (EntityContext.Gen6 or EntityContext.Gen7)) diff --git a/PKHeX.Core/Saves/SAV8BS.cs b/PKHeX.Core/Saves/SAV8BS.cs index 91a0a71a0..fa3c2fcb8 100644 --- a/PKHeX.Core/Saves/SAV8BS.cs +++ b/PKHeX.Core/Saves/SAV8BS.cs @@ -255,7 +255,7 @@ public override int SetString(Span destBuffer, ReadOnlySpan value, i public override uint ID32 { get => MyStatus.ID32; set => MyStatus.ID32 = value; } public override ushort TID16 { get => MyStatus.TID16; set => MyStatus.TID16 = value; } public override ushort SID16 { get => MyStatus.SID16; set => MyStatus.SID16 = value; } - public override GameVersion Version { get => MyStatus.Game; set => MyStatus.Game = value; } + public override GameVersion Version { get => MyStatus.Version; set => MyStatus.Version = value; } public override byte Gender { get => MyStatus.Male ? (byte)0 : (byte)1; set => MyStatus.Male = value == 0; } public override int Language { get => Config.Language; set => Config.Language = value; } public override string OT { get => MyStatus.OT; set => MyStatus.OT = value; } diff --git a/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs b/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs index 8fe009b38..ffc4ed82d 100644 --- a/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs +++ b/PKHeX.Core/Saves/Substructures/Gen6/PSS6.cs @@ -77,12 +77,12 @@ private static bool ReadTrainer(List result, ReadOnlySpan data) return false; } - private static string GetGameName(GameVersion game) + private static string GetGameName(GameVersion version) { const string unk = "UNKNOWN GAME"; - if (game is not (GameVersion.X or GameVersion.Y or GameVersion.OR or GameVersion.AS)) + if (!version.IsGen6()) return unk; var list = GameInfo.Strings.gamelist; - return list[(byte)game]; + return list[(byte)version]; } } diff --git a/PKHeX.Core/Saves/Substructures/Gen8/BS/MyStatus8b.cs b/PKHeX.Core/Saves/Substructures/Gen8/BS/MyStatus8b.cs index 0c7e3771c..6fbee2bdd 100644 --- a/PKHeX.Core/Saves/Substructures/Gen8/BS/MyStatus8b.cs +++ b/PKHeX.Core/Saves/Substructures/Gen8/BS/MyStatus8b.cs @@ -76,19 +76,19 @@ public MoveType StarterType // end structure! - public GameVersion Game + public GameVersion Version { get => ROMCode switch { 0 => GameVersion.BD, 1 => GameVersion.SP, - _ => throw new ArgumentOutOfRangeException(nameof(Game)), + _ => throw new ArgumentOutOfRangeException(nameof(Version)), }; set => ROMCode = value switch { GameVersion.BD => 0, GameVersion.SP => 1, - _ => throw new ArgumentOutOfRangeException(nameof(Game)), + _ => throw new ArgumentOutOfRangeException(nameof(Version)), }; } diff --git a/PKHeX.Core/Saves/Util/SaveLanguage.cs b/PKHeX.Core/Saves/Util/SaveLanguage.cs index 79a70e8ab..37f040a78 100644 --- a/PKHeX.Core/Saves/Util/SaveLanguage.cs +++ b/PKHeX.Core/Saves/Util/SaveLanguage.cs @@ -190,10 +190,10 @@ public static SaveLanguageResult InferFrom1(ReadOnlySpan name, GameVersion } return default; - static bool MaybeRD(GameVersion game) => game is RD or RB or RBY or Any; - static bool MaybeGN(GameVersion game) => game is GN or RB or RBY or Any; - static bool MaybeBU(GameVersion game) => game is BU or RBY or Any; - static bool MaybeYW(GameVersion game) => game is YW or RBY or Any; + static bool MaybeRD(GameVersion version) => version is RD or RB or RBY or Any; + static bool MaybeGN(GameVersion version) => version is GN or RB or RBY or Any; + static bool MaybeBU(GameVersion version) => version is BU or RBY or Any; + static bool MaybeYW(GameVersion version) => version is YW or RBY or Any; } /// @@ -237,9 +237,9 @@ public static SaveLanguageResult InferFrom2(ReadOnlySpan name, GameVersion if (MaybeSI(hint) && Contains(name, "si")) return (OverrideLanguageGen2, SI); return default; - static bool MaybeGD(GameVersion game) => game is GD or GS or Any; - static bool MaybeSI(GameVersion game) => game is SI or GS or Any; - static bool MaybeC(GameVersion game) => game is C or Any; + static bool MaybeGD(GameVersion version) => version is GD or GS or Any; + static bool MaybeSI(GameVersion version) => version is SI or GS or Any; + static bool MaybeC (GameVersion version) => version is C or Any; } /// @@ -309,11 +309,11 @@ public static SaveLanguageResult InferFrom3(ReadOnlySpan name, GameVersion } return default; - static bool MaybeFR(GameVersion game) => game is FR or FRLG or Any; - static bool MaybeLG(GameVersion game) => game is LG or FRLG or Any; - static bool MaybeR(GameVersion game) => game is R or RS or Any; - static bool MaybeS(GameVersion game) => game is S or RS or Any; - static bool MaybeE(GameVersion game) => game is E or RS or Any; + static bool MaybeFR(GameVersion version) => version is FR or FRLG or Any; + static bool MaybeLG(GameVersion version) => version is LG or FRLG or Any; + static bool MaybeR (GameVersion version) => version is R or RS or Any; + static bool MaybeS (GameVersion version) => version is S or RS or Any; + static bool MaybeE (GameVersion version) => version is E or RS or Any; } /// diff --git a/PKHeX.Drawing.PokeSprite/Builder/SpriteBuilder.cs b/PKHeX.Drawing.PokeSprite/Builder/SpriteBuilder.cs index 2b9ddb2b4..d9f66eea1 100644 --- a/PKHeX.Drawing.PokeSprite/Builder/SpriteBuilder.cs +++ b/PKHeX.Drawing.PokeSprite/Builder/SpriteBuilder.cs @@ -63,7 +63,6 @@ public abstract class SpriteBuilder : ISpriteBuilder /// /// Ensures all data is set up to generate sprites for the save file. /// - /// public void Initialize(SaveFile sav) { if (sav.Generation != 3) @@ -71,14 +70,14 @@ public void Initialize(SaveFile sav) // If the game is indeterminate, we might have different form sprites. // Currently, this only applies to Gen3's FireRed / LeafGreen - Game = sav.Version; - if (Game == GameVersion.FRLG) - Game = ReferenceEquals(sav.Personal, PersonalTable.FR) ? GameVersion.FR : GameVersion.LG; + Version = sav.Version; + if (Version == GameVersion.FRLG) + Version = ReferenceEquals(sav.Personal, PersonalTable.FR) ? GameVersion.FR : GameVersion.LG; } - private GameVersion Game; + private GameVersion Version; - private static byte GetDeoxysForm(GameVersion game) => game switch + private static byte GetDeoxysForm(GameVersion version) => version switch { GameVersion.FR => 1, // Attack GameVersion.LG => 2, // Defense @@ -110,7 +109,7 @@ public Bitmap GetSprite(ushort species, byte form, byte gender, uint formarg, in return None; if (context == EntityContext.Gen3 && species == (int)Species.Deoxys) // Depends on Gen3 save file version - form = GetDeoxysForm(Game); + form = GetDeoxysForm(Version); else if (context == EntityContext.Gen4 && species == (int)Species.Arceus) // Curse type's existence in Gen4 form = GetArceusForm4(form); diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_FlagWork8b.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_FlagWork8b.cs index 2476eccc1..c707937fa 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_FlagWork8b.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_FlagWork8b.cs @@ -250,10 +250,10 @@ private void LoadSAV(object sender, string path) ChangeSAV(); } - private static string GetGameFilePrefix(GameVersion game) => game switch + private static string GetGameFilePrefix(GameVersion version) => version switch { BD or SP or BDSP => "bdsp", - _ => throw new IndexOutOfRangeException(nameof(game)), + _ => throw new IndexOutOfRangeException(nameof(version)), }; private void DiffSaves() diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_EventWork.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_EventWork.cs index e0dde1c72..7a8cb93c2 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_EventWork.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_EventWork.cs @@ -242,13 +242,13 @@ private void LoadSAV(object sender, string path) ChangeSAV(); } - private static string[] GetStringList(GameVersion game, [ConstantExpected] string type) + private static string[] GetStringList(GameVersion version, [ConstantExpected] string type) { - var gamePrefix = GetGameFilePrefix(game); + var gamePrefix = GetGameFilePrefix(version); return GameLanguage.GetStrings(gamePrefix, GameInfo.CurrentLanguage, type); } - private static string GetGameFilePrefix(GameVersion game) => game switch + private static string GetGameFilePrefix(GameVersion version) => version switch { SL or VL or SV => "sv", BD or SP or BDSP => "bdsp", @@ -267,7 +267,7 @@ private static string[] GetStringList(GameVersion game, [ConstantExpected] strin C => "c", R or S or RS => "rs", FR or LG or FRLG => "frlg", - _ => throw new IndexOutOfRangeException(nameof(game)), + _ => throw new IndexOutOfRangeException(nameof(version)), }; private void DiffSaves()