Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper

This commit is contained in:
2026-08-28 15:20:26 +02:00
parent 942be8eaeb
commit 8a2733a0a9
859 changed files with 4408 additions and 5331 deletions

View File

@@ -12,11 +12,11 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
/// </summary>
public class DragonAscentTests
{
private static (DragonAscent script, IExecutingMove move, IPokemon user) CreateTestSetup()
private static (DragonAscent script, IExecutingMove move, IBattlePokemon user) CreateTestSetup()
{
var script = new DragonAscent();
var move = Substitute.For<IExecutingMove>();
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
move.User.Returns(user);
return (script, move, user);
}
@@ -25,7 +25,7 @@ public class DragonAscentTests
/// Helper checking whether the given Pokémon received a ChangeStatBoost call for the given stat with
/// a one-stage self-inflicted, non-forced drop.
/// </summary>
private static bool ReceivedSelfInflictedDrop(IPokemon pokemon, Statistic stat) =>
private static bool ReceivedSelfInflictedDrop(IBattlePokemon pokemon, Statistic stat) =>
pokemon.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "ChangeStatBoost" &&
(Statistic)c.GetArguments()[0]! == stat && (sbyte)c.GetArguments()[1]! == -1 &&
(bool)c.GetArguments()[2]! && !(bool)c.GetArguments()[3]!);
@@ -39,7 +39,7 @@ public class DragonAscentTests
{
// Arrange
var (script, move, user) = CreateTestSetup();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
// Act
script.OnSecondaryEffect(move, target, 0);
@@ -57,7 +57,7 @@ public class DragonAscentTests
{
// Arrange
var (script, move, user) = CreateTestSetup();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
// Act
script.OnSecondaryEffect(move, target, 0);
@@ -75,7 +75,7 @@ public class DragonAscentTests
{
// Arrange
var (script, move, _) = CreateTestSetup();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
// Act
script.OnSecondaryEffect(move, target, 0);
@@ -93,7 +93,7 @@ public class DragonAscentTests
{
// Arrange
var (script, move, user) = CreateTestSetup();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
// Act
script.OnSecondaryEffect(move, target, 0);