mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-25 23:54:33 -05:00
Fix gender ratio comparison
http://bulbapedia.bulbagarden.net/wiki/Personality_value#Gender For a Pokémon with a 50/50 male/female gender ratio, there is actually a 129/256 (50.390625%) chance for the Pokémon to be male and 127/256 (49.609375%) chance for the Pokémon to be female. remove unnecessary parameter passing #1163
This commit is contained in:
@@ -585,7 +585,7 @@ public virtual bool getGenderIsValid()
|
||||
if (GenNumber >= 6)
|
||||
return true;
|
||||
|
||||
return gender == PKX.getGender(Species, PID, gv);
|
||||
return gender == PKX.getGender(PID, gv);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -474,7 +474,7 @@ public static uint getRandomPID(int species, int cg, int origin, int nature, int
|
||||
return pid; // PID can be anything
|
||||
|
||||
// Gen 3/4/5: Gender derived from PID
|
||||
if (cg == getGender(species, pid, gt))
|
||||
if (cg == getGender(pid, gt))
|
||||
return pid;
|
||||
}
|
||||
}
|
||||
@@ -1408,17 +1408,16 @@ public static int getG3Species(int g4index)
|
||||
public static int getGender(int species, uint PID)
|
||||
{
|
||||
int genderratio = Personal[species].Gender;
|
||||
return getGender(species, PID, genderratio);
|
||||
return getGender(PID, genderratio);
|
||||
}
|
||||
public static int getGender(int species, uint PID, int gv)
|
||||
public static int getGender(uint PID, int gr)
|
||||
{
|
||||
int genderratio = Personal[species].Gender;
|
||||
switch (genderratio)
|
||||
switch (gr)
|
||||
{
|
||||
case 255: return 2;
|
||||
case 254: return 1;
|
||||
case 0: return 0;
|
||||
default: return (PID & 0xFF) <= genderratio ? 1 : 0;
|
||||
default: return (PID & 0xFF) < gr ? 1 : 0;
|
||||
}
|
||||
}
|
||||
#region Gen 3 Species Table
|
||||
|
||||
Reference in New Issue
Block a user