Add XY wild undiscovered egg group IV check

Closes #2025
add misc updates/simplifications (personal stuff used in pkNX)
This commit is contained in:
Kurt
2018-06-24 21:55:00 -07:00
parent 09c96558ea
commit fba8adb32f
4 changed files with 42 additions and 17 deletions

View File

@@ -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)

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -252,6 +252,9 @@ public PersonalInfo GetFormeEntry(int species, int forme)
/// </summary>
public int TableLength => Table.Length;
/// <summary>
/// Maximum Species ID for the Table.
/// </summary>
public readonly int MaxSpeciesID;
/// <summary>