{
    name: 'slp',
    effectType: 'Status',
    onStart(target, source, sourceEffect) {
        if (sourceEffect && sourceEffect.effectType === 'Ability') {
            this.add('-status', target, 'slp', '[from] ability: ' + sourceEffect.name, `[of] ${source}`);
        } else if (sourceEffect && sourceEffect.effectType === 'Move') {
            this.add('-status', target, 'slp', `[from] move: ${sourceEffect.name}`);
        } else {
            this.add('-status', target, 'slp');
        }
        this.effectState.startTime = this.random(2, 5);
        this.effectState.time = this.effectState.startTime;


    },
    onBeforeMovePriority: 10,
    onBeforeMove(pokemon, target, move) {
        if (pokemon.hasAbility('earlybird')) {
            pokemon.statusState.time--;
        }
        pokemon.statusState.time--;
        if (pokemon.statusState.time <= 0) {
            pokemon.cureStatus();
            return;
        }
        this.add('cant', pokemon, 'slp');
        if (move.sleepUsable) {
            return;
        }
        return false;
    },
    onDamage(damage, target, source, move) {
        if (
            (move.category === 'Physical' || move.category === 'Special') &&
            move.id !== 'falseswipe' &&
            move.id !== 'holdback' &&
            move.id !== 'dreameater' &&
            !target.volatiles['nightmare']
        ) { {
            target.cureStatus();
        }
        }
    }
}
