Fix Transfer Ability 4->6

Clear Shiny Leaves/Crown, and fix ability detection
This commit is contained in:
Kaphotics
2016-02-13 19:40:51 -08:00
parent eae4b2ad5c
commit 54e5b2b30c
2 changed files with 2 additions and 4 deletions

View File

@@ -156,9 +156,6 @@ public PK4(byte[] decryptedData = null, string ident = null)
public bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } }
public int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } }
public int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } }
public int Nature { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } }
public bool HiddenAbility { get { return (Data[0x41] & 1) == 1; } set { Data[0x41] = (byte)(Data[0x41] & ~0x01 | (value ? 1 : 0)); } }
public bool NPokémon { get { return (Data[0x41] & 2) == 2; } set { Data[0x41] = (byte)(Data[0x41] & ~0x02 | (value ? 2 : 0)); } }
// 0x43-0x47 Unused
#endregion
@@ -425,6 +422,7 @@ public PK5 convertToPK5()
: 30001; // Pokétransfer (not Crown)
// Delete HGSS Data
pk5.Data[0x41] = 0; // Shiny Leaves/Crown
BitConverter.GetBytes((ushort)0).CopyTo(pk5.Data, 0x86);
if (HGSSBall > 0 && HGSSBall != 4)
pk5.Ball = HGSSBall;

View File

@@ -262,7 +262,7 @@ internal static byte[] getAbilities(int species, int formnum)
internal static int getAbilityNumber(int species, int ability, int formnum)
{
byte[] spec_abilities = Personal[Personal[species].FormeIndex(species, formnum)].Abilities;
int abilval = Array.IndexOf(spec_abilities, ability);
int abilval = Array.IndexOf(spec_abilities, (byte)ability);
if (abilval >= 0)
return 1 << abilval;
return -1;