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

28 lines
819 B
C#
Raw Normal View History

2025-03-02 13:03:51 +00:00
using System.Collections.Generic;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "fly")]
public class Fly : Script
{
/// <inheritdoc />
public override void PreventMove(IExecutingMove move, ref bool prevent)
{
2025-03-02 16:19:57 +00:00
if (move.User.Volatile.Contains<ChargeFlyEffect>())
2025-03-02 13:03:51 +00:00
return;
2025-03-02 16:19:57 +00:00
2025-03-02 13:03:51 +00:00
move.User.Volatile.Add(new ChargeFlyEffect(move.User));
move.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("fly_charge", new Dictionary<string, object>()
{
2025-03-02 16:19:57 +00:00
{ "user", move.User },
2025-03-02 13:03:51 +00:00
}));
prevent = true;
}
/// <inheritdoc />
public override void OnBeforeMove(IExecutingMove move)
{
move.User.Volatile.Remove(ScriptUtils.ResolveName<ChargeFlyEffect>());
}
}