mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-30 17:27:58 -05:00
Misc egg tweaks
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user