Deukhoofd 2533512eda
All checks were successful
Build / Build (push) Successful in 51s
Slight cleanup, do some TODOs
2025-06-22 10:42:25 +02:00

30 lines
791 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Items;
/// <summary>
/// An implementation of a pokeball script that just has a flat catch rate bonus.
/// </summary>
[ItemScript("pokeball")]
public class StaticPokeball : PokeballScript
{
private byte _catchRate;
/// <inheritdoc />
public StaticPokeball(IItem item) : base(item)
{
}
/// <inheritdoc />
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
{
if (parameters == null || !parameters.TryGetValue("catchRate", out var catchRateObj) ||
catchRateObj is not byte catchRate)
{
catchRate = 1;
}
_catchRate = catchRate;
}
/// <inheritdoc />
public override byte GetCatchRate(IPokemon target) => _catchRate;
}