mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 00:37:11 +00:00
177604e2cb
Simplify some verifier logic
25 lines
753 B
C#
25 lines
753 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 CheckResult VerifyConsoleRegion(PKM pkm)
|
|
{
|
|
int consoleRegion = pkm.ConsoleRegion;
|
|
if (consoleRegion >= 7)
|
|
return GetInvalid(V301);
|
|
|
|
if (!Legal.IsConsoleRegionCountryValid(consoleRegion, pkm.Country))
|
|
return GetInvalid(V302);
|
|
|
|
return GetValid(V303);
|
|
}
|
|
}
|
|
}
|