mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 22:54:14 +00:00
Add cxd starter TID/SID correlation check
This commit is contained in:
parent
a01e164e2e
commit
4aeb3ce818
1 changed files with 22 additions and 3 deletions
|
@ -1365,13 +1365,32 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
// Starters have a correlation to the Trainer ID numbers
|
// Starters have a correlation to the Trainer ID numbers
|
||||||
var spec = ((EncounterStatic) EncounterMatch).Species;
|
var spec = ((EncounterStatic) EncounterMatch).Species;
|
||||||
|
var rev = int.MinValue;
|
||||||
switch (spec)
|
switch (spec)
|
||||||
{
|
{
|
||||||
|
// pidiv reversed 5x yields SID, again == TID. +7 if another PKM is generated
|
||||||
case 133: // Eevee
|
case 133: // Eevee
|
||||||
case 196: // Espeon
|
rev = 5; break;
|
||||||
case 197: // Umbreon
|
|
||||||
break; // todo
|
case 197: // Umbreon (generated before Espeon)
|
||||||
|
rev = 5; break;
|
||||||
|
case 196: // Espeon (generated after Umbreon)
|
||||||
|
rev = 12; break;
|
||||||
}
|
}
|
||||||
|
if (rev == int.MinValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var pidiv = MethodFinder.Analyze(pkm);
|
||||||
|
if (pidiv == null || pidiv.Type != PIDType.CXD)
|
||||||
|
{
|
||||||
|
AddLine(Severity.Invalid, V400, CheckIdentifier.PID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var seed = pidiv.OriginSeed;
|
||||||
|
var SIDf = pidiv.RNG.Reverse(seed, rev);
|
||||||
|
var TIDf = pidiv.RNG.Prev(SIDf);
|
||||||
|
if (SIDf >> 16 != pkm.SID || TIDf >> 16 != pkm.TID)
|
||||||
|
AddLine(Severity.Invalid, V400, CheckIdentifier.PID);
|
||||||
}
|
}
|
||||||
else if (pkm.WasEgg) // can't obtain eggs in CXD
|
else if (pkm.WasEgg) // can't obtain eggs in CXD
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue