From a3633bb5628e655a9ec74241906a3cdd93bd7d3b Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 23 Aug 2021 19:15:39 -0700 Subject: [PATCH] Update MemoryContext8.cs --- .../Restrictions/Memories/MemoryContext8.cs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs b/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs index 2d365a140..0afb58c26 100644 --- a/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs +++ b/PKHeX.Core/Legality/Restrictions/Memories/MemoryContext8.cs @@ -74,9 +74,9 @@ private static bool IsInvalidGenLoc8(int memory, int loc, int egg, int variable, switch (memory) { - case 1 when enc.EggEncounter || IsCurryEncounter(pk, enc): + case 1 when !IsWildEncounter(pk, enc): case 2 when !enc.EggEncounter: - case 3 when (enc is not (EncounterTrade or EncounterStatic {Gift: true} or WC8 {IsHOMEGift: false}) && !IsCurryEncounter(pk, enc)): + case 3 when !IsWildEncounterMeet(pk, enc): return true; } @@ -94,6 +94,26 @@ private static bool IsInvalidGenLoc8(int memory, int loc, int egg, int variable, return false; } + private static bool IsWildEncounterMeet(PKM pk, IEncounterTemplate enc) + { + if (enc is EncounterTrade or EncounterStatic { Gift: true } or WC8 { IsHOMEGift: false }) + return true; + if (IsCurryEncounter(pk, enc)) + return true; + return false; + } + + private static bool IsWildEncounter(PKM pk, IEncounterTemplate enc) + { + if (enc is not EncounterSlot or EncounterStatic { Gift: false }) + return false; + if (pk is IRibbonSetMark8 { RibbonMarkCurry: true }) + return false; + if (pk.Species == (int)Species.Shedinja && pk is PK8 { AffixedRibbon: (int)RibbonIndex.MarkCurry }) + return false; + return true; + } + private static bool IsCurryEncounter(PKM pk, IEncounterTemplate enc) { if (enc is not EncounterSlot8)