diff --git a/PKHeX.Core/Legality/Verifiers/IndividualValueVerifier.cs b/PKHeX.Core/Legality/Verifiers/IndividualValueVerifier.cs
index b946b7167..fa1463488 100644
--- a/PKHeX.Core/Legality/Verifiers/IndividualValueVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/IndividualValueVerifier.cs
@@ -75,9 +75,18 @@ private static int[] GetMysteryGiftIVs(MysteryGift g)
private void VerifyIVsSlot(LegalityAnalysis data, EncounterSlot w)
{
var pkm = data.pkm;
- bool force2 = w.Type == SlotType.FriendSafari || w.Generation == 7 && pkm.AbilityNumber == 4;
- if (force2 && pkm.IVs.Count(iv => iv == 31) < 2)
- data.AddLine(GetInvalid(w.Type == SlotType.FriendSafari ? V29 : string.Format(V28, 2)));
+ if (w.Generation == 7 && pkm.AbilityNumber == 4)
+ VerifyIVsFlawless(data, 3);
+ else if (w.Type == SlotType.FriendSafari && pkm.IVs.Count(iv => iv == 31) < 2)
+ data.AddLine(GetInvalid(string.Format(V28, 2)));
+ else if(pkm.XY && PersonalTable.XY[data.EncounterMatch.Species].IsEggGroup(15)) // Undiscovered
+ VerifyIVsFlawless(data, 3);
+ }
+
+ private void VerifyIVsFlawless(LegalityAnalysis data, int count)
+ {
+ if (data.pkm.IVs.Count(iv => iv == 31) < 3)
+ data.AddLine(GetInvalid(string.Format(V28, count)));
}
private void VerifyIVsStatic(LegalityAnalysis data, EncounterStatic s)
diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs
index f6a2a2248..a5baf48c2 100644
--- a/PKHeX.Core/PKM/PKM.cs
+++ b/PKHeX.Core/PKM/PKM.cs
@@ -925,8 +925,13 @@ public int GetFlawlessIVCount()
{
if (GenNumber >= 6 && (Legal.Legends.Contains(Species) || Legal.SubLegends.Contains(Species)))
return 3;
- if (XY && Met_Location == 148 && Met_Level == 30)
- return 2;
+ if (XY)
+ {
+ if (Met_Location == 148 && Met_Level == 30)
+ return 2;
+ if (PersonalInfo.EggGroup1 == 15) // Undiscovered
+ return 3;
+ }
if (VC)
return Species == 151 || Species == 251 ? 5 : 3;
return 0;
diff --git a/PKHeX.Core/PersonalInfo/PersonalInfo.cs b/PKHeX.Core/PersonalInfo/PersonalInfo.cs
index aad076383..e2141695e 100644
--- a/PKHeX.Core/PersonalInfo/PersonalInfo.cs
+++ b/PKHeX.Core/PersonalInfo/PersonalInfo.cs
@@ -14,7 +14,19 @@ public abstract class PersonalInfo
public abstract int SPA { get; set; }
public abstract int SPD { get; set; }
- public int[] Stats => new[] { HP, ATK, DEF, SPE, SPA, SPD };
+ public int[] Stats
+ {
+ get => new[] { HP, ATK, DEF, SPE, SPA, SPD };
+ set
+ {
+ HP = value[0];
+ ATK = value[1];
+ DEF = value[2];
+ SPE = value[3];
+ SPA = value[4];
+ SPD = value[5];
+ }
+ }
public abstract int EV_HP { get; set; }
public abstract int EV_ATK { get; set; }
@@ -131,17 +143,13 @@ public int RandomGender
{
get
{
- switch (Gender)
- {
- case 255: // Genderless
- return 2;
- case 254: // Female
- return 1;
- case 0: // Male
- return 0;
- default:
- return (int)(Util.Rand32() & 1);
- }
+ if (Genderless)
+ return 2;
+ if (OnlyFemale)
+ return 1;
+ if (OnlyMale)
+ return 0;
+ return Util.Rand.Next(2);
}
}
diff --git a/PKHeX.Core/PersonalInfo/PersonalTable.cs b/PKHeX.Core/PersonalInfo/PersonalTable.cs
index 3bf055ad1..afccdf84e 100644
--- a/PKHeX.Core/PersonalInfo/PersonalTable.cs
+++ b/PKHeX.Core/PersonalInfo/PersonalTable.cs
@@ -252,6 +252,9 @@ public PersonalInfo GetFormeEntry(int species, int forme)
///
public int TableLength => Table.Length;
+ ///
+ /// Maximum Species ID for the Table.
+ ///
public readonly int MaxSpeciesID;
///