{
  name: "Malice Mender",
  rating: 4,
  num: -2006,
  flags: {},
  onBeforeMove(pokemon, target, move) {
    if (pokemon !== this.effectState.target) return;
    const curative = new Set(["aromatherapy", "healbell", "junglehealing", "remedialchain"]);
    this.effectState.mmActive = curative.has(move.id);
    if (!this.effectState.mmActive) return;
    const prev = {};
    const allies = [...pokemon.side.pokemon, ...(pokemon.side.allySide?.pokemon || [])];
    const foes = [...pokemon.side.foe.pokemon, ...(pokemon.side.foe.allySide?.pokemon || [])];
    for (const mon of [...allies, ...foes]) {
      if (!mon) continue;
      const key = `${mon.side.n}-${mon.position}`;
      prev[key] = mon.status || "";
    }
    this.effectState.mmPrev = prev;
  },
  onAfterMove(pokemon, target, move) {
    if (pokemon !== this.effectState.target) return;
    if (!this.effectState.mmActive) return;
    const prev = this.effectState.mmPrev || {};
    let curedCount = 0;
    const allies = [...pokemon.side.pokemon, ...(pokemon.side.allySide?.pokemon || [])];
    const foes = [...pokemon.side.foe.pokemon, ...(pokemon.side.foe.allySide?.pokemon || [])];
    for (const mon of [...allies, ...foes]) {
      if (!mon) continue;
      const key = `${mon.side.n}-${mon.position}`;
      const before = prev[key] || "";
      const after = mon.status || "";
      if (before && !after) curedCount++;
    }
    this.effectState.mmActive = false;
    this.effectState.mmPrev = undefined;
    if (curedCount > 0) {
      this.add("-ability", pokemon, "Malice Mender");
      this.boost({ spa: curedCount }, pokemon, pokemon, null, false, true);
      if (curedCount > 1) {
        this.add("-message", pokemon.name + "'s Special Attack rose by " + curedCount + " stages due to Malice Mender!");
      }
    }
  }
}
