More abilities
This commit is contained in:
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Insomnia.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Insomnia.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Insomnia is an ability that prevents the Pokémon from falling asleep.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Insomnia_(Ability)">Bulbapedia - Insomnia</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "insomnia")]
|
||||
public class Insomnia : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||
ref bool preventStatus)
|
||||
{
|
||||
if (status != ScriptUtils.ResolveName<Status.Sleep>())
|
||||
return;
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
preventStatus = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user