Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -25,7 +25,7 @@ public class FusionFlareTests
|
||||
moveData.SecondaryEffect.Returns((ISecondaryEffect?)null);
|
||||
var learnedMove = Substitute.For<ILearnedMove>();
|
||||
learnedMove.MoveData.Returns(moveData);
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
var choice = new MoveChoice(user, learnedMove, 0, 0);
|
||||
if (failed)
|
||||
choice.Fail();
|
||||
@@ -36,7 +36,7 @@ public class FusionFlareTests
|
||||
/// Creates a fully mocked test setup where the current turn consists of the given choices, executed in
|
||||
/// order, and the script is evaluating the given executing choice.
|
||||
/// </summary>
|
||||
private static (FusionFlare script, IExecutingMove move, IPokemon target) CreateTestSetup(
|
||||
private static (FusionFlare script, IExecutingMove move, IBattlePokemon target) CreateTestSetup(
|
||||
IMoveChoice executingChoice, params ITurnChoice[] currentTurnChoices)
|
||||
{
|
||||
var script = new FusionFlare();
|
||||
@@ -46,11 +46,9 @@ public class FusionFlareTests
|
||||
var battle = Substitute.For<IBattle>();
|
||||
battle.PreviousTurnChoices.Returns(new List<IReadOnlyList<ITurnChoice>> { currentTurnChoices });
|
||||
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
var target = Substitute.For<IPokemon>();
|
||||
target.BattleData.Returns(battleData);
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
|
||||
target.Battle.Returns(battle);
|
||||
return (script, move, target);
|
||||
}
|
||||
|
||||
@@ -135,10 +133,8 @@ public class FusionFlareTests
|
||||
new ITurnChoice[] { flareChoice },
|
||||
});
|
||||
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
var target = Substitute.For<IPokemon>();
|
||||
target.BattleData.Returns(battleData);
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
target.Battle.Returns(battle);
|
||||
var modifier = 1f;
|
||||
|
||||
// Act
|
||||
@@ -229,25 +225,4 @@ public class FusionFlareTests
|
||||
// Assert
|
||||
await Assert.That(modifier).IsEqualTo(1f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Technical test: outside of battle (no battle data on the target) the modifier is left unchanged and
|
||||
/// the hook does not throw.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task ChangeDamageModifier_TargetHasNoBattleData_ModifierUnchanged()
|
||||
{
|
||||
// Arrange
|
||||
var script = new FusionFlare();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
target.BattleData.Returns((IPokemonBattleData?)null);
|
||||
var modifier = 1f;
|
||||
|
||||
// Act
|
||||
script.ChangeDamageModifier(move, target, 0, ref modifier);
|
||||
|
||||
// Assert
|
||||
await Assert.That(modifier).IsEqualTo(1f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user