Split GO from "GG" gameversion

Make Gen7b as the combined ver for that expression
This commit is contained in:
Kurt 2020-08-06 18:24:20 -07:00
parent 56d1eed483
commit 12d9397c8c
12 changed files with 28 additions and 20 deletions

View File

@ -369,7 +369,6 @@ public enum GameVersion
/// <remarks>Used to lump data from the associated games as data assets are shared.</remarks>
/// <see cref="GP"/>
/// <see cref="GE"/>
/// <see cref="GO"/>
GG,
/// <summary>
@ -421,13 +420,19 @@ public enum GameVersion
Gen6,
/// <summary>
/// Generation 7 Games
/// Generation 7 Games on the Nintendo 3DS
/// </summary>
/// <see cref="SM"/>
/// <see cref="USUM"/>
/// <see cref="GG"/>
Gen7,
/// <summary>
/// Generation 7 Games on the Nintendo Switch
/// </summary>
/// <see cref="GG"/>
/// <see cref="GO"/>
Gen7b,
/// <summary>
/// Generation 8 Games
/// </summary>

View File

@ -61,7 +61,7 @@ public static string GetVersionName(GameVersion version)
/// <param name="location">Location value</param>
/// <param name="format">Current <see cref="PKM.Format"/></param>
/// <param name="generation"><see cref="PKM.GenNumber"/> of origin</param>
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.GG"/> differentiation)</param>
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.Gen7b"/> differentiation)</param>
/// <returns>Location name</returns>
public static string GetLocationName(bool isEggLocation, int location, int format, int generation, GameVersion version)
{

View File

@ -408,7 +408,7 @@ private string[] GetItemStrings3(GameVersion game)
/// <param name="location">Location value</param>
/// <param name="format">Current <see cref="PKM.Format"/></param>
/// <param name="generation"><see cref="PKM.GenNumber"/> of origin</param>
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.GG"/> differentiation)</param>
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.Gen7b"/> differentiation)</param>
/// <returns>Location name</returns>
public string GetLocationName(bool isEggLocation, int location, int format, int generation, GameVersion version)
{
@ -470,7 +470,7 @@ public IReadOnlyList<string> 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:

View File

@ -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)
/// <param name="pkVersion"></param>
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();
}

View File

@ -85,7 +85,7 @@ internal static ICollection<int> 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<int>()
};

View File

@ -181,7 +181,7 @@ private static IEnumerable<IEncounterable> GetPossibleOfType(PKM pk, IReadOnlyCo
/// <returns>A consumable <see cref="IEncounterable"/> list of possible encounters.</returns>
private static IEnumerable<EncounterEgg> GetEggs(PKM pk, IReadOnlyCollection<int> 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);

View File

@ -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 },

View File

@ -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),

View File

@ -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++)
{

View File

@ -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;
}
}

View File

@ -147,7 +147,7 @@ public static int GetPKMDataFormat(byte[] data)
/// <returns>Updated PKM if actually PK7</returns>
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);
}

View File

@ -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()