using PkmnLib.Plugin.Gen7.Scripts.Utils;

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

[Script(ScriptCategory.Pokemon, "charge_move_effect")]
public class ChargeMoveEffect : Script, IScriptForceTurnSelection
{
    public readonly StringKey MoveName;
    private readonly IPokemon _user;
    private readonly byte _targetSide;
    private readonly byte _targetPosition;

    public ChargeMoveEffect(StringKey moveName, IPokemon user, byte targetSide, byte targetPosition)
    {
        MoveName = moveName;
        _user = user;
        _targetSide = targetSide;
        _targetPosition = targetPosition;
    }

    /// <inheritdoc />
    public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
    {
        choice = TurnChoiceHelper.CreateMoveChoice(_user, MoveName, _targetSide, _targetPosition);
    }
}