namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// PreventCritical is a generic ability that prevents the user from being hit by critical hits.
/// This ability completely blocks any incoming critical hits from opposing Pokémon.
/// This ability is used by abilities like Battle Armor and Shell Armor.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battle_Armor_(Ability)">Bulbapedia - Battle Armor</see>
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shell_Armor_(Ability)">Bulbapedia - Shell Armor</see>
/// </summary>
[Script(ScriptCategory.Ability, "prevent_critical")]
public class PreventCritical : Script, IScriptBlockIncomingCriticalHit
{
    /// <inheritdoc />
    public void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block) =>
        block = true;
}