Adds a bunch more move scripts
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user