mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-06-03 03:14:12 -05:00
Update cleared data legality checks
Add in a few more, a little bit of shuffling
This commit is contained in:
parent
b370c26542
commit
45367cdce7
|
|
@ -518,8 +518,21 @@ private void verifyMedals()
|
|||
{ AddLine(Severity.Invalid, "Super Training missions on Egg.", CheckIdentifier.Training); }
|
||||
else if (TrainCount > 0 && pkm.GenNumber != 6)
|
||||
{ AddLine(Severity.Invalid, "Distribution Super Training missions are not available in game.", CheckIdentifier.Training); }
|
||||
else if (TrainCount == 30 ^ pkm.SecretSuperTrainingComplete)
|
||||
{ AddLine(Severity.Invalid, "Super Training complete flag mismatch.", CheckIdentifier.Training); }
|
||||
else
|
||||
{
|
||||
if (pkm.Format >= 7)
|
||||
{
|
||||
if (pkm.SecretSuperTrainingUnlocked)
|
||||
{ AddLine(Severity.Invalid, "Super Training unlocked flag invalid.", CheckIdentifier.Training); }
|
||||
if (pkm.SecretSuperTrainingComplete)
|
||||
{ AddLine(Severity.Invalid, "Super Training complete flag invalid.", CheckIdentifier.Training); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TrainCount == 30 ^ pkm.SecretSuperTrainingComplete)
|
||||
{ AddLine(Severity.Invalid, "Super Training complete flag mismatch.", CheckIdentifier.Training); }
|
||||
}
|
||||
}
|
||||
|
||||
// Distribution Training Medals
|
||||
var DistNames = ReflectUtil.getPropertiesStartWithPrefix(pkm.GetType(), "DistSuperTrain");
|
||||
|
|
@ -1090,6 +1103,16 @@ private CheckResult verifyHistory()
|
|||
if (pkm.HT_Gender > 1)
|
||||
return new CheckResult(Severity.Invalid, $"HT Gender invalid {pkm.HT_Gender}.", CheckIdentifier.History);
|
||||
|
||||
if (pkm.Format >= 7) // Cleared Values
|
||||
{
|
||||
if (pkm.EncounterType != 0)
|
||||
return new CheckResult(Severity.Invalid, $"EncounterType invalid {pkm.EncounterType}.", CheckIdentifier.History);
|
||||
if (pkm.Enjoyment != 0)
|
||||
return new CheckResult(Severity.Invalid, $"Enjoyment invalid {pkm.Enjoyment}.", CheckIdentifier.History);
|
||||
if (pkm.Fullness != 0)
|
||||
return new CheckResult(Severity.Invalid, $"Fullness invalid {pkm.Fullness}.", CheckIdentifier.History);
|
||||
}
|
||||
|
||||
MysteryGift mg = EncounterMatch as MysteryGift;
|
||||
WC6 MatchedWC6 = EncounterMatch as WC6;
|
||||
WC7 MatchedWC7 = EncounterMatch as WC7;
|
||||
|
|
@ -1118,7 +1141,7 @@ private CheckResult verifyHistory()
|
|||
if (pkm.CurrentHandler != 1)
|
||||
return new CheckResult(Severity.Invalid, "Current handler should not be Event OT.", CheckIdentifier.History);
|
||||
}
|
||||
if (pkm.GenNumber >= 7)
|
||||
if (pkm.Format >= 7)
|
||||
{
|
||||
var geo = new[]
|
||||
{
|
||||
|
|
@ -1128,7 +1151,7 @@ private CheckResult verifyHistory()
|
|||
if (geo.Any(d => d != 0))
|
||||
return new CheckResult(Severity.Invalid, "Geolocation Memories should not be present.", CheckIdentifier.History);
|
||||
|
||||
if (pkm.XY && pkm.CNTs.Any(stat => stat > 0))
|
||||
if (pkm.GenNumber >= 7 && pkm.CNTs.Any(stat => stat > 0))
|
||||
return new CheckResult(Severity.Invalid, "Untraded -- Contest stats on SM origin should be zero.", CheckIdentifier.History);
|
||||
|
||||
if (!pkm.WasEvent && pkm.HT_Name.Length == 0) // Is not Traded
|
||||
|
|
@ -1272,7 +1295,13 @@ private void verifyOTMemory()
|
|||
return;
|
||||
}
|
||||
|
||||
if (EncounterType == typeof(WC6))
|
||||
if (EncounterType == typeof(EncounterTrade))
|
||||
{
|
||||
// Undocumented, uncommon, and insignificant -- don't bother.
|
||||
AddLine(Severity.Valid, "OT Memory (Ingame Trade) is valid.", CheckIdentifier.Memory);
|
||||
return;
|
||||
}
|
||||
if (EncounterType == typeof(WC6) && pkm.Format == 6)
|
||||
{
|
||||
WC6 MatchedWC6 = EncounterMatch as WC6;
|
||||
if (pkm.OT_Memory != MatchedWC6.OT_Memory)
|
||||
|
|
@ -1296,14 +1325,7 @@ private void verifyOTMemory()
|
|||
if (pkm.OT_Feeling != MatchedWC7.OT_Feeling)
|
||||
AddLine(Severity.Invalid, "Event " + (MatchedWC7.OT_Feeling == 0 ? "should not have an OT Memory Feeling value" : "OT Memory Feeling should be index " + MatchedWC7.OT_Feeling) + ".", CheckIdentifier.Memory);
|
||||
}
|
||||
if (EncounterType == typeof(EncounterTrade))
|
||||
{
|
||||
// Undocumented, uncommon, and insignificant -- don't bother.
|
||||
AddLine(Severity.Valid, "OT Memory (Ingame Trade) is valid.", CheckIdentifier.Memory);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pkm.GenNumber == 7)
|
||||
else if (pkm.Format == 7)
|
||||
{
|
||||
if (pkm.OT_Memory != 0)
|
||||
AddLine(Severity.Invalid, "Should not have an OT Memory.", CheckIdentifier.Memory);
|
||||
|
|
@ -1360,7 +1382,7 @@ private void verifyHTMemory()
|
|||
if (!History.Valid)
|
||||
return;
|
||||
|
||||
if (pkm.GenNumber == 7)
|
||||
if (pkm.Format == 7)
|
||||
{
|
||||
if (pkm.HT_Memory != 0)
|
||||
AddLine(Severity.Invalid, "Should not have a HT Memory.", CheckIdentifier.Memory);
|
||||
|
|
|
|||
|
|
@ -621,12 +621,11 @@ public PK7 convertToPK7()
|
|||
|
||||
// Bank-accurate data zeroing
|
||||
for (var i = 0x94; i < 0x9E; i++) pk7.Data[i] = 0; /* Geolocations. */
|
||||
for (var i = 0xAA; i < 0xB0; i++) pk7.Data[i] = 0; /* Unused/Amie. */
|
||||
for (var i = 0xAA; i < 0xB0; i++) pk7.Data[i] = 0; /* Unused/Amie Fullness & Enjoyment. */
|
||||
for (var i = 0xE4; i < 0xE8; i++) pk7.Data[i] = 0; /* Unused. */
|
||||
pk7.Data[0x72] &= 0xFC; /* Clear lower two bits of Super training flags. */
|
||||
pk7.Data[0xDE] = 0; /* Gen IV encounter type. */
|
||||
|
||||
|
||||
// Fix Checksum
|
||||
pk7.RefreshChecksum();
|
||||
|
||||
|
|
|
|||
|
|
@ -263,17 +263,17 @@ public byte[] Write()
|
|||
public int TrainerID7 => (int)((uint)(TID | (SID << 16)) % 1000000);
|
||||
public bool VC => Version >= 35 && Version <= 41;
|
||||
public bool Horohoro => Version == 34;
|
||||
public bool Gen7 => Version >= 30 && Version <= 33;
|
||||
public bool Gen6 => Version >= 24 && Version <= 29;
|
||||
public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y;
|
||||
public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR;
|
||||
public bool SM => Version == (int)GameVersion.SN || Version == (int)GameVersion.MN;
|
||||
protected bool PtHGSS => GameVersion.Pt == (GameVersion)Version || HGSS;
|
||||
protected bool HGSS => new[] {GameVersion.HG, GameVersion.SS}.Contains((GameVersion)Version);
|
||||
public bool Gen7 => Version >= 30 && Version <= 33;
|
||||
public bool Gen6 => Version >= 24 && Version <= 29;
|
||||
public bool Gen5 => Version >= 20 && Version <= 23;
|
||||
public bool Gen4 => Version >= 7 && Version <= 12 && Version != 9;
|
||||
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
|
||||
public bool GenU => !(Gen6 || Gen5 || Gen4 || Gen3);
|
||||
public bool GenU => !(Gen7 || Gen6 || Gen5 || Gen4 || Gen3);
|
||||
public int GenNumber
|
||||
{
|
||||
get
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user