Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -19,16 +19,16 @@ public class HighJumpKickTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a fully mocked test setup for High Jump Kick tests, with the given user max HP
|
||||
/// (<see cref="IPokemon.BoostedStats"/>) and hit data. The engine calculates a hit's damage before the
|
||||
/// (<see cref="IBattlePokemon.BoostedStats"/>) and hit data. The engine calculates a hit's damage before the
|
||||
/// accuracy and block checks, so a missed or blocked hit still carries a damage value but has
|
||||
/// <see cref="IHitData.HasExecuted"/> set to false.
|
||||
/// </summary>
|
||||
private static (HighJumpKick script, IExecutingMove move, IPokemon target, IPokemon user) CreateTestSetup(
|
||||
uint maxHp, params (bool hasExecuted, uint damage)[] hits)
|
||||
private static (HighJumpKick script, IExecutingMove move, IBattlePokemon target, IBattlePokemon user)
|
||||
CreateTestSetup(uint maxHp, params (bool hasExecuted, uint damage)[] hits)
|
||||
{
|
||||
var script = new HighJumpKick();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
var hitData = hits.Select(h =>
|
||||
{
|
||||
var hit = Substitute.For<IHitData>();
|
||||
@@ -38,7 +38,7 @@ public class HighJumpKickTests
|
||||
}).ToArray();
|
||||
move.Hits.Returns(hitData);
|
||||
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
user.BoostedStats.Returns(new StatisticSet<uint>(maxHp, 0, 0, 0, 0, 0));
|
||||
move.User.Returns(user);
|
||||
return (script, move, target, user);
|
||||
@@ -47,7 +47,7 @@ public class HighJumpKickTests
|
||||
/// <summary>
|
||||
/// Helper to extract the damage amount from the user's received Damage calls.
|
||||
/// </summary>
|
||||
private static uint? GetDamageAmount(IPokemon user)
|
||||
private static uint? GetDamageAmount(IBattlePokemon user)
|
||||
{
|
||||
var call = user.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Damage");
|
||||
return call != null ? (uint)call.GetArguments()[0]! : null;
|
||||
@@ -56,7 +56,7 @@ public class HighJumpKickTests
|
||||
/// <summary>
|
||||
/// Helper to extract the damage source from the user's received Damage calls.
|
||||
/// </summary>
|
||||
private static DamageSource? GetDamageSource(IPokemon user)
|
||||
private static DamageSource? GetDamageSource(IBattlePokemon user)
|
||||
{
|
||||
var call = user.ReceivedCalls().FirstOrDefault(c => c.GetMethodInfo().Name == "Damage");
|
||||
return call != null ? (DamageSource)call.GetArguments()[1]! : null;
|
||||
|
||||
Reference in New Issue
Block a user