Add initial nieve check for ball inheritance

Closes #2438
This commit is contained in:
Kurt 2019-11-16 17:45:51 -08:00
parent 915c2d52b1
commit 31c09c52e8

View file

@ -260,6 +260,13 @@ namespace PKHeX.Core
if (810 <= species && species <= 818) // G8 Starters
return VerifyBallEquals(data, (int)Poke);
if (IsGalarCapture(species))
{
if (!Legal.WildPokeballs8.Contains(pkm.Ball))
return GetInvalid(LBallSpecies);
return GetValid(LBallSpeciesPass);
}
Ball ball = (Ball)pkm.Ball;
if (ball == Safari)
@ -328,6 +335,18 @@ namespace PKHeX.Core
return NONE;
}
public bool IsGalarCapture(int species)
{
if (810 <= species && species <= 818) // starter
return false;
if (880 <= species && species <= 883) // fossil
return false;
var pt = PersonalTable.SWSH;
if (((PersonalInfoSWSH) pt.GetFormeEntry(species, 0)).IsPresentInGame)
return true;
return true;
}
private CheckResult VerifyBallEquals(LegalityAnalysis data, int ball) => GetResult(ball == data.pkm.Ball);
private CheckResult VerifyBallEquals(LegalityAnalysis data, HashSet<int> balls) => GetResult(balls.Contains(data.pkm.Ball));
private CheckResult VerifyBallEquals(LegalityAnalysis data, ICollection<int> balls) => GetResult(balls.Contains(data.pkm.Ball));