Handle Gold Bottle Cap 31IV bugfix

HOME fixes anything with 31IVs flagged. S/V no longer in error. Would be an incredible headache to detect "has visited S/V prior to 3.0.0" so just flag it.
It's up to the checker to know about this.
This commit is contained in:
Kurt 2023-12-20 11:29:50 -08:00
parent e885a7d4f4
commit 5da1ae4849
2 changed files with 8 additions and 20 deletions

View file

@ -1,4 +1,3 @@
using System;
using static PKHeX.Core.LegalityCheckStrings;
namespace PKHeX.Core;
@ -42,7 +41,13 @@ public sealed class HyperTrainingVerifier : Verifier
// already checked for 6IV, therefore we're flawed on at least one IV
if (t.IsHyperTrainedAll())
{
if (HasVisitedGoldBottleFlawless(data.Info.EvoChainsAllGens))
// S/V gold bottle cap applies to all IVs regardless
// LGP/E gold bottle cap applies to all IVs regardless
// As of S/V update 3.0.0 and HOME, HOME will fix any with this issue, and S/V no longer behaves incorrectly.
// Ignore the fact that <3.0.0 S/V touched can be broken while still in S/V or previous games, as it's not worth the effort to check.
// - Needs to be able to inhabit S/V before 3.0.0, which has ball/date/species restrictions
// Really isn't worth checking. Just flag it for anything outside LGP/E similar to other GameFreak bugs (like incorrect move PP).
if (pk.Context == EntityContext.Gen7b)
return;
// Otherwise, could not have hyper trained a flawless IV. Flag a flawless IV with the usual logic.
}
@ -51,23 +56,6 @@ public sealed class HyperTrainingVerifier : Verifier
data.AddLine(GetInvalid(LHyperPerfectOne));
}
private static bool HasVisitedGoldBottleFlawless(EvolutionHistory evos)
{
// S/V gold bottle cap applies to all IVs regardless
// LGP/E gold bottle cap applies to all IVs regardless
foreach (ref readonly var x in evos.Gen9.AsSpan())
{
if (x.LevelMax >= 50)
return true;
}
foreach (ref readonly var x in evos.Gen7b.AsSpan())
{
if (x.LevelMax >= 100)
return true;
}
return false;
}
public static bool IsFlawlessHyperTrained(PKM pk, IHyperTrain t, int max)
{
for (int i = 0; i < 6; i++) // Check individual IVs

View file

@ -67,7 +67,7 @@ public static class SpriteUtil
private static Bitmap GetSprite(PKM pk)
{
var formarg = pk is IFormArgument f ? f.FormArgument : 0;
var shiny = !pk.IsShiny ? Shiny.Never : (ShinyExtensions.IsSquareShinyExist(pk) ? Shiny.AlwaysSquare : Shiny.AlwaysStar);
var shiny = ShinyExtensions.GetType(pk);
var img = GetSprite(pk.Species, pk.Form, pk.Gender, formarg, pk.SpriteItem, pk.IsEgg, shiny, pk.Context);
if (pk is IShadowCapture {IsShadow: true})