namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "psycho_shift")]
public class PsychoShift : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var statusScript = move.User.StatusScript;
        var targetStatusScript = target.StatusScript;
        if (statusScript.IsEmpty || !targetStatusScript.IsEmpty)
        {
            move.GetHitData(target, hit).Fail();
            return;
        }
        var script = statusScript.Clear();
        targetStatusScript.Set(script!);
    }
}