nus-yam/ex-repair huggingface dataset:
Program: 157840
Project: 157840
Buggy source:
/** 
 * Creates new form ConnectDialog
 */
public ConnectDialog(){
  initComponents();
  this.txtServer.addActionListener(connectAction);
  this.txtPort.addActionListener(connectAction);
  this.txtUserName.addActionListener(connectAction);
  this.txtPassword.addActionListener(connectAction);
  registerUserDialog=new RegisterUserDialog(this);
  MageFrame.getDesktop().add(registerUserDialog,JLayeredPane.POPUP_LAYER);
  resetPasswordDialog=new ResetPasswordDialog(this);
  MageFrame.getDesktop().add(resetPasswordDialog,JLayeredPane.POPUP_LAYER);
}

Fixed version (ground truth):
/** 
 * Creates new form ConnectDialog
 */
public ConnectDialog(){
  initComponents();
  this.txtServer.addActionListener(connectAction);
  this.txtPort.addActionListener(connectAction);
  this.txtUserName.addActionListener(connectAction);
  this.txtPassword.addActionListener(connectAction);
  registerUserDialog=new RegisterUserDialog(this);
  MageFrame.getDesktop().add(registerUserDialog,JLayeredPane.MODAL_LAYER);
  resetPasswordDialog=new ResetPasswordDialog(this);
  MageFrame.getDesktop().add(resetPasswordDialog,JLayeredPane.MODAL_LAYER);
}
Program: 157841
Project: 157841
Buggy source:
@Override public void show(){
  super.show();
  this.toFront();
  if (modal) {
    this.setClosable(false);
  }
  if (this.modal) {
    startModal();
  }
}

Fixed version (ground truth):
@Override public void show(){
  super.show();
  if (modal) {
    this.setClosable(false);
  }
  this.toFront();
  if (modal) {
    startModal();
  }
}
Program: 157843
Project: 157843
Buggy source:
public void showDialog(int min,int max,String message){
  this.spnAmount.setModel(new SpinnerNumberModel(min,min,max,1));
  this.lblMessage.setText(message);
  this.btnOk.setVisible(true);
  this.btnCancel.setVisible(false);
  this.pack();
  Point centered=SettingsManager.instance.getComponentPosition(getWidth(),getHeight());
  this.setLocation(centered.x,centered.y);
  GuiDisplayUtil.keepComponentInsideScreen(centered.x,centered.y,this);
  this.setVisible(true);
}

Fixed version (ground truth):
public void showDialog(int min,int max,String message){
  this.spnAmount.setModel(new SpinnerNumberModel(min,min,max,1));
  this.lblMessage.setText(message);
  this.btnOk.setVisible(true);
  this.btnCancel.setVisible(false);
  this.pack();
  if (this.isModal()) {
    MageFrame.getDesktop().add(this,JLayeredPane.MODAL_LAYER);
  }
 else {
    MageFrame.getDesktop().add(this,JLayeredPane.PALETTE_LAYER);
  }
  Point centered=SettingsManager.instance.getComponentPosition(getWidth(),getHeight());
  this.setLocation(centered.x,centered.y);
  GuiDisplayUtil.keepComponentInsideScreen(centered.x,centered.y,this);
  this.setVisible(true);
}
Program: 157844
Project: 157844
Buggy source:
public void loadCards(String name,CardsView pile1,CardsView pile2,BigCard bigCard,UUID gameId){
  this.title=name;
  this.pile1.loadCardsNarrow(pile1,bigCard,gameId);
  this.pile2.loadCardsNarrow(pile2,bigCard,gameId);
  if (getParent() != MageFrame.getDesktop()) {
    MageFrame.getDesktop().add(this,JLayeredPane.MODAL_LAYER);
  }
  pack();
  Point centered=SettingsManager.instance.getComponentPosition(getWidth(),getHeight());
  this.setLocation(centered.x,centered.y);
  GuiDisplayUtil.keepComponentInsideScreen(centered.x,centered.y,this);
  this.revalidate();
  this.repaint();
  this.setModal(true);
  this.setVisible(true);
}

Fixed version (ground truth):
public void loadCards(String name,CardsView pile1,CardsView pile2,BigCard bigCard,UUID gameId){
  this.title=name;
  this.pile1.loadCardsNarrow(pile1,bigCard,gameId);
  this.pile2.loadCardsNarrow(pile2,bigCard,gameId);
  if (getParent() != MageFrame.getDesktop()) {
    MageFrame.getDesktop().add(this,JLayeredPane.MODAL_LAYER);
  }
  pack();
  Point centered=SettingsManager.instance.getComponentPosition(getWidth(),getHeight());
  this.setLocation(centered.x,centered.y);
  GuiDisplayUtil.keepComponentInsideScreen(centered.x,centered.y,this);
  this.revalidate();
  this.repaint();
  this.setModal(true);
  if (this.isModal()) {
    MageFrame.getDesktop().add(this,JLayeredPane.MODAL_LAYER);
  }
 else {
    MageFrame.getDesktop().add(this,JLayeredPane.PALETTE_LAYER);
  }
  this.setVisible(true);
}
Program: 157847
Project: 157847
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player == null) {
    return false;
  }
  if (player.getLibrary().hasCards()) {
    Card card=player.getLibrary().getFromTop(game);
    Cards cards=new CardsImpl();
    cards.add(card);
    player.revealCards("String_Node_Str",cards,game);
    if (card != null) {
      if (filter.match(card,game) && player.chooseUse(outcome,new StringBuilder("String_Node_Str").append(card.getName()).append("String_Node_Str").toString(),source,game)) {
        card.putOntoBattlefield(game,Zone.LIBRARY,source.getSourceId(),source.getControllerId());
        Permanent permanent=game.getPermanent(card.getId());
        if (permanent != null) {
          permanent.addCounters(new Counter("String_Node_Str"),source,game);
          ContinuousEffect effect=new AddCardTypeTargetEffect(CardType.ENCHANTMENT,Duration.Custom);
          effect.setTargetPointer(new FixedTarget(permanent.getId()));
          game.addEffect(effect,source);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player == null) {
    return false;
  }
  if (player.getLibrary().hasCards()) {
    Card card=player.getLibrary().getFromTop(game);
    Cards cards=new CardsImpl();
    cards.add(card);
    player.revealCards("String_Node_Str",cards,game);
    if (card != null) {
      if (filter.match(card,game) && player.chooseUse(outcome,new StringBuilder("String_Node_Str").append(card.getName()).append("String_Node_Str").toString(),source,game)) {
        card.putOntoBattlefield(game,Zone.LIBRARY,source.getSourceId(),source.getControllerId());
        Permanent permanent=game.getPermanent(card.getId());
        if (permanent != null) {
          permanent.addCounters(new Counter("String_Node_Str"),source,game);
          ContinuousEffect effect=new AddCardTypeTargetEffect(Duration.Custom,CardType.ENCHANTMENT);
          effect.setTargetPointer(new FixedTarget(permanent.getId()));
          game.addEffect(effect,source);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 157848
Project: 157848
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  Permanent copyFromPermanent=game.getPermanent(getTargetPointer().getFirst(game,source));
  if (sourcePermanent != null && copyFromPermanent != null) {
    game.copyPermanent(Duration.EndOfTurn,copyFromPermanent,sourcePermanent.getId(),source,new EmptyApplyToPermanent());
    if (!copyFromPermanent.isArtifact()) {
      ContinuousEffect effect=new AddCardTypeTargetEffect(CardType.ARTIFACT,Duration.EndOfTurn);
      effect.setTargetPointer(new FixedTarget(sourcePermanent,game));
      game.addEffect(effect,source);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  Permanent copyFromPermanent=game.getPermanent(getTargetPointer().getFirst(game,source));
  if (sourcePermanent != null && copyFromPermanent != null) {
    game.copyPermanent(Duration.EndOfTurn,copyFromPermanent,sourcePermanent.getId(),source,new EmptyApplyToPermanent());
    if (!copyFromPermanent.isArtifact()) {
      ContinuousEffect effect=new AddCardTypeTargetEffect(Duration.EndOfTurn,CardType.ARTIFACT);
      effect.setTargetPointer(new FixedTarget(sourcePermanent,game));
      game.addEffect(effect,source);
    }
    return true;
  }
  return false;
}
Program: 157849
Project: 157849
Buggy source:
@Override public boolean apply(Game game,Ability source){
  DynamicValue value=new PermanentsOnBattlefieldCount(filter);
  int count=value.calculate(game,source,this) * 2;
  Player player=game.getPlayer(source.getFirstTarget());
  if (player != null) {
    player.loseLife(count,game,false);
  }
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    controller.gainLife(count,game);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  int count=new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT).calculate(game,source,this) * 2;
  if (count > 0) {
    Player targetPlayer=game.getPlayer(getTargetPointer().getFirst(game,source));
    if (targetPlayer != null) {
      targetPlayer.loseLife(count,game,false);
    }
    Player controller=game.getPlayer(source.getControllerId());
    if (controller != null) {
      controller.gainLife(count,game);
    }
  }
  return true;
}
Program: 157850
Project: 157850
Buggy source:
@Override public void init(Ability source,Game game){
  this.amount=dynamicAmount.calculate(game,source,this);
}

Fixed version (ground truth):
@Override public void init(Ability source,Game game){
  amountToRedirect=dynamicAmount.calculate(game,source,this);
}
Program: 157851
Project: 157851
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (!this.used && super.applies(event,source,game)) {
    MageObject sourceObject=game.getObject(event.getSourceId());
    MageObject chosenSourceObject=game.getObject(source.getFirstTarget());
    if (sourceObject == null) {
      game.informPlayers("String_Node_Str");
      return false;
    }
    if (sourceObject.getId() != chosenSourceObject.getId()) {
      return false;
    }
    Permanent permanent=game.getPermanent(event.getTargetId());
    if (permanent != null && permanent.isCreature()) {
      if (permanent.getControllerId().equals(source.getControllerId())) {
        return true;
      }
    }
    Player player=game.getPlayer(event.getTargetId());
    if (player != null) {
      if (player.getId().equals(source.getControllerId())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (!this.used && event.getFlag()) {
    MageObject sourceObject=game.getObject(event.getSourceId());
    MageObject chosenSourceObject=game.getObject(source.getFirstTarget());
    if (sourceObject == null) {
      game.informPlayers("String_Node_Str");
      return false;
    }
    if (sourceObject.getId() != chosenSourceObject.getId()) {
      return false;
    }
    Permanent permanent=game.getPermanent(event.getTargetId());
    if (permanent != null && permanent.isCreature()) {
      if (permanent.getControllerId().equals(source.getControllerId())) {
        redirectTarget=source.getTargets().get(1);
        return true;
      }
    }
    Player player=game.getPlayer(event.getTargetId());
    if (player != null) {
      if (player.getId().equals(source.getControllerId())) {
        redirectTarget=source.getTargets().get(1);
        return true;
      }
    }
  }
  return false;
}
Program: 157852
Project: 157852
Buggy source:
@Override public ShiningShoalPreventDamageTargetEffect copy(){
  return new ShiningShoalPreventDamageTargetEffect(this);
}

Fixed version (ground truth):
@Override public ShiningShoalRedirectDamageTargetEffect copy(){
  return new ShiningShoalRedirectDamageTargetEffect(this);
}
Program: 157853
Project: 157853
Buggy source:
/** 
 * Vorinclex, Voice of Hunger is not mana doubling River of Tears.
 */
@Test @Ignore public void testVorinclexVoiceofHungerRiverOfTearsManaMultiplier(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  activateManaAbility(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.PRECOMBAT_MAIN);
  execute();
  assertManaPool(playerA,ManaType.BLUE,2);
}

Fixed version (ground truth):
/** 
 * Vorinclex, Voice of Hunger is not mana doubling River of Tears.
 */
@Test public void testVorinclexVoiceofHungerRiverOfTearsManaMultiplier(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  playLand(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  activateManaAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(3,PhaseStep.BEGIN_COMBAT);
  execute();
  assertManaPool(playerA,ManaType.BLUE,2);
}
Program: 157854
Project: 157854
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  if (condition.apply(game,source)) {
    effect.setTargetPointer(this.targetPointer);
  }
 else   if (otherwiseEffect != null) {
    otherwiseEffect.setTargetPointer(this.targetPointer);
  }
  Mana mana=getMana(game,source);
  if (mana != null && mana.getAny() > 0) {
    int amount=mana.getAny();
    ChoiceColor choice=new ChoiceColor(true);
    Mana createdMana=null;
    if (controller.choose(outcome,choice,game)) {
      if (choice.getColor() == null) {
        return false;
      }
      createdMana=choice.getMana(amount);
    }
    mana=createdMana;
  }
  if (mana != null) {
    checkToFirePossibleEvents(mana,game,source);
    controller.getManaPool().addMana(mana,game,source);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  if (condition.apply(game,source)) {
    effect.setTargetPointer(this.targetPointer);
  }
 else   if (otherwiseEffect != null) {
    otherwiseEffect.setTargetPointer(this.targetPointer);
  }
  Mana mana=getMana(game,source);
  if (mana == null) {
    return false;
  }
  if (mana.getAny() > 0) {
    int amount=mana.getAny();
    ChoiceColor choice=new ChoiceColor(true);
    Mana createdMana=null;
    if (controller.choose(outcome,choice,game)) {
      if (choice.getColor() == null) {
        return false;
      }
      createdMana=choice.getMana(amount);
    }
    if (createdMana == null) {
      return false;
    }
    mana=createdMana;
    checkToFirePossibleEvents(mana,game,source);
  }
  controller.getManaPool().addMana(mana,game,source);
  return true;
}
Program: 157855
Project: 157855
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    Cards topCards=new CardsImpl();
    topCards.addAll(controller.getLibrary().getTopCards(game,3));
    if (!topCards.isEmpty()) {
      controller.lookAtCards(sourceObject.getIdName(),topCards,game);
      int number=topCards.count(new FilterInstantOrSorceryCard(),source.getSourceId(),source.getControllerId(),game);
      if (number > 0) {
        if (controller.chooseUse(outcome,"String_Node_Str",source,game)) {
          Card card;
          if (number == 1) {
            card=topCards.getCards(new FilterInstantOrSorceryCard(),source.getSourceId(),source.getControllerId(),game).iterator().next();
          }
 else {
            Target target=new TargetCard(Zone.LIBRARY,new FilterInstantOrSorceryCard());
            controller.chooseTarget(outcome,target,source,game);
            card=topCards.get(target.getFirstTarget(),game);
          }
          if (card != null) {
            controller.moveCards(card,Zone.HAND,source,game);
            controller.revealCards(sourceObject.getIdName(),new CardsImpl(card),game);
            topCards.remove(card);
          }
        }
      }
      controller.putCardsOnBottomOfLibrary(topCards,game,source,true);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    Cards topCards=new CardsImpl();
    topCards.addAll(controller.getLibrary().getTopCards(game,3));
    if (!topCards.isEmpty()) {
      controller.lookAtCards(sourceObject.getIdName(),topCards,game);
      int number=topCards.count(new FilterInstantOrSorceryCard(),source.getSourceId(),source.getControllerId(),game);
      if (number > 0) {
        if (controller.chooseUse(outcome,"String_Node_Str",source,game)) {
          Card card;
          if (number == 1) {
            card=topCards.getCards(new FilterInstantOrSorceryCard(),source.getSourceId(),source.getControllerId(),game).iterator().next();
          }
 else {
            TargetCard target=new TargetCard(Zone.LIBRARY,new FilterInstantOrSorceryCard());
            controller.chooseTarget(outcome,topCards,target,source,game);
            card=topCards.get(target.getFirstTarget(),game);
          }
          if (card != null) {
            controller.moveCards(card,Zone.HAND,source,game);
            controller.revealCards(sourceObject.getIdName(),new CardsImpl(card),game);
            topCards.remove(card);
          }
        }
      }
      controller.putCardsOnBottomOfLibrary(topCards,game,source,true);
    }
    return true;
  }
  return false;
}
Program: 157857
Project: 157857
Buggy source:
@Override public boolean apply(Game game,Ability source){
  game.informPlayers("String_Node_Str");
  for (  UUID playerId : game.getState().getPlayersInRange(source.getControllerId(),game)) {
    Player player=game.getPlayer(playerId);
    if (player != null) {
      TargetControlledCreaturePermanent target=new TargetControlledCreaturePermanent();
      List<Permanent> liste=game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(),playerId,game);
      if (!liste.isEmpty()) {
        player.choose(Outcome.ReturnToHand,target,source.getSourceId(),game);
        Permanent permanent=game.getPermanent(target.getFirstTarget());
        if (permanent != null) {
          permanent.moveToZone(Zone.HAND,source.getSourceId(),game,false);
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  game.informPlayers("String_Node_Str");
  for (  UUID playerId : game.getState().getPlayersInRange(source.getControllerId(),game)) {
    Player player=game.getPlayer(playerId);
    if (player != null) {
      FilterControlledCreaturePermanent filter=new FilterControlledCreaturePermanent();
      TargetControlledCreaturePermanent target=new TargetControlledCreaturePermanent(1,1,filter,true);
      List<Permanent> liste=game.getBattlefield().getActivePermanents(filter,playerId,game);
      if (!liste.isEmpty()) {
        player.choose(Outcome.ReturnToHand,target,source.getSourceId(),game);
        Permanent permanent=game.getPermanent(target.getFirstTarget());
        if (permanent != null) {
          permanent.moveToZone(Zone.HAND,source.getSourceId(),game,false);
        }
      }
    }
  }
  return true;
}
Program: 157858
Project: 157858
Buggy source:
@Override public boolean apply(Game game,Ability source){
  for (  UUID targetId : getTargetPointer().getTargets(game,source)) {
    ContinuousEffect effect=new GainControlTargetEffect(Duration.EndOfGame);
    effect.setTargetPointer(new FixedTarget(targetId));
    game.addEffect(effect,source);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  for (  Target target : source.getTargets()) {
    if (target.getFirstTarget() != null) {
      ContinuousEffect effect=new GainControlTargetEffect(Duration.EndOfGame);
      effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
      game.addEffect(effect,source);
    }
  }
  return true;
}
Program: 157859
Project: 157859
Buggy source:
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    ability.getTargets().clear();
    ability.addTarget(new BlatantThieveryTarget(game.getOpponents(ability.getControllerId()).size()));
  }
}

Fixed version (ground truth):
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    ability.getTargets().clear();
    for (    UUID opponentId : game.getOpponents(ability.getControllerId())) {
      Player opponent=game.getPlayer(opponentId);
      if (opponent != null) {
        FilterPermanent filter=new FilterPermanent("String_Node_Str" + opponent.getName());
        filter.add(new ControllerIdPredicate(opponentId));
        TargetPermanent targetPermanent=new TargetPermanent(filter);
        ability.addTarget(targetPermanent);
      }
    }
  }
}
Program: 157860
Project: 157860
Buggy source:
@Override public BlatantThieveryTarget copy(){
  return new BlatantThieveryTarget(this);
}

Fixed version (ground truth):
@Override public BlatantThieveryEffect copy(){
  return new BlatantThieveryEffect(this);
}
Program: 157861
Project: 157861
Buggy source:
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    for (    UUID opponentId : game.getOpponents(ability.getControllerId())) {
      Player opponent=game.getPlayer(opponentId);
      if (opponent != null) {
        ability.getTargets().clear();
        FilterCreaturePermanent filter=new FilterCreaturePermanent("String_Node_Str" + opponent.getName());
        filter.add(new ControllerIdPredicate(opponentId));
        TargetCreaturePermanent target=new TargetCreaturePermanent(0,1,filter,false);
        ability.addTarget(target);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    ability.getTargets().clear();
    for (    UUID opponentId : game.getOpponents(ability.getControllerId())) {
      Player opponent=game.getPlayer(opponentId);
      if (opponent != null) {
        FilterCreaturePermanent filter=new FilterCreaturePermanent("String_Node_Str" + opponent.getName());
        filter.add(new ControllerIdPredicate(opponentId));
        TargetCreaturePermanent target=new TargetCreaturePermanent(0,1,filter,false);
        ability.addTarget(target);
      }
    }
  }
}
Program: 157862
Project: 157862
Buggy source:
/** 
 * Returns an opponent by random
 * @param abilityControllerId
 * @param game
 * @return
 */
private UUID getRandomOpponent(UUID abilityControllerId,Game game){
  UUID randomOpponentId=null;
  Set<UUID> opponents=game.getOpponents(abilityControllerId);
  if (opponents.size() > 1) {
    int rand=RandomUtil.nextInt(opponents.size());
    int count=0;
    for (    UUID currentId : opponents) {
      if (count == rand) {
        randomOpponentId=currentId;
        break;
      }
    }
  }
  return randomOpponentId;
}

Fixed version (ground truth):
/** 
 * Returns an opponent by random
 * @param abilityControllerId
 * @param game
 * @return
 */
private UUID getRandomOpponent(UUID abilityControllerId,Game game){
  UUID randomOpponentId=null;
  Set<UUID> opponents=game.getOpponents(abilityControllerId);
  if (opponents.size() > 1) {
    int rand=RandomUtil.nextInt(opponents.size());
    int count=0;
    for (    UUID currentId : opponents) {
      if (count == rand) {
        randomOpponentId=currentId;
        break;
      }
    }
  }
 else   if (opponents.size() == 1) {
    randomOpponentId=game.getOpponents(abilityControllerId).iterator().next();
  }
  return randomOpponentId;
}
Program: 157863
Project: 157863
Buggy source:
/** 
 * Returns an opponent by random
 * @param abilityControllerId
 * @param game
 * @return
 */
private UUID getRandomOpponent(UUID abilityControllerId,Game game){
  UUID randomOpponentId=game.getOpponents(abilityControllerId).iterator().next();
  Set<UUID> opponents=game.getOpponents(abilityControllerId);
  if (opponents.size() > 1) {
    int rand=RandomUtil.nextInt(opponents.size());
    int count=0;
    for (    UUID currentId : opponents) {
      if (count == rand) {
        randomOpponentId=currentId;
        break;
      }
    }
  }
  return randomOpponentId;
}

Fixed version (ground truth):
/** 
 * Returns an opponent by random
 * @param abilityControllerId
 * @param game
 * @return
 */
private UUID getRandomOpponent(UUID abilityControllerId,Game game){
  UUID randomOpponentId=null;
  Set<UUID> opponents=game.getOpponents(abilityControllerId);
  if (opponents.size() > 1) {
    int rand=RandomUtil.nextInt(opponents.size());
    int count=0;
    for (    UUID currentId : opponents) {
      if (count == rand) {
        randomOpponentId=currentId;
        break;
      }
    }
  }
  return randomOpponentId;
}
Program: 157865
Project: 157865
Buggy source:
private void AnalyseSearchResult(){
  Date startedDate=new Date();
  for (  ExpansionSet set : Sets.getInstance().values()) {
    if (codesToIgnoreCheck.get(set.getCode()) != null) {
      continue;
    }
    CheckResult res=setsToDonwload.get(set.getCode());
    if (res == null) {
      logger.warn(String.format("String_Node_Str",set.getCode(),set.getName()));
      continue;
    }
    if (logger.isDebugEnabled()) {
      if ((set.getCardsByRarity(Rarity.COMMON).size() > 0) && !res.haveCommon) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
      if ((set.getCardsByRarity(Rarity.UNCOMMON).size() > 0) && !res.haveUncommon) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
      if ((set.getCardsByRarity(Rarity.RARE).size() > 0) && !res.haveRare) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
      if ((set.getCardsByRarity(Rarity.MYTHIC).size() > 0) && !res.haveMyth) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
    }
  }
  Date endedDate=new Date();
  long secs=(endedDate.getTime() - startedDate.getTime()) / 1000;
  logger.debug(String.format("String_Node_Str",secs));
}

Fixed version (ground truth):
private void AnalyseSearchResult(){
  Date startedDate=new Date();
  for (  ExpansionSet set : Sets.getInstance().values()) {
    if (codesToIgnoreCheck.get(set.getCode()) != null) {
      continue;
    }
    CheckResult res=setsToDownload.get(set.getCode());
    if (res == null) {
      logger.warn(String.format("String_Node_Str",set.getCode(),set.getName()));
      continue;
    }
    if (logger.isDebugEnabled()) {
      if ((set.getCardsByRarity(Rarity.COMMON).size() > 0) && !res.haveCommon) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
      if ((set.getCardsByRarity(Rarity.UNCOMMON).size() > 0) && !res.haveUncommon) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
      if ((set.getCardsByRarity(Rarity.RARE).size() > 0) && !res.haveRare) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
      if ((set.getCardsByRarity(Rarity.MYTHIC).size() > 0) && !res.haveMyth) {
        logger.error(String.format("String_Node_Str",set.getCode(),set.getName()));
      }
    }
  }
  Date endedDate=new Date();
  long secs=(endedDate.getTime() - startedDate.getTime()) / 1000;
  logger.debug(String.format("String_Node_Str",secs));
}
Program: 157866
Project: 157866
Buggy source:
private void CheckSearchResult(String searchCode,ExpansionSet foundedExp,boolean canDownloadTask,boolean haveCommon,boolean haveUncommon,boolean haveRare,boolean haveMyth){
  CheckResult res=setsToDonwload.get(searchCode);
  if (res != null) {
    logger.error(String.format("String_Node_Str",searchCode));
  }
 else {
    res=new CheckResult(searchCode,foundedExp,haveCommon,haveUncommon,haveRare,haveMyth);
    setsToDonwload.put(searchCode,res);
  }
  if (foundedExp == null) {
    logger.error(String.format("String_Node_Str",searchCode));
    return;
  }
  if (!canDownloadTask) {
    Calendar c=Calendar.getInstance();
    c.setTime(foundedExp.getReleaseDate());
    c.add(Calendar.DATE,-1 * DAYS_BEFORE_RELEASE_TO_DOWNLOAD);
    logger.warn(String.format("String_Node_Str",searchCode,foundedExp.getName(),c.getTime()));
  }
}

Fixed version (ground truth):
private void CheckSearchResult(String searchCode,ExpansionSet foundedExp,boolean canDownloadTask,boolean haveCommon,boolean haveUncommon,boolean haveRare,boolean haveMyth){
  CheckResult res=setsToDownload.get(searchCode);
  if (res != null) {
    logger.error(String.format("String_Node_Str",searchCode));
  }
 else {
    res=new CheckResult(searchCode,foundedExp,haveCommon,haveUncommon,haveRare,haveMyth);
    setsToDownload.put(searchCode,res);
  }
  if (foundedExp == null) {
    logger.error(String.format("String_Node_Str",searchCode));
    return;
  }
  if (!canDownloadTask) {
    Calendar c=Calendar.getInstance();
    c.setTime(foundedExp.getReleaseDate());
    c.add(Calendar.DATE,-1 * DAYS_BEFORE_RELEASE_TO_DOWNLOAD);
    logger.warn(String.format("String_Node_Str",searchCode,foundedExp.getName(),c.getTime()));
  }
}
Program: 157867
Project: 157867
Buggy source:
public static String generateImagePath(CardDownloadData card){
  String useDefault=PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT,"String_Node_Str");
  String imagesPath=Objects.equals(useDefault,"String_Node_Str") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH,null);
  String imageDir=getImageDir(card,imagesPath);
  String imageName;
  String type=card.getType() != 0 ? ' ' + Integer.toString(card.getType()) : "String_Node_Str";
  String name=card.getFileName().isEmpty() ? card.getName().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") : card.getFileName();
  if (card.getUsesVariousArt()) {
    imageName=name + '.' + card.getCollectorId()+ "String_Node_Str";
  }
 else {
    imageName=name + type + "String_Node_Str";
  }
  if (new TFile(imageDir).exists() && !new TFile(imageDir + TFile.separator + imageName).exists()) {
    for (    String fileName : new TFile(imageDir).list()) {
      if (fileName.toLowerCase().equals(imageName.toLowerCase())) {
        imageName=fileName;
        break;
      }
    }
  }
  return imageDir + TFile.separator + imageName;
}

Fixed version (ground truth):
public static String generateImagePath(CardDownloadData card){
  String useDefault=PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT,"String_Node_Str");
  String imagesPath=Objects.equals(useDefault,"String_Node_Str") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH,null);
  String imageDir=getImageDir(card,imagesPath);
  String imageName;
  String type=card.getType() != 0 ? ' ' + Integer.toString(card.getType()) : "String_Node_Str";
  String name=card.getFileName().isEmpty() ? card.getName().replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") : card.getFileName();
  if (card.getUsesVariousArt()) {
    imageName=name + '.' + card.getCollectorId()+ "String_Node_Str";
  }
 else {
    imageName=name + type + "String_Node_Str";
  }
  if (new TFile(imageDir).exists() && !new TFile(imageDir + TFile.separator + imageName).exists()) {
    for (    String fileName : new TFile(imageDir).list()) {
      if (fileName.toLowerCase().equals(imageName.toLowerCase())) {
        imageName=fileName;
        break;
      }
    }
  }
  return imageDir + TFile.separator + imageName;
}
Program: 157868
Project: 157868
Buggy source:
protected void calculatePreCombatActions(Game game){
  if (!getNextAction(game)) {
    currentScore=GameStateEvaluator2.evaluate(playerId,game);
    Game sim=createSimulation(game);
    SimulationNode2.resetCount();
    root=new SimulationNode2(null,sim,maxDepth,playerId);
    addActionsTimed();
    logger.trace("String_Node_Str" + root.children.size());
    if (!root.children.isEmpty()) {
      root=root.children.get(0);
      boolean doThis=true;
      if (root.abilities.size() == 1) {
        for (        Ability ability : root.abilities) {
          if (ability.getManaCosts().convertedManaCost() == 0 && ability.getCosts().isEmpty()) {
            if (actionCache.contains(ability.getRule() + '_' + ability.getSourceId())) {
              doThis=false;
            }
          }
        }
      }
      if (doThis) {
        actions=new LinkedList<>(root.abilities);
        combat=root.combat;
        for (        Ability ability : actions) {
          actionCache.add(ability.getRule() + '_' + ability.getSourceId());
        }
      }
    }
 else {
      logger.info('[' + game.getPlayer(playerId).getName() + "String_Node_Str");
    }
  }
 else {
    logger.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
protected void calculatePreCombatActions(Game game){
  if (!getNextAction(game)) {
    currentScore=GameStateEvaluator2.evaluate(playerId,game);
    Game sim=createSimulation(game);
    SimulationNode2.resetCount();
    root=new SimulationNode2(null,sim,maxDepth,playerId);
    addActionsTimed();
    if (root.children != null && !root.children.isEmpty()) {
      logger.trace("String_Node_Str" + root.children.size());
      root=root.children.get(0);
      boolean doThis=true;
      if (root.abilities.size() == 1) {
        for (        Ability ability : root.abilities) {
          if (ability.getManaCosts().convertedManaCost() == 0 && ability.getCosts().isEmpty()) {
            if (actionCache.contains(ability.getRule() + '_' + ability.getSourceId())) {
              doThis=false;
            }
          }
        }
      }
      if (doThis) {
        actions=new LinkedList<>(root.abilities);
        combat=root.combat;
        for (        Ability ability : actions) {
          actionCache.add(ability.getRule() + '_' + ability.getSourceId());
        }
      }
    }
 else {
      logger.info('[' + game.getPlayer(playerId).getName() + "String_Node_Str");
    }
  }
 else {
    logger.debug("String_Node_Str");
  }
}
Program: 157869
Project: 157869
Buggy source:
protected void waitForResponse(Game game){
  if (isExecutingMacro()) {
    pullResponseFromQueue(game);
    return;
  }
  response.clear();
  logger.debug("String_Node_Str" + getId());
  game.resumeTimer(getTurnControlledBy());
  boolean loop=true;
  while (loop) {
    loop=false;
synchronized (response) {
      try {
        response.wait();
      }
 catch (      InterruptedException ex) {
        logger.error("String_Node_Str" + getName() + "String_Node_Str"+ game.getId(),ex);
      }
 finally {
        game.pauseTimer(getTurnControlledBy());
      }
    }
    if (response.getResponseConcedeCheck()) {
      ((GameImpl)game).checkConcede();
      if (game.hasEnded()) {
        return;
      }
      response.clear();
      loop=true;
    }
  }
  if (recordingMacro && !macroTriggeredSelectionFlag) {
    actionQueueSaved.add(new PlayerResponse(response));
  }
}

Fixed version (ground truth):
protected void waitForResponse(Game game){
  if (isExecutingMacro()) {
    pullResponseFromQueue(game);
    return;
  }
  response.clear();
  logger.debug("String_Node_Str" + getId());
  game.resumeTimer(getTurnControlledBy());
  boolean loop=true;
  while (loop) {
    loop=false;
synchronized (response) {
      try {
        response.wait();
      }
 catch (      InterruptedException ex) {
        logger.error("String_Node_Str" + getName() + "String_Node_Str"+ game.getId(),ex);
      }
 finally {
        game.pauseTimer(getTurnControlledBy());
      }
    }
    if (response.getResponseConcedeCheck()) {
      ((GameImpl)game).checkConcede();
      if (game.hasEnded()) {
        return;
      }
      response.clear();
      if (isInGame()) {
        loop=true;
      }
    }
  }
  if (recordingMacro && !macroTriggeredSelectionFlag) {
    actionQueueSaved.add(new PlayerResponse(response));
  }
}
Program: 157870
Project: 157870
Buggy source:
@Override public void setConcedingPlayer(UUID playerId){
  Player player=getPlayer(state.getPriorityPlayerId());
  if (player != null) {
    if (!player.hasLeft() && player.isHuman()) {
      if (!concedingPlayers.contains(playerId)) {
        logger.debug("String_Node_Str" + playerId + "String_Node_Str"+ getId());
        concedingPlayers.add(playerId);
        player.signalPlayerConcede();
      }
    }
 else {
      concedingPlayers.add(playerId);
      checkConcede();
    }
  }
 else {
    checkConcede();
    checkIfGameIsOver();
  }
}

Fixed version (ground truth):
@Override public void setConcedingPlayer(UUID playerId){
  Player player=null;
  if (state.getChoosingPlayerId() != null) {
    player=getPlayer(state.getChoosingPlayerId());
  }
 else   if (state.getPriorityPlayerId() != null) {
    player=getPlayer(state.getPriorityPlayerId());
  }
  if (player != null) {
    if (!player.hasLeft() && player.isHuman()) {
      if (!concedingPlayers.contains(playerId)) {
        logger.debug("String_Node_Str" + playerId + "String_Node_Str"+ getId());
        concedingPlayers.add(playerId);
        player.signalPlayerConcede();
      }
    }
 else {
      concedingPlayers.add(playerId);
      checkConcede();
    }
  }
 else {
    checkConcede();
    checkIfGameIsOver();
  }
}
Program: 157872
Project: 157872
Buggy source:
@Override public boolean canActivate(UUID playerId,Game game){
  if (playerId == caster) {
    return super.canActivate(playerId,game);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canActivate(UUID playerId,Game game){
  if (playerId == caster) {
    Permanent permanent=game.getBattlefield().getPermanent(this.getSourceId());
    if (permanent != null) {
      if (filter.match(permanent,permanent.getId(),permanent.getControllerId(),game)) {
        return super.canActivate(playerId,game);
      }
    }
  }
  return false;
}
Program: 157873
Project: 157873
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getTargetId().equals(getTargetPointer().getFirst(game,source))) {
    if (event.getTargetId() != null && source.getSourceId() != null) {
      TargetCreatureOrPlayer target=new TargetCreatureOrPlayer();
      target.add(source.getSourceId(),game);
      redirectTarget=target;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getBattlefield().getPermanent(source.getSourceId());
  if (permanent != null) {
    if (filter.match(permanent,permanent.getId(),permanent.getControllerId(),game)) {
      if (event.getTargetId().equals(getTargetPointer().getFirst(game,source))) {
        if (event.getTargetId() != null) {
          TargetCreatureOrPlayer target=new TargetCreatureOrPlayer();
          target.add(source.getSourceId(),game);
          redirectTarget=target;
          return true;
        }
      }
    }
  }
  return false;
}
Program: 157874
Project: 157874
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (sourceObject.equals(new MageObjectReference(event.getSourceId(),game))) {
    redirectTarget=new TargetPermanent();
    redirectTarget.add(source.getSourceId(),game);
    return event.getTargetId().equals(getTargetPointer().getFirst(game,source));
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getBattlefield().getPermanent(source.getSourceId());
  if (permanent != null) {
    if (filter.match(permanent,permanent.getId(),permanent.getControllerId(),game)) {
      if (sourceObject.equals(new MageObjectReference(event.getSourceId(),game))) {
        redirectTarget=new TargetPermanent();
        redirectTarget.add(source.getSourceId(),game);
        return event.getTargetId().equals(getTargetPointer().getFirst(game,source));
      }
    }
  }
  return false;
}
Program: 157875
Project: 157875
Buggy source:
@Override public void setConcedingPlayer(UUID playerId){
  Player player=getPlayer(state.getPriorityPlayerId());
  if (player != null) {
    if (!player.hasLeft() && player.isHuman()) {
      if (!concedingPlayers.contains(playerId)) {
        logger.debug("String_Node_Str" + playerId + "String_Node_Str"+ getId());
        concedingPlayers.add(playerId);
        player.signalPlayerConcede();
      }
    }
 else {
      checkConcede();
    }
  }
 else {
    checkConcede();
    checkIfGameIsOver();
  }
}

Fixed version (ground truth):
@Override public void setConcedingPlayer(UUID playerId){
  Player player=getPlayer(state.getPriorityPlayerId());
  if (player != null) {
    if (!player.hasLeft() && player.isHuman()) {
      if (!concedingPlayers.contains(playerId)) {
        logger.debug("String_Node_Str" + playerId + "String_Node_Str"+ getId());
        concedingPlayers.add(playerId);
        player.signalPlayerConcede();
      }
    }
 else {
      concedingPlayers.add(playerId);
      checkConcede();
    }
  }
 else {
    checkConcede();
    checkIfGameIsOver();
  }
}
Program: 157876
Project: 157876
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getTargetId().equals(getTargetPointer().getFirst(game,source))) {
    TargetPermanent target=new TargetPermanent();
    target.add(source.getSourceId(),game);
    redirectTarget=target;
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getBattlefield().getPermanent(source.getSourceId());
  if (permanent != null) {
    if (filter.match(permanent,permanent.getId(),permanent.getControllerId(),game)) {
      if (event.getTargetId().equals(getTargetPointer().getFirst(game,source))) {
        if (event.getTargetId() != null) {
          TargetPermanent target=new TargetPermanent();
          target.add(source.getSourceId(),game);
          redirectTarget=target;
          return true;
        }
      }
    }
  }
  return false;
}
Program: 157877
Project: 157877
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  ChooseBlockersRedundancyWatcher watcher=(ChooseBlockersRedundancyWatcher)game.getState().getWatchers().get(ChooseBlockersRedundancyWatcher.class.getSimpleName());
  watcher.decrement();
  if (watcher.copyCountApply > 0) {
    game.informPlayers(source.getSourceObject(game).getIdName() + "String_Node_Str");
    return false;
  }
  watcher.copyCount--;
  watcher.copyCountApply=watcher.copyCount;
  Player blockController=game.getPlayer(source.getControllerId());
  if (blockController != null) {
    game.getCombat().selectBlockers(blockController,game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  ChooseBlockersRedundancyWatcher watcher=(ChooseBlockersRedundancyWatcher)game.getState().getWatchers().get(ChooseBlockersRedundancyWatcher.class.getSimpleName());
  watcher.decrement();
  watcher.copyCount--;
  if (watcher.copyCountApply > 0) {
    game.informPlayers(source.getSourceObject(game).getIdName() + "String_Node_Str");
    this.discard();
    return false;
  }
  watcher.copyCountApply=watcher.copyCount;
  Player blockController=game.getPlayer(source.getControllerId());
  if (blockController != null) {
    game.getCombat().selectBlockers(blockController,game);
    return true;
  }
  this.discard();
  return false;
}
Program: 157878
Project: 157878
Buggy source:
@Override public boolean apply(MageObject input,Game game){
  boolean isFaceDown=false;
  Abilities<Ability> abilities;
  if (input instanceof Card) {
    abilities=((Card)input).getAbilities(game);
    isFaceDown=((Card)input).isFaceDown(game);
  }
 else {
    abilities=input.getAbilities();
  }
  if (isFaceDown) {
    for (    Ability ability : abilities) {
      if (!ability.getSourceId().equals(input.getId())) {
        if (ability.getClass().equals(JohanVigilanceAbility.class)) {
          return false;
        }
      }
    }
    return true;
  }
  for (  Ability ability : abilities) {
    if (!Objects.equals(ability.getClass(),SpellAbility.class)) {
      if (!ability.getClass().equals(JohanVigilanceAbility.class)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(MageObject input,Game game){
  boolean isFaceDown=false;
  Abilities<Ability> abilities;
  if (input instanceof Card) {
    abilities=((Card)input).getAbilities(game);
    isFaceDown=((Card)input).isFaceDown(game);
  }
 else {
    abilities=input.getAbilities();
  }
  if (isFaceDown) {
    for (    Ability ability : abilities) {
      if (!ability.getSourceId().equals(input.getId()) && !ability.getClass().equals(JohanVigilanceAbility.class)) {
        return false;
      }
    }
    return true;
  }
  for (  Ability ability : abilities) {
    if (!Objects.equals(ability.getClass(),SpellAbility.class) && !ability.getClass().equals(JohanVigilanceAbility.class)) {
      return false;
    }
  }
  return true;
}
Program: 157879
Project: 157879
Buggy source:
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    return permanent.getPower().getValue() > controller.getHand().size();
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  return controller.getInRange().contains(permanent.getControllerId()) && permanent.getPower().getValue() > controller.getHand().size();
}
Program: 157880
Project: 157880
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent permanent=game.getPermanent(event.getSourceId());
  if (permanent == null) {
    permanent=(Permanent)game.getLastKnownInformation(event.getSourceId(),Zone.BATTLEFIELD);
  }
  if (permanent != null && permanent.isLand() && !permanent.getControllerId().equals(game.getActivePlayerId())) {
    getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId()));
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent permanent=game.getPermanentOrLKIBattlefield(event.getSourceId());
  if (permanent == null) {
    return false;
  }
  Player player=game.getPlayer(controllerId);
  if (player == null) {
    return false;
  }
  if (permanent.isLand() && player.getInRange().contains(permanent.getControllerId()) && !permanent.getControllerId().equals(game.getActivePlayerId())) {
    getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId()));
    return true;
  }
  return false;
}
Program: 157881
Project: 157881
Buggy source:
@Override public boolean hasOpponent(UUID playerToCheckId,Game game){
  return !this.getId().equals(playerToCheckId) && game.isOpponent(this,playerToCheckId);
}

Fixed version (ground truth):
@Override public boolean hasOpponent(UUID playerToCheckId,Game game){
  return !this.getId().equals(playerToCheckId) && game.isOpponent(this,playerToCheckId) && getInRange().contains(playerToCheckId);
}
Program: 157882
Project: 157882
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  return event.getPlayerId().equals(source.getControllerId());
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Player blockController=game.getPlayer(source.getControllerId());
  if (blockController != null) {
    return true;
  }
  return false;
}