namespace PkmnLib.Plugin.Gen7.Scripts.Side;

[Script(ScriptCategory.Side, "rage_powder")]
public class RagePowderEffect : Script, IScriptChangeIncomingTargets, IScriptOnEndTurn
{
    public IPokemon User { get; set; }

    public RagePowderEffect(IPokemon user)
    {
        User = user;
    }

    /// <inheritdoc />
    public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
    {
        // Ignore multi-hit moves
        if (targets.Count != 1)
            return;

        targets = [User];
    }

    /// <inheritdoc />
    public void OnEndTurn(IScriptSource owner, IBattle battle)
    {
        RemoveSelf();
    }
}