2018-06-24 05:00:01 +00:00
|
|
|
|
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2018-07-02 02:17:37 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Verifies the <see cref="IHyperTrain"/> values.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class HyperTrainingVerifier : Verifier
|
2018-06-24 05:00:01 +00:00
|
|
|
|
{
|
|
|
|
|
protected override CheckIdentifier Identifier => CheckIdentifier.Training;
|
|
|
|
|
|
|
|
|
|
public override void Verify(LegalityAnalysis data)
|
|
|
|
|
{
|
|
|
|
|
var pkm = data.pkm;
|
2020-12-22 01:12:39 +00:00
|
|
|
|
if (pkm is not IHyperTrain t)
|
2018-06-24 05:00:01 +00:00
|
|
|
|
return; // No Hyper Training before Gen7
|
|
|
|
|
|
|
|
|
|
if (!t.IsHyperTrained())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pkm.CurrentLevel != 100)
|
|
|
|
|
{
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LHyperBelow100));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int max = pkm.MaxIV;
|
|
|
|
|
if (pkm.IVTotal == max * 6)
|
|
|
|
|
{
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LHyperPerfectAll));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-07 00:21:34 +00:00
|
|
|
|
// LGPE gold bottle cap applies to all IVs regardless
|
|
|
|
|
if (pkm.GG && t.IsHyperTrainedAll()) // already checked for 6IV, therefore we're flawed on at least one IV
|
|
|
|
|
return;
|
|
|
|
|
|
2018-06-24 05:00:01 +00:00
|
|
|
|
for (int i = 0; i < 6; i++) // Check individual IVs
|
|
|
|
|
{
|
|
|
|
|
if (pkm.GetIV(i) != max || !t.IsHyperTrained(i))
|
|
|
|
|
continue;
|
2018-09-01 21:11:12 +00:00
|
|
|
|
data.AddLine(GetInvalid(LHyperPerfectOne));
|
2018-06-24 05:00:01 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|