From fa9713a1adf51db612e13a03dcdc4c384bdf311c Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 12 May 2025 21:10:23 -0500 Subject: [PATCH] Misc egg tweaks --- .../Encounters/Templates/Gen9/EncounterEgg9.cs | 3 ++- .../Legality/Verifiers/TrainerIDVerifier.cs | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterEgg9.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterEgg9.cs index 5e281efb0..a77bf58fc 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterEgg9.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen9/EncounterEgg9.cs @@ -47,11 +47,12 @@ public PK9 ConvertToPKM(ITrainerInfo tr, EncounterCriteria criteria) Nickname = SpeciesName.GetSpeciesNameGeneration(Species, language, Generation), OriginalTrainerName = tr.OT, OriginalTrainerFriendship = 100, + ObedienceLevel = 1, MetLevel = 1, MetDate = date, MetLocation = Location, EggMetDate = date, - EggLocation = tr.Version == Version ? Locations.Daycare5 : Locations.LinkTrade6, + EggLocation = tr.Version == Version ? Locations.Picnic9 : Locations.LinkTrade6, EncryptionConstant = rnd.Rand32(), PID = rnd.Rand32(), diff --git a/PKHeX.Core/Legality/Verifiers/TrainerIDVerifier.cs b/PKHeX.Core/Legality/Verifiers/TrainerIDVerifier.cs index 575a8e6ee..814695b1e 100644 --- a/PKHeX.Core/Legality/Verifiers/TrainerIDVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/TrainerIDVerifier.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using static PKHeX.Core.LegalityCheckStrings; namespace PKHeX.Core; @@ -37,8 +38,14 @@ public override void Verify(LegalityAnalysis data) var enc = data.EncounterMatch; // If the trainer ID is that of the player, verify it is possible // For eggs, the version does not update on hatch, so it truly is from R/S. - if (enc is not ITrainerID16ReadOnly) // all are 32-bit locked anyway - VerifyTrainerID_RS(data, pk); + // All encounters with fixed TID/SID are 32-bit locked anyway, but a 16-bit TID interface check is sufficient. + if (enc is not ITrainerID16ReadOnly) + { + // Eggs from R/S that are traded to Emerald can obtain the Emerald TID/SID without updating version. + // Flag it as fishy for manual inspection. If it matches an Emerald trainer, it's fine. + var severity = enc is EncounterEgg3 && !pk.IsEgg ? Severity.Fishy : Severity.Invalid; + VerifyTrainerID_RS(data, pk, severity); + } } else if (pk.VC) { @@ -88,10 +95,10 @@ public static bool TryGetShinySID(uint pid, ushort tid, GameVersion version, out data.AddLine(GetInvalid(LTrainerIDNoSeed, CheckIdentifier.Trainer)); } - private static void VerifyTrainerID_RS(LegalityAnalysis data, T tr) where T : ITrainerID32 + private static void VerifyTrainerID_RS(LegalityAnalysis data, T tr, Severity severity = Severity.Invalid) where T : ITrainerID32 { if (!MethodH.TryGetSeedTrainerID(tr.TID16, tr.SID16, out _)) - data.AddLine(GetInvalid(LTrainerIDNoSeed, CheckIdentifier.Trainer)); + data.AddLine(Get(LTrainerIDNoSeed, severity, CheckIdentifier.Trainer)); } public static bool IsOTIDSuspicious(ushort tid16, ushort sid16) => (tid16, sid16) switch