diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs
index 49817063b..73668bc51 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs
@@ -15,19 +15,22 @@ public static class EncounterFinder
/// The iterator lazily finds matching encounters, then verifies secondary checks to weed out any nonexact matches.
///
/// Source data to find a match for
+ /// Object to store matched encounter info
///
/// Information containing the matched encounter and any parsed checks.
/// If no clean match is found, the last checked match is returned.
/// If no match is found, an invalid encounter object is returned.
///
- public static LegalInfo FindVerifiedEncounter(PKM pkm)
+ public static void FindVerifiedEncounter(PKM pkm, LegalInfo info)
{
- var info = new LegalInfo(pkm);
var encounters = EncounterGenerator.GetEncounters(pkm, info);
using var encounter = new PeekEnumerator(encounters);
if (!encounter.PeekIsNext())
- return VerifyWithoutEncounter(pkm, info);
+ {
+ VerifyWithoutEncounter(pkm, info);
+ return;
+ }
var EncounterValidator = EncounterVerifier.GetEncounterVerifierMethod(pkm);
while (encounter.MoveNext())
@@ -63,8 +66,6 @@ public static LegalInfo FindVerifiedEncounter(PKM pkm)
info.Parse.Add(new CheckResult(ParseSettings.RNGFrameNotFound, LEncConditionBadRNGFrame, CheckIdentifier.PID)); // todo for further confirmation
if (!info.PIDIVMatches) // if false, all valid PIDIV matches have already been consumed
info.Parse.Add(new CheckResult(Severity.Invalid, LPIDTypeMismatch, CheckIdentifier.PID));
-
- return info;
}
///
diff --git a/PKHeX.Core/Legality/LegalityAnalysis.cs b/PKHeX.Core/Legality/LegalityAnalysis.cs
index cadcb067c..2008d3897 100644
--- a/PKHeX.Core/Legality/LegalityAnalysis.cs
+++ b/PKHeX.Core/Legality/LegalityAnalysis.cs
@@ -111,11 +111,12 @@ public LegalityAnalysis(PKM pk, PersonalInfo pi)
if (pkm.Format <= 2) // prior to storing GameVersion
pkm.TradebackStatus = GBRestrictions.GetTradebackStatusInitial(pkm);
+ Info = new LegalInfo(pkm);
#if SUPPRESS
try
#endif
{
- Info = EncounterFinder.FindVerifiedEncounter(pkm);
+ EncounterFinder.FindVerifiedEncounter(pkm, Info);
if (!pkm.IsOriginValid)
AddLine(Severity.Invalid, LEncConditionBadSpecies, CheckIdentifier.GameOrigin);
GetParseMethod()();
@@ -141,7 +142,6 @@ public LegalityAnalysis(PKM pk, PersonalInfo pi)
#pragma warning restore CA1031 // Do not catch general exception types
{
System.Diagnostics.Debug.WriteLine(e.Message);
- Info = new LegalInfo(pkm);
Valid = false;
AddLine(Severity.Invalid, L_AError, CheckIdentifier.Misc);
}
@@ -396,7 +396,7 @@ private string GetVerboseLegalityReport()
if (rl != lines.Count) // move info added, break for next section
lines.Add(br[1]);
- var outputLines = Parse.Where(chk => chk?.Valid == true && chk.Comment != L_AValid).OrderBy(chk => chk.Judgement); // Fishy sorted to top
+ var outputLines = Parse.Where(chk => chk.Valid && chk.Comment != L_AValid).OrderBy(chk => chk.Judgement); // Fishy sorted to top
lines.AddRange(outputLines.Select(chk => chk.Format(L_F0_1)));
lines.AddRange(br);