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:
Kurt 2017-05-23 18:48:16 -07:00
parent 7e30d863b0
commit b8a799f7ed
2 changed files with 6 additions and 7 deletions

View file

@ -585,7 +585,7 @@ namespace PKHeX.Core
if (GenNumber >= 6)
return true;
return gender == PKX.getGender(Species, PID, gv);
return gender == PKX.getGender(PID, gv);
}
/// <summary>

View file

@ -474,7 +474,7 @@ namespace PKHeX.Core
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 @@ namespace PKHeX.Core
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