Deukhoofd 6d71de375e
All checks were successful
Build / Build (push) Successful in 48s
More abilities, refactor custom triggers to be typed.
2025-06-13 11:15:48 +02:00

24 lines
924 B
C#

using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "whirlpool")]
public class Whirlpool : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var userVolatile = move.User.Volatile.Add(new WhirlpoolEffect());
if (userVolatile?.Script is WhirlpoolEffect whirlpoolEffect)
{
var turns = move.Battle.Random.GetInt(4, 6);
var damagePercent = 0.125f;
var args = new CustomTriggers.WhirlpoolArgs(move, target, hit, turns, damagePercent);
move.RunScriptHook(x => x.CustomTrigger(CustomTriggers.Whirlpool, args));
turns = args.Turns;
damagePercent = args.DamagePercent;
whirlpoolEffect.AddTargetedPokemon(target, turns, damagePercent);
}
}
}