Deukhoofd 77d7b86a3c
All checks were successful
Build / Build (push) Successful in 1m2s
Implement most pokeballs
2025-07-20 11:15:45 +02:00

32 lines
964 B
C#

using PkmnLib.Static.Species;
namespace PkmnLib.Plugin.Gen7.Scripts.Items.Pokeballs;
[ItemScript("moon_ball")]
public class MoonBall : PokeballScript
{
/// <inheritdoc />
public MoonBall(IItem item) : base(item)
{
}
/// <inheritdoc />
public override void ChangeCatchRate(IPokemon target, ref byte catchRate)
{
if (target.Species.EvolutionData.Any(x =>
{
switch (x)
{
case ItemUseEvolution itemUseEvolution when itemUseEvolution.Item == "moon_ball":
case ItemGenderEvolution itemGenderEvolution when itemGenderEvolution.Item == "moon_ball":
return true;
default:
return false;
}
}))
{
// If the target can evolve with a Moon Ball, it has a 4x catch rate.
catchRate = catchRate.MultiplyOrMax(4f);
}
}
}