namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Immunity is an ability that prevents the Pokémon from being poisoned.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Immunity_(Ability)">Bulbapedia - Immunity</see>
/// </summary>
[Script(ScriptCategory.Ability, "immunity")]
public class Immunity : Script, IScriptPreventStatusChange
{
    /// <inheritdoc />
    public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
    {
        if (status == ScriptUtils.ResolveName<Status.Poisoned>() ||
            status == ScriptUtils.ResolveName<Status.BadlyPoisoned>())
        {
            preventStatus = true;
        }
    }
}