{
  num: -356029,
  accuracy: true,
  basePower: 0,
  category: "Status",
  name: "Redemption",
  pp: 1,
  priority: 0,
  flags: { heal: 1 },
  type: "Normal",
  contestType: "Beautiful",

  onTryMove(pokemon) {
    const faintedAllies = pokemon.side.pokemon.filter(ally => ally.fainted);
    if (faintedAllies.length === 0) {
      this.add('-fail', pokemon, 'move: Redemption', '[no fainted allies]');
      return false;
    }

    if (!pokemon.whitebutterflyLayers || pokemon.whitebutterflyLayers < 10) {
      this.add('-fail', pokemon, 'move: Redemption', '[insufficient layers]');
      return false;
    }

    return true;
  },

  onHit(pokemon) {
    const layers = pokemon.whitebutterflyLayers;
    pokemon.whitebutterflyLayers = 0;
    this.add('-activate', pokemon, 'move: Redemption');

    pokemon.side.needHalfHPRevive = true;
    pokemon.side.addSlotCondition(pokemon.position, 'revivalblessing');
  },

  target: "self",
  selfSwitch: true,
  noSketch: true,
  secondary: null
}