gender check update

check gender correctly for transferred species
This commit is contained in:
Kurt 2017-03-25 00:01:02 -07:00
parent 047d7a0ae5
commit 13965d2766
9 changed files with 20 additions and 129 deletions

View file

@ -403,24 +403,6 @@ namespace PKHeX.Core
}
// Methods
public override bool getGenderIsValid()
{
int gv = PersonalTable.HGSS[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
protected override ushort CalculateChecksum()
{
ushort chk = 0;

View file

@ -187,22 +187,5 @@ namespace PKHeX.Core
{
return (byte[])Data.Clone();
}
public override bool getGenderIsValid()
{
int gv = PersonalTable.RS[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
}
}

View file

@ -169,24 +169,6 @@ namespace PKHeX.Core
{
return PKX.encryptArray3(Data);
}
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if ((PID & 0xFF) <= gv)
return Gender == 1;
if (gv < (PID & 0xFF))
return Gender == 0;
return false;
}
public PK4 convertToPK4()
{
DateTime moment = DateTime.Now;

View file

@ -385,23 +385,6 @@ namespace PKHeX.Core
}
// Methods
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if ((PID & 0xFF) <= gv)
return Gender == 1;
if (gv < (PID & 0xFF))
return Gender == 0;
return false;
}
public override byte[] Encrypt()
{
RefreshChecksum();

View file

@ -301,23 +301,6 @@ namespace PKHeX.Core
}
// Methods
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if ((PID & 0xFF) <= gv)
return Gender == 1;
if (gv < (PID & 0xFF))
return Gender == 0;
return false;
}
public override byte[] Encrypt()
{
RefreshChecksum();

View file

@ -411,18 +411,6 @@ namespace PKHeX.Core
Checksum = CalculateChecksum();
return PKX.encryptArray(Data);
}
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
return true;
}
// General User-error Fixes
public void FixRelearn()

View file

@ -445,18 +445,6 @@ namespace PKHeX.Core
Checksum = CalculateChecksum();
return PKX.encryptArray(Data);
}
public override bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
return true;
}
// General User-error Fixes
public void FixRelearn()

View file

@ -512,7 +512,26 @@ namespace PKHeX.Core
/// Checks if the current <see cref="Gender"/> is valid.
/// </summary>
/// <returns>True if valid, False if invalid.</returns>
public abstract bool getGenderIsValid();
public virtual bool getGenderIsValid()
{
int gv = PersonalInfo.Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 1;
if (gv == 0)
return Gender == 0;
if (GenNumber >= 6)
return true;
if ((PID & 0xFF) < gv)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
return false;
}
/// <summary>
/// Updates the checksum of the <see cref="PKM"/>.

View file

@ -193,22 +193,5 @@ namespace PKHeX.Core
{
return (byte[])Data.Clone();
}
public override bool getGenderIsValid()
{
int gv = PersonalTable.RS[Species].Gender;
if (gv == 255)
return Gender == 2;
if (gv == 254)
return Gender == 0;
if (gv == 0)
return Gender == 1;
if (gv <= (PID & 0xFF))
return Gender == 0;
if ((PID & 0xFF) < gv)
return Gender == 1;
return false;
}
}
}