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

28 lines
838 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, "dive")]
public class Dive : Script
{
/// <inheritdoc />
public override void PreventMove(IExecutingMove move, ref bool prevent)
{
2025-03-02 16:19:57 +00:00
if (move.User.Volatile.Contains<DiveEffect>())
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("dive_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;
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
move.User.Volatile.Remove(ScriptUtils.ResolveName<DiveEffect>());
}
}