Deukhoofd eea5697109
All checks were successful
Build / Build (push) Successful in 49s
Fixes all warnings
2025-05-19 11:50:51 +02:00

24 lines
693 B
C#

using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "heal_percent")]
public class HealPercent : Script
{
private float _healPercent = 0.5f;
/// <inheritdoc />
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
{
if (parameters?.TryGetValue("healPercent", out var variable) == true && variable is float healPercent)
{
_healPercent = healPercent;
}
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.Heal((uint)(move.User.BoostedStats.Hp * _healPercent));
}
}