using PkmnLib.Dynamic.Events;
using PkmnLib.Dynamic.Models;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.ScriptHandling;
///
/// Base class for item scripts.
///
public abstract class ItemScript : IDeepCloneable
{
///
protected ItemScript(IItem item)
{
Item = item;
}
///
/// The item associated with this script.
///
protected IItem Item { get; private set; }
///
/// Initializes the script with the given parameters for a specific item
///
public virtual void OnInitialize(IReadOnlyDictionary? parameters)
{
}
///
/// Returns whether the item is usable in the current context.
///
public virtual bool IsItemUsable => false;
///
/// Returns whether the item requires a target to be used.
///
public virtual bool RequiresTarget => false;
///
/// Returns whether the item is usable on the given target.
///
public virtual bool IsTargetValid(IPokemon target) => false;
///
/// Returns whether the item can be held by a Pokémon.
///
public virtual bool IsHoldable => false;
///
/// Returns whether the item can be held by the given target.
///
public virtual bool CanTargetHold(IPokemon pokemon) => false;
///
/// Handles the use of the item.
///
public virtual void OnUse(EventHook eventHook)
{
}
///
/// Handles the use of the item on the given target.
///
public virtual void OnUseWithTarget(IPokemon target, EventHook eventHook)
{
}
}