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,14 +14,15 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
/// </summary>
public class FlatterTests
{
private static (Flatter script, IExecutingMove move, IPokemon target, IScriptSet targetVolatile) CreateTestSetup()
private static (Flatter script, IExecutingMove move, IBattlePokemon target, IScriptSet targetVolatile)
CreateTestSetup()
{
var script = new Flatter();
var move = Substitute.For<IExecutingMove>();
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
move.User.Returns(user);
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
var targetVolatile = Substitute.For<IScriptSet>();
target.Volatile.Returns(targetVolatile);
@@ -34,7 +35,7 @@ public class FlatterTests
/// the trailing <see cref="EventBatchId"/> parameter cannot be bound by <c>Arg.Any</c> (its
/// parameterless constructor initializes a fresh id, so it never equals the matcher's default value).
/// </summary>
private static object?[]? GetStatBoostArgs(IPokemon pokemon)
private static object?[]? GetStatBoostArgs(IBattlePokemon pokemon)
{
var call = pokemon.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "ChangeStatBoost");
return call?.GetArguments();
@@ -64,7 +65,7 @@ public class FlatterTests
/// <summary>
/// Bulbapedia: Flatter raises the target's Special Attack "and confuses it". The confusion is applied
/// through the target's <see cref="IPokemon.Volatile"/> script set.
/// through the target's <see cref="IBattlePokemon.Volatile"/> script set.
/// </summary>
[Test]
public async Task OnSecondaryEffect_Always_ConfusesTarget()
@@ -101,7 +102,7 @@ public class FlatterTests
/// <summary>
/// Bulbapedia: "Even if the target's Special Attack is already at +6 stages, it will still become
/// confused." A substitute's <see cref="IPokemon.ChangeStatBoost"/> returns false by default (the
/// confused." A substitute's <see cref="IBattlePokemon.ChangeStatBoost"/> returns false by default (the
/// boost failed), yet the confusion is still applied.
/// </summary>
[Test]