More moves implemented
This commit is contained in:
35
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/StaticDamage.cs
Normal file
35
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/StaticDamage.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "static_damage")]
|
||||
public class StaticDamage : Script
|
||||
{
|
||||
private uint Damage { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user