mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
88830e0d00
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now. Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes. Adds functionality for Batch Editor commands to `>`, `<` and <=/>= TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants. Main window has a new layout to account for DPI scaling (8 point grid) Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724) Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720) Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714) Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691) Added: Properties for ribbon/mark count (closes #3659) Fixed: Traded SV eggs are now checked correctly (closes #3692)
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using System;
|
|
using Xunit;
|
|
using FluentAssertions;
|
|
|
|
namespace PKHeX.Core.Tests.Saves;
|
|
|
|
public static class PokeDex
|
|
{
|
|
[Theory]
|
|
[InlineData(Species.Bulbasaur)]
|
|
[InlineData(Species.Voltorb)]
|
|
[InlineData(Species.Genesect)]
|
|
public static void Gen5(Species species)
|
|
{
|
|
var bw = new SAV5B2W2();
|
|
SetDexSpecies(bw, (ushort)species, 0x54);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(Species.Landorus)]
|
|
public static void Gen5Form(Species species)
|
|
{
|
|
var bw = new SAV5B2W2();
|
|
SetDexSpecies(bw, (ushort)species, 0x54);
|
|
CheckDexFlags5(bw, (ushort)species, 0, 0x54, 0xB);
|
|
}
|
|
|
|
private static void SetDexSpecies(SaveFile sav, ushort species, int regionSize)
|
|
{
|
|
var pk5 = new PK5 {Species = species, TID16 = 1337}; // non-shiny
|
|
pk5.Gender = pk5.GetSaneGender();
|
|
|
|
sav.SetBoxSlotAtIndex(pk5, 0);
|
|
|
|
CheckFlags(sav, species, regionSize);
|
|
}
|
|
|
|
private static void CheckFlags(SaveFile sav, ushort species, int regionSize)
|
|
{
|
|
var dex = sav.PokeDex;
|
|
var data = sav.Data;
|
|
|
|
var bit = species - 1;
|
|
var value = (byte) (1 << (bit & 7));
|
|
var offset = bit >> 3;
|
|
|
|
// Check the regular flag regions.
|
|
var span = data.AsSpan(dex + 0x08);
|
|
span[offset].Should().Be(value, "caught flag");
|
|
span[offset + regionSize].Should().Be(value, "seen flag");
|
|
span[offset + regionSize + (regionSize * 4)].Should().Be(value, "displayed flag");
|
|
}
|
|
|
|
private static void CheckDexFlags5(SaveFile sav, ushort species, byte form, int regionSize, int formRegionSize)
|
|
{
|
|
var dex = sav.PokeDex;
|
|
var data = sav.Data;
|
|
|
|
var fc = sav.Personal[species].FormCount;
|
|
var bit = ((SAV5)sav).Zukan.DexFormIndexFetcher(species, fc);
|
|
if (bit < 0)
|
|
return;
|
|
bit += form;
|
|
var value = (byte)(1 << (bit & 7));
|
|
var offset = bit >> 3;
|
|
|
|
// Check the form flag regions.
|
|
var span = data.AsSpan(dex + 0x08 + (regionSize * 9));
|
|
span[offset].Should().Be(value, "seen flag");
|
|
span[offset + (formRegionSize * 2)].Should().Be(value, "displayed flag");
|
|
}
|
|
}
|