First couple abilities implemented
All checks were successful
Build / Build (push) Successful in 48s
All checks were successful
Build / Build (push) Successful in 48s
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
[Script(ScriptCategory.Ability, "prevent_stat_lowering")]
|
||||
public class PreventStatLowering : Script
|
||||
{
|
||||
private Statistic _statistic;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnInitialize(IReadOnlyDictionary<StringKey, object?>? parameters)
|
||||
{
|
||||
if (parameters is null)
|
||||
throw new ArgumentNullException(nameof(parameters), "Parameters cannot be null.");
|
||||
if (!parameters.TryGetValue("stat", out var statObj) || statObj is not string statStr)
|
||||
throw new ArgumentException("Parameter 'stat' is required and must be a string.", nameof(parameters));
|
||||
if (!Enum.TryParse(statStr, true, out Statistic stat))
|
||||
throw new ArgumentException($"Invalid statistic '{statStr}' provided.", nameof(statStr));
|
||||
|
||||
_statistic = stat;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatBoostChange(IPokemon target, Statistic stat, sbyte amount, bool selfInflicted,
|
||||
ref bool prevent)
|
||||
{
|
||||
if (!selfInflicted)
|
||||
prevent = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user