2024-11-02 11:59:55 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
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 />
|
2025-01-10 10:11:50 +00:00
|
|
|
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
|
2024-11-02 11:59:55 +00:00
|
|
|
{
|
|
|
|
if (parameters == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException(nameof(parameters));
|
|
|
|
}
|
|
|
|
if (!parameters.TryGetValue("amount", out var amount) || amount == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentException("Parameter 'amount' is required.");
|
|
|
|
}
|
2025-02-01 14:26:57 +00:00
|
|
|
_amount = (sbyte)(int)amount;
|
2024-11-02 11:59:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
}
|
|
|
|
}
|