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

@@ -14,16 +14,16 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
/// </summary>
public class CaptivateTests
{
private static (Captivate script, IExecutingMove move, IPokemon user, IPokemon target, IHitData hitData)
private static (Captivate script, IExecutingMove move, IBattlePokemon user, IBattlePokemon target, IHitData hitData)
CreateTestSetup(Gender userGender, Gender targetGender)
{
var script = new Captivate();
var move = Substitute.For<IExecutingMove>();
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
user.Gender.Returns(userGender);
move.User.Returns(user);
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
target.Gender.Returns(targetGender);
var hitData = Substitute.For<IHitData>();
move.GetHitData(target, 0).Returns(hitData);
@@ -34,7 +34,7 @@ public class CaptivateTests
/// <summary>
/// Helper that checks whether a stat boost change was applied to the given Pokémon.
/// </summary>
private static bool ReceivedStatBoost(IPokemon pokemon, Statistic stat, sbyte amount) =>
private static bool ReceivedStatBoost(IBattlePokemon pokemon, Statistic stat, sbyte amount) =>
pokemon.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "ChangeStatBoost" &&
(Statistic)c.GetArguments()[0]! == stat &&
(sbyte)c.GetArguments()[1]! == amount);