{
  num: -13105,
  accuracy: true,
  basePower: 0,
  category: "Status",
  name: "Minazuki Aura",
  pp: 1,
  priority: 0,
  flags: {},
  sideCondition: "minazukiaura",
  condition: {
    onSideStart(side, source) {
      this.effectState.unohanaSource = source;
      this.effectState.bankai = this.effect.isBankai.call(this, source);
      this.add("-activate", source, "ability: Minazuki");
    },
    minazukiFields(pokemon) {
      return [
        pokemon?.species?.id,
        pokemon?.species?.name,
        pokemon?.species?.baseSpecies,
        pokemon?.baseSpecies?.baseSpecies,
        pokemon?.baseSpecies?.name,
        pokemon?.ability,
        pokemon?.baseAbility,
        pokemon?.abilityState?.id,
        pokemon?.set?.ability,
        pokemon?.getAbility?.()?.id,
        pokemon?.name,
        pokemon?.set?.species,
        pokemon?.set?.name,
        pokemon?.speciesState?.id,
        pokemon?.details
      ].map(value => String(value || "").toLowerCase().replace(/[^a-z0-9]/g, ""));
    },
    isAlive(pokemon) {
      return !!pokemon && pokemon.fainted !== true && pokemon.hp !== 0;
    },
    findUnohana(side) {
      if (!side?.pokemon) return null;
      for (const ally of side.pokemon) {
        const fields = this.effect.minazukiFields.call(this, ally);
        const unohana = fields.some(value => value === "minazuki" || value === "unohana" || value === "unohanamega" || value === "unohanabankai" || value.includes("unohana") || value.includes("minazuki"));
        if (this.effect.isAlive.call(this, ally) && unohana) return ally;
      }
      return null;
    },
    isBankai(source) {
      if (source?.bleachCaptainAwakened) return true;
      return this.effect.minazukiFields.call(this, source).some(value => value === "unohanamega" || value === "unohanabankai" || value.includes("unohanamega") || value.includes("unohanabankai") || value.endsWith("mega") || value.endsWith("bankai"));
    },
    refresh(side) {
      const source = this.effect.findUnohana.call(this, side);
      if (!source) return null;
      this.effectState.unohanaSource = source;
      this.effectState.bankai = this.effect.isBankai.call(this, source) || !!this.effectState.bankai;
      return source;
    },
    onSwitchIn(pokemon) {
      this.effect.refresh.call(this, pokemon.side);
    },
    onUpdate(pokemon) {
      if (!pokemon || !pokemon.hp || pokemon.fainted) return;
      this.effect.refresh.call(this, pokemon.side);
    },
    onAfterDamage(damage, target, source, effect) {
      if (!target || !target.hp || target.fainted) return;
      this.effect.refresh.call(this, target.side);
    }
  },
  secondary: null,
  target: "allySide",
  type: "Psychic",
  desc: "Internal Minazuki team support aura."
}
