23 lines
837 B
C#
23 lines
837 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "incinerate")]
|
|
public class Incinerate : Script, IScriptOnSecondaryEffect
|
|
{
|
|
/// <inheritdoc />
|
|
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<string, object>
|
|
{
|
|
{ "pokemon", target },
|
|
{ "item", target.HeldItem! },
|
|
}));
|
|
}
|
|
} |