2018-07-01 17:49:11 +00:00
|
|
|
|
using static PKHeX.Core.LegalityCheckStrings;
|
2018-06-24 05:00:01 +00:00
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2018-07-02 02:17:37 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Verifies the <see cref="PK5.NPokémon"/> data.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class NHarmoniaVerifier : Verifier
|
2018-06-24 05:00:01 +00:00
|
|
|
|
{
|
|
|
|
|
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)
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LG5SparkleRequired, CheckIdentifier.Fateful));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
if (!checksRequired && has)
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LG5SparkleInvalid, CheckIdentifier.Fateful));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!checksRequired)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-07-01 17:49:11 +00:00
|
|
|
|
if (pkm.IVTotal != 30*6)
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LG5IVAll30, CheckIdentifier.IVs));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
if (!VerifyNsPKMOTValid(pkm))
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LG5ID_N, CheckIdentifier.Trainer));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
if (pkm.IsShiny)
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LG5PIDShinyN, CheckIdentifier.Shiny));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
2018-06-24 05:00:01 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|