mirror of
https://github.com/kwsch/pkNX.git
synced 2026-06-01 01:37:19 -05:00
Use RandomGender logic from PKHeX
This commit is contained in:
parent
127ae14d2b
commit
5879a4950f
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user