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

@@ -21,9 +21,9 @@ public class IngrainTests
/// Creates a rooted Pokémon substitute with the given maximum HP, together with the
/// <see cref="IngrainEffect"/> that roots it.
/// </summary>
private static (IngrainEffect effect, IPokemon owner) CreateRootedPokemon(uint maxHealth = 100)
private static (IngrainEffect effect, IBattlePokemon owner) CreateRootedPokemon(uint maxHealth = 100)
{
var owner = Substitute.For<IPokemon>();
var owner = Substitute.For<IBattlePokemon>();
owner.BoostedStats.Returns(new StatisticSet<uint>(maxHealth, 1, 1, 1, 1, 1));
return (new IngrainEffect(owner), owner);
}
@@ -31,7 +31,7 @@ public class IngrainTests
/// <summary>
/// Helper to extract the heal amount from a Pokémon's received Heal calls.
/// </summary>
private static uint? GetHealAmount(IPokemon pokemon)
private static uint? GetHealAmount(IBattlePokemon pokemon)
{
var call = pokemon.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Heal");
return call != null ? (uint)call.GetArguments()[0]! : null;
@@ -47,12 +47,12 @@ public class IngrainTests
// Arrange
var script = new Ingrain();
var move = Substitute.For<IExecutingMove>();
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
user.GetScripts().Returns(_ => new ScriptIterator(new List<IEnumerable<ScriptContainer>>()));
var userVolatile = new ScriptSet(user);
user.Volatile.Returns(userVolatile);
move.User.Returns(user);
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
// Act
script.OnSecondaryEffect(move, target, 0);