This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user