mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Fix Stationary haxorus encounter gen
remove unnecessary %25 check (only applicable for gen4 encounters), unneeded for gen5 method. add a test case to generate a haxorus for all natures, verify shininess Closes #2336
This commit is contained in:
parent
9be5bd1abc
commit
71fdd01a93
|
|
@ -266,7 +266,7 @@ public static uint GetPokeWalkerPID(int TID, int SID, uint nature, int gender, i
|
|||
public static void SetValuesFromSeedMG5Shiny(PKM pk, uint seed)
|
||||
{
|
||||
var gv = seed >> 24;
|
||||
var av = seed & 1;
|
||||
var av = seed & 1; // arbitrary choice
|
||||
pk.PID = GetMG5ShinyPID(gv, av, pk.TID, pk.SID);
|
||||
SetRandomIVs(pk);
|
||||
}
|
||||
|
|
@ -377,8 +377,6 @@ private static void SetRandomWildPID5(PKM pk, int nature, int ability, int gende
|
|||
seed ^= 1;
|
||||
}
|
||||
|
||||
if (seed % 25 != nature)
|
||||
continue;
|
||||
if (((seed >> 16) & 1) != ability)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using PKHeX.Core;
|
||||
using Xunit;
|
||||
|
|
@ -7,6 +8,12 @@ namespace PKHeX.Tests.Simulator
|
|||
{
|
||||
public class GeneratorTests
|
||||
{
|
||||
static GeneratorTests()
|
||||
{
|
||||
if (!EncounterEvent.Initialized)
|
||||
EncounterEvent.RefreshMGDB();
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> PokemonGenerationTestData()
|
||||
{
|
||||
for (int i = 1; i <= 807; i++)
|
||||
|
|
@ -33,5 +40,30 @@ public void PokemonGenerationReturnsLegalPokemon(int species)
|
|||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanGenerateMG5Case()
|
||||
{
|
||||
const Species spec = Species.Haxorus;
|
||||
var pk = new PK5 {Species = (int) spec};
|
||||
var ez = EncounterMovesetGenerator.GenerateEncounters(pk, null, GameVersion.W2).OfType<EncounterStatic>().FirstOrDefault();
|
||||
ez.Should().NotBeNull("Shiny Haxorus stationary encounter exists for B2/W2");
|
||||
|
||||
var criteria = new EncounterCriteria();
|
||||
var tr = new SimpleTrainerInfo
|
||||
{
|
||||
TID = 57600,
|
||||
SID = 62446,
|
||||
};
|
||||
for (var nature = Nature.Hardy; nature <= Nature.Quirky; nature++)
|
||||
{
|
||||
criteria.Nature = nature;
|
||||
var pkm = ez.ConvertToPKM(tr, criteria);
|
||||
pkm.Nature.Should().Be((int)nature, "not nature locked");
|
||||
pkm.IsShiny.Should().BeTrue("encounter is shiny locked");
|
||||
pkm.TID.Should().Be(tr.TID);
|
||||
pkm.SID.Should().Be(tr.SID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user