namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "role_play")]
public class RolePlay : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var ability = target.ActiveAbility;
        if (ability is null || ability.HasFlag("cant_be_copied"))
        {
            move.GetHitData(target, hit).Fail();
            return;
        }
        move.User.ChangeAbility(ability);
    }
}