Improve partial match bleed through

Checks partial matches in the loop rather than outside; it'll only settle on the partial match if there's nothing else to settle on.

Gen1/2 generators can have partial matches bubble up before actual matches (gen1 fighting gen2).
This commit is contained in:
Kurt 2021-02-02 22:40:06 -08:00
parent 2b00e310ae
commit 9d9eb935b1

View file

@ -41,16 +41,22 @@ namespace PKHeX.Core
}
info.Parse.Add(e);
if (VerifySecondaryChecks(pkm, info, encounter))
break; // passes
}
if (!VerifySecondaryChecks(pkm, info, encounter))
continue;
// Sanity Check -- Some secondary checks might not be as thorough as the partial-match leak-through checks done by the encounter.
if (info.EncounterMatch is not IEncounterMatch mx)
break;
// Sanity Check -- Some secondary checks might not be as thorough as the partial-match leak-through checks done by the encounter.
if (info.EncounterMatch is IEncounterMatch mx)
{
var match = mx.GetMatchRating(pkm);
if (match == EncounterMatchRating.PartialMatch)
info.Parse.Add( new CheckResult(Severity.Invalid, LEncInvalid, CheckIdentifier.Encounter));
if (match != EncounterMatchRating.PartialMatch)
break;
if (encounter.PeekIsNext())
continue;
info.Parse.Add(new CheckResult(Severity.Invalid, LEncInvalid, CheckIdentifier.Encounter));
break;
}
if (!info.FrameMatches && info.EncounterMatch is EncounterSlot {Version: not GameVersion.CXD}) // if false, all valid RNG frame matches have already been consumed