{
  num: -356030,
  accuracy: 100,
  basePower: 15,
  category: "Special",
  name: "Solemn Mourning",
  pp: 5,
  priority: 0,
  flags: { protect: 1 },
  type: "Ghost",
  target: "allAdjacentFoes",
  contestType: "Tough",
  multihit: [10, 10],

  onTryMove(pokemon) {
    const cost = Math.floor(pokemon.maxhp / 2) || 1;
    if (pokemon.hp <= cost) {
      this.add('-fail', pokemon, 'move: Solemn Mourning');
      return false;
    }
    return true;
  },

  onAfterMove(pokemon) {
    
    this.damage(Math.floor(pokemon.maxhp / 2) || 1, pokemon, pokemon);

    
    pokemon.whitebutterflyLayers = (pokemon.whitebutterflyLayers || 0) + 5;
    pokemon.blackbutterflyLayers = (pokemon.blackbutterflyLayers || 0) + 5;

    
    this.add('-start', pokemon, 'solemnmourning');
  }
}