{
    name: "VoidFog",
    effectType: "Weather",
    duration: 5,
    durationCallback(source, effect) {
      if (source?.hasItem("voidrock")) {
        return 8;
      }
      return 5;
    },
    onTryMovePriority: 1,
    onTryMove(attacker, defender, move) {
      if (move.flags["canuseinvoid"])
        return;
      if (move.flags["light"] && !attacker.hasAbility(["illuminate", "lightforce", "lunarpower"])) {
        this.debug("Void Fog light suppress");
        this.add("-fail", attacker, "[from] Void Fog");
        this.attrLastMove("[still]");
        return null;
      }
    },
    onModifyDef(def, pokemon) {
      if (pokemon.hasType("Psychic")) {
        return this.chainModify(1.5);
      }
    },
    onTryBoost(boost, target, source, effect) {
      if (!target.hasType("Dark")) return;

      let blocked = false;
      for (const stat in boost) {
        if (boost[stat] < 0) {
          delete boost[stat];
          blocked = true;
        }
      }
      if (blocked) {
        this.add("-fail", target, "unboost", "[from] weather: Void Fog");
      }

      if (!Object.keys(boost).length) return null;
    },
    onFieldStart(battle, source, effect) {
      if (effect?.effectType === "Ability") {
        this.add("-weather", "VoidFog", "[from] ability: " + effect.name, "[of] " + source);
      } else {
        this.add("-weather", "VoidFog");
      }
    },
    onFieldResidualOrder: 1,
    onFieldResidual() {
      this.add("-weather", "VoidFog", "[upkeep]");
      this.eachEvent("Weather");
    },
    onFieldEnd() {
      this.add("-weather", "none");
    }
}