24 lines
1.1 KiB
C#
24 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
using PkmnLib.Static.Utils;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "bind")]
|
|
public class Bind : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
|
{
|
|
var bindTurnsParameters = new Dictionary<StringKey, object?> { { "bind_number_of_turns", 5 } };
|
|
move.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.BindNumberOfTurns, bindTurnsParameters));
|
|
var bindDamageParameters = new Dictionary<StringKey, object?> { { "bind_percent_of_max_health", 1f / 8f } };
|
|
move.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.BindPercentOfMaxHealth, bindDamageParameters));
|
|
|
|
var bindTurns = bindTurnsParameters.GetOrDefault("bind_number_of_turns", 5) as int? ?? 5;
|
|
var bindDamage = bindDamageParameters.GetOrDefault("bind_percent_of_max_health", 1f / 8f) as float? ?? 1f / 8f;
|
|
|
|
var bindEffect = new BindEffect(target, bindTurns, bindDamage);
|
|
target.Volatile.Add(bindEffect);
|
|
}
|
|
} |