diff --git a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs index bdc9321b2..12b29409a 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/ByGeneration/EncounterGenerator7GG.cs @@ -8,7 +8,7 @@ namespace PKHeX.Core; public sealed class EncounterGenerator7GG : IEncounterGenerator { public static readonly EncounterGenerator7GG Instance = new(); - public bool CanGenerateEggs => true; + public bool CanGenerateEggs => false; public IEnumerable GetPossible(PKM _, EvoCriteria[] chain, GameVersion game, EncounterTypeGroup groups) { diff --git a/PKHeX.Core/Legality/Encounters/Templates/GO/EncounterSlot8GO.cs b/PKHeX.Core/Legality/Encounters/Templates/GO/EncounterSlot8GO.cs index 413b8f8a2..3723bff00 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/GO/EncounterSlot8GO.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/GO/EncounterSlot8GO.cs @@ -229,11 +229,31 @@ public EncounterMatchRating GetMatchRating(PKM pk) { if (IsMatchPartial(pk)) return EncounterMatchRating.PartialMatch; + if (Species is (int)Farfetchd && IsReallySirfetchd(pk)) + return EncounterMatchRating.DeferredErrors; if (!this.GetIVsValid(pk)) return EncounterMatchRating.Deferred; return EncounterMatchRating.Match; } + /// + /// Checks if a Farfetch'd was originally a Sirfetch'd. + /// + /// Only basis we can check with is if it has the bad HOME apostrophe. + private static bool IsReallySirfetchd(PKM pk) + { + if (pk.Species != (int)Sirfetchd) + return false; + + // Check for the "wrong" apostrophe. If it matches the species name, then it was originally Farfetch'd. + if (pk.IsNicknamed || !SpeciesName.IsApostropheFarfetchdLanguage(pk.Language)) + return false; // can't tell if it was originally Farfetch'd + + Span name = stackalloc char[pk.TrashCharCountNickname]; + pk.LoadString(pk.NicknameTrash, name); + return name is "Sirfetch'd"; // only way to get the bad apostrophe is to originate in HOME with it. + } + public byte OriginalTrainerFriendship => Species switch { (int)Timburr when Form == 0 => 70, diff --git a/PKHeX.Core/Legality/LearnSource/Group/LearnGroup6.cs b/PKHeX.Core/Legality/LearnSource/Group/LearnGroup6.cs index 48fdaaf10..f33c84440 100644 --- a/PKHeX.Core/Legality/LearnSource/Group/LearnGroup6.cs +++ b/PKHeX.Core/Legality/LearnSource/Group/LearnGroup6.cs @@ -64,7 +64,7 @@ private static void CheckDexNavMoves(Span result, ReadOnlySpanTrue if all results are valid. private static bool CleanPurge(Span result, ReadOnlySpan current, PKM pk, MoveSourceType types, IHomeSource local, ReadOnlySpan evos) { - // The logic used to update the results did not check if the move was could be learned in the local game. + // The logic used to update the results did not check if the move could be learned in the local game. // Double-check the results and remove any that are not valid for the local game. // SW/SH will continue to iterate downwards to previous groups after HOME is checked, so we can exactly check via Environment. for (int i = 0; i < result.Length; i++) diff --git a/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs b/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs index 42ee4801a..c45c4fdff 100644 --- a/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs @@ -256,6 +256,21 @@ private static bool IsNicknameValid(PKM pk, IEncounterTemplate enc, ReadOnlySpan ushort species = pk.Species; byte format = pk.Format; int language = pk.Language; + + // Farfetch’d and Sirfetch’d have different apostrophes in HOME, only if transferred from 3DS or GO => HOME. + // HOME doesn't use the right apostrophe. ' vs ’ + if (format >= 8 && species is (int)Species.Farfetchd or (int)Species.Sirfetchd) + { + // Evolving in-game fixes it. Check only un-evolved and affected languages. + if (species == enc.Species && SpeciesName.IsApostropheFarfetchdLanguage(language)) + { + if (enc is { Generation: < 8, Context: not EntityContext.Gen7b }) // 3DS -> HOME + return nickname is "Farfetch'd"; + if (enc is EncounterSlot8GO) // GO -> HOME + return species is (int)Species.Farfetchd ? nickname is "Farfetch'd" : nickname is "Sirfetch'd"; + } + } + ReadOnlySpan expect = SpeciesName.GetSpeciesNameGeneration(species, language, format); if (nickname.SequenceEqual(expect)) return true; @@ -269,26 +284,12 @@ private static bool IsNicknameValid(PKM pk, IEncounterTemplate enc, ReadOnlySpan if (canHaveAnyLanguage && !SpeciesName.IsNicknamedAnyLanguage(species, nickname, format)) return true; - switch (enc) - { - case ILangNick loc: - if (loc.Language != 0 && !loc.IsNicknamed && !SpeciesName.IsNicknamedAnyLanguage(species, nickname, format)) - return true; // fixed language without nickname, nice job event maker! - break; - } + if (enc is ILangNick loc && loc.Language != 0 && !loc.IsNicknamed && !SpeciesName.IsNicknamedAnyLanguage(species, nickname, format)) + return true; // fixed language without nickname, nice job event maker! if (format == 5 && enc.Generation != 5) // transfer return IsMatch45(nickname, species, expect, language, canHaveAnyLanguage); - if (format >= 8 && enc is { Generation: < 8 } or IPogoSlot) // HOME weirdness - { - // HOME doesn't use the right apostrophe. ' vs ’ - if (pk.Species == (int)Species.Farfetchd) - return nickname is "Farfetch'd"; - if (pk.Species == (int)Species.Sirfetchd) - return nickname is "Sirfetch'd"; - } - return false; }