Misc mg gen fixes

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 - がくえんさい×ポケモンプレゼント
This commit is contained in:
Kurt 2018-06-15 22:00:51 -07:00
parent b0b2fb5d4b
commit 88b5277062
2 changed files with 11 additions and 14 deletions

View file

@ -271,20 +271,15 @@ namespace PKHeX.Core
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

View file

@ -103,7 +103,9 @@ namespace PKHeX.Core
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
{