Program: 160081
Project: 160081
Buggy source:
public void apply(Game game){
  removeInactiveEffects(game);
  List<ContinuousEffect> layerEffects=getLayeredEffects(game);
  List<ContinuousEffect> layer=filterLayeredEffects(layerEffects,Layer.CopyEffects_1);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.CopyEffects_1,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.ControlChangingEffects_2);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.ControlChangingEffects_2,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.TextChangingEffects_3);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.TextChangingEffects_3,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.TypeChangingEffects_4);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.TypeChangingEffects_4,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.ColorChangingEffects_5);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.ColorChangingEffects_5,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.AbilityAddingRemovingEffects_6);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.AbilityAddingRemovingEffects_6,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layerEffects=getLayeredEffects(game);
  layer=filterLayeredEffects(layerEffects,Layer.PTChangingEffects_7);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PTChangingEffects_7,SubLayer.SetPT_7b,layeredEffects.getAbility(effect.getId()),game);
  }
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PTChangingEffects_7,SubLayer.ModifyPT_7c,layeredEffects.getAbility(effect.getId()),game);
  }
  applyCounters.apply(Layer.PTChangingEffects_7,SubLayer.Counters_7d,null,game);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PTChangingEffects_7,SubLayer.SwitchPT_e,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.PlayerEffects);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PlayerEffects,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.RulesEffects);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.RulesEffects,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
}

Fixed version (ground truth):
public void apply(Game game){
  removeInactiveEffects(game);
  List<ContinuousEffect> layerEffects=getLayeredEffects(game);
  List<ContinuousEffect> layer=filterLayeredEffects(layerEffects,Layer.CopyEffects_1);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.CopyEffects_1,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.ControlChangingEffects_2);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.ControlChangingEffects_2,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.TextChangingEffects_3);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.TextChangingEffects_3,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.TypeChangingEffects_4);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.TypeChangingEffects_4,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.ColorChangingEffects_5);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.ColorChangingEffects_5,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.AbilityAddingRemovingEffects_6);
  for (  ContinuousEffect effect : layer) {
    layerEffects=getLayeredEffects(game);
    if (layerEffects.contains(effect)) {
      effect.apply(Layer.AbilityAddingRemovingEffects_6,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
    }
  }
  layer=filterLayeredEffects(layerEffects,Layer.PTChangingEffects_7);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PTChangingEffects_7,SubLayer.SetPT_7b,layeredEffects.getAbility(effect.getId()),game);
  }
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PTChangingEffects_7,SubLayer.ModifyPT_7c,layeredEffects.getAbility(effect.getId()),game);
  }
  applyCounters.apply(Layer.PTChangingEffects_7,SubLayer.Counters_7d,null,game);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PTChangingEffects_7,SubLayer.SwitchPT_e,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.PlayerEffects);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.PlayerEffects,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
  layer=filterLayeredEffects(layerEffects,Layer.RulesEffects);
  for (  ContinuousEffect effect : layer) {
    effect.apply(Layer.RulesEffects,SubLayer.NA,layeredEffects.getAbility(effect.getId()),game);
  }
}