Fix event OT friendship check

Should compare to the original species not to the current
Added corresponding wc7 checks (and 4/5->6+ checks, unused).
This commit is contained in:
Kurt 2017-01-10 17:14:48 -08:00
parent 130807c698
commit 29658c28f2

View file

@ -1082,16 +1082,34 @@ namespace PKHeX.Core
if (pkm.HT_Gender > 1)
return new CheckResult(Severity.Invalid, $"HT Gender invalid {pkm.HT_Gender}.", CheckIdentifier.History);
MysteryGift mg = EncounterMatch as MysteryGift;
WC6 MatchedWC6 = EncounterMatch as WC6;
WC7 MatchedWC7 = EncounterMatch as WC7;
if (MatchedWC6?.OT.Length > 0) // Has Event OT -- null propagation yields false if MatchedWC6=null
{
if (pkm.OT_Friendship != pkm.PersonalInfo.BaseFriendship)
if (pkm.OT_Friendship != PersonalTable.AO[MatchedWC6.Species].BaseFriendship)
return new CheckResult(Severity.Invalid, "Event OT Friendship does not match base friendship.", CheckIdentifier.History);
if (pkm.OT_Affection != 0)
return new CheckResult(Severity.Invalid, "Event OT Affection should be zero.", CheckIdentifier.History);
if (pkm.CurrentHandler != 1)
return new CheckResult(Severity.Invalid, "Current handler should not be Event OT.", CheckIdentifier.History);
}
else if (MatchedWC7?.OT.Length > 0) // Has Event OT -- null propagation yields false if MatchedWC7=null
{
if (pkm.OT_Friendship != PersonalTable.SM[MatchedWC7.Species].BaseFriendship)
return new CheckResult(Severity.Invalid, "Event OT Friendship does not match base friendship.", CheckIdentifier.History);
if (pkm.OT_Affection != 0)
return new CheckResult(Severity.Invalid, "Event OT Affection should be zero.", CheckIdentifier.History);
if (pkm.CurrentHandler != 1)
return new CheckResult(Severity.Invalid, "Current handler should not be Event OT.", CheckIdentifier.History);
}
else if (mg != null && mg.Format < 6 && pkm.Format >= 6)
{
if (pkm.OT_Affection != 0)
return new CheckResult(Severity.Invalid, "Event OT Affection should be zero.", CheckIdentifier.History);
if (pkm.CurrentHandler != 1)
return new CheckResult(Severity.Invalid, "Current handler should not be Event OT.", CheckIdentifier.History);
}
if (pkm.GenNumber >= 7)
{
var geo = new[]