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

@@ -10,11 +10,11 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
/// </summary>
public class ExplosionTests
{
private static (Explosion script, IExecutingMove move, IPokemon user) CreateTestSetup(uint currentHealth)
private static (Explosion script, IExecutingMove move, IBattlePokemon user) CreateTestSetup(uint currentHealth)
{
var script = new Explosion();
var move = Substitute.For<IExecutingMove>();
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
user.CurrentHealth.Returns(currentHealth);
move.User.Returns(user);
return (script, move, user);
@@ -23,7 +23,7 @@ public class ExplosionTests
/// <summary>
/// Helper to extract the damage amount from the user's received Damage calls.
/// </summary>
private static uint? GetDamageAmount(IPokemon user)
private static uint? GetDamageAmount(IBattlePokemon user)
{
var call = user.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Damage");
return call != null ? (uint)call.GetArguments()[0]! : null;
@@ -40,7 +40,7 @@ public class ExplosionTests
var (script, move, user) = CreateTestSetup(100);
// Act
script.OnAfterHits(move, Substitute.For<IPokemon>());
script.OnAfterHits(move, Substitute.For<IBattlePokemon>());
// Assert
var damage = GetDamageAmount(user);
@@ -60,7 +60,7 @@ public class ExplosionTests
var (script, move, user) = CreateTestSetup(100);
// Act
script.OnAfterHits(move, Substitute.For<IPokemon>());
script.OnAfterHits(move, Substitute.For<IBattlePokemon>());
// Assert
var call = user.ReceivedCalls().First(c => c.GetMethodInfo().Name == "Damage");