Misc egg tweaks

This commit is contained in:
Kurt
2025-05-12 21:10:23 -05:00
parent 85f5950f28
commit fa9713a1ad
2 changed files with 13 additions and 5 deletions

View File

@@ -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(),

View File

@@ -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<T>(LegalityAnalysis data, T tr) where T : ITrainerID32
private static void VerifyTrainerID_RS<T>(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