nus-yam/ex-repair huggingface dataset:
Program: 159250
Project: 159250
Buggy source:
public void broadcast(String userName,String message,MessageColor color,boolean withTime,MessageType messageType,SoundToPlay soundToPlay){
  if (!message.isEmpty()) {
    final String msg=message;
    final String time=(withTime ? timeFormatter.format(new Date()) : "String_Node_Str");
    final String username=userName;
    logger.trace("String_Node_Str" + msg + "String_Node_Str"+ chatId);
    for (    UUID userId : clients.keySet()) {
      User user=UserManager.getInstance().getUser(userId);
      if (user != null) {
        user.fireCallback(new ClientCallback("String_Node_Str",chatId,new ChatMessage(username,msg,time,color,messageType,soundToPlay)));
      }
 else {
        kill(userId,DisconnectReason.CleaningUp);
      }
    }
  }
}

Fixed version (ground truth):
public void broadcast(String userName,String message,MessageColor color,boolean withTime,MessageType messageType,SoundToPlay soundToPlay){
  if (!message.isEmpty()) {
    final String msg=message;
    final String time=(withTime ? timeFormatter.format(new Date()) : "String_Node_Str");
    final String username=userName;
    logger.trace("String_Node_Str" + msg + "String_Node_Str"+ chatId);
    for (    UUID userId : clients.keySet()) {
      User user=UserManager.getInstance().getUser(userId);
      if (user != null) {
        user.fireCallback(new ClientCallback("String_Node_Str",chatId,new ChatMessage(username,msg,time,color,messageType,soundToPlay)));
      }
 else {
        logger.debug("String_Node_Str" + userId + "String_Node_Str"+ chatId);
        kill(userId,DisconnectReason.CleaningUp);
      }
    }
  }
}
Program: 159251
Project: 159251
Buggy source:
public synchronized void join(UUID userId){
  UUID playerId=userPlayerMap.get(userId);
  if (playerId == null) {
    logger.error("String_Node_Str" + userId + "String_Node_Str"+ tournament.getId());
    return;
  }
  TournamentSession tournamentSession=new TournamentSession(tournament,userId,tableId,playerId);
  if (tournamentSessions == null) {
    logger.error("String_Node_Str" + userId + "String_Node_Str"+ tournament.getId());
    return;
  }
  tournamentSessions.put(playerId,tournamentSession);
  UserManager.getInstance().getUser(userId).addTournament(playerId,tournamentSession);
  TournamentPlayer player=tournament.getPlayer(playerId);
  player.setJoined();
  logger.debug("String_Node_Str" + playerId + "String_Node_Str"+ tournament.getId());
  ChatManager.getInstance().broadcast(chatId,"String_Node_Str",player.getPlayer().getName() + "String_Node_Str",MessageColor.BLACK,true,MessageType.STATUS);
  checkStart();
}

Fixed version (ground truth):
public synchronized void join(UUID userId){
  UUID playerId=userPlayerMap.get(userId);
  if (playerId == null) {
    if (logger.isDebugEnabled()) {
      User user=UserManager.getInstance().getUser(userId);
      if (user != null) {
        logger.debug(user.getName() + "String_Node_Str" + tournament.getId());
      }
    }
    return;
  }
  if (tournamentSessions.containsKey(playerId)) {
    logger.debug("String_Node_Str" + userId + "String_Node_Str"+ tournament.getId());
    return;
  }
  TournamentSession tournamentSession=new TournamentSession(tournament,userId,tableId,playerId);
  tournamentSessions.put(playerId,tournamentSession);
  UserManager.getInstance().getUser(userId).addTournament(playerId,tournamentSession);
  TournamentPlayer player=tournament.getPlayer(playerId);
  player.setJoined();
  logger.debug("String_Node_Str" + player.getPlayer().getName() + "String_Node_Str"+ tournament.getId());
  ChatManager.getInstance().broadcast(chatId,"String_Node_Str",player.getPlayer().getName() + "String_Node_Str",MessageColor.BLACK,true,MessageType.STATUS);
  checkStart();
}
Program: 159253
Project: 159253
Buggy source:
public boolean isType(MagePermanent card){
switch (this) {
case land:
    return CardUtil.isLand(card);
case creature:
  return CardUtil.isCreature(card);
case other:
return !CardUtil.isLand(card) && !CardUtil.isCreature(card);
case attached:
return card.getOriginalPermanent().isAttachedTo();
default :
throw new RuntimeException("String_Node_Str" + this);
}
}

Fixed version (ground truth):
public boolean isType(MagePermanent card){
switch (this) {
case land:
    return CardUtil.isLand(card);
case creature:
  return CardUtil.isCreature(card);
case other:
return !CardUtil.isLand(card) && !CardUtil.isCreature(card);
case attached:
return card.getOriginalPermanent().isAttachedTo() && !card.getOriginalPermanent().getSubTypes().contains("String_Node_Str");
default :
throw new RuntimeException("String_Node_Str" + this);
}
}
Program: 159255
Project: 159255
Buggy source:
public CommanderView(Commander commander,Card sourceCard){
  super(sourceCard);
  rules.addAll(commander.getAbilities().getRules(sourceCard.getName()));
  this.mageObjectType=MageObjectType.COMMANDER;
}

Fixed version (ground truth):
public CommanderView(Commander commander,Card sourceCard){
  super(sourceCard);
  this.mageObjectType=MageObjectType.COMMANDER;
}
Program: 159258
Project: 159258
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card sourceCard=game.getCard(source.getSourceId());
  if (controller != null && sourceCard != null) {
    Permanent targetEnchantment=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (targetEnchantment != null) {
      controller.moveCardToExileWithInfo(targetEnchantment,null,null,source.getSourceId(),game,Zone.BATTLEFIELD);
      if (targetEnchantment.hasSubtype("String_Node_Str")) {
        Player enchantmentController=game.getPlayer(targetEnchantment.getControllerId());
        return super.applySearchAndExile(game,source,targetEnchantment.getName(),enchantmentController.getId());
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card sourceCard=game.getCard(source.getSourceId());
  if (controller != null && sourceCard != null) {
    Permanent targetEnchantment=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (targetEnchantment != null) {
      controller.moveCardToExileWithInfo(targetEnchantment,null,"String_Node_Str",source.getSourceId(),game,Zone.BATTLEFIELD);
      Card cardInExile=game.getExile().getCard(targetEnchantment.getId(),game);
      if (cardInExile != null && cardInExile.hasSubtype("String_Node_Str")) {
        Player enchantmentController=game.getPlayer(targetEnchantment.getControllerId());
        return super.applySearchAndExile(game,source,cardInExile.getName(),enchantmentController.getId());
      }
    }
  }
  return false;
}
Program: 159259
Project: 159259
Buggy source:
@Override public Set<UUID> getPlayableInHand(Game game){
  Set<UUID> playable=new HashSet<>();
  if (!shouldSkipGettingPlayable(game)) {
    if (game.getPhase() != null && PhaseStep.CLEANUP.equals(game.getPhase().getStep().getType())) {
      for (      Card card : hand.getCards(game)) {
        playable.add(card.getId());
      }
    }
 else {
      ManaOptions available=getManaAvailable(game);
      available.addMana(manaPool.getMana());
      for (      Card card : hand.getCards(game)) {
        for (        ActivatedAbility ability : card.getAbilities().getPlayableAbilities(Zone.HAND)) {
          if (canPlay(ability,available,game)) {
            playable.add(card.getId());
            break;
          }
        }
        for (        ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.HAND)) {
          if (!playable.contains(ability) && canPlay(ability,available,game)) {
            playable.add(card.getId());
            break;
          }
        }
      }
    }
  }
  return playable;
}

Fixed version (ground truth):
@Override public Set<UUID> getPlayableInHand(Game game){
  Set<UUID> playable=new HashSet<>();
  if (!shouldSkipGettingPlayable(game)) {
    if (game.getPhase() != null && PhaseStep.CLEANUP.equals(game.getPhase().getStep().getType())) {
      for (      Card card : hand.getCards(game)) {
        playable.add(card.getId());
      }
    }
 else {
      ManaOptions available=getManaAvailable(game);
      available.addMana(manaPool.getMana());
      for (      Card card : hand.getCards(game)) {
        for (        ActivatedAbility ability : card.getAbilities().getPlayableAbilities(Zone.HAND)) {
          if (canPlay(ability,available,game)) {
            playable.add(card.getId());
            break;
          }
        }
        for (        ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.HAND)) {
          if (!playable.contains(ability.getSourceId()) && canPlay(ability,available,game)) {
            playable.add(card.getId());
            break;
          }
        }
      }
    }
  }
  return playable;
}
Program: 159261
Project: 159261
Buggy source:
@Override public void addTarget(UUID id,int amount,Ability source,Game game,boolean skipEvent){
  if (targets.containsKey(id)) {
    amount+=targets.get(id);
  }
  if (source != null) {
    if (!skipEvent && !game.replaceEvent(GameEvent.getEvent(EventType.TARGET,id,source.getId(),source.getControllerId()))) {
      targets.put(id,amount);
      rememberZoneChangeCounter(id,game);
      chosen=targets.size() >= minNumberOfTargets;
      if (!skipEvent) {
        game.fireEvent(GameEvent.getEvent(EventType.TARGETED,id,source.getId(),source.getControllerId()));
      }
    }
  }
 else {
    targets.put(id,amount);
    rememberZoneChangeCounter(id,game);
  }
}

Fixed version (ground truth):
@Override public void addTarget(UUID id,int amount,Ability source,Game game,boolean skipEvent){
  if (targets.containsKey(id)) {
    amount+=targets.get(id);
  }
  if (source != null && !skipEvent) {
    if (!game.replaceEvent(GameEvent.getEvent(EventType.TARGET,id,source.getId(),source.getControllerId()))) {
      targets.put(id,amount);
      rememberZoneChangeCounter(id,game);
      chosen=targets.size() >= minNumberOfTargets;
      if (!skipEvent) {
        game.fireEvent(GameEvent.getEvent(EventType.TARGETED,id,source.getId(),source.getControllerId()));
      }
    }
  }
 else {
    targets.put(id,amount);
    rememberZoneChangeCounter(id,game);
  }
}
Program: 159262
Project: 159262
Buggy source:
@Override public void setRuleVisible(boolean ruleVisible){
  this.ruleVisible=ruleVisible;
}

Fixed version (ground truth):
@Override public void setRuleVisible(boolean ruleVisible){
  if (!(this instanceof MageSingleton)) {
    this.ruleVisible=ruleVisible;
  }
}
Program: 159263
Project: 159263
Buggy source:
public EntersBattlefieldTriggeredAbility(EntersBattlefieldTriggeredAbility ability){
  super(ability);
  this.rulePrefix=ability.rulePrefix;
  this.noRule=ability.noRule;
}

Fixed version (ground truth):
public EntersBattlefieldTriggeredAbility(final EntersBattlefieldTriggeredAbility ability){
  super(ability);
  this.rulePrefix=ability.rulePrefix;
  this.noRule=ability.noRule;
}
Program: 159264
Project: 159264
Buggy source:
private void setText(CardView card){
  if (displayTitleAnyway) {
    titleText.setText(card.getName());
    return;
  }
  if (hasImage) {
    titleText.setText("String_Node_Str");
  }
 else {
    titleText.setText(card.getName());
  }
}

Fixed version (ground truth):
private void setText(CardView card){
  titleText.setText(!displayTitleAnyway && hasImage ? "String_Node_Str" : card.getName());
}
Program: 159265
Project: 159265
Buggy source:
private int getHeight(){
  return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + ATTACHMENT_DY_OFFSET * maxAttachedCount;
}

Fixed version (ground truth):
private int getHeight(){
  return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + attachmentSpacingY * maxAttachedCount;
}
Program: 159267
Project: 159267
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    for (    UUID playerId : controller.getInRange()) {
      Player player=game.getPlayer(playerId);
      if (player != null) {
        int cardsHand=player.getHand().size();
        if (cardsHand > 0) {
          for (          UUID cardId : player.getHand()) {
            Card card=game.getCard(cardId);
            if (card != null) {
              player.removeFromHand(card,game);
              card.moveToZone(Zone.LIBRARY,source.getSourceId(),game,true);
            }
          }
          game.informPlayers(player.getName() + "String_Node_Str");
          player.shuffleLibrary(game);
          player.drawCards(cardsHand,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) {
    for (    UUID playerId : controller.getInRange()) {
      Player player=game.getPlayer(playerId);
      if (player != null) {
        int cardsHand=player.getHand().size();
        if (cardsHand > 0) {
          for (          Card card : player.getHand().getCards(game)) {
            player.removeFromHand(card,game);
            card.moveToZone(Zone.LIBRARY,source.getSourceId(),game,true);
          }
          game.informPlayers(player.getName() + "String_Node_Str");
          player.shuffleLibrary(game);
          player.drawCards(cardsHand,game);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 159268
Project: 159268
Buggy source:
@Override public String getText(Mode mode){
  StringBuilder sb=new StringBuilder("String_Node_Str");
  if (amount.toString().equals("String_Node_Str")) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append(amount.toString());
  }
  sb.append("String_Node_Str").append(token.getDescription()).append("String_Node_Str");
  if (tapped) {
    sb.append("String_Node_Str");
  }
  if (attacking) {
    if (tapped) {
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
  }
  String message=amount.getMessage();
  if (message.length() > 0) {
    sb.append("String_Node_Str");
  }
  sb.append(message);
  sb.append("String_Node_Str").append(mode.getTargets().get(0).getTargetName());
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String getText(Mode mode){
  if (staticText != null && !staticText.isEmpty()) {
    return staticText;
  }
  StringBuilder sb=new StringBuilder("String_Node_Str");
  if (amount.toString().equals("String_Node_Str")) {
    sb.append("String_Node_Str");
  }
 else {
    sb.append(amount.toString());
  }
  sb.append("String_Node_Str").append(token.getDescription()).append("String_Node_Str");
  if (tapped) {
    sb.append("String_Node_Str");
  }
  if (attacking) {
    if (tapped) {
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
  }
  String message=amount.getMessage();
  if (message.length() > 0) {
    sb.append("String_Node_Str");
  }
  sb.append(message);
  sb.append("String_Node_Str").append(mode.getTargets().get(0).getTargetName());
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 159269
Project: 159269
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.SPELL_CAST) {
    Spell spell=game.getStack().getSpell(event.getTargetId());
    if (spell != null && filter.match(spell,game)) {
      if (rememberSource) {
        this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.SPELL_CAST) {
    Spell spell=game.getStack().getSpell(event.getTargetId());
    if (spell != null && filter.match(spell,getControllerId(),game)) {
      if (rememberSource) {
        this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
      }
      return true;
    }
  }
  return false;
}
Program: 159270
Project: 159270
Buggy source:
@Override public boolean canBeBlocked(Permanent attacker,Permanent blocker,Ability source,Game game){
  for (  Permanent permanent : game.getBattlefield().getAllActivePermanents(filter,blocker.getControllerId(),game)) {
    if (permanent.isTapped() && !game.getState().getContinuousEffects().asThough(this.getId(),AsThoughEffectType.BLOCK_TAPPED,blocker.getControllerId(),game)) {
      return false;
    }
    for (    Map.Entry<RestrictionEffect,HashSet<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(permanent,game).entrySet()) {
      for (      Ability ability : entry.getValue()) {
        if (!entry.getKey().canBlock(attacker,permanent,ability,game)) {
          return false;
        }
      }
    }
    for (    Map.Entry<RestrictionEffect,HashSet<Ability>> restrictionEntry : game.getContinuousEffects().getApplicableRestrictionEffects(attacker,game).entrySet()) {
      for (      Ability ability : restrictionEntry.getValue()) {
        if (!(restrictionEntry.getKey() instanceof CantBeBlockedUnlessAllEffect) && !restrictionEntry.getKey().canBeBlocked(attacker,permanent,ability,game)) {
          return false;
        }
      }
    }
    if (attacker.hasProtectionFrom(permanent,game)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean canBeBlocked(Permanent attacker,Permanent blocker,Ability source,Game game){
  for (  Permanent permanent : game.getBattlefield().getAllActivePermanents(filter,blocker.getControllerId(),game)) {
    if (permanent.isTapped() && !game.getState().getContinuousEffects().asThough(this.getId(),AsThoughEffectType.BLOCK_TAPPED,source,blocker.getControllerId(),game)) {
      return false;
    }
    for (    Map.Entry<RestrictionEffect,HashSet<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(permanent,game).entrySet()) {
      for (      Ability ability : entry.getValue()) {
        if (!entry.getKey().canBlock(attacker,permanent,ability,game)) {
          return false;
        }
      }
    }
    for (    Map.Entry<RestrictionEffect,HashSet<Ability>> restrictionEntry : game.getContinuousEffects().getApplicableRestrictionEffects(attacker,game).entrySet()) {
      for (      Ability ability : restrictionEntry.getValue()) {
        if (!(restrictionEntry.getKey() instanceof CantBeBlockedUnlessAllEffect) && !restrictionEntry.getKey().canBeBlocked(attacker,permanent,ability,game)) {
          return false;
        }
      }
    }
    if (attacker.hasProtectionFrom(permanent,game)) {
      return false;
    }
  }
  return true;
}
Program: 159271
Project: 159271
Buggy source:
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility || abilityToModify instanceof RetraceAbility) {
    Ability spell=abilityToModify;
    if (spell.getControllerId().equals(source.getControllerId())) {
      Card sourceCard=game.getCard(spell.getSourceId());
      if (sourceCard != null && sourceCard.hasSubtype("String_Node_Str")) {
        Player player=game.getPlayer(spell.getControllerId());
        if (player != null && player.chooseUse(Outcome.Benefit,"String_Node_Str",game)) {
          spell.getManaCostsToPay().clear();
          spell.getManaCostsToPay().addAll(new ManaCostsImpl("String_Node_Str"));
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility || abilityToModify instanceof RetraceAbility) {
    Ability spell=abilityToModify;
    if (spell.getControllerId().equals(source.getControllerId())) {
      Card sourceCard=game.getCard(spell.getSourceId());
      if (sourceCard != null && sourceCard.hasSubtype("String_Node_Str")) {
        Player player=game.getPlayer(spell.getControllerId());
        if (player != null && (CardUtil.isCheckPlayableMode(spell) || player.chooseUse(Outcome.Benefit,"String_Node_Str",game))) {
          spell.getManaCostsToPay().clear();
          spell.getManaCostsToPay().addAll(new ManaCostsImpl<>("String_Node_Str"));
          return true;
        }
      }
    }
  }
  return false;
}
Program: 159272
Project: 159272
Buggy source:
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility || abilityToModify instanceof RetraceAbility) {
    Card sourceCard=game.getCard(abilityToModify.getSourceId());
    StackObject stackObject=game.getStack().getStackObject(abilityToModify.getSourceId());
    if (stackObject != null && stackObject instanceof Spell) {
      Zone zone=((Spell)stackObject).getFromZone();
      if (zone != null && zone.equals(Zone.HAND)) {
        if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId()) && !sourceCard.getCardType().contains(CardType.LAND)) {
          Player player=game.getPlayer(source.getControllerId());
          String message="String_Node_Str" + sourceCard.getName() + "String_Node_Str";
          if (player != null && player.chooseUse(outcome,message,game)) {
            return true;
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility || abilityToModify instanceof RetraceAbility) {
    Card sourceCard=game.getCard(abilityToModify.getSourceId());
    StackObject stackObject=game.getStack().getStackObject(abilityToModify.getSourceId());
    if (stackObject != null && stackObject instanceof Spell) {
      Zone zone=((Spell)stackObject).getFromZone();
      if (zone != null && zone.equals(Zone.HAND)) {
        if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId()) && !sourceCard.getCardType().contains(CardType.LAND)) {
          Player player=game.getPlayer(source.getControllerId());
          String message="String_Node_Str" + sourceCard.getName() + "String_Node_Str";
          if (player != null && (CardUtil.isCheckPlayableMode(abilityToModify) || player.chooseUse(outcome,message,game))) {
            return true;
          }
        }
      }
    }
  }
  return false;
}
Program: 159273
Project: 159273
Buggy source:
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify instanceof SpellAbility) {
    Card sourceCard=game.getCard(abilityToModify.getSourceId());
    StackObject stackObject=game.getStack().getStackObject(abilityToModify.getSourceId());
    if (stackObject != null && stackObject instanceof Spell) {
      if (sourceCard != null && sourceCard.getCardType().contains(CardType.CREATURE) && sourceCard.getManaCost().convertedManaCost() <= 3) {
        Player player=game.getPlayer(stackObject.getControllerId());
        String message="String_Node_Str" + sourceCard.getName() + "String_Node_Str";
        if (player != null && player.chooseUse(outcome,message,game)) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Ability abilityToModify,Ability source,Game game){
  if (abilityToModify instanceof SpellAbility) {
    Card sourceCard=game.getCard(abilityToModify.getSourceId());
    StackObject stackObject=game.getStack().getStackObject(abilityToModify.getSourceId());
    if (stackObject != null && stackObject instanceof Spell) {
      if (sourceCard != null && sourceCard.getCardType().contains(CardType.CREATURE) && sourceCard.getManaCost().convertedManaCost() <= 3) {
        Player player=game.getPlayer(stackObject.getControllerId());
        String message="String_Node_Str" + sourceCard.getName() + "String_Node_Str";
        if (player != null && (CardUtil.isCheckPlayableMode(abilityToModify) || player.chooseUse(outcome,message,game))) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 159274
Project: 159274
Buggy source:
@Override public boolean canActivate(UUID playerId,Game game){
  if (this.spellCanBeActivatedRegularlyNow(playerId,game) || game.getContinuousEffects().asThough(sourceId,AsThoughEffectType.CAST,playerId,game)) {
    if (spellAbilityType.equals(SpellAbilityType.SPLIT)) {
      return false;
    }
    if (!controllerId.equals(playerId)) {
      return false;
    }
    if (this.getManaCosts().isEmpty() && this.getCosts().isEmpty()) {
      return false;
    }
    if (costs.canPay(sourceId,controllerId,game)) {
      if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
        SplitCard splitCard=(SplitCard)game.getCard(getSourceId());
        if (splitCard != null) {
          return (splitCard.getLeftHalfCard().getSpellAbility().canChooseTarget(game) && splitCard.getRightHalfCard().getSpellAbility().canChooseTarget(game));
        }
        return false;
      }
 else {
        return canChooseTarget(game);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canActivate(UUID playerId,Game game){
  if (game.getContinuousEffects().asThough(sourceId,AsThoughEffectType.CAST,this,playerId,game) || this.spellCanBeActivatedRegularlyNow(playerId,game)) {
    if (spellAbilityType.equals(SpellAbilityType.SPLIT)) {
      return false;
    }
    if (!controllerId.equals(playerId)) {
      return false;
    }
    if (this.getManaCosts().isEmpty() && this.getCosts().isEmpty()) {
      return false;
    }
    if (costs.canPay(sourceId,controllerId,game)) {
      if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
        SplitCard splitCard=(SplitCard)game.getCard(getSourceId());
        if (splitCard != null) {
          return (splitCard.getLeftHalfCard().getSpellAbility().canChooseTarget(game) && splitCard.getRightHalfCard().getSpellAbility().canChooseTarget(game));
        }
        return false;
      }
 else {
        return canChooseTarget(game);
      }
    }
  }
  return false;
}
Program: 159275
Project: 159275
Buggy source:
public boolean asThough(UUID objectId,AsThoughEffectType type,UUID controllerId,Game game){
  List<AsThoughEffect> asThoughEffectsList=getApplicableAsThoughEffects(type,game);
  for (  AsThoughEffect effect : asThoughEffectsList) {
    HashSet<Ability> abilities=asThoughEffectsMap.get(type).getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (controllerId.equals(ability.getControllerId())) {
        if (effect.applies(objectId,ability,game)) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean asThough(UUID objectId,AsThoughEffectType type,Ability affectedAbility,UUID controllerId,Game game){
  List<AsThoughEffect> asThoughEffectsList=getApplicableAsThoughEffects(type,game);
  for (  AsThoughEffect effect : asThoughEffectsList) {
    HashSet<Ability> abilities=asThoughEffectsMap.get(type).getAbility(effect.getId());
    for (    Ability ability : abilities) {
      if (controllerId.equals(ability.getControllerId())) {
        if (affectedAbility == null) {
          if (effect.applies(objectId,ability,game)) {
            return true;
          }
        }
 else {
          if (effect.applies(objectId,affectedAbility,ability,game)) {
            return true;
          }
        }
      }
    }
  }
  return false;
}
Program: 159276
Project: 159276
Buggy source:
@Override public void adjustCosts(Ability ability,Game game){
  Player player=game.getPlayer(controllerId);
  if (player == null || !(ability instanceof SpellAbility)) {
    return;
  }
  Target target=new TargetCardInYourGraveyard(1,Integer.MAX_VALUE,new FilterCard());
  target.setTargetName("String_Node_Str");
  if (!target.canChoose(sourceId,controllerId,game)) {
    return;
  }
  if (player.chooseUse(Outcome.Detriment,"String_Node_Str",game)) {
    player.chooseTarget(Outcome.Detriment,target,ability,game);
    if (target.getTargets().size() > 0) {
      int adjCost=0;
      for (      UUID cardId : target.getTargets()) {
        Card card=game.getCard(cardId);
        if (card == null) {
          continue;
        }
        card.moveToExile(null,null,this.getSourceId(),game);
        ++adjCost;
      }
      game.informPlayers(new StringBuilder(player.getName()).append("String_Node_Str").append(adjCost).append("String_Node_Str").append(adjCost != 1 ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str").toString());
      CardUtil.adjustCost((SpellAbility)ability,adjCost);
    }
  }
}

Fixed version (ground truth):
@Override public void adjustCosts(Ability ability,Game game){
  Player player=game.getPlayer(controllerId);
  if (player == null || !(ability instanceof SpellAbility)) {
    return;
  }
  Target target=new TargetCardInYourGraveyard(1,Integer.MAX_VALUE,new FilterCard());
  target.setTargetName("String_Node_Str");
  if (!target.canChoose(sourceId,controllerId,game)) {
    return;
  }
  if (!CardUtil.isCheckPlayableMode(ability) && player.chooseUse(Outcome.Detriment,"String_Node_Str",game)) {
    player.chooseTarget(Outcome.Detriment,target,ability,game);
    if (target.getTargets().size() > 0) {
      int adjCost=0;
      for (      UUID cardId : target.getTargets()) {
        Card card=game.getCard(cardId);
        if (card == null) {
          continue;
        }
        player.moveCardToExileWithInfo(card,null,"String_Node_Str",getSourceId(),game,Zone.GRAVEYARD);
        ++adjCost;
      }
      game.informPlayers(new StringBuilder("String_Node_Str").append(player.getName()).append("String_Node_Str").append(adjCost).append("String_Node_Str").append(adjCost != 1 ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str").toString());
      CardUtil.adjustCost((SpellAbility)ability,adjCost);
    }
  }
}
Program: 159277
Project: 159277
Buggy source:
@Override public boolean canBeBlocked(Permanent attacker,Permanent blocker,Ability source,Game game){
  if (blocker.getAbilities().containsKey(ShadowAbility.getInstance().getId()) || game.getContinuousEffects().asThough(blocker.getId(),AsThoughEffectType.BLOCK_SHADOW,blocker.getControllerId(),game)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canBeBlocked(Permanent attacker,Permanent blocker,Ability source,Game game){
  if (blocker.getAbilities().containsKey(ShadowAbility.getInstance().getId()) || game.getContinuousEffects().asThough(blocker.getId(),AsThoughEffectType.BLOCK_SHADOW,source,blocker.getControllerId(),game)) {
    return true;
  }
  return false;
}
Program: 159278
Project: 159278
Buggy source:
@Override public boolean canActivate(UUID playerId,Game game){
  MageObject object=game.getObject(sourceId);
  return (object.getCardType().contains(CardType.INSTANT) || object.hasAbility(FlashAbility.getInstance().getId(),game) || game.getContinuousEffects().asThough(sourceId,AsThoughEffectType.CAST,playerId,game)|| game.canPlaySorcery(playerId));
}

Fixed version (ground truth):
@Override public boolean canActivate(UUID playerId,Game game){
  MageObject object=game.getObject(sourceId);
  return (object.getCardType().contains(CardType.INSTANT) || object.hasAbility(FlashAbility.getInstance().getId(),game) || game.getContinuousEffects().asThough(sourceId,AsThoughEffectType.CAST,this,playerId,game)|| game.canPlaySorcery(playerId));
}
Program: 159279
Project: 159279
Buggy source:
private boolean spendAnyMana(Ability ability,Game game){
  return game.getContinuousEffects().asThough(ability.getSourceId(),AsThoughEffectType.SPEND_ANY_MANA,ability.getControllerId(),game);
}

Fixed version (ground truth):
private boolean spendAnyMana(Ability ability,Game game){
  return game.getContinuousEffects().asThough(ability.getSourceId(),AsThoughEffectType.SPEND_ANY_MANA,ability,ability.getControllerId(),game);
}
Program: 159280
Project: 159280
Buggy source:
protected boolean canPlay(ActivatedAbility ability,ManaOptions available,Game game){
  if (!(ability instanceof ManaAbility) && ability.canActivate(playerId,game)) {
    Ability copy=ability.copy();
    game.getContinuousEffects().costModification(copy,game);
    Card card=game.getCard(ability.getSourceId());
    if (card != null) {
      for (      Ability ability0 : card.getAbilities()) {
        if (ability0 instanceof AdjustingSourceCosts) {
          if (!(ability0 instanceof ConvokeAbility)) {
            ((AdjustingSourceCosts)ability0).adjustCosts(copy,game);
          }
        }
      }
    }
    ManaOptions abilityOptions=copy.getManaCostsToPay().getOptions();
    if (abilityOptions.size() == 0) {
      return true;
    }
 else {
      for (      Mana mana : abilityOptions) {
        for (        Mana avail : available) {
          if (mana.enough(avail)) {
            return true;
          }
        }
      }
    }
    MageObject object=game.getObject(ability.getSourceId());
    for (    Ability objectAbility : object.getAbilities()) {
      if (objectAbility instanceof AlternativeCostSourceAbility) {
        if (objectAbility.getCosts().canPay(ability.getSourceId(),playerId,game)) {
          return true;
        }
      }
    }
    for (    AlternativeCost cost : ability.getAlternativeCosts()) {
      if (cost.isAvailable(game,ability) && cost.canPay(ability.getSourceId(),playerId,game)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean canPlay(ActivatedAbility ability,ManaOptions available,Game game){
  if (!(ability instanceof ManaAbility)) {
    ActivatedAbility copy=ability.copy();
    copy.setCheckPlayableMode();
    if (!copy.canActivate(playerId,game)) {
      return false;
    }
    game.getContinuousEffects().costModification(copy,game);
    Card card=game.getCard(ability.getSourceId());
    if (card != null) {
      for (      Ability ability0 : card.getAbilities()) {
        if (ability0 instanceof AdjustingSourceCosts) {
          if (!(ability0 instanceof ConvokeAbility)) {
            ((AdjustingSourceCosts)ability0).adjustCosts(copy,game);
          }
        }
      }
    }
    ManaOptions abilityOptions=copy.getManaCostsToPay().getOptions();
    if (abilityOptions.size() == 0) {
      return true;
    }
 else {
      for (      Mana mana : abilityOptions) {
        for (        Mana avail : available) {
          if (mana.enough(avail)) {
            return true;
          }
        }
      }
    }
    MageObject object=game.getObject(ability.getSourceId());
    for (    Ability objectAbility : object.getAbilities()) {
      if (objectAbility instanceof AlternativeCostSourceAbility) {
        if (objectAbility.getCosts().canPay(ability.getSourceId(),playerId,game)) {
          return true;
        }
      }
    }
    for (    AlternativeCost cost : ability.getAlternativeCosts()) {
      if (cost.isAvailable(game,ability) && cost.canPay(ability.getSourceId(),playerId,game)) {
        return true;
      }
    }
  }
  return false;
}
Program: 159281
Project: 159281
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == EventType.SEARCH_LIBRARY) {
    return true;
  }
  if (event.getType() == EventType.END_TURN_STEP_POST) {
    this.paidPlayers.clear();
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == EventType.SEARCH_LIBRARY) {
    return true;
  }
  if (event.getType() == EventType.END_PHASE_POST) {
    this.paidPlayers.clear();
  }
  return false;
}
Program: 159282
Project: 159282
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  if (event.getType() == EventType.SEARCH_LIBRARY && !paidPlayers.contains(event.getPlayerId())) {
    Player player=game.getPlayer(event.getPlayerId());
    if (player != null) {
      ManaCostsImpl arbiterTax=new ManaCostsImpl("String_Node_Str");
      if (arbiterTax.canPay(source.getSourceId(),event.getPlayerId(),game) && player.chooseUse(Outcome.Neutral,"String_Node_Str",game)) {
        if (arbiterTax.payOrRollback(source,game,this.getId(),event.getPlayerId())) {
          paidPlayers.add(event.getPlayerId());
          return false;
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  if (event.getType() == EventType.SEARCH_LIBRARY && !paidPlayers.contains(event.getPlayerId())) {
    Player player=game.getPlayer(event.getPlayerId());
    if (player != null) {
      ManaCostsImpl arbiterTax=new ManaCostsImpl("String_Node_Str");
      if (arbiterTax.canPay(source.getSourceId(),event.getPlayerId(),game) && player.chooseUse(Outcome.Neutral,"String_Node_Str",game)) {
        if (arbiterTax.payOrRollback(source,game,source.getSourceId(),event.getPlayerId())) {
          paidPlayers.add(event.getPlayerId());
          return false;
        }
      }
    }
    return true;
  }
  return false;
}
Program: 159283
Project: 159283
Buggy source:
LeoninArbiterReplacementEffect(LeoninArbiterReplacementEffect effect){
  super(effect);
  this.paidPlayers=effect.paidPlayers;
}

Fixed version (ground truth):
LeoninArbiterReplacementEffect(LeoninArbiterReplacementEffect effect){
  super(effect);
  this.paidPlayers.addAll(effect.paidPlayers);
}
Program: 159284
Project: 159284
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card sourceCard=game.getCard(source.getSourceId());
  if (controller != null && sourceCard != null) {
    Permanent targetEnchantment=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (targetEnchantment != null) {
      controller.moveCardToExileWithInfo(targetEnchantment,null,null,source.getSourceId(),game,Zone.BATTLEFIELD);
      Card exiledCard=game.getCard(targetEnchantment.getId());
      if (exiledCard.hasSubtype("String_Node_Str")) {
        Player enchantmentController=game.getPlayer(targetEnchantment.getControllerId());
        return super.applySearchAndExile(game,source,exiledCard.getName(),enchantmentController.getId());
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card sourceCard=game.getCard(source.getSourceId());
  if (controller != null && sourceCard != null) {
    Permanent targetEnchantment=game.getPermanent(getTargetPointer().getFirst(game,source));
    if (targetEnchantment != null) {
      controller.moveCardToExileWithInfo(targetEnchantment,null,null,source.getSourceId(),game,Zone.BATTLEFIELD);
      if (targetEnchantment.hasSubtype("String_Node_Str")) {
        Player enchantmentController=game.getPlayer(targetEnchantment.getControllerId());
        return super.applySearchAndExile(game,source,targetEnchantment.getName(),enchantmentController.getId());
      }
    }
  }
  return false;
}
Program: 159285
Project: 159285
Buggy source:
@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) {
    UUID exileId=CardUtil.getCardExileZoneId(game,source);
    int numberOfCards=0;
    for (    Card card : game.getExile().getExileZone(exileId).getCards(game)) {
      if (card.getOwnerId().equals(controller.getId())) {
        numberOfCards++;
        card.setFaceDown(false);
        card.moveToZone(Zone.HAND,source.getSourceId(),game,true);
      }
    }
    if (numberOfCards > 0) {
      game.informPlayers(sourcePermanent.getName() + "String_Node_Str" + controller.getName()+ "String_Node_Str"+ numberOfCards+ "String_Node_Str"+ (numberOfCards > 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
    }
    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) {
    UUID exileId=CardUtil.getCardExileZoneId(game,source);
    int numberOfCards=0;
    ExileZone exileZone=game.getExile().getExileZone(exileId);
    if (exileZone != null) {
      for (      Card card : exileZone.getCards(game)) {
        if (card.getOwnerId().equals(controller.getId())) {
          numberOfCards++;
          card.setFaceDown(false);
          card.moveToZone(Zone.HAND,source.getSourceId(),game,true);
        }
      }
    }
    if (numberOfCards > 0) {
      game.informPlayers(sourcePermanent.getLogName() + "String_Node_Str" + controller.getName()+ "String_Node_Str"+ numberOfCards+ "String_Node_Str"+ (numberOfCards > 1 ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str");
    }
    return true;
  }
  return false;
}
Program: 159286
Project: 159286
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  Cards cards=new CardsImpl(Zone.PICK);
  int count=source.getManaCostsToPay().getX();
  count=Math.min(controller.getLibrary().size(),count);
  for (int i=0; i < count; i++) {
    Card card=controller.getLibrary().removeFromTop(game);
    cards.add(card);
    game.setZone(card.getId(),Zone.PICK);
  }
  FilterCard filter=new FilterCard("String_Node_Str" + count + "String_Node_Str");
  filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan,count + 1));
  filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT),new CardTypePredicate(CardType.CREATURE),new CardTypePredicate(CardType.ENCHANTMENT),new CardTypePredicate(CardType.LAND),new CardTypePredicate(CardType.PLANESWALKER)));
  TargetCard target1=new TargetCard(Zone.PICK,filter);
  while (cards.size() > 0 && controller.choose(Outcome.PutCardInPlay,cards,target1,game)) {
    Card card=cards.get(target1.getFirstTarget(),game);
    if (card != null) {
      cards.remove(card);
      card.putOntoBattlefield(game,Zone.PICK,source.getSourceId(),source.getControllerId());
    }
    target1.clearChosen();
  }
  while (cards.size() > 0) {
    Card card=cards.get(cards.iterator().next(),game);
    cards.remove(card);
    controller.putOntoBattlefieldWithInfo(card,game,Zone.LIBRARY,source.getSourceId());
    card.moveToZone(Zone.GRAVEYARD,source.getId(),game,true);
  }
  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;
  }
  Cards cards=new CardsImpl(Zone.LIBRARY);
  int xValue=source.getManaCostsToPay().getX();
  int numberCards=Math.min(controller.getLibrary().size(),xValue);
  for (int i=0; i < numberCards; i++) {
    Card card=controller.getLibrary().removeFromTop(game);
    cards.add(card);
  }
  FilterCard filter=new FilterCard("String_Node_Str" + xValue + "String_Node_Str");
  filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan,xValue + 1));
  filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT),new CardTypePredicate(CardType.CREATURE),new CardTypePredicate(CardType.ENCHANTMENT),new CardTypePredicate(CardType.LAND),new CardTypePredicate(CardType.PLANESWALKER)));
  TargetCard target1=new TargetCard(Zone.LIBRARY,filter);
  while (cards.size() > 0 && controller.choose(Outcome.PutCardInPlay,cards,target1,game)) {
    Card card=cards.get(target1.getFirstTarget(),game);
    if (card != null) {
      cards.remove(card);
      controller.putOntoBattlefieldWithInfo(card,game,Zone.LIBRARY,source.getSourceId());
    }
    target1.clearChosen();
    if (!controller.isInGame()) {
      break;
    }
  }
  while (cards.size() > 0) {
    Card card=cards.get(cards.iterator().next(),game);
    cards.remove(card);
    controller.moveCardToGraveyardWithInfo(card,source.getId(),game,Zone.LIBRARY);
  }
  return true;
}
Program: 159287
Project: 159287
Buggy source:
public void quit(UUID tournamentId,UUID userId){
  if (controllers.contains(tournamentId)) {
    controllers.get(tournamentId).quit(userId);
  }
 else {
    Logger.getLogger(TournamentManager.class).error("String_Node_Str" + tournamentId + "String_Node_Str"+ userId);
  }
}

Fixed version (ground truth):
public void quit(UUID tournamentId,UUID userId){
  if (controllers.containsKey(tournamentId)) {
    controllers.get(tournamentId).quit(userId);
  }
 else {
    Logger.getLogger(TournamentManager.class).error("String_Node_Str" + tournamentId + "String_Node_Str"+ userId);
  }
}
Program: 159288
Project: 159288
Buggy source:
@Override public void init(Game game,boolean testMode){
  this.abort=false;
  if (!testMode) {
    this.hand.clear();
    this.graveyard.clear();
  }
  this.library.reset();
  this.abilities.clear();
  this.counters.clear();
  this.wins=false;
  this.loses=false;
  this.left=false;
  this.quit=false;
  this.timerTimeout=false;
  this.idleTimeout=false;
  this.turns=0;
  this.passed=false;
  this.passedTurn=false;
  this.passedAllTurns=false;
  this.canGainLife=true;
  this.canLoseLife=true;
  this.topCardRevealed=false;
  this.setLife(game.getLife(),game);
  this.setReachedNextTurnAfterLeaving(false);
  game.getState().getWatchers().add(new BloodthirstWatcher(playerId));
}

Fixed version (ground truth):
@Override public void init(Game game,boolean testMode){
  this.abort=false;
  if (!testMode) {
    this.hand.clear();
    this.graveyard.clear();
  }
  this.library.reset();
  this.abilities.clear();
  this.counters.clear();
  this.wins=false;
  this.loses=false;
  this.left=false;
  this.quit=false;
  this.timerTimeout=false;
  this.idleTimeout=false;
  this.turns=0;
  this.isGameUnderControl=true;
  this.turnController=this.getId();
  this.playersUnderYourControl.clear();
  this.passed=false;
  this.passedTurn=false;
  this.passedAllTurns=false;
  this.canGainLife=true;
  this.canLoseLife=true;
  this.topCardRevealed=false;
  this.setLife(game.getLife(),game);
  this.setReachedNextTurnAfterLeaving(false);
  game.getState().getWatchers().add(new BloodthirstWatcher(playerId));
}
Program: 159289
Project: 159289
Buggy source:
@Override public void reset(){
  this.abilities.clear();
  this.landsPerTurn=1;
  this.loyaltyUsePerTurn=1;
  this.maxHandSize=7;
  this.maxAttackedBy=Integer.MAX_VALUE;
  this.canGainLife=true;
  this.canLoseLife=true;
  this.canPayLifeCost=true;
  this.canPaySacrificeCost=true;
  this.loseByZeroOrLessLife=true;
  this.canPlayCardsFromGraveyard=false;
  this.topCardRevealed=false;
  this.alternativeSourceCosts.clear();
}

Fixed version (ground truth):
/** 
 * called before apply effects
 */
@Override public void reset(){
  this.abilities.clear();
  this.landsPerTurn=1;
  this.loyaltyUsePerTurn=1;
  this.maxHandSize=7;
  this.maxAttackedBy=Integer.MAX_VALUE;
  this.canGainLife=true;
  this.canLoseLife=true;
  this.canPayLifeCost=true;
  this.canPaySacrificeCost=true;
  this.loseByZeroOrLessLife=true;
  this.canPlayCardsFromGraveyard=false;
  this.topCardRevealed=false;
  this.alternativeSourceCosts.clear();
}
Program: 159290
Project: 159290
Buggy source:
@Override public Set<UUID> getPlayableInHand(Game game){
  Set<UUID> playable=new HashSet<>();
  ManaOptions available=getManaAvailable(game);
  available.addMana(manaPool.getMana());
  for (  Card card : hand.getCards(game)) {
    for (    ActivatedAbility ability : card.getAbilities().getPlayableAbilities(Zone.HAND)) {
      if (canPlay(ability,available,game)) {
        playable.add(card.getId());
        break;
      }
    }
  }
  return playable;
}

Fixed version (ground truth):
@Override public Set<UUID> getPlayableInHand(Game game){
  Set<UUID> playable=new HashSet<>();
  if (!shouldSkipGettingPlayable(game)) {
    if (game.getPhase() != null && PhaseStep.CLEANUP.equals(game.getPhase().getStep().getType())) {
      for (      Card card : hand.getCards(game)) {
        playable.add(card.getId());
      }
    }
 else {
      ManaOptions available=getManaAvailable(game);
      available.addMana(manaPool.getMana());
      for (      Card card : hand.getCards(game)) {
        for (        ActivatedAbility ability : card.getAbilities().getPlayableAbilities(Zone.HAND)) {
          if (canPlay(ability,available,game)) {
            playable.add(card.getId());
            break;
          }
        }
      }
    }
  }
  return playable;
}