{
  name: "Grim Sigil",
  rating: 4,
  num: -21502,
  flags: {},

  onSwitchIn(pokemon) {
    if (pokemon.abilityState.used) return;

    const foes = pokemon.side.foe.active.filter(x => x && !x.fainted);
    if (!foes.length) return;

    const disableMove = this.dex.moves.get("disable");
    let success = false;

    for (const foe of foes) {
      if (foe.volatiles["disable"]) continue;
      if (!foe.lastMove || foe.lastMove.isZ || foe.lastMove.isMax || foe.lastMove.id === "struggle") continue;

      let hasPP = true;
      for (const slot of foe.moveSlots) {
        if (slot.id === foe.lastMove.id) {
          if (!slot.pp) hasPP = false;
          break;
        }
      }
      if (!hasPP) continue;

      if (foe.addVolatile("disable", pokemon, disableMove)) {
        success = true;
      }
    }

    if (!success) return;

    this.add("-ability", pokemon, "Grim Sigil");
    this.boost({ atk: 1 }, pokemon);
    pokemon.abilityState.used = true;
  }
}
