Deukhoofd 7c270a6d52
All checks were successful
Build / Build (push) Successful in 1m1s
Finish script interface refactor
2025-07-06 10:27:56 +02:00

30 lines
1.2 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, IScriptPreventStatusChange, IScriptCustomTrigger
{
/// <inheritdoc />
public void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted, ref bool preventStatus)
{
if (status == ScriptUtils.ResolveName<Status.Sleep>())
{
preventStatus = true;
}
}
/// <inheritdoc />
public void CustomTrigger(StringKey eventName, ICustomTriggerArgs args)
{
if (eventName == CustomTriggers.BypassSleep && args is CustomTriggers.BypassSleepArgs bypassArgs)
{
bypassArgs.Bypass = true;
}
}
}