From 88b5277062d02642e64e05ffc47cd4e18917d7d6 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 15 Jun 2018 22:00:51 -0700 Subject: [PATCH] Misc mg gen fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed gender PCD with dynamic PID needs to check gender validity (some korean card had it) Fixed wc3 generated force-hatching to unflag fateful for non-frlg and to hatch on the designated game just in case stuck on a PGF issue where ability doesn't match PID, need to revisit that PID creation... Card #: 0002 - がくえんさい×ポケモンプレゼント --- PKHeX.Core/MysteryGifts/PGT.cs | 21 ++++++++------------- PKHeX.Core/MysteryGifts/WC3.cs | 4 +++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/PKHeX.Core/MysteryGifts/PGT.cs b/PKHeX.Core/MysteryGifts/PGT.cs index 8f840e61a..b50fd544a 100644 --- a/PKHeX.Core/MysteryGifts/PGT.cs +++ b/PKHeX.Core/MysteryGifts/PGT.cs @@ -271,20 +271,15 @@ public override PKM ConvertToPKM(ITrainerInfo SAV) uint seed = Util.Rand32(); if (pk4.PID == 1) // Create Nonshiny { - uint pid1 = PKX.LCRNG(ref seed) >> 16; - uint pid2 = PKX.LCRNG(ref seed) >> 16; + do { + uint pid1 = PKX.LCRNG(ref seed) >> 16; + uint pid2 = PKX.LCRNG(ref seed) >> 16; + pk4.PID = pid1 | (pid2 << 16); + // sanity check gender for non-genderless PID cases + } while (!pk4.IsGenderValid()); - while ((pid1 ^ pid2 ^ pk4.TID ^ pk4.SID) < 8) - { - uint testPID = pid1 | pid2 << 16; - - // Call the ARNG to change the PID - testPID = RNG.ARNG.Next(testPID); - - pid1 = testPID & 0xFFFF; - pid2 = testPID >> 16; - } - pk4.PID = pid1 | (pid2 << 16); + while (pk4.IsShiny) // Call the ARNG to change the PID + pk4.PID = RNG.ARNG.Next(pk4.PID); } if (!IsManaphyEgg) seed = Util.Rand32(); // reseed, do not have method 1 correlation diff --git a/PKHeX.Core/MysteryGifts/WC3.cs b/PKHeX.Core/MysteryGifts/WC3.cs index de13d334c..4b6934104 100644 --- a/PKHeX.Core/MysteryGifts/WC3.cs +++ b/PKHeX.Core/MysteryGifts/WC3.cs @@ -103,7 +103,9 @@ public override PKM ConvertToPKM(ITrainerInfo SAV) pk.TID = SAV.TID; pk.SID = SAV.SID; pk.OT_Friendship = pi.BaseFriendship; - pk.Met_Location = 32; + pk.Met_Location = pk.FRLG ? 146 /* Four Island */ : 32; // Route 117 + pk.FatefulEncounter &= pk.FRLG; // clear flag for RSE + pk.Met_Level = 0; // hatched } else {