PKHeX/Tests/PKHeX.Core.Tests/PKM/HiddenPowerTests.cs
Kurt 95fbf66a6e
Refactor: Gen3/4 Lead Encounters, property fixing (#4193)
In addition to the Method 1 (and other sibling PIDIV types) correlation, an encounter can only be triggered if the calls prior land on the Method {1} seed. The RNG community has dubbed these patterns as "Method J" (D/P/Pt), "Method K" (HG/SS), and "Method H" (Gen3, coined by yours truly). The basic gist of these is that they are pre-requisites, like the Shadow locks of Colosseum/XD. 

Rename/re-type a bunch of properties to get the codebase more in line with correct property names & more obvious underlying types.
2024-02-22 21:20:54 -06:00

41 lines
1.3 KiB
C#

using System;
using FluentAssertions;
using Xunit;
namespace PKHeX.Core.Tests.PKM;
public class HiddenPowerTests
{
[Theory]
[InlineData(14, 15, 15, 14, 14, 15, MoveType.Dark, 69, typeof(PK2))]
[InlineData(30, 31, 31, 30, 31, 31, MoveType.Grass, 70, typeof(PK3))]
[InlineData(26, 31, 31, 30, 31, 31, MoveType.Grass, 70, typeof(PK3))]
public void HiddenPowerTest(int h, int a, int b, int c, int d, int s, MoveType type, int power, Type pkmType)
{
var pk = EntityBlank.GetBlank(pkmType);
pk.IV_HP = h;
pk.IV_ATK = a;
pk.IV_DEF = b;
pk.IV_SPA = c;
pk.IV_SPD = d;
pk.IV_SPE = s;
pk.HPType.Should().Be((int)type - 1); // no normal type, down-shift by 1
pk.HPPower.Should().Be(power);
}
[Theory]
[InlineData(15, 15, MoveType.Dark)]
[InlineData(15, 10, MoveType.Dragon)]
public void HiddenPowerTestGen2(int atk, int def, MoveType type)
{
int expect = (int)type - 1; // no normal type, down-shift by 1
var pk2 = new PK2 { IV_ATK = atk, IV_DEF = def };
pk2.HPType.Should().Be(expect);
HiddenPower.GetTypeGB(pk2.DV16).Should().Be(expect);
Span<int> ivs = stackalloc int[6];
pk2.GetIVs(ivs);
HiddenPower.GetTypeGB(ivs).Should().Be(expect);
}
}