From bb97c0ffef1fb4c2e0338810cd2011d18e31f055 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 12 Apr 2017 21:38:53 -0700 Subject: [PATCH] Update wurmple check wurmple index was calculated incorrectly update main form EC reroll; now that legality checking (and gen1->7) is implemented the legality indicator will alert the user to their error instead. --- PKHeX.WinForms/MainWindow/Main.cs | 23 ++++++++++++++++------- PKHeX/Legality/Checks.cs | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index a0341007c..e1b13a4a8 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -2414,12 +2414,6 @@ private void updateRandomEC(object sender, EventArgs e) { if (pkm.Format < 6) return; - pkm.Version = WinFormsUtil.getIndex(CB_GameOrigin); - if (pkm.GenNumber < 6) - { - TB_EC.Text = TB_PID.Text; - WinFormsUtil.Alert("EC should match PID."); - } int wIndex = Array.IndexOf(Legal.WurmpleEvolutions, WinFormsUtil.getIndex(CB_Species)); if (wIndex < 0) @@ -2429,9 +2423,24 @@ private void updateRandomEC(object sender, EventArgs e) else { uint EC; - do { EC = Util.rnd32(); } while ((EC >> 16)%10/5 != wIndex/2); + bool valid; + do + { + EC = Util.rnd32(); + uint evoVal; + switch (pkm.GenNumber) + { + case 3: evoVal = pkm.PID & 0xFFFF; break; + case 4: + case 5: evoVal = pkm.PID >> 16; break; + default: evoVal = pkm.EncryptionConstant >> 16; break; + } + evoVal = evoVal%10/5; + valid = evoVal == wIndex/2; + } while (!valid); TB_EC.Text = EC.ToString("X8"); } + updateLegality(); } private void updateHackedStats(object sender, EventArgs e) { diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 5b0d941f4..83122a599 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -157,7 +157,7 @@ private void verifyECPIDWurmple() case 5: evoVal = pkm.PID >> 16; break; default: evoVal = pkm.EncryptionConstant >> 16; break; } - evoVal = evoVal%10/2; + evoVal = evoVal%10/5; if (pkm.Species == 265) {