Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -20,12 +20,12 @@ public class EndureTests
|
||||
/// <see cref="ProtectionScript.OnSecondaryEffect"/>. The <c>target</c> of the secondary effect is the
|
||||
/// Pokémon using Endure itself, as the move is self-targeted.
|
||||
/// </summary>
|
||||
private static (Endure script, IExecutingMove move, IPokemon target, IHitData hitData, IScriptSet volatileSet)
|
||||
private static (Endure script, IExecutingMove move, IBattlePokemon target, IHitData hitData, IScriptSet volatileSet)
|
||||
CreateProtectSetup(bool userMovesLast, float randomRoll)
|
||||
{
|
||||
var script = new Endure();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
var hitData = Substitute.For<IHitData>();
|
||||
move.GetHitData(target, 0).Returns(hitData);
|
||||
|
||||
@@ -39,9 +39,7 @@ public class EndureTests
|
||||
battle.ChoiceQueue.Returns(queue);
|
||||
battle.Random.Returns(random);
|
||||
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
target.BattleData.Returns(battleData);
|
||||
target.Battle.Returns(battle);
|
||||
|
||||
target.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
|
||||
IScriptSet volatileSet = new ScriptSet(target);
|
||||
@@ -134,7 +132,7 @@ public class EndureTests
|
||||
{
|
||||
// Arrange
|
||||
var effect = new EndureEffect();
|
||||
var pokemon = Substitute.For<IPokemon>();
|
||||
var pokemon = Substitute.For<IBattlePokemon>();
|
||||
pokemon.CurrentHealth.Returns(currentHealth);
|
||||
var damage = incomingDamage;
|
||||
|
||||
@@ -154,7 +152,7 @@ public class EndureTests
|
||||
{
|
||||
// Arrange
|
||||
var effect = new EndureEffect();
|
||||
var pokemon = Substitute.For<IPokemon>();
|
||||
var pokemon = Substitute.For<IBattlePokemon>();
|
||||
pokemon.CurrentHealth.Returns(100u);
|
||||
var damage = 100u;
|
||||
|
||||
@@ -174,7 +172,7 @@ public class EndureTests
|
||||
{
|
||||
// Arrange
|
||||
var effect = new EndureEffect();
|
||||
var pokemon = Substitute.For<IPokemon>();
|
||||
var pokemon = Substitute.For<IBattlePokemon>();
|
||||
pokemon.CurrentHealth.Returns(100u);
|
||||
var damage = 50u;
|
||||
|
||||
@@ -193,7 +191,7 @@ public class EndureTests
|
||||
public async Task OnEndTurn_EffectRemovesItself()
|
||||
{
|
||||
// Arrange
|
||||
var owner = Substitute.For<IPokemon>();
|
||||
var owner = Substitute.For<IBattlePokemon>();
|
||||
owner.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
|
||||
IScriptSet ownerVolatile = new ScriptSet(owner);
|
||||
var effect = new EndureEffect();
|
||||
|
||||
Reference in New Issue
Block a user