namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Natural Cure is an ability that heals status conditions when switching out.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Natural_Cure_(Ability)">Bulbapedia - Natural Cure</see>
/// </summary>
[Script(ScriptCategory.Ability, "natural_cure")]
public class NaturalCure : Script, IScriptOnSwitchOut
{
    /// <inheritdoc />
    public void OnSwitchOut(IPokemon oldPokemon, byte position)
    {
        if (!oldPokemon.StatusScript.IsEmpty)
        {
            oldPokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(oldPokemon));
            oldPokemon.ClearStatus();
        }
    }
}