mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-23 19:03:11 +00:00
fc754b346b
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces) Updates all the files, one less level of indentation. Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using static PKHeX.Core.LegalityCheckStrings;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Verifies the <see cref="IHyperTrain"/> values.
|
|
/// </summary>
|
|
public sealed class HyperTrainingVerifier : Verifier
|
|
{
|
|
protected override CheckIdentifier Identifier => CheckIdentifier.Training;
|
|
|
|
public override void Verify(LegalityAnalysis data)
|
|
{
|
|
var pk = data.Entity;
|
|
if (pk is not IHyperTrain t)
|
|
return; // No Hyper Training before Gen7
|
|
|
|
if (!t.IsHyperTrained())
|
|
return;
|
|
|
|
if (!t.IsHyperTrainingAvailable(data.Info.EvoChainsAllGens))
|
|
{
|
|
data.AddLine(GetInvalid(LHyperPerfectUnavailable));
|
|
return;
|
|
}
|
|
|
|
if (pk.CurrentLevel != 100)
|
|
{
|
|
data.AddLine(GetInvalid(LHyperBelow100));
|
|
return;
|
|
}
|
|
|
|
int max = pk.MaxIV;
|
|
if (pk.IVTotal == max * 6)
|
|
{
|
|
data.AddLine(GetInvalid(LHyperPerfectAll));
|
|
return;
|
|
}
|
|
|
|
// LGPE gold bottle cap applies to all IVs regardless
|
|
if (pk.GG && t.IsHyperTrainedAll()) // already checked for 6IV, therefore we're flawed on at least one IV
|
|
return;
|
|
|
|
for (int i = 0; i < 6; i++) // Check individual IVs
|
|
{
|
|
if (pk.GetIV(i) != max || !t.IsHyperTrained(i))
|
|
continue;
|
|
data.AddLine(GetInvalid(LHyperPerfectOne));
|
|
break;
|
|
}
|
|
}
|
|
}
|