More abilities, refactor custom triggers to be typed.
All checks were successful
Build / Build (push) Successful in 48s
All checks were successful
Build / Build (push) Successful in 48s
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Dynamic.ScriptHandling;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Moves;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Abilities;
|
||||
|
||||
public class MegaLauncherTests
|
||||
{
|
||||
[Test]
|
||||
public async Task ChangeHealPercent_HealPercentIncreasesForAuraMoves()
|
||||
{
|
||||
// Arrange
|
||||
var move = Substitute.For<IExecutingMove>();
|
||||
var target = Substitute.For<IPokemon>();
|
||||
var healPercent = 0.5f;
|
||||
var user = Substitute.For<IPokemon>();
|
||||
move.User.Returns(user);
|
||||
move.UseMove.Category.Returns(MoveCategory.Special);
|
||||
move.UseMove.HasFlag("pulse").Returns(true);
|
||||
var megaLauncher = new ScriptContainer(new MegaLauncher());
|
||||
move.User.AbilityScript.Returns(megaLauncher);
|
||||
move.GetScripts().Returns(new ScriptIterator([megaLauncher]));
|
||||
var healPercentScript = new HealPercent();
|
||||
uint healedAmount = 0;
|
||||
target.Heal(Arg.Do<uint>(amount => healedAmount = amount));
|
||||
target.BoostedStats.Returns(new StatisticSet<uint>(100, 100, 100, 100, 100, 100));
|
||||
|
||||
// Act
|
||||
healPercentScript.OnInitialize(new Dictionary<StringKey, object?>
|
||||
{
|
||||
{ "healPercent", healPercent },
|
||||
});
|
||||
healPercentScript.OnSecondaryEffect(move, target, 0);
|
||||
|
||||
// Assert
|
||||
await Assert.That(healedAmount).IsEqualTo((uint)(target.BoostedStats.Hp * healPercent * 1.5f));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user