mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Add fixed gender checks for non-GBA/NDS games
Closes #1912 , genderless ~= fixed gender I guess; shouldn't get these gender-errors unless it's manually tampered data/ShowdownSet remove unnecessary code in: * PKMEditor (>=255 is already covered by == 255 and the fact that gt is always <= 255) * VerifyGender (3 <= x <= 5) check is already early-returned via PIDGender check above Update IsGenderValid knowing that VC mons have a gennumber <= 2
This commit is contained in:
parent
15ce1acfdb
commit
3f6b1acc93
3 changed files with 11 additions and 7 deletions
|
@ -9,10 +9,11 @@ namespace PKHeX.Core
|
|||
{
|
||||
private void VerifyGender()
|
||||
{
|
||||
if (pkm.PersonalInfo.Gender == 255 && pkm.Gender != 2)
|
||||
var gr = pkm.PersonalInfo.Gender;
|
||||
if (gr == 255 && pkm.Gender != 2)
|
||||
{
|
||||
// DP/HGSS shedinja glitch -- only generation 4 spawns
|
||||
bool ignore = pkm.Species == 292 && pkm.Format == 4 && pkm.Met_Level != pkm.CurrentLevel;
|
||||
bool ignore = pkm.Format == 4 && pkm.Species == 292 && pkm.Met_Level != pkm.CurrentLevel;
|
||||
if (!ignore)
|
||||
AddLine(Severity.Invalid, V203, CheckIdentifier.Gender);
|
||||
}
|
||||
|
@ -22,7 +23,12 @@ namespace PKHeX.Core
|
|||
|
||||
bool PIDGender = 3 <= gen && gen <= 5;
|
||||
if (!PIDGender)
|
||||
{
|
||||
// Check fixed gender cases
|
||||
if ((gr == 254 || gr == 0) && (gr == 0 ? 0 : 1) != pkm.Gender)
|
||||
AddLine(Severity.Invalid, V203, CheckIdentifier.Gender);
|
||||
return;
|
||||
}
|
||||
|
||||
bool genderValid = pkm.IsGenderValid();
|
||||
if (!genderValid)
|
||||
|
@ -41,7 +47,7 @@ namespace PKHeX.Core
|
|||
genderValid = true;
|
||||
}
|
||||
}
|
||||
else if (3 <= Info.Generation && Info.Generation <= 5)
|
||||
else
|
||||
{
|
||||
// check for mixed->fixed gender incompatibility by checking the gender of the original species
|
||||
if (Legal.FixedGenderFromBiGender.Contains(EncounterMatch.Species) && pkm.Gender != 2) // shedinja
|
||||
|
|
|
@ -652,7 +652,8 @@ namespace PKHeX.Core
|
|||
if (gv == 0)
|
||||
return gender == 0;
|
||||
|
||||
if (GenNumber >= 6)
|
||||
int gen = GenNumber;
|
||||
if (2 <= gen || gen >= 6)
|
||||
return true;
|
||||
|
||||
return gender == PKX.GetGenderFromPIDAndRatio(PID, gv);
|
||||
|
|
|
@ -513,9 +513,6 @@ namespace PKHeX.WinForms.Controls
|
|||
if (gt == 255 || gt == 0 || gt == 254) // Single gender/genderless
|
||||
return;
|
||||
|
||||
if (gt >= 255) return;
|
||||
// If not a single gender(less) species: (should be <254 but whatever, 255 never happens)
|
||||
|
||||
int newGender = PKX.GetGenderFromString(Label_Gender.Text) ^ 1;
|
||||
if (pkm.Format <= 2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue