mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-28 03:06:24 -05:00
Decouple personal tables, use pinfo
This commit is contained in:
@@ -128,12 +128,14 @@ public override int Species
|
||||
get { return PKX.getG1Species(Data[0]); }
|
||||
set
|
||||
{
|
||||
// Before updating catch rate, check if non-standard
|
||||
if (Catch_Rate == PersonalTable.RBY[Species].CatchRate)
|
||||
Catch_Rate = PersonalTable.RBY[value].CatchRate;
|
||||
int currentRate = PersonalInfo.CatchRate;
|
||||
Data[0] = (byte)PKX.setG1Species(value);
|
||||
Type_A = PersonalTable.RBY[value].Types[0];
|
||||
Type_B = PersonalTable.RBY[value].Types[1];
|
||||
|
||||
// Before updating catch rate, check if non-standard
|
||||
if (Catch_Rate == currentRate)
|
||||
Catch_Rate = PersonalInfo.CatchRate;
|
||||
Type_A = PersonalInfo.Types[0];
|
||||
Type_B = PersonalInfo.Types[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +290,7 @@ public PK2 convertToPK2()
|
||||
pk2.HeldItem = 0xAD; // Berry
|
||||
break;
|
||||
}
|
||||
pk2.CurrentFriendship = PersonalTable.C[Species].BaseFriendship;
|
||||
pk2.CurrentFriendship = pk2.PersonalInfo.BaseFriendship;
|
||||
// Pokerus = 0
|
||||
// Caught Data = 0
|
||||
pk2.Stat_Level = PKX.getLevel(Species, EXP);
|
||||
|
||||
@@ -219,7 +219,7 @@ public override ushort[] getStats(PersonalInfo p)
|
||||
|
||||
public override bool getGenderIsValid()
|
||||
{
|
||||
int gv = PersonalTable.C[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
|
||||
if (gv == 255)
|
||||
return Gender == 2;
|
||||
@@ -247,7 +247,7 @@ public override int Gender
|
||||
{
|
||||
get
|
||||
{
|
||||
int gv = PersonalTable.C[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
if (gv == 255)
|
||||
return 2;
|
||||
if (gv == 254)
|
||||
|
||||
@@ -33,7 +33,7 @@ public PK3(byte[] decryptedData = null, string ident = null)
|
||||
public override int Gender { get { return PKX.getGender(Species, PID); } set { } }
|
||||
public override int Characteristic => -1;
|
||||
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
|
||||
public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber]; } set { } }
|
||||
public override int Ability { get { int[] abils = PersonalInfo.Abilities; return abils[abils[1] == 0 ? 0 : AbilityNumber]; } set { } }
|
||||
public override int CurrentHandler { get { return 0; } set { } }
|
||||
public override int Egg_Location { get { return 0; } set { } }
|
||||
|
||||
@@ -167,7 +167,7 @@ public override byte[] Encrypt()
|
||||
}
|
||||
public override bool getGenderIsValid()
|
||||
{
|
||||
int gv = PersonalTable.RS[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
|
||||
if (gv == 255)
|
||||
return Gender == 2;
|
||||
|
||||
@@ -386,7 +386,7 @@ public override int Characteristic
|
||||
// Methods
|
||||
public override bool getGenderIsValid()
|
||||
{
|
||||
int gv = PersonalTable.HGSS[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
|
||||
if (gv == 255)
|
||||
return Gender == 2;
|
||||
|
||||
@@ -302,7 +302,7 @@ public override int Characteristic
|
||||
// Methods
|
||||
public override bool getGenderIsValid()
|
||||
{
|
||||
int gv = PersonalTable.B2W2[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
|
||||
if (gv == 255)
|
||||
return Gender == 2;
|
||||
@@ -336,7 +336,7 @@ public PK6 convertToPK6()
|
||||
Ability = Ability
|
||||
};
|
||||
|
||||
int[] abilities = PersonalTable.AO.getAbilities(Species, AltForm);
|
||||
int[] abilities = PersonalInfo.Abilities;
|
||||
int abilval = Array.IndexOf(abilities, Ability);
|
||||
if (abilval >= 0)
|
||||
pk6.AbilityNumber = 1 << abilval;
|
||||
@@ -520,7 +520,7 @@ public PK6 convertToPK6()
|
||||
pk6.HT_Memory = 4;
|
||||
pk6.HT_Feeling = (int)(Util.rnd32() % 10);
|
||||
// When transferred, friendship gets reset.
|
||||
pk6.OT_Friendship = pk6.HT_Friendship = PersonalTable.B2W2[Species].BaseFriendship;
|
||||
pk6.OT_Friendship = pk6.HT_Friendship = PersonalInfo.BaseFriendship;
|
||||
|
||||
// Antishiny Mechanism
|
||||
ushort LID = (ushort)(PID & 0xFFFF);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class PK6 : PKM
|
||||
public sealed override int SIZE_PARTY => PKX.SIZE_6PARTY;
|
||||
public override int SIZE_STORED => PKX.SIZE_6STORED;
|
||||
public override int Format => 6;
|
||||
public override PersonalInfo PersonalInfo => (AO ? PersonalTable.AO : PersonalTable.XY).getFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.AO.getFormeEntry(Species, AltForm);
|
||||
|
||||
public PK6(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
@@ -440,14 +440,14 @@ public override byte[] Encrypt()
|
||||
}
|
||||
public override bool getGenderIsValid()
|
||||
{
|
||||
int gv = PersonalTable.AO[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
|
||||
if (gv == 255)
|
||||
return Gender == 2;
|
||||
if (gv == 254)
|
||||
return Gender == 0;
|
||||
if (gv == 0)
|
||||
return Gender == 1;
|
||||
if (gv == 0)
|
||||
return Gender == 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ public void TradeFriendshipAffection(string SAV_TRAINER)
|
||||
return;
|
||||
|
||||
// Reset
|
||||
HT_Friendship = PersonalTable.AO[Species].BaseFriendship;
|
||||
HT_Friendship = PersonalInfo.BaseFriendship;
|
||||
HT_Affection = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -448,14 +448,14 @@ public override byte[] Encrypt()
|
||||
}
|
||||
public override bool getGenderIsValid()
|
||||
{
|
||||
int gv = PersonalTable.AO[Species].Gender;
|
||||
int gv = PersonalInfo.Gender;
|
||||
|
||||
if (gv == 255)
|
||||
return Gender == 2;
|
||||
if (gv == 254)
|
||||
return Gender == 0;
|
||||
if (gv == 0)
|
||||
return Gender == 1;
|
||||
if (gv == 0)
|
||||
return Gender == 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ public void TradeFriendshipAffection(string SAV_TRAINER)
|
||||
return;
|
||||
|
||||
// Reset
|
||||
HT_Friendship = PersonalTable.AO[Species].BaseFriendship;
|
||||
HT_Friendship = PersonalInfo.BaseFriendship;
|
||||
HT_Affection = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user