using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Plugin.Gen7.Scripts.Side;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "rapid_spin")]
public class RapidSpin : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        move.User.Volatile.Remove<LeechSeedEffect>();
        move.User.Volatile.Remove<BindEffect>();
        move.User.Volatile.Remove<FireSpinEffect>();
        move.User.Volatile.Remove<MagmaStormEffect>();
        move.User.Volatile.Remove<WhirlpoolEffect>();

        var battleData = move.User.BattleData;
        if (battleData != null)
        {
            battleData.BattleSide.VolatileScripts.Remove<SpikesEffect>();
            battleData.BattleSide.VolatileScripts.Remove<StickyWebEffect>();
            battleData.BattleSide.VolatileScripts.Remove<ToxicSpikesEffect>();
            battleData.BattleSide.VolatileScripts.Remove<StealthRockEffect>();
        }
    }
}