Use byte for pp value storage

more appropriate storage; for 3887 indexes -> saves 11.3KB
This commit is contained in:
Kurt 2019-04-10 22:05:57 -07:00
parent 27dfffd5b2
commit ba2b9ace8d
9 changed files with 14 additions and 22 deletions

View file

@ -319,22 +319,14 @@ namespace PKHeX.Core
return IsEvolutionValid(pkm);
}
public static IReadOnlyList<int> GetPPTable(PKM pkm, int format)
public static IReadOnlyList<byte> GetPPTable(PKM pkm, int format)
{
switch (format)
{
case 1: return MovePP_RBY;
case 2: return MovePP_GSC;
case 3: return MovePP_RS;
case 4: return MovePP_DP;
case 5: return MovePP_BW;
case 6: return MovePP_XY;
case 7: return pkm.GG ? MovePP_GG : MovePP_SM;
default: return Array.Empty<int>();
}
if (format != 7)
return GetPPTable(format);
return pkm.GG ? MovePP_GG : MovePP_SM;
}
public static IReadOnlyList<int> GetPPTable(int format)
public static IReadOnlyList<byte> GetPPTable(int format)
{
switch (format)
{
@ -345,7 +337,7 @@ namespace PKHeX.Core
case 5: return MovePP_BW;
case 6: return MovePP_XY;
case 7: return MovePP_SM;
default: return Array.Empty<int>();
default: return Array.Empty<byte>();
}
}

View file

@ -31,7 +31,7 @@ namespace PKHeX.Core
240,241,242,243,244,245,246,247,248,249,250,
};
internal static readonly int[] MovePP_RBY =
internal static readonly byte[] MovePP_RBY =
{
0,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 10, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -35,7 +35,7 @@ namespace PKHeX.Core
internal static readonly ushort[] HeldItems_GSC = new ushort[1].Concat(Pouch_Items_GSC).Concat(Pouch_Ball_GSC).Concat(Pouch_TMHM_GSC).ToArray();
internal static readonly int[] MovePP_GSC =
internal static readonly byte[] MovePP_GSC =
{
00,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 10, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -59,7 +59,7 @@ namespace PKHeX.Core
internal static readonly ushort[] HeldItems_RS = new ushort[1].Concat(Pouch_Items_RS).Concat(Pouch_Ball_RS).Concat(Pouch_Berries_RS).Concat(Pouch_TM_RS).ToArray();
#endregion
internal static readonly int[] MovePP_RS =
internal static readonly byte[] MovePP_RS =
{
00,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 10, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -166,7 +166,7 @@ namespace PKHeX.Core
015, 019, 057, 070, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS) excluded
};
internal static readonly int[] MovePP_DP =
internal static readonly byte[] MovePP_DP =
{
00,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 15, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 20, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -90,7 +90,7 @@ namespace PKHeX.Core
015, 019, 057, 070, 127, 291
};
internal static readonly int[] MovePP_BW =
internal static readonly byte[] MovePP_BW =
{
00,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 30, 30, 35, 35, 20, 15, 20, 20, 15, 20, 30, 05, 25, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -421,7 +421,7 @@ namespace PKHeX.Core
};
#endregion
internal static readonly int[] MovePP_XY =
internal static readonly byte[] MovePP_XY =
{
00,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -535,7 +535,7 @@ namespace PKHeX.Core
// No HMs
};
internal static readonly int[] MovePP_SM =
internal static readonly byte[] MovePP_SM =
{
00,
35, 25, 10, 15, 20, 20, 15, 15, 15, 35, 30, 05, 10, 20, 30, 35, 35, 20, 15, 20, 20, 25, 20, 30, 05, 10, 15, 15, 15, 25, 20, 05, 35, 15, 20, 20, 10, 15, 30, 35, 20, 20, 30, 25, 40, 20, 15, 20, 20, 20,

View file

@ -190,7 +190,7 @@ namespace PKHeX.Core
#region Moves
internal static readonly int[] MovePP_GG =
internal static readonly byte[] MovePP_GG =
{
// Absorb: 25 -> 15 (damage buffed from 20->40)
// Mega Drain: 15 -> 10 (damage buffed from 40->75)