mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-11 08:05:21 -05:00
Fix gen1/2 gender detect
gender: take top 4 bits of gr: 31 = 0x1F = 1 63 = 0x3F = 3 127 = 0x7F = 7 191 = 0xBF = 11 See the pattern? If we change the compares from >= to >, we -1. All numbers match except for the 25/75 ratio pkm... which unveils the problem. Simplify the calc for these using the logic above, which fixes the error and makes the code easier to read! Thanks SystemError for assisting :)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
@@ -298,19 +297,7 @@ public override int Gender
|
||||
return 1;
|
||||
if (gv == 0)
|
||||
return 0;
|
||||
switch (gv)
|
||||
{
|
||||
case 31:
|
||||
return IV_ATK >= 2 ? 0 : 1;
|
||||
case 63:
|
||||
return IV_ATK >= 5 ? 0 : 1;
|
||||
case 127:
|
||||
return IV_ATK >= 8 ? 0 : 1;
|
||||
case 191:
|
||||
return IV_ATK >= 12 ? 0 : 1;
|
||||
}
|
||||
Debug.WriteLine($"Unknown Gender value: {gv}");
|
||||
return 0;
|
||||
return IV_ATK > gv >> 4 ? 0 : 1;
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
@@ -285,19 +284,7 @@ public override int Gender
|
||||
return 1;
|
||||
if (gv == 0)
|
||||
return 0;
|
||||
switch (gv)
|
||||
{
|
||||
case 31:
|
||||
return IV_ATK >= 2 ? 0 : 1;
|
||||
case 63:
|
||||
return IV_ATK >= 5 ? 0 : 1;
|
||||
case 127:
|
||||
return IV_ATK >= 8 ? 0 : 1;
|
||||
case 191:
|
||||
return IV_ATK >= 12 ? 0 : 1;
|
||||
}
|
||||
Debug.WriteLine($"Unknown Gender value: {gv}");
|
||||
return 0;
|
||||
return IV_ATK > gv >> 4 ? 0 : 1;
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user