using System; using System.Collections.Generic; using System.Linq; using PkmnLib.Static; using PkmnLib.Static.Utils; namespace PkmnLib.Plugin.Gen7.Scripts.Moves; [Script(ScriptCategory.Move, "change_multiple_user_stat_boosts")] public class ChangeMultipleUserStatBoosts : Script { private Dictionary _statBoosts = new(); /// public override void OnInitialize(IReadOnlyDictionary? parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } foreach (var par in parameters) { if (!Enum.TryParse(par.Key, true, out var stat)) continue; if (par.Value is sbyte value) { _statBoosts[stat] = value; } } } /// public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) { EventBatchId batchId = new(); foreach (var stat in _statBoosts!) { move.User.ChangeStatBoost(stat.Key, stat.Value, true, batchId); } } }