namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Poison Heal is an ability that heals the Pokémon when it is poisoned instead of damaging it.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Poison_Heal_(Ability)">Bulbapedia - Poison Heal</see>
/// </summary>
[Script(ScriptCategory.Ability, "poison_heal")]
public class PoisonHeal : Script, IScriptCustomTrigger
{
    /// <inheritdoc />
    public void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
    {
        if (eventName != CustomTriggers.PoisonedDamage)
            return;
        if (args is not CustomTriggers.PoisonedDamageArgs poisonArgs)
            return;
        poisonArgs.Invert = true;
    }
}