This commit is contained in:
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/EarlyBird.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/EarlyBird.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Early Bird is an ability that allows the Pokémon to wake up from sleep twice as fast.
|
||||
/// This means the number of turns the Pokémon stays asleep is halved, rounded down.
|
||||
/// This ability is commonly associated with Kangaskhan and Dodrio.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Early_Bird_(Ability)">Bulbapedia - Early Bird</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "early_bird")]
|
||||
public class EarlyBird : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void CustomTrigger(StringKey eventName, IDictionary<StringKey, object?>? parameters)
|
||||
{
|
||||
if (eventName != CustomTriggers.ModifySleepTurns)
|
||||
return;
|
||||
if (parameters == null)
|
||||
return;
|
||||
if (parameters.TryGetValue("turns", out var turnsObj) && turnsObj is int turns)
|
||||
{
|
||||
parameters["turns"] = turns / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user