namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Analytic is an ability that increases the power of the user's move by 30% if the user moves after all other Pokémon in the same turn.
/// This bonus applies only if the Pokémon with Analytic acts last in the turn.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Analytic_(Ability)">Bulbapedia - Analytic</see>
/// </summary>
[Script(ScriptCategory.Ability, "analytic")]
public class Analytic : Script, IScriptChangeDamageModifier
{
    /// <inheritdoc />
    public void ChangeDamageModifier(IExecutingMove move, IPokemon target, byte hit, ref float modifier)
    {
        if (move.Battle.ChoiceQueue?.HasNext() == false)
        {
            move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
            modifier *= 1.3f;
        }
    }
}