{
  onStart(source) {
    
    if (source.sorrowStarted) return;
    source.sorrowStarted = true;
    
    
    this.add('-activate', source, 'ability: Sorrow');
    
    
    this.field.setWeather('raindance');
    
    
    this.add('-weather', 'RainDance', '[from] ability: Sorrow');
  },
  
  
  onDamage(damage, target, source, effect) {
    
    if (damage >= target.hp && !target.fainted) {
      
      if (target.sorrowSurvived) {
        
        return damage;
      }
      
      
      target.sorrowSurvived = true;
      
      
      const finalDamage = target.hp - 1;
      
      
      this.add('-activate', target, 'ability: Sorrow');
      
      
      this.boost({spa: 2, spe: 1}, target, target, null, true);
      
      return finalDamage;
    }
  },
  
  
  onSwitchOut(pokemon) {
    
    if (pokemon.sorrowStarted) {
      delete pokemon.sorrowStarted;
    }
    
  },
  
  
  onSwitchIn(pokemon) {
    
    if (!pokemon.sorrowStarted) {
      pokemon.sorrowStarted = true;
      
      
      this.add('-activate', pokemon, 'ability: Sorrow');
      
      
      this.field.setWeather('raindance');
      
      
      this.add('-weather', 'RainDance', '[from] ability: Sorrow');
    }
  },
  
  
  flags: {},
  name: "Sorrow",
  rating: 4,
  num: -356006
}