31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|
|
|
/// <summary>
|
|
/// Comatose is an ability that makes the Pokémon always be in a sleep state, but still able to attack.
|
|
/// The Pokémon cannot be affected by other status conditions, and moves that would normally fail on sleeping Pokémon
|
|
/// will work normally. The Pokémon will still be affected by sleep-related moves and abilities.
|
|
///
|
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Comatose_(Ability)">Bulbapedia - Comatose</see>
|
|
/// </summary>
|
|
[Script(ScriptCategory.Ability, "comatose")]
|
|
public class Comatose : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
|
ref bool preventStatus)
|
|
{
|
|
if (status == ScriptUtils.ResolveName<Status.Sleep>())
|
|
{
|
|
preventStatus = true;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
|
|
{
|
|
if (eventName == CustomTriggers.BypassSleep && args is CustomTriggers.BypassSleepArgs bypassArgs)
|
|
{
|
|
bypassArgs.Bypass = true;
|
|
}
|
|
}
|
|
} |