{
  num: -356026,
  accuracy: true,
  basePower: 0,
  category: "Status",
  name: "Dying",
  pp: 10,
  priority: 0,
  flags: { heal: 1 },

  onTry(source) {
    const layers = source.whitebutterflyLayers || 0;
    if (layers === 0) {
      this.add('-fail', source, 'move: Dying');
      return false;
    }

    if (source.hp === source.maxhp) {
      this.add('-fail', source, 'heal');
      return false;
    }

    return true;
  },

  onHit(source) {
    const layers = source.whitebutterflyLayers || 0;
    if (layers === 0) return false;

    const healPercent = layers * 0.1;
    let healAmount = Math.floor(source.maxhp * healPercent);
    const maxHeal = source.maxhp - source.hp;
    if (healAmount > maxHeal) healAmount = maxHeal;

    if (healAmount > 0) {
      this.heal(healAmount, source, source, this.effect);
      this.add('-activate', source, 'move: Dying');
      this.add('-start', source, 'dying', layers);

      source.whitebutterflyLayers = 0;
    }
  },

  target: "self",
  type: "Normal",
  contestType: "Cute"
}