namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "gear_up")]
public class GearUp : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var battleData = move.User.BattleData;
        if (battleData == null)
            return;

        var side = battleData.Battle.Sides[battleData.SideIndex];
        EventBatchId evtBatchId = new();
        foreach (var pokemon in side.Pokemon.WhereNotNull())
        {
            var ability = pokemon.ActiveAbility?.Name;
            if (ability != "plus" && ability != "minus")
                continue;
            pokemon.ChangeStatBoost(Statistic.Attack, 1, pokemon == move.User, false, evtBatchId);
            pokemon.ChangeStatBoost(Statistic.SpecialAttack, 1, pokemon == move.User, false, evtBatchId);
        }
    }
}