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

@@ -17,12 +17,12 @@ public class DreamEaterTests
/// <summary>
/// Creates a fully mocked test setup for Dream Eater tests.
/// </summary>
private static (DreamEater script, IExecutingMove move, IPokemon target, IPokemon user) CreateTestSetup(uint damage,
bool holdsBigRoot = false, Script[]? targetScripts = null)
private static (DreamEater script, IExecutingMove move, IBattlePokemon target, IBattlePokemon user) CreateTestSetup(
uint damage, bool holdsBigRoot = false, Script[]? targetScripts = null)
{
var script = new DreamEater();
var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
var hitData = Substitute.For<IHitData>();
hitData.Damage.Returns(damage);
move.GetHitData(target, 0).Returns(hitData);
@@ -33,7 +33,7 @@ public class DreamEaterTests
.ToArray();
target.GetScripts().Returns(_ => new ScriptIterator(containers));
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
if (holdsBigRoot)
user.HasHeldItem("big_root").Returns(true);
move.User.Returns(user);
@@ -44,7 +44,7 @@ public class DreamEaterTests
/// <summary>
/// Helper to extract the heal amount from the user's received Heal calls.
/// </summary>
private static uint? GetHealAmount(IPokemon user)
private static uint? GetHealAmount(IBattlePokemon user)
{
var call = user.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Heal");
return call != null ? (uint)call.GetArguments()[0]! : null;