mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Misc tweaks
No functional change
This commit is contained in:
parent
0742c1b891
commit
da9d09ea76
9 changed files with 38 additions and 10 deletions
|
@ -49,7 +49,7 @@ public ref struct XorShift128
|
|||
|
||||
public (uint x, uint y, uint z, uint w) GetState32() => (x, y, z, w);
|
||||
public (ulong s0, ulong s1) GetState64() => (s0, s1);
|
||||
public string GetState128 => $"{s1:X16}{s0:X16}";
|
||||
public string FullState => $"{s1:X16}{s0:X16}";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the next random <see cref="ulong"/>.
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
public (ulong s0, ulong s1) GetState() => (s0, s1);
|
||||
public string FullState => $"{s1:X16}{s0:X16}";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static ulong RotateLeft(ulong x, int k)
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
public (ulong s0, ulong s1) GetState() => (s0, s1);
|
||||
public string FullState => $"{s1:X16}{s0:X16}";
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static ulong RotateLeft(ulong x, int k)
|
||||
|
|
|
@ -55,14 +55,12 @@ namespace PKHeX.Core
|
|||
|
||||
public override bool CanWinLotoID(int item) => LotoPrizeSWSH.Contains((ushort)item);
|
||||
|
||||
public override bool CanBuyItem(int item, GameVersion version)
|
||||
public override bool CanBuyItem(int item, GameVersion version) => item switch
|
||||
{
|
||||
if (item is 1085) // Bob's Food Tin
|
||||
return version is GameVersion.SW or GameVersion.Any;
|
||||
if (item is 1086) // Bach's Food Tin
|
||||
return version is GameVersion.SH or GameVersion.Any;
|
||||
return PurchaseableItemSWSH.Contains((ushort)item);
|
||||
}
|
||||
1085 => version is GameVersion.SW or GameVersion.Any, // Bob's Food Tin
|
||||
1086 => version is GameVersion.SH or GameVersion.Any, // Bach's Food Tin
|
||||
_ => PurchaseableItemSWSH.Contains((ushort)item),
|
||||
};
|
||||
|
||||
private static bool IsInvalidGenLoc8(int memory, int loc, int egg, int variable, PKM pk, IEncounterTemplate enc)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,12 @@ namespace PKHeX.Core
|
|||
|
||||
/// <summary> Creates a copy of the object. </summary>
|
||||
public new InventoryItem7b Clone() => (InventoryItem7b)MemberwiseClone();
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Index = Count = 0;
|
||||
IsFreeSpace = IsNew = false;
|
||||
}
|
||||
|
||||
public static InventoryItem7b GetValue(uint value) => new()
|
||||
{
|
||||
|
|
|
@ -10,6 +10,12 @@ namespace PKHeX.Core
|
|||
|
||||
/// <summary> Creates a copy of the object. </summary>
|
||||
public new InventoryItem8 Clone() => (InventoryItem8)MemberwiseClone();
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Index = Count = 0;
|
||||
IsFavorite = IsNew = false;
|
||||
}
|
||||
|
||||
public static InventoryItem8 GetValue(uint value) => new()
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace PKHeX.Core
|
|||
public sealed class InventoryItem8b : InventoryItem, IItemFavorite, IItemNew
|
||||
{
|
||||
public const int SIZE = 0x10;
|
||||
private const ushort SortOrderNone = 0;
|
||||
|
||||
public bool IsFavorite { get; set; }
|
||||
public bool IsNew { get; set; }
|
||||
|
@ -16,10 +17,18 @@ namespace PKHeX.Core
|
|||
/// <summary> Creates a copy of the object. </summary>
|
||||
public new InventoryItem8b Clone() => (InventoryItem8b)MemberwiseClone();
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Index = Count = 0;
|
||||
IsFavorite = false;
|
||||
IsNew = true;
|
||||
SortOrder = SortOrderNone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the item has been acquired by the player.
|
||||
/// </summary>
|
||||
public bool IsValidSaveSortNumberCount => SortOrder != 0;
|
||||
public bool IsValidSaveSortNumberCount => SortOrder != SortOrderNone;
|
||||
|
||||
public static InventoryItem8b Read(ushort index, ReadOnlySpan<byte> data) => new()
|
||||
{
|
||||
|
|
|
@ -52,6 +52,13 @@ namespace PKHeX.Core
|
|||
|
||||
/// <summary> Creates a copy of the object. </summary>
|
||||
public new InventoryItem7 Clone() => (InventoryItem7)MemberwiseClone();
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Index = Count = 0;
|
||||
FreeSpaceIndex = 0;
|
||||
IsNew = false;
|
||||
}
|
||||
|
||||
public static InventoryItem7 GetValue(uint value) => new()
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace PKHeX.WinForms
|
|||
new Task(() => splash.ShowDialog()).Start();
|
||||
new Task(() => EncounterEvent.RefreshMGDB(WinForms.Main.MGDatabasePath)).Start();
|
||||
var main = new Main();
|
||||
splash.Invoke((MethodInvoker)(() => splash.Close()));
|
||||
splash.Invoke(() => splash.Close());
|
||||
Application.Run(main);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue