Deukhoofd 7727f92f4e
All checks were successful
continuous-integration/drone/push Build is passing
Even more moves
2025-05-05 16:58:03 +02:00

33 lines
854 B
C#

using System.Collections.Generic;
using PkmnLib.Static.Utils;
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;
}