mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-18 08:23:12 +00:00
e29cf2a903
Checks.cs initially started out small, but over the years it has grown to handle multiple types of checks. With all these checks next to eachother, it's hard to see the overall groups. Splitting them up (potentially further?) allows for more focused maintenance & understanding. Not sure if I'm happy with the overall bandaids used (checks no longer done within LegalityAnalysis so variable repointing is excessively used), but I'm happier the way it is now compared to the huge Checks.cs
23 lines
902 B
C#
23 lines
902 B
C#
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
public class ConsoleRegionVerifier : Verifier
|
|
{
|
|
protected override CheckIdentifier Identifier => CheckIdentifier.Geography;
|
|
public override void Verify(LegalityAnalysis data)
|
|
{
|
|
var result = VerifyConsoleRegion(data.pkm);
|
|
data.AddLine(result);
|
|
}
|
|
private static CheckResult VerifyConsoleRegion(PKM pkm)
|
|
{
|
|
int consoleRegion = pkm.ConsoleRegion;
|
|
if (consoleRegion >= 7)
|
|
return new CheckResult(Severity.Invalid, V301, CheckIdentifier.Geography);
|
|
return Legal.IsConsoleRegionCountryValid(consoleRegion, pkm.Country)
|
|
? new CheckResult(Severity.Valid, V303, CheckIdentifier.Geography)
|
|
: new CheckResult(Severity.Invalid, V302, CheckIdentifier.Geography);
|
|
}
|
|
}
|
|
}
|