Improve PID/EC rerolling automation

This commit is contained in:
Kaphotics 2016-08-08 18:42:42 -07:00
parent d65717487a
commit 724da7ff0f
2 changed files with 17 additions and 5 deletions

View file

@ -1628,13 +1628,13 @@ namespace PKHeX
pkm.setPIDGender(pkm.Gender);
TB_PID.Text = pkm.PID.ToString("X8");
getQuickFiller(dragout);
if (pkm.Format >= 6)
TB_EC.Text = pkm.EncryptionConstant.ToString("X8");
if (pkm.GenNumber < 6 && TB_EC.Visible)
TB_EC.Text = TB_PID.Text;
}
private void updateRandomEC(object sender, EventArgs e)
{
int origin = Util.getIndex(CB_GameOrigin);
if (origin < 24)
pkm.Version = Util.getIndex(CB_GameOrigin);
if (pkm.GenNumber < 6)
{
TB_EC.Text = TB_PID.Text;
Util.Alert("EC should match PID.");
@ -2101,11 +2101,12 @@ namespace PKHeX
pkm.Nature = Util.getIndex(CB_Nature);
pkm.Gender = PKX.getGender(Label_Gender.Text);
pkm.AltForm = CB_Form.SelectedIndex;
pkm.Version = Util.getIndex(CB_GameOrigin);
pkm.setShinyPID();
TB_PID.Text = pkm.PID.ToString("X8");
if (pkm.Format < 6)
if (pkm.GenNumber < 6 && TB_EC.Visible)
TB_EC.Text = TB_PID.Text;
getQuickFiller(dragout);

View file

@ -153,6 +153,17 @@ namespace PKHeX
public bool Gen4 => Version >= 10 && Version < 12 || Version >= 7 && Version <= 8;
public bool Gen3 => Version >= 1 && Version <= 5 || Version == 15;
public bool GenU => !(Gen6 || Gen5 || Gen4 || Gen3);
public int GenNumber
{
get
{
if (Gen6) return 6;
if (Gen5) return 5;
if (Gen4) return 4;
if (Gen3) return 3;
return -1;
}
}
public bool PKRS_Infected => PKRS_Strain > 0;
public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0;
public bool ChecksumValid => Checksum == CalculateChecksum();