{
  name: "Mesmerizer",
  num: -6001,
  accuracy: 100,
  basePower: 90,
  category: "Special",
  pp: 10,
  priority: 0,
  flags: { protect: 1, sound: 1, mirror: 1, metronome: 1 },
  secondary: null,

  onHit(target, pokemon, move) {
    if (!pokemon || pokemon.transformed) return;

    const baseSpecies = pokemon.baseSpecies?.baseSpecies || pokemon.baseSpecies?.name || pokemon.species?.baseSpecies || pokemon.species?.name || "";
    const baseId = baseSpecies.toLowerCase().replace(/[^a-z0-9]+/g, "");
    const speciesId = pokemon.species?.id || "";

    if (baseId !== "meloettadelta" && !speciesId.startsWith("meloettadelta")) return;
    if (pokemon.getAbility?.().id !== "hatsune") return;

    if (!pokemon.m) pokemon.m = {};
    if (!pokemon.m.meloettaDeltaMesmerizerForm) {
      pokemon.m.meloettaDeltaMesmerizerForm = speciesId.includes("teto") ? "teto" : "miku";
    }

    move.willChangeForme = true;
  },

  onAfterMoveSecondarySelf(pokemon, target, move) {
    if (!move.willChangeForme) return;

    if (!pokemon.m) pokemon.m = {};

    const speciesId = pokemon.species?.id || "";
    const isTeto = pokemon.m.meloettaDeltaMesmerizerForm === "teto" || speciesId.includes("teto");
    const newForm = isTeto ? "Meloettadelta" : "Meloettadelta-Teto";

    pokemon.formeChange(newForm, this.effect, false, "[msg]");
    pokemon.m.meloettaDeltaMesmerizerForm = isTeto ? "miku" : "teto";
    move.willChangeForme = false;
  },

  target: "normal",
  type: "Normal",
  contestType: "Beautiful"
}
