Adds a bunch more move scripts

This commit is contained in:
2024-11-02 12:59:55 +01:00
parent 6f2bd678a5
commit 44cd2ee03e
17 changed files with 492 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using PkmnLib.Dynamic.Libraries;
using PkmnLib.Dynamic.Models;
using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.Events;
[Script(ScriptCategory.Move, "change_all_target_stats")]
public class ChangeAllTargetStats : Script
{
private sbyte _amount;
/// <inheritdoc />
public override void OnInitialize(IDynamicLibrary library, IReadOnlyDictionary<StringKey, object?>? parameters)
{
if (parameters == null)
{
throw new ArgumentNullException(nameof(parameters));
}
if (!parameters.TryGetValue("amount", out var amount) || amount == null)
{
throw new ArgumentException("Parameter 'amount' is required.");
}
_amount = (sbyte)amount;
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
target.ChangeStatBoost(Statistic.Attack, _amount, target == move.User);
target.ChangeStatBoost(Statistic.Defense, _amount, target == move.User);
target.ChangeStatBoost(Statistic.SpecialAttack, _amount, target == move.User);
target.ChangeStatBoost(Statistic.SpecialDefense, _amount, target == move.User);
target.ChangeStatBoost(Statistic.Speed, _amount, target == move.User);
}
}