From 256b3c66ca34568dc1eae32402eb97ed6d630663 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 19 Oct 2021 21:53:22 -0700 Subject: [PATCH] Recognize unhatched crystal eggs, 2F pokecenter location lacking met location data on receipt, can result in 0 for eggs hatched on the second floor of a pokecenter https://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_II) Thanks Freezing Dart! --- .../Legality/Encounters/EncounterStatic/EncounterStatic2.cs | 4 ++-- .../Encounters/Generator/Specific/EncounterEggGenerator2.cs | 4 +++- PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs index 5777864c0..45ee38c91 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs @@ -44,8 +44,8 @@ namespace PKHeX.Core { case 0 when pkm.Met_Location != 0: return false; - case 1 when pkm.Met_Location == 0: - return false; + case 1: // 0 = second floor of every Pokémon Center, valid + return true; default: if (pkm.Met_Location == 0 && pkm.Met_Level != 0) return false; diff --git a/PKHeX.Core/Legality/Encounters/Generator/Specific/EncounterEggGenerator2.cs b/PKHeX.Core/Legality/Encounters/Generator/Specific/EncounterEggGenerator2.cs index b51b72e50..8db0dceb0 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/Specific/EncounterEggGenerator2.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/Specific/EncounterEggGenerator2.cs @@ -53,7 +53,9 @@ namespace PKHeX.Core // Check if the met data is present or could have been erased. if (pkm.Format > 2) return true; // doesn't have original met location - if (pkm.Met_Location != 0) + if (pkm.IsEgg) + return true; // doesn't have location yet + if (pkm.Met_Level == 1) // Met location of 0 is valid -- second floor of every Pokémon Center return true; // has original met location if (species < Legal.MaxSpeciesID_1) return true; // can trade RBY to wipe location diff --git a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs index 06ae1dbfc..50358e769 100644 --- a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs @@ -122,7 +122,7 @@ namespace PKHeX.Core if (pkm.OT_Gender == 1) { - if ((pkm.Format == 2 && pkm.Met_Location == 0) || (pkm.Format > 2 && pkm.VC1) || data is {EncounterOriginal: {Generation:1} or EncounterStatic2E {IsGift:true}}) + if (pkm is ICaughtData2 {CaughtData:0} || (pkm.Format > 2 && pkm.VC1) || data is {EncounterOriginal: {Generation:1} or EncounterStatic2E {IsGift:true}}) data.AddLine(GetInvalid(LG1OTGender)); } }