25 lines
727 B
C#
25 lines
727 B
C#
|
using System.Collections.Generic;
|
||
|
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));
|
||
|
}
|
||
|
}
|