using PkmnLib.Plugin.Gen7.Scripts.Pokemon;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "smack_down")]
public class SmackDown : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var battleData = target.BattleData;
        if (battleData == null)
            return;

        target.Volatile.Add(new SmackDownEffect());

        var chargeBounceEffect = ScriptUtils.ResolveName<ChargeBounceEffect>();
        if (target.Volatile.Contains(chargeBounceEffect))
            target.Volatile.Remove(chargeBounceEffect);
        var flyEffect = ScriptUtils.ResolveName<ChargeFlyEffect>();
        if (target.Volatile.Contains(flyEffect))
            target.Volatile.Remove(flyEffect);
        var skyDropEffect = ScriptUtils.ResolveName<ChargeSkyDropEffect>();
        if (target.Volatile.Contains(skyDropEffect))
            target.Volatile.Remove(skyDropEffect);
    }
}