Use RandomGender logic from PKHeX

This commit is contained in:
Kurt 2019-02-17 22:10:48 -08:00
parent 127ae14d2b
commit 5879a4950f

View File

@ -147,15 +147,29 @@ public int FormeIndex(int species, int forme)
return FormStatsIndex + forme - 1;
}
/// <summary>
/// Gets a random valid gender for the entry.
/// </summary>
public int RandomGender()
{
if (Genderless)
return 2;
if (OnlyFemale)
return 1;
if (OnlyMale)
return 0;
return Util.Rand.Next(2);
var fix = FixedGender;
return fix >= 0 ? fix : Util.Rand.Next(2);
}
public bool IsDualGender => FixedGender < 0;
public int FixedGender
{
get
{
if (Genderless)
return 2;
if (OnlyFemale)
return 1;
if (OnlyMale)
return 0;
return -1;
}
}
public bool Genderless => Gender == 255;