From 0af0c05bacd65bb6fc8e3768119c51a313d67751 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 18 Nov 2020 21:34:40 -0800 Subject: [PATCH] Update go slot list yield and move fetch --- PKHeX.Core/Legality/Areas/EncounterArea7g.cs | 2 +- .../Generator/EncounterSlotGenerator.cs | 21 +++++++++++++++---- PKHeX.Core/Legality/Moves/MoveLevelUp.cs | 4 +++- PKHeX.Core/Legality/Tables/Locations.cs | 3 +++ PKHeX.Core/PKM/PKM.cs | 2 +- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/PKHeX.Core/Legality/Areas/EncounterArea7g.cs b/PKHeX.Core/Legality/Areas/EncounterArea7g.cs index 345909bab..f0877cf7b 100644 --- a/PKHeX.Core/Legality/Areas/EncounterArea7g.cs +++ b/PKHeX.Core/Legality/Areas/EncounterArea7g.cs @@ -20,7 +20,7 @@ private EncounterArea7g(int species, int form) : base(GameVersion.GO) { Species = species; Form = form; - Location = 50; + Location = Locations.GO7; } internal static EncounterArea7g[] GetArea(byte[][] data) diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs index 3b906ca30..cff3db9cf 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterSlotGenerator.cs @@ -180,10 +180,7 @@ private static IEnumerable GetEncounterTable(PKM pkm, GameVersion case GameVersion.GP: return SlotsGP; case GameVersion.GE: return SlotsGE; case GameVersion.GO: - if (pkm.Met_Location == Locations.GO8) - return SlotsGO; - else // LGPE GO - return SlotsGO_GG; + return GetEncounterTableGO(pkm); case GameVersion.SW: return SlotsSW; case GameVersion.SH: return SlotsSH; @@ -214,5 +211,21 @@ private static IEnumerable GetEncounterTableGSC(PKM pkm) // or it can be a Crystal pokemon that lost met location after being tradeback to gen 1 games return SlotsGSC; } + + private static IEnumerable GetEncounterTableGO(PKM pkm) + { + if (pkm.Format < 8) + return SlotsGO_GG; + + // If we know the met location, return the specific area list. + // If we're just getting all encounters (lack of met location is kinda bad...), just return everything. + var met = pkm.Met_Location; + return met switch + { + Locations.GO8 => SlotsGO, + Locations.GO7 => SlotsGO_GG, + _ => SlotsGO_GG.Concat(SlotsGO), + }; + } } } diff --git a/PKHeX.Core/Legality/Moves/MoveLevelUp.cs b/PKHeX.Core/Legality/Moves/MoveLevelUp.cs index 6b97f9381..7002c89f4 100644 --- a/PKHeX.Core/Legality/Moves/MoveLevelUp.cs +++ b/PKHeX.Core/Legality/Moves/MoveLevelUp.cs @@ -209,7 +209,8 @@ private static LearnVersion GetIsLevelUp8(int species, int move, int lvl, int fo switch (ver) { case Any: - case SW: case SH: + case GO: + case SW: case SH: case SWSH: if (species > MaxSpeciesID_8) return LearnNONE; return LearnSWSH.GetIsLevelUp(species, form, move, lvl); @@ -474,6 +475,7 @@ private static List AddMovesLevelUp8(List moves, GameVersion ver, int switch (ver) { case Any: + case GO: case SW: case SH: case SWSH: if (species > MaxSpeciesID_8) return moves; diff --git a/PKHeX.Core/Legality/Tables/Locations.cs b/PKHeX.Core/Legality/Tables/Locations.cs index 765f472ba..331049d29 100644 --- a/PKHeX.Core/Legality/Tables/Locations.cs +++ b/PKHeX.Core/Legality/Tables/Locations.cs @@ -79,6 +79,9 @@ public static class Locations /// Generation 6 Gift from Pokémon Link public const int LinkGift6 = 30011; + /// Generation 7 Transfer from GO to Pokémon LGP/E's GO Park + public const int GO7 = 50; + /// Generation 8 Transfer from GO to Pokémon HOME public const int GO8 = 30012; diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 8406e9e39..1592ec0d5 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -298,7 +298,7 @@ private void SetID7(int sid7, int tid7) public bool SWSH => Version == (int)GameVersion.SW || Version == (int)GameVersion.SH; protected bool PtHGSS => Pt || HGSS; - public bool GO_LGPE => GO && Met_Location == 50; + public bool GO_LGPE => GO && Met_Location == Locations.GO7; public bool GO_HOME => GO && Met_Location == Locations.GO8; public bool VC => VC1 || VC2; public bool GG => LGPE || GO_LGPE;