From 12d9397c8c4e0f2ce524441f4e20e911d84f00c6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 6 Aug 2020 18:24:20 -0700 Subject: [PATCH] Split GO from "GG" gameversion Make Gen7b as the combined ver for that expression --- PKHeX.Core/Game/Enums/GameVersion.cs | 11 ++++++++--- PKHeX.Core/Game/GameStrings/GameInfo.cs | 2 +- PKHeX.Core/Game/GameStrings/GameStrings.cs | 4 ++-- PKHeX.Core/Game/GameUtil.cs | 11 ++++++----- PKHeX.Core/Legality/Core.cs | 2 +- .../Encounters/Generator/EncounterMovesetGenerator.cs | 2 +- PKHeX.Core/Legality/Moves/GameData.cs | 4 +++- PKHeX.Core/Legality/Moves/MoveLevelUp.cs | 2 +- PKHeX.Core/Legality/Moves/MoveTechnicalMachine.cs | 2 +- PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs | 2 +- PKHeX.Core/PKM/Util/PKMConverter.cs | 4 ++-- .../Subforms/Save Editors/Gen7/SAV_Trainer7GG.cs | 2 +- 12 files changed, 28 insertions(+), 20 deletions(-) diff --git a/PKHeX.Core/Game/Enums/GameVersion.cs b/PKHeX.Core/Game/Enums/GameVersion.cs index e37e14eaf..71745586b 100644 --- a/PKHeX.Core/Game/Enums/GameVersion.cs +++ b/PKHeX.Core/Game/Enums/GameVersion.cs @@ -369,7 +369,6 @@ public enum GameVersion /// Used to lump data from the associated games as data assets are shared. /// /// - /// GG, /// @@ -421,13 +420,19 @@ public enum GameVersion Gen6, /// - /// Generation 7 Games + /// Generation 7 Games on the Nintendo 3DS /// /// /// - /// Gen7, + /// + /// Generation 7 Games on the Nintendo Switch + /// + /// + /// + Gen7b, + /// /// Generation 8 Games /// diff --git a/PKHeX.Core/Game/GameStrings/GameInfo.cs b/PKHeX.Core/Game/GameStrings/GameInfo.cs index ae35ff3e7..05fa34379 100644 --- a/PKHeX.Core/Game/GameStrings/GameInfo.cs +++ b/PKHeX.Core/Game/GameStrings/GameInfo.cs @@ -61,7 +61,7 @@ public static string GetVersionName(GameVersion version) /// Location value /// Current /// of origin - /// Current GameVersion (only applicable for differentiation) + /// Current GameVersion (only applicable for differentiation) /// Location name public static string GetLocationName(bool isEggLocation, int location, int format, int generation, GameVersion version) { diff --git a/PKHeX.Core/Game/GameStrings/GameStrings.cs b/PKHeX.Core/Game/GameStrings/GameStrings.cs index 913598dac..39bf97038 100644 --- a/PKHeX.Core/Game/GameStrings/GameStrings.cs +++ b/PKHeX.Core/Game/GameStrings/GameStrings.cs @@ -408,7 +408,7 @@ private string[] GetItemStrings3(GameVersion game) /// Location value /// Current /// of origin - /// Current GameVersion (only applicable for differentiation) + /// Current GameVersion (only applicable for differentiation) /// Location name public string GetLocationName(bool isEggLocation, int location, int format, int generation, GameVersion version) { @@ -470,7 +470,7 @@ public IReadOnlyList GetLocationNames(int gen, int bankID, GameVersion v case 5: return GetLocationNames5(bankID); case 6: return GetLocationNames6(bankID); case 7: - if (GameVersion.GG.Contains(version)) + if (GameVersion.Gen7b.Contains(version)) return GetLocationNames7GG(bankID); return GetLocationNames7(bankID); case 8: diff --git a/PKHeX.Core/Game/GameUtil.cs b/PKHeX.Core/Game/GameUtil.cs index 829daa6b1..eda6a66b0 100644 --- a/PKHeX.Core/Game/GameUtil.cs +++ b/PKHeX.Core/Game/GameUtil.cs @@ -146,14 +146,13 @@ public static int GetMaxSpeciesID(this GameVersion game) if (Gen4.Contains(game)) return Legal.MaxSpeciesID_4; if (Gen5.Contains(game)) return Legal.MaxSpeciesID_5; if (Gen6.Contains(game)) return Legal.MaxSpeciesID_6; + if (Gen7b.Contains(game)) return Legal.MaxSpeciesID_7b; if (Gen7.Contains(game)) { if (SM.Contains(game)) return Legal.MaxSpeciesID_7; if (USUM.Contains(game)) return Legal.MaxSpeciesID_7_USUM; - if (GG.Contains(game)) - return Legal.MaxSpeciesID_7b; return Legal.MaxSpeciesID_7_USUM; } if (Gen8.Contains(game)) return Legal.MaxSpeciesID_8; @@ -233,9 +232,11 @@ public static bool Contains(this GameVersion g1, GameVersion g2) case USUM: return g2 == US || g2 == UM; case GG: - return g2 == GP || g2 == GE || g2 == GO; + return g2 == GP || g2 == GE; case Gen7: - return SM.Contains(g2) || USUM.Contains(g2) || GG.Contains(g2); + return SM.Contains(g2) || USUM.Contains(g2); + case Gen7b: + return GG.Contains(g2) || GO == g2; case SWSH: return g2 == SW || g2 == SH; @@ -253,7 +254,7 @@ public static bool Contains(this GameVersion g1, GameVersion g2) /// public static GameVersion[] GetVersionsInGeneration(int generation, int pkVersion) { - if (GG.Contains(pkVersion)) + if (Gen7b.Contains(pkVersion)) return new[] {GO, GP, GE}; return GameVersions.Where(z => z.GetGeneration() == generation).ToArray(); } diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index be2dfc679..f1a88b944 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -85,7 +85,7 @@ internal static ICollection GetWildBalls(int gen, GameVersion game) 4 => GameVersion.HGSS.Contains(game) ? WildPokeBalls4_HGSS : WildPokeBalls4_DPPt, 5 => WildPokeBalls5, 6 => WildPokeballs6, - 7 => GameVersion.GG.Contains(game) ? WildPokeballs7b : WildPokeballs7, + 7 => GameVersion.Gen7b.Contains(game) ? WildPokeballs7b : WildPokeballs7, 8 => WildPokeballs8, _ => Array.Empty() }; diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs index 69e983039..fafdbe4d6 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs @@ -181,7 +181,7 @@ private static IEnumerable GetPossibleOfType(PKM pk, IReadOnlyCo /// A consumable list of possible encounters. private static IEnumerable GetEggs(PKM pk, IReadOnlyCollection needs, GameVersion version) { - if (GameVersion.CXD.Contains(version) || GameVersion.GG.Contains(version)) + if (GameVersion.CXD.Contains(version) || GameVersion.Gen7b.Contains(version)) yield break; // no eggs from these games var eggs = EncounterEggGenerator.GenerateEggs(pk, all: true); diff --git a/PKHeX.Core/Legality/Moves/GameData.cs b/PKHeX.Core/Legality/Moves/GameData.cs index 757ccb8fc..321ea958d 100644 --- a/PKHeX.Core/Legality/Moves/GameData.cs +++ b/PKHeX.Core/Legality/Moves/GameData.cs @@ -80,6 +80,7 @@ public static class GameData { GameVersion.Gen5, Legal.LevelUpB2W2 }, { GameVersion.Gen6, Legal.LevelUpAO }, { GameVersion.Gen7, Legal.LevelUpSM }, + { GameVersion.Gen7b, Legal.LevelUpGG }, { GameVersion.Gen8, Legal.LevelUpSWSH }, { GameVersion.VCEvents, Legal.LevelUpY }, @@ -161,7 +162,8 @@ public static class GameData { GameVersion.Gen4, PersonalTable.HGSS }, { GameVersion.Gen5, PersonalTable.B2W2 }, { GameVersion.Gen6, PersonalTable.AO }, - { GameVersion.Gen7, PersonalTable.SM }, + { GameVersion.Gen7, PersonalTable.USUM }, + { GameVersion.Gen7b, PersonalTable.GG }, { GameVersion.Gen8, PersonalTable.SWSH }, { GameVersion.VCEvents, PersonalTable.Y }, diff --git a/PKHeX.Core/Legality/Moves/MoveLevelUp.cs b/PKHeX.Core/Legality/Moves/MoveLevelUp.cs index a260da5ce..0b5fada09 100644 --- a/PKHeX.Core/Legality/Moves/MoveLevelUp.cs +++ b/PKHeX.Core/Legality/Moves/MoveLevelUp.cs @@ -12,7 +12,7 @@ private static readonly LearnLookup LearnSWSH = new LearnLookup(PersonalTable.SWSH, LevelUpSWSH, SWSH), LearnSM = new LearnLookup(PersonalTable.SM, LevelUpSM, SM), LearnUSUM = new LearnLookup(PersonalTable.USUM, LevelUpUSUM, USUM), - LearnGG = new LearnLookup(PersonalTable.GG, LevelUpGG, GG), + LearnGG = new LearnLookup(PersonalTable.GG, LevelUpGG, Gen7b), LearnXY = new LearnLookup(PersonalTable.XY, LevelUpXY, XY), LearnAO = new LearnLookup(PersonalTable.AO, LevelUpAO, ORAS), LearnBW = new LearnLookup(PersonalTable.BW, LevelUpBW, BW), diff --git a/PKHeX.Core/Legality/Moves/MoveTechnicalMachine.cs b/PKHeX.Core/Legality/Moves/MoveTechnicalMachine.cs index abc96de08..11cd1b78f 100644 --- a/PKHeX.Core/Legality/Moves/MoveTechnicalMachine.cs +++ b/PKHeX.Core/Legality/Moves/MoveTechnicalMachine.cs @@ -180,7 +180,7 @@ private static GameVersion GetIsMachine6(int species, int move, int form, GameVe private static GameVersion GetIsMachine7(int species, int move, int form, GameVersion ver) { - if (GameVersion.GG.Contains(ver)) + if (GameVersion.Gen7b.Contains(ver)) { for (int i = 0; i < Legal.TMHM_GG.Length; i++) { diff --git a/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs b/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs index 068c0c4ce..47b2e4d8f 100644 --- a/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs +++ b/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs @@ -18,7 +18,7 @@ public sealed class SimpleTrainerInfo : ITrainerInfo, IRegionOrigin public SimpleTrainerInfo(GameVersion game = GameVersion.SW) { Game = (int) game; - if (GameVersion.GG.Contains(game) || game.GetGeneration() >= 8) + if (GameVersion.Gen7b.Contains(game) || game.GetGeneration() >= 8) ConsoleRegion = Region = Country = 0; } } diff --git a/PKHeX.Core/PKM/Util/PKMConverter.cs b/PKHeX.Core/PKM/Util/PKMConverter.cs index 6c277618b..38cee294a 100644 --- a/PKHeX.Core/PKM/Util/PKMConverter.cs +++ b/PKHeX.Core/PKM/Util/PKMConverter.cs @@ -147,7 +147,7 @@ public static int GetPKMDataFormat(byte[] data) /// Updated PKM if actually PK7 private static G6PKM CheckPKMFormat7(PK6 pk, int prefer) { - if (GameVersion.GG.Contains(pk.Version)) + if (GameVersion.Gen7b.Contains(pk.Version)) return new PB7(pk.Data); if (IsPK6FormatReallyPK7(pk, prefer)) return new PK7(pk.Data); @@ -434,7 +434,7 @@ public static PKM GetBlank(Type type) public static PKM GetBlank(int gen, GameVersion ver) { - if (gen == 7 && GameVersion.GG.Contains(ver)) + if (gen == 7 && GameVersion.Gen7b.Contains(ver)) return new PB7(); return GetBlank(gen); } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7GG.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7GG.cs index 1dcb405bf..54e602b2b 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7GG.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7GG.cs @@ -57,7 +57,7 @@ private void GetComboBoxes() CB_Language.InitializeBinding(); CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation); CB_Game.InitializeBinding(); - CB_Game.DataSource = new BindingSource(GameInfo.VersionDataSource.Where(z => GameVersion.GG.Contains(z.Value)).ToList(), null); + CB_Game.DataSource = new BindingSource(GameInfo.VersionDataSource.Where(z => GameVersion.Gen7b.Contains(z.Value)).ToList(), null); } private void LoadTrainerInfo()