Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -22,14 +22,14 @@ public class LeechSeedTests
|
||||
/// Creates a fully mocked test setup for the <see cref="LeechSeed"/> move script, with a target of the
|
||||
/// given types.
|
||||
/// </summary>
|
||||
private static (LeechSeed script, IExecutingMove move, IPokemon target, IScriptSet targetVolatile, IHitData hitData)
|
||||
CreateMoveSetup(params TypeIdentifier[] targetTypes)
|
||||
private static (LeechSeed script, IExecutingMove move, IBattlePokemon target, IScriptSet targetVolatile, IHitData
|
||||
hitData) CreateMoveSetup(params TypeIdentifier[] targetTypes)
|
||||
{
|
||||
var script = new LeechSeed();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
move.User.Returns(user);
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
target.Types.Returns(targetTypes);
|
||||
var targetVolatile = Substitute.For<IScriptSet>();
|
||||
target.Volatile.Returns(targetVolatile);
|
||||
@@ -41,13 +41,13 @@ public class LeechSeedTests
|
||||
/// <summary>
|
||||
/// Creates a mocked seeded Pokémon and placer for <see cref="LeechSeedEffect"/> tests.
|
||||
/// </summary>
|
||||
private static (LeechSeedEffect effect, IPokemon seeded, IPokemon placer) CreateEffectSetup(uint maxHp,
|
||||
private static (LeechSeedEffect effect, IBattlePokemon seeded, IBattlePokemon placer) CreateEffectSetup(uint maxHp,
|
||||
uint currentHp)
|
||||
{
|
||||
var seeded = Substitute.For<IPokemon>();
|
||||
var seeded = Substitute.For<IBattlePokemon>();
|
||||
seeded.MaxHealth.Returns(maxHp);
|
||||
seeded.CurrentHealth.Returns(currentHp);
|
||||
var placer = Substitute.For<IPokemon>();
|
||||
var placer = Substitute.For<IBattlePokemon>();
|
||||
var effect = new LeechSeedEffect(seeded, placer);
|
||||
return (effect, seeded, placer);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class LeechSeedTests
|
||||
/// Helper to extract the heal amount from a substitute's received Heal calls, or null when Heal was
|
||||
/// never called.
|
||||
/// </summary>
|
||||
private static uint? GetHealAmount(IPokemon pokemon)
|
||||
private static uint? GetHealAmount(IBattlePokemon pokemon)
|
||||
{
|
||||
var call = pokemon.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Heal");
|
||||
return call != null ? (uint)call.GetArguments()[0]! : null;
|
||||
@@ -66,7 +66,7 @@ public class LeechSeedTests
|
||||
/// Helper to extract the damage amount from a substitute's received Damage calls, or null when Damage
|
||||
/// was never called.
|
||||
/// </summary>
|
||||
private static uint? GetDamageAmount(IPokemon pokemon)
|
||||
private static uint? GetDamageAmount(IBattlePokemon pokemon)
|
||||
{
|
||||
var call = pokemon.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Damage");
|
||||
return call != null ? (uint)call.GetArguments()[0]! : null;
|
||||
|
||||
Reference in New Issue
Block a user