namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

[Script(ScriptCategory.Pokemon, "torment")]
public class TormentEffect(IMoveChoice? moveChoice) : Script, IScriptPreventMoveSelection, IScriptOnBeforeTurnStart
{
    private IMoveChoice? _moveChoice = moveChoice;

    /// <inheritdoc />
    public void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
    {
        if (_moveChoice == null)
            return;
        if (choice.ChosenMove.MoveData == _moveChoice.ChosenMove.MoveData)
        {
            prevent = true;
        }
    }

    /// <inheritdoc />
    public void OnBeforeTurnStart(ITurnChoice choice)
    {
        if (choice is IMoveChoice moveChoice)
            _moveChoice = moveChoice;
    }
}