PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Fling.cs

31 lines
886 B
C#
Raw Normal View History

2025-03-02 13:03:51 +00:00
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fling")]
public class Fling : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
{
var item = move.User.HeldItem;
if (item == null)
{
move.GetHitData(target, hit).Fail();
return;
}
if (item.Category is ItemCategory.FormChanger or ItemCategory.Pokeball or ItemCategory.Mail
or ItemCategory.KeyItem or ItemCategory.TmHm)
{
move.GetHitData(target, hit).Fail();
return;
}
basePower = item.FlingPower;
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) =>
move.User.RemoveHeldItemForBattle();
}