{
    num: 604,
    accuracy: true,
    basePower: 0,
    category: "Status",
    name: "Electric Terrain",
    pp: 10,
    priority: 0,
    flags: { nonsky: 1, metronome: 1 },
    terrain: "electricterrain",
    condition: {
        duration: 5,
        durationCallback(source, effect) {
            if (source?.hasItem("terrainextender")) {
                return 8;
            }
            return 5;
        },
        onSetStatus(status, target, source, effect) {
            if (status.id === "slp" && target.isGrounded() && !target.isSemiInvulnerable() && !target.hasItem("heavydutyboots")) {
                if (effect.id === "yawn" || effect.effectType === "Move" && !effect.secondaries) {
                    this.add("-activate", target, "move: Electric Terrain");
                }
                return false;
            }
        },
        onTryAddVolatile(status, target) {
            if (!target.isGrounded() || target.isSemiInvulnerable())
                return;
            if (status.id === "yawn") {
                this.add("-activate", target, "move: Electric Terrain");
                return null;
            }
        },
        onBasePowerPriority: 6,
        onBasePower(basePower, attacker, defender, move) {
            if (move.type === "Electric" && attacker.isGrounded() && !attacker.isSemiInvulnerable() && !attacker.hasItem("heavydutyboots")) {
                this.debug("electric terrain boost");
                return this.chainModify([5325, 4096]);
            }
        },
        onFieldStart(field, source, effect) {
            if (effect?.effectType === "Ability") {
                this.add("-fieldstart", "move: Electric Terrain", "[from] ability: " + effect.name, "[of] " + source);
            } else {
                this.add("-fieldstart", "move: Electric Terrain");
            }
            for (const pokemon of this.getAllActive()) {
                if (pokemon.status === 'slp' && pokemon.isGrounded() && !pokemon.isSemiInvulnerable() && !pokemon.hasItem("heavydutyboots")) {
                    pokemon.cureStatus();
                }
            }
        },
        onFieldResidualOrder: 27,
        onFieldResidualSubOrder: 7,
        onFieldEnd() {
            this.add("-fieldend", "move: Electric Terrain");
        },
        onResidualOrder: 5,
        onResidual() {
            for (const pokemon of this.getAllActive()) {
                if (pokemon.status === 'slp' && pokemon.isGrounded() && !pokemon.isSemiInvulnerable() && !pokemon.hasItem("heavydutyboots")) {
                    pokemon.cureStatus();
                }
            }
        }
    },
    secondary: null,
    target: "all",
    type: "Electric",
    zMove: { boost: { spe: 1 } },
    contestType: "Clever"
}
