Implements several more moves
This commit is contained in:
79
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/ChangeUserStats.cs
Normal file
79
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/ChangeUserStats.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Static;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
public abstract class ChangeUserStats : Script
|
||||
{
|
||||
private readonly Statistic _stat;
|
||||
private sbyte _amount;
|
||||
|
||||
protected ChangeUserStats(Statistic stat)
|
||||
{
|
||||
_stat = stat;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnInitialize(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)
|
||||
{
|
||||
move.User.ChangeStatBoost(_stat, _amount, true);
|
||||
}
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Move, "change_user_attack")]
|
||||
public class ChangeUserAttack : ChangeUserStats
|
||||
{
|
||||
public ChangeUserAttack() : base(Statistic.Attack)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Move, "change_user_defense")]
|
||||
public class ChangeUserDefense : ChangeUserStats
|
||||
{
|
||||
public ChangeUserDefense() : base(Statistic.Defense)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Move, "change_user_special_attack")]
|
||||
public class ChangeUserSpecialAttack : ChangeUserStats
|
||||
{
|
||||
public ChangeUserSpecialAttack() : base(Statistic.SpecialAttack)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Move, "change_user_special_defense")]
|
||||
public class ChangeUserSpecialDefense : ChangeUserStats
|
||||
{
|
||||
public ChangeUserSpecialDefense() : base(Statistic.SpecialDefense)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Move, "change_user_speed")]
|
||||
public class ChangeUserSpeed : ChangeUserStats
|
||||
{
|
||||
public ChangeUserSpeed() : base(Statistic.Speed)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user