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,11 +21,11 @@ public class FeintTests
/// Creates a fully mocked test setup where the target has a real <see cref="ScriptSet"/> as its volatile
/// script set.
/// </summary>
private static (Feint script, IExecutingMove move, IPokemon target, IScriptSet volatileSet) CreateTestSetup()
private static (Feint script, IExecutingMove move, IBattlePokemon target, IScriptSet volatileSet) CreateTestSetup()
{
var script = new Feint();
var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
target.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
IScriptSet volatileSet = new ScriptSet(target);
target.Volatile.Returns(volatileSet);
@@ -36,16 +36,14 @@ public class FeintTests
/// Extends the test setup with a battle side that has a real <see cref="ScriptSet"/> as its volatile
/// scripts, so side-wide protections such as <see cref="CraftyShieldEffect"/> can be attached.
/// </summary>
private static IScriptSet AttachSide(IPokemon target)
private static IScriptSet AttachSide(IBattlePokemon target)
{
var side = Substitute.For<IBattleSide>();
side.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
IScriptSet sideScripts = new ScriptSet(side);
side.VolatileScripts.Returns(sideScripts);
var battleData = Substitute.For<IPokemonBattleData>();
battleData.BattleSide.Returns(side);
target.BattleData.Returns(battleData);
target.BattleSide.Returns(side);
return sideScripts;
}