20 lines
708 B
C#
20 lines
708 B
C#
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;
|
|
}
|
|
} |