Improve batch randomization

allow .EncryptionConstant=PID
improve .PID=$rand to use random PID method instead of pure rand
switch comparisons to match command appearance in richtextbox
This commit is contained in:
Kaphotics 2016-08-14 23:23:38 -07:00
parent d818eaec5f
commit 2116d528e4
2 changed files with 13 additions and 6 deletions

View file

@ -426,17 +426,20 @@ namespace PKHeX
public void setShinyPID()
{
do PID = PKX.getRandomPID(Species, Gender, Version, Nature, AltForm, PID); while (!IsShiny);
EncryptionConstant = PID;
if (GenNumber < 6)
EncryptionConstant = PID;
}
public void setPIDGender(int gender)
{
do PID = PKX.getRandomPID(Species, gender, Version, Nature, AltForm, PID); while (IsShiny);
EncryptionConstant = PID;
if (GenNumber < 6)
EncryptionConstant = PID;
}
public void setPIDNature(int nature)
{
do PID = PKX.getRandomPID(Species, Gender, Version, nature, AltForm, PID); while (IsShiny);
EncryptionConstant = PID;
if (GenNumber < 6)
EncryptionConstant = PID;
}
}
}

View file

@ -262,11 +262,15 @@ namespace PKHeX
{
try
{
if (cmd.PropertyValue == CONST_RAND && (cmd.PropertyName == "PID" || cmd.PropertyName == "EncryptionConstant"))
if (cmd.PropertyName == "EncryptionConstant" && cmd.PropertyValue == CONST_RAND)
ReflectUtil.SetValue(PKM, cmd.PropertyName, Util.rnd32().ToString());
else if (cmd.PropertyValue == CONST_SHINY && cmd.PropertyName == "PID")
else if(cmd.PropertyName == "PID" && cmd.PropertyValue == CONST_RAND)
PKM.setPIDGender(PKM.Gender);
else if (cmd.PropertyName == "EncryptionConstant" && cmd.PropertyValue == "PID")
PKM.EncryptionConstant = PKM.PID;
else if (cmd.PropertyName == "PID" && cmd.PropertyValue == CONST_SHINY)
PKM.setShinyPID();
else if (cmd.PropertyValue == "0" && cmd.PropertyName == "Species")
else if (cmd.PropertyName == "Species" && cmd.PropertyValue == "0")
PKM.Data = new byte[PKM.Data.Length];
else
ReflectUtil.SetValue(PKM, cmd.PropertyName, cmd.PropertyValue);