{
  num: -510,
  accuracy: 95,
  basePower: 100,
  category: "Special",
  name: "Timeless Torrent",
  pp: 10,
  priority: 0,
  flags: { protect: 1, reflectable: 1, mirror: 1, allyanim: 1, metronome: 1 },
  secondary: {
    chance: 10,
    boosts: {
      spd: -1,
    },
  },
  onAfterMove(pokemon, target, move) {
    if (move.id !== "timelesstorrent") return;
    if (!target.fainted) return;

    const terrain = this.field.terrain;
    const weather = this.field.weather;

    let boosted = false;

    if (terrain === "electricterrain") {
      if (!pokemon.boosts.spe || pokemon.boosts.spe < 6) {
        pokemon.boosts.spe++;
        this.add('-boost', pokemon, 'spe', 1, '[from] move: Timeless Torrent');
      }
      boosted = true;
    }

    if (weather === "sunnyday" || weather === "desolateland") {
      if (!pokemon.boosts.spa || pokemon.boosts.spa < 6) {
        pokemon.boosts.spa++;
        this.add('-boost', pokemon, 'spa', 1, '[from] move: Timeless Torrent');
      }
      boosted = true;
    }

    if (!boosted) {
      this.heal(Math.floor(pokemon.maxhp / 10), pokemon);
    }
  },
  target: "normal",
  type: "Dragon",
  zMove: { boost: { spa: 1 } },
  contestType: "Beautiful",
}
