This commit is contained in:
28
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Whirlpool.cs
Normal file
28
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Whirlpool.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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 parameters = new Dictionary<StringKey, object?>
|
||||
{
|
||||
{ "number_of_turns", turns },
|
||||
{ "damage_percent", damagePercent },
|
||||
};
|
||||
move.RunScriptHook(x => x.CustomTrigger(CustomTriggers.Whirlpool, parameters));
|
||||
turns = parameters.GetValueOrDefault("number_of_turns", turns) as int? ?? turns;
|
||||
damagePercent = parameters.GetValueOrDefault("damage_percent", damagePercent) as float? ?? damagePercent;
|
||||
whirlpoolEffect.AddTargetedPokemon(target, turns, damagePercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user