mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Fix wurmple evo lockup
while loop wasn't checking the modified EC value, thus looping forever standardize usage across core
This commit is contained in:
parent
8f951211b4
commit
f70bd02d69
4 changed files with 22 additions and 21 deletions
|
@ -91,7 +91,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
private void verifyECPIDWurmple()
|
||||
{
|
||||
uint evoVal = EncounterGenerator.getWurmpleEvoVal(pkm);
|
||||
uint evoVal = PKX.getWurmpleEvoVal(pkm.GenNumber, pkm.EncryptionConstant);
|
||||
|
||||
if (pkm.Species == 265)
|
||||
AddLine(Severity.Valid, string.Format(V212, evoVal == 0 ? specieslist[267] : specieslist[269]), CheckIdentifier.EC);
|
||||
|
|
|
@ -1104,20 +1104,9 @@ namespace PKHeX.Core
|
|||
string tr = pkm.Format <= 2 ? "TRAINER" : "Trainer"; // decaps on transfer
|
||||
return ot == "トレーナー" || ot == tr;
|
||||
}
|
||||
internal static uint getWurmpleEvoVal(PKM pkm)
|
||||
{
|
||||
uint evoVal;
|
||||
switch (pkm.GenNumber)
|
||||
{
|
||||
case 4:
|
||||
case 3: evoVal = pkm.EncryptionConstant & 0xFFFF; break;
|
||||
default: evoVal = pkm.EncryptionConstant >> 16; break;
|
||||
}
|
||||
return evoVal % 10 / 5;
|
||||
}
|
||||
private static bool getWurmpleEvoValid(PKM pkm)
|
||||
{
|
||||
uint evoVal = getWurmpleEvoVal(pkm);
|
||||
uint evoVal = PKX.getWurmpleEvoVal(pkm.GenNumber, pkm.EncryptionConstant);
|
||||
int wIndex = Array.IndexOf(WurmpleEvolutions, pkm.Species) / 2;
|
||||
return evoVal == wIndex;
|
||||
}
|
||||
|
|
|
@ -433,6 +433,24 @@ namespace PKHeX.Core
|
|||
return chk;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Wurmple Evolution Value for a given <see cref="PKM.GenNumber"/> and <see cref="PKM.EncryptionConstant"/>
|
||||
/// </summary>
|
||||
/// <param name="gen">Origin Generation</param>
|
||||
/// <param name="EC">Encryption Constant</param>
|
||||
/// <returns>Wurmple Evolution Value</returns>
|
||||
public static uint getWurmpleEvoVal(int gen, uint EC)
|
||||
{
|
||||
uint evoVal;
|
||||
switch (gen)
|
||||
{
|
||||
case 4:
|
||||
case 3: evoVal = EC & 0xFFFF; break;
|
||||
default: evoVal = EC >> 16; break;
|
||||
}
|
||||
return evoVal % 10 / 5;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a random PID according to specifications.
|
||||
/// </summary>
|
||||
|
|
|
@ -993,19 +993,13 @@ namespace PKHeX.WinForms.Controls
|
|||
}
|
||||
else
|
||||
{
|
||||
int gen = pkm.GenNumber;
|
||||
uint EC;
|
||||
bool valid;
|
||||
do
|
||||
{
|
||||
EC = Util.rnd32();
|
||||
uint evoVal;
|
||||
switch (pkm.GenNumber)
|
||||
{
|
||||
case 4:
|
||||
case 3: evoVal = pkm.EncryptionConstant & 0xFFFF; break;
|
||||
default: evoVal = pkm.EncryptionConstant >> 16; break;
|
||||
}
|
||||
evoVal = evoVal % 10 / 5;
|
||||
uint evoVal = PKX.getWurmpleEvoVal(gen, EC);
|
||||
valid = evoVal == wIndex / 2;
|
||||
} while (!valid);
|
||||
TB_EC.Text = EC.ToString("X8");
|
||||
|
|
Loading…
Add table
Reference in a new issue