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;
|
2021-01-11 02:15:33 +00:00
|
|
|
|
bool checksRequired = data.EncounterMatch is EncounterStatic5N;
|
2018-06-24 05:00:01 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2020-12-24 02:03:05 +00:00
|
|
|
|
if (pkm.OT_Gender != 0)
|
2020-12-24 04:40:59 +00:00
|
|
|
|
data.AddLine(GetInvalid(LG5OTGenderN, CheckIdentifier.Trainer));
|
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;
|
2020-10-07 03:09:14 +00:00
|
|
|
|
var c = EncounterStatic5N.GetOT(pkm.Language);
|
2018-06-24 05:00:01 +00:00
|
|
|
|
return c == ot;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|