using PkmnLib.Plugin.Gen7.Scripts.Side;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "brick_break")]
public class BrickBreak : Script, IScriptOnBeforeMove
{
    /// <inheritdoc />
    public void OnBeforeMove(IExecutingMove move)
    {
        var targets = move.Targets.WhereNotNull();
        var sides = targets.Select(x => x.BattleData!.BattleSide).Distinct();
        foreach (var side in sides)
        {
            side.VolatileScripts.Remove(ScriptUtils.ResolveName<ReflectEffect>());
            side.VolatileScripts.Remove(ScriptUtils.ResolveName<LightScreenEffect>());
            side.VolatileScripts.Remove(ScriptUtils.ResolveName<AuroraVeilEffect>());
        }
    }
}