Implement most pokeballs
All checks were successful
Build / Build (push) Successful in 1m2s

This commit is contained in:
2025-07-20 11:15:45 +02:00
parent db3f7f2403
commit 77d7b86a3c
19 changed files with 452 additions and 38 deletions

View File

@@ -0,0 +1,38 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Items.Pokeballs;
/// <summary>
/// An implementation of a pokeball script that just has a flat catch rate bonus.
/// </summary>
[ItemScript("pokeball_flat_modifier")]
public class PokeballFlatModifier : PokeballScript
{
private float _catchModifier;
/// <inheritdoc />
public PokeballFlatModifier(IItem item) : base(item)
{
}
/// <inheritdoc />
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
{
var catchModifier = 1f;
if (parameters != null && parameters.TryGetValue("catchRate", out var catchRateObj))
{
catchModifier = catchRateObj switch
{
float catchModifierFloat => catchModifierFloat,
int catchModifierInt => catchModifierInt,
_ => catchModifier,
};
}
_catchModifier = catchModifier;
}
/// <inheritdoc />
public override void ChangeCatchRate(IPokemon target, ref byte catchRate)
{
catchRate = catchRate.MultiplyOrMax(_catchModifier);
}
}