nus-yam/ex-repair huggingface dataset:
Program: 159901
Project: 159901
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
    Permanent permanent=game.getPermanent(event.getTargetId());
    if (permanent != null && permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.controllerId)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
    Permanent permanent=game.getPermanent(event.getTargetId());
    if (permanent != null && permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.controllerId)) {
      return true;
    }
  }
  return false;
}
Program: 159903
Project: 159903
Buggy source:
@Override public boolean apply(Game game,Ability source){
  boolean result=false;
  for (  UUID id : targetPointer.getTargets(game,source)) {
switch (game.getState().getZone(id)) {
case BATTLEFIELD:
      Permanent permanent=game.getPermanent(id);
    if (permanent != null) {
      result|=permanent.moveToZone(Zone.HAND,source.getId(),game,false);
    }
  break;
case GRAVEYARD:
Card card=game.getCard(id);
if (card != null) {
result|=card.moveToZone(Zone.HAND,source.getId(),game,true);
}
break;
case EXILED:
card=game.getCard(id);
if (card != null) {
result|=card.moveToZone(Zone.HAND,source.getId(),game,true);
}
break;
}
}
return result;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  boolean result=false;
  for (  UUID targetId : targetPointer.getTargets(game,source)) {
switch (game.getState().getZone(targetId)) {
case BATTLEFIELD:
      Permanent permanent=game.getPermanent(targetId);
    if (permanent != null) {
      result|=permanent.moveToZone(Zone.HAND,source.getId(),game,false);
    }
  break;
case GRAVEYARD:
Card card=game.getCard(targetId);
if (card != null) {
result|=card.moveToZone(Zone.HAND,source.getId(),game,true);
}
break;
case EXILED:
card=game.getCard(targetId);
if (card != null) {
result|=card.moveToZone(Zone.HAND,source.getId(),game,true);
}
break;
}
}
return result;
}
Program: 159904
Project: 159904
Buggy source:
@Override public ArmyOfTheDamned copy(){
  return new ArmyOfTheDamned(this);
}

Fixed version (ground truth):
@Override public ArmyOfTheDamnedEffect copy(){
  return new ArmyOfTheDamnedEffect(this);
}
Program: 159905
Project: 159905
Buggy source:
@Override public void removeAllAbilities(UUID sourceId,Game game){
  getAbilities().clear();
  game.resetForSourceId(this.getId());
}

Fixed version (ground truth):
@Override public void removeAllAbilities(UUID sourceId,Game game){
  getAbilities().clear();
  game.getContinuousEffects().removeGainedEffectsForSource(this.getId());
  game.getState().resetForSourceId(this.getId());
}
Program: 159906
Project: 159906
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller == null) {
    return false;
  }
  for (  UUID playerId : controller.getInRange()) {
    Cards playerLibrary=new CardsImpl();
    Player player=game.getPlayer(playerId);
    playerLibrary.addAll(player.getLibrary().getCardList());
    TargetCardInLibrary target=new TargetCardInLibrary(new FilterNonlandCard());
    if (controller.choose(Constants.Outcome.Benefit,playerLibrary,target,game)) {
      UUID targetId=target.getFirstTarget();
      Card card=player.getLibrary().remove(targetId,game);
      if (card != null) {
        card.moveToExile(source.getSourceId(),"String_Node_Str",source.getSourceId(),game);
      }
    }
    player.shuffleLibrary(game);
  }
  ExileZone JaceExileZone=game.getExile().getExileZone(source.getSourceId());
  FilterCard filter=new FilterCard("String_Node_Str");
  TargetCardInExile target=new TargetCardInExile(filter,source.getSourceId());
  while (JaceExileZone.count(filter,game) > 0 && controller.choose(Outcome.PlayForFree,JaceExileZone,target,game)) {
    Card card=game.getCard(target.getFirstTarget());
    if (card != null) {
      if (controller.cast(card.getSpellAbility(),game,true)) {
        game.getExile().removeCard(card,game);
      }
    }
    target.clearChosen();
  }
  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;
  }
  for (  UUID playerId : controller.getInRange()) {
    Cards playerLibrary=new CardsImpl();
    Player player=game.getPlayer(playerId);
    playerLibrary.addAll(player.getLibrary().getCardList());
    String playerName=new StringBuilder(player.getName()).append("String_Node_Str").toString();
    if (source.getControllerId().equals(player.getId())) {
      playerName="String_Node_Str";
    }
    TargetCardInLibrary target=new TargetCardInLibrary(new FilterNonlandCard(new StringBuilder("String_Node_Str").append(playerName).append("String_Node_Str").toString()));
    if (controller.choose(Constants.Outcome.Benefit,playerLibrary,target,game)) {
      UUID targetId=target.getFirstTarget();
      Card card=player.getLibrary().remove(targetId,game);
      if (card != null) {
        card.moveToExile(source.getSourceId(),"String_Node_Str",source.getSourceId(),game);
      }
    }
    player.shuffleLibrary(game);
  }
  ExileZone JaceExileZone=game.getExile().getExileZone(source.getSourceId());
  FilterCard filter=new FilterCard("String_Node_Str");
  TargetCardInExile target=new TargetCardInExile(filter,source.getSourceId());
  while (JaceExileZone.count(filter,game) > 0 && controller.choose(Outcome.PlayForFree,JaceExileZone,target,game)) {
    Card card=game.getCard(target.getFirstTarget());
    if (card != null) {
      if (controller.cast(card.getSpellAbility(),game,true)) {
        game.getExile().removeCard(card,game);
      }
    }
    target.clearChosen();
  }
  return true;
}
Program: 159907
Project: 159907
Buggy source:
@Override public void entersBattlefield(UUID sourceId,Game game){
  controlledFromStartOfControllerTurn=false;
  game.replaceEvent(GameEvent.getEvent(EventType.ENTERS_THE_BATTLEFIELD,objectId,sourceId,ownerId));
}

Fixed version (ground truth):
@Override public void entersBattlefield(UUID sourceId,Game game){
  controlledFromStartOfControllerTurn=false;
  game.replaceEvent(GameEvent.getEvent(EventType.ENTERS_THE_BATTLEFIELD,objectId,sourceId,controllerId));
}
Program: 159908
Project: 159908
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
    Permanent creature=game.getPermanent(event.getTargetId());
    if (creature != null && creature.getControllerId().equals(source.getControllerId()) && !event.getTargetId().equals(source.getSourceId())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
    Permanent creature=game.getPermanent(event.getTargetId());
    if (creature != null && creature.getControllerId().equals(source.getControllerId()) && creature.getCardType().contains(CardType.CREATURE) && !event.getTargetId().equals(source.getSourceId())) {
      return true;
    }
  }
  return false;
}
Program: 159909
Project: 159909
Buggy source:
@Override public boolean apply(Game game,Ability source){
  boolean result=false;
  for (  Target target : source.getTargets()) {
    if (target instanceof TargetCreaturePermanent) {
      Permanent targetCreature=game.getPermanent(target.getFirstTarget());
      if (targetCreature != null) {
        ContinuousEffect effect1=new GainControlTargetEffect(Duration.EndOfTurn);
        effect1.setTargetPointer(new FixedTarget(targetCreature.getId()));
        game.addEffect(effect1,source);
        ContinuousEffect effect2=new GainAbilityTargetEffect(HasteAbility.getInstance(),Constants.Duration.EndOfTurn);
        effect2.setTargetPointer(new FixedTarget(targetCreature.getId()));
        game.addEffect(effect2,source);
        targetCreature.untap(game);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  boolean result=false;
  for (  Target target : source.getTargets()) {
    if (target instanceof TargetCreaturePermanent) {
      Permanent targetCreature=game.getPermanent(target.getFirstTarget());
      if (targetCreature != null) {
        ContinuousEffect effect1=new GainControlTargetEffect(Duration.EndOfTurn);
        effect1.setTargetPointer(new FixedTarget(targetCreature.getId()));
        game.addEffect(effect1,source);
        ContinuousEffect effect2=new GainAbilityTargetEffect(HasteAbility.getInstance(),Constants.Duration.EndOfTurn);
        effect2.setTargetPointer(new FixedTarget(targetCreature.getId()));
        game.addEffect(effect2,source);
        targetCreature.untap(game);
        result=true;
      }
    }
  }
  return result;
}
Program: 159910
Project: 159910
Buggy source:
@Override public boolean apply(Game game,Ability source){
  List<Permanent> permanents=game.getBattlefield().getAllActivePermanents(source.getControllerId());
  for (  Permanent p : permanents) {
    if (!p.getColor().isColorless()) {
      p.sacrifice(source.getSourceId(),game);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  List<Permanent> permanents=game.getBattlefield().getActivePermanents(source.getControllerId(),game);
  for (  Permanent p : permanents) {
    if (!p.getColor().isColorless()) {
      p.sacrifice(source.getSourceId(),game);
    }
  }
  return true;
}
Program: 159911
Project: 159911
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    List<Permanent> creatures=game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(),player.getId(),game);
    int amount=0;
    for (    Permanent creature : creatures) {
      int power=creature.getPower().getValue();
      if (amount < power) {
        amount=power;
      }
    }
    OozeToken oozeToken=new OozeToken();
    oozeToken.getPower().setValue(amount);
    oozeToken.getToughness().setValue(amount);
    oozeToken.putOntoBattlefield(1,game,source.getSourceId(),source.getControllerId());
    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) {
    List<Permanent> creatures=game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(),player.getId(),game);
    int amount=0;
    for (    Permanent creature : creatures) {
      int power=creature.getPower().getValue();
      if (amount < power) {
        amount=power;
      }
    }
    OozeToken oozeToken=new OozeToken();
    oozeToken.getPower().initValue(amount);
    oozeToken.getToughness().initValue(amount);
    oozeToken.putOntoBattlefield(1,game,source.getSourceId(),source.getControllerId());
    return true;
  }
  return false;
}
Program: 159912
Project: 159912
Buggy source:
public OozeToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  power=new MageInt(0);
  toughness=new MageInt(0);
}

Fixed version (ground truth):
public OozeToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  color.setGreen(true);
  power=new MageInt(0);
  toughness=new MageInt(0);
}
Program: 159913
Project: 159913
Buggy source:
@Override public boolean apply(Game game,Ability source){
  StackObject stackObject=game.getStack().getStackObject(targetPointer.getFirst(game,source));
  if (stackObject != null && game.getStack().counter(source.getFirstTarget(),source.getSourceId(),game)) {
    if (stackObject != null) {
      int cmc=stackObject.getManaCost().convertedManaCost();
      if (cmc > 0) {
        MysticGenesisOozeToken oozeToken=new MysticGenesisOozeToken();
        oozeToken.getPower().setValue(cmc);
        oozeToken.getToughness().setValue(cmc);
        oozeToken.putOntoBattlefield(1,game,source.getSourceId(),source.getControllerId());
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  StackObject stackObject=game.getStack().getStackObject(targetPointer.getFirst(game,source));
  if (stackObject != null && game.getStack().counter(source.getFirstTarget(),source.getSourceId(),game)) {
    if (stackObject != null) {
      int cmc=stackObject.getManaCost().convertedManaCost();
      if (cmc > 0) {
        MysticGenesisOozeToken oozeToken=new MysticGenesisOozeToken();
        oozeToken.getPower().initValue(cmc);
        oozeToken.getToughness().initValue(cmc);
        oozeToken.putOntoBattlefield(1,game,source.getSourceId(),source.getControllerId());
      }
      return true;
    }
  }
  return false;
}
Program: 159914
Project: 159914
Buggy source:
@Override public boolean apply(Game game,Ability source){
  int xValue=0;
  for (  Cost cost : source.getCosts()) {
    if (cost instanceof RemoveVariableCountersTargetCost) {
      xValue=((RemoveVariableCountersTargetCost)cost).getAmount();
      break;
    }
  }
  Token tokenCopy=token.copy();
  tokenCopy.getAbilities().newId();
  tokenCopy.getPower().setValue(xValue);
  tokenCopy.getToughness().setValue(xValue);
  tokenCopy.putOntoBattlefield(1,game,source.getSourceId(),source.getControllerId());
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  int xValue=0;
  for (  Cost cost : source.getCosts()) {
    if (cost instanceof RemoveVariableCountersTargetCost) {
      xValue=((RemoveVariableCountersTargetCost)cost).getAmount();
      break;
    }
  }
  Token tokenCopy=token.copy();
  tokenCopy.getAbilities().newId();
  tokenCopy.getPower().initValue(xValue);
  tokenCopy.getToughness().initValue(xValue);
  tokenCopy.putOntoBattlefield(1,game,source.getSourceId(),source.getControllerId());
  return true;
}
Program: 159915
Project: 159915
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent aura=game.getPermanent(source.getFirstTarget());
  Permanent creature=game.getPermanent(source.getTargets().get(1).getFirstTarget());
  if (aura != null && creature != null) {
    aura.attachTo(creature.getId(),game);
    creature.addAttachment(aura.getId(),game);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent aura=game.getPermanent(source.getFirstTarget());
  Permanent creature=game.getPermanent(source.getTargets().get(1).getFirstTarget());
  if (aura != null && creature != null) {
    Permanent oldCreature=game.getPermanent(aura.getAttachedTo());
    if (oldCreature == null || oldCreature.equals(creature)) {
      return false;
    }
    if (oldCreature.removeAttachment(aura.getId(),game)) {
      return creature.addAttachment(aura.getId(),game);
    }
  }
  return false;
}
Program: 159916
Project: 159916
Buggy source:
@Override public boolean apply(Game game,Ability source,UUID originalId){
  return apply(game,source,null);
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source,UUID originalId){
  return apply(game,source);
}
Program: 159917
Project: 159917
Buggy source:
@Override public boolean apply(Game game,Ability source){
  for (  Permanent permanent : game.getBattlefield().getAllActivePermanents(filter,source.getControllerId(),game)) {
    permanent.moveToZone(Constants.Zone.HAND,source.getSourceId(),game,true);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(filter,source.getControllerId(),source.getSourceId(),game)) {
    permanent.moveToZone(Constants.Zone.HAND,source.getSourceId(),game,true);
  }
  return true;
}
Program: 159918
Project: 159918
Buggy source:
public boolean hasFirstOrDoubleStrike(Game game){
  for (  CombatGroup group : groups) {
    if (group.hasFirstOrDoubleStrike(game))     return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean hasFirstOrDoubleStrike(Game game){
  for (  CombatGroup group : groups) {
    if (group.hasFirstOrDoubleStrike(game)) {
      return true;
    }
  }
  return false;
}
Program: 159919
Project: 159919
Buggy source:
public CombatGroup findGroup(UUID attackerId){
  for (  CombatGroup group : groups) {
    if (group.getAttackers().contains(attackerId))     return group;
  }
  return null;
}

Fixed version (ground truth):
public CombatGroup findGroup(UUID attackerId){
  for (  CombatGroup group : groups) {
    if (group.getAttackers().contains(attackerId)) {
      return group;
    }
  }
  return null;
}
Program: 159920
Project: 159920
Buggy source:
public Set<UUID> getPlayerDefenders(Game game){
  Set<UUID> playerDefenders=new HashSet<UUID>();
  for (  CombatGroup group : groups) {
    if (group.defenderIsPlaneswalker) {
      Permanent permanent=game.getPermanent(group.getDefenderId());
      if (permanent != null)       playerDefenders.add(permanent.getControllerId());
    }
 else {
      playerDefenders.add(group.getDefenderId());
    }
  }
  return playerDefenders;
}

Fixed version (ground truth):
public Set<UUID> getPlayerDefenders(Game game){
  Set<UUID> playerDefenders=new HashSet<UUID>();
  for (  CombatGroup group : groups) {
    if (group.defenderIsPlaneswalker) {
      Permanent permanent=game.getPermanent(group.getDefenderId());
      if (permanent != null) {
        playerDefenders.add(permanent.getControllerId());
      }
    }
 else {
      playerDefenders.add(group.getDefenderId());
    }
  }
  return playerDefenders;
}
Program: 159921
Project: 159921
Buggy source:
public void selectAttackers(Game game){
  if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_ATTACKERS,attackerId,attackerId))) {
    Player player=game.getPlayer(attackerId);
    checkAttackRequirements(player,game);
    player.selectAttackers(game,attackerId);
    if (game.isPaused() || game.isGameOver())     return;
    checkAttackRestrictions(player,game);
    resumeSelectAttackers(game);
  }
}

Fixed version (ground truth):
public void selectAttackers(Game game){
  if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_ATTACKERS,attackerId,attackerId))) {
    Player player=game.getPlayer(attackerId);
    checkAttackRequirements(player,game);
    player.selectAttackers(game,attackerId);
    if (game.isPaused() || game.isGameOver()) {
      return;
    }
    checkAttackRestrictions(player,game);
    resumeSelectAttackers(game);
  }
}
Program: 159922
Project: 159922
Buggy source:
public void declareAttacker(UUID attackerId,UUID defenderId,Game game){
  if (!defenders.contains(defenderId))   return;
  Permanent defender=game.getPermanent(defenderId);
  CombatGroup newGroup=new CombatGroup(defenderId,defender != null);
  newGroup.attackers.add(attackerId);
  Permanent attacker=game.getPermanent(attackerId);
  if (!attacker.getAbilities().containsKey(VigilanceAbility.getInstance().getId())) {
    attacker.tap(game);
  }
  attacker.setAttacking(true);
  groups.add(newGroup);
}

Fixed version (ground truth):
public void declareAttacker(UUID attackerId,UUID defenderId,Game game){
  if (!defenders.contains(defenderId)) {
    return;
  }
  Permanent defender=game.getPermanent(defenderId);
  CombatGroup newGroup=new CombatGroup(defenderId,defender != null);
  newGroup.attackers.add(attackerId);
  Permanent attacker=game.getPermanent(attackerId);
  if (!attacker.getAbilities().containsKey(VigilanceAbility.getInstance().getId())) {
    attacker.tap(game);
  }
  attacker.setAttacking(true);
  groups.add(newGroup);
}
Program: 159923
Project: 159923
Buggy source:
public boolean noAttackers(){
  if (groups.isEmpty() || getAttackers().isEmpty())   return true;
  return false;
}

Fixed version (ground truth):
public boolean noAttackers(){
  if (groups.isEmpty() || getAttackers().isEmpty()) {
    return true;
  }
  return false;
}
Program: 159924
Project: 159924
Buggy source:
public boolean isAttacked(UUID defenderId,Game game){
  for (  CombatGroup group : groups) {
    if (group.getDefenderId().equals(defenderId))     return true;
    if (group.defenderIsPlaneswalker) {
      Permanent permanent=game.getPermanent(group.getDefenderId());
      if (permanent.getControllerId().equals(defenderId))       return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isAttacked(UUID defenderId,Game game){
  for (  CombatGroup group : groups) {
    if (group.getDefenderId().equals(defenderId)) {
      return true;
    }
    if (group.defenderIsPlaneswalker) {
      Permanent permanent=game.getPermanent(group.getDefenderId());
      if (permanent.getControllerId().equals(defenderId)) {
        return true;
      }
    }
  }
  return false;
}
Program: 159925
Project: 159925
Buggy source:
public void removeBlocker(UUID blockerId,Game game){
  for (  CombatGroup group : groups) {
    if (group.blockers.contains(blockerId)) {
      group.blockers.remove(blockerId);
      group.blockerOrder.remove(blockerId);
      if (group.blockers.isEmpty())       group.blocked=false;
    }
  }
  Permanent creature=game.getPermanent(blockerId);
  if (creature != null)   creature.setBlocking(0);
}

Fixed version (ground truth):
public void removeBlocker(UUID blockerId,Game game){
  for (  CombatGroup group : groups) {
    if (group.blockers.contains(blockerId)) {
      group.blockers.remove(blockerId);
      group.blockerOrder.remove(blockerId);
      if (group.blockers.isEmpty()) {
        group.blocked=false;
      }
    }
  }
  Permanent creature=game.getPermanent(blockerId);
  if (creature != null) {
    creature.setBlocking(0);
  }
}
Program: 159926
Project: 159926
Buggy source:
protected void checkAttackRestrictions(Player player,Game game){
  int count=0;
  for (  CombatGroup group : groups) {
    count+=group.getAttackers().size();
  }
  if (count == 1) {
    for (    CombatGroup group : groups) {
      List<UUID> tobeRemoved=new ArrayList<UUID>();
      for (      UUID attackerId : group.getAttackers()) {
        Permanent attacker=game.getPermanent(attackerId);
        if (attacker != null && attacker.getAbilities().containsKey(CantAttackAloneAbility.getInstance().getId())) {
          game.informPlayers(attacker.getName() + "String_Node_Str");
          tobeRemoved.add(attackerId);
        }
      }
      for (      UUID attackerId : tobeRemoved) {
        group.remove(attackerId);
      }
    }
  }
}

Fixed version (ground truth):
protected void checkAttackRestrictions(Player player,Game game){
  int count=0;
  for (  CombatGroup group : groups) {
    count+=group.getAttackers().size();
  }
  if (count == 1) {
    for (    CombatGroup group : groups) {
      List<UUID> tobeRemoved=new ArrayList<UUID>();
      for (      UUID attackingCreatureId : group.getAttackers()) {
        Permanent attacker=game.getPermanent(attackingCreatureId);
        if (attacker != null && attacker.getAbilities().containsKey(CantAttackAloneAbility.getInstance().getId())) {
          game.informPlayers(attacker.getName() + "String_Node_Str");
          tobeRemoved.add(attackingCreatureId);
        }
      }
      for (      UUID attackingCreatureId : tobeRemoved) {
        group.remove(attackingCreatureId);
      }
    }
  }
}
Program: 159928
Project: 159928
Buggy source:
public void run(){
  logger.info("String_Node_Str");
  FeedbackPanel.this.btnRight.doClick();
}

Fixed version (ground truth):
@Override public void run(){
  logger.info("String_Node_Str");
  Component c=MageFrame.getGame(gameId);
  while (c != null && !(c instanceof GamePane)) {
    c=c.getParent();
  }
  if (c != null && ((GamePane)c).isVisible()) {
    FeedbackPanel.this.btnRight.doClick();
  }
}
Program: 159929
Project: 159929
Buggy source:
/** 
 * Close game window by pressing OK button after 5 seconds
 */
private void endWithTimeout(){
  Runnable task=new Runnable(){
    public void run(){
      logger.info("String_Node_Str");
      FeedbackPanel.this.btnRight.doClick();
    }
  }
;
  worker.schedule(task,8,TimeUnit.SECONDS);
}

Fixed version (ground truth):
/** 
 * Close game window by pressing OK button after 8 seconds
 */
private void endWithTimeout(){
  Runnable task=new Runnable(){
    @Override public void run(){
      logger.info("String_Node_Str");
      Component c=MageFrame.getGame(gameId);
      while (c != null && !(c instanceof GamePane)) {
        c=c.getParent();
      }
      if (c != null && ((GamePane)c).isVisible()) {
        FeedbackPanel.this.btnRight.doClick();
      }
    }
  }
;
  worker.schedule(task,8,TimeUnit.SECONDS);
}
Program: 159930
Project: 159930
Buggy source:
public void actionPerformed(java.awt.event.ActionEvent evt){
  btnSpecialActionPerformed(evt);
}

Fixed version (ground truth):
@Override public void actionPerformed(java.awt.event.ActionEvent evt){
  btnSpecialActionPerformed(evt);
}
Program: 159931
Project: 159931
Buggy source:
@Override public ArmoredTransport copy(){
  return new ArmoredTransport(this);
}

Fixed version (ground truth):
@Override public ArmoredTransportPreventCombatDamageSourceEffect copy(){
  return new ArmoredTransportPreventCombatDamageSourceEffect(this);
}
Program: 159932
Project: 159932
Buggy source:
@Override public int calculate(Game game,Ability sourceAbility){
  Player player=game.getPlayer(sourceAbility.getControllerId());
  if (player != null) {
    return player.getGraveyard().count(filter,game);
  }
  return 0;
}

Fixed version (ground truth):
@Override public int calculate(Game game,Ability sourceAbility){
  Permanent attachment=game.getPermanent(sourceAbility.getSourceId());
  if (attachment != null) {
    Permanent creature=game.getPermanent(attachment.getAttachedTo());
    if (creature != null) {
      Player player=game.getPlayer(creature.getControllerId());
      if (player != null) {
        return player.getGraveyard().count(filter,game);
      }
    }
  }
  return 0;
}
Program: 159933
Project: 159933
Buggy source:
public void checkBlockRestrictions(Game game,int blockersCount){
  if (attackers.isEmpty()) {
    return;
  }
  if (blockersCount == 1) {
    List<UUID> toBeRemoved=new ArrayList<UUID>();
    for (    UUID blockerId : getBlockers()) {
      Permanent blocker=game.getPermanent(blockerId);
      if (blocker != null && blocker.getAbilities().containsKey(CantBlockAloneAbility.getInstance().getId())) {
        game.informPlayers(blocker.getName() + "String_Node_Str");
        toBeRemoved.add(blockerId);
      }
    }
    for (    UUID blockerId : toBeRemoved) {
      remove(blockerId);
    }
    if (blockers.size() == 0) {
      this.blocked=false;
    }
  }
  for (  UUID uuid : attackers) {
    Permanent attacker=game.getPermanent(uuid);
    if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && blockers.size() > 0 && blockers.size() < attacker.getMinBlockedBy()) {
      for (      UUID blockerId : blockers) {
        Permanent blocker=game.getPermanent(blockerId);
        if (blocker != null) {
          blocker.setBlocking(blocker.getBlocking() - 1);
        }
      }
      blockers.clear();
      blockerOrder.clear();
      this.blocked=false;
      game.informPlayers(attacker.getName() + "String_Node_Str" + attacker.getMinBlockedBy()+ "String_Node_Str");
      return;
    }
  }
}

Fixed version (ground truth):
public void checkBlockRestrictions(Game game,int blockersCount){
  if (attackers.isEmpty()) {
    return;
  }
  if (blockersCount == 1) {
    List<UUID> toBeRemoved=new ArrayList<UUID>();
    for (    UUID blockerId : getBlockers()) {
      Permanent blocker=game.getPermanent(blockerId);
      if (blocker != null && blocker.getAbilities().containsKey(CantBlockAloneAbility.getInstance().getId())) {
        game.informPlayers(blocker.getName() + "String_Node_Str");
        toBeRemoved.add(blockerId);
      }
    }
    for (    UUID blockerId : toBeRemoved) {
      remove(blockerId);
      Permanent creature=game.getPermanent(blockerId);
      if (creature != null) {
        creature.setBlocking(creature.getBlocking() - 1);
      }
    }
    if (blockers.isEmpty()) {
      this.blocked=false;
    }
  }
  for (  UUID uuid : attackers) {
    Permanent attacker=game.getPermanent(uuid);
    if (attacker != null && this.blocked && attacker.getMinBlockedBy() > 1 && blockers.size() > 0 && blockers.size() < attacker.getMinBlockedBy()) {
      for (      UUID blockerId : blockers) {
        Permanent blocker=game.getPermanent(blockerId);
        if (blocker != null) {
          blocker.setBlocking(blocker.getBlocking() - 1);
        }
      }
      blockers.clear();
      blockerOrder.clear();
      this.blocked=false;
      game.informPlayers(attacker.getName() + "String_Node_Str" + attacker.getMinBlockedBy()+ "String_Node_Str");
      return;
    }
  }
}
Program: 159934
Project: 159934
Buggy source:
public boolean canBlock(Permanent blocker,Game game){
  for (  UUID attackerId : attackers) {
    if (!blocker.canBlock(attackerId,game))     return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean canBlock(Permanent blocker,Game game){
  for (  UUID attackerId : attackers) {
    if (!blocker.canBlock(attackerId,game)) {
      return false;
    }
  }
  return true;
}
Program: 159935
Project: 159935
Buggy source:
public void pickBlockerOrder(UUID playerId,Game game){
  if (blockers.isEmpty())   return;
  Player player=game.getPlayer(playerId);
  List<UUID> blockerList=new ArrayList<UUID>(blockers);
  blockerOrder.clear();
  while (true) {
    if (blockerList.size() == 1) {
      blockerOrder.add(blockerList.get(0));
      break;
    }
 else {
      List<Permanent> blockerPerms=new ArrayList<Permanent>();
      for (      UUID blockerId : blockerList) {
        blockerPerms.add(game.getPermanent(blockerId));
      }
      UUID blockerId=player.chooseBlockerOrder(blockerPerms,game);
      blockerOrder.add(blockerId);
      blockerList.remove(blockerId);
    }
  }
}

Fixed version (ground truth):
public void pickBlockerOrder(UUID playerId,Game game){
  if (blockers.isEmpty()) {
    return;
  }
  Player player=game.getPlayer(playerId);
  List<UUID> blockerList=new ArrayList<UUID>(blockers);
  blockerOrder.clear();
  while (true) {
    if (blockerList.size() == 1) {
      blockerOrder.add(blockerList.get(0));
      break;
    }
 else {
      List<Permanent> blockerPerms=new ArrayList<Permanent>();
      for (      UUID blockerId : blockerList) {
        blockerPerms.add(game.getPermanent(blockerId));
      }
      UUID blockerId=player.chooseBlockerOrder(blockerPerms,game);
      blockerOrder.add(blockerId);
      blockerList.remove(blockerId);
    }
  }
}
Program: 159936
Project: 159936
Buggy source:
public void remove(UUID creatureId){
  if (attackers.contains(creatureId)) {
    attackers.remove(creatureId);
  }
  if (blockers.contains(creatureId)) {
    blockers.remove(creatureId);
    if (blockerOrder.contains(creatureId))     blockerOrder.remove(creatureId);
  }
}

Fixed version (ground truth):
public void remove(UUID creatureId){
  if (attackers.contains(creatureId)) {
    attackers.remove(creatureId);
  }
  if (blockers.contains(creatureId)) {
    blockers.remove(creatureId);
    if (blockerOrder.contains(creatureId)) {
      blockerOrder.remove(creatureId);
    }
  }
}
Program: 159938
Project: 159938
Buggy source:
private void singleBlockerDamage(boolean first,Game game){
  Permanent blocker=game.getPermanent(blockers.get(0));
  Permanent attacker=game.getPermanent(attackers.get(0));
  if (blocker != null && attacker != null) {
    if (blocked && canDamage(attacker,first)) {
      int damage=attacker.getPower().getValue();
      if (hasTrample(attacker)) {
        int lethalDamage=blocker.getToughness().getValue() - blocker.getDamage();
        if (lethalDamage >= damage) {
          blocker.markDamage(damage,attacker.getId(),game,true,true);
        }
 else {
          Player player=game.getPlayer(attacker.getControllerId());
          int damageAssigned=player.getAmount(lethalDamage,damage,"String_Node_Str" + blocker.getName(),game);
          blocker.markDamage(damageAssigned,attacker.getId(),game,true,true);
          damage-=damageAssigned;
          if (damage > 0)           defenderDamage(attacker,damage,game);
        }
      }
 else {
        blocker.markDamage(damage,attacker.getId(),game,true,true);
      }
    }
    if (canDamage(blocker,first)) {
      if (blocker.getBlocking() == 1) {
        int blockerDamage=blocker.getPower().getValue();
        attacker.markDamage(blockerDamage,blocker.getId(),game,true,true);
      }
    }
  }
}

Fixed version (ground truth):
private void singleBlockerDamage(boolean first,Game game){
  Permanent blocker=game.getPermanent(blockers.get(0));
  Permanent attacker=game.getPermanent(attackers.get(0));
  if (blocker != null && attacker != null) {
    if (blocked && canDamage(attacker,first)) {
      int damage=attacker.getPower().getValue();
      if (hasTrample(attacker)) {
        int lethalDamage=blocker.getToughness().getValue() - blocker.getDamage();
        if (lethalDamage >= damage) {
          blocker.markDamage(damage,attacker.getId(),game,true,true);
        }
 else {
          Player player=game.getPlayer(attacker.getControllerId());
          int damageAssigned=player.getAmount(lethalDamage,damage,"String_Node_Str" + blocker.getName(),game);
          blocker.markDamage(damageAssigned,attacker.getId(),game,true,true);
          damage-=damageAssigned;
          if (damage > 0) {
            defenderDamage(attacker,damage,game);
          }
        }
      }
 else {
        blocker.markDamage(damage,attacker.getId(),game,true,true);
      }
    }
    if (canDamage(blocker,first)) {
      if (blocker.getBlocking() == 1) {
        int blockerDamage=blocker.getPower().getValue();
        attacker.markDamage(blockerDamage,blocker.getId(),game,true,true);
      }
    }
  }
}
Program: 159939
Project: 159939
Buggy source:
public void pickAttackerOrder(UUID playerId,Game game){
  if (attackers.isEmpty())   return;
  Player player=game.getPlayer(playerId);
  List<UUID> attackerList=new ArrayList<UUID>(attackers);
  attackerOrder.clear();
  while (true) {
    if (attackerList.size() == 1) {
      attackerOrder.add(attackerList.get(0));
      break;
    }
 else {
      List<Permanent> attackerPerms=new ArrayList<Permanent>();
      for (      UUID attackerId : attackerList) {
        attackerPerms.add(game.getPermanent(attackerId));
      }
      UUID attackerId=player.chooseAttackerOrder(attackerPerms,game);
      attackerOrder.add(attackerId);
      attackerList.remove(attackerId);
    }
  }
}

Fixed version (ground truth):
public void pickAttackerOrder(UUID playerId,Game game){
  if (attackers.isEmpty()) {
    return;
  }
  Player player=game.getPlayer(playerId);
  List<UUID> attackerList=new ArrayList<UUID>(attackers);
  attackerOrder.clear();
  while (true) {
    if (attackerList.size() == 1) {
      attackerOrder.add(attackerList.get(0));
      break;
    }
 else {
      List<Permanent> attackerPerms=new ArrayList<Permanent>();
      for (      UUID attackerId : attackerList) {
        attackerPerms.add(game.getPermanent(attackerId));
      }
      UUID attackerId=player.chooseAttackerOrder(attackerPerms,game);
      attackerOrder.add(attackerId);
      attackerList.remove(attackerId);
    }
  }
}
Program: 159940
Project: 159940
Buggy source:
/** 
 * Damages attacking creatures by a creature that blocked several ones Damages only attackers as blocker was damage in either   {@link #singleBlockerDamage} or {@link #multiBlockerDamage}. Handles abilities like "{this} an block any number of creatures.".
 * @param first
 * @param game
 */
private void multiAttackerDamage(boolean first,Game game){
  Permanent blocker=game.getPermanent(blockers.get(0));
  if (blocker == null) {
    return;
  }
  Player player=game.getPlayer(blocker.getControllerId());
  int damage=blocker.getPower().getValue();
  if (canDamage(blocker,first)) {
    Map<UUID,Integer> assigned=new HashMap<UUID,Integer>();
    for (    UUID attackerId : attackerOrder) {
      Permanent attacker=game.getPermanent(attackerId);
      int lethalDamage;
      if (blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId()))       lethalDamage=1;
 else       lethalDamage=attacker.getToughness().getValue() - attacker.getDamage();
      if (lethalDamage >= damage) {
        assigned.put(attackerId,damage);
        break;
      }
      int damageAssigned=player.getAmount(lethalDamage,damage,"String_Node_Str" + attacker.getName(),game);
      assigned.put(attackerId,damageAssigned);
      damage-=damageAssigned;
    }
    for (    Map.Entry<UUID,Integer> entry : assigned.entrySet()) {
      Permanent attacker=game.getPermanent(entry.getKey());
      attacker.markDamage(entry.getValue(),blocker.getId(),game,true,true);
    }
  }
}

Fixed version (ground truth):
/** 
 * Damages attacking creatures by a creature that blocked several ones Damages only attackers as blocker was damage in either   {@link #singleBlockerDamage} or {@link #multiBlockerDamage}. Handles abilities like "{this} an block any number of creatures.".
 * @param first
 * @param game
 */
private void multiAttackerDamage(boolean first,Game game){
  Permanent blocker=game.getPermanent(blockers.get(0));
  if (blocker == null) {
    return;
  }
  Player player=game.getPlayer(blocker.getControllerId());
  int damage=blocker.getPower().getValue();
  if (canDamage(blocker,first)) {
    Map<UUID,Integer> assigned=new HashMap<UUID,Integer>();
    for (    UUID attackerId : attackerOrder) {
      Permanent attacker=game.getPermanent(attackerId);
      int lethalDamage;
      if (blocker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
        lethalDamage=1;
      }
 else {
        lethalDamage=attacker.getToughness().getValue() - attacker.getDamage();
      }
      if (lethalDamage >= damage) {
        assigned.put(attackerId,damage);
        break;
      }
      int damageAssigned=player.getAmount(lethalDamage,damage,"String_Node_Str" + attacker.getName(),game);
      assigned.put(attackerId,damageAssigned);
      damage-=damageAssigned;
    }
    for (    Map.Entry<UUID,Integer> entry : assigned.entrySet()) {
      Permanent attacker=game.getPermanent(entry.getKey());
      attacker.markDamage(entry.getValue(),blocker.getId(),game,true,true);
    }
  }
}
Program: 159941
Project: 159941
Buggy source:
private void unblockedDamage(boolean first,Game game){
  for (  UUID attackerId : attackers) {
    Permanent attacker=game.getPermanent(attackerId);
    if (canDamage(attacker,first)) {
      if (!blocked || hasTrample(attacker))       defenderDamage(attacker,attacker.getPower().getValue(),game);
    }
  }
}

Fixed version (ground truth):
private void unblockedDamage(boolean first,Game game){
  for (  UUID attackerId : attackers) {
    Permanent attacker=game.getPermanent(attackerId);
    if (canDamage(attacker,first)) {
      if (!blocked || hasTrample(attacker)) {
        defenderDamage(attacker,attacker.getPower().getValue(),game);
      }
    }
  }
}
Program: 159942
Project: 159942
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (super.applies(event,source,game)) {
    DamageEvent damageEvent=(DamageEvent)event;
    if (event.getTargetId().equals(source.getSourceId()) && damageEvent.isCombatDamage()) {
      if (game.getState().getCombat().getAttackers().contains(source.getSourceId())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (super.applies(event,source,game)) {
    DamageEvent damageEvent=(DamageEvent)event;
    if (event.getTargetId().equals(source.getSourceId()) && damageEvent.isCombatDamage()) {
      Permanent sourcePermanent=game.getPermanent(source.getSourceId());
      if (sourcePermanent != null && sourcePermanent.isAttacking()) {
        return true;
      }
    }
  }
  return false;
}
Program: 159943
Project: 159943
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    player.drawCards(1,game);
    Target target=new TargetCardInHand(new FilterCard("String_Node_Str"));
    target.setRequired(true);
    if (player.chooseTarget(outcome,target,source,game)) {
      Card card=game.getCard(target.getFirstTarget());
      Card sourceCard=game.getCard(source.getSourceId());
      if (card != null && sourceCard != null) {
        card.setFaceDown(true);
        UUID exileId=UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
        return card.moveToExile(exileId,new StringBuilder(sourceCard.getName()).append("String_Node_Str").append(sourceCard.getZoneChangeCounter()).append("String_Node_Str").toString(),source.getSourceId(),game);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    player.drawCards(1,game);
    Target target=new TargetCardInHand(new FilterCard("String_Node_Str"));
    target.setRequired(true);
    if (player.chooseTarget(outcome,target,source,game)) {
      Card card=game.getCard(target.getFirstTarget());
      Card sourceCard=game.getCard(source.getSourceId());
      if (card != null && sourceCard != null) {
        card.setFaceDown(true);
        UUID exileId=(UUID)game.getState().getValue(new StringBuilder("String_Node_Str").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
        if (exileId == null) {
          exileId=UUID.randomUUID();
          game.getState().setValue(new StringBuilder("String_Node_Str").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString(),exileId);
        }
        return card.moveToExile(exileId,new StringBuilder(sourceCard.getName()).append("String_Node_Str").append(sourceCard.getZoneChangeCounter()).append("String_Node_Str").toString(),source.getSourceId(),game);
      }
    }
  }
  return false;
}
Program: 159944
Project: 159944
Buggy source:
@Override public boolean canTarget(UUID id,Ability source,Game game){
  Card card=game.getCard(id);
  if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
    ExileZone exile=null;
    Card sourceCard=game.getCard(source.getSourceId());
    if (sourceCard != null) {
      UUID exileId=UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
      exile=game.getExile().getExileZone(exileId);
    }
    if (exile != null && exile.contains(id)) {
      return filter.match(card,source.getControllerId(),game);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canTarget(UUID id,Ability source,Game game){
  Card card=game.getCard(id);
  if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
    ExileZone exile=null;
    Card sourceCard=game.getCard(source.getSourceId());
    if (sourceCard != null) {
      UUID exileId=(UUID)game.getState().getValue(new StringBuilder("String_Node_Str").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
      exile=game.getExile().getExileZone(exileId);
    }
    if (exile != null && exile.contains(id)) {
      return filter.match(card,source.getControllerId(),game);
    }
  }
  return false;
}
Program: 159945
Project: 159945
Buggy source:
@Override public Set<UUID> possibleTargets(UUID sourceId,UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<UUID>();
  Card sourceCard=game.getCard(sourceId);
  if (sourceCard != null) {
    UUID exileId=UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
    ExileZone exile=game.getExile().getExileZone(exileId);
    if (exile != null && exile.size() > 0) {
      possibleTargets.addAll(exile);
    }
  }
  return possibleTargets;
}

Fixed version (ground truth):
@Override public Set<UUID> possibleTargets(UUID sourceId,UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<UUID>();
  Card sourceCard=game.getCard(sourceId);
  if (sourceCard != null) {
    UUID exileId=(UUID)game.getState().getValue(new StringBuilder("String_Node_Str").append(sourceId).append(sourceCard.getZoneChangeCounter()).toString());
    ExileZone exile=game.getExile().getExileZone(exileId);
    if (exile != null && exile.size() > 0) {
      possibleTargets.addAll(exile);
    }
  }
  return possibleTargets;
}
Program: 159946
Project: 159946
Buggy source:
@Override public boolean canChoose(UUID sourceId,UUID sourceControllerId,Game game){
  Card sourceCard=game.getCard(sourceId);
  if (sourceCard != null) {
    UUID exileId=UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
    ExileZone exile=game.getExile().getExileZone(exileId);
    if (exile != null && exile.size() > 0) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canChoose(UUID sourceId,UUID sourceControllerId,Game game){
  Card sourceCard=game.getCard(sourceId);
  if (sourceCard != null) {
    UUID exileId=(UUID)game.getState().getValue(new StringBuilder("String_Node_Str").append(sourceId).append(sourceCard.getZoneChangeCounter()).toString());
    ExileZone exile=game.getExile().getExileZone(exileId);
    if (exile != null && exile.size() > 0) {
      return true;
    }
  }
  return false;
}
Program: 159947
Project: 159947
Buggy source:
@Override public boolean applies(UUID sourceId,Ability source,Game game){
  Card card=game.getCard(sourceId);
  if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
    Card sourceCard=game.getCard(source.getSourceId());
    UUID exileId=UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
    ExileZone zone=game.getExile().getExileZone(exileId);
    if (zone != null && zone.contains(card.getId())) {
      if (card.getCardType().contains(CardType.INSTANT) || game.canPlaySorcery(source.getControllerId())) {
        card.setControllerId(source.getControllerId());
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(UUID sourceId,Ability source,Game game){
  Card card=game.getCard(sourceId);
  if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
    Card sourceCard=game.getCard(source.getSourceId());
    UUID exileId=(UUID)game.getState().getValue(new StringBuilder("String_Node_Str").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
    ExileZone zone=game.getExile().getExileZone(exileId);
    if (zone != null && zone.contains(card.getId())) {
      if (card.getCardType().contains(CardType.INSTANT) || game.canPlaySorcery(source.getControllerId())) {
        card.setControllerId(source.getControllerId());
        return true;
      }
    }
  }
  return false;
}
Program: 159949
Project: 159949
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (event.getType() == EventType.DRAW_STEP_PRE) {
    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){
  if (event.getType() == EventType.UPKEEP_STEP_PRE) {
    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;
}