Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -26,9 +26,9 @@ public class MirrorCoatTests
|
||||
/// Creates a Pokémon substitute with a real (empty) volatile script set, so that volatile lookups
|
||||
/// behave like they would on a real Pokémon.
|
||||
/// </summary>
|
||||
private static IPokemon CreatePokemonWithEmptyVolatile()
|
||||
private static IBattlePokemon CreatePokemonWithEmptyVolatile()
|
||||
{
|
||||
var pokemon = Substitute.For<IPokemon>();
|
||||
var pokemon = Substitute.For<IBattlePokemon>();
|
||||
var volatileSet = new ScriptSet(pokemon);
|
||||
pokemon.Volatile.Returns(volatileSet);
|
||||
pokemon.GetScripts().Returns(_ => new ScriptIterator(new List<IEnumerable<ScriptContainer>>()));
|
||||
@@ -39,7 +39,7 @@ public class MirrorCoatTests
|
||||
/// Creates a Mirror Coat user that has declared Mirror Coat this turn: <see cref="MirrorCoat"/>'s
|
||||
/// <c>OnBeforeTurnStart</c> has run, so the helper volatile script is attached to the user.
|
||||
/// </summary>
|
||||
private static (MirrorCoat script, IPokemon user) CreateMirrorCoatUser()
|
||||
private static (MirrorCoat script, IBattlePokemon user) CreateMirrorCoatUser()
|
||||
{
|
||||
var script = new MirrorCoat();
|
||||
var user = CreatePokemonWithEmptyVolatile();
|
||||
@@ -53,7 +53,7 @@ public class MirrorCoatTests
|
||||
/// Simulates the user being hit by a move of the given category dealing the given damage, by invoking
|
||||
/// the helper volatile script's <see cref="IScriptOnIncomingHit.OnIncomingHit"/> hook.
|
||||
/// </summary>
|
||||
private static void ReceiveHit(IPokemon user, IPokemon attacker, uint damage,
|
||||
private static void ReceiveHit(IBattlePokemon user, IBattlePokemon attacker, uint damage,
|
||||
MoveCategory category = MoveCategory.Special)
|
||||
{
|
||||
var incoming = Substitute.For<IExecutingMove>();
|
||||
@@ -72,7 +72,8 @@ public class MirrorCoatTests
|
||||
/// <summary>
|
||||
/// Creates the executing Mirror Coat move of <paramref name="user"/> against <paramref name="target"/>.
|
||||
/// </summary>
|
||||
private static (IExecutingMove move, IHitData hitData) CreateExecutingMirrorCoat(IPokemon user, IPokemon target)
|
||||
private static (IExecutingMove move, IHitData hitData) CreateExecutingMirrorCoat(IBattlePokemon user,
|
||||
IBattlePokemon target)
|
||||
{
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
move.User.Returns(user);
|
||||
@@ -225,7 +226,7 @@ public class MirrorCoatTests
|
||||
ReceiveHit(user, attacker, 40);
|
||||
var choice = Substitute.For<IMoveChoice>();
|
||||
choice.User.Returns(user);
|
||||
IReadOnlyList<IPokemon?> targets = [CreatePokemonWithEmptyVolatile()];
|
||||
IReadOnlyList<IBattlePokemon?> targets = [CreatePokemonWithEmptyVolatile()];
|
||||
|
||||
// Act & Assert - the script must expose the redirection hook and point the move at the attacker
|
||||
var changeTargets = script as IScriptChangeTargets;
|
||||
|
||||
Reference in New Issue
Block a user