{
    onUpdate(pokemon) {
        if (pokemon.status === "slp") {
            this.add("-activate", pokemon, "ability: Insomnia");
            pokemon.cureStatus();
        }
    },
    onSetStatus(status, target, source, effect) {
        if (status.id !== "slp")
            return;
        if (effect?.status) {
            this.add("-immune", target, "[from] ability: Insomnia");
        }
        return false;
    },
    onTryAddVolatile(status, target) {
        if (status.id === "yawn") {
            this.add("-immune", target, "[from] ability: Insomnia");
            return null;
        }
    },
    onSourceModifyAtkPriority: 6,
    onSourceModifyAtk(atk, attacker, defender, move) {
        if (move.type === "Dark" || move.type === "Ghost") {
            this.debug("Insomnia weaken");
            return this.chainModify(0.5);
        }
    },
    onSourceModifySpAPriority: 5,
    onSourceModifySpA(atk, attacker, defender, move) {
        if (move.type === "Dark" || move.type === "Ghost") {
            this.debug("Insomnia weaken");
            return this.chainModify(0.5);
        }
    },
    flags: { breakable: 1 },
    name: "Insomnia",
    rating: 1.5,
    num: 15
}
