Add greninja variable PID edge case

game programmer should have used the nonshiny mode option instead of
randomly coming up with a PID
closes #458
added missing gift check for level (was 'deferred' but never
implemented)
This commit is contained in:
Kurt 2016-12-11 17:13:59 -08:00
parent edf69fdacf
commit bdd1158a25
2 changed files with 16 additions and 3 deletions

View File

@ -486,6 +486,11 @@ private void verifyLevel()
return;
}
}
if (MatchedGift != null && MatchedGift.Level > pkm.CurrentLevel)
{
AddLine(new CheckResult(Severity.Invalid, "Current Level below Wonder Card level.", CheckIdentifier.Level));
return;
}
int lvl = pkm.CurrentLevel;
if (lvl > 1 && pkm.IsEgg)

View File

@ -439,9 +439,6 @@ private static IEnumerable<MysteryGift> getMatchingWC7(PKM pkm, IEnumerable<Myst
if (wc.OTGender != pkm.OT_Gender) continue;
}
if (!string.IsNullOrEmpty(wc.OT) && wc.OT != pkm.OT_Name) continue;
if (wc.PIDType == 0 && pkm.PID != wc.PID) continue;
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
if (wc.PIDType == 3 && pkm.IsShiny) continue;
if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version) continue;
if (wc.EncryptionConstant != 0 && wc.EncryptionConstant != pkm.EncryptionConstant) continue;
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
@ -462,6 +459,17 @@ private static IEnumerable<MysteryGift> getMatchingWC7(PKM pkm, IEnumerable<Myst
if (wc.CNT_Tough > pkm.CNT_Tough) continue;
if (wc.CNT_Sheen > pkm.CNT_Sheen) continue;
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
if (wc.PIDType == 3 && pkm.IsShiny) continue;
if ((pkm.SID << 16 | pkm.TID) == 0x79F57B49) // Greninja WC has variant PID and can arrive @ 36 or 37
{
if (!pkm.IsShiny)
validWC7.Add(wc);
continue;
}
if (wc.PIDType == 0 && pkm.PID != wc.PID) continue;
// Some checks are best performed separately as they are caused by users screwing up valid data.
// if (!wc.RelearnMoves.SequenceEqual(pkm.RelearnMoves)) continue; // Defer to relearn legality
// if (wc.OT.Length > 0 && pkm.CurrentHandler != 1) continue; // Defer to ownership legality