26 lines
910 B
C#
26 lines
910 B
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Steadfast is an ability that raises the user's Speed each time it flinches.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Steadfast_(Ability)">Bulbapedia - Steadfast</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "steadfast")]
|
|
public class Steadfast : Script, IScriptCustomTrigger
|
|
{
|
|
/// <inheritdoc />
|
|
public void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
|
{
|
|
if (eventName != CustomTriggers.OnFlinch)
|
|
return;
|
|
if (args is not CustomTriggers.OnFlinchArgs flinchArgs)
|
|
return;
|
|
|
|
EventBatchId batchId = new();
|
|
flinchArgs.Move.Battle.EventHook.Invoke(new AbilityTriggerEvent(flinchArgs.Move.User)
|
|
{
|
|
BatchId = batchId,
|
|
});
|
|
flinchArgs.Move.User.ChangeStatBoost(Statistic.Speed, 1, true, false, batchId);
|
|
}
|
|
} |