Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -27,17 +27,17 @@ public class HyperspaceFuryTests
|
||||
/// Creates a fully mocked test setup where the target has a real <see cref="ScriptSet"/> as its volatile
|
||||
/// script set.
|
||||
/// </summary>
|
||||
private static (HyperspaceFury script, IExecutingMove move, IPokemon target, IPokemon user, IScriptSet volatileSet)
|
||||
CreateTestSetup()
|
||||
private static (HyperspaceFury script, IExecutingMove move, IBattlePokemon target, IBattlePokemon user, IScriptSet
|
||||
volatileSet) CreateTestSetup()
|
||||
{
|
||||
var script = new HyperspaceFury();
|
||||
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);
|
||||
|
||||
var user = Substitute.For<IPokemon>();
|
||||
var user = Substitute.For<IBattlePokemon>();
|
||||
move.User.Returns(user);
|
||||
return (script, move, target, user, volatileSet);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class HyperspaceFuryTests
|
||||
/// Extends the test setup with a battle side that has a real <see cref="ScriptSet"/> as its volatile
|
||||
/// scripts, so side-wide protections such as <see cref="QuickGuardEffect"/> can be attached.
|
||||
/// </summary>
|
||||
private static IScriptSet AttachSide(IPokemon target)
|
||||
private static IScriptSet AttachSide(IBattlePokemon target)
|
||||
{
|
||||
var side = Substitute.For<IBattleSide>();
|
||||
side.GetScripts().Returns(_ => new ScriptIterator(Array.Empty<IEnumerable<ScriptContainer>>()));
|
||||
@@ -56,11 +56,9 @@ public class HyperspaceFuryTests
|
||||
var battle = Substitute.For<IBattle>();
|
||||
battle.Sides.Returns(new[] { side });
|
||||
|
||||
var battleData = Substitute.For<IPokemonBattleData>();
|
||||
battleData.Battle.Returns(battle);
|
||||
battleData.SideIndex.Returns((byte)0);
|
||||
battleData.BattleSide.Returns(side);
|
||||
target.BattleData.Returns(battleData);
|
||||
target.Battle.Returns(battle);
|
||||
target.SideIndex.Returns((byte)0);
|
||||
target.BattleSide.Returns(side);
|
||||
|
||||
return sideScripts;
|
||||
}
|
||||
@@ -159,7 +157,7 @@ public class HyperspaceFuryTests
|
||||
|
||||
/// <summary>
|
||||
/// Bulbapedia: "Hyperspace Fury inflicts damage, then lowers the user's Defense stat by one stage."
|
||||
/// The self-inflicted Defense drop is applied via <see cref="IPokemon.ChangeStatBoost"/>.
|
||||
/// The self-inflicted Defense drop is applied via <see cref="IBattlePokemon.ChangeStatBoost"/>.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task OnSecondaryEffect_DamageDealt_LowersUserDefenseByOneStage()
|
||||
@@ -182,7 +180,7 @@ public class HyperspaceFuryTests
|
||||
/// <summary>
|
||||
/// Gives the mocked user an explicit species and form name.
|
||||
/// </summary>
|
||||
private static void SetUserSpeciesForm(IPokemon user, string speciesName, string formName)
|
||||
private static void SetUserSpeciesForm(IBattlePokemon user, string speciesName, string formName)
|
||||
{
|
||||
var species = Substitute.For<ISpecies>();
|
||||
species.Name.Returns(new StringKey(speciesName));
|
||||
|
||||
Reference in New Issue
Block a user