diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index ea822d7d5..c3c30326a 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -282,6 +282,7 @@ public static class LegalityCheckStrings public static string LMemoryArgBadHatch { get; set; } = "{0} Memory: {0} did not hatch this."; public static string LMemoryArgBadHT { get; set; } = "Memory: Can't have Handling Trainer Memory as Egg."; public static string LMemoryArgBadID { get; set; } = "{0} Memory: Can't obtain Memory on {0} Version."; + public static string LMemoryArgBadItem { get; set; } = "{0} Memory: Species can't hold this item."; public static string LMemoryArgBadLocation { get; set; } = "{0} Memory: Can't obtain Location on {0} Version."; public static string LMemoryArgBadMove { get; set; } = "{0} Memory: Species can't learn this move."; public static string LMemoryArgBadOTEgg { get; set; } = "{0} Memory: Link Trade is not a valid first memory."; diff --git a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs index b8a8d1e8c..6a03aae7b 100644 --- a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs @@ -178,6 +178,7 @@ public static bool GetCanOTHandle(IEncounterable enc, PKM pkm, int gen) return enc switch { EncounterTrade _ => false, + EncounterSlot8GO _ => false, WC6 wc6 when wc6.OT_Name.Length > 0 => false, WC7 wc7 when wc7.OT_Name.Length > 0 && wc7.TID != 18075 => false, // Ash Pikachu QR Gift doesn't set Current Handler WC8 wc8 when wc8.GetHasOT(pkm.Language) => false, diff --git a/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs b/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs index bd05d536f..858e00ba0 100644 --- a/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/MemoryVerifier.cs @@ -39,13 +39,40 @@ private CheckResult VerifyCommonMemory(PKM pkm, int handler, int gen, LegalInfo case 21 when gen != 6 || !Legal.GetCanLearnMachineMove(new PK6 {Species = memory.Variable, EXP = Experience.GetEXP(100, PersonalTable.XY.GetFormIndex(memory.Variable, 0))}, 19, 6): return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler)); - case 16 when memory.Variable == 0 && !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): - case 48 when memory.Variable == 0 && !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): + case 16 when memory.Variable == 0 || !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): + case 48 when memory.Variable == 0 || !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler)); // {0} was able to remember {2} at {1}'s instruction. {4} that {3}. - case 49 when memory.Variable == 0 && !Legal.GetCanRelearnMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): + case 49 when memory.Variable == 0 || !Legal.GetCanRelearnMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler)); + + // Dynamaxing + // {0} battled at {1}’s side against {2} that Dynamaxed. {4} that {3}. + case 71 when !GetCanBeCaptured(memory.Variable, 8, handler == 0 ? (GameVersion)pkm.Version : GameVersion.Any): + // {0} battled {2} and Dynamaxed upon {1}’s instruction. {4} that {3}. + case 72 when !((PersonalInfoSWSH)PersonalTable.SWSH[memory.Variable]).IsPresentInGame: + return GetInvalid(string.Format(LMemoryArgBadSpecies, handler == 0 ? L_XOT : L_XHT)); + + // Move + // {0} studied about how to use {2} in a Box, thinking about {1}. {4} that {3}. + case 80 when memory.Variable == 0 || !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): + // {0} practiced its cool pose for the move {2} in a Box, wishing to be praised by {1}. {4} that {3}. + case 81 when memory.Variable == 0 || !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]): + return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler)); + + // Species + // {0} had a great chat about {1} with the {2} that it was in a Box with. {4} that {3}. + case 82 when !((PersonalInfoSWSH)PersonalTable.SWSH[memory.Variable]).IsPresentInGame: + // {0} became good friends with the {2} in a Box, practiced moves with it, and talked about the day that {0} would be praised by {1}. {4} that {3}. + case 83 when !((PersonalInfoSWSH)PersonalTable.SWSH[memory.Variable]).IsPresentInGame: + // {0} got in a fight with the {2} that it was in a Box with about {1}. {4} that {3}. + case 87 when !((PersonalInfoSWSH)PersonalTable.SWSH[memory.Variable]).IsPresentInGame: + return GetInvalid(string.Format(LMemoryArgBadSpecies, handler == 0 ? L_XOT : L_XHT)); + + // Item + case 84 when !Legal.HeldItems_SWSH.Contains((ushort)memory.Variable): // {0} was worried if {1} was looking for the {2} that it was holding in a Box. {4} that {3}. + return GetInvalid(string.Format(LMemoryArgBadItem, memory.Handler)); } if (gen == 6 && !Memories.CanHaveIntensity(memory.MemoryID, memory.Intensity)) @@ -125,7 +152,7 @@ private void VerifyOTMemory(LegalityAnalysis data) return; } } - else if (!CanHaveMemory(pkm, memoryGen, memory)) + else if (!CanHaveMemoryForOT(pkm, memoryGen, memory)) { VerifyOTMemoryIs(data, 0, 0, 0, 0); // empty return; @@ -180,21 +207,26 @@ private void VerifyOTMemory(LegalityAnalysis data) data.AddLine(VerifyCommonMemory(pkm, 0, Info.Generation, Info)); } - private static bool CanHaveMemory(PKM pkm, int origin, int memory) + private static bool CanHaveMemoryForOT(PKM pkm, int origin, int memory) { - if (pkm.GG) // LGPE never assigns memories - return false; + switch (origin) + { + // Bank Memories only + case 1 when memory != 4: // VC transfers + case 2 when memory != 4: // VC transfers + case 7 when memory != 4: // Gen7 does not set memories. - if ((pkm.VC || pkm.Gen7) && memory != 4) // Generation 7 - Trade memory or nothing - return false; + // Memories don't exist + case 7 when pkm.GG: // LGPE does not set memories. + case 8 when pkm.GO_HOME: // HOME does not set memories. + case 8 when pkm.Met_Location == Locations.HOME8: // HOME does not set memories. + return false; - if (origin < 6) // NDS/3DS - return false; - - if (pkm.IsEgg) // Eggs should not have memories - return false; - - return true; + // Eggs cannot have memories + // Cannot have memories if the OT was from a generation prior to Gen6. + default: + return origin >= 6 && !pkm.IsEgg; + } } private void VerifyHTMemory(LegalityAnalysis data)