nus-yam/ex-repair huggingface dataset:
Program: 158168
Project: 158168
Buggy source:
@Override public Iterator<DownloadJob> iterator(){
  Calendar c=Calendar.getInstance();
  c.setTime(new Date());
  c.add(Calendar.DATE,-14);
  Date compareDate=c.getTime();
  ArrayList<DownloadJob> jobs=new ArrayList<>();
  for (  String symbol : symbols) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
    }
  }
  for (  String symbol : withMythics) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
    }
  }
  for (  String symbol : onlyMythics) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str"));
    }
  }
  return jobs.iterator();
}

Fixed version (ground truth):
@Override public Iterator<DownloadJob> iterator(){
  Calendar c=Calendar.getInstance();
  c.setTime(new Date());
  c.add(Calendar.DATE,-14);
  Date compareDate=c.getTime();
  ArrayList<DownloadJob> jobs=new ArrayList<>();
  for (  String symbol : symbols) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
    }
  }
  for (  String symbol : withMythics) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
    }
  }
  for (  String symbol : onlyMythics) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
    }
  }
  for (  String symbol : onlyMythicsAsSpecial) {
    ExpansionSet exp=Sets.findSet(symbol);
    if (exp != null && exp.getReleaseDate().before(compareDate)) {
      jobs.add(generateDownloadJob(symbol,"String_Node_Str","String_Node_Str"));
    }
  }
  return jobs.iterator();
}
Program: 158169
Project: 158169
Buggy source:
private DownloadJob generateDownloadJob(String set,String rarity){
  File dst=new File(outDir,set + "String_Node_Str" + rarity+ "String_Node_Str");
  if (symbolsReplacements.containsKey(set)) {
    set=symbolsReplacements.get(set);
  }
  String url="String_Node_Str" + set + "String_Node_Str"+ rarity;
  return new DownloadJob(set + "String_Node_Str" + rarity,fromURL(url),toFile(dst));
}

Fixed version (ground truth):
private DownloadJob generateDownloadJob(String set,String rarity,String urlRarity){
  File dst=new File(outDir,set + "String_Node_Str" + rarity+ "String_Node_Str");
  if (symbolsReplacements.containsKey(set)) {
    set=symbolsReplacements.get(set);
  }
  String url="String_Node_Str" + set + "String_Node_Str"+ urlRarity;
  return new DownloadJob(set + "String_Node_Str" + rarity,fromURL(url),toFile(dst));
}
Program: 158173
Project: 158173
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    new GetEnergyCountersControllerEffect(2).apply(game,source);
    if (controller.getCounters().getCount(CounterType.ENERGY) > 5) {
      Cost cost=new PayEnergyCost(6);
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),true)) {
        new UntapAllControllerEffect(new FilterControlledCreaturePermanent(),"String_Node_Str").apply(game,source);
        new AdditionalCombatPhaseEffect("String_Node_Str").apply(game,source);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    new GetEnergyCountersControllerEffect(2).apply(game,source);
    if (controller.getCounters().getCount(CounterType.ENERGY) > 7) {
      Cost cost=new PayEnergyCost(8);
      if (controller.chooseUse(outcome,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",source,game) && cost.pay(source,game,source.getSourceId(),source.getControllerId(),true)) {
        new UntapAllControllerEffect(new FilterControlledCreaturePermanent()).apply(game,source);
        new AdditionalCombatPhaseEffect().apply(game,source);
      }
    }
    return true;
  }
  return false;
}
Program: 158174
Project: 158174
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    return player.addCounters(CounterType.ENERGY.createInstance(value.calculate(game,source,this)),game);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    return controller.addCounters(CounterType.ENERGY.createInstance(value.calculate(game,source,this)),game);
  }
  return false;
}
Program: 158175
Project: 158175
Buggy source:
@Override public boolean apply(Game game,Ability source){
  RevoltWatcher watcher=(RevoltWatcher)game.getState().getWatchers().get("String_Node_Str");
  return watcher != null && watcher.revoltActive(source.getControllerId());
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  RevoltWatcher watcher=(RevoltWatcher)game.getState().getWatchers().get(RevoltWatcher.class.getName());
  return watcher != null && watcher.revoltActive(source.getControllerId());
}
Program: 158176
Project: 158176
Buggy source:
public RevoltWatcher(final RevoltWatcher watcher){
  super(watcher);
}

Fixed version (ground truth):
public RevoltWatcher(final RevoltWatcher watcher){
  super(watcher);
  this.revoltActivePlayerIds.addAll(watcher.revoltActivePlayerIds);
}
Program: 158177
Project: 158177
Buggy source:
public boolean activate(Game game,boolean noMana){
  if (!spellAbilities.get(0).activate(game,noMana)) {
    return false;
  }
  if (spellAbilities.size() > 1) {
    boolean ignoreAbility=true;
    boolean payNoMana=noMana;
    for (    SpellAbility spellAbility : spellAbilities) {
      if (ignoreAbility) {
        ignoreAbility=false;
      }
 else {
        payNoMana|=spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE);
        if (!spellAbility.activate(game,payNoMana)) {
          return false;
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean activate(Game game,boolean noMana){
  if (!spellAbilities.get(0).activate(game,noMana)) {
    return false;
  }
  if (spellAbilities.size() > 1) {
    boolean ignoreAbility=true;
    boolean payNoMana=noMana;
    for (    SpellAbility spellAbility : spellAbilities) {
      if (ignoreAbility) {
        ignoreAbility=false;
      }
 else {
        payNoMana|=spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE);
        if (!spellAbility.activate(game,payNoMana)) {
          return false;
        }
      }
    }
  }
  setDoneActivatingManaAbilities(false);
  return true;
}
Program: 158179
Project: 158179
Buggy source:
@Override public boolean moveCardToExileWithInfo(Card card,UUID exileId,String exileName,UUID sourceId,Game game,Zone fromZone,boolean withName){
  boolean result=false;
  if (card.moveToExile(exileId,exileName,sourceId,game)) {
    if (!game.isSimulation()) {
      if (card instanceof PermanentCard) {
        Card basicCard=game.getCard(card.getId());
        if (basicCard != null) {
          card=basicCard;
        }
      }
      game.informPlayers(this.getLogName() + "String_Node_Str" + (withName ? card.getLogName() : "String_Node_Str")+ "String_Node_Str"+ (fromZone != null ? "String_Node_Str" + fromZone.toString().toLowerCase(Locale.ENGLISH) + "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
    }
    result=true;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean moveCardToExileWithInfo(Card card,UUID exileId,String exileName,UUID sourceId,Game game,Zone fromZone,boolean withName){
  boolean result=false;
  if (card.moveToExile(exileId,exileName,sourceId,game)) {
    if (!game.isSimulation()) {
      if (card instanceof PermanentCard) {
        Card basicCard=game.getCard(card.getId());
        if (basicCard != null) {
          card=basicCard;
        }
      }
      game.informPlayers(this.getLogName() + "String_Node_Str" + (withName ? card.getLogName() + (card.isCopy() ? "String_Node_Str" : "String_Node_Str") : "String_Node_Str")+ "String_Node_Str"+ (fromZone != null ? "String_Node_Str" + fromZone.toString().toLowerCase(Locale.ENGLISH) + "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
    }
    result=true;
  }
  return result;
}
Program: 158181
Project: 158181
Buggy source:
@Override public boolean apply(Game game,Ability source){
  for (  UUID targetPlayerId : targetPointer.getTargets(game,source)) {
    Player player=game.getPlayer(targetPlayerId);
    if (player != null) {
      player.discard(amount.calculate(game,source,this),randomDiscard,source,game);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  for (  UUID targetPlayerId : targetPointer.getTargets(game,source)) {
    Player player=game.getPlayer(targetPlayerId);
    if (player != null) {
      player.discard(amount.calculate(game,source,this),randomDiscard,source,game);
    }
  }
  return true;
}
Program: 158182
Project: 158182
Buggy source:
public LazavDimirEffect(final LazavDimirEffect effect){
  super(effect);
  this.cardToCopy=effect.cardToCopy;
  this.IdOfCopiedCard=effect.IdOfCopiedCard;
}

Fixed version (ground truth):
public LazavDimirEffect(final LazavDimirEffect effect){
  super(effect);
  this.cardToCopy=effect.cardToCopy;
}
Program: 158184
Project: 158184
Buggy source:
@Override public boolean apply(Game game,Ability source){
  FairgroundsTrumpeterWatcher watcher=(FairgroundsTrumpeterWatcher)game.getState().getWatchers().get("String_Node_Str");
  return watcher != null && watcher.p1p1AddedToPermanent(source.getControllerId());
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  FairgroundsTrumpeterWatcher watcher=(FairgroundsTrumpeterWatcher)game.getState().getWatchers().get(FairgroundsTrumpeterWatcher.class.getName());
  return watcher != null && watcher.p1p1AddedToPermanent(source.getControllerId());
}
Program: 158185
Project: 158185
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.COUNTER_ADDED && event.getData().equals(CounterType.P1P1.getName())) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
      players.add(permanent.getControllerId());
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.COUNTER_ADDED && event.getData().equals(CounterType.P1P1.getName())) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent != null) {
      players.add(permanent.getControllerId());
    }
  }
}
Program: 158186
Project: 158186
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Player player=game.getPlayer(getTargetPointer().getFirst(game,source));
    if (player != null) {
      for (      Counter counter : player.getCounters().values()) {
        counter.increase();
      }
    }
    Permanent permanent=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (permanent != null) {
      for (      Counter counter : permanent.getCounters(game).values()) {
        counter.increase();
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Player player=game.getPlayer(getTargetPointer().getFirst(game,source));
    if (player != null) {
      Counters counters=player.getCounters().copy();
      for (      Counter counter : counters.values()) {
        CounterType counterType=CounterType.findByName(counter.getName());
        Counter counterToAdd;
        if (counterType != null) {
          counterToAdd=counterType.createInstance();
        }
 else {
          counterToAdd=new Counter(counter.getName());
        }
        player.addCounters(counterToAdd,game);
      }
      return true;
    }
    Permanent permanent=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (permanent != null) {
      Counters counters=permanent.getCounters(game).copy();
      for (      Counter counter : counters.values()) {
        CounterType counterType=CounterType.findByName(counter.getName());
        Counter counterToAdd;
        if (counterType != null) {
          counterToAdd=counterType.createInstance();
        }
 else {
          counterToAdd=new Counter(counter.getName());
        }
        permanent.addCounters(counterToAdd,source,game);
      }
    }
    return true;
  }
  return false;
}
Program: 158187
Project: 158187
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Player player=game.getPlayer(getTargetPointer().getFirst(game,source));
    if (player != null) {
      for (      Counter counter : player.getCounters().values()) {
        counter.increase();
      }
    }
    Permanent permanent=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (permanent != null) {
      for (      Counter counter : permanent.getCounters(game).values()) {
        counter.increase();
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Player player=game.getPlayer(getTargetPointer().getFirst(game,source));
    if (player != null) {
      Counters counters=player.getCounters().copy();
      for (      Counter counter : counters.values()) {
        CounterType counterType=CounterType.findByName(counter.getName());
        Counter counterToAdd;
        if (counterType != null) {
          counterToAdd=counterType.createInstance();
        }
 else {
          counterToAdd=new Counter(counter.getName());
        }
        player.addCounters(counterToAdd,game);
      }
      return true;
    }
    Permanent permanent=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (permanent != null) {
      Counters counters=permanent.getCounters(game).copy();
      for (      Counter counter : counters.values()) {
        CounterType counterType=CounterType.findByName(counter.getName());
        Counter counterToAdd;
        if (counterType != null) {
          counterToAdd=counterType.createInstance();
        }
 else {
          counterToAdd=new Counter(counter.getName());
        }
        permanent.addCounters(counterToAdd,source,game);
      }
    }
    return true;
  }
  return false;
}
Program: 158188
Project: 158188
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  ManaCostsImpl cost=new ManaCostsImpl("String_Node_Str");
  if (player != null) {
    if (player.chooseUse(Outcome.Benefit,"String_Node_Str" + cost.getText() + "String_Node_Str",source,game)) {
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),false,null)) {
        StackAbility ability=(StackAbility)getValue("String_Node_Str");
        Player controller=game.getPlayer(source.getControllerId());
        Permanent sourcePermanent=game.getPermanent(source.getSourceId());
        if (ability != null && controller != null) {
          ability.createCopyOnStack(game,source,source.getControllerId(),true);
          game.informPlayers(new StringBuilder(sourcePermanent.getName()).append("String_Node_Str").append(controller.getLogName()).append("String_Node_Str").toString());
          return true;
        }
        return false;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  ManaCostsImpl cost=new ManaCostsImpl("String_Node_Str");
  if (player != null) {
    if (player.chooseUse(Outcome.Benefit,"String_Node_Str" + cost.getText() + "String_Node_Str",source,game)) {
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),false,null)) {
        StackAbility ability=(StackAbility)getValue("String_Node_Str");
        Player controller=game.getPlayer(source.getControllerId());
        Permanent sourcePermanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (ability != null && controller != null && sourcePermanent != null) {
          ability.createCopyOnStack(game,source,source.getControllerId(),true);
          game.informPlayers(sourcePermanent.getIdName() + "String_Node_Str" + controller.getLogName()+ "String_Node_Str");
          return true;
        }
        return false;
      }
    }
  }
  return false;
}
Program: 158189
Project: 158189
Buggy source:
@Override public String getText(Mode mode){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(mode.getTargets().get(0).getTargetName());
  sb.append("String_Node_Str");
  if (targetZone.equals(Zone.EXILED)) {
    sb.append("String_Node_Str");
  }
  if (targetZone.equals(Zone.HAND)) {
    sb.append("String_Node_Str");
  }
  if (targetZone.equals(Zone.LIBRARY)) {
    sb.append("String_Node_Str");
switch (zoneDetail) {
case BOTTOM:
      sb.append("String_Node_Str");
case TOP:
    sb.append("String_Node_Str");
case CHOOSE:
  sb.append("String_Node_Str");
case NONE:
sb.append("String_Node_Str");
}
sb.append("String_Node_Str");
}
return sb.toString();
}

Fixed version (ground truth):
@Override public String getText(Mode mode){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(mode.getTargets().get(0).getTargetName());
  sb.append("String_Node_Str");
  if (targetZone.equals(Zone.EXILED)) {
    sb.append("String_Node_Str");
  }
  if (targetZone.equals(Zone.HAND)) {
    sb.append("String_Node_Str");
  }
  if (targetZone.equals(Zone.LIBRARY)) {
    sb.append("String_Node_Str");
switch (zoneDetail) {
case BOTTOM:
      sb.append("String_Node_Str");
    break;
case TOP:
  sb.append("String_Node_Str");
break;
case CHOOSE:
sb.append("String_Node_Str");
break;
case NONE:
sb.append("String_Node_Str");
break;
}
sb.append("String_Node_Str");
}
return sb.toString();
}
Program: 158191
Project: 158191
Buggy source:
@Override public boolean apply(Game game,Ability source){
  RevoltWatcher watcher=(RevoltWatcher)game.getState().getWatchers().get("String_Node_Str");
  return watcher.revoltActive(source.getControllerId());
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  RevoltWatcher watcher=(RevoltWatcher)game.getState().getWatchers().get("String_Node_Str");
  return watcher != null && watcher.revoltActive(source.getControllerId());
}
Program: 158192
Project: 158192
Buggy source:
@Override public boolean applies(UUID objectId,Ability source,UUID affectedControllerId,Game game){
  Card card=game.getCard(objectId);
  if (card != null && affectedControllerId.equals(card.getOwnerId()) && game.getState().getZone(card.getId()) == Zone.EXILED) {
    HashSet<MageObjectReference> exiledCardsByPlayer=(HashSet)game.getState().getValue(UbaMask.UBA_MASK_VALUE_KEY + affectedControllerId);
    if (exiledCardsByPlayer != null) {
      return exiledCardsByPlayer.contains(new MageObjectReference(card,game));
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(UUID objectId,Ability source,UUID affectedControllerId,Game game){
  Card card=game.getCard(objectId);
  if (card != null && affectedControllerId.equals(card.getOwnerId()) && game.getState().getZone(card.getId()) == Zone.EXILED) {
    UbaMaskExiledCardsWatcher watcher=(UbaMaskExiledCardsWatcher)game.getState().getWatchers().get(UbaMaskExiledCardsWatcher.class.getName());
    if (watcher != null) {
      List<MageObjectReference> exiledThisTurn=watcher.getUbaMaskExiledCardsThisTurn(affectedControllerId);
      return exiledThisTurn != null && exiledThisTurn.contains(new MageObjectReference(card,game));
    }
  }
  return false;
}
Program: 158193
Project: 158193
Buggy source:
@Override public boolean checksEventType(GameEvent event,Game game){
  return event.getType() == GameEvent.EventType.DRAW_CARD || event.getType() == GameEvent.EventType.PLAY_TURN;
}

Fixed version (ground truth):
@Override public boolean checksEventType(GameEvent event,Game game){
  return event.getType() == GameEvent.EventType.DRAW_CARD;
}
Program: 158194
Project: 158194
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  if (event.getType().equals(GameEvent.EventType.PLAY_TURN)) {
    for (    UUID playerId : game.getPlayerList()) {
      game.getState().setValue(UbaMask.UBA_MASK_VALUE_KEY + source.getSourceId() + playerId,null);
    }
    return false;
  }
  MageObject sourceObject=source.getSourceObject(game);
  Player player=game.getPlayer(event.getPlayerId());
  if (player != null && sourceObject != null) {
    Card card=player.getLibrary().getFromTop(game);
    if (card != null) {
      player.moveCardsToExile(card,source,game,true,source.getId(),sourceObject.getIdName());
      HashSet<MageObjectReference> exiledCardsByPlayer=(HashSet)game.getState().getValue(UbaMask.UBA_MASK_VALUE_KEY + event.getPlayerId());
      if (exiledCardsByPlayer == null) {
        exiledCardsByPlayer=new HashSet<>();
        game.getState().setValue(UbaMask.UBA_MASK_VALUE_KEY + event.getPlayerId(),exiledCardsByPlayer);
      }
      exiledCardsByPlayer.add(new MageObjectReference(card.getId(),game));
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  MageObject sourceObject=source.getSourceObject(game);
  Player player=game.getPlayer(event.getPlayerId());
  if (player != null && sourceObject != null) {
    Card card=player.getLibrary().getFromTop(game);
    if (card != null) {
      if (player.moveCardsToExile(card,source,game,true,source.getSourceId(),sourceObject.getIdName())) {
        UbaMaskExiledCardsWatcher watcher=(UbaMaskExiledCardsWatcher)game.getState().getWatchers().get(UbaMaskExiledCardsWatcher.class.getName());
        if (watcher != null) {
          watcher.addExiledCard(event.getPlayerId(),card,game);
        }
      }
    }
  }
  return true;
}
Program: 158195
Project: 158195
Buggy source:
@Override public UbaMaskPlayEffect copy(){
  return new UbaMaskPlayEffect(this);
}

Fixed version (ground truth):
@Override public UbaMaskExiledCardsWatcher copy(){
  return new UbaMaskExiledCardsWatcher(this);
}
Program: 158196
Project: 158196
Buggy source:
/** 
 * Tooth and Nail off a cascade is bugged. It let me pay the entwine cost for free even though I had no mana open and the entwine is an additional cost.
 */
@Test public void testHaveToPayAdditionalCosts(){
  playerA.getLibrary().clear();
  addCard(Zone.LIBRARY,playerA,"String_Node_Str",2);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertLife(playerA,15);
  assertHandCount(playerA,5);
  assertPermanentCount(playerA,"String_Node_Str",1);
}

Fixed version (ground truth):
/** 
 * Tooth and Nail off a cascade is bugged. It let me pay the entwine cost for free even though I had no mana open and the entwine is an additional cost.
 */
@Test public void testHaveToPayAdditionalCosts(){
  playerA.getLibrary().clear();
  addCard(Zone.LIBRARY,playerA,"String_Node_Str",2);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertLife(playerA,15);
  assertHandCount(playerA,5);
  assertPermanentCount(playerA,"String_Node_Str",0);
}
Program: 158197
Project: 158197
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Player you=game.getPlayer(this.getControllerId());
  Player upkeepPlayer=game.getPlayer(event.getPlayerId());
  if (you != null && upkeepPlayer != null && upkeepPlayer.getHand().isEmpty()) {
    you.drawCards(1,game);
    you.loseLife(1,game,false);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Player upkeepPlayer=game.getPlayer(event.getPlayerId());
  if (upkeepPlayer != null && upkeepPlayer.getHand().isEmpty()) {
    return true;
  }
  return false;
}
Program: 158198
Project: 158198
Buggy source:
@Override public AsylumVisitorTriggeredAbility copy(){
  return new AsylumVisitorTriggeredAbility(this);
}

Fixed version (ground truth):
@Override public AsylumVisitorEffect copy(){
  return new AsylumVisitorEffect(this);
}
Program: 158199
Project: 158199
Buggy source:
@Override public SpinedSliver copy(){
  return new SpinedSliver(this);
}

Fixed version (ground truth):
@Override public BlockersCount copy(){
  return new BlockersCount(this);
}
Program: 158202
Project: 158202
Buggy source:
public TargetWithAdditionalFilter(Target originalTarget,FilterInPlay<T> additionalFilter,boolean notTarget){
  originalTarget=originalTarget.copy();
  originalTarget.clearChosen();
  this.originalTarget=originalTarget;
  this.targetName=originalTarget.getFilter().getMessage();
  this.notTarget=notTarget;
  this.additionalFilter=additionalFilter;
}

Fixed version (ground truth):
public TargetWithAdditionalFilter(Target originalTarget,FilterInPlay<T> additionalFilter,boolean notTarget){
  this.originalTarget=originalTarget.copy();
  this.originalTarget.clearChosen();
  this.targetName=originalTarget.getFilter().getMessage();
  this.notTarget=notTarget;
  this.additionalFilter=additionalFilter;
}
Program: 158203
Project: 158203
Buggy source:
public PreventDamageToSourceByCardTypeEffect(CardType cardT){
  super(Duration.WhileOnBattlefield);
  cardType=cardT;
}

Fixed version (ground truth):
public PreventDamageToSourceByCardTypeEffect(final PreventDamageToSourceByCardTypeEffect effect){
  super(effect.duration);
}
Program: 158204
Project: 158204
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (super.applies(event,source,game)) {
    if (game.getObject(event.getSourceId()).getCardType().contains(cardType)) {
      if (event.getTargetId().equals(source.getSourceId())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (super.applies(event,source,game)) {
    MageObject sourceObject=game.getObject(event.getSourceId());
    if (sourceObject != null && sourceObject.getCardType().contains(CardType.CREATURE)) {
      if (event.getTargetId().equals(source.getSourceId())) {
        return true;
      }
    }
  }
  return false;
}
Program: 158205
Project: 158205
Buggy source:
@Override public UncleIstvan copy(){
  return new UncleIstvan(this);
}

Fixed version (ground truth):
@Override public PreventAllDamageToSourceEffect copy(){
  return new PreventAllDamageToSourceEffect(this);
}
Program: 158206
Project: 158206
Buggy source:
private void checkForNewImages(){
  long beforeCall=System.currentTimeMillis();
  missingCards=CardRepository.instance.findCards(new CardCriteria());
  LOGGER.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
  beforeCall=System.currentTimeMillis();
  if (DownloadPictures.checkForNewCards(missingCards)) {
    LOGGER.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
    UserRequestMessage message=new UserRequestMessage("String_Node_Str","String_Node_Str" + missingCards.size() + "String_Node_Str"+ "String_Node_Str");
    message.setButton1("String_Node_Str",null);
    message.setButton2("String_Node_Str",PlayerAction.CLIENT_DOWNLOAD_CARD_IMAGES);
    showUserRequestDialog(message);
  }
}

Fixed version (ground truth):
private void checkForNewImages(){
  long beforeCall=System.currentTimeMillis();
  missingCards=CardRepository.instance.findCards(new CardCriteria());
  LOGGER.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
  beforeCall=System.currentTimeMillis();
  if (DownloadPictures.checkForMissingCardImages(missingCards)) {
    LOGGER.info("String_Node_Str" + ((System.currentTimeMillis() - beforeCall) / 1000 + "String_Node_Str"));
    UserRequestMessage message=new UserRequestMessage("String_Node_Str","String_Node_Str" + missingCards.size() + "String_Node_Str"+ "String_Node_Str");
    message.setButton1("String_Node_Str",null);
    message.setButton2("String_Node_Str",PlayerAction.CLIENT_DOWNLOAD_CARD_IMAGES);
    showUserRequestDialog(message);
  }
}
Program: 158207
Project: 158207
Buggy source:
private void jToggleCardViewActionPerformed(java.awt.event.ActionEvent evt){
  if (currentView.cardsSize() > CardGrid.MAX_IMAGES) {
    jToggleCardView.setSelected(false);
    jToggleListView.setSelected(true);
    JOptionPane.showMessageDialog(this,new StringBuilder("String_Node_Str").append(CardGrid.MAX_IMAGES).append("String_Node_Str").toString());
  }
 else {
    if (!(currentView instanceof CardGrid)) {
      toggleViewMode();
    }
    filterCards();
  }
}

Fixed version (ground truth):
private void jToggleCardViewActionPerformed(java.awt.event.ActionEvent evt){
  if (currentView.cardsSize() > CardGrid.MAX_IMAGES) {
    jToggleCardView.setSelected(false);
    jToggleListView.setSelected(true);
    MageFrame.getInstance().showMessage("String_Node_Str" + CardGrid.MAX_IMAGES + "String_Node_Str");
  }
 else {
    if (!(currentView instanceof CardGrid)) {
      toggleViewMode();
    }
    filterCards();
  }
}
Program: 158208
Project: 158208
Buggy source:
private void btnBoosterActionPerformed(java.awt.event.ActionEvent evt){
  List<String> sets=ConstructedFormats.getSetsByFormat(this.cbExpansionSet.getSelectedItem().toString());
  if (sets.size() == 1) {
    if (!this.limited) {
      this.limited=true;
      cards.clear();
    }
    ExpansionSet expansionSet=Sets.getInstance().get(sets.get(0));
    if (expansionSet != null) {
      List<Card> booster=expansionSet.createBooster();
      cards.addAll(booster);
      filterCards();
    }
  }
 else {
    JOptionPane.showMessageDialog(null,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void btnBoosterActionPerformed(java.awt.event.ActionEvent evt){
  List<String> sets=ConstructedFormats.getSetsByFormat(this.cbExpansionSet.getSelectedItem().toString());
  if (sets.size() == 1) {
    if (!this.limited) {
      this.limited=true;
      cards.clear();
    }
    ExpansionSet expansionSet=Sets.getInstance().get(sets.get(0));
    if (expansionSet != null) {
      List<Card> booster=expansionSet.createBooster();
      cards.addAll(booster);
      filterCards();
    }
  }
 else {
    MageFrame.getInstance().showMessage("String_Node_Str");
  }
}
Program: 158212
Project: 158212
Buggy source:
private List<TokenData> parseTokensData(InputStream inputStream) throws IOException {
  List<TokenData> tokensData=new ArrayList<TokenData>();
  InputStreamReader inputReader=null;
  BufferedReader reader=null;
  try {
    inputReader=new InputStreamReader(inputStream,"String_Node_Str");
    reader=new BufferedReader(inputReader);
    reader.readLine();
    String line=reader.readLine();
    int state=0;
    String set=null;
    while (line != null) {
      if (line.trim().isEmpty()) {
        if (state == 2) {
          state=0;
        }
      }
 else {
        if (state == 0) {
          set=line.substring(0,3);
          state=1;
        }
 else {
          if (state == 1) {
            state=2;
          }
          String[] split=line.split("String_Node_Str");
          String name=split[0].replace('‚',',');
          String number=split[1];
          TokenData token=new TokenData(name,number,set);
          tokensData.add(token);
        }
      }
      line=reader.readLine();
    }
  }
  finally {
    if (inputReader != null) {
      try {
        inputReader.close();
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
    }
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
    }
  }
  return tokensData;
}

Fixed version (ground truth):
private List<TokenData> parseTokensData(InputStream inputStream) throws IOException {
  List<TokenData> newTokensData=new ArrayList<>();
  InputStreamReader inputReader=null;
  BufferedReader reader=null;
  try {
    inputReader=new InputStreamReader(inputStream,"String_Node_Str");
    reader=new BufferedReader(inputReader);
    reader.readLine();
    String line=reader.readLine();
    int state=0;
    String set=null;
    while (line != null) {
      if (line.trim().isEmpty()) {
        if (state == 2) {
          state=0;
        }
      }
 else       if (state == 0) {
        set=line.substring(0,3);
        state=1;
      }
 else {
        if (state == 1) {
          state=2;
        }
        String[] split=line.split("String_Node_Str");
        String name=split[0].replace('‚',',');
        String number=split[1];
        TokenData token=new TokenData(name,number,set);
        newTokensData.add(token);
      }
      line=reader.readLine();
    }
  }
  finally {
    if (inputReader != null) {
      try {
        inputReader.close();
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
    }
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
    }
  }
  return newTokensData;
}
Program: 158214
Project: 158214
Buggy source:
public GainProtectionFromColorTargetEffect(final GainProtectionFromColorTargetEffect effect){
  super(effect);
  choice=effect.choice;
}

Fixed version (ground truth):
public GainProtectionFromColorTargetEffect(final GainProtectionFromColorTargetEffect effect){
  super(effect);
  this.choice=effect.choice.copy();
}
Program: 158215
Project: 158215
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent permanentToDestroy=game.getPermanent(getTargetPointer().getFirst(game,source));
  Permanent permanentToPutCounter=game.getPermanent(getTargetPointer().getTargets(game,source).get(1));
  if (controller != null) {
    if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(),game,false)) {
      if (permanentToPutCounter != null) {
        permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(),game);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent permanentToDestroy=game.getPermanent(getTargetPointer().getFirst(game,source));
  Permanent permanentToPutCounter=game.getPermanent(source.getTargets().get(1).getFirstTarget());
  if (controller != null) {
    if (permanentToDestroy != null && permanentToDestroy.destroy(source.getSourceId(),game,false)) {
      if (permanentToPutCounter != null) {
        permanentToPutCounter.addCounters(CounterType.P1P1.createInstance(),game);
      }
    }
    return true;
  }
  return false;
}
Program: 158216
Project: 158216
Buggy source:
@Override public boolean apply(Game game,Ability source){
  int tappedAmount=0;
  Player you=game.getPlayer(source.getControllerId());
  TargetCreaturePermanent target=new TargetCreaturePermanent(filter);
  while (true) {
    target.clearChosen();
    if (target.canChoose(source.getControllerId(),game) && target.choose(Outcome.Tap,source.getControllerId(),source.getSourceId(),game)) {
      UUID creature=target.getFirstTarget();
      if (creature != null) {
        game.getPermanent(creature).tap(game);
        tappedAmount++;
      }
    }
 else {
      break;
    }
  }
  if (tappedAmount > 0) {
    you.gainLife(tappedAmount * 2,game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  int tappedAmount=0;
  Player you=game.getPlayer(source.getControllerId());
  TargetCreaturePermanent target=new TargetCreaturePermanent(0,Integer.MAX_VALUE,filter,true);
  if (target.canChoose(source.getControllerId(),game) && target.choose(Outcome.Tap,source.getControllerId(),source.getSourceId(),game)) {
    for (    UUID creature : target.getTargets()) {
      if (creature != null) {
        game.getPermanent(creature).tap(game);
        tappedAmount++;
      }
    }
  }
  if (tappedAmount > 0) {
    you.gainLife(tappedAmount * 2,game);
    return true;
  }
  return false;
}
Program: 158217
Project: 158217
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player you=game.getPlayer(source.getControllerId());
  Player damagedPlayer=game.getPlayer(targetPointer.getFirst(game,source));
  filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
  filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),new CardTypePredicate(CardType.SORCERY)));
  Target target=new TargetCardInGraveyard(filter);
  if (you != null) {
    if (you.chooseTarget(Outcome.PlayForFree,target,source,game)) {
      Card card=game.getCard(target.getFirstTarget());
      if (card != null) {
        you.cast(card.getSpellAbility(),game,true);
        game.addEffect(new WrexialReplacementEffect(card.getId()),source);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Player damagedPlayer=game.getPlayer(targetPointer.getFirst(game,source));
    if (damagedPlayer == null) {
      return false;
    }
    FilterCard filter=new FilterCard("String_Node_Str" + damagedPlayer.getName() + "String_Node_Str");
    filter.add(new OwnerIdPredicate(damagedPlayer.getId()));
    filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),new CardTypePredicate(CardType.SORCERY)));
    Target target=new TargetCardInGraveyard(filter);
    if (controller.chooseTarget(Outcome.PlayForFree,target,source,game)) {
      Card card=game.getCard(target.getFirstTarget());
      if (card != null) {
        controller.cast(card.getSpellAbility(),game,true);
        game.addEffect(new WrexialReplacementEffect(card.getId()),source);
      }
    }
    return true;
  }
  return false;
}
Program: 158218
Project: 158218
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  DamagedPlayerEvent damageEvent=(DamagedPlayerEvent)event;
  Permanent p=game.getPermanent(event.getSourceId());
  if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
    getTargets().get(0).add(event.getPlayerId(),game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  DamagedPlayerEvent damageEvent=(DamagedPlayerEvent)event;
  Permanent damageSource=game.getPermanentOrLKIBattlefield(event.getSourceId());
  if (damageEvent.isCombatDamage() && damageSource != null && damageSource.getAttachments().contains(this.getSourceId())) {
    getTargets().get(0).clearChosen();
    getTargets().get(0).add(event.getPlayerId(),game);
    return true;
  }
  return false;
}
Program: 158219
Project: 158219
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player target=game.getPlayer(source.getFirstTarget());
  if (target != null) {
    target.damage(target.getHand().size(),source.getSourceId(),game,false,true);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player target=game.getPlayer(source.getFirstTarget());
  if (target != null) {
    target.damage(target.getHand().size(),source.getSourceId(),game,false,true);
  }
  return true;
}
Program: 158220
Project: 158220
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (super.checkTrigger(event,game)) {
    if (game.getTurn().getStepType().equals(PhaseStep.COMBAT_DAMAGE) || game.getTurn().getStepType().equals(PhaseStep.FIRST_COMBAT_DAMAGE)) {
      Integer stepHash=(Integer)game.getState().getValue("String_Node_Str" + getOriginalId());
      if (stepHash == null || game.getStep().hashCode() != stepHash) {
        game.getState().setValue("String_Node_Str" + getOriginalId(),game.getStep().hashCode());
        return true;
      }
    }
 else {
      game.getState().setValue("String_Node_Str" + getOriginalId(),null);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (super.checkTrigger(event,game)) {
    if (game.getTurn().getStepType().equals(PhaseStep.COMBAT_DAMAGE) || game.getTurn().getStepType().equals(PhaseStep.FIRST_COMBAT_DAMAGE)) {
      String stepHash=(String)game.getState().getValue("String_Node_Str" + getOriginalId());
      String newStepHash=game.getStep().getType().toString() + game.getTurnNum();
      if (stepHash == null || !newStepHash.equals(stepHash)) {
        game.getState().setValue("String_Node_Str" + getOriginalId(),game.getStep().getType().toString() + game.getTurnNum());
        return true;
      }
    }
 else {
      game.getState().setValue("String_Node_Str" + getOriginalId(),null);
      return true;
    }
  }
  return false;
}
Program: 158221
Project: 158221
Buggy source:
@Override protected Player getPayingPlayer(Game game,Ability source){
  Permanent attachment=game.getPermanent(source.getSourceId());
  Permanent attachedTo=game.getPermanent(attachment.getAttachedTo());
  return game.getPlayer(attachedTo.getControllerId());
}

Fixed version (ground truth):
@Override protected Player getPayingPlayer(Game game,Ability source){
  Permanent attachment=game.getPermanentOrLKIBattlefield(source.getSourceId());
  if (attachment != null) {
    Permanent attachedTo=game.getPermanentOrLKIBattlefield(attachment.getAttachedTo());
    if (attachedTo != null) {
      return game.getPlayer(attachedTo.getControllerId());
    }
  }
  return null;
}
Program: 158222
Project: 158222
Buggy source:
@Override public String getText(Mode mode){
  return new StringBuilder("String_Node_Str").append(getCostText()).append("String_Node_Str").append(executingEffects.getText(mode)).toString();
}

Fixed version (ground truth):
@Override public String getText(Mode mode){
  return "String_Node_Str" + getCostText() + "String_Node_Str"+ executingEffects.getText(mode);
}
Program: 158223
Project: 158223
Buggy source:
@Override public AnimateArtifact copy(){
  return new AnimateArtifact(this);
}

Fixed version (ground truth):
@Override public AnimateArtifactContinuousEffect copy(){
  return new AnimateArtifactContinuousEffect(this);
}
Program: 158224
Project: 158224
Buggy source:
/** 
 * Assert whether a permanent is a specified type
 * @param cardName Name of the permanent that should be checked.
 * @param type A type to test for
 * @param subType a subtype to test for
 */
public void assertType(String cardName,CardType type,String subType) throws AssertionError {
  Permanent found=null;
  for (  Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
    if (permanent.getName().equals(cardName)) {
      found=permanent;
      break;
    }
  }
  Assert.assertNotNull("String_Node_Str" + cardName,found);
  Assert.assertTrue("String_Node_Str" + cardName + "String_Node_Str"+ type+ "String_Node_Str",found.getCardType().contains(type));
  Assert.assertTrue("String_Node_Str" + cardName + "String_Node_Str"+ subType+ "String_Node_Str",found.getSubtype(currentGame).contains(subType));
}

Fixed version (ground truth):
/** 
 * Assert whether a permanent is a specified type
 * @param cardName Name of the permanent that should be checked.
 * @param type A type to test for
 * @param subType a subtype to test for
 */
public void assertType(String cardName,CardType type,String subType) throws AssertionError {
  Permanent found=null;
  for (  Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) {
    if (permanent.getName().equals(cardName)) {
      found=permanent;
      break;
    }
  }
  Assert.assertNotNull("String_Node_Str" + cardName,found);
  Assert.assertTrue("String_Node_Str" + cardName + "String_Node_Str"+ type+ "String_Node_Str",found.getCardType().contains(type));
  if (subType != null) {
    Assert.assertTrue("String_Node_Str" + cardName + "String_Node_Str"+ subType+ "String_Node_Str",found.getSubtype(currentGame).contains(subType));
  }
}
Program: 158225
Project: 158225
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(targetPointer.getFirst(game,source));
  if (player != null) {
    UntappedLandsAtBeginningOfTurnWatcher watcher=(UntappedLandsAtBeginningOfTurnWatcher)game.getState().getWatchers().get("String_Node_Str");
    int damage=watcher.getUntappedLandCount(targetPointer.getFirst(game,source));
    player.damage(damage,source.getSourceId(),game,false,true);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(targetPointer.getFirst(game,source));
  if (player != null) {
    PowerSurgeWatcher watcher=(PowerSurgeWatcher)game.getState().getWatchers().get(PowerSurgeWatcher.class.getName());
    int damage=watcher.getUntappedLandCount();
    player.damage(damage,source.getSourceId(),game,false,true);
    return true;
  }
  return false;
}
Program: 158226
Project: 158226
Buggy source:
@Override public PowerSurgeDamageEffect copy(){
  return new PowerSurgeDamageEffect(this);
}

Fixed version (ground truth):
@Override public PowerSurgeWatcher copy(){
  return new PowerSurgeWatcher(this);
}
Program: 158227
Project: 158227
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Card card=game.getCard(source.getSourceId());
  if (card != null) {
    ExileZone currentZone=game.getState().getExile().getExileZone(source.getSourceId());
    if (currentZone != null && currentZone.size() > 0) {
      Player owner=game.getPlayer(card.getOwnerId());
      if (owner != null && owner.moveCards(card,Zone.BATTLEFIELD,source,game)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Card card=game.getCard(source.getSourceId());
  if (card != null) {
    Zone zone=game.getState().getZone(source.getSourceId());
    if (!zone.equals(Zone.BATTLEFIELD) && !zone.equals(Zone.LIBRARY) && !zone.equals(Zone.HAND)) {
      Player owner=game.getPlayer(card.getOwnerId());
      if (owner != null) {
        owner.moveCards(card,Zone.BATTLEFIELD,source,game);
      }
    }
    return true;
  }
  return false;
}