Bunch more moves, changes in how additional information for items works.

This commit is contained in:
2025-04-14 15:29:26 +02:00
parent 2adbb12367
commit 7c2845502d
60 changed files with 4275 additions and 963 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "change_multiple_target_stat_boosts")]
public class ChangeMultipleTargetStatBoosts : Script
{
private Dictionary<Statistic, sbyte> _statBoosts = new();
/// <inheritdoc />
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
{
if (parameters == null)
{
throw new ArgumentNullException(nameof(parameters));
}
foreach (var par in parameters)
{
if (!Enum.TryParse<Statistic>(par.Key, true, out var stat))
throw new ArgumentException($"Invalid stat name: {par.Key}");
if (par.Value is sbyte value)
{
_statBoosts[stat] = value;
}
}
}
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId batchId = new();
foreach (var stat in _statBoosts!)
{
target.ChangeStatBoost(stat.Key, stat.Value, true, batchId);
}
}
}