namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// SuppressWeatherAbility is a generic ability that suppresses the effects of weather conditions.
/// This ability prevents weather effects from being applied while the Pokémon is on the field.
/// This ability is used by abilities like Cloud Nine and Air Lock.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cloud_Nine_(Ability)">Bulbapedia - Cloud Nine</see>
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Air_Lock_(Ability)">Bulbapedia - Air Lock</see>
/// </summary>
[Script(ScriptCategory.Ability, "suppress_weather")]
public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnSwitchIn
{
    /// <inheritdoc />
    public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
    {
        suppressedCategories ??= [];
        suppressedCategories.Add(ScriptCategory.Weather);
    }

    /// <inheritdoc />
    public void OnSwitchIn(IPokemon pokemon, byte position)
    {
        pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
    }
}