using System.Collections.Generic; using PkmnLib.Dynamic.Models; using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Dynamic.ScriptHandling.Registry; using PkmnLib.Static; using PkmnLib.Static.Utils; namespace PkmnLib.Plugin.Gen7.Scripts.Items; /// /// An implementation of a pokeball script that just has a flat catch rate bonus. /// [ItemScript("pokeball")] public class StaticPokeball : PokeballScript { private byte _catchRate; /// public StaticPokeball(IItem item) : base(item) { } /// public override void OnInitialize(IReadOnlyDictionary? parameters) { if (parameters == null || !parameters.TryGetValue("catchRate", out var catchRateObj) || catchRateObj is not byte catchRate) { catchRate = 1; } _catchRate = catchRate; } /// public override byte GetCatchRate(IPokemon target) { return _catchRate; } }