2023-01-22 04:02:33 +00:00
|
|
|
using System;
|
2020-09-15 03:06:11 +00:00
|
|
|
using FluentAssertions;
|
|
|
|
using Xunit;
|
|
|
|
|
2023-01-22 04:02:33 +00:00
|
|
|
namespace PKHeX.Core.Tests.PKM;
|
2022-06-18 18:04:24 +00:00
|
|
|
|
|
|
|
public class HiddenPowerTests
|
2020-09-15 03:06:11 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
[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)
|
2020-09-15 03:06:11 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
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;
|
2020-09-15 03:06:11 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
pk.HPType.Should().Be((int)type - 1); // no normal type, down-shift by 1
|
|
|
|
pk.HPPower.Should().Be(power);
|
2020-09-15 03:06:11 +00:00
|
|
|
}
|
2023-12-04 04:13:20 +00:00
|
|
|
|
|
|
|
[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);
|
2024-02-23 03:20:54 +00:00
|
|
|
|
|
|
|
Span<int> ivs = stackalloc int[6];
|
|
|
|
pk2.GetIVs(ivs);
|
|
|
|
HiddenPower.GetTypeGB(ivs).Should().Be(expect);
|
2023-12-04 04:13:20 +00:00
|
|
|
}
|
2020-09-15 03:06:11 +00:00
|
|
|
}
|