namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "incinerate")]
public class Incinerate : Script, IScriptOnSecondaryEffect
{
///
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
{
var isValidItem = target.HeldItem is { Category: ItemCategory.Berry } ||
(target.HeldItem?.Name.ToString().EndsWith("_gem") == true && target.HeldItem is
{ Category: ItemCategory.MiscItem });
if (!isValidItem || !target.TryStealHeldItem(out _))
{
return;
}
move.Battle.EventHook.Invoke(new DialogEvent("item_incinerated", new Dictionary
{
{ "pokemon", target },
{ "item", target.HeldItem! },
}));
}
}