Handle suggestions

This commit is contained in:
Kurt 2022-01-17 20:21:33 -08:00
parent 51090d0be8
commit 38809f67dd
2 changed files with 7 additions and 11 deletions

View file

@ -78,7 +78,7 @@ namespace PKHeX.Core
for (var i = 0; i < ivs.Length; i++) for (var i = 0; i < ivs.Length; i++)
{ {
if (ivs[i] == UNSET) if (ivs[i] == UNSET)
ivs[i] = (int)xors.NextInt(0, MAX + 1); ivs[i] = xors.NextInt(0, MAX + 1);
} }
if (!criteria.IsIVsCompatible(ivs, 8)) if (!criteria.IsIVsCompatible(ivs, 8))
@ -116,11 +116,10 @@ namespace PKHeX.Core
pk.Gender = next; pk.Gender = next;
} }
// Skip nature, assuming Synchronize if (criteria.Nature is Nature.Random)
if (criteria.Nature >= 0 && (int)criteria.Nature < 25)
pk.Nature = (int)criteria.Nature;
else
pk.Nature = (int)xors.NextUInt(25); pk.Nature = (int)xors.NextUInt(25);
else // Skip nature, assuming Synchronize
pk.Nature = (int)criteria.Nature;
pk.StatNature = pk.Nature; pk.StatNature = pk.Nature;
// Remainder // Remainder

View file

@ -1,7 +1,4 @@
using System; using FluentAssertions;
using System.Collections.Generic;
using FluentAssertions;
using PKHeX.Core;
using Xunit; using Xunit;
namespace PKHeX.Core.Tests.Legality namespace PKHeX.Core.Tests.Legality
@ -12,8 +9,8 @@ namespace PKHeX.Core.Tests.Legality
public static void TryGenerateLatias() public static void TryGenerateLatias()
{ {
PB8 test = new() { Species = (int)Species.Latias}; PB8 test = new() { Species = (int)Species.Latias};
ulong s0 = 0xdf9cf5c73e4a160b; const ulong s0 = 0xdf9cf5c73e4a160b;
ulong s1 = 0xd0b8383103a7f201; const ulong s1 = 0xd0b8383103a7f201;
Wild8bRNG.TryApplyFromSeed(test, EncounterCriteria.Unrestricted, Shiny.Random, 3, new XorShift128(s0, s1)); Wild8bRNG.TryApplyFromSeed(test, EncounterCriteria.Unrestricted, Shiny.Random, 3, new XorShift128(s0, s1));
test.IV_HP.Should().Be(31); test.IV_HP.Should().Be(31);
test.IV_ATK.Should().Be(4); test.IV_ATK.Should().Be(4);