namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Aura Break is an ability that reverses the effects of Dark Aura and Fairy Aura.
/// When this ability is present, Dark-type and Fairy-type moves are reduced in power by 25% instead of being boosted.
/// 
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aura_Break_(Ability)">Bulbapedia - Aura Break</see>
/// </summary>
[Script(ScriptCategory.Ability, "aura_break")]
public class AuraBreak : Script, IScriptCustomTrigger
{
    /// <inheritdoc />
    public void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
    {
        if (eventName != CustomTriggers.ModifyAuraEffect || args is not CustomTriggers.ModifyAuraEffectArgs auraArgs)
            return;

        var typeName = auraArgs.Move.UseMove.MoveType.Name;
        if (typeName == "dark" || typeName == "fairy")
        {
            // Reverse the aura effect by reducing power by 25%
            auraArgs.AuraEffect *= 0.75f;
        }
    }
}