Fix ball enumerating when setter guards value

Ty Atrius!
This commit is contained in:
Kurt 2022-10-14 17:14:58 -07:00
parent 8b0e93b42f
commit 66f43291d3

View file

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using static PKHeX.Core.Ball; using static PKHeX.Core.Ball;
@ -23,7 +23,10 @@ public static class BallApplicator
var clone = pk.Clone(); var clone = pk.Clone();
foreach (var b in BallList) foreach (var b in BallList)
{ {
clone.Ball = (int)b; var ball = (int)b;
clone.Ball = ball;
if (clone.Ball != ball)
continue; // Some setters guard against out of bounds values.
if (new LegalityAnalysis(clone).Valid) if (new LegalityAnalysis(clone).Valid)
yield return b; yield return b;
} }