using System.Collections.Generic; using PkmnLib.Static; using PkmnLib.Static.Utils; namespace PkmnLib.Plugin.Gen7.Scripts.Items; [ItemScript("healing_item")] public class HealingItem : ItemScript { private uint _healAmount; /// public HealingItem(IItem item) : base(item) { } /// public override bool IsItemUsable => true; /// public override bool RequiresTarget => true; /// public override void OnInitialize(IReadOnlyDictionary? parameters) { if (parameters == null || !parameters.TryGetValue("heal_amount", out var healAmountObj) || healAmountObj is not int healAmount) { healAmount = 20; } _healAmount = (uint)healAmount; } /// public override bool IsTargetValid(IPokemon target) => !target.IsFainted; /// public override void OnUseWithTarget(IPokemon target) { target.Heal(_healAmount); } }