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

@@ -20,13 +20,13 @@ public class FuryCutterTests
/// Creates a fully mocked test setup where the user's volatile scripts are a real
/// <see cref="ScriptSet"/>, so the <see cref="FuryCutterEffect"/> added by the move can be inspected.
/// </summary>
private static (FuryCutter script, IExecutingMove move, IPokemon target, IPokemon user, ScriptSet userVolatile)
CreateTestSetup()
private static (FuryCutter script, IExecutingMove move, IBattlePokemon target, IBattlePokemon user, ScriptSet
userVolatile) CreateTestSetup()
{
var script = new FuryCutter();
var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>();
var user = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
var user = Substitute.For<IBattlePokemon>();
var userVolatile = new ScriptSet(user);
user.Volatile.Returns(userVolatile);
user.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
@@ -38,7 +38,8 @@ public class FuryCutterTests
/// Simulates the given number of consecutive uses of Fury Cutter, feeding the Gen VII base power of 40
/// into each use, and returns the base power of the final use.
/// </summary>
private static ushort SimulateConsecutiveUses(FuryCutter script, IExecutingMove move, IPokemon target, int uses)
private static ushort SimulateConsecutiveUses(FuryCutter script, IExecutingMove move, IBattlePokemon target,
int uses)
{
ushort basePower = 40;
for (var i = 0; i < uses; i++)
@@ -127,7 +128,7 @@ public class FuryCutterTests
public async Task OnBeforeMove_DifferentMoveUsed_EffectRemovesItself()
{
// Arrange
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
user.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
var userVolatile = new ScriptSet(user);
var effect = new FuryCutterEffect();
@@ -153,7 +154,7 @@ public class FuryCutterTests
public async Task OnBeforeMove_FuryCutterUsedAgain_EffectPersists()
{
// Arrange
var user = Substitute.For<IPokemon>();
var user = Substitute.For<IBattlePokemon>();
user.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
var userVolatile = new ScriptSet(user);
var effect = new FuryCutterEffect();