31 lines
937 B
C#
31 lines
937 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "static_damage")]
|
|
public class StaticDamage : Script, IScriptOnInitialize
|
|
{
|
|
private uint Damage { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
public void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
|
|
{
|
|
if (parameters == null)
|
|
throw new Exception("Parameters cannot be null for StaticDamage script.");
|
|
if (parameters.TryGetValue("damage", out var damage))
|
|
{
|
|
if (damage is int d)
|
|
Damage = (uint)d;
|
|
else
|
|
throw new Exception($"Invalid damage value: {damage}");
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("Missing required parameter: damage");
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
|
|
{
|
|
damage = Damage;
|
|
}
|
|
} |