nus-yam/ex-repair huggingface dataset:
Program: 157972
Project: 157972
Buggy source:
@Override public boolean apply(Game game,Ability source,Ability abilityToModify){
  Player controller=game.getPlayer(abilityToModify.getControllerId());
  if (controller != null) {
    if ((abilityToModify instanceof ActivatedAbility && ((ActivatedAbility)abilityToModify).isCheckPlayableMode()) || controller.chooseUse(Outcome.PlayForFree,"String_Node_Str",source,game)) {
      abilityToModify.getCosts().clear();
      abilityToModify.getManaCostsToPay().clear();
      abilityToModify.getCosts().add(new DiscardSourceCost());
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source,Ability abilityToModify){
  Player controller=game.getPlayer(abilityToModify.getControllerId());
  if (controller != null) {
    if ((abilityToModify instanceof ActivatedAbility && ((ActivatedAbility)abilityToModify).isCheckPlayableMode()) || controller.chooseUse(Outcome.PlayForFree,"String_Node_Str",source,game)) {
      abilityToModify.getCosts().clear();
      abilityToModify.getManaCostsToPay().clear();
      abilityToModify.getCosts().add(new CyclingDiscardCost());
    }
    return true;
  }
  return false;
}
Program: 157973
Project: 157973
Buggy source:
@Override public CyclingDiscardCost copy(){
  return new CyclingDiscardCost(this);
}

Fixed version (ground truth):
@Override public CyclingAbility copy(){
  return new CyclingAbility(this);
}
Program: 157974
Project: 157974
Buggy source:
public LandfallWatcher(final LandfallWatcher watcher){
  super(watcher);
  playerPlayedLand.addAll(watcher.playerPlayedLand);
}

Fixed version (ground truth):
public LandfallWatcher(final LandfallWatcher watcher){
  super(watcher);
  playerPlayedLand.addAll(watcher.playerPlayedLand);
  landPlayed.addAll(watcher.landPlayed);
}
Program: 157975
Project: 157975
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent != null && permanent.isLand() && !playerPlayedLand.contains(event.getPlayerId())) {
      playerPlayedLand.add(event.getPlayerId());
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.LAND_PLAYED) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent != null && permanent.isLand() && !playerPlayedLand.contains(event.getPlayerId())) {
      playerPlayedLand.add(event.getPlayerId());
      landPlayed.add(event.getTargetId());
    }
  }
}
Program: 157976
Project: 157976
Buggy source:
@Override public void reset(){
  playerPlayedLand.clear();
  super.reset();
}

Fixed version (ground truth):
@Override public void reset(){
  playerPlayedLand.clear();
  landPlayed.clear();
  super.reset();
}
Program: 157977
Project: 157977
Buggy source:
public LandfallWatcher(final LandfallWatcher watcher){
  super(watcher);
  playerPlayedLand.addAll(watcher.playerPlayedLand);
  landPlayed.addAll(watcher.landPlayed);
}

Fixed version (ground truth):
public LandfallWatcher(final LandfallWatcher watcher){
  super(watcher);
  playerPlayedLand.addAll(watcher.playerPlayedLand);
  landEnteredBattlefield.addAll(watcher.landEnteredBattlefield);
}
Program: 157978
Project: 157978
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.LAND_PLAYED) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent != null && permanent.isLand() && !playerPlayedLand.contains(event.getPlayerId())) {
      playerPlayedLand.add(event.getPlayerId());
      landPlayed.add(event.getTargetId());
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent != null && permanent.isLand() && !playerPlayedLand.contains(event.getPlayerId())) {
      playerPlayedLand.add(event.getPlayerId());
      landEnteredBattlefield.add(event.getTargetId());
    }
  }
}
Program: 157979
Project: 157979
Buggy source:
@Override public void reset(){
  playerPlayedLand.clear();
  landPlayed.clear();
  super.reset();
}

Fixed version (ground truth):
@Override public void reset(){
  playerPlayedLand.clear();
  landEnteredBattlefield.clear();
  super.reset();
}
Program: 157980
Project: 157980
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getPermanent(event.getTargetId());
  if (permanent == null) {
    permanent=game.getPermanentEntering(event.getTargetId());
  }
  return permanent != null && permanent.getControllerId().equals(source.getControllerId());
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent permanent=game.getPermanent(event.getTargetId());
  if (permanent == null) {
    permanent=game.getPermanentEntering(event.getTargetId());
    landPlayed=(permanent != null && permanent.isLand());
  }
  return permanent != null && permanent.getControllerId().equals(source.getControllerId()) && !landPlayed;
}
Program: 157981
Project: 157981
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    if (allPlayers) {
      for (      UUID playerId : game.getState().getPlayersInRange(controller.getId(),game)) {
        Player player=game.getPlayer(playerId);
        if (player != null) {
          player.setTopCardRevealed(true);
        }
      }
    }
 else {
      controller.setTopCardRevealed(true);
    }
    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) {
    if (allPlayers) {
      for (      UUID playerId : game.getState().getPlayersInRange(controller.getId(),game)) {
        Player player=game.getPlayer(playerId);
        if (player != null && !isCastFromPlayersLibrary(game,playerId)) {
          player.setTopCardRevealed(true);
        }
      }
    }
 else     if (!isCastFromPlayersLibrary(game,controller.getId())) {
      controller.setTopCardRevealed(true);
    }
    return true;
  }
  return false;
}
Program: 157982
Project: 157982
Buggy source:
public boolean activate(Game game,boolean noMana){
  if (!spellAbilities.get(0).activate(game,noMana)) {
    return false;
  }
  if (spellAbilities.size() > 1) {
    boolean ignoreAbility=true;
    boolean payNoMana=noMana;
    for (    SpellAbility spellAbility : spellAbilities) {
      if (ignoreAbility) {
        ignoreAbility=false;
      }
 else {
        payNoMana|=spellAbility.getSpellAbilityType() == SpellAbilityType.SPLICE;
        if (!spellAbility.activate(game,payNoMana)) {
          return false;
        }
      }
    }
  }
  setDoneActivatingManaAbilities(false);
  return true;
}

Fixed version (ground truth):
public boolean activate(Game game,boolean noMana){
  setDoneActivatingManaAbilities(false);
  if (!spellAbilities.get(0).activate(game,noMana)) {
    return false;
  }
  if (spellAbilities.size() > 1) {
    boolean ignoreAbility=true;
    boolean payNoMana=noMana;
    for (    SpellAbility spellAbility : spellAbilities) {
      if (ignoreAbility) {
        ignoreAbility=false;
      }
 else {
        payNoMana|=spellAbility.getSpellAbilityType() == SpellAbilityType.SPLICE;
        if (!spellAbility.activate(game,payNoMana)) {
          return false;
        }
      }
    }
  }
  setDoneActivatingManaAbilities(true);
  return true;
}
Program: 157983
Project: 157983
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  cardWasCycledThisTurn=false;
  cardHasCycling=false;
  if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD) {
    Player controller=game.getPlayer(source.getControllerId());
    AbandonedSarcophagusWatcher watcher=(AbandonedSarcophagusWatcher)game.getState().getWatchers().get(AbandonedSarcophagusWatcher.class.getSimpleName());
    Card card=game.getCard(event.getTargetId());
    if (card != null && watcher != null) {
      for (      Ability ability : card.getAbilities()) {
        if (ability instanceof CyclingAbility) {
          cardHasCycling=true;
        }
      }
      Cards cards=watcher.getCardsCycledThisTurn(controller.getId());
      for (      Card c : cards.getCards(game)) {
        if (c == card) {
          cardWasCycledThisTurn=true;
          watcher.getCardsCycledThisTurn(controller.getId()).remove(card);
        }
      }
      return (!cardWasCycledThisTurn && cardHasCycling);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  cardWasCycledThisTurn=false;
  cardHasCycling=false;
  if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD && !game.isSimulation()) {
    Player controller=game.getPlayer(source.getControllerId());
    AbandonedSarcophagusWatcher watcher=(AbandonedSarcophagusWatcher)game.getState().getWatchers().get(AbandonedSarcophagusWatcher.class.getSimpleName());
    Card card=game.getCard(event.getTargetId());
    if (card != null && watcher != null && card.getOwnerId() == controller.getId()) {
      for (      Ability ability : card.getAbilities()) {
        if (ability instanceof CyclingAbility) {
          cardHasCycling=true;
        }
      }
      Cards cards=watcher.getCardsCycledThisTurn(controller.getId());
      for (      Card c : cards.getCards(game)) {
        if (c == card) {
          cardWasCycledThisTurn=true;
          watcher.getCardsCycledThisTurn(controller.getId()).remove(card);
        }
      }
      return (!cardWasCycledThisTurn && cardHasCycling);
    }
  }
  return false;
}
Program: 157984
Project: 157984
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.CYCLE_CARD) {
    Card card=game.getCard(event.getSourceId());
    if (card != null) {
      Cards c=getCardsCycledThisTurn(event.getPlayerId());
      c.add(card);
      cycledCardsThisTurn.put(event.getPlayerId(),c);
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.CYCLE_CARD && !game.isSimulation()) {
    Card card=game.getCard(event.getSourceId());
    Player controller=game.getPlayer(event.getPlayerId());
    if (card != null && controller != null && card.getOwnerId() == controller.getId()) {
      Cards c=getCardsCycledThisTurn(event.getPlayerId());
      c.add(card);
      cycledCardsThisTurn.put(event.getPlayerId(),c);
    }
  }
}
Program: 157985
Project: 157985
Buggy source:
@Override public boolean canActivate(UUID playerId,Game game){
  if (!controlsAbility(playerId,game)) {
    return false;
  }
  return costs.canPay(this,sourceId,controllerId,game);
}

Fixed version (ground truth):
@Override public boolean canActivate(UUID playerId,Game game){
  if (!controlsAbility(playerId,game)) {
    return false;
  }
  if (timing == TimingRule.SORCERY && !game.canPlaySorcery(playerId) && !game.getContinuousEffects().asThough(sourceId,AsThoughEffectType.ACTIVATE_AS_INSTANT,this,controllerId,game)) {
    return false;
  }
  return costs.canPay(this,sourceId,controllerId,game);
}
Program: 157987
Project: 157987
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (targetPlayer != null) {
    for (    Card card : targetPlayer.getGraveyard().getCards(game)) {
      if (!filter.match(card,game)) {
        card.moveToExile(null,"String_Node_Str",source.getSourceId(),game);
        FilterCard filterCard=new FilterCard("String_Node_Str" + card.getName());
        filterCard.add(new NamePredicate(card.getName()));
        int count=targetPlayer.getLibrary().count(filterCard,game);
        TargetCardInLibrary target=new TargetCardInLibrary(count,count,filterCard);
        player.searchLibrary(target,game,targetPlayer.getId());
        List<UUID> targets=target.getTargets();
        for (        UUID cardId : targets) {
          Card libraryCard=game.getCard(cardId);
          if (libraryCard != null) {
            libraryCard.moveToExile(null,"String_Node_Str",source.getSourceId(),game);
          }
        }
      }
    }
    targetPlayer.shuffleLibrary(source,game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (targetPlayer != null) {
    for (    Card card : targetPlayer.getGraveyard().getCards(game)) {
      if (!filter.match(card,game)) {
        card.moveToExile(null,"String_Node_Str",source.getSourceId(),game);
        FilterCard filterCard=new FilterCard("String_Node_Str" + card.getName());
        String nameToSearch=card.isSplitCard() ? ((SplitCard)card).getLeftHalfCard().getName() : card.getName();
        filterCard.add(new NamePredicate(nameToSearch));
        int count=targetPlayer.getLibrary().count(filterCard,game);
        TargetCardInLibrary target=new TargetCardInLibrary(count,count,filterCard);
        player.searchLibrary(target,game,targetPlayer.getId());
        List<UUID> targets=target.getTargets();
        for (        UUID cardId : targets) {
          Card libraryCard=game.getCard(cardId);
          if (libraryCard != null) {
            libraryCard.moveToExile(null,"String_Node_Str",source.getSourceId(),game);
          }
        }
      }
    }
    targetPlayer.shuffleLibrary(source,game);
    return true;
  }
  return false;
}
Program: 157988
Project: 157988
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) {
    if (!controller.getHand().isEmpty()) {
      Card cardToReveal=null;
      if (controller.getHand().size() > 1) {
        Target target=new TargetCardInHand(new FilterCard());
        target.setNotTarget(true);
        if (controller.chooseTarget(outcome,target,source,game)) {
          cardToReveal=game.getCard(target.getFirstTarget());
        }
      }
 else {
        cardToReveal=controller.getHand().getRandom(game);
      }
      FilterCard filterCard;
      if (cardToReveal != null) {
        controller.revealCards("String_Node_Str" + sourceObject.getName(),new CardsImpl(cardToReveal),game);
        filterCard=new FilterCard("String_Node_Str" + cardToReveal.getName());
        filterCard.add(new NamePredicate(cardToReveal.getName()));
      }
 else {
        filterCard=new FilterCard();
      }
      return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filterCard),true,true).apply(game,source);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    if (!controller.getHand().isEmpty()) {
      Card cardToReveal=null;
      if (controller.getHand().size() > 1) {
        Target target=new TargetCardInHand(new FilterCard());
        target.setNotTarget(true);
        if (controller.chooseTarget(outcome,target,source,game)) {
          cardToReveal=game.getCard(target.getFirstTarget());
        }
      }
 else {
        cardToReveal=controller.getHand().getRandom(game);
      }
      FilterCard filterCard;
      if (cardToReveal != null) {
        controller.revealCards("String_Node_Str" + sourceObject.getName(),new CardsImpl(cardToReveal),game);
        String nameToSearch=cardToReveal.isSplitCard() ? ((SplitCard)cardToReveal).getLeftHalfCard().getName() : cardToReveal.getName();
        filterCard=new FilterCard("String_Node_Str" + nameToSearch);
        filterCard.add(new NamePredicate(nameToSearch));
      }
 else {
        filterCard=new FilterCard();
      }
      return new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filterCard),true,true).apply(game,source);
    }
    return true;
  }
  return false;
}
Program: 157992
Project: 157992
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.sourceId);
  if (enchantment != null && enchantment.getAttachedTo() != null) {
    Player player=game.getPlayer(enchantment.getAttachedTo());
    if (player != null && game.getActivePlayerId().equals(player.getId())) {
      this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent enchantment=game.getPermanent(this.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null) {
    if (game.getActivePlayerId().equals(enchantment.getAttachedTo())) {
      return true;
    }
  }
  return false;
}
Program: 157993
Project: 157993
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player enchantedPlayer=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (enchantedPlayer != null) {
    int permanents=game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_NON_LAND,enchantedPlayer.getId(),game);
    if (permanents > 0 && enchantedPlayer.chooseUse(outcome,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",source,game)) {
      Target target=new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND);
      if (enchantedPlayer.choose(outcome,target,source.getSourceId(),game)) {
        Permanent permanent=game.getPermanent(target.getFirstTarget());
        if (permanent != null) {
          permanent.sacrifice(source.getSourceId(),game);
          return true;
        }
      }
    }
    if (!enchantedPlayer.getHand().isEmpty() && enchantedPlayer.chooseUse(outcome,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",source,game)) {
      enchantedPlayer.discardOne(false,source,game);
      return true;
    }
    enchantedPlayer.loseLife(3,game,false);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent enchantment=game.getPermanent(source.getSourceId());
  if (enchantment == null || enchantment.getAttachedTo() == null) {
    return false;
  }
  Player enchantedPlayer=game.getPlayer(enchantment.getAttachedTo());
  if (enchantedPlayer != null) {
    int permanents=game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_NON_LAND,enchantedPlayer.getId(),game);
    if (permanents > 0 && enchantedPlayer.chooseUse(outcome,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",source,game)) {
      Target target=new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_NON_LAND);
      if (enchantedPlayer.choose(outcome,target,source.getSourceId(),game)) {
        Permanent permanent=game.getPermanent(target.getFirstTarget());
        if (permanent != null) {
          permanent.sacrifice(source.getSourceId(),game);
          return true;
        }
      }
    }
    if (!enchantedPlayer.getHand().isEmpty() && enchantedPlayer.chooseUse(outcome,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",source,game)) {
      enchantedPlayer.discardOne(false,source,game);
      return true;
    }
    enchantedPlayer.loseLife(3,game,false);
    return true;
  }
  return false;
}
Program: 157996
Project: 157996
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    Target target=new TargetPermanent(filter);
    if (target.canChoose(source.getControllerId(),game)) {
      player.choose(Outcome.Copy,target,source.getSourceId(),game);
      Permanent tokenToCopy=game.getPermanent(target.getFirstTarget());
      if (tokenToCopy != null) {
        if (!game.isSimulation()) {
          game.informPlayers("String_Node_Str" + tokenToCopy.getLogName());
        }
        Effect effect=new PutTokenOntoBattlefieldCopyTargetEffect();
        effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
        return effect.apply(game,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) {
    Target target=new TargetPermanent(filter);
    target.setNotTarget(true);
    if (target.canChoose(source.getControllerId(),game)) {
      player.choose(Outcome.Copy,target,source.getSourceId(),game);
      Permanent tokenToCopy=game.getPermanent(target.getFirstTarget());
      if (tokenToCopy != null) {
        if (!game.isSimulation()) {
          game.informPlayers("String_Node_Str" + tokenToCopy.getLogName());
        }
        Effect effect=new PutTokenOntoBattlefieldCopyTargetEffect();
        effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
        return effect.apply(game,source);
      }
    }
    return true;
  }
  return false;
}
Program: 157997
Project: 157997
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card aura=game.getCard(source.getFirstTarget());
  if (controller == null || aura == null) {
    return false;
  }
  FilterControlledCreaturePermanent FILTER=new FilterControlledCreaturePermanent("String_Node_Str");
  TargetControlledPermanent target=new TargetControlledPermanent(FILTER);
  target.setNotTarget(true);
  if (target.canChoose(source.getControllerId(),game) && controller.choose(Outcome.PutCardInPlay,target,source.getSourceId(),game)) {
    Permanent permanent=game.getPermanent(target.getFirstTarget());
    if (permanent != null && !permanent.cantBeAttachedBy(aura,game)) {
      game.getState().setValue("String_Node_Str" + aura.getId(),permanent);
      controller.moveCards(aura,Zone.BATTLEFIELD,source,game);
      return permanent.addAttachment(aura.getId(),game);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Card aura=game.getCard(source.getFirstTarget());
  if (controller == null || aura == null) {
    return false;
  }
  FilterControlledCreaturePermanent FILTER=new FilterControlledCreaturePermanent("String_Node_Str");
  TargetControlledPermanent target=new TargetControlledPermanent(FILTER);
  target.setNotTarget(true);
  if (controller.choose(Outcome.PutCardInPlay,target,source.getSourceId(),game)) {
    Permanent permanent=game.getPermanent(target.getFirstTarget());
    if (permanent != null && !permanent.cantBeAttachedBy(aura,game)) {
      game.getState().setValue("String_Node_Str" + aura.getId(),permanent);
      aura.putOntoBattlefield(game,Zone.GRAVEYARD,source.getSourceId(),controller.getId());
      return permanent.addAttachment(aura.getId(),game);
    }
  }
  return false;
}
Program: 157998
Project: 157998
Buggy source:
@Override public void setRuleAtTheTop(boolean ruleAtTheTop){
  this.ability.setRuleAtTheTop(ruleAtTheTop);
}

Fixed version (ground truth):
@Override public Ability setRuleAtTheTop(boolean ruleAtTheTop){
  this.ability.setRuleAtTheTop(ruleAtTheTop);
  return this;
}
Program: 157999
Project: 157999
Buggy source:
public String toString(){
  return new StringBuilder(responseString).append(',').append(responseUUID).append(',').append(responseBoolean).append(',').append(responseInteger).append(',').append(responseManaType).append(',').append(responseManaTypePlayerId).toString();
}

Fixed version (ground truth):
public String toString(){
  return new StringBuilder((responseString == null) ? "String_Node_Str" : responseString).append(',').append(responseUUID).append(',').append(responseBoolean).append(',').append(responseInteger).append(',').append(responseManaType).append(',').append(responseManaTypePlayerId).toString();
}
Program: 158000
Project: 158000
Buggy source:
/** 
 * bookmarks the current state and restores it if player doesn't pay the mana cost
 * @param ability
 * @param game
 * @param sourceId
 * @param payingPlayerId
 * @return true if the cost was paid
 */
@Override public boolean payOrRollback(Ability ability,Game game,UUID sourceId,UUID payingPlayerId){
  int bookmark=game.bookmarkState();
  if (pay(ability,game,sourceId,payingPlayerId,false,null)) {
    game.removeBookmark(bookmark);
    return true;
  }
  game.restoreState(bookmark,ability.getRule());
  return false;
}

Fixed version (ground truth):
/** 
 * bookmarks the current state and restores it if player doesn't pay the mana cost
 * @param ability
 * @param game
 * @param sourceId
 * @param payingPlayerId
 * @return true if the cost was paid
 */
@Override public boolean payOrRollback(Ability ability,Game game,UUID sourceId,UUID payingPlayerId){
  int bookmark=game.bookmarkState();
  handlePhyrexianManaCosts(payingPlayerId,ability,game);
  if (pay(ability,game,sourceId,payingPlayerId,false,null)) {
    game.removeBookmark(bookmark);
    return true;
  }
  game.restoreState(bookmark,ability.getRule());
  return false;
}
Program: 158001
Project: 158001
Buggy source:
private boolean handleManaCosts(ManaCosts attackBlockManaTax,GameEvent event,Ability source,Game game){
  Player player=game.getPlayer(event.getPlayerId());
  if (player != null) {
    String chooseText;
    if (event.getType() == EventType.DECLARE_ATTACKER) {
      chooseText="String_Node_Str" + attackBlockManaTax.getText() + "String_Node_Str";
    }
 else {
      chooseText="String_Node_Str" + attackBlockManaTax.getText() + "String_Node_Str";
    }
    attackBlockManaTax.clearPaid();
    if (attackBlockManaTax.canPay(source,source.getSourceId(),player.getId(),game) && player.chooseUse(Outcome.Neutral,chooseText,source,game)) {
      handlePhyrexianManaCosts(getManaCostToPay(event,source,game),player,source,game);
      if (attackBlockManaTax instanceof ManaCostsImpl) {
        if (attackBlockManaTax.payOrRollback(source,game,source.getSourceId(),event.getPlayerId())) {
          return false;
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean handleManaCosts(ManaCosts attackBlockManaTax,GameEvent event,Ability source,Game game){
  Player player=game.getPlayer(event.getPlayerId());
  if (player != null) {
    String chooseText;
    if (event.getType() == EventType.DECLARE_ATTACKER) {
      chooseText="String_Node_Str" + attackBlockManaTax.getText() + "String_Node_Str";
    }
 else {
      chooseText="String_Node_Str" + attackBlockManaTax.getText() + "String_Node_Str";
    }
    attackBlockManaTax.clearPaid();
    if (attackBlockManaTax.canPay(source,source.getSourceId(),player.getId(),game) && player.chooseUse(Outcome.Neutral,chooseText,source,game)) {
      if (attackBlockManaTax instanceof ManaCostsImpl) {
        if (attackBlockManaTax.payOrRollback(source,game,source.getSourceId(),event.getPlayerId())) {
          return false;
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158002
Project: 158002
Buggy source:
public PayCostToAttackBlockEffectImpl(PayCostToAttackBlockEffectImpl effect){
  super(effect);
  if (effect.cost != null) {
    this.cost=effect.cost.copy();
  }
 else {
    this.cost=null;
  }
  if (effect.manaCosts != null) {
    this.manaCosts=effect.manaCosts.copy();
  }
 else {
    this.manaCosts=null;
  }
  this.restrictType=effect.restrictType;
}

Fixed version (ground truth):
public PayCostToAttackBlockEffectImpl(final PayCostToAttackBlockEffectImpl effect){
  super(effect);
  if (effect.cost != null) {
    this.cost=effect.cost.copy();
  }
 else {
    this.cost=null;
  }
  if (effect.manaCosts != null) {
    this.manaCosts=effect.manaCosts.copy();
  }
 else {
    this.manaCosts=null;
  }
  this.restrictType=effect.restrictType;
}
Program: 158003
Project: 158003
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  ManaCosts attackBlockManaTax=getManaCostToPay(event,source,game);
  if (attackBlockManaTax != null) {
    return handleManaCosts(attackBlockManaTax,event,source,game);
  }
  Cost attackBlockOtherTax=getOtherCostToPay(event,source,game);
  if (attackBlockOtherTax != null) {
    return handleOtherCosts(attackBlockOtherTax,event,source,game);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  ManaCosts attackBlockManaTax=getManaCostToPay(event,source,game);
  if (attackBlockManaTax != null) {
    return handleManaCosts(attackBlockManaTax.copy(),event,source,game);
  }
  Cost attackBlockOtherTax=getOtherCostToPay(event,source,game);
  if (attackBlockOtherTax != null) {
    return handleOtherCosts(attackBlockOtherTax.copy(),event,source,game);
  }
  return false;
}
Program: 158004
Project: 158004
Buggy source:
public CantAttackYouUnlessPayManaAllEffect(CantAttackYouUnlessPayManaAllEffect effect){
  super(effect);
  this.payAlsoForAttackingPlaneswalker=effect.payAlsoForAttackingPlaneswalker;
  this.filterCreaturePermanent=effect.filterCreaturePermanent;
}

Fixed version (ground truth):
public CantAttackYouUnlessPayManaAllEffect(final CantAttackYouUnlessPayManaAllEffect effect){
  super(effect);
  this.payAlsoForAttackingPlaneswalker=effect.payAlsoForAttackingPlaneswalker;
  this.filterCreaturePermanent=effect.filterCreaturePermanent;
}
Program: 158006
Project: 158006
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (condition) {
    return;
  }
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
    Permanent p=(Permanent)game.getLastKnownInformation(event.getTargetId(),Zone.BATTLEFIELD);
    if (p != null && p.isCreature()) {
      condition=true;
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (condition) {
    return;
  }
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent() && ((ZoneChangeEvent)event).getTarget().isCreature()) {
    condition=true;
  }
}
Program: 158007
Project: 158007
Buggy source:
public void downloadImages(){
  List<CardInfo> cards=CardRepository.instance.findCards(new CardCriteria());
  DownloadPictures.startDownload(null,cards);
}

Fixed version (ground truth):
public void downloadImages(){
  java.util.List<CardInfo> cards=CardRepository.instance.findCards(new CardCriteria());
  DownloadPictures.startDownload(null,cards);
}
Program: 158008
Project: 158008
Buggy source:
public static void setActive(MagePane frame){
  if (activeFrame == frame) {
    return;
  }
  if (activeFrame != null) {
    activeFrame.deactivated();
  }
  if (frame == null) {
    activeFrame=null;
    return;
  }
  LOGGER.debug("String_Node_Str" + frame.getTitle() + "String_Node_Str");
  activeFrame=frame;
  desktopPane.moveToFront(frame);
  activeFrame.setBounds(0,0,desktopPane.getWidth(),desktopPane.getHeight());
  activeFrame.revalidate();
  activeFrame.activated();
  activeFrame.setVisible(true);
  ArrowBuilder.getBuilder().hideAllPanels();
  if (frame instanceof GamePane) {
    ArrowBuilder.getBuilder().showPanel(((GamePane)frame).getGameId());
    MusicPlayer.playBGM();
  }
 else {
    MusicPlayer.stopBGM();
  }
}

Fixed version (ground truth):
public static void setActive(MagePane frame){
  try {
    ActionCallback callback=Plugins.instance.getActionCallback();
    if (callback != null && callback instanceof MageActionCallback) {
      ((MageActionCallback)callback).hideEnlargedCard();
    }
    Component container=MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
    if (container.isVisible()) {
      container.setVisible(false);
      container.repaint();
    }
  }
 catch (  InterruptedException e) {
  }
  if (activeFrame == frame) {
    return;
  }
  if (activeFrame != null) {
    activeFrame.deactivated();
  }
  if (frame == null) {
    activeFrame=null;
    return;
  }
  LOGGER.debug("String_Node_Str" + frame.getTitle() + "String_Node_Str");
  activeFrame=frame;
  desktopPane.moveToFront(frame);
  activeFrame.setBounds(0,0,desktopPane.getWidth(),desktopPane.getHeight());
  activeFrame.revalidate();
  activeFrame.activated();
  activeFrame.setVisible(true);
  ArrowBuilder.getBuilder().hideAllPanels();
  if (frame instanceof GamePane) {
    ArrowBuilder.getBuilder().showPanel(((GamePane)frame).getGameId());
    MusicPlayer.playBGM();
  }
 else {
    MusicPlayer.stopBGM();
  }
}
Program: 158009
Project: 158009
Buggy source:
@Override public boolean applies(UUID sourceId,Ability source,UUID affectedControllerId,Game game){
  if (affectedControllerId.equals(source.getControllerId())) {
    if (getTargetPointer().getFirst(game,source) == null) {
      this.discard();
      return false;
    }
    if (sourceId.equals(getTargetPointer().getFirst(game,source))) {
      Card card=game.getCard(sourceId);
      if (card != null) {
        if (game.getState().getZone(sourceId) == Zone.EXILED) {
          Player player=game.getPlayer(affectedControllerId);
          player.setCastSourceIdWithAlternateMana(sourceId,null,null);
          return true;
        }
 else {
          this.discard();
        }
      }
    }
  }
  return false;
}

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

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

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

Fixed version (ground truth):
@Override public boolean applies(UUID objectId,Ability source,UUID affectedControllerId,Game game){
  if (objectId.equals(getTargetPointer().getFirst(game,source)) && affectedControllerId.equals(source.getControllerId())) {
    Card card=game.getCard(objectId);
    if (card != null) {
      Player player=game.getPlayer(affectedControllerId);
      if (player != null) {
        player.setCastSourceIdWithAlternateMana(objectId,null,card.getSpellAbility().getCosts());
        return true;
      }
    }
  }
  return false;
}
Program: 158013
Project: 158013
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  boolean weAreDoingIt=getControllerId().equals(event.getPlayerId());
  boolean isM1M1Counters=event.getData().equals(CounterType.M1M1.getName());
  if (weAreDoingIt && isM1M1Counters && event.getAmount() > 0) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent == null) {
      permanent=game.getPermanentEntering(event.getTargetId());
    }
    if (permanent.isCreature()) {
      getEffects().forEach(effect -> effect.setValue("String_Node_Str",event.getAmount()));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  boolean weAreDoingIt=getControllerId().equals(game.getControllerId(event.getSourceId()));
  boolean isM1M1Counters=event.getData().equals(CounterType.M1M1.getName());
  if (weAreDoingIt && isM1M1Counters && event.getAmount() > 0) {
    Permanent permanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
    if (permanent == null) {
      permanent=game.getPermanentEntering(event.getTargetId());
    }
    if (permanent.isCreature()) {
      getEffects().forEach(effect -> effect.setValue("String_Node_Str",event.getAmount()));
      return true;
    }
  }
  return false;
}
Program: 158014
Project: 158014
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) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
    while (!controller.choose(outcome,typeChoice,game)) {
      if (!controller.canRespond()) {
        return false;
      }
    }
    if (typeChoice.getChoice() != null) {
      game.informPlayers(sourceObject.getLogName() + "String_Node_Str" + typeChoice.getChoice());
    }
    FilterCard filterSubtype=new FilterCard();
    filterSubtype.add(new SubtypePredicate(typeChoice.getChoice()));
    if (controller.getLibrary().hasCards()) {
      Card card=controller.getLibrary().getFromTop(game);
      Cards cards=new CardsImpl(card);
      controller.revealCards(sourceObject.getIdName(),cards,game);
      if (card != null) {
        if (filterSubtype.match(card,game)) {
          controller.moveCards(card,Zone.HAND,source,game);
        }
 else {
          controller.moveCards(card,Zone.GRAVEYARD,source,game);
        }
      }
    }
    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) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
    while (!controller.choose(outcome,typeChoice,game)) {
      if (!controller.canRespond()) {
        return false;
      }
    }
    if (typeChoice.getChoice() != null) {
      game.informPlayers(sourceObject.getLogName() + "String_Node_Str" + typeChoice.getChoice());
    }
    FilterCard filterSubtype=new FilterCard();
    filterSubtype.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
    if (controller.getLibrary().hasCards()) {
      Card card=controller.getLibrary().getFromTop(game);
      Cards cards=new CardsImpl(card);
      controller.revealCards(sourceObject.getIdName(),cards,game);
      if (card != null) {
        if (filterSubtype.match(card,game)) {
          controller.moveCards(card,Zone.HAND,source,game);
        }
 else {
          controller.moveCards(card,Zone.GRAVEYARD,source,game);
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158016
Project: 158016
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Choice choice=new ChoiceImpl(true);
    choice.setMessage("String_Node_Str");
    choice.setChoices(CardRepository.instance.getCreatureTypes());
    if (controller.choose(Outcome.Damage,choice,game)) {
      String chosenType=choice.getChoice();
      FilterControlledPermanent filter=new FilterControlledPermanent();
      filter.add(new SubtypePredicate(chosenType));
      int damageDealt=game.getBattlefield().count(filter,source.getSourceId(),source.getControllerId(),game);
      Permanent permanent=game.getPermanent(this.getTargetPointer().getFirst(game,source));
      if (permanent != null) {
        permanent.damage(damageDealt,source.getSourceId(),game,false,true);
      }
      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) {
    Choice choice=new ChoiceImpl(true);
    choice.setMessage("String_Node_Str");
    choice.setChoices(SubType.getCreatureTypes(false));
    if (controller.choose(Outcome.Damage,choice,game)) {
      String chosenType=choice.getChoice();
      FilterControlledPermanent filter=new FilterControlledPermanent();
      filter.add(new SubtypePredicate(SubType.byDescription(chosenType)));
      int damageDealt=game.getBattlefield().count(filter,source.getSourceId(),source.getControllerId(),game);
      Permanent permanent=game.getPermanent(this.getTargetPointer().getFirst(game,source));
      if (permanent != null) {
        permanent.damage(damageDealt,source.getSourceId(),game,false,true);
      }
      return true;
    }
  }
  return false;
}
Program: 158017
Project: 158017
Buggy source:
private void searchCard(Player player,Ability source,Game game,Cards cards,String subtype){
  FilterCard filter=new FilterCard(subtype);
  filter.add(new SubtypePredicate(subtype));
  TargetCardInLibrary target=new TargetCardInLibrary(filter);
  if (player.searchLibrary(target,game)) {
    Card card=player.getLibrary().remove(target.getFirstTarget(),game);
    if (card != null) {
      card.moveToZone(Zone.HAND,source.getSourceId(),game,false);
      cards.add(card);
    }
  }
}

Fixed version (ground truth):
private void searchCard(Player player,Ability source,Game game,Cards cards,String subtype){
  FilterCard filter=new FilterCard(subtype);
  filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
  TargetCardInLibrary target=new TargetCardInLibrary(filter);
  if (player.searchLibrary(target,game)) {
    Card card=player.getLibrary().remove(target.getFirstTarget(),game);
    if (card != null) {
      card.moveToZone(Zone.HAND,source.getSourceId(),game,false);
      cards.add(card);
    }
  }
}
Program: 158019
Project: 158019
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
    while (!player.choose(Outcome.BoostCreature,typeChoice,game)) {
      if (!player.canRespond()) {
        return false;
      }
    }
    FilterControlledCreaturePermanent filter=new FilterControlledCreaturePermanent();
    filter.add(new SubtypePredicate(typeChoice.getChoice()));
    return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game,source);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
    while (!player.choose(Outcome.BoostCreature,typeChoice,game)) {
      if (!player.canRespond()) {
        return false;
      }
    }
    FilterControlledCreaturePermanent filter=new FilterControlledCreaturePermanent();
    filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
    return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game,source);
  }
  return false;
}
Program: 158020
Project: 158020
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent doorOfDestinies=game.getPermanent(getSourceId());
  if (doorOfDestinies != null) {
    String subtype=(String)game.getState().getValue(doorOfDestinies.getId() + "String_Node_Str");
    if (subtype != null) {
      FilterSpell filter=new FilterSpell();
      filter.add(new ControllerPredicate(TargetController.YOU));
      filter.add(new SubtypePredicate(subtype));
      Spell spell=game.getStack().getSpell(event.getTargetId());
      if (spell != null && filter.match(spell,getSourceId(),getControllerId(),game)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent doorOfDestinies=game.getPermanent(getSourceId());
  if (doorOfDestinies != null) {
    String subtype=(String)game.getState().getValue(doorOfDestinies.getId() + "String_Node_Str");
    if (subtype != null) {
      FilterSpell filter=new FilterSpell();
      filter.add(new ControllerPredicate(TargetController.YOU));
      filter.add(new SubtypePredicate(SubType.byDescription(subtype)));
      Spell spell=game.getStack().getSpell(event.getTargetId());
      if (spell != null && filter.match(spell,getSourceId(),getControllerId(),game)) {
        return true;
      }
    }
  }
  return false;
}