Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -25,13 +25,11 @@ public class FakeOutTests
|
||||
|
||||
var battle = Substitute.For<IBattle>();
|
||||
battle.CurrentTurnNumber.Returns(currentTurn);
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
battleData.SwitchInTurn.Returns(switchInTurn);
|
||||
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.BattleData.Returns(battleData);
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
move.User.Returns(user);
|
||||
user.SwitchInTurn.Returns(switchInTurn);
|
||||
user.Battle.Returns(battle);
|
||||
|
||||
return (script, move);
|
||||
}
|
||||
@@ -74,28 +72,6 @@ public class FakeOutTests
|
||||
await Assert.That(stop).IsTrue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Technical test: without battle data on the user (outside of battle) the first-turn check does nothing
|
||||
/// and the move is not stopped.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task StopBeforeMove_UserHasNoBattleData_MoveNotStopped()
|
||||
{
|
||||
// Arrange
|
||||
var script = new FakeOut();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var user = Substitute.For<IPokemon>();
|
||||
user.BattleData.Returns((IPokemonBattleData?)null);
|
||||
move.User.Returns(user);
|
||||
var stop = false;
|
||||
|
||||
// Act
|
||||
script.StopBeforeMove(move, ref stop);
|
||||
|
||||
// Assert
|
||||
await Assert.That(stop).IsFalse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bulbapedia: "Fake Out inflicts damage and always makes the target flinch" — the secondary effect puts
|
||||
/// a <see cref="FlinchEffect"/> on the target.
|
||||
@@ -106,7 +82,7 @@ public class FakeOutTests
|
||||
// Arrange
|
||||
var script = new FakeOut();
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var target = Substitute.For<IBattlePokemon>();
|
||||
target.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
|
||||
IScriptSet volatileSet = new ScriptSet(target);
|
||||
target.Volatile.Returns(volatileSet);
|
||||
|
||||
Reference in New Issue
Block a user