mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-18 00:13:10 +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
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using System.Linq;
|
|
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
public class NHarmoniaVerifier : Verifier
|
|
{
|
|
protected override CheckIdentifier Identifier => CheckIdentifier.Trainer;
|
|
|
|
public override void Verify(LegalityAnalysis data)
|
|
{
|
|
var pkm = data.pkm;
|
|
var EncounterMatch = data.EncounterMatch;
|
|
|
|
bool checksRequired = EncounterMatch is EncounterStaticPID s && s.NSparkle;
|
|
if (pkm is PK5 pk5)
|
|
{
|
|
bool has = pk5.NPokémon;
|
|
if (checksRequired && !has)
|
|
data.AddLine(GetInvalid(V326, CheckIdentifier.Fateful));
|
|
if (!checksRequired && has)
|
|
data.AddLine(GetInvalid(V327, CheckIdentifier.Fateful));
|
|
}
|
|
|
|
if (!checksRequired)
|
|
return;
|
|
|
|
if (pkm.IVs.Any(iv => iv != 30))
|
|
data.AddLine(GetInvalid(V218, CheckIdentifier.IVs));
|
|
if (!VerifyNsPKMOTValid(pkm))
|
|
data.AddLine(GetInvalid(V219, CheckIdentifier.Trainer));
|
|
if (pkm.IsShiny)
|
|
data.AddLine(GetInvalid(V220, CheckIdentifier.Shiny));
|
|
}
|
|
private static bool VerifyNsPKMOTValid(PKM pkm)
|
|
{
|
|
if (pkm.TID != 00002 || pkm.SID != 00000)
|
|
return false;
|
|
var ot = pkm.OT_Name;
|
|
if (ot.Length != 1)
|
|
return false;
|
|
var c = Legal.GetG5OT_NSparkle(pkm.Language);
|
|
return c == ot;
|
|
}
|
|
}
|
|
}
|