namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Soundproof is an ability that grants immunity to sound-based moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soundproof_(Ability)">Bulbapedia - Soundproof</see>
/// </summary>
[Script(ScriptCategory.Ability, "soundproof")]
public class Soundproof : Script, IScriptIsInvulnerableToMove
{
    /// <inheritdoc />
    public void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
    {
        if (move.UseMove.HasFlag(MoveFlags.Sound))
            invulnerable = true;
    }
}