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

28 lines
801 B
C#
Raw Normal View History

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