Fix item transferral

Instead of just copying the value, get the corresponding transferred
value (and sanity check; the getG4Item returns 0x80 if held item does
not correspond to a sprite).
Closes #665
This commit is contained in:
Kurt 2016-12-23 17:28:39 -08:00
parent a6e84f5aa9
commit 67838e4643
2 changed files with 9 additions and 2 deletions

View file

@ -290,9 +290,12 @@ namespace PKHeX
// Unown Form
pk4.AltForm = AltForm;
int item = HeldItem;
if (HeldItem > 0)
pk4.HeldItem = item;
{
ushort item = PKX.getG4Item((ushort)HeldItem);
if (PKX.isTransferrable34(item))
pk4.HeldItem = item;
}
// Remove HM moves
int[] banned = { 15, 19, 57, 70, 148, 249, 127, 291 };

View file

@ -1949,6 +1949,10 @@ namespace PKHeX
ushort val = g3val > arr.Length ? ushort.MaxValue : arr[g3val];
return val == ushort.MaxValue ? ITEM_UNK : val;
}
public static bool isTransferrable34(ushort item)
{
return item == ITEM_UNK && item > 0;
}
#region Gen 1 Character Tables
private static Dictionary<byte, string> RBY2U_U => new Dictionary<byte, string>{