Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Items/Pokeballs/MoonBall.cs

32 lines
978 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 == ItemNames.MoonBall:
case ItemGenderEvolution itemGenderEvolution when itemGenderEvolution.Item == ItemNames.MoonBall:
return true;
default:
return false;
}
}))
{
// If the target can evolve with a Moon Ball, it has a 4x catch rate.
catchRate = catchRate.MultiplyOrMax(4f);
}
}
}