{
  name: "Transience",
  rating: 3,
  num: -1009,
  flags: {},

  onModifyDamage(damage, source, target, move) {
    if (source !== this.effectState.target || move.category === "Status") return;
    this.effectState.transienceLastDamage = damage;
  },

  onAfterMove(pokemon, target, move) {
    if (!this.effectState.transienceLastDamage) return;
    if (pokemon !== this.effectState.target || move.category === "Status") return;

    const healAmount = Math.floor(this.effectState.transienceLastDamage / 4);
    if (healAmount > 0) {
      this.heal(healAmount, pokemon, pokemon);
    }

    this.effectState.transienceLastDamage = null;
  }
}