2025-06-07 11:03:48 +02:00

32 lines
1.1 KiB
C#

using PkmnLib.Static.Utils;
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 pokemonImpl, StringKey status, ref bool preventStatus)
{
if (status == ScriptUtils.ResolveName<Status.Sleep>())
{
preventStatus = true;
}
}
/// <inheritdoc />
public override void CustomTrigger(StringKey eventName, IDictionary<StringKey, object?>? parameters)
{
if (eventName == CustomTriggers.BypassSleep && parameters != null)
{
parameters["bypass_sleep"] = true;
}
}
}