nus-yam/ex-repair huggingface dataset:
Program: 157926
Project: 157926
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.DAMAGED_PLAYER) {
    DamagedPlayerEvent damageEvent=(DamagedPlayerEvent)event;
    UUID damagedPlayerId=game.getCombat().getDefenderId(sourceId);
    UUID you=this.getControllerId();
    Permanent p=game.getPermanent(event.getSourceId());
    if (damageEvent.isCombatDamage() && p != null) {
      PlayersAttackedLastTurnWatcher watcher=(PlayersAttackedLastTurnWatcher)game.getState().getWatchers().get(PlayersAttackedLastTurnWatcher.class.getSimpleName());
      if (watcher != null && watcher.attackedLastTurn(damagedPlayerId,you)) {
        FilterNonlandPermanent filter=new FilterNonlandPermanent("String_Node_Str");
        filter.add(new ControllerIdPredicate(damagedPlayerId));
        this.getTargets().clear();
        TargetPermanent target=new TargetPermanent(filter);
        this.addTarget(target);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.DAMAGED_PLAYER) {
    DamagedPlayerEvent damageEvent=(DamagedPlayerEvent)event;
    UUID damagedPlayerId=game.getCombat().getDefenderId(sourceId);
    UUID you=this.getControllerId();
    Permanent p=game.getPermanent(event.getSourceId());
    if (damageEvent.isCombatDamage() && p != null && p.getId().equals(this.getSourceId())) {
      PlayersAttackedLastTurnWatcher watcher=(PlayersAttackedLastTurnWatcher)game.getState().getWatchers().get(PlayersAttackedLastTurnWatcher.class.getSimpleName());
      if (watcher != null && watcher.attackedLastTurn(damagedPlayerId,you)) {
        FilterNonlandPermanent filter=new FilterNonlandPermanent("String_Node_Str");
        filter.add(new ControllerIdPredicate(damagedPlayerId));
        this.getTargets().clear();
        TargetPermanent target=new TargetPermanent(filter);
        this.addTarget(target);
        return true;
      }
    }
  }
  return false;
}
Program: 157927
Project: 157927
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(this.getSourceId());
  UUID controller=this.getControllerId();
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    if (!game.getCombat().getAttackerId().equals(controller)) {
      for (      Effect effect : this.getEffects()) {
        effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    CombatGroup group : game.getCombat().getBlockingGroups()) {
      if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
        this.getEffects().setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
        return true;
      }
    }
  }
  return false;
}
Program: 157928
Project: 157928
Buggy source:
public Set<UUID> getDefenders(){
  return defenders;
}

Fixed version (ground truth):
/** 
 * Get all possible defender (players and plainwalkers) That does not mean neccessarly mean that they are really attacked
 * @return
 */
public Set<UUID> getDefenders(){
  return defenders;
}
Program: 157930
Project: 157930
Buggy source:
@Override protected Void doInBackground() throws Exception {
  while (!isCancelled()) {
    SessionHandler.getTable(roomId,tableId).ifPresent(this::publish);
    TimeUnit.SECONDS.sleep(1);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground() throws Exception {
  while (!isCancelled()) {
    Optional<TableView> tableView=SessionHandler.getTable(roomId,tableId);
    if (tableView.isPresent()) {
      tableView.ifPresent(this::publish);
    }
 else {
      dialog.closeDialog();
    }
    TimeUnit.SECONDS.sleep(1);
  }
  return null;
}
Program: 157931
Project: 157931
Buggy source:
public static CombatInfo blockWithGoodTrade(Game game,List<Permanent> attackers,List<Permanent> blockers){
  UUID attackerId=game.getCombat().getAttackerId();
  UUID defenderId=game.getCombat().getDefenders().iterator().next();
  if (attackerId == null || defenderId == null) {
    log.warn("String_Node_Str" + attackerId + ' '+ defenderId);
    return new CombatInfo();
  }
  CombatInfo combatInfo=new CombatInfo();
  for (  Permanent attacker : attackers) {
    List<Permanent> possibleBlockers=getPossibleBlockers(game,attacker,blockers);
    List<Permanent> survivedBlockers=getBlockersThatWillSurvive(game,attackerId,defenderId,attacker,possibleBlockers);
    if (!survivedBlockers.isEmpty()) {
      Permanent blocker=getWorstCreature(survivedBlockers);
      combatInfo.addPair(attacker,blocker);
      blockers.remove(blocker);
    }
    if (blockers.isEmpty()) {
      break;
    }
  }
  return combatInfo;
}

Fixed version (ground truth):
public static CombatInfo blockWithGoodTrade(Game game,List<Permanent> attackers,List<Permanent> blockers){
  UUID attackerId=game.getCombat().getAttackingPlayerId();
  UUID defenderId=game.getCombat().getDefenders().iterator().next();
  if (attackerId == null || defenderId == null) {
    log.warn("String_Node_Str" + attackerId + ' '+ defenderId);
    return new CombatInfo();
  }
  CombatInfo combatInfo=new CombatInfo();
  for (  Permanent attacker : attackers) {
    List<Permanent> possibleBlockers=getPossibleBlockers(game,attacker,blockers);
    List<Permanent> survivedBlockers=getBlockersThatWillSurvive(game,attackerId,defenderId,attacker,possibleBlockers);
    if (!survivedBlockers.isEmpty()) {
      Permanent blocker=getWorstCreature(survivedBlockers);
      combatInfo.addPair(attacker,blocker);
      blockers.remove(blocker);
    }
    if (blockers.isEmpty()) {
      break;
    }
  }
  return combatInfo;
}
Program: 157932
Project: 157932
Buggy source:
public static CombatInfo blockWithGoodTrade2(Game game,List<Permanent> attackers,List<Permanent> blockers){
  UUID attackerId=game.getCombat().getAttackerId();
  UUID defenderId=game.getCombat().getDefenders().iterator().next();
  if (attackerId == null || defenderId == null) {
    log.warn("String_Node_Str" + attackerId + ' '+ defenderId);
    return new CombatInfo();
  }
  CombatInfo combatInfo=new CombatInfo();
  for (  Permanent attacker : attackers) {
    List<Permanent> possibleBlockers=getPossibleBlockers(game,attacker,blockers);
    List<Permanent> survivedBlockers=getBlockersThatWillSurvive2(game,attackerId,defenderId,attacker,possibleBlockers);
    if (!survivedBlockers.isEmpty()) {
      Permanent blocker=getWorstCreature(survivedBlockers);
      combatInfo.addPair(attacker,blocker);
      blockers.remove(blocker);
    }
    if (blockers.isEmpty()) {
      break;
    }
  }
  return combatInfo;
}

Fixed version (ground truth):
public static CombatInfo blockWithGoodTrade2(Game game,List<Permanent> attackers,List<Permanent> blockers){
  UUID attackerId=game.getCombat().getAttackingPlayerId();
  UUID defenderId=game.getCombat().getDefenders().iterator().next();
  if (attackerId == null || defenderId == null) {
    log.warn("String_Node_Str" + attackerId + ' '+ defenderId);
    return new CombatInfo();
  }
  CombatInfo combatInfo=new CombatInfo();
  for (  Permanent attacker : attackers) {
    List<Permanent> possibleBlockers=getPossibleBlockers(game,attacker,blockers);
    List<Permanent> survivedBlockers=getBlockersThatWillSurvive2(game,attackerId,defenderId,attacker,possibleBlockers);
    if (!survivedBlockers.isEmpty()) {
      Permanent blocker=getWorstCreature(survivedBlockers);
      combatInfo.addPair(attacker,blocker);
      blockers.remove(blocker);
    }
    if (blockers.isEmpty()) {
      break;
    }
  }
  return combatInfo;
}
Program: 157933
Project: 157933
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  return game.getCombat().getAttackers().size() >= 2 && game.getCombat().getAttackerId().equals(getControllerId());
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  return game.getCombat().getAttackers().size() >= 2 && game.getCombat().getAttackingPlayerId().equals(getControllerId());
}
Program: 157934
Project: 157934
Buggy source:
@Override public void adjustTargets(Ability ability,Game game){
  if (this.getAbilities().contains(ability) && ability.getRule().startsWith("String_Node_Str")) {
    FilterCreaturePermanent filter=new FilterCreaturePermanent("String_Node_Str");
    filter.add(new ControllerIdPredicate(game.getCombat().getAttackerId()));
    ability.getTargets().clear();
    ability.addTarget(new TargetCreaturePermanent(filter));
  }
}

Fixed version (ground truth):
@Override public void adjustTargets(Ability ability,Game game){
  if (this.getAbilities().contains(ability) && ability.getRule().startsWith("String_Node_Str")) {
    FilterCreaturePermanent filter=new FilterCreaturePermanent("String_Node_Str");
    filter.add(new ControllerIdPredicate(game.getCombat().getAttackingPlayerId()));
    ability.getTargets().clear();
    ability.addTarget(new TargetCreaturePermanent(filter));
  }
}
Program: 157935
Project: 157935
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(this.getSourceId());
  UUID controller=this.getControllerId();
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    if (!game.getCombat().getAttackerId().equals(controller)) {
      for (      Effect effect : this.getEffects()) {
        effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(getSourceId());
  Player controller=game.getPlayer(getControllerId());
  if (controller != null && enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    CombatGroup group : game.getCombat().getBlockingGroups()) {
      if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
        if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(),game)) {
          Effect effect=new UntapAllNonlandsTargetEffect();
          effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
          this.addEffect(effect);
        }
        return true;
      }
    }
  }
  return false;
}
Program: 157936
Project: 157936
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    Effect effect : this.getEffects()) {
      effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    Effect effect : this.getEffects()) {
      effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
    }
    return true;
  }
  return false;
}
Program: 157937
Project: 157937
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(this.getSourceId());
  UUID controller=this.getControllerId();
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    if (!game.getCombat().getAttackerId().equals(controller)) {
      for (      Effect effect : this.getEffects()) {
        effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(getSourceId());
  Player controller=game.getPlayer(getControllerId());
  if (controller != null && enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    CombatGroup group : game.getCombat().getBlockingGroups()) {
      if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
        if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(),game)) {
          Effect effect=new CreateTokenTargetEffect(new ZombieToken());
          effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
          this.addEffect(effect);
        }
        return true;
      }
    }
  }
  return false;
}
Program: 157938
Project: 157938
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    TargetPermanent target=new TargetPermanent();
    target.setTargetController(game.getCombat().getAttackerId());
    addTarget(target);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    TargetPermanent target=new TargetPermanent();
    target.setTargetController(game.getCombat().getAttackingPlayerId());
    addTarget(target);
    return true;
  }
  return false;
}
Program: 157939
Project: 157939
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    CombatGroup group : game.getCombat().getBlockingGroups()) {
      if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
        this.getEffects().setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanentOrLKIBattlefield(getSourceId());
  Player controller=game.getPlayer(getControllerId());
  if (controller != null && enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    CombatGroup group : game.getCombat().getBlockingGroups()) {
      if (group.getDefenderId().equals(enchantment.getAttachedTo())) {
        if (controller.hasOpponent(game.getCombat().getAttackingPlayerId(),game)) {
          Effect effect=new CreateTokenTargetEffect(new GoldToken());
          effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
          this.addEffect(effect);
        }
        return true;
      }
    }
  }
  return false;
}
Program: 157940
Project: 157940
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    Effect effect : this.getEffects()) {
      effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
    for (    Effect effect : this.getEffects()) {
      effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackingPlayerId()));
    }
    return true;
  }
  return false;
}
Program: 157941
Project: 157941
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getFirstTarget());
  if (permanent == null) {
    return false;
  }
  permanent.moveToExile(null,null,source.getSourceId(),game);
  UUID controllerId=permanent.getControllerId();
  for (  UUID opponentId : game.getOpponents(controllerId)) {
    PutTokenOntoBattlefieldCopyTargetEffect effect=new PutTokenOntoBattlefieldCopyTargetEffect(opponentId,null,true);
    effect.setTargetPointer(new FixedTarget(permanent,game));
    effect.apply(game,source);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getFirstTarget());
  if (permanent == null) {
    return false;
  }
  permanent.moveToExile(null,null,source.getSourceId(),game);
  UUID controllerId=permanent.getControllerId();
  for (  UUID opponentId : game.getOpponents(controllerId)) {
    PutTokenOntoBattlefieldCopyTargetEffect effect=new PutTokenOntoBattlefieldCopyTargetEffect(opponentId,null,false);
    effect.setTargetPointer(new FixedTarget(permanent,game));
    effect.apply(game,source);
  }
  return true;
}
Program: 157942
Project: 157942
Buggy source:
@Override public NemesisOfMortals copy(){
  return new NemesisOfMortals(this);
}

Fixed version (ground truth):
@Override public NemesisOfMortalsCostReducingEffect copy(){
  return new NemesisOfMortalsCostReducingEffect(this);
}
Program: 157944
Project: 157944
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent creature=game.getPermanent(targetPointer.getFirst(game,source));
  if (creature != null) {
    ObjectColor color=creature.getColor(game);
    for (    Permanent permanent : game.getBattlefield().getActivePermanents(FILTER,source.getControllerId(),game)) {
      if (permanent.getColor(game).shares(color) && !Objects.equals(permanent,creature)) {
        permanent.destroy(source.getSourceId(),game,true);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent creature=game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game,source));
  if (creature != null) {
    ObjectColor color=creature.getColor(game);
    for (    Permanent permanent : game.getBattlefield().getActivePermanents(FILTER,source.getControllerId(),game)) {
      if (permanent.getColor(game).shares(color) && !Objects.equals(permanent,creature)) {
        permanent.destroy(source.getSourceId(),game,true);
      }
    }
    return true;
  }
  return false;
}
Program: 157945
Project: 157945
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  if (controller != null && sourcePermanent != null) {
    String message="String_Node_Str";
    message=CardUtil.replaceSourceName(message,sourcePermanent.getLogName());
    message=Character.toUpperCase(message.charAt(0)) + message.substring(1);
    if (cost.canPay(source,source.getSourceId(),source.getControllerId(),game) && controller.chooseUse(Outcome.Benefit,message,source,game)) {
      cost.clearPaid();
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),false,null)) {
        return true;
      }
    }
    if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
      ContinuousEffect effect=new GiveControlEffect();
      effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
      game.addEffect(effect,source);
      game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + "String_Node_Str" + sourcePermanent.getIdName());
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
  if (controller != null && sourcePermanent != null) {
    String message="String_Node_Str";
    message=CardUtil.replaceSourceName(message,sourcePermanent.getLogName());
    message=Character.toUpperCase(message.charAt(0)) + message.substring(1);
    if (cost.canPay(source,source.getSourceId(),source.getControllerId(),game) && controller.chooseUse(Outcome.Benefit,message,source,game)) {
      cost.clearPaid();
      if (cost.pay(source,game,source.getSourceId(),source.getControllerId(),false,null)) {
        return true;
      }
    }
    if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) {
      ContinuousEffect effect=new GiveControlEffect();
      effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
      game.addEffect(effect,source);
      game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + "String_Node_Str" + sourcePermanent.getIdName());
    }
    return true;
  }
  return false;
}
Program: 157946
Project: 157946
Buggy source:
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  for (  UUID playerId : game.getOpponents(source.getControllerId())) {
    Player opponent=game.getPlayer(playerId);
    if (opponent != null && opponent.getHand().isEmpty()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify.getSourceId().equals(source.getSourceId())) {
    for (    UUID playerId : game.getOpponents(source.getControllerId())) {
      Player opponent=game.getPlayer(playerId);
      if (opponent != null && opponent.getHand().isEmpty()) {
        return true;
      }
    }
  }
  return false;
}
Program: 157947
Project: 157947
Buggy source:
@Test public void testJelevaCastingSavageBeatingFromExile(){
  String jeleva="String_Node_Str";
  String savageBeating="String_Node_Str";
  skipInitShuffling();
  addCard(Zone.LIBRARY,playerA,savageBeating);
  addCard(Zone.HAND,playerA,jeleva);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,jeleva);
  attack(3,playerA,jeleva);
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,savageBeating);
  setChoice(playerA,"String_Node_Str");
  setModeChoice(playerA,"String_Node_Str");
  setStopAt(3,PhaseStep.END_COMBAT);
  execute();
  assertTapped(jeleva,true);
  assertLife(playerB,18);
  assertAbility(playerA,jeleva,DoubleStrikeAbility.getInstance(),true);
  assertGraveyardCount(playerA,savageBeating,1);
}

Fixed version (ground truth):
@Test public void testJelevaCastingSavageBeatingFromExile(){
  String jeleva="String_Node_Str";
  String savageBeating="String_Node_Str";
  skipInitShuffling();
  addCard(Zone.LIBRARY,playerA,savageBeating,2);
  addCard(Zone.HAND,playerA,jeleva);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,jeleva);
  attack(3,playerA,jeleva);
  setChoice(playerA,"String_Node_Str");
  setChoice(playerA,savageBeating);
  setChoice(playerA,"String_Node_Str");
  setModeChoice(playerA,"String_Node_Str");
  setStopAt(3,PhaseStep.END_COMBAT);
  execute();
  assertGraveyardCount(playerA,savageBeating,1);
  assertTapped(jeleva,true);
  assertLife(playerB,18);
  assertAbility(playerA,jeleva,DoubleStrikeAbility.getInstance(),true);
}
Program: 157948
Project: 157948
Buggy source:
@Test public void testTokenCreatedOnlyIfTargetDies(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  activateAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  setStopAt(3,PhaseStep.BEGIN_COMBAT);
  execute();
  assertPermanentCount(playerA,5);
  assertPermanentCount(playerB,0);
}

Fixed version (ground truth):
@Test public void testTokenCreatedOnlyIfTargetDies(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  activateAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  setStopAt(3,PhaseStep.BEGIN_COMBAT);
  execute();
  assertPermanentCount(playerA,5);
  assertPermanentCount(playerA,"String_Node_Str",0);
  assertPermanentCount(playerB,0);
}
Program: 157949
Project: 157949
Buggy source:
@Override public boolean destroy(UUID sourceId,Game game,boolean noRegen){
  if (abilities.containsKey(IndestructibleAbility.getInstance().getId())) {
    return false;
  }
  if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT,objectId,sourceId,controllerId,noRegen ? 1 : 0))) {
    if (moveToZone(Zone.GRAVEYARD,sourceId,game,false)) {
      if (!game.isSimulation()) {
        String logName;
        Card card=game.getCard(this.getId());
        if (card != null) {
          logName=card.getLogName();
        }
 else {
          logName=this.getLogName();
        }
        if (this.isCreature()) {
          game.informPlayers(logName + "String_Node_Str");
        }
 else {
          game.informPlayers(logName + "String_Node_Str");
        }
      }
      game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT,objectId,sourceId,controllerId));
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean destroy(UUID sourceId,Game game,boolean noRegen){
  if (abilities.containsKey(IndestructibleAbility.getInstance().getId())) {
    return false;
  }
  if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT,objectId,sourceId,controllerId,noRegen ? 1 : 0))) {
    if (moveToZone(Zone.GRAVEYARD,sourceId,game,false)) {
      if (!game.isSimulation()) {
        String logName;
        Card card=game.getCard(this.getId());
        if (card != null) {
          logName=card.getLogName();
        }
 else {
          logName=this.getLogName();
        }
        if (this.isCreature()) {
          game.informPlayers(logName + "String_Node_Str");
        }
 else {
          game.informPlayers(logName + "String_Node_Str");
        }
      }
      game.fireEvent(GameEvent.getEvent(EventType.DESTROYED_PERMANENT,objectId,sourceId,controllerId));
      return true;
    }
  }
  return false;
}
Program: 157950
Project: 157950
Buggy source:
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  Permanent before=((ZoneChangeEvent)event).getTarget();
  if (before == null) {
    return false;
  }
  if (!(before instanceof PermanentToken) && !this.hasSourceObjectAbility(game,before,event)) {
    return false;
  }
  if (before.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(source.getId())) {
    Zone after=game.getState().getZone(sourceId);
    return after != null && Zone.GRAVEYARD.match(after);
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean isInUseableZone(Game game,MageObject source,GameEvent event){
  Permanent before=((ZoneChangeEvent)event).getTarget();
  if (before == null) {
    return false;
  }
  if (!(before instanceof PermanentToken) && !this.hasSourceObjectAbility(game,before,event)) {
    return false;
  }
  if (before.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(sourceId)) {
    Zone after=game.getState().getZone(sourceId);
    return after != null && Zone.GRAVEYARD.match(after);
  }
 else {
    return true;
  }
}
Program: 157951
Project: 157951
Buggy source:
@Override protected void setRuntimeData(Ability source,Game game){
  String s=(String)game.getState().getValue(source.getSourceId() + "String_Node_Str");
  subtype=SubType.byDescription(s);
}

Fixed version (ground truth):
@Override protected void setRuntimeData(Ability source,Game game){
  String s=(String)game.getState().getValue(source.getSourceId() + "String_Node_Str");
  if (subtype != null) {
    subtype=SubType.byDescription(s);
  }
 else {
    discard();
  }
}
Program: 157952
Project: 157952
Buggy source:
Set<DependencyType> getDependencyTypes();

Fixed version (ground truth):
EnumSet<DependencyType> getDependencyTypes();
Program: 157953
Project: 157953
Buggy source:
/** 
 * We create a timer that will run every 250 ms individually for a player decreasing his internal game counter. Later on this counter is used to get time left to play the whole match. <p> What we also do here is passing Action to PriorityTimer that is the action that will be executed once game timer is over.
 * @param playerId
 * @param count
 * @return
 */
private PriorityTimer createPlayerTimer(UUID playerId,int count){
  final UUID initPlayerId=playerId;
  long delayMs=250L;
  Action executeOnNoTimeLeft=() -> {
    game.timerTimeout(initPlayerId);
    logger.debug("String_Node_Str" + initPlayerId + "String_Node_Str");
  }
;
  PriorityTimer timer=new PriorityTimer(count,delayMs,executeOnNoTimeLeft);
  timers.put(playerId,timer);
  timer.init(game.getId());
  return timer;
}

Fixed version (ground truth):
/** 
 * We create a timer that will run every 250 ms individually for a player decreasing his internal game counter. Later on this counter is used to get time left to play the whole match. <p> What we also do here is passing Action to PriorityTimer that is the action that will be executed once game timer is over.
 * @param playerId
 * @param count
 * @return
 */
private PriorityTimer createPlayerTimer(UUID playerId,int count){
  final UUID initPlayerId=playerId;
  long delayMs=250L;
  Action executeOnNoTimeLeft=() -> {
    game.timerTimeout(initPlayerId);
    logger.debug("String_Node_Str" + initPlayerId + "String_Node_Str");
  }
;
  PriorityTimer timer=new PriorityTimer(count,delayMs,executeOnNoTimeLeft);
  timer.init(game.getId());
  timers.put(playerId,timer);
  return timer;
}
Program: 157954
Project: 157954
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    UUID creatureId=(UUID)this.getValue("String_Node_Str");
    Permanent creature=game.getPermanentOrLKIBattlefield(creatureId);
    if (creature != null) {
      Player opponent=game.getPlayer(source.getFirstTarget());
      boolean paid=false;
      if (opponent != null) {
        Cost cost=new PayLifeCost(3);
        if (cost.canPay(source,source.getSourceId(),opponent.getId(),game) && opponent.chooseUse(outcome,new StringBuilder("String_Node_Str").append(creature.getLogName()).append("String_Node_Str").append(controller.getLogName()).append("String_Node_Str").toString(),source,game)) {
          if (cost.pay(source,game,source.getSourceId(),opponent.getId(),false,null)) {
            paid=true;
          }
        }
      }
      if (opponent == null || !paid) {
        if (game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) {
          controller.moveCards(game.getCard(creatureId),Zone.HAND,source,game);
        }
      }
    }
    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) {
    UUID creatureId=(UUID)this.getValue("String_Node_Str");
    Card creature=game.getCard(creatureId);
    if (creature != null) {
      Player opponent=game.getPlayer(source.getFirstTarget());
      boolean paid=false;
      if (opponent != null) {
        Cost cost=new PayLifeCost(3);
        if (cost.canPay(source,source.getSourceId(),opponent.getId(),game) && opponent.chooseUse(outcome,new StringBuilder("String_Node_Str").append(creature.getLogName()).append("String_Node_Str").append(controller.getLogName()).append("String_Node_Str").toString(),source,game)) {
          if (cost.pay(source,game,source.getSourceId(),opponent.getId(),false,null)) {
            paid=true;
          }
        }
      }
      if (opponent == null || !paid) {
        if (game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) {
          controller.moveCards(creature,Zone.HAND,source,game);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 157955
Project: 157955
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
    Permanent permanent=(Permanent)game.getLastKnownInformation(event.getTargetId(),Zone.BATTLEFIELD);
    if (permanent != null && filter.match(permanent,sourceId,controllerId,game)) {
      for (      Effect effect : this.getEffects()) {
        effect.setValue("String_Node_Str",event.getTargetId());
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
  if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
    if (zEvent.getTarget() != null && filter.match(zEvent.getTarget(),sourceId,controllerId,game)) {
      for (      Effect effect : this.getEffects()) {
        effect.setValue("String_Node_Str",event.getTargetId());
      }
      return true;
    }
  }
  return false;
}
Program: 157956
Project: 157956
Buggy source:
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  Permanent equipment=game.getPermanent(source.getSourceId());
  if (equipment != null && equipment.getAttachedTo() != null) {
    Permanent equipped=game.getPermanent(equipment.getAttachedTo());
    if (permanent.getId().equals(equipped.getId())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  Permanent equipment=game.getPermanent(source.getSourceId());
  if (equipment != null && equipment.getAttachedTo() != null) {
    Permanent equipped=game.getPermanent(equipment.getAttachedTo());
    if (equipped != null && permanent.getId().equals(equipped.getId())) {
      return true;
    }
  }
  return false;
}
Program: 157957
Project: 157957
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=source.getSourceObject(game);
  if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
    Library library=controller.getLibrary();
    Card card=library.removeFromTop(game);
    if (card != null) {
      boolean exiledCardWasCast=false;
      controller.moveCardToExileWithInfo(card,source.getSourceId(),sourceObject.getIdName(),source.getSourceId(),game,Zone.LIBRARY,true);
      if (!card.getManaCost().isEmpty()) {
        if (controller.chooseUse(Outcome.Benefit,"String_Node_Str",source,game) && !card.isLand()) {
          exiledCardWasCast=controller.cast(card.getSpellAbility(),game,false);
        }
      }
      if (!exiledCardWasCast) {
        new DamagePlayersEffect(Outcome.Damage,new StaticValue(2),TargetController.OPPONENT).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());
  MageObject sourceObject=source.getSourceObject(game);
  if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
    Library library=controller.getLibrary();
    Card card=library.getFromTop(game);
    if (card != null) {
      boolean exiledCardWasCast=false;
      controller.moveCardToExileWithInfo(card,source.getSourceId(),sourceObject.getIdName(),source.getSourceId(),game,Zone.LIBRARY,true);
      if (!card.getManaCost().isEmpty()) {
        if (controller.chooseUse(Outcome.Benefit,"String_Node_Str",source,game) && !card.isLand()) {
          exiledCardWasCast=controller.cast(card.getSpellAbility(),game,false);
        }
      }
      if (!exiledCardWasCast) {
        new DamagePlayersEffect(Outcome.Damage,new StaticValue(2),TargetController.OPPONENT).apply(game,source);
      }
    }
    return true;
  }
  return false;
}
Program: 157958
Project: 157958
Buggy source:
protected boolean controlsAbility(UUID playerId,Game game){
  if (this.controllerId != null && this.controllerId.equals(playerId)) {
    return true;
  }
 else {
    Card card=(Card)game.getObject(this.sourceId);
    if (card != null && game.getState().getZone(this.sourceId) != Zone.BATTLEFIELD) {
      return card.getOwnerId().equals(playerId);
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean controlsAbility(UUID playerId,Game game){
  if (this.controllerId != null && this.controllerId.equals(playerId)) {
    return true;
  }
 else {
    MageObject mageObject=game.getObject(this.sourceId);
    if (mageObject instanceof Emblem) {
      return ((Emblem)mageObject).getControllerId().equals(playerId);
    }
 else {
      if (game.getState().getZone(this.sourceId) != Zone.BATTLEFIELD) {
        return ((Card)mageObject).getOwnerId().equals(playerId);
      }
    }
  }
  return false;
}
Program: 157959
Project: 157959
Buggy source:
@Override public String getText(Mode mode){
  if (staticText != null && !staticText.isEmpty()) {
    return staticText;
  }
  return "String_Node_Str" + (mode.getTargets().get(0) != null ? mode.getTargets().get(0).getTargetName() : "String_Node_Str");
}

Fixed version (ground truth):
@Override public String getText(Mode mode){
  if (staticText != null && !staticText.isEmpty()) {
    return staticText;
  }
  return "String_Node_Str" + (!mode.getTargets().isEmpty() ? mode.getTargets().get(0).getTargetName() : "String_Node_Str");
}
Program: 157960
Project: 157960
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  if (setColor != null) {
    MageObject sourceObject=game.getObject(source.getSourceId());
    if (sourceObject != null) {
      sourceObject.getColor(game).setColor(setColor);
    }
 else {
      this.discard();
    }
    return true;
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  if (setColor != null) {
    MageObject sourceObject=game.getObject(source.getSourceId());
    if (sourceObject != null) {
      sourceObject.getColor(game).setColor(setColor);
    }
 else {
      this.discard();
    }
    return true;
  }
  return false;
}
Program: 157963
Project: 157963
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    ExileZone exileZone=game.getExile().getExileZone(CardUtil.getCardExileZoneId(game,source.getSourceId(),true));
    if (exileZone != null) {
      controller.moveCards(exileZone,Zone.HAND,source,game);
    }
    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) {
    ExileZone exileZone=game.getExile().getExileZone(CardUtil.getExileZoneId(game,source.getSourceId(),0));
    if (exileZone != null) {
      controller.moveCards(exileZone,Zone.HAND,source,game);
    }
    return true;
  }
  return false;
}
Program: 157964
Project: 157964
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(targetPointer.getFirst(game,source));
  if (player == null) {
    return false;
  }
  FilterControlledCreaturePermanent filter=new FilterControlledCreaturePermanent();
  int realCount=game.getBattlefield().countAll(filter,player.getId(),game);
  if (realCount > 0) {
    Target target=new TargetControlledPermanent(1,1,filter,true);
    while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(),game)) {
      player.chooseTarget(Outcome.Sacrifice,target,source,game);
    }
    Permanent permanent=game.getPermanent(target.getFirstTarget());
    if (permanent != null) {
      int gainLife=permanent.getToughness().getValue();
      permanent.sacrifice(source.getSourceId(),game);
      player.gainLife(gainLife,game);
    }
 else {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(targetPointer.getFirst(game,source));
  if (player == null) {
    return false;
  }
  FilterControlledCreaturePermanent filter=new FilterControlledCreaturePermanent();
  int realCount=game.getBattlefield().countAll(filter,player.getId(),game);
  if (realCount > 0) {
    Target target=new TargetControlledPermanent(1,1,filter,true);
    while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(),game)) {
      player.chooseTarget(Outcome.Sacrifice,target,source,game);
    }
    Permanent permanent=game.getPermanent(target.getFirstTarget());
    if (permanent != null) {
      int gainLife=permanent.getToughness().getValue();
      permanent.sacrifice(source.getSourceId(),game);
      game.applyEffects();
      player.gainLife(gainLife,game);
    }
 else {
      return false;
    }
  }
  return true;
}
Program: 157965
Project: 157965
Buggy source:
public AnyColorLandsProduceManaEffect(final AnyColorLandsProduceManaEffect effect){
  super(effect);
  this.filter=effect.filter.copy();
}

Fixed version (ground truth):
public AnyColorLandsProduceManaEffect(final AnyColorLandsProduceManaEffect effect){
  super(effect);
  this.filter=effect.filter.copy();
  this.onlyColors=effect.onlyColors;
}
Program: 157967
Project: 157967
Buggy source:
@Override public boolean isInactive(Ability source,Game game){
  if (super.isInactive(source,game)) {
    return true;
  }
  if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) {
    if (!sameStep && game.getActivePlayerId().equals(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
      return true;
    }
  }
 else {
    sameStep=false;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isInactive(Ability source,Game game){
  if (game.getPhase().getStep().getType() == PhaseStep.UPKEEP) {
    if (game.getActivePlayerId().equals(source.getControllerId())) {
      return true;
    }
  }
  return false;
}
Program: 157968
Project: 157968
Buggy source:
@Override public NagaVitalistEffect copy(){
  return new NagaVitalistEffect(this);
}

Fixed version (ground truth):
@Override public NagaVitalist copy(){
  return new NagaVitalist(this);
}
Program: 157969
Project: 157969
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(targetPointer.getFirst(game,source));
  if (player != null && !player.getHand().isEmpty()) {
    Card card=player.getHand().getRandom(game);
    Cards cards=new CardsImpl();
    cards.add(card);
    player.revealCards("String_Node_Str",cards,game);
    if (card.isLand()) {
      card.putOntoBattlefield(game,Zone.HAND,source.getSourceId(),player.getId());
    }
 else {
      player.cast(card.getSpellAbility(),game,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));
  MageObject sourceObject=source.getSourceObject(game);
  if (player != null && sourceObject != null) {
    Card card=player.getHand().getRandom(game);
    if (card != null) {
      Cards cards=new CardsImpl();
      cards.add(card);
      player.revealCards(sourceObject.getIdName() + "String_Node_Str" + game.getTurnNum(),cards,game);
      if (card.isLand()) {
        player.moveCards(card,Zone.BATTLEFIELD,source,game);
      }
 else       if (card.getSpellAbility() != null && card.getSpellAbility().getTargets().canChoose(player.getId(),game)) {
        player.cast(card.getSpellAbility(),game,true);
      }
 else {
        game.informPlayers(GameLog.getColoredObjectName(card) + "String_Node_Str" + player.getLogName());
      }
    }
    return true;
  }
  return false;
}
Program: 157970
Project: 157970
Buggy source:
@Override public boolean leaveChat(UUID chatId){
  try {
    if (isConnected()) {
      server.leaveChat(chatId,sessionId);
      return true;
    }
  }
 catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean leaveChat(UUID chatId){
  try {
    if (isConnected() && chatId != null) {
      server.leaveChat(chatId,sessionId);
    }
    return true;
  }
 catch (  MageException ex) {
    handleMageException(ex);
  }
catch (  Throwable t) {
    handleThrowable(t);
  }
  return false;
}
Program: 157971
Project: 157971
Buggy source:
@Override public boolean applies(UUID sourceId,Ability source,UUID affectedControllerId,Game game){
  UUID targetId=getTargetPointer().getFirst(game,source);
  Player player=game.getPlayer(affectedControllerId);
  if (targetId != null && sourceId != null && targetId.equals(sourceId) && player != null) {
    if (affectedControllerId.equals(source.getControllerId())) {
      Card card=game.getCard(sourceId);
      if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) {
        player.setCastSourceIdWithAlternateMana(sourceId,null,card.getSpellAbility().getCosts());
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(UUID objectId,Ability source,UUID affectedControllerId,Game game){
  if (objectId != null && objectId.equals(getTargetPointer().getFirst(game,source))) {
    if (affectedControllerId.equals(source.getControllerId())) {
      Card card=game.getCard(objectId);
      if (card != null && game.getState().getZone(objectId) == Zone.EXILED) {
        if (!card.isLand() && card.getSpellAbility().getCosts() != null) {
          Player player=game.getPlayer(affectedControllerId);
          if (player != null) {
            player.setCastSourceIdWithAlternateMana(objectId,null,card.getSpellAbility().getCosts());
          }
        }
        return true;
      }
    }
  }
  return false;
}