From 54e5b2b30c10ee5a760496bbbf879888f533c2ab Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 13 Feb 2016 19:40:51 -0800 Subject: [PATCH] Fix Transfer Ability 4->6 Clear Shiny Leaves/Crown, and fix ability detection --- Misc/PK4.cs | 4 +--- Misc/PKX.cs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Misc/PK4.cs b/Misc/PK4.cs index bde0c6239..060da9ec9 100644 --- a/Misc/PK4.cs +++ b/Misc/PK4.cs @@ -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; diff --git a/Misc/PKX.cs b/Misc/PKX.cs index f312c0d03..95cf5bde4 100644 --- a/Misc/PKX.cs +++ b/Misc/PKX.cs @@ -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;