namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;

/// <summary>
/// Speed Boost is an ability that raises the Pokémon's Speed at the end of each turn.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Speed_Boost_(Ability)">Bulbapedia - Speed Boost</see>
/// </summary>
[Script(ScriptCategory.Ability, "speed_boost")]
public class SpeedBoost : Script, IScriptOnEndTurn
{
    /// <inheritdoc />
    public void OnEndTurn(IScriptSource owner, IBattle battle)
    {
        if (owner is not IPokemon pokemon)
            return;

        EventBatchId batchId = new();
        battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon)
        {
            BatchId = batchId,
        });
        pokemon.ChangeStatBoost(Statistic.Speed, 1, true, false, batchId);
    }
}