mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-04 01:39:13 +00:00
d5be6254f3
Adds structures to read/write saved spawner data such as seeds, counts. Adds generator and validator to emulate the FixInitSpec builder used by the game logic Similar to SW/SH raids, validating these in-process is not feasible due to the number crunching required. This does not handle the encounter slot call or the follow-up level range call. Just the inner FixInitSpec ctor & fill. level is calc'd: randFloat(sum) -> slot float rand.Next() -> gen_seed (for all the details) rand.NextInt(delta) +min -> level Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using FluentAssertions;
|
|
using Xunit;
|
|
|
|
namespace PKHeX.Core.Tests.Legality;
|
|
|
|
public static class Wild8aRNGTests
|
|
{
|
|
[Fact]
|
|
public static void TryGenerateShinyOutbreakZorua()
|
|
{
|
|
PA8 test = new() { Species = (int)Species.Zorua, Form = 1 };
|
|
const ulong s0 = 0xDF440DA44EEC4FFB;
|
|
|
|
var rand = new Xoroshiro128Plus(s0);
|
|
var param = new OverworldParam8a
|
|
{
|
|
FlawlessIVs = 0, IsAlpha = false,
|
|
Shiny = Shiny.Random, RollCount = 30,
|
|
GenderRatio = 0x7F,
|
|
};
|
|
|
|
var result = Overworld8aRNG.TryApplyFromSeed(test, EncounterCriteria.Unrestricted, param, rand);
|
|
result.Should().BeTrue();
|
|
|
|
test.IV_HP.Should().Be(10);
|
|
test.IV_ATK.Should().Be(13);
|
|
test.IV_DEF.Should().Be(8);
|
|
test.IV_SPA.Should().Be(0);
|
|
test.IV_SPD.Should().Be(17);
|
|
test.IV_SPE.Should().Be(25);
|
|
test.HeightScalar.Should().Be(99);
|
|
test.WeightScalar.Should().Be(153);
|
|
|
|
var verify = Overworld8aRNG.Verify(test, s0, param);
|
|
verify.Should().BeTrue();
|
|
}
|
|
}
|