mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00: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:
parent
7e30d863b0
commit
b8a799f7ed
2 changed files with 6 additions and 7 deletions
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue