mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-19 20:28:24 -05:00
Minor allocation reduction
This commit is contained in:
parent
b869107c84
commit
9049ef99fd
|
|
@ -29,7 +29,7 @@ public EncounterStatic8N(byte nestID, uint minRank, uint maxRank, byte val, Game
|
|||
FlawlessIVCount = val;
|
||||
}
|
||||
|
||||
private static readonly int[] LevelCaps =
|
||||
private static readonly byte[] LevelCaps =
|
||||
{
|
||||
15, 20, // 0
|
||||
25, 30, // 1
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using static PKHeX.Core.StaticCorrelation8bRequirement;
|
||||
|
||||
namespace PKHeX.Core
|
||||
|
|
@ -23,7 +22,18 @@ protected override bool IsMatchLocation(PKM pkm)
|
|||
{
|
||||
if (!Roaming)
|
||||
return base.IsMatchLocation(pkm);
|
||||
return Roaming_MetLocation_BDSP.Contains(pkm.Met_Location);
|
||||
return IsRoamingLocation(pkm);
|
||||
}
|
||||
|
||||
private static bool IsRoamingLocation(PKM pkm)
|
||||
{
|
||||
var location = pkm.Met_Location;
|
||||
foreach (var value in Roaming_MetLocation_BDSP)
|
||||
{
|
||||
if (value == location)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public StaticCorrelation8bRequirement GetRequirement(PKM pk) => Roaming
|
||||
|
|
@ -77,7 +87,7 @@ protected override void SetMetData(PKM pk, int level, DateTime today)
|
|||
}
|
||||
|
||||
// defined by mvpoke in encounter data
|
||||
private static readonly int[] Roaming_MetLocation_BDSP =
|
||||
private static readonly ushort[] Roaming_MetLocation_BDSP =
|
||||
{
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ private static int JSlot(SlotType type, uint rand)
|
|||
|
||||
private readonly record struct Range(uint Min, uint Max);
|
||||
|
||||
private static Range[] GetRanges(params uint[] rates)
|
||||
private static Range[] GetRanges(params byte[] rates)
|
||||
{
|
||||
var len = rates.Length;
|
||||
var arr = new Range[len];
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ private static uint GetShinyXor(uint pid, uint oid)
|
|||
return (xor ^ (xor >> 16)) & 0xFFFF;
|
||||
}
|
||||
|
||||
private static readonly int[] Nature0 = {3, 4, 2, 8, 9, 19, 22, 11, 13, 14, 0, 6, 24};
|
||||
private static readonly int[] Nature1 = {1, 5, 7, 10, 12, 15, 16, 17, 18, 20, 21, 23};
|
||||
private static readonly byte[] Nature0 = {3, 4, 2, 8, 9, 19, 22, 11, 13, 14, 0, 6, 24};
|
||||
private static readonly byte[] Nature1 = {1, 5, 7, 10, 12, 15, 16, 17, 18, 20, 21, 23};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public static class PokedexConstants8a
|
|||
{
|
||||
public const int MaxPokedexResearchPoints = 60000;
|
||||
|
||||
public static readonly int[] ResearchPointsForRank =
|
||||
public static readonly ushort[] ResearchPointsForRank =
|
||||
{
|
||||
0, 500, 1800, 3500, 6000, 8500, 11000, 15000, 20000, 30000, 60000,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -601,10 +601,11 @@ private void UpdateAllCompleteFlags()
|
|||
|
||||
public static int GetResearchPoint(int rank)
|
||||
{
|
||||
if ((uint)rank >= PokedexConstants8a.ResearchPointsForRank.Length)
|
||||
var table = PokedexConstants8a.ResearchPointsForRank;
|
||||
if ((uint)rank >= table.Length)
|
||||
return 0;
|
||||
|
||||
return PokedexConstants8a.ResearchPointsForRank[rank];
|
||||
return table[rank];
|
||||
}
|
||||
|
||||
public int GetCurrentReportCounter() => SaveData.GetReportCounter();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user