mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Skip initial cctor alloc on non-byte primitives (#3850)
Runtime/jit repoints these to the dll rather than heap if we're Little Endian (always, otherwise will allocate like before). Eliminates quite a few static constructors, so even faster startup. Items later.
This commit is contained in:
parent
34c1473966
commit
5ce3e734b8
126 changed files with 482 additions and 509 deletions
|
@ -38,7 +38,7 @@ public sealed class StringInstruction
|
|||
PropertyValue = index.ToString();
|
||||
}
|
||||
|
||||
public static readonly IReadOnlyList<char> Prefixes = new[] { Apply, FilterEqual, FilterNotEqual, FilterGreaterThan, FilterGreaterThanOrEqual, FilterLessThan, FilterLessThanOrEqual };
|
||||
public static ReadOnlySpan<char> Prefixes => new[] { Apply, FilterEqual, FilterNotEqual, FilterGreaterThan, FilterGreaterThanOrEqual, FilterLessThan, FilterLessThanOrEqual };
|
||||
private const char Apply = '.';
|
||||
private const char SplitRange = ',';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public sealed class FakeSaveFile : SaveFile
|
|||
public override int SetString(Span<byte> destBuffer, ReadOnlySpan<char> value, int maxLength, StringConverterOption option) => 0;
|
||||
public override PersonalTable3 Personal => PersonalTable.RS;
|
||||
public override int MaxEV => 0;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
public override int GetBoxOffset(int box) => -1;
|
||||
public override string GetBoxName(int box) => $"Box {box:00}";
|
||||
public override void SetBoxName(int box, ReadOnlySpan<char> value) { }
|
||||
|
|
|
@ -17,7 +17,7 @@ public sealed class ShowdownSet : IBattleTemplate
|
|||
internal const string DefaultLanguage = GameLanguage.DefaultLanguage;
|
||||
private static readonly GameStrings DefaultStrings = GameInfo.GetStrings(DefaultLanguage);
|
||||
|
||||
private static readonly ushort[] DashedSpecies =
|
||||
private static ReadOnlySpan<ushort> DashedSpecies => new ushort[]
|
||||
{
|
||||
(int)NidoranF, (int)NidoranM,
|
||||
(int)HoOh,
|
||||
|
|
|
@ -117,7 +117,7 @@ public sealed class GameDataSource
|
|||
return Util.GetUnsortedCBList(list, OrderedVersionArray);
|
||||
}
|
||||
|
||||
public List<ComboItem> GetItemDataSource(GameVersion game, EntityContext context, IReadOnlyList<ushort> allowed, bool HaX = false)
|
||||
public List<ComboItem> GetItemDataSource(GameVersion game, EntityContext context, ReadOnlySpan<ushort> allowed, bool HaX = false)
|
||||
{
|
||||
var items = Strings.GetItemStrings(context, game);
|
||||
return HaX ? Util.GetCBList(items) : Util.GetCBList(items, allowed);
|
||||
|
|
|
@ -42,7 +42,7 @@ public sealed class GameStrings : IBasicStrings
|
|||
/// <summary>
|
||||
/// Item IDs that correspond to the <see cref="Ball"/> value.
|
||||
/// </summary>
|
||||
private static readonly ushort[] Items_Ball =
|
||||
private static ReadOnlySpan<ushort> Items_Ball => new ushort[]
|
||||
{
|
||||
0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0008, 0009,
|
||||
0010, 0011, 0012, 0013, 0014, 0015, 0016, 0492, 0493, 0494,
|
||||
|
@ -91,9 +91,10 @@ public sealed class GameStrings : IBasicStrings
|
|||
groundtiletypes = Get("groundtile");
|
||||
gamelist = Get("games");
|
||||
|
||||
balllist = new string[Items_Ball.Length];
|
||||
var balls = Items_Ball;
|
||||
balllist = new string[balls.Length];
|
||||
for (int i = 0; i < balllist.Length; i++)
|
||||
balllist[i] = itemlist[Items_Ball[i]];
|
||||
balllist[i] = itemlist[balls[i]];
|
||||
|
||||
pokeblocks = Get("pokeblock");
|
||||
forms = Get("forms");
|
||||
|
|
|
@ -33,13 +33,13 @@ internal static class Locations4
|
|||
};
|
||||
|
||||
// Ignore the --- met location at index 7.
|
||||
internal static readonly ushort[] Met2 =
|
||||
internal static ReadOnlySpan<ushort> Met2 => new ushort[]
|
||||
{
|
||||
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009,
|
||||
2010, 2011, 2012, 2013, 2014,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009,
|
||||
3010, 3011, 3012, 3013, 3014, 3015, 3016, 3017, 3018, 3019,
|
||||
|
|
|
@ -24,13 +24,13 @@ internal static class Locations5
|
|||
150, 151, 152, 153,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30002, 30004, 30005, 30006, 30007, 30008,
|
||||
30010, 30011, 30012, 30013, 30014, 30015,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019,
|
||||
|
@ -45,5 +45,5 @@ internal static class Locations5
|
|||
40100, 40101, 40102, 40103, 40104, 40105, 40106, 40107, 40108, 40109,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = { 60001, 60003 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] { 60001, 60003 };
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
internal static class Locations6
|
||||
{
|
||||
public static readonly ushort[] Met0 =
|
||||
public static ReadOnlySpan<ushort> Met0 => new ushort[]
|
||||
{
|
||||
/* XY */
|
||||
002, 006, 008,
|
||||
|
@ -45,13 +47,13 @@ internal static class Locations6
|
|||
350, 352, 354,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009,
|
||||
30010, 30011,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019,
|
||||
|
@ -63,5 +65,5 @@ internal static class Locations6
|
|||
40070, 40071, 40072, 40073, 40074, 40075, 40076, 40077, 40078, 40079,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ internal static class Locations7
|
|||
230, 232,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009,
|
||||
30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019,
|
||||
|
@ -51,5 +51,5 @@ internal static class Locations7
|
|||
40080, 40081, 40082, 40083, 40084, 40085, 40086, 40087, 40088,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ internal static class Locations7b
|
|||
050, 051, 052, 053,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009,
|
||||
30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019,
|
||||
|
@ -32,5 +32,5 @@ internal static class Locations7b
|
|||
40070, 40071, 40072, 40073, 40074, 40075, 40076, 40077,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
}
|
||||
|
|
|
@ -33,13 +33,13 @@ internal static class Locations8
|
|||
240, 242, 244, 246,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009,
|
||||
30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40016, 40017, 40018, 40019,
|
||||
|
@ -52,5 +52,5 @@ internal static class Locations8
|
|||
40080, 40081, 40082, 40083, 40084, 40085, 40086,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@ internal static class Locations8a
|
|||
150, 151, 152, 153, 154, 155,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30002, 30003, 30004, 30005, 30006, 30007, 30008, 30009,
|
||||
30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018, 30019,
|
||||
30020, 30021, 30022,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40016, 40017, 40018, 40019,
|
||||
|
@ -44,5 +44,5 @@ internal static class Locations8a
|
|||
40080, 40081, 40082, 40083, 40084, 40085, 40086,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
internal static class Locations8b
|
||||
{
|
||||
internal static readonly ushort[] Met0 =
|
||||
internal static ReadOnlySpan<ushort> Met0 => new ushort[]
|
||||
{
|
||||
000, 001, 002, 003, 004, 005, 006, 007, 008, 009,
|
||||
010, 011, 012, 013, 014, 015, 016, 017, 018, 019,
|
||||
|
@ -74,14 +76,14 @@ internal static class Locations8b
|
|||
648, 649, 650, 651, 652, 653, 654, 655, 656, 657,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30009,
|
||||
30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018, 30019,
|
||||
30020, 30022,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40016, 40017, 40018, 40019,
|
||||
|
@ -93,5 +95,5 @@ internal static class Locations8b
|
|||
40070, 40071, 40072, 40074, 40075, 40076, 40077,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004, /* BDSP */ 60005, 60006, 60007, 60010 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004, /* BDSP */ 60005, 60006, 60007, 60010 };
|
||||
}
|
||||
|
|
|
@ -26,14 +26,14 @@ internal static class Locations9
|
|||
130, 131,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met3 =
|
||||
internal static ReadOnlySpan<ushort> Met3 => new ushort[]
|
||||
{
|
||||
30001, 30003, 30004, 30005, 30006, 30007, 30008, 30009,
|
||||
30010, 30011, 30012, 30013, 30014, 30015, 30016, 30017, 30018, 30019,
|
||||
30020, 30021, 30022, 30023, 30024,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met4 =
|
||||
internal static ReadOnlySpan<ushort> Met4 => new ushort[]
|
||||
{
|
||||
40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009,
|
||||
40010, 40011, 40012, 40013, 40014, 40015, 40016, 40017, 40018, 40019,
|
||||
|
@ -45,5 +45,5 @@ internal static class Locations9
|
|||
40070, 40071, 40072, 40073, 40074, 40075, 40076, 40077, 40078,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Met6 = {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
internal static ReadOnlySpan<ushort> Met6 => new ushort[] {/* XY */ 60001, 60003, /* ORAS */ 60004 };
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public sealed record EncounterArea8b : EncounterArea
|
|||
&& LocationID_HoneyTree[trees.Tree4] != location;
|
||||
}
|
||||
|
||||
private static readonly ushort[] LocationID_HoneyTree =
|
||||
private static ReadOnlySpan<ushort> LocationID_HoneyTree => new ushort[]
|
||||
{
|
||||
359, // 00 Route 205 Floaroma
|
||||
361, // 01 Route 205 Eterna
|
||||
|
|
|
@ -105,7 +105,7 @@ public sealed record EncounterStatic8b : EncounterStatic, IStaticCorrelation8b
|
|||
}
|
||||
|
||||
// defined by mvpoke in encounter data
|
||||
private static readonly ushort[] Roaming_MetLocation_BDSP =
|
||||
private static ReadOnlySpan<ushort> Roaming_MetLocation_BDSP => new ushort[]
|
||||
{
|
||||
197, 201, 354, 355, 356, 357, 358, 359, 361, 362, 364, 365, 367, 373, 375, 377,
|
||||
378, 379, 383, 385, 392, 394, 395, 397, 400, 403, 404, 407,
|
||||
|
|
|
@ -74,7 +74,7 @@ public sealed class LearnSource3E : ILearnSource<PersonalInfo3>, IEggSource
|
|||
private static bool GetIsSpecialTutor(ushort species, ushort move)
|
||||
{
|
||||
var info = Personal[species];
|
||||
var index = Array.IndexOf(Tutor_E, move);
|
||||
var index = Tutor_E.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TypeTutors[index];
|
||||
|
@ -82,7 +82,7 @@ public sealed class LearnSource3E : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_3, move);
|
||||
var index = TM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[index];
|
||||
|
@ -90,7 +90,7 @@ public sealed class LearnSource3E : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsHM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_3, move);
|
||||
var index = HM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[CountTM + index];
|
||||
|
@ -146,7 +146,7 @@ public sealed class LearnSource3E : ILearnSource<PersonalInfo3>, IEggSource
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] Tutor_E =
|
||||
private static ReadOnlySpan<ushort> Tutor_E => new ushort[]
|
||||
{
|
||||
005, 014, 025, 034, 038, 068, 069, 102, 118, 135,
|
||||
138, 086, 153, 157, 164, 223, 205, 244, 173, 196,
|
||||
|
|
|
@ -81,7 +81,7 @@ public sealed class LearnSource3FR : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_3, move);
|
||||
var index = TM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[index];
|
||||
|
@ -89,7 +89,7 @@ public sealed class LearnSource3FR : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsHM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_3, move);
|
||||
var index = HM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[CountTM + index];
|
||||
|
|
|
@ -81,7 +81,7 @@ public sealed class LearnSource3LG : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_3, move);
|
||||
var index = TM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[index];
|
||||
|
@ -89,7 +89,7 @@ public sealed class LearnSource3LG : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsHM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_3, move);
|
||||
var index = HM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[CountTM + index];
|
||||
|
|
|
@ -73,21 +73,21 @@ public sealed class LearnSource3RS : ILearnSource<PersonalInfo3>, IEggSource
|
|||
private static bool GetIsTutor(ushort species, ushort move)
|
||||
{
|
||||
// XD (Mew)
|
||||
if (species == (int)Species.Mew && Tutor_3Mew.AsSpan().IndexOf(move) != -1)
|
||||
if (species == (int)Species.Mew && Tutor_3Mew.Contains(move))
|
||||
return true;
|
||||
|
||||
return move switch
|
||||
{
|
||||
(int)Move.SelfDestruct => Array.BinarySearch(SpecialTutors_XD_SelfDestruct, species) >= 0,
|
||||
(int)Move.SkyAttack => Array.BinarySearch(SpecialTutors_XD_SkyAttack, species) >= 0,
|
||||
(int)Move.Nightmare => Array.BinarySearch(SpecialTutors_XD_Nightmare, species) >= 0,
|
||||
(int)Move.SelfDestruct => SpecialTutors_XD_SelfDestruct.BinarySearch(species) >= 0,
|
||||
(int)Move.SkyAttack => SpecialTutors_XD_SkyAttack.BinarySearch(species) >= 0,
|
||||
(int)Move.Nightmare => SpecialTutors_XD_Nightmare.BinarySearch(species) >= 0,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
private static bool GetIsTM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_3, move);
|
||||
var index = TM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[index];
|
||||
|
@ -95,7 +95,7 @@ public sealed class LearnSource3RS : ILearnSource<PersonalInfo3>, IEggSource
|
|||
|
||||
private static bool GetIsHM(PersonalInfo3 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_3, move);
|
||||
var index = HM_3.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.TMHM[CountTM + index];
|
||||
|
@ -147,16 +147,16 @@ public sealed class LearnSource3RS : ILearnSource<PersonalInfo3>, IEggSource
|
|||
result[move] = true;
|
||||
}
|
||||
|
||||
if (Array.BinarySearch(SpecialTutors_XD_SelfDestruct, evo.Species) >= 0)
|
||||
if (SpecialTutors_XD_SelfDestruct.BinarySearch(evo.Species) >= 0)
|
||||
result[(int)Move.SelfDestruct] = true;
|
||||
if (Array.BinarySearch(SpecialTutors_XD_SkyAttack, evo.Species) >= 0)
|
||||
if (SpecialTutors_XD_SkyAttack.BinarySearch(evo.Species) >= 0)
|
||||
result[(int)Move.SkyAttack] = true;
|
||||
if (Array.BinarySearch(SpecialTutors_XD_Nightmare, evo.Species) >= 0)
|
||||
if (SpecialTutors_XD_Nightmare.BinarySearch(evo.Species) >= 0)
|
||||
result[(int)Move.Nightmare] = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] Tutor_3Mew =
|
||||
private static ReadOnlySpan<ushort> Tutor_3Mew => new ushort[]
|
||||
{
|
||||
(int)Move.FeintAttack,
|
||||
(int)Move.FakeOut,
|
||||
|
@ -166,7 +166,7 @@ public sealed class LearnSource3RS : ILearnSource<PersonalInfo3>, IEggSource
|
|||
(int)Move.ZapCannon,
|
||||
};
|
||||
|
||||
private static readonly ushort[] SpecialTutors_XD_SelfDestruct =
|
||||
private static ReadOnlySpan<ushort> SpecialTutors_XD_SelfDestruct => new ushort[]
|
||||
{
|
||||
074, 075, 076, 088, 089, 090, 091, 092, 093, 094, 095,
|
||||
100, 101, 102, 103, 109, 110, 143, 150, 151, 185, 204,
|
||||
|
@ -175,14 +175,14 @@ public sealed class LearnSource3RS : ILearnSource<PersonalInfo3>, IEggSource
|
|||
376, 377, 378, 379,
|
||||
};
|
||||
|
||||
private static readonly ushort[] SpecialTutors_XD_SkyAttack =
|
||||
private static ReadOnlySpan<ushort> SpecialTutors_XD_SkyAttack => new ushort[]
|
||||
{
|
||||
016, 017, 018, 021, 022, 084, 085, 142, 144, 145, 146,
|
||||
151, 163, 164, 176, 177, 178, 198, 225, 227, 250, 276,
|
||||
277, 278, 279, 333, 334,
|
||||
};
|
||||
|
||||
private static readonly ushort[] SpecialTutors_XD_Nightmare =
|
||||
private static ReadOnlySpan<ushort> SpecialTutors_XD_Nightmare => new ushort[]
|
||||
{
|
||||
012, 035, 036, 039, 040, 052, 053, 063, 064, 065, 079,
|
||||
080, 092, 093, 094, 096, 097, 102, 103, 108, 121, 122,
|
||||
|
|
|
@ -73,18 +73,18 @@ public sealed class LearnSource4DP : ILearnSource<PersonalInfo4>, IEggSource
|
|||
return default;
|
||||
}
|
||||
|
||||
private static bool GetIsTypeTutor(ushort species, ushort move)
|
||||
private static bool GetIsTypeTutor(ushort species, ushort move) => move switch
|
||||
{
|
||||
var index = Array.IndexOf(SpecialTutors_4, move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
var list = SpecialTutors_Compatibility_4[index].AsSpan();
|
||||
return list.IndexOf(species) != -1;
|
||||
}
|
||||
(ushort)Move.BlastBurn => SpecialTutors_Compatibility_4_BlastBurn.Contains(species),
|
||||
(ushort)Move.HydroCannon => SpecialTutors_Compatibility_4_HydroCannon.Contains(species),
|
||||
(ushort)Move.FrenzyPlant => SpecialTutors_Compatibility_4_FrenzyPlant.Contains(species),
|
||||
(ushort)Move.DracoMeteor => SpecialTutors_Compatibility_4_DracoMeteor.Contains(species),
|
||||
_ => false,
|
||||
};
|
||||
|
||||
private static bool GetIsSpecialTutor(PersonalInfo4 pi, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(Tutors_4, move);
|
||||
var index = Tutors_4.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return pi.TypeTutors[index];
|
||||
|
@ -92,13 +92,13 @@ public sealed class LearnSource4DP : ILearnSource<PersonalInfo4>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo4 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_4, move);
|
||||
var index = TM_4.IndexOf(move);
|
||||
return info.GetIsLearnTM(index);
|
||||
}
|
||||
|
||||
private static bool GetIsHM(PersonalInfo4 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_DPPt, move);
|
||||
var index = HM_DPPt.IndexOf(move);
|
||||
return info.GetIsLearnTM(CountTM + index);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ public sealed class LearnSource4HGSS : ILearnSource<PersonalInfo4>, IEggSource
|
|||
private const int MaxSpecies = Legal.MaxSpeciesID_4;
|
||||
private const LearnEnvironment Game = HGSS;
|
||||
private const int Generation = 4;
|
||||
private const int CountTM = 92;
|
||||
|
||||
public Learnset GetLearnset(ushort species, byte form) => Learnsets[Personal.GetFormIndex(species, form)];
|
||||
|
||||
|
@ -86,18 +85,18 @@ public sealed class LearnSource4HGSS : ILearnSource<PersonalInfo4>, IEggSource
|
|||
_ => false,
|
||||
};
|
||||
|
||||
private static bool GetIsTypeTutor(ushort species, ushort move)
|
||||
private static bool GetIsTypeTutor(ushort species, ushort move) => move switch
|
||||
{
|
||||
var index = Array.IndexOf(SpecialTutors_4, move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
var list = SpecialTutors_Compatibility_4[index];
|
||||
return Array.IndexOf(list, species) != -1;
|
||||
}
|
||||
(ushort)Move.BlastBurn => SpecialTutors_Compatibility_4_BlastBurn.Contains(species),
|
||||
(ushort)Move.HydroCannon => SpecialTutors_Compatibility_4_HydroCannon.Contains(species),
|
||||
(ushort)Move.FrenzyPlant => SpecialTutors_Compatibility_4_FrenzyPlant.Contains(species),
|
||||
(ushort)Move.DracoMeteor => SpecialTutors_Compatibility_4_DracoMeteor.Contains(species),
|
||||
_ => false,
|
||||
};
|
||||
|
||||
private static bool GetIsSpecialTutor(PersonalInfo4 pi, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(Tutors_4, move);
|
||||
var index = Tutors_4.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return pi.TypeTutors[index];
|
||||
|
@ -105,13 +104,13 @@ public sealed class LearnSource4HGSS : ILearnSource<PersonalInfo4>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo4 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_4, move);
|
||||
var index = TM_4.IndexOf(move);
|
||||
return info.GetIsLearnTM(index);
|
||||
}
|
||||
|
||||
private static bool GetIsHM(PersonalInfo4 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_HGSS, move);
|
||||
var index = HM_HGSS.IndexOf(move);
|
||||
return info.GetIsLearnHM(index);
|
||||
}
|
||||
|
||||
|
@ -145,14 +144,14 @@ public sealed class LearnSource4HGSS : ILearnSource<PersonalInfo4>, IEggSource
|
|||
if (types.HasFlag(MoveSourceType.TypeTutor))
|
||||
{
|
||||
// Elemental Beams
|
||||
var species = SpecialTutors_Compatibility_4;
|
||||
var moves = SpecialTutors_4;
|
||||
for (int i = 0; i < species.Length; i++)
|
||||
{
|
||||
var index = Array.IndexOf(species[i], evo.Species);
|
||||
if (index != -1)
|
||||
result[moves[i]] = true;
|
||||
}
|
||||
if (SpecialTutors_Compatibility_4_BlastBurn.Contains(evo.Species))
|
||||
result[(int)Move.BlastBurn] = true;
|
||||
if (SpecialTutors_Compatibility_4_HydroCannon.Contains(evo.Species))
|
||||
result[(int)Move.HydroCannon] = true;
|
||||
if (SpecialTutors_Compatibility_4_FrenzyPlant.Contains(evo.Species))
|
||||
result[(int)Move.FrenzyPlant] = true;
|
||||
if (SpecialTutors_Compatibility_4_DracoMeteor.Contains(evo.Species))
|
||||
result[(int)Move.DracoMeteor] = true;
|
||||
}
|
||||
|
||||
if (types.HasFlag(MoveSourceType.SpecialTutor))
|
||||
|
|
|
@ -18,7 +18,6 @@ public sealed class LearnSource4Pt : ILearnSource<PersonalInfo4>, IEggSource
|
|||
private const int MaxSpecies = Legal.MaxSpeciesID_4;
|
||||
private const LearnEnvironment Game = Pt;
|
||||
private const int Generation = 4;
|
||||
private const int CountTM = 92;
|
||||
|
||||
public Learnset GetLearnset(ushort species, byte form) => Learnsets[Personal.GetFormIndex(species, form)];
|
||||
|
||||
|
@ -86,18 +85,18 @@ public sealed class LearnSource4Pt : ILearnSource<PersonalInfo4>, IEggSource
|
|||
_ => false,
|
||||
};
|
||||
|
||||
private static bool GetIsTypeTutor(ushort species, ushort move)
|
||||
private static bool GetIsTypeTutor(ushort species, ushort move) => move switch
|
||||
{
|
||||
var index = Array.IndexOf(SpecialTutors_4, move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
var list = SpecialTutors_Compatibility_4[index];
|
||||
return Array.IndexOf(list, species) != -1;
|
||||
}
|
||||
(ushort)Move.BlastBurn => SpecialTutors_Compatibility_4_BlastBurn.Contains(species),
|
||||
(ushort)Move.HydroCannon => SpecialTutors_Compatibility_4_HydroCannon.Contains(species),
|
||||
(ushort)Move.FrenzyPlant => SpecialTutors_Compatibility_4_FrenzyPlant.Contains(species),
|
||||
(ushort)Move.DracoMeteor => SpecialTutors_Compatibility_4_DracoMeteor.Contains(species),
|
||||
_ => false,
|
||||
};
|
||||
|
||||
private static bool GetIsSpecialTutor(PersonalInfo4 pi, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(Tutors_4, move);
|
||||
var index = Tutors_4.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return pi.TypeTutors[index];
|
||||
|
@ -105,13 +104,13 @@ public sealed class LearnSource4Pt : ILearnSource<PersonalInfo4>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo4 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TM_4, move);
|
||||
var index = TM_4.IndexOf(move);
|
||||
return info.GetIsLearnTM(index);
|
||||
}
|
||||
|
||||
private static bool GetIsHM(PersonalInfo4 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(HM_DPPt, move);
|
||||
var index = HM_DPPt.IndexOf(move);
|
||||
return info.GetIsLearnHM(index);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public sealed class LearnSource5B2W2 : ILearnSource<PersonalInfo5B2W2>, IEggSour
|
|||
|
||||
private static bool GetIsTypeTutor(PersonalInfo5B2W2 pi, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TypeTutor567, move);
|
||||
var index = TypeTutor567.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return pi.GetIsLearnTutorType(index);
|
||||
|
@ -95,7 +95,7 @@ public sealed class LearnSource5B2W2 : ILearnSource<PersonalInfo5B2W2>, IEggSour
|
|||
|
||||
private static bool GetIsTM(PersonalInfo5B2W2 info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TMHM_BW, move);
|
||||
var index = TMHM_BW.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.GetIsLearnTM(index);
|
||||
|
|
|
@ -84,7 +84,7 @@ public sealed class LearnSource5BW : ILearnSource<PersonalInfo5BW>, IEggSource
|
|||
|
||||
private static bool GetIsTypeTutor(PersonalInfo5BW pi, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TypeTutor567, move);
|
||||
var index = TypeTutor567.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return pi.GetIsLearnTutorType(index);
|
||||
|
@ -92,7 +92,7 @@ public sealed class LearnSource5BW : ILearnSource<PersonalInfo5BW>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo5BW info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TMHM_BW, move);
|
||||
var index = TMHM_BW.IndexOf(move);
|
||||
if (index == -1)
|
||||
return false;
|
||||
return info.GetIsLearnTM(index) && index != 94; // TM95 not available in this game
|
||||
|
|
|
@ -56,7 +56,7 @@ public sealed class LearnSource6AO : ILearnSource<PersonalInfo6AO>, IEggSource
|
|||
if (types.HasFlag(MoveSourceType.Machine) && GetIsTM(pi, move))
|
||||
return new(TMHM, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(Array.IndexOf(LearnSource5.TypeTutor567, move)))
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(LearnSource5.TypeTutor567.IndexOf(move)))
|
||||
return new(Tutor, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.SpecialTutor) && pi.GetIsTutorSpecial(move))
|
||||
|
@ -86,7 +86,7 @@ public sealed class LearnSource6AO : ILearnSource<PersonalInfo6AO>, IEggSource
|
|||
|
||||
private static bool GetIsTM(PersonalInfo6AO info, ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TMHM_AO, move);
|
||||
var index = TMHM_AO.IndexOf(move);
|
||||
return info.GetIsLearnTM(index);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public sealed class LearnSource6AO : ILearnSource<PersonalInfo6AO>, IEggSource
|
|||
}
|
||||
}
|
||||
|
||||
internal static readonly ushort[] TMHM_AO =
|
||||
internal static ReadOnlySpan<ushort> TMHM_AO => new ushort[]
|
||||
{
|
||||
468, 337, 473, 347, 046, 092, 258, 339, 474, 237,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 355, 219,
|
||||
|
|
|
@ -53,10 +53,10 @@ public sealed class LearnSource6XY : ILearnSource<PersonalInfo6XY>, IEggSource
|
|||
return new(LevelUp, Game, (byte)level);
|
||||
}
|
||||
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(Array.IndexOf(TMHM_XY, move)))
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(TMHM_XY.IndexOf(move)))
|
||||
return new(TMHM, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(Array.IndexOf(LearnSource5.TypeTutor567, move)))
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(LearnSource5.TypeTutor567.IndexOf(move)))
|
||||
return new(Tutor, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.EnhancedTutor) && GetIsEnhancedTutor(evo, pk, move, option))
|
||||
|
@ -116,7 +116,7 @@ public sealed class LearnSource6XY : ILearnSource<PersonalInfo6XY>, IEggSource
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] TMHM_XY =
|
||||
private static ReadOnlySpan<ushort> TMHM_XY => new ushort[]
|
||||
{
|
||||
468, 337, 473, 347, 046, 092, 258, 339, 474, 237,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 355, 219,
|
||||
|
|
|
@ -38,7 +38,7 @@ public sealed class LearnSource7GG : ILearnSource<PersonalInfo7GG>
|
|||
return new(LevelUp, Game, (byte)level);
|
||||
}
|
||||
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(Array.IndexOf(TMHM_GG, move)))
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(TMHM_GG.IndexOf(move)))
|
||||
return new(TMHM, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.EnhancedTutor) && GetIsEnhancedTutor(evo.Species, evo.Form, move))
|
||||
|
@ -50,9 +50,9 @@ public sealed class LearnSource7GG : ILearnSource<PersonalInfo7GG>
|
|||
private static bool GetIsEnhancedTutor(ushort species, byte form, ushort move)
|
||||
{
|
||||
if (species == (int)Species.Pikachu && form == 8) // Partner
|
||||
return Tutor_StarterPikachu.AsSpan().Contains(move);
|
||||
return Tutor_StarterPikachu.Contains(move);
|
||||
if (species == (int)Species.Eevee && form == 1) // Partner
|
||||
return Tutor_StarterEevee.AsSpan().Contains(move);
|
||||
return Tutor_StarterEevee.Contains(move);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public sealed class LearnSource7GG : ILearnSource<PersonalInfo7GG>
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] TMHM_GG =
|
||||
private static ReadOnlySpan<ushort> TMHM_GG => new ushort[]
|
||||
{
|
||||
029, 269, 270, 100, 156, 113, 182, 164, 115, 091,
|
||||
261, 263, 280, 019, 069, 086, 525, 369, 231, 399,
|
||||
|
@ -104,7 +104,7 @@ public sealed class LearnSource7GG : ILearnSource<PersonalInfo7GG>
|
|||
// No HMs
|
||||
};
|
||||
|
||||
private static readonly ushort[] Tutor_StarterPikachu =
|
||||
private static ReadOnlySpan<ushort> Tutor_StarterPikachu => new ushort[]
|
||||
{
|
||||
(int)Move.ZippyZap,
|
||||
(int)Move.SplishySplash,
|
||||
|
@ -112,7 +112,7 @@ public sealed class LearnSource7GG : ILearnSource<PersonalInfo7GG>
|
|||
//(int)Move.PikaPapow, // Joycon Shake
|
||||
};
|
||||
|
||||
private static readonly ushort[] Tutor_StarterEevee =
|
||||
private static ReadOnlySpan<ushort> Tutor_StarterEevee => new ushort[]
|
||||
{
|
||||
(int)Move.BouncyBubble,
|
||||
(int)Move.BuzzyBuzz,
|
||||
|
|
|
@ -55,10 +55,10 @@ public sealed class LearnSource7SM : ILearnSource<PersonalInfo7>, IEggSource
|
|||
return new(LevelUp, Game, 1);
|
||||
}
|
||||
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(Array.IndexOf(TMHM_SM, move)))
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(TMHM_SM.IndexOf(move)))
|
||||
return new(TMHM, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(Array.IndexOf(LearnSource5.TypeTutor567, move)))
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(LearnSource5.TypeTutor567.IndexOf(move)))
|
||||
return new(Tutor, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.EnhancedTutor) && GetIsEnhancedTutor(evo, pk, move, option))
|
||||
|
|
|
@ -55,10 +55,10 @@ public sealed class LearnSource7USUM : ILearnSource<PersonalInfo7>, IEggSource
|
|||
return new(LevelUp, Game, 1);
|
||||
}
|
||||
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(Array.IndexOf(TMHM_SM, move)))
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(TMHM_SM.IndexOf(move)))
|
||||
return new(TMHM, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(Array.IndexOf(LearnSource5.TypeTutor567, move)))
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(LearnSource5.TypeTutor567.IndexOf(move)))
|
||||
return new(Tutor, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.SpecialTutor) && pi.GetIsLearnTutorSpecial(move))
|
||||
|
|
|
@ -60,10 +60,10 @@ public sealed class LearnSource8BDSP : ILearnSource<PersonalInfo8BDSP>, IEggSour
|
|||
if (types.HasFlag(MoveSourceType.SharedEggMove) && GetIsSharedEggMove(pi, move))
|
||||
return new(Shared, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(Array.IndexOf(TMHM_BDSP, move)))
|
||||
if (types.HasFlag(MoveSourceType.Machine) && pi.GetIsLearnTM(TMHM_BDSP.IndexOf(move)))
|
||||
return new(TMHM, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(Array.IndexOf(TypeTutor8b, move)))
|
||||
if (types.HasFlag(MoveSourceType.TypeTutor) && pi.GetIsLearnTutorType(TypeTutor8b.IndexOf(move)))
|
||||
return new(Tutor, Game);
|
||||
|
||||
if (types.HasFlag(MoveSourceType.EnhancedTutor) && GetIsEnhancedTutor(evo, pk, move, option))
|
||||
|
@ -129,7 +129,7 @@ public sealed class LearnSource8BDSP : ILearnSource<PersonalInfo8BDSP>, IEggSour
|
|||
}
|
||||
}
|
||||
|
||||
public static readonly ushort[] TMHM_BDSP =
|
||||
public static ReadOnlySpan<ushort> TMHM_BDSP => new ushort[]
|
||||
{
|
||||
264, 337, 352, 347, 046, 092, 258, 339, 331, 526,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 202, 219,
|
||||
|
@ -144,7 +144,7 @@ public sealed class LearnSource8BDSP : ILearnSource<PersonalInfo8BDSP>, IEggSour
|
|||
015, 019, 057, 070, 432, 249, 127, 431,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] TypeTutor8b =
|
||||
internal static ReadOnlySpan<ushort> TypeTutor8b => new ushort[]
|
||||
{
|
||||
(int)Move.FrenzyPlant,
|
||||
(int)Move.BlastBurn,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
internal static class LearnSource3
|
||||
{
|
||||
internal static readonly ushort[] TM_3 =
|
||||
internal static ReadOnlySpan<ushort> TM_3 => new ushort[]
|
||||
{
|
||||
264, 337, 352, 347, 046, 092, 258, 339, 331, 237,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 202, 219,
|
||||
|
@ -11,5 +13,5 @@ internal static class LearnSource3
|
|||
259, 263, 290, 156, 213, 168, 211, 285, 289, 315,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] HM_3 = { 15, 19, 57, 70, 148, 249, 127, 291 };
|
||||
internal static ReadOnlySpan<ushort> HM_3 => new ushort[] { 15, 19, 57, 70, 148, 249, 127, 291 };
|
||||
}
|
||||
|
|
|
@ -14,23 +14,12 @@ internal static class LearnSource4
|
|||
/// <param name="hasDefog">True if the current moveset has <see cref="Move.Defog"/>.</param>
|
||||
public static ReadOnlySpan<ushort> GetPreferredTransferHMs(bool hasDefog) => hasDefog ? HM_HGSS : HM_DPPt;
|
||||
|
||||
internal static readonly ushort[] SpecialTutors_4 =
|
||||
{
|
||||
(int)Move.BlastBurn,
|
||||
(int)Move.HydroCannon,
|
||||
(int)Move.FrenzyPlant,
|
||||
(int)Move.DracoMeteor,
|
||||
};
|
||||
internal static ReadOnlySpan<ushort> SpecialTutors_Compatibility_4_BlastBurn => new ushort[] { 006, 157, 257, 392 };
|
||||
internal static ReadOnlySpan<ushort> SpecialTutors_Compatibility_4_HydroCannon => new ushort[] { 009, 160, 260, 395 };
|
||||
internal static ReadOnlySpan<ushort> SpecialTutors_Compatibility_4_FrenzyPlant => new ushort[] { 003, 154, 254, 389 };
|
||||
internal static ReadOnlySpan<ushort> SpecialTutors_Compatibility_4_DracoMeteor => new ushort[] { 147, 148, 149, 230, 329, 330, 334, 371, 372, 373, 380, 381, 384, 443, 444, 445, 483, 484, 487 };
|
||||
|
||||
internal static readonly ushort[][] SpecialTutors_Compatibility_4 =
|
||||
{
|
||||
new ushort[] { 006, 157, 257, 392 },
|
||||
new ushort[] { 009, 160, 260, 395 },
|
||||
new ushort[] { 003, 154, 254, 389 },
|
||||
new ushort[] { 147, 148, 149, 230, 329, 330, 334, 371, 372, 373, 380, 381, 384, 443, 444, 445, 483, 484, 487 },
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Tutors_4 =
|
||||
internal static ReadOnlySpan<ushort> Tutors_4 => new ushort[]
|
||||
{
|
||||
291, 189, 210, 196, 205, 009, 007, 276, 008, 442, 401, 466, 380, 173, 180, 314,
|
||||
270, 283, 200, 246, 235, 324, 428, 410, 414, 441, 239, 402, 334, 393, 387, 340,
|
||||
|
@ -38,7 +27,7 @@ internal static class LearnSource4
|
|||
143, 335, 450, 029,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] TM_4 =
|
||||
internal static ReadOnlySpan<ushort> TM_4 => new ushort[]
|
||||
{
|
||||
264, 337, 352, 347, 046, 092, 258, 339, 331, 237,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 202, 219,
|
||||
|
@ -52,7 +41,7 @@ internal static class LearnSource4
|
|||
430, 433,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] HM_DPPt =
|
||||
internal static ReadOnlySpan<ushort> HM_DPPt => new ushort[]
|
||||
{
|
||||
(int)Move.Cut,
|
||||
(int)Move.Fly,
|
||||
|
@ -64,7 +53,7 @@ internal static class LearnSource4
|
|||
(int)Move.RockClimb,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] HM_HGSS =
|
||||
internal static ReadOnlySpan<ushort> HM_HGSS => new ushort[]
|
||||
{
|
||||
(int)Move.Cut,
|
||||
(int)Move.Fly,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
internal static class LearnSource5
|
||||
{
|
||||
internal static readonly ushort[] TMHM_BW =
|
||||
internal static ReadOnlySpan<ushort> TMHM_BW => new ushort[]
|
||||
{
|
||||
468, 337, 473, 347, 046, 092, 258, 339, 474, 237,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 477, 219,
|
||||
|
@ -18,7 +20,7 @@ internal static class LearnSource5
|
|||
015, 019, 057, 070, 127, 291,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] TypeTutor567 =
|
||||
internal static ReadOnlySpan<ushort> TypeTutor567 => new ushort[]
|
||||
{
|
||||
(int)Move.GrassPledge,
|
||||
(int)Move.FirePledge,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
internal static class LearnSource7
|
||||
{
|
||||
internal static readonly ushort[] TMHM_SM =
|
||||
internal static ReadOnlySpan<ushort> TMHM_SM => new ushort[]
|
||||
{
|
||||
526, 337, 473, 347, 046, 092, 258, 339, 474, 237,
|
||||
241, 269, 058, 059, 063, 113, 182, 240, 355, 219,
|
||||
|
|
|
@ -156,8 +156,8 @@ public static class MoveBreed3
|
|||
var learn = value.Learnset;
|
||||
var baseEgg = value.Learnset.GetBaseEggMoves(value.Level);
|
||||
var tm = info.TMHM;
|
||||
var tmlist = TM_3.AsSpan(0, 50);
|
||||
var hmlist = HM_3.AsSpan();
|
||||
var tmlist = TM_3;
|
||||
var hmlist = HM_3;
|
||||
var moves = value.Moves;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
|
|
|
@ -151,8 +151,8 @@ public static class MoveBreed4
|
|||
var possible = value.Possible;
|
||||
var learn = value.Learnset;
|
||||
var baseEgg = value.Learnset.GetBaseEggMoves(value.Level);
|
||||
var tmlist = TM_4.AsSpan(0, 92);
|
||||
var hmlist = (gameVersion is HG or SS ? HM_HGSS : HM_DPPt).AsSpan();
|
||||
var tmlist = TM_4;
|
||||
var hmlist = gameVersion is HG or SS ? HM_HGSS : HM_DPPt;
|
||||
|
||||
var moves = value.Moves;
|
||||
for (int i = 0; i < count; i++)
|
||||
|
|
|
@ -147,7 +147,7 @@ public static class MoveBreed5
|
|||
var possible = value.Possible;
|
||||
var learn = value.Learnset;
|
||||
var baseEgg = value.Learnset.GetBaseEggMoves(value.Level);
|
||||
var tmlist = LearnSource5.TMHM_BW.AsSpan(0, 95); // actually 96, but TM96 is unavailable (Snarl - Lock Capsule)
|
||||
var tmlist = LearnSource5.TMHM_BW[..^1]; // actually 96, but TM96 is unavailable (Snarl - Lock Capsule)
|
||||
|
||||
var moves = value.Moves;
|
||||
for (int i = 0; i < count; i++)
|
||||
|
|
|
@ -37,7 +37,7 @@ internal static class EvolutionRestrictions
|
|||
|
||||
private readonly record struct MoveEvolution(byte ReferenceIndex, ushort Move);
|
||||
|
||||
private static readonly ushort[] FairyMoves =
|
||||
private static ReadOnlySpan<ushort> FairyMoves => new ushort[]
|
||||
{
|
||||
(int)SweetKiss,
|
||||
(int)Charm,
|
||||
|
|
|
@ -107,7 +107,7 @@ public partial class MemoryContext6
|
|||
/// <summary>
|
||||
/// 24bits of flags allowing certain feelings for a given memory index.
|
||||
/// </summary>
|
||||
private static readonly uint[] MemoryFeelings =
|
||||
private static ReadOnlySpan<uint> MemoryFeelings => new uint[]
|
||||
{
|
||||
0x000000, 0x04CBFD, 0x004BFD, 0x04CBFD, 0x04CBFD, 0xFFFBFB, 0x84FFF9, 0x47FFFF, 0xBF7FFA, 0x7660B0,
|
||||
0x80BDF9, 0x88FB7A, 0x083F79, 0x0001FE, 0xCFEFFF, 0x84EBAF, 0xB368B0, 0x091F7E, 0x0320A0, 0x080DDD,
|
||||
|
|
|
@ -291,7 +291,7 @@ public partial class MemoryContext8
|
|||
/// 24bits of flags allowing certain feelings for a given memory index.
|
||||
/// </summary>
|
||||
/// <remarks>Beware, there was an off-by-one error in the game that made Feeling 0 unobtainable, and thus the Happy feeling bit (rightmost) is omitted.</remarks>
|
||||
private static readonly uint[] MemoryFeelings =
|
||||
private static ReadOnlySpan<uint> MemoryFeelings => new uint[]
|
||||
{
|
||||
0x000000, 0x04CBFD, 0x004BFD, 0x04CBFD, 0x04CBFD, 0xFFFBFB, 0x84FFF9, 0x47FFFF, 0xBF7FFA, 0x7660B0,
|
||||
0x80BDF9, 0x88FB7A, 0x083F79, 0x0001FE, 0xCFEFFF, 0x84EBAF, 0xB368B0, 0x091F7E, 0x0320A0, 0x080DDD,
|
||||
|
|
|
@ -14,7 +14,7 @@ public static class Vivillon3DS
|
|||
/// <summary>
|
||||
/// List of valid regions as bitflags indexed by Vivillon form.
|
||||
/// </summary>
|
||||
private static readonly Region3DSFlags[] VivillonRegionTable =
|
||||
private static ReadOnlySpan<Region3DSFlags> VivillonRegionTable => new[]
|
||||
{
|
||||
/* 0 Icy Snow */ Americas | Europe,
|
||||
/* 1 Polar */ Americas | Europe | China,
|
||||
|
@ -68,7 +68,7 @@ public static class Vivillon3DS
|
|||
return form == same;
|
||||
|
||||
var tuple = (ushort)(country << 8 | region);
|
||||
var index = Array.BinarySearch(DiffCountryRegion, tuple);
|
||||
var index = DiffCountryRegion.BinarySearch(tuple);
|
||||
if (index >= 0)
|
||||
return form == DiffForm[index];
|
||||
|
||||
|
@ -89,7 +89,7 @@ public static class Vivillon3DS
|
|||
return same;
|
||||
|
||||
var tuple = (ushort)(country << 8 | region);
|
||||
var index = Array.BinarySearch(DiffCountryRegion, tuple);
|
||||
var index = DiffCountryRegion.BinarySearch(tuple);
|
||||
if (index >= 0)
|
||||
return DiffForm[index];
|
||||
|
||||
|
@ -128,7 +128,7 @@ public static class Vivillon3DS
|
|||
// (country:X2_region:X2)
|
||||
// do it this way instead of region_country so that the byte[] form is better ordered for better file compression :)
|
||||
// 777 entries, so we can use a binary search to find the form. Worst case is log2(777) = 10 comparisons.
|
||||
private static readonly ushort[] DiffCountryRegion =
|
||||
private static ReadOnlySpan<ushort> DiffCountryRegion => new ushort[]
|
||||
{
|
||||
0x0100, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F, 0x0110,
|
||||
0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, 0x011F, 0x0120,
|
||||
|
|
|
@ -27,7 +27,7 @@ public static class FormChangeUtil
|
|||
/// <summary>
|
||||
/// Species that can change between their forms and get access to form-specific moves.
|
||||
/// </summary>
|
||||
private static readonly HashSet<ushort> FormChangeMovesRetain = new()
|
||||
private static ReadOnlySpan<ushort> FormChangeMovesRetain => new ushort[]
|
||||
{
|
||||
(int)Species.Deoxys,
|
||||
(int)Species.Giratina,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static PKHeX.Core.Species;
|
||||
|
||||
|
@ -119,9 +120,9 @@ public static class FormInfo
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool IsFormChangeEgg(ushort species) => System.Array.IndexOf(FormChangeEgg, species) != -1;
|
||||
public static bool IsFormChangeEgg(ushort species) => FormChangeEgg.IndexOf(species) != -1;
|
||||
|
||||
private static readonly ushort[] FormChangeEgg =
|
||||
private static ReadOnlySpan<ushort> FormChangeEgg => new ushort[]
|
||||
{
|
||||
(int)Burmy,
|
||||
(int)Furfrou,
|
||||
|
@ -132,8 +133,12 @@ public static class FormInfo
|
|||
/// Species that can change between their forms, regardless of origin.
|
||||
/// </summary>
|
||||
/// <remarks>Excludes Zygarde as it has special conditions. Check separately.</remarks>
|
||||
private static readonly HashSet<ushort> FormChange = new(FormChangeEgg)
|
||||
private static readonly HashSet<ushort> FormChange = new()
|
||||
{
|
||||
(int)Burmy,
|
||||
(int)Furfrou,
|
||||
(int)Oricorio,
|
||||
|
||||
// Sometimes considered for wild encounters
|
||||
(int)Rotom,
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core;
|
|||
/// </summary>
|
||||
public static class MystryMew
|
||||
{
|
||||
private static readonly ushort[] Seeds =
|
||||
private static ReadOnlySpan<ushort> Seeds => new ushort[]
|
||||
{
|
||||
0x0652, 0x0932, 0x0C13, 0x0D43, 0x0EEE,
|
||||
0x1263, 0x13C9, 0x1614, 0x1C09, 0x1EA5,
|
||||
|
@ -41,8 +41,9 @@ public static class MystryMew
|
|||
/// </summary>
|
||||
public static uint GetSeed(uint random, PIDType type = PIDType.BACD_U)
|
||||
{
|
||||
uint restricted = random % (uint)Seeds.Length;
|
||||
var seed = (uint)Seeds[restricted];
|
||||
var seeds = Seeds;
|
||||
uint restricted = random % (uint)seeds.Length;
|
||||
var seed = (uint)seeds[(int)restricted];
|
||||
if (type == PIDType.BACD_R)
|
||||
return seed;
|
||||
|
||||
|
@ -59,10 +60,11 @@ public static class MystryMew
|
|||
/// <param name="seed">Origin seed (for the PID/IV)</param>
|
||||
public static int GetSeedIndex(uint seed)
|
||||
{
|
||||
var seeds = Seeds;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (seed <= ushort.MaxValue)
|
||||
return Array.BinarySearch(Seeds, (ushort)seed);
|
||||
return seeds.BinarySearch((ushort)seed);
|
||||
seed = LCRNG.Prev5(seed);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,9 +126,9 @@ public static partial class Legal
|
|||
|
||||
#region Moves
|
||||
|
||||
public static bool IsAllowedMoveGG(ushort move) => Array.BinarySearch(AllowedMovesGG, move) >= 0;
|
||||
public static bool IsAllowedMoveGG(ushort move) => AllowedMovesGG.BinarySearch(move) >= 0;
|
||||
|
||||
private static readonly ushort[] AllowedMovesGG =
|
||||
private static ReadOnlySpan<ushort> AllowedMovesGG => new ushort[]
|
||||
{
|
||||
000, 001, 002, 003, 004, 005, 006, 007, 008, 009,
|
||||
010, 011, 012, 013, 014, 015, 016, 017, 018, 019,
|
||||
|
|
|
@ -211,8 +211,8 @@ public sealed class FormVerifier : Verifier
|
|||
return VALID;
|
||||
}
|
||||
|
||||
private static readonly ushort[] Arceus_PlateIDs = { 303, 306, 304, 305, 309, 308, 310, 313, 298, 299, 301, 300, 307, 302, 311, 312, 644 };
|
||||
private static readonly ushort[] Arceus_ZCrystal = { 782, 785, 783, 784, 788, 787, 789, 792, 777, 778, 780, 779, 786, 781, 790, 791, 793 };
|
||||
private static ReadOnlySpan<ushort> Arceus_PlateIDs => new ushort[] { 303, 306, 304, 305, 309, 308, 310, 313, 298, 299, 301, 300, 307, 302, 311, 312, 644 };
|
||||
private static ReadOnlySpan<ushort> Arceus_ZCrystal => new ushort[] { 782, 785, 783, 784, 788, 787, 789, 792, 777, 778, 780, 779, 786, 781, 790, 791, 793 };
|
||||
|
||||
public static byte GetArceusFormFromHeldItem(int item, int format) => item switch
|
||||
{
|
||||
|
@ -223,12 +223,12 @@ public sealed class FormVerifier : Verifier
|
|||
|
||||
private static byte GetArceusFormFromZCrystal(int item)
|
||||
{
|
||||
return (byte)(Array.IndexOf(Arceus_ZCrystal, (ushort)item) + 1);
|
||||
return (byte)(Arceus_ZCrystal.IndexOf((ushort)item) + 1);
|
||||
}
|
||||
|
||||
private static byte GetArceusFormFromPlate(int item, int format)
|
||||
{
|
||||
byte form = (byte)(Array.IndexOf(Arceus_PlateIDs, (ushort)item) + 1);
|
||||
byte form = (byte)(Arceus_PlateIDs.IndexOf((ushort)item) + 1);
|
||||
if (format != 4) // No need to consider Curse type
|
||||
return form;
|
||||
if (form < 9)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -12,13 +11,11 @@ namespace PKHeX.Core;
|
|||
/// </remarks>
|
||||
public sealed class BK4 : G4PKM
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x42, 0x43, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => PokeCrypto.SIZE_4STORED;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_4STORED;
|
||||
public override EntityContext Context => EntityContext.Gen4;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -7,7 +6,7 @@ namespace PKHeX.Core;
|
|||
/// <summary> Generation 3 <see cref="PKM"/> format, exclusively for Pokémon Colosseum. </summary>
|
||||
public sealed class CK3 : G3PKM, IShadowCapture
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x11, 0x12, 0x13,
|
||||
0x61, 0x62, 0x63, 0x64,
|
||||
|
@ -18,8 +17,6 @@ public sealed class CK3 : G3PKM, IShadowCapture
|
|||
// 0xFC onwards unused? no, it's some pointers and values used by the game?
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => PokeCrypto.SIZE_3CSTORED;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_3CSTORED;
|
||||
public override EntityContext Context => EntityContext.Gen3;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
@ -11,7 +10,7 @@ public sealed class PA8 : PKM, ISanityChecksum, IMoveReset,
|
|||
IGanbaru, IAlpha, INoble, ITechRecord, ISociability, IMoveShop8Mastery, IContestStats, IHyperTrain, IScaledSizeValue, IScaledSize3, IGigantamax, IFavorite, IDynamaxLevel, IHandlerLanguage, IFormArgument, IHomeTrack, IBattleVersion, ITrainerMemories,
|
||||
IRibbonIndex, IRibbonSetAffixed, IRibbonSetRibbons, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6, IRibbonSetMemory6, IRibbonSetCommon7, IRibbonSetCommon8, IRibbonSetMarks, IRibbonSetMark8
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x17, 0x1A, 0x1B, 0x23, 0x33,
|
||||
0x4C, 0x4D, 0x4E, 0x4F,
|
||||
|
@ -29,7 +28,6 @@ public sealed class PA8 : PKM, ISanityChecksum, IMoveReset,
|
|||
0x12D, 0x13C,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override PersonalInfo8LA PersonalInfo => PersonalTable.LA.GetFormEntry(Species, Form);
|
||||
public IPermitRecord Permit => PersonalInfo;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core;
|
|||
/// <summary> Generation 7 <see cref="PKM"/> format used for <see cref="GameVersion.GG"/>. </summary>
|
||||
public sealed class PB7 : G6PKM, IHyperTrain, IAwakened, IScaledSizeValue, ICombatPower, IFavorite, IFormArgument
|
||||
{
|
||||
public static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x2A, // Old Marking Value (PelagoEventStatus)
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, // Unused Ribbons
|
||||
|
@ -21,8 +21,6 @@ public sealed class PB7 : G6PKM, IHyperTrain, IAwakened, IScaledSizeValue, IComb
|
|||
0xC8, 0xC9, // OT Terminator
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => SIZE;
|
||||
public override int SIZE_STORED => SIZE;
|
||||
private const int SIZE = 260;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
/// <summary> Generation 8 <see cref="PKM"/> format. </summary>
|
||||
public sealed class PB8 : G8PKM
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
// Alignment bytes
|
||||
0x17, 0x1A, 0x1B, 0x23, 0x33, 0x3E, 0x3F,
|
||||
|
@ -26,7 +25,6 @@ public sealed class PB8 : G8PKM
|
|||
0x140, 0x141, 0x142, 0x143, 0x144, 0x145, 0x146, 0x147,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override PersonalInfo8BDSP PersonalInfo => PersonalTable.BDSP.GetFormEntry(Species, Form);
|
||||
public override IPermitRecord Permit => PersonalInfo;
|
||||
public override bool IsNative => BDSP;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -127,7 +126,7 @@ public sealed class PK1 : GBPKML, IPersonalType
|
|||
public override int Version { get => (int)GameVersion.RBY; set { } }
|
||||
public override int PKRS_Strain { get => 0; set { } }
|
||||
public override int PKRS_Days { get => 0; set { } }
|
||||
public override bool CanHoldItem(IReadOnlyList<ushort> valid) => false;
|
||||
public override bool CanHoldItem(ReadOnlySpan<ushort> valid) => false;
|
||||
public override int Met_Location { get => 0; set { } }
|
||||
public override int OT_Gender { get => 0; set { } }
|
||||
public override int Met_Level { get => 0; set { } }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -8,7 +7,7 @@ namespace PKHeX.Core;
|
|||
/// <summary> Generation 3 <see cref="PKM"/> format. </summary>
|
||||
public sealed class PK3 : G3PKM, ISanityChecksum
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x2A, 0x2B,
|
||||
};
|
||||
|
@ -18,8 +17,6 @@ public sealed class PK3 : G3PKM, ISanityChecksum
|
|||
public override EntityContext Context => EntityContext.Gen3;
|
||||
public override PersonalInfo3 PersonalInfo => PersonalTable.RS[Species];
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public PK3() : base(PokeCrypto.SIZE_3PARTY) { }
|
||||
public PK3(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -8,13 +7,11 @@ namespace PKHeX.Core;
|
|||
/// <summary> Generation 4 <see cref="PKM"/> format. </summary>
|
||||
public sealed class PK4 : G4PKM
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x42, 0x43, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => PokeCrypto.SIZE_4PARTY;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_4STORED;
|
||||
public override EntityContext Context => EntityContext.Gen4;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -10,7 +9,7 @@ public sealed class PK5 : PKM, ISanityChecksum,
|
|||
IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetUnique3, IRibbonSetUnique4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetRibbons,
|
||||
IContestStats, IGroundTile
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x5E, // unused
|
||||
|
@ -20,8 +19,6 @@ public sealed class PK5 : PKM, ISanityChecksum,
|
|||
0x87, // PokeStar Fame
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => PokeCrypto.SIZE_5PARTY;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_5STORED;
|
||||
public override EntityContext Context => EntityContext.Gen5;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -9,13 +8,12 @@ namespace PKHeX.Core;
|
|||
public sealed class PK6 : G6PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6, IRibbonSetMemory6, IRibbonSetRibbons,
|
||||
IContestStats, IGeoTrack, ISuperTrain, IFormArgument, ITrainerMemories, IAffection, IGroundTile
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x36, 0x37, // Unused Ribbons
|
||||
0x58, 0x59, 0x73, 0x90, 0x91, 0x9E, 0x9F, 0xA0, 0xA1, 0xA7, 0xAA, 0xAB, 0xAC, 0xAD, 0xC8, 0xC9, 0xD7, 0xE4, 0xE5, 0xE6, 0xE7,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override EntityContext Context => EntityContext.Gen6;
|
||||
public override PersonalInfo6AO PersonalInfo => PersonalTable.AO.GetFormEntry(Species, Form);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -9,14 +8,13 @@ namespace PKHeX.Core;
|
|||
public sealed class PK7 : G6PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6, IRibbonSetMemory6, IRibbonSetCommon7, IRibbonSetRibbons,
|
||||
IContestStats, IHyperTrain, IGeoTrack, ISuperTrain, IFormArgument, ITrainerMemories, IAffection
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x2A, // Old Marking Value (PelagoEventStatus)
|
||||
// 0x36, 0x37, // Unused Ribbons
|
||||
0x58, 0x59, 0x73, 0x90, 0x91, 0x9E, 0x9F, 0xA0, 0xA1, 0xA7, 0xAA, 0xAB, 0xAC, 0xAD, 0xC8, 0xC9, 0xD7, 0xE4, 0xE5, 0xE6, 0xE7,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override EntityContext Context => EntityContext.Gen7;
|
||||
public override PersonalInfo7 PersonalInfo => PersonalTable.USUM.GetFormEntry(Species, Form);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -7,7 +6,7 @@ namespace PKHeX.Core;
|
|||
/// <summary> Generation 8 <see cref="PKM"/> format. </summary>
|
||||
public sealed class PK8 : G8PKM
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
// Alignment bytes
|
||||
0x17, 0x1A, 0x1B, 0x23, 0x33, 0x3E, 0x3F,
|
||||
|
@ -27,7 +26,6 @@ public sealed class PK8 : G8PKM
|
|||
0x140, 0x141, 0x142, 0x143, 0x144, 0x145, 0x146, 0x147,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override PersonalInfo8SWSH PersonalInfo => PersonalTable.SWSH.GetFormEntry(Species, Form);
|
||||
public override IPermitRecord Permit => PersonalInfo;
|
||||
public override bool IsNative => SWSH;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -10,7 +9,7 @@ public sealed class PK9 : PKM, ISanityChecksum, ITeraType, IMoveReset, ITechReco
|
|||
IContestStats, IHyperTrain, IScaledSize, IScaledSize3, IFavorite, IHandlerLanguage, IFormArgument, IHomeTrack, IBattleVersion, ITrainerMemories,
|
||||
IRibbonIndex, IRibbonSetAffixed, IRibbonSetRibbons, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6, IRibbonSetMemory6, IRibbonSetCommon7, IRibbonSetCommon8, IRibbonSetCommon9, IRibbonSetMarks, IRibbonSetMark8, IRibbonSetMark9
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x17,
|
||||
0x1A, 0x1B,
|
||||
|
@ -26,7 +25,6 @@ public sealed class PK9 : PKM, ISanityChecksum, ITeraType, IMoveReset, ITechReco
|
|||
0x115,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override PersonalInfo9SV PersonalInfo => PersonalTable.SV.GetFormEntry(Species, Form);
|
||||
public IPermitRecord Permit => PersonalInfo;
|
||||
public override bool IsNative => SWSH;
|
||||
|
|
|
@ -21,7 +21,7 @@ public abstract class PKM : ISpeciesForm, ITrainerID32, IGeneration, IShiny, ILa
|
|||
public abstract int SIZE_STORED { get; }
|
||||
public string Extension => GetType().Name.ToLowerInvariant();
|
||||
public abstract PersonalInfo PersonalInfo { get; }
|
||||
public virtual IReadOnlyList<ushort> ExtraBytes => Array.Empty<ushort>();
|
||||
public virtual ReadOnlySpan<ushort> ExtraBytes => Array.Empty<ushort>();
|
||||
|
||||
// Internal Attributes set on creation
|
||||
public readonly byte[] Data; // Raw Storage
|
||||
|
@ -757,7 +757,7 @@ public abstract class PKM : ISpeciesForm, ITrainerID32, IGeneration, IShiny, ILa
|
|||
/// </summary>
|
||||
/// <param name="valid">Items that the <see cref="PKM"/> can hold.</param>
|
||||
/// <returns>True/False if the <see cref="PKM"/> can hold its <see cref="HeldItem"/>.</returns>
|
||||
public virtual bool CanHoldItem(IReadOnlyList<ushort> valid) => valid.Contains((ushort)HeldItem);
|
||||
public virtual bool CanHoldItem(ReadOnlySpan<ushort> valid) => valid.Contains((ushort)HeldItem);
|
||||
|
||||
/// <summary>
|
||||
/// Deep clones the <see cref="PKM"/> object. The clone will not have any shared resources with the source.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -11,13 +10,11 @@ namespace PKHeX.Core;
|
|||
/// </remarks>
|
||||
public sealed class RK4 : G4PKM
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
{
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x42, 0x43, 0x5E, 0x63, 0x64, 0x65, 0x66, 0x67, 0x87,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => PokeCrypto.SIZE_4RSTORED;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_4RSTORED;
|
||||
public override EntityContext Context => EntityContext.Gen4;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
|
@ -18,7 +17,7 @@ public abstract class GBPKM : PKM
|
|||
public sealed override int MaxIV => 15;
|
||||
public sealed override int MaxEV => ushort.MaxValue;
|
||||
|
||||
public sealed override IReadOnlyList<ushort> ExtraBytes => Array.Empty<ushort>();
|
||||
public sealed override ReadOnlySpan<ushort> ExtraBytes => ReadOnlySpan<ushort>.Empty;
|
||||
|
||||
protected GBPKM(int size) : base(size) { }
|
||||
protected GBPKM(byte[] data) : base(data) { }
|
||||
|
|
|
@ -94,7 +94,7 @@ public static class StringConverter12Transporter
|
|||
/// <br>0xCD at arr[0xC9] = Í (Spanish In-game Trade Shuckle, MANÍA)</br>
|
||||
/// <br>All other new language sensitive re-mapping (or lack thereof) are inaccessible via the character entry screen.</br>
|
||||
/// </remarks>
|
||||
private static readonly ushort[] us_table =
|
||||
private static ReadOnlySpan<ushort> us_table => new ushort[]
|
||||
{
|
||||
0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // 0
|
||||
0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, // 1
|
||||
|
@ -117,7 +117,7 @@ public static class StringConverter12Transporter
|
|||
/// <summary>
|
||||
/// Japanese 1->7 character translation table
|
||||
/// </summary>
|
||||
private static readonly ushort[] jp_table =
|
||||
private static ReadOnlySpan<ushort> jp_table => new ushort[]
|
||||
{
|
||||
0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x30AC, 0x30AE, 0x30B0, 0x30B2, 0x30B4, 0x30B6, 0x30B8, 0x30BA, 0x30BC, 0x30BE, 0x30C0, // 0
|
||||
0x30C2, 0x30C5, 0x30C7, 0x30C9, 0x3000, 0x3000, 0x3000, 0x3000, 0x3000, 0x30D0, 0x30D3, 0x30D6, 0x30DC, 0x3000, 0x3000, 0x3000, // 1
|
||||
|
|
|
@ -30,11 +30,12 @@ public static class StringConverter3
|
|||
/// <returns>Character count loaded.</returns>
|
||||
public static int LoadString(ReadOnlySpan<byte> data, Span<char> result, bool jp)
|
||||
{
|
||||
var table = jp ? G3_JP : G3_EN;
|
||||
int i = 0;
|
||||
for (; i < data.Length; i++)
|
||||
{
|
||||
var value = data[i];
|
||||
var c = GetG3Char(value, jp); // Convert to Unicode
|
||||
var c = table[value]; // Convert to Unicode
|
||||
if (c == Terminator) // Stop if Terminator/Invalid
|
||||
break;
|
||||
result[i] = c;
|
||||
|
@ -62,11 +63,14 @@ public static class StringConverter3
|
|||
else if (option is StringConverterOption.ClearZero)
|
||||
buffer.Clear();
|
||||
|
||||
var table = jp ? G3_JP : G3_EN;
|
||||
int i = 0;
|
||||
for (; i < value.Length; i++)
|
||||
{
|
||||
var chr = value[i];
|
||||
var b = SetG3Char(chr, jp);
|
||||
if (chr == '\'') // ’
|
||||
return 0xB4;
|
||||
var b = (byte)table.IndexOf(chr);
|
||||
if (b == TerminatorByte)
|
||||
break;
|
||||
buffer[i] = b;
|
||||
|
@ -84,7 +88,7 @@ public static class StringConverter3
|
|||
/// <param name="chr">Generation 4 decoded character.</param>
|
||||
/// <param name="jp">Character destination is Japanese font.</param>
|
||||
/// <returns>Generation 3 encoded value.</returns>
|
||||
private static char GetG3Char(byte chr, bool jp)
|
||||
public static char GetG3Char(byte chr, bool jp)
|
||||
{
|
||||
var table = jp ? G3_JP : G3_EN;
|
||||
return table[chr];
|
||||
|
@ -96,18 +100,16 @@ public static class StringConverter3
|
|||
/// <param name="chr">Generation 4 decoded character.</param>
|
||||
/// <param name="jp">Character destination is Japanese font.</param>
|
||||
/// <returns>Generation 3 encoded value.</returns>
|
||||
private static byte SetG3Char(char chr, bool jp)
|
||||
public static byte SetG3Char(char chr, bool jp)
|
||||
{
|
||||
if (chr == '\'') // ’
|
||||
return 0xB4;
|
||||
var table = jp ? G3_JP : G3_EN;
|
||||
var index = Array.IndexOf(table, chr);
|
||||
if (index == -1)
|
||||
return TerminatorByte;
|
||||
var index = table.IndexOf(chr);
|
||||
return (byte)index;
|
||||
}
|
||||
|
||||
private static readonly char[] G3_EN =
|
||||
private static ReadOnlySpan<char> G3_EN => new[]
|
||||
{
|
||||
' ', 'À', 'Á', 'Â', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'こ', 'Î', 'Ï', 'Ò', 'Ó', 'Ô', // 0
|
||||
'Œ', 'Ù', 'Ú', 'Û', 'Ñ', 'ß', 'à', 'á', 'ね', 'Ç', 'È', 'é', 'ê', 'ë', 'ì', 'í', // 1
|
||||
|
@ -130,7 +132,7 @@ public static class StringConverter3
|
|||
Terminator, Terminator, Terminator, Terminator, Terminator, Terminator, Terminator, Terminator, Terminator,
|
||||
};
|
||||
|
||||
private static readonly char[] G3_JP =
|
||||
private static ReadOnlySpan<char> G3_JP => new[]
|
||||
{
|
||||
' ', 'あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ', // 0
|
||||
'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ', 'ま', // 1
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
|
@ -59,7 +58,7 @@ public static class StringConverter4Util
|
|||
/// <summary>
|
||||
/// Values (stored value)
|
||||
/// </summary>
|
||||
private static readonly ushort[] G4Values =
|
||||
private static ReadOnlySpan<ushort> G4Values => new ushort[]
|
||||
{
|
||||
00001, 00002, 00003, 00004, 00005, 00006, 00007, 00008, 00009, 00010, 00011, 00012, 00013, 00014, 00015, 00016,
|
||||
00017, 00018, 00019, 00020, 00021, 00022, 00023, 00024, 00025, 00026, 00027, 00028, 00029, 00030, 00031, 00032,
|
||||
|
@ -246,7 +245,7 @@ public static class StringConverter4Util
|
|||
/// <summary>
|
||||
/// Characters (Unicode representation)
|
||||
/// </summary>
|
||||
private static readonly ushort[] G4Chars =
|
||||
private static ReadOnlySpan<ushort> G4Chars => new ushort[]
|
||||
{
|
||||
12288, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367,
|
||||
12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383,
|
||||
|
@ -430,13 +429,16 @@ public static class StringConverter4Util
|
|||
04467, 04469, 47252, 49968, 50108, 50388, 52012, 65535,
|
||||
};
|
||||
|
||||
private static readonly Dictionary<ushort, int> G4ValueId = G4Values
|
||||
.Select((value, index) => new KeyValuePair<ushort, int>(value, index))
|
||||
.ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
private static readonly Dictionary<ushort, int> G4ValueId = GetDictionary(G4Values);
|
||||
private static readonly Dictionary<ushort, int> G4CharId = GetDictionary(G4Chars);
|
||||
|
||||
private static readonly Dictionary<ushort, int> G4CharId = G4Chars
|
||||
.Select((value, index) => new KeyValuePair<ushort, int>(value, index))
|
||||
.ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
private static Dictionary<ushort, int> GetDictionary(ReadOnlySpan<ushort> arr)
|
||||
{
|
||||
var result = new Dictionary<ushort, int>(arr.Length);
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
result[arr[i]] = i;
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ internal static class ItemConverter
|
|||
{
|
||||
if (item == NaN)
|
||||
return 0;
|
||||
int index = Array.IndexOf(arr3, item);
|
||||
int index = arr3.IndexOf(item);
|
||||
return (ushort)Math.Max(0, index);
|
||||
}
|
||||
|
||||
|
@ -54,13 +54,13 @@ internal static class ItemConverter
|
|||
{
|
||||
if (item == NaN)
|
||||
return 0;
|
||||
int index = Array.IndexOf(arr2, item);
|
||||
int index = arr2.IndexOf(item);
|
||||
return (byte)Math.Max(0, index);
|
||||
}
|
||||
|
||||
#region Item Mapping Tables
|
||||
/// <summary> Gen2 items (index) and their corresponding Gen4 item ID (value) </summary>
|
||||
private static readonly ushort[] arr2 =
|
||||
private static ReadOnlySpan<ushort> arr2 => new ushort[]
|
||||
{
|
||||
000, 001, 002, 213, 003, 004, NaN, 450, 081, 018, // 0
|
||||
019, 020, 021, 022, 023, 024, 025, 026, 017, 078, // 1
|
||||
|
@ -91,7 +91,7 @@ internal static class ItemConverter
|
|||
};
|
||||
|
||||
/// <summary> Gen3 items (index) and their corresponding Gen4 item ID (value) </summary>
|
||||
private static readonly ushort[] arr3 =
|
||||
private static ReadOnlySpan<ushort> arr3 => new ushort[]
|
||||
{
|
||||
000, 001, 002, 003, 004, 005, 006, 007, 008, 009,
|
||||
010, 011, 012, 017, 018, 019, 020, 021, 022, 023,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
||||
/// <summary>
|
||||
|
@ -13,10 +15,11 @@ public static class Experience
|
|||
/// <returns>Current level of the species.</returns>
|
||||
public static int GetLevel(uint exp, byte growth)
|
||||
{
|
||||
if (exp >= ExpTable[99, growth])
|
||||
var table = GetTable(growth);
|
||||
if (exp >= table[^1])
|
||||
return 100;
|
||||
int tl = 1; // Initial Level. Iterate upwards to find the level
|
||||
while (exp >= ExpTable[tl, growth])
|
||||
while (exp >= table[tl])
|
||||
++tl;
|
||||
return tl;
|
||||
}
|
||||
|
@ -33,9 +36,22 @@ public static class Experience
|
|||
return 0;
|
||||
if (level > 100)
|
||||
level = 100;
|
||||
return ExpTable[level - 1, growth];
|
||||
|
||||
var table = GetTable(growth);
|
||||
return table[level - 1];
|
||||
}
|
||||
|
||||
private static ReadOnlySpan<uint> GetTable(byte growth) => growth switch
|
||||
{
|
||||
0 => Growth0,
|
||||
1 => Growth1,
|
||||
2 => Growth2,
|
||||
3 => Growth3,
|
||||
4 => Growth4,
|
||||
5 => Growth5,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(growth)),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PKM.Nature"/> value for <see cref="PK1"/> / <see cref="PK2"/> entries based on the <see cref="PKM.EXP"/>
|
||||
/// </summary>
|
||||
|
@ -53,8 +69,9 @@ public static class Experience
|
|||
{
|
||||
if ((uint)level >= 100)
|
||||
return 0;
|
||||
var current = ExpTable[level - 1, growth];
|
||||
var next = ExpTable[level, growth];
|
||||
var table = GetTable(growth);
|
||||
var current = table[level - 1];
|
||||
var next = table[level];
|
||||
return next - current;
|
||||
}
|
||||
|
||||
|
@ -69,8 +86,10 @@ public static class Experience
|
|||
{
|
||||
if ((uint)level >= 100)
|
||||
return 0;
|
||||
var current = ExpTable[level - 1, growth];
|
||||
var next = ExpTable[level, growth];
|
||||
|
||||
var table = GetTable(growth);
|
||||
var current = table[level - 1];
|
||||
var next = table[level];
|
||||
var amount = next - current;
|
||||
double progress = exp - current;
|
||||
return progress / amount;
|
||||
|
@ -78,111 +97,88 @@ public static class Experience
|
|||
|
||||
#region ExpTable
|
||||
|
||||
/// <summary>
|
||||
/// Experience required for next level [0,99]
|
||||
/// </summary>
|
||||
private static readonly uint[,] ExpTable =
|
||||
private static ReadOnlySpan<uint> Growth0 => new uint[]
|
||||
{
|
||||
{0000000, 0000000, 0000000, 0000000, 0000000, 0000000},
|
||||
{0000008, 0000015, 0000004, 0000009, 0000006, 0000010},
|
||||
{0000027, 0000052, 0000013, 0000057, 0000021, 0000033},
|
||||
{0000064, 0000122, 0000032, 0000096, 0000051, 0000080},
|
||||
{0000125, 0000237, 0000065, 0000135, 0000100, 0000156},
|
||||
{0000216, 0000406, 0000112, 0000179, 0000172, 0000270},
|
||||
{0000343, 0000637, 0000178, 0000236, 0000274, 0000428},
|
||||
{0000512, 0000942, 0000276, 0000314, 0000409, 0000640},
|
||||
{0000729, 0001326, 0000393, 0000419, 0000583, 0000911},
|
||||
{0001000, 0001800, 0000540, 0000560, 0000800, 0001250},
|
||||
{0001331, 0002369, 0000745, 0000742, 0001064, 0001663},
|
||||
{0001728, 0003041, 0000967, 0000973, 0001382, 0002160},
|
||||
{0002197, 0003822, 0001230, 0001261, 0001757, 0002746},
|
||||
{0002744, 0004719, 0001591, 0001612, 0002195, 0003430},
|
||||
{0003375, 0005737, 0001957, 0002035, 0002700, 0004218},
|
||||
{0004096, 0006881, 0002457, 0002535, 0003276, 0005120},
|
||||
{0004913, 0008155, 0003046, 0003120, 0003930, 0006141},
|
||||
{0005832, 0009564, 0003732, 0003798, 0004665, 0007290},
|
||||
{0006859, 0011111, 0004526, 0004575, 0005487, 0008573},
|
||||
{0008000, 0012800, 0005440, 0005460, 0006400, 0010000},
|
||||
{0009261, 0014632, 0006482, 0006458, 0007408, 0011576},
|
||||
{0010648, 0016610, 0007666, 0007577, 0008518, 0013310},
|
||||
{0012167, 0018737, 0009003, 0008825, 0009733, 0015208},
|
||||
{0013824, 0021012, 0010506, 0010208, 0011059, 0017280},
|
||||
{0015625, 0023437, 0012187, 0011735, 0012500, 0019531},
|
||||
{0017576, 0026012, 0014060, 0013411, 0014060, 0021970},
|
||||
{0019683, 0028737, 0016140, 0015244, 0015746, 0024603},
|
||||
{0021952, 0031610, 0018439, 0017242, 0017561, 0027440},
|
||||
{0024389, 0034632, 0020974, 0019411, 0019511, 0030486},
|
||||
{0027000, 0037800, 0023760, 0021760, 0021600, 0033750},
|
||||
{0029791, 0041111, 0026811, 0024294, 0023832, 0037238},
|
||||
{0032768, 0044564, 0030146, 0027021, 0026214, 0040960},
|
||||
{0035937, 0048155, 0033780, 0029949, 0028749, 0044921},
|
||||
{0039304, 0051881, 0037731, 0033084, 0031443, 0049130},
|
||||
{0042875, 0055737, 0042017, 0036435, 0034300, 0053593},
|
||||
{0046656, 0059719, 0046656, 0040007, 0037324, 0058320},
|
||||
{0050653, 0063822, 0050653, 0043808, 0040522, 0063316},
|
||||
{0054872, 0068041, 0055969, 0047846, 0043897, 0068590},
|
||||
{0059319, 0072369, 0060505, 0052127, 0047455, 0074148},
|
||||
{0064000, 0076800, 0066560, 0056660, 0051200, 0080000},
|
||||
{0068921, 0081326, 0071677, 0061450, 0055136, 0086151},
|
||||
{0074088, 0085942, 0078533, 0066505, 0059270, 0092610},
|
||||
{0079507, 0090637, 0084277, 0071833, 0063605, 0099383},
|
||||
{0085184, 0095406, 0091998, 0077440, 0068147, 0106480},
|
||||
{0091125, 0100237, 0098415, 0083335, 0072900, 0113906},
|
||||
{0097336, 0105122, 0107069, 0089523, 0077868, 0121670},
|
||||
{0103823, 0110052, 0114205, 0096012, 0083058, 0129778},
|
||||
{0110592, 0115015, 0123863, 0102810, 0088473, 0138240},
|
||||
{0117649, 0120001, 0131766, 0109923, 0094119, 0147061},
|
||||
{0125000, 0125000, 0142500, 0117360, 0100000, 0156250},
|
||||
{0132651, 0131324, 0151222, 0125126, 0106120, 0165813},
|
||||
{0140608, 0137795, 0163105, 0133229, 0112486, 0175760},
|
||||
{0148877, 0144410, 0172697, 0141677, 0119101, 0186096},
|
||||
{0157464, 0151165, 0185807, 0150476, 0125971, 0196830},
|
||||
{0166375, 0158056, 0196322, 0159635, 0133100, 0207968},
|
||||
{0175616, 0165079, 0210739, 0169159, 0140492, 0219520},
|
||||
{0185193, 0172229, 0222231, 0179056, 0148154, 0231491},
|
||||
{0195112, 0179503, 0238036, 0189334, 0156089, 0243890},
|
||||
{0205379, 0186894, 0250562, 0199999, 0164303, 0256723},
|
||||
{0216000, 0194400, 0267840, 0211060, 0172800, 0270000},
|
||||
{0226981, 0202013, 0281456, 0222522, 0181584, 0283726},
|
||||
{0238328, 0209728, 0300293, 0234393, 0190662, 0297910},
|
||||
{0250047, 0217540, 0315059, 0246681, 0200037, 0312558},
|
||||
{0262144, 0225443, 0335544, 0259392, 0209715, 0327680},
|
||||
{0274625, 0233431, 0351520, 0272535, 0219700, 0343281},
|
||||
{0287496, 0241496, 0373744, 0286115, 0229996, 0359370},
|
||||
{0300763, 0249633, 0390991, 0300140, 0240610, 0375953},
|
||||
{0314432, 0257834, 0415050, 0314618, 0251545, 0393040},
|
||||
{0328509, 0267406, 0433631, 0329555, 0262807, 0410636},
|
||||
{0343000, 0276458, 0459620, 0344960, 0274400, 0428750},
|
||||
{0357911, 0286328, 0479600, 0360838, 0286328, 0447388},
|
||||
{0373248, 0296358, 0507617, 0377197, 0298598, 0466560},
|
||||
{0389017, 0305767, 0529063, 0394045, 0311213, 0486271},
|
||||
{0405224, 0316074, 0559209, 0411388, 0324179, 0506530},
|
||||
{0421875, 0326531, 0582187, 0429235, 0337500, 0527343},
|
||||
{0438976, 0336255, 0614566, 0447591, 0351180, 0548720},
|
||||
{0456533, 0346965, 0639146, 0466464, 0365226, 0570666},
|
||||
{0474552, 0357812, 0673863, 0485862, 0379641, 0593190},
|
||||
{0493039, 0367807, 0700115, 0505791, 0394431, 0616298},
|
||||
{0512000, 0378880, 0737280, 0526260, 0409600, 0640000},
|
||||
{0531441, 0390077, 0765275, 0547274, 0425152, 0664301},
|
||||
{0551368, 0400293, 0804997, 0568841, 0441094, 0689210},
|
||||
{0571787, 0411686, 0834809, 0590969, 0457429, 0714733},
|
||||
{0592704, 0423190, 0877201, 0613664, 0474163, 0740880},
|
||||
{0614125, 0433572, 0908905, 0636935, 0491300, 0767656},
|
||||
{0636056, 0445239, 0954084, 0660787, 0508844, 0795070},
|
||||
{0658503, 0457001, 0987754, 0685228, 0526802, 0823128},
|
||||
{0681472, 0467489, 1035837, 0710266, 0545177, 0851840},
|
||||
{0704969, 0479378, 1071552, 0735907, 0563975, 0881211},
|
||||
{0729000, 0491346, 1122660, 0762160, 0583200, 0911250},
|
||||
{0753571, 0501878, 1160499, 0789030, 0602856, 0941963},
|
||||
{0778688, 0513934, 1214753, 0816525, 0622950, 0973360},
|
||||
{0804357, 0526049, 1254796, 0844653, 0643485, 1005446},
|
||||
{0830584, 0536557, 1312322, 0873420, 0664467, 1038230},
|
||||
{0857375, 0548720, 1354652, 0902835, 0685900, 1071718},
|
||||
{0884736, 0560922, 1415577, 0932903, 0707788, 1105920},
|
||||
{0912673, 0571333, 1460276, 0963632, 0730138, 1140841},
|
||||
{0941192, 0583539, 1524731, 0995030, 0752953, 1176490},
|
||||
{0970299, 0591882, 1571884, 1027103, 0776239, 1212873},
|
||||
{1000000, 0600000, 1640000, 1059860, 0800000, 1250000},
|
||||
0000000, 0000008, 0000027, 0000064, 0000125, 0000216, 0000343, 0000512, 0000729, 0001000,
|
||||
0001331, 0001728, 0002197, 0002744, 0003375, 0004096, 0004913, 0005832, 0006859, 0008000,
|
||||
0009261, 0010648, 0012167, 0013824, 0015625, 0017576, 0019683, 0021952, 0024389, 0027000,
|
||||
0029791, 0032768, 0035937, 0039304, 0042875, 0046656, 0050653, 0054872, 0059319, 0064000,
|
||||
0068921, 0074088, 0079507, 0085184, 0091125, 0097336, 0103823, 0110592, 0117649, 0125000,
|
||||
0132651, 0140608, 0148877, 0157464, 0166375, 0175616, 0185193, 0195112, 0205379, 0216000,
|
||||
0226981, 0238328, 0250047, 0262144, 0274625, 0287496, 0300763, 0314432, 0328509, 0343000,
|
||||
0357911, 0373248, 0389017, 0405224, 0421875, 0438976, 0456533, 0474552, 0493039, 0512000,
|
||||
0531441, 0551368, 0571787, 0592704, 0614125, 0636056, 0658503, 0681472, 0704969, 0729000,
|
||||
0753571, 0778688, 0804357, 0830584, 0857375, 0884736, 0912673, 0941192, 0970299, 1000000,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<uint> Growth1 => new uint[]
|
||||
{
|
||||
0000000, 0000015, 0000052, 0000122, 0000237, 0000406, 0000637, 0000942, 0001326, 0001800,
|
||||
0002369, 0003041, 0003822, 0004719, 0005737, 0006881, 0008155, 0009564, 0011111, 0012800,
|
||||
0014632, 0016610, 0018737, 0021012, 0023437, 0026012, 0028737, 0031610, 0034632, 0037800,
|
||||
0041111, 0044564, 0048155, 0051881, 0055737, 0059719, 0063822, 0068041, 0072369, 0076800,
|
||||
0081326, 0085942, 0090637, 0095406, 0100237, 0105122, 0110052, 0115015, 0120001, 0125000,
|
||||
0131324, 0137795, 0144410, 0151165, 0158056, 0165079, 0172229, 0179503, 0186894, 0194400,
|
||||
0202013, 0209728, 0217540, 0225443, 0233431, 0241496, 0249633, 0257834, 0267406, 0276458,
|
||||
0286328, 0296358, 0305767, 0316074, 0326531, 0336255, 0346965, 0357812, 0367807, 0378880,
|
||||
0390077, 0400293, 0411686, 0423190, 0433572, 0445239, 0457001, 0467489, 0479378, 0491346,
|
||||
0501878, 0513934, 0526049, 0536557, 0548720, 0560922, 0571333, 0583539, 0591882, 0600000,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<uint> Growth2 => new uint[]
|
||||
{
|
||||
0000000, 0000004, 0000013, 0000032, 0000065, 0000112, 0000178, 0000276, 0000393, 0000540,
|
||||
0000745, 0000967, 0001230, 0001591, 0001957, 0002457, 0003046, 0003732, 0004526, 0005440,
|
||||
0006482, 0007666, 0009003, 0010506, 0012187, 0014060, 0016140, 0018439, 0020974, 0023760,
|
||||
0026811, 0030146, 0033780, 0037731, 0042017, 0046656, 0050653, 0055969, 0060505, 0066560,
|
||||
0071677, 0078533, 0084277, 0091998, 0098415, 0107069, 0114205, 0123863, 0131766, 0142500,
|
||||
0151222, 0163105, 0172697, 0185807, 0196322, 0210739, 0222231, 0238036, 0250562, 0267840,
|
||||
0281456, 0300293, 0315059, 0335544, 0351520, 0373744, 0390991, 0415050, 0433631, 0459620,
|
||||
0479600, 0507617, 0529063, 0559209, 0582187, 0614566, 0639146, 0673863, 0700115, 0737280,
|
||||
0765275, 0804997, 0834809, 0877201, 0908905, 0954084, 0987754, 1035837, 1071552, 1122660,
|
||||
1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<uint> Growth3 => new uint[]
|
||||
{
|
||||
0000000, 0000009, 0000057, 0000096, 0000135, 0000179, 0000236, 0000314, 0000419, 0000560,
|
||||
0000742, 0000973, 0001261, 0001612, 0002035, 0002535, 0003120, 0003798, 0004575, 0005460,
|
||||
0006458, 0007577, 0008825, 0010208, 0011735, 0013411, 0015244, 0017242, 0019411, 0021760,
|
||||
0024294, 0027021, 0029949, 0033084, 0036435, 0040007, 0043808, 0047846, 0052127, 0056660,
|
||||
0061450, 0066505, 0071833, 0077440, 0083335, 0089523, 0096012, 0102810, 0109923, 0117360,
|
||||
0125126, 0133229, 0141677, 0150476, 0159635, 0169159, 0179056, 0189334, 0199999, 0211060,
|
||||
0222522, 0234393, 0246681, 0259392, 0272535, 0286115, 0300140, 0314618, 0329555, 0344960,
|
||||
0360838, 0377197, 0394045, 0411388, 0429235, 0447591, 0466464, 0485862, 0505791, 0526260,
|
||||
0547274, 0568841, 0590969, 0613664, 0636935, 0660787, 0685228, 0710266, 0735907, 0762160,
|
||||
0789030, 0816525, 0844653, 0873420, 0902835, 0932903, 0963632, 0995030, 1027103, 1059860,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<uint> Growth4 => new uint[]
|
||||
{
|
||||
0000000, 0000006, 0000021, 0000051, 0000100, 0000172, 0000274, 0000409, 0000583, 0000800,
|
||||
0001064, 0001382, 0001757, 0002195, 0002700, 0003276, 0003930, 0004665, 0005487, 0006400,
|
||||
0007408, 0008518, 0009733, 0011059, 0012500, 0014060, 0015746, 0017561, 0019511, 0021600,
|
||||
0023832, 0026214, 0028749, 0031443, 0034300, 0037324, 0040522, 0043897, 0047455, 0051200,
|
||||
0055136, 0059270, 0063605, 0068147, 0072900, 0077868, 0083058, 0088473, 0094119, 0100000,
|
||||
0106120, 0112486, 0119101, 0125971, 0133100, 0140492, 0148154, 0156089, 0164303, 0172800,
|
||||
0181584, 0190662, 0200037, 0209715, 0219700, 0229996, 0240610, 0251545, 0262807, 0274400,
|
||||
0286328, 0298598, 0311213, 0324179, 0337500, 0351180, 0365226, 0379641, 0394431, 0409600,
|
||||
0425152, 0441094, 0457429, 0474163, 0491300, 0508844, 0526802, 0545177, 0563975, 0583200,
|
||||
0602856, 0622950, 0643485, 0664467, 0685900, 0707788, 0730138, 0752953, 0776239, 0800000,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<uint> Growth5 => new uint[]
|
||||
{
|
||||
0000000, 0000010, 0000033, 0000080, 0000156, 0000270, 0000428, 0000640, 0000911, 0001250,
|
||||
0001663, 0002160, 0002746, 0003430, 0004218, 0005120, 0006141, 0007290, 0008573, 0010000,
|
||||
0011576, 0013310, 0015208, 0017280, 0019531, 0021970, 0024603, 0027440, 0030486, 0033750,
|
||||
0037238, 0040960, 0044921, 0049130, 0053593, 0058320, 0063316, 0068590, 0074148, 0080000,
|
||||
0086151, 0092610, 0099383, 0106480, 0113906, 0121670, 0129778, 0138240, 0147061, 0156250,
|
||||
0165813, 0175760, 0186096, 0196830, 0207968, 0219520, 0231491, 0243890, 0256723, 0270000,
|
||||
0283726, 0297910, 0312558, 0327680, 0343281, 0359370, 0375953, 0393040, 0410636, 0428750,
|
||||
0447388, 0466560, 0486271, 0506530, 0527343, 0548720, 0570666, 0593190, 0616298, 0640000,
|
||||
0664301, 0689210, 0714733, 0740880, 0767656, 0795070, 0823128, 0851840, 0881211, 0911250,
|
||||
0941963, 0973360, 1005446, 1038230, 1071718, 1105920, 1140841, 1176490, 1212873, 1250000,
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -8,7 +7,7 @@ namespace PKHeX.Core;
|
|||
/// <summary> Generation 3 <see cref="PKM"/> format, exclusively for Pokémon XD. </summary>
|
||||
public sealed class XK3 : G3PKM, IShadowCapture
|
||||
{
|
||||
private static readonly ushort[] Unused =
|
||||
public override ReadOnlySpan<ushort> ExtraBytes => new ushort[]
|
||||
{
|
||||
0x0A, 0x0B, 0x0C, 0x0D, 0x1E, 0x1F,
|
||||
0x2A, 0x2B,
|
||||
|
@ -16,8 +15,6 @@ public sealed class XK3 : G3PKM, IShadowCapture
|
|||
0x7E, 0x7F,
|
||||
};
|
||||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
|
||||
public override int SIZE_PARTY => PokeCrypto.SIZE_3XSTORED;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_3XSTORED;
|
||||
public override EntityContext Context => EntityContext.Gen3;
|
||||
|
|
|
@ -148,7 +148,7 @@ public sealed class PersonalInfo5B2W2 : PersonalInfo, IPersonalAbility12H, IPers
|
|||
|
||||
public bool GetIsLearnTutor1(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves1, move);
|
||||
var index = TutorMoves1.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor1 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ public sealed class PersonalInfo5B2W2 : PersonalInfo, IPersonalAbility12H, IPers
|
|||
|
||||
public bool GetIsLearnTutor2(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves2, move);
|
||||
var index = TutorMoves2.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor2 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public sealed class PersonalInfo5B2W2 : PersonalInfo, IPersonalAbility12H, IPers
|
|||
|
||||
public bool GetIsLearnTutor3(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves3, move);
|
||||
var index = TutorMoves3.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor3 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public sealed class PersonalInfo5B2W2 : PersonalInfo, IPersonalAbility12H, IPers
|
|||
|
||||
public bool GetIsLearnTutor4(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves4, move);
|
||||
var index = TutorMoves4.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor4 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -275,10 +275,10 @@ public sealed class PersonalInfo5B2W2 : PersonalInfo, IPersonalAbility12H, IPers
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] TutorMoves1 = { 450, 343, 162, 530, 324, 442, 402, 529, 340, 067, 441, 253, 009, 007, 008 }; // Driftveil
|
||||
private static readonly ushort[] TutorMoves2 = { 277, 335, 414, 492, 356, 393, 334, 387, 276, 527, 196, 401, 399, 428, 406, 304, 231 }; // Lentimas
|
||||
private static readonly ushort[] TutorMoves3 = { 020, 173, 282, 235, 257, 272, 215, 366, 143, 220, 202, 409, 355 }; // Humilau
|
||||
private static readonly ushort[] TutorMoves4 = { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 }; // Nacrene
|
||||
private static ReadOnlySpan<ushort> TutorMoves1 => new ushort[] { 450, 343, 162, 530, 324, 442, 402, 529, 340, 067, 441, 253, 009, 007, 008 }; // Driftveil
|
||||
private static ReadOnlySpan<ushort> TutorMoves2 => new ushort[] { 277, 335, 414, 492, 356, 393, 334, 387, 276, 527, 196, 401, 399, 428, 406, 304, 231 }; // Lentimas
|
||||
private static ReadOnlySpan<ushort> TutorMoves3 => new ushort[] { 020, 173, 282, 235, 257, 272, 215, 366, 143, 220, 202, 409, 355 }; // Humilau
|
||||
private static ReadOnlySpan<ushort> TutorMoves4 => new ushort[] { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 }; // Nacrene
|
||||
|
||||
public bool GetIsTutorSpecial(ushort move)
|
||||
{
|
||||
|
|
|
@ -148,7 +148,7 @@ public sealed class PersonalInfo6AO : PersonalInfo, IPersonalAbility12H, IPerson
|
|||
|
||||
public bool GetIsTutor1(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves1, move);
|
||||
var index = TutorMoves1.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor1 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ public sealed class PersonalInfo6AO : PersonalInfo, IPersonalAbility12H, IPerson
|
|||
|
||||
public bool GetIsLearnTutor2(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves2, move);
|
||||
var index = TutorMoves2.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor2 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public sealed class PersonalInfo6AO : PersonalInfo, IPersonalAbility12H, IPerson
|
|||
|
||||
public bool GetIsLearnTutor3(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves3, move);
|
||||
var index = TutorMoves3.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor3 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public sealed class PersonalInfo6AO : PersonalInfo, IPersonalAbility12H, IPerson
|
|||
|
||||
public bool GetIsLearnTutor4(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(TutorMoves4, move);
|
||||
var index = TutorMoves4.IndexOf(move);
|
||||
return index >= 0 && (Data[Tutor4 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
}
|
||||
|
||||
|
@ -275,10 +275,10 @@ public sealed class PersonalInfo6AO : PersonalInfo, IPersonalAbility12H, IPerson
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] TutorMoves1 = { 450, 343, 162, 530, 324, 442, 402, 529, 340, 067, 441, 253, 009, 007, 008 };
|
||||
private static readonly ushort[] TutorMoves2 = { 277, 335, 414, 492, 356, 393, 334, 387, 276, 527, 196, 401, 399, 428, 406, 304, 231 };
|
||||
private static readonly ushort[] TutorMoves3 = { 020, 173, 282, 235, 257, 272, 215, 366, 143, 220, 202, 409, 355, 264, 351, 352 }; // Last 3 added, Different from G5 Humilau
|
||||
private static readonly ushort[] TutorMoves4 = { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 };
|
||||
private static ReadOnlySpan<ushort> TutorMoves1 => new ushort[] { 450, 343, 162, 530, 324, 442, 402, 529, 340, 067, 441, 253, 009, 007, 008 };
|
||||
private static ReadOnlySpan<ushort> TutorMoves2 => new ushort[] { 277, 335, 414, 492, 356, 393, 334, 387, 276, 527, 196, 401, 399, 428, 406, 304, 231 };
|
||||
private static ReadOnlySpan<ushort> TutorMoves3 => new ushort[] { 020, 173, 282, 235, 257, 272, 215, 366, 143, 220, 202, 409, 355, 264, 351, 352 }; // Last 3 added, Different from G5 Humilau
|
||||
private static ReadOnlySpan<ushort> TutorMoves4 => new ushort[] { 380, 388, 180, 495, 270, 271, 478, 472, 283, 200, 278, 289, 446, 214, 285 };
|
||||
|
||||
public bool GetIsTutorSpecial(ushort move)
|
||||
{
|
||||
|
|
|
@ -147,7 +147,7 @@ public sealed class PersonalInfo7 : PersonalInfo, IPersonalAbility12H, IPersonal
|
|||
|
||||
public bool GetIsLearnTutorSpecial(ushort move)
|
||||
{
|
||||
var index = Array.IndexOf(Tutors_USUM, move);
|
||||
var index = Tutors_USUM.IndexOf(move);
|
||||
if (index < 0)
|
||||
return false;
|
||||
return (Data[Tutor1 + (index >> 3)] & (1 << (index & 7))) != 0;
|
||||
|
@ -164,7 +164,7 @@ public sealed class PersonalInfo7 : PersonalInfo, IPersonalAbility12H, IPersonal
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] Tutors_USUM =
|
||||
private static ReadOnlySpan<ushort> Tutors_USUM => new ushort[]
|
||||
{
|
||||
450, 343, 162, 530, 324, 442, 402, 529, 340, 067, 441, 253, 009, 007, 008,
|
||||
277, 335, 414, 492, 356, 393, 334, 387, 276, 527, 196, 401, 428, 406, 304, 231,
|
||||
|
|
|
@ -107,7 +107,7 @@ public sealed class PersonalInfo8LA : PersonalInfo, IPersonalAbility12H, IPermit
|
|||
|
||||
public bool GetIsLearnMoveShop(ushort move)
|
||||
{
|
||||
var moves = MoveShopMoves.AsSpan();
|
||||
var moves = MoveShopMoves;
|
||||
var index = moves.IndexOf(move);
|
||||
return index != -1 && IsRecordPermitted(index);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public sealed class PersonalInfo8LA : PersonalInfo, IPersonalAbility12H, IPermit
|
|||
public int RecordCountUsed => MoveShopCount;
|
||||
public bool HasMoveShop => MoveShopBits != 0;
|
||||
|
||||
private static readonly ushort[] MoveShopMoves =
|
||||
private static ReadOnlySpan<ushort> MoveShopMoves => new ushort[]
|
||||
{
|
||||
(int)Move.FalseSwipe,
|
||||
(int)Move.FireFang,
|
||||
|
|
|
@ -207,7 +207,7 @@ public sealed class PersonalInfo8SWSH : PersonalInfo, IPersonalAbility12H, IPers
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ushort[] TM_SWSH =
|
||||
private static ReadOnlySpan<ushort> TM_SWSH => new ushort[]
|
||||
{
|
||||
005, 025, 006, 007, 008, 009, 019, 042, 063, 416,
|
||||
345, 076, 669, 083, 086, 091, 103, 113, 115, 219,
|
||||
|
@ -221,7 +221,7 @@ public sealed class PersonalInfo8SWSH : PersonalInfo, IPersonalAbility12H, IPers
|
|||
604, 678, 595, 598, 206, 403, 684, 693, 707, 784,
|
||||
};
|
||||
|
||||
private static readonly ushort[] TR_SWSH =
|
||||
private static ReadOnlySpan<ushort> TR_SWSH => new ushort[]
|
||||
{
|
||||
014, 034, 053, 056, 057, 058, 059, 067, 085, 087,
|
||||
089, 094, 097, 116, 118, 126, 127, 133, 141, 161,
|
||||
|
@ -235,7 +235,7 @@ public sealed class PersonalInfo8SWSH : PersonalInfo, IPersonalAbility12H, IPers
|
|||
583, 599, 605, 663, 667, 675, 676, 706, 710, 776,
|
||||
};
|
||||
|
||||
private static readonly ushort[] TypeTutor8 =
|
||||
private static ReadOnlySpan<ushort> TypeTutor8 => new ushort[]
|
||||
{
|
||||
(int)Move.GrassPledge,
|
||||
(int)Move.FirePledge,
|
||||
|
@ -247,7 +247,7 @@ public sealed class PersonalInfo8SWSH : PersonalInfo, IPersonalAbility12H, IPers
|
|||
(int)Move.SteelBeam,
|
||||
};
|
||||
|
||||
private static readonly ushort[] Tutors_SWSH =
|
||||
private static ReadOnlySpan<ushort> Tutors_SWSH => new ushort[]
|
||||
{
|
||||
805, 807, 812, 804, 803, 813, 811, 810,
|
||||
815, 814, 797, 806, 800, 809, 799, 808,
|
||||
|
@ -258,19 +258,19 @@ public sealed class PersonalInfo8SWSH : PersonalInfo, IPersonalAbility12H, IPers
|
|||
|
||||
public bool GetIsLearnTM(ushort move)
|
||||
{
|
||||
var index = TM_SWSH.AsSpan().IndexOf(move);
|
||||
var index = TM_SWSH.IndexOf(move);
|
||||
return GetIsLearnTM(index);
|
||||
}
|
||||
|
||||
public bool GetIsLearnTutorType(ushort move)
|
||||
{
|
||||
var index = TypeTutor8.AsSpan().IndexOf(move);
|
||||
var index = TypeTutor8.IndexOf(move);
|
||||
return GetIsLearnTutorType(index);
|
||||
}
|
||||
|
||||
public bool GetIsLearnTutorSpecial(ushort move)
|
||||
{
|
||||
var index = Tutors_SWSH.AsSpan().IndexOf(move);
|
||||
var index = Tutors_SWSH.IndexOf(move);
|
||||
return GetIsLearnTutorSpecial(index);
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public sealed class PersonalInfo9SV : PersonalInfo, IPersonalAbility12H, IPerson
|
|||
public int RecordCountTotal => 200;
|
||||
public int RecordCountUsed => CountTM;
|
||||
|
||||
private static readonly ushort[] TM_SV =
|
||||
private static ReadOnlySpan<ushort> TM_SV => new ushort[]
|
||||
{
|
||||
005, 036, 204, 313, 097, 189, 184, 182, 424, 422,
|
||||
423, 352, 067, 491, 512, 522, 060, 109, 168, 574,
|
||||
|
|
|
@ -20,7 +20,7 @@ public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray
|
|||
|
||||
public override PersonalTable1 Personal { get; }
|
||||
|
||||
public override IReadOnlyList<ushort> HeldItems => Array.Empty<ushort>();
|
||||
public override ReadOnlySpan<ushort> HeldItems => Array.Empty<ushort>();
|
||||
|
||||
public override IReadOnlyList<string> PKMExtensions => Array.FindAll(PKM.Extensions, f =>
|
||||
{
|
||||
|
@ -406,13 +406,11 @@ public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray
|
|||
}
|
||||
}
|
||||
|
||||
private readonly ushort[] LegalItems = Legal.Pouch_Items_RBY;
|
||||
|
||||
public override IReadOnlyList<InventoryPouch> Inventory
|
||||
{
|
||||
get
|
||||
{
|
||||
ushort[] legalItems = LegalItems;
|
||||
ushort[] legalItems = Legal.Pouch_Items_RBY;
|
||||
InventoryPouch[] pouch =
|
||||
{
|
||||
new InventoryPouchGB(InventoryType.Items, legalItems, 99, Offsets.Items, 20),
|
||||
|
|
|
@ -14,7 +14,7 @@ public sealed class SAV1Stadium : SAV_STADIUM
|
|||
|
||||
public override PersonalTable1 Personal => PersonalTable.Y;
|
||||
public override int MaxEV => ushort.MaxValue;
|
||||
public override IReadOnlyList<ushort> HeldItems => Array.Empty<ushort>();
|
||||
public override ReadOnlySpan<ushort> HeldItems => Array.Empty<ushort>();
|
||||
public override GameVersion Version { get; protected set; } = GameVersion.Stadium;
|
||||
|
||||
protected override SAV1Stadium CloneInternal() => new((byte[])Data.Clone(), Japanese);
|
||||
|
|
|
@ -15,7 +15,7 @@ public sealed class SAV1StadiumJ : SAV_STADIUM
|
|||
|
||||
public override PersonalTable1 Personal => PersonalTable.Y;
|
||||
public override int MaxEV => ushort.MaxValue;
|
||||
public override IReadOnlyList<ushort> HeldItems => Array.Empty<ushort>();
|
||||
public override ReadOnlySpan<ushort> HeldItems => Array.Empty<ushort>();
|
||||
public override GameVersion Version { get; protected set; } = GameVersion.StadiumJ;
|
||||
|
||||
protected override SAV1StadiumJ CloneInternal() => new((byte[])Data.Clone());
|
||||
|
|
|
@ -19,7 +19,7 @@ public sealed class SAV2 : SaveFile, ILangDeviantSave, IEventFlagArray, IEventWo
|
|||
public bool Korean { get; }
|
||||
|
||||
public override PersonalTable2 Personal { get; }
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_GSC;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_GSC;
|
||||
|
||||
public override IReadOnlyList<string> PKMExtensions => Array.FindAll(PKM.Extensions, f =>
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ public sealed class SAV2Stadium : SAV_STADIUM
|
|||
|
||||
public override PersonalTable2 Personal => PersonalTable.C;
|
||||
public override int MaxEV => ushort.MaxValue;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_GSC;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_GSC;
|
||||
public override GameVersion Version { get; protected set; } = GameVersion.Stadium2;
|
||||
|
||||
protected override SAV2Stadium CloneInternal() => new((byte[])Data.Clone(), Japanese);
|
||||
|
|
|
@ -180,7 +180,7 @@ public abstract class SAV3 : SaveFile, ILangDeviantSave, IEventFlag37
|
|||
_ => throw new ArgumentOutOfRangeException(nameof(version)),
|
||||
};
|
||||
|
||||
public sealed override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
public sealed override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
|
||||
public sealed override int BoxCount => 14;
|
||||
public sealed override int MaxEV => 255;
|
||||
|
|
|
@ -13,7 +13,7 @@ public sealed class SAV3Colosseum : SaveFile, IGCSaveFile
|
|||
protected internal override string ShortSummary => $"{OT} ({Version}) - {PlayTimeString}";
|
||||
public override string Extension => this.GCExtension();
|
||||
public override PersonalTable3 Personal => PersonalTable.RS;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_COLO;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_COLO;
|
||||
public SAV3GCMemoryCard? MemoryCard { get; init; }
|
||||
|
||||
// 3 Save files are stored
|
||||
|
|
|
@ -13,7 +13,7 @@ public sealed class SAV3RSBox : SaveFile, IGCSaveFile
|
|||
protected internal override string ShortSummary => $"{Version} #{SaveCount:0000}";
|
||||
public override string Extension => this.GCExtension();
|
||||
public override PersonalTable3 Personal => PersonalTable.RS;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_RS;
|
||||
public SAV3GCMemoryCard? MemoryCard { get; init; }
|
||||
private readonly bool Japanese;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public sealed class SAV3XD : SaveFile, IGCSaveFile
|
|||
}
|
||||
|
||||
public override PersonalTable3 Personal => PersonalTable.RS;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_XD;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_XD;
|
||||
|
||||
private readonly bool Japanese;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public sealed class SAV4BR : SaveFile
|
|||
protected internal override string ShortSummary => $"{Version} #{SaveCount:0000}";
|
||||
public override string Extension => string.Empty;
|
||||
public override PersonalTable4 Personal => PersonalTable.DP;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_DP;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_DP;
|
||||
|
||||
private const int SAVE_COUNT = 4;
|
||||
public const int SIZE_HALF = 0x1C0000;
|
||||
|
|
|
@ -25,7 +25,7 @@ public sealed class SAV4DP : SAV4Sinnoh
|
|||
|
||||
protected override SAV4 CloneInternal4() => State.Exportable ? new SAV4DP((byte[])Data.Clone()) : new SAV4DP();
|
||||
public override PersonalTable4 Personal => PersonalTable.DP;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_DP;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_DP;
|
||||
public override int MaxItemID => Legal.MaxItemID_4_DP;
|
||||
|
||||
private const int GeneralSize = 0xC100;
|
||||
|
@ -160,6 +160,14 @@ public sealed class SAV4DP : SAV4Sinnoh
|
|||
public override uint SwarmSeed { get => ReadUInt32LittleEndian(General.AsSpan(0x53C8)); set => WriteUInt32LittleEndian(General.AsSpan(0x53C8), value); }
|
||||
public override uint SwarmMaxCountModulo => 28;
|
||||
|
||||
protected override ReadOnlySpan<ushort> TreeSpecies =>new ushort[]
|
||||
{
|
||||
000, 000, 000, 000, 000, 000,
|
||||
265, 266, 415, 412, 420, 190,
|
||||
415, 412, 420, 190, 214, 265,
|
||||
446, 446, 446, 446, 446, 446,
|
||||
};
|
||||
|
||||
public Roamer4 RoamerMesprit => new(General, 0x73A0);
|
||||
public Roamer4 RoamerCresselia => new(General, 0x73B4);
|
||||
public Roamer4 RoamerUnused => new(General, 0x73C8); // Darkrai
|
||||
|
|
|
@ -26,7 +26,7 @@ public sealed class SAV4HGSS : SAV4
|
|||
protected override SAV4 CloneInternal4() => State.Exportable ? new SAV4HGSS((byte[])Data.Clone()) : new SAV4HGSS();
|
||||
|
||||
public override PersonalTable4 Personal => PersonalTable.HGSS;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_HGSS;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_HGSS;
|
||||
public override int MaxItemID => Legal.MaxItemID_4_HGSS;
|
||||
private const int GeneralSize = 0xF628;
|
||||
private const int StorageSize = 0x12310; // Start 0xF700, +0 starts box data
|
||||
|
|
|
@ -24,7 +24,7 @@ public sealed class SAV4Pt : SAV4Sinnoh
|
|||
public override Zukan4 Dex { get; }
|
||||
protected override SAV4 CloneInternal4() => State.Exportable ? new SAV4Pt((byte[])Data.Clone()) : new SAV4Pt();
|
||||
public override PersonalTable4 Personal => PersonalTable.Pt;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_Pt;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_Pt;
|
||||
public override int MaxItemID => Legal.MaxItemID_4_Pt;
|
||||
|
||||
private const int GeneralSize = 0xCF2C;
|
||||
|
@ -129,6 +129,14 @@ public sealed class SAV4Pt : SAV4Sinnoh
|
|||
public override uint SwarmSeed { get => ReadUInt32LittleEndian(General.AsSpan(0x5664)); set => WriteUInt32LittleEndian(General.AsSpan(0x5664), value); }
|
||||
public override uint SwarmMaxCountModulo => 22;
|
||||
|
||||
protected override ReadOnlySpan<ushort> TreeSpecies => new ushort[]
|
||||
{
|
||||
000, 000, 000, 000, 000, 000,
|
||||
415, 265, 412, 420, 190, 190,
|
||||
412, 420, 415, 190, 190, 214,
|
||||
446, 446, 446, 446, 446, 446,
|
||||
};
|
||||
|
||||
public Roamer4 RoamerMesprit => new(General, 0x7FF4);
|
||||
public Roamer4 RoamerCresselia => new(General, 0x8008);
|
||||
public Roamer4 RoamerUnused => new(General, 0x801C); // Darkrai
|
||||
|
|
|
@ -184,6 +184,12 @@ public abstract class SAV4Sinnoh : SAV4
|
|||
public abstract uint SafariSeed { get; set; }
|
||||
public uint GetSafariIndex(int slot) => (SafariSeed >> (slot * 5)) & 0x1F;
|
||||
public void SetSafariIndex(int slot, uint value) => SafariSeed = (SafariSeed & ~(0x1Fu << (slot * 5))) | (value << (slot * 5));
|
||||
|
||||
protected abstract ReadOnlySpan<ushort> TreeSpecies { get; }
|
||||
private const int GroupEntryCount = 6;
|
||||
|
||||
public ushort GetHoneyTreeSpecies(int group, int index) =>
|
||||
TreeSpecies.Slice(group * GroupEntryCount, GroupEntryCount)[index];
|
||||
}
|
||||
|
||||
public enum PoketchColor
|
||||
|
|
|
@ -15,7 +15,7 @@ public abstract class SAV5 : SaveFile, ISaveBlock5BW, IEventFlag37
|
|||
protected internal override string ShortSummary => $"{OT} ({(GameVersion)Game}) - {PlayTimeString}";
|
||||
public override string Extension => ".sav";
|
||||
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_BW;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_BW;
|
||||
protected override int SIZE_STORED => PokeCrypto.SIZE_5STORED;
|
||||
protected override int SIZE_PARTY => PokeCrypto.SIZE_5PARTY;
|
||||
public override PK5 BlankPKM => new();
|
||||
|
|
|
@ -24,7 +24,7 @@ public sealed class SAV6AO : SAV6, ISaveBlock6AO, IMultiplayerSprite
|
|||
}
|
||||
|
||||
public override PersonalTable6AO Personal => PersonalTable.AO;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItem_AO;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItem_AO;
|
||||
public SaveBlockAccessor6AO Blocks { get; }
|
||||
protected override SAV6AO CloneInternal() => new((byte[])Data.Clone());
|
||||
public override ushort MaxMoveID => Legal.MaxMoveID_6_AO;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -21,7 +22,7 @@ public sealed class SAV6AODemo : SAV6
|
|||
}
|
||||
|
||||
public override PersonalTable6AO Personal => PersonalTable.AO;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItem_AO;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItem_AO;
|
||||
protected override SAV6AODemo CloneInternal() => new((byte[])Data.Clone());
|
||||
public override ushort MaxMoveID => Legal.MaxMoveID_6_AO;
|
||||
public override int MaxItemID => Legal.MaxItemID_6_AO;
|
||||
|
|
|
@ -24,7 +24,7 @@ public sealed class SAV6XY : SAV6, ISaveBlock6XY, IMultiplayerSprite
|
|||
}
|
||||
|
||||
public override PersonalTable6XY Personal => PersonalTable.XY;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItem_XY;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItem_XY;
|
||||
public SaveBlockAccessor6XY Blocks { get; }
|
||||
protected override SAV6XY CloneInternal() => new((byte[])Data.Clone());
|
||||
public override ushort MaxMoveID => Legal.MaxMoveID_6_XY;
|
||||
|
|
|
@ -34,7 +34,7 @@ public sealed class SAV7SM : SAV7, ISaveBlock7SM
|
|||
}
|
||||
|
||||
public override PersonalTable7 Personal => PersonalTable.SM;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_SM;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_SM;
|
||||
protected override SAV7SM CloneInternal() => new((byte[])Data.Clone());
|
||||
|
||||
#region Blocks
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -31,7 +32,7 @@ public sealed class SAV7USUM : SAV7, ISaveBlock7USUM
|
|||
}
|
||||
|
||||
public override PersonalTable7 Personal => PersonalTable.USUM;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_USUM;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_USUM;
|
||||
protected override SAV7USUM CloneInternal() => new((byte[])Data.Clone());
|
||||
public override int EventFlagCount => 4960;
|
||||
public override ushort MaxMoveID => Legal.MaxMoveID_7_USUM;
|
||||
|
|
|
@ -20,7 +20,7 @@ public sealed class SAV7b : SAV_BEEF, ISaveBlock7b, IGameSync, IEventFlagArray
|
|||
public override byte[] GetDataForBox(PKM pk) => pk.EncryptedPartyData;
|
||||
|
||||
public override PersonalTable7GG Personal => PersonalTable.GG;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_GG;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_GG;
|
||||
|
||||
protected override SAV7b CloneInternal() => new((byte[])Data.Clone());
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ public sealed class SAV8BS : SaveFile, ISaveFileRevision, ITrainerStatRecord, IE
|
|||
|
||||
public string SaveRevisionString => ((Gem8Version)SaveRevision).GetSuffixString();
|
||||
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_BS;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_BS;
|
||||
protected override SAV8BS CloneInternal() => new((byte[])(Data.Clone()));
|
||||
|
||||
protected override byte[] GetFinalData()
|
||||
|
|
|
@ -87,7 +87,7 @@ public sealed class SAV8LA : SaveFile, ISaveBlock8LA, ISCBlockArray, ISaveFileRe
|
|||
protected override byte[] GetFinalData() => SwishCrypto.Encrypt(AllBlocks);
|
||||
|
||||
public override PersonalTable8LA Personal => PersonalTable.LA;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_LA;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_LA;
|
||||
|
||||
protected override SAV8LA CloneInternal()
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ public sealed class SAV8SWSH : SaveFile, ISaveBlock8SWSH, ITrainerStatRecord, IS
|
|||
protected override byte[] GetFinalData() => SwishCrypto.Encrypt(AllBlocks);
|
||||
|
||||
public override PersonalTable8SWSH Personal => PersonalTable.SWSH;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_SWSH;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_SWSH;
|
||||
|
||||
#region Blocks
|
||||
public SCBlockAccessor Accessor => Blocks;
|
||||
|
|
|
@ -54,7 +54,7 @@ public sealed class SAV9SV : SaveFile, ISaveBlock9Main, ISCBlockArray, ISaveFile
|
|||
protected override byte[] GetFinalData() => SwishCrypto.Encrypt(AllBlocks);
|
||||
|
||||
public override PersonalTable9SV Personal => PersonalTable.SV;
|
||||
public override IReadOnlyList<ushort> HeldItems => Legal.HeldItems_SV;
|
||||
public override ReadOnlySpan<ushort> HeldItems => Legal.HeldItems_SV;
|
||||
|
||||
#region Blocks
|
||||
public SCBlockAccessor Accessor => Blocks;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue