31 lines
886 B
C#
31 lines
886 B
C#
|
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();
|
||
|
}
|