mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Fix pt/hgss egg location handling 4->5
Closes #1766
pt/hgss egg location data is lost on transfer, retaining faraway place
only.
2c8e2176e9
fix was incorrect
This commit is contained in:
parent
e616b56bfa
commit
b229a947f2
3 changed files with 29 additions and 10 deletions
|
@ -475,17 +475,34 @@ namespace PKHeX.Core
|
|||
if (pkm.Egg_Location != 0)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
switch (pkm.GenNumber)
|
||||
else if (pkm.Gen4)
|
||||
{
|
||||
case 4:
|
||||
if (pkm.Egg_Location != 2002) // Link Trade
|
||||
if (pkm.Egg_Location != 2002) // Link Trade
|
||||
{
|
||||
// check Pt/HGSS data
|
||||
if (pkm.Format <= 4)
|
||||
return false; // must match
|
||||
if (e.EggLocation >= 3000 || e.EggLocation <= 2010) // non-Pt/HGSS egg gift
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
if (pkm.Egg_Location != 30002) // Link Trade
|
||||
|
||||
// transferring 4->5 clears pt/hgss location value and keeps Faraway Place
|
||||
if (pkm.Egg_Location != 3002) // Faraway Place
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pkm.Egg_Location != 30002) // Link Trade
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (e.EggLocation != 0 && pkm.Gen4)
|
||||
{
|
||||
// Check the inverse scenario for 4->5 eggs
|
||||
if (e.EggLocation < 3000 && e.EggLocation > 2010) // Pt/HGSS egg gift
|
||||
{
|
||||
if (pkm.Format > 4)
|
||||
return false; // locations match when it shouldn't
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -438,7 +438,9 @@ namespace PKHeX.Core
|
|||
pk5.Met_Location = pk5.Gen4 && pk5.FatefulEncounter && Legal.CrownBeasts.Contains(pk5.Species)
|
||||
? (pk5.Species == 251 ? Legal.Transfer4_CelebiUnused : Legal.Transfer4_CrownUnused) // Celebi : Beast
|
||||
: Legal.Transfer4; // Pokétransfer (not Crown)
|
||||
pk5.Egg_Location = Egg_Location;
|
||||
|
||||
// Egg Location is not modified; when clearing Pt/HGSS egg data, the location will revert to Faraway Place
|
||||
// pk5.Egg_Location = Egg_Location;
|
||||
|
||||
// Delete HGSS Data
|
||||
BitConverter.GetBytes((ushort)0).CopyTo(pk5.Data, 0x86);
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
public static readonly byte[] ExtraBytes =
|
||||
{
|
||||
0x42, 0x43, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87
|
||||
0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87
|
||||
};
|
||||
public override int SIZE_PARTY => PKX.SIZE_5PARTY;
|
||||
public override int SIZE_STORED => PKX.SIZE_5STORED;
|
||||
|
|
Loading…
Reference in a new issue