namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Mega Launcher is an ability that boosts the power of aura and pulse moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Mega_Launcher_(Ability)">Bulbapedia - Mega Launcher</see>
/// </summary>
[Script(ScriptCategory.Ability, "mega_launcher")]
public class MegaLauncher : Script, IScriptChangeBasePower, IScriptCustomTrigger
{
    /// <inheritdoc />
    public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
    {
        if (move.UseMove.HasFlag(MoveFlags.Pulse))
        {
            basePower = basePower.MultiplyOrMax(1.5f);
        }
    }

    /// <inheritdoc />
    public void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
    {
        if (eventName != CustomTriggers.ModifyHealPercent || args is not CustomTriggers.ModifyHealPercentArgs healArgs)
            return;

        if (healArgs.Move.UseMove.HasFlag(MoveFlags.Pulse))
            healArgs.HealPercent *= 1.5f;
    }
}