Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -15,13 +15,13 @@ public class MetalBurstTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a Metal Burst user whose damage-tracking volatile has been installed through
|
||||
/// <see cref="MetalBurst.OnBeforeTurnStart"/>. The user's <see cref="IPokemon.Volatile"/> is a real
|
||||
/// <see cref="MetalBurst.OnBeforeTurnStart"/>. The user's <see cref="IBattlePokemon.Volatile"/> is a real
|
||||
/// <see cref="ScriptSet"/> so the internal tracker script can actually be stored and retrieved.
|
||||
/// </summary>
|
||||
private static (MetalBurst metalBurst, IPokemon user, IScriptSet userVolatile) CreateUserWithTracker()
|
||||
private static (MetalBurst metalBurst, IBattlePokemon user, IScriptSet userVolatile) CreateUserWithTracker()
|
||||
{
|
||||
var metalBurst = new MetalBurst();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
var userVolatile = new ScriptSet(user);
|
||||
user.Volatile.Returns(userVolatile);
|
||||
// ScriptSet.Add runs the IScriptPreventVolatileAdd hook pass over the owner's scripts; give the mock a
|
||||
@@ -37,9 +37,9 @@ public class MetalBurstTests
|
||||
/// <summary>
|
||||
/// Creates an opposing Pokémon with a real (empty) <see cref="ScriptSet"/> as its volatile collection.
|
||||
/// </summary>
|
||||
private static IPokemon CreateOpponent()
|
||||
private static IBattlePokemon CreateOpponent()
|
||||
{
|
||||
var opponent = Substitute.For<IPokemon>();
|
||||
var opponent = Substitute.For<IBattlePokemon>();
|
||||
opponent.Volatile.Returns(new ScriptSet(opponent));
|
||||
return opponent;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class MetalBurstTests
|
||||
/// Simulates the user being hit by an opponent's move; the damage tracker installed on the user observes
|
||||
/// this through its <see cref="IScriptOnIncomingHit"/> hook.
|
||||
/// </summary>
|
||||
private static void HitUser(IPokemon user, IPokemon attacker, uint damage,
|
||||
private static void HitUser(IBattlePokemon user, IBattlePokemon attacker, uint damage,
|
||||
MoveCategory category = MoveCategory.Physical, byte hit = 0)
|
||||
{
|
||||
var attackMove = Substitute.For<IExecutingMove>();
|
||||
@@ -67,7 +67,8 @@ public class MetalBurstTests
|
||||
/// <summary>
|
||||
/// Creates the executing Metal Burst move used by <paramref name="user"/> against <paramref name="target"/>.
|
||||
/// </summary>
|
||||
private static (IExecutingMove move, IHitData hitData) CreateMetalBurstMove(IPokemon user, IPokemon target)
|
||||
private static (IExecutingMove move, IHitData hitData) CreateMetalBurstMove(IBattlePokemon user,
|
||||
IBattlePokemon target)
|
||||
{
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
move.User.Returns(user);
|
||||
@@ -269,7 +270,7 @@ public class MetalBurstTests
|
||||
HitUser(user, lastAttacker, 80);
|
||||
var choice = Substitute.For<IMoveChoice>();
|
||||
choice.User.Returns(user);
|
||||
IReadOnlyList<IPokemon?> targets = [firstAttacker];
|
||||
IReadOnlyList<IBattlePokemon?> targets = [firstAttacker];
|
||||
|
||||
// Act & Assert - the script must expose the redirection hook and point the move at the last attacker
|
||||
var changeTargets = metalBurst as IScriptChangeTargets;
|
||||
|
||||
Reference in New Issue
Block a user