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

@@ -16,12 +16,12 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves;
public class HelpingHandTests
{
/// <summary>
/// Creates an ally with a real <see cref="ScriptSet"/> as its <see cref="IPokemon.Volatile"/> set, so that
/// Creates an ally with a real <see cref="ScriptSet"/> as its <see cref="IBattlePokemon.Volatile"/> set, so that
/// adding, stacking, and removing the <see cref="HelpingHandEffect"/> behaves as it would in battle.
/// </summary>
private static (IPokemon ally, ScriptSet volatiles) CreateAllyWithRealVolatileSet()
private static (IBattlePokemon ally, ScriptSet volatiles) CreateAllyWithRealVolatileSet()
{
var ally = Substitute.For<IPokemon>();
var ally = Substitute.For<IBattlePokemon>();
var volatiles = new ScriptSet(ally);
// ScriptSet.Add runs the IScriptPreventVolatileAdd hook over the owner's scripts; give the mock a real
// iterator so that hook pass runs (empty of blockers here).
@@ -37,7 +37,7 @@ public class HelpingHandTests
private static ushort RunChangeBasePowerHooks(ScriptSet volatiles, ushort basePower)
{
var allyMove = Substitute.For<IExecutingMove>();
var opponent = Substitute.For<IPokemon>();
var opponent = Substitute.For<IBattlePokemon>();
foreach (var container in volatiles)
{
if (container.Script is IScriptChangeBasePower changeBasePower)
@@ -58,7 +58,7 @@ public class HelpingHandTests
// Arrange
var helpingHand = new HelpingHand();
var move = Substitute.For<IExecutingMove>();
var ally = Substitute.For<IPokemon>();
var ally = Substitute.For<IBattlePokemon>();
// Act
helpingHand.OnSecondaryEffect(move, ally, 0);
@@ -81,7 +81,7 @@ public class HelpingHandTests
// Arrange
var effect = new HelpingHandEffect();
var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
// Act
effect.ChangeBasePower(move, target, 0, ref basePower);
@@ -100,7 +100,7 @@ public class HelpingHandTests
// Arrange
var effect = new HelpingHandEffect();
var move = Substitute.For<IExecutingMove>();
var target = Substitute.For<IPokemon>();
var target = Substitute.For<IBattlePokemon>();
var basePower = ushort.MaxValue;
// Act