private void VerifyIVsMystery(LegalityAnalysis data, MysteryGift g) { var IVs = g.IVs; if (IVs.Length == 0) { return; } var ivflag = Array.Find(IVs, iv => (byte)(iv - 0xFC) < 3); if (ivflag == 0) // Random IVs { bool valid = Legal.GetIsFixedIVSequenceValidSkipRand(IVs, data.pkm); if (!valid) { data.AddLine(GetInvalid(LEncGiftIVMismatch)); } } else { int IVCount = ivflag - 0xFB; // IV2/IV3 VerifyIVsFlawless(data, IVCount); } }
private void VerifyIVsMystery(LegalityAnalysis data, MysteryGift g) { if (!g.HasFixedIVs) { return; // PID/IV style instead of fixed IVs. } Span <int> IVs = stackalloc int[6]; g.GetIVs(IVs); var ivflag = IVs.Find(iv => (byte)(iv - 0xFC) < 3); if (ivflag == 0) // Random IVs { bool valid = Legal.GetIsFixedIVSequenceValidSkipRand(IVs, data.pkm); if (!valid) { data.AddLine(GetInvalid(LEncGiftIVMismatch)); } } else { int IVCount = ivflag - 0xFB; // IV2/IV3 VerifyIVsFlawless(data, IVCount); } }
private bool IsMatchIVs(PKM pkm) { if (IVs.Count == 0) { return(true); // nothing to check, IVs are random } if (Generation <= 2 && pkm.Format > 2) { return(true); // IVs are regenerated on VC transfer upward } return(Legal.GetIsFixedIVSequenceValidSkipRand(IVs, pkm)); }