nus-yam/ex-repair huggingface dataset:
Program: 158490
Project: 158490
Buggy source:
public static BufferedImage getRotatedResizedImage(BufferedImage image,int width,int height,double angle){
  int imageWidth=image.getWidth();
  int imageHeight=image.getHeight();
  if (angle == 0.0 && (width < 0 || imageWidth == width) && (height < 0 || imageHeight == height))   return image;
  int resWidth;
  int resHeight;
  if (width < 0 && height < 0) {
    resWidth=imageWidth;
    resHeight=imageHeight;
  }
 else   if ((height < 0) || (width >= 0 && imageHeight * width <= imageWidth * height)) {
    resWidth=width;
    resHeight=imageHeight * width / imageWidth;
  }
 else {
    resWidth=imageWidth * height / imageHeight;
    resHeight=height;
  }
  if (angle == 0.0 && imageWidth == resWidth && imageHeight == resHeight)   return image;
  return IMAGE_CACHE.get(new Key(resWidth,resHeight,angle)).get(image);
}

Fixed version (ground truth):
public static BufferedImage getRotatedResizedImage(BufferedImage image,int width,int height,double angle){
  int imageWidth=image.getWidth();
  int imageHeight=image.getHeight();
  if (angle == 0.0 && (width < 0 || imageWidth == width) && (height < 0 || imageHeight == height)) {
    return image;
  }
  int resWidth;
  int resHeight;
  if (width < 0 && height < 0) {
    resWidth=imageWidth;
    resHeight=imageHeight;
  }
 else   if ((height < 0) || (width >= 0 && imageHeight * width <= imageWidth * height)) {
    resWidth=width;
    resHeight=imageHeight * width / imageWidth;
  }
 else {
    resWidth=imageWidth * height / imageHeight;
    resHeight=height;
  }
  if (angle == 0.0 && imageWidth == resWidth && imageHeight == resHeight) {
    return image;
  }
  if (resWidth < 3) {
    resWidth=3;
  }
  if (resHeight < 3) {
    resHeight=3;
  }
  return IMAGE_CACHE.get(new Key(resWidth,resHeight,angle)).get(image);
}
Program: 158491
Project: 158491
Buggy source:
@Override public void restoreState(int bookmark,String context){
  if (!simulation && !this.hasEnded()) {
    if (bookmark != 0) {
      if (!savedStates.contains(bookmark - 1)) {
        throw new UnsupportedOperationException("String_Node_Str" + (bookmark - 1) + "String_Node_Str"+ context);
      }
      int stateNum=savedStates.get(bookmark - 1);
      removeBookmark(bookmark);
      GameState restore=gameStates.rollback(stateNum);
      if (restore != null) {
        state.restore(restore);
        playerList.setCurrent(state.getActivePlayerId());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void restoreState(int bookmark,String context){
  if (!simulation && !this.hasEnded()) {
    if (bookmark != 0) {
      if (!savedStates.contains(bookmark - 1)) {
        throw new UnsupportedOperationException("String_Node_Str" + (bookmark - 1) + "String_Node_Str"+ context);
      }
      int stateNum=savedStates.get(bookmark - 1);
      removeBookmark(bookmark);
      GameState restore=gameStates.rollback(stateNum);
      if (restore != null) {
        state.restore(restore);
        playerList.setCurrent(state.getPlayerList().get());
      }
    }
  }
}
Program: 158492
Project: 158492
Buggy source:
@Override public void saveState(boolean bookmark){
  if (!simulation && gameStates != null) {
    if (bookmark || saveGame) {
      gameStates.save(state);
    }
  }
}

Fixed version (ground truth):
@Override public void saveState(boolean bookmark){
  if (!simulation && gameStates != null) {
    if (bookmark || saveGame) {
      state.getPlayerList().setCurrent(playerList.get());
      gameStates.save(state);
    }
  }
}
Program: 158493
Project: 158493
Buggy source:
@Override public synchronized void rollbackTurns(int turnsToRollback){
  if (gameOptions.rollbackTurnsAllowed) {
    int turnToGoTo=getTurnNum() - turnsToRollback;
    if (turnToGoTo < 1 || !gameStatesRollBack.containsKey(turnToGoTo)) {
      informPlayers(GameLog.getPlayerRequestColoredText("String_Node_Str" + turnsToRollback + "String_Node_Str"));
    }
 else {
      GameState restore=gameStatesRollBack.get(turnToGoTo);
      if (restore != null) {
        informPlayers(GameLog.getPlayerRequestColoredText("String_Node_Str" + restore.getTurnNum()));
        state.restoreForRollBack(restore);
        playerList.setCurrent(state.getActivePlayerId());
        gameStatesRollBack.put(getTurnNum(),state.copy());
        executingRollback=true;
        for (        Player playerObject : getPlayers().values()) {
          if (playerObject.isHuman() && playerObject.isInGame()) {
            playerObject.abort();
            playerObject.resetPlayerPassedActions();
          }
        }
        fireUpdatePlayersEvent();
      }
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void rollbackTurns(int turnsToRollback){
  if (gameOptions.rollbackTurnsAllowed) {
    int turnToGoTo=getTurnNum() - turnsToRollback;
    if (turnToGoTo < 1 || !gameStatesRollBack.containsKey(turnToGoTo)) {
      informPlayers(GameLog.getPlayerRequestColoredText("String_Node_Str" + turnsToRollback + "String_Node_Str"));
    }
 else {
      GameState restore=gameStatesRollBack.get(turnToGoTo);
      if (restore != null) {
        informPlayers(GameLog.getPlayerRequestColoredText("String_Node_Str" + restore.getTurnNum()));
        state.restoreForRollBack(restore);
        playerList.setCurrent(state.getPlayerList().get());
        gameStatesRollBack.put(getTurnNum(),state.copy());
        executingRollback=true;
        for (        Player playerObject : getPlayers().values()) {
          if (playerObject.isHuman() && playerObject.isInGame()) {
            playerObject.abort();
            playerObject.resetPlayerPassedActions();
          }
        }
        fireUpdatePlayersEvent();
      }
    }
  }
}
Program: 158494
Project: 158494
Buggy source:
public void restore(GameState state){
  this.activePlayerId=state.activePlayerId;
  this.playerList.setCurrent(state.activePlayerId);
  this.priorityPlayerId=state.priorityPlayerId;
  this.stack=state.stack;
  this.command=state.command;
  this.exile=state.exile;
  this.battlefield=state.battlefield;
  this.turnNum=state.turnNum;
  this.stepNum=state.stepNum;
  this.extraTurn=state.extraTurn;
  this.legendaryRuleActive=state.legendaryRuleActive;
  this.effects=state.effects;
  this.triggered=state.triggered;
  this.triggers=state.triggers;
  this.delayed=state.delayed;
  this.specialActions=state.specialActions;
  this.combat=state.combat;
  this.turnMods=state.turnMods;
  this.watchers=state.watchers;
  this.values=state.values;
  for (  Player copyPlayer : state.players.values()) {
    Player origPlayer=players.get(copyPlayer.getId());
    origPlayer.restore(copyPlayer);
  }
  this.zones=state.zones;
  this.simultaneousEvents=state.simultaneousEvents;
  this.cardState=state.cardState;
  this.cardAttribute=state.cardAttribute;
  this.zoneChangeCounter=state.zoneChangeCounter;
  this.copiedCards=state.copiedCards;
  this.permanentOrderNumber=state.permanentOrderNumber;
}

Fixed version (ground truth):
public void restore(GameState state){
  this.activePlayerId=state.activePlayerId;
  this.playerList.setCurrent(state.playerList.get());
  this.priorityPlayerId=state.priorityPlayerId;
  this.stack=state.stack;
  this.command=state.command;
  this.exile=state.exile;
  this.battlefield=state.battlefield;
  this.turnNum=state.turnNum;
  this.stepNum=state.stepNum;
  this.extraTurn=state.extraTurn;
  this.legendaryRuleActive=state.legendaryRuleActive;
  this.effects=state.effects;
  this.triggered=state.triggered;
  this.triggers=state.triggers;
  this.delayed=state.delayed;
  this.specialActions=state.specialActions;
  this.combat=state.combat;
  this.turnMods=state.turnMods;
  this.watchers=state.watchers;
  this.values=state.values;
  for (  Player copyPlayer : state.players.values()) {
    Player origPlayer=players.get(copyPlayer.getId());
    origPlayer.restore(copyPlayer);
  }
  this.zones=state.zones;
  this.simultaneousEvents=state.simultaneousEvents;
  this.cardState=state.cardState;
  this.cardAttribute=state.cardAttribute;
  this.zoneChangeCounter=state.zoneChangeCounter;
  this.copiedCards=state.copiedCards;
  this.permanentOrderNumber=state.permanentOrderNumber;
}
Program: 158495
Project: 158495
Buggy source:
public static void transformCard(final CardPanel panel,final MagePermanent parent,final boolean transformed){
  new Animation(1200){
    private boolean state=false;
    @Override protected void start(){
      parent.onBeginAnimation();
    }
    @Override protected void update(    float percentage){
      double p=percentage * 2;
      if (percentage > 0.5) {
        if (!state) {
          parent.toggleTransformed();
        }
        state=true;
        p=(p - 0.5) * 2;
      }
      if (!state) {
        panel.transformAngle=Math.max(0.01,1 - p);
      }
 else {
        panel.transformAngle=Math.max(0.01,p - 1);
      }
      panel.repaint();
    }
    @Override protected void end(){
      if (!state) {
        parent.toggleTransformed();
      }
      state=true;
      panel.transformAngle=0;
      parent.onEndAnimation();
      parent.repaint();
    }
  }
;
}

Fixed version (ground truth):
public static void transformCard(final CardPanel panel,final MagePermanent parent,final boolean transformed){
  new Animation(1200){
    private boolean state=false;
    @Override protected void start(){
      parent.onBeginAnimation();
    }
    @Override protected void update(    float percentage){
      double p=percentage * 2;
      if (percentage > 0.5) {
        if (!state) {
          parent.toggleTransformed();
        }
        state=true;
        p=(p - 0.5) * 2;
      }
      if (!state) {
        panel.transformAngle=Math.max(0.01,1 - p);
      }
 else {
        panel.transformAngle=Math.max(0.01,p - 1);
      }
      panel.repaint();
    }
    @Override protected void end(){
      if (!state) {
        parent.toggleTransformed();
      }
      state=true;
      panel.transformAngle=1;
      parent.onEndAnimation();
      parent.repaint();
    }
  }
;
}
Program: 158497
Project: 158497
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player defender=null;
  if (attackerIsSource) {
    defender=game.getPlayer(game.getCombat().getDefenderId(source.getSourceId()));
  }
 else {
    defender=game.getPlayer(game.getCombat().getDefenderId(getTargetPointer().getFirst(game,source)));
  }
  if (defender != null) {
    defender.loseLife(amount.calculate(game,source,this),game);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player defender=null;
  if (attackerIsSource) {
    defender=game.getPlayer(game.getCombat().getDefenderId(source.getSourceId()));
  }
 else {
    defender=game.getPlayer(getTargetPointer().getFirst(game,source));
  }
  if (defender != null) {
    defender.loseLife(amount.calculate(game,source,this),game);
  }
  return true;
}
Program: 158498
Project: 158498
Buggy source:
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  CallerOfTheClawWatcher watcher=(CallerOfTheClawWatcher)game.getState().getWatchers().get("String_Node_Str",sourceAbility.getControllerId());
  if (watcher != null) {
    return watcher.getCreaturesCount();
  }
  return 0;
}

Fixed version (ground truth):
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  CallerOfTheClawWatcher watcher=(CallerOfTheClawWatcher)game.getState().getWatchers().get(CallerOfTheClawWatcher.class.getName(),sourceAbility.getControllerId());
  if (watcher != null) {
    return watcher.getCreaturesCount();
  }
  return 0;
}
Program: 158499
Project: 158499
Buggy source:
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  FreshMeatWatcher watcher=(FreshMeatWatcher)game.getState().getWatchers().get("String_Node_Str",sourceAbility.getControllerId());
  if (watcher != null) {
    return watcher.getCreaturesCount();
  }
  return 0;
}

Fixed version (ground truth):
@Override public int calculate(Game game,Ability sourceAbility,Effect effect){
  CreaturesDiedWatcher watcher=(CreaturesDiedWatcher)game.getState().getWatchers().get("String_Node_Str");
  if (watcher != null) {
    return watcher.getAmountOfCreaturesDiesThisTurn(sourceAbility.getControllerId());
  }
  return 0;
}
Program: 158500
Project: 158500
Buggy source:
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    if (zEvent.isDiesEvent() && zEvent.getTarget() != null && zEvent.getTarget().getCardType().contains(CardType.CREATURE)) {
      amountOfCreaturesThatDied++;
    }
  }
}

Fixed version (ground truth):
@Override public void watch(GameEvent event,Game game){
  if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
    ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
    if (zEvent.isDiesEvent() && zEvent.getTarget() != null && zEvent.getTarget().getCardType().contains(CardType.CREATURE)) {
      amountOfCreaturesThatDied++;
      int amount=0;
      if (amountOfCreaturesThatDiedByController.containsKey(zEvent.getTarget().getControllerId())) {
        amount=amountOfCreaturesThatDiedByController.get(zEvent.getTarget().getControllerId());
      }
      amountOfCreaturesThatDiedByController.put(zEvent.getTarget().getControllerId(),amount + 1);
    }
  }
}
Program: 158501
Project: 158501
Buggy source:
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher){
  super(watcher);
  this.amountOfCreaturesThatDied=watcher.amountOfCreaturesThatDied;
}

Fixed version (ground truth):
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher){
  super(watcher);
  this.amountOfCreaturesThatDied=watcher.amountOfCreaturesThatDied;
  this.amountOfCreaturesThatDiedByController.putAll(watcher.amountOfCreaturesThatDiedByController);
}
Program: 158502
Project: 158502
Buggy source:
@Override public void reset(){
  amountOfCreaturesThatDied=0;
}

Fixed version (ground truth):
@Override public void reset(){
  amountOfCreaturesThatDied=0;
  amountOfCreaturesThatDiedByController.clear();
}
Program: 158503
Project: 158503
Buggy source:
public int getAmountOfCreaturesDiesThisTurn(){
  return amountOfCreaturesThatDied;
}

Fixed version (ground truth):
public int getAmountOfCreaturesDiesThisTurn(UUID playerId){
  if (amountOfCreaturesThatDiedByController.containsKey(playerId)) {
    return amountOfCreaturesThatDiedByController.get(playerId);
  }
  return 0;
}
Program: 158504
Project: 158504
Buggy source:
@Override public void init(Ability source,Game game){
  landTypes.clear();
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Set<String> choiceSet=new LinkedHashSet<>();
    choiceSet.add("String_Node_Str");
    choiceSet.add("String_Node_Str");
    ChoiceImpl choice=new ChoiceImpl(true);
    choice.setChoices(choiceSet);
    choice.setMessage("String_Node_Str");
    controller.choose(outcome,choice,game);
    landTypes.add(choice.getChoice());
  }
 else {
    this.discard();
  }
  super.init(source,game);
}

Fixed version (ground truth):
@Override public void init(Ability source,Game game){
  landTypes.clear();
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Set<String> choiceSet=new LinkedHashSet<>();
    choiceSet.add("String_Node_Str");
    choiceSet.add("String_Node_Str");
    ChoiceImpl choice=new ChoiceImpl(true);
    choice.setChoices(choiceSet);
    choice.setMessage("String_Node_Str");
    while (!controller.choose(outcome,choice,game)) {
      if (!controller.canRespond()) {
        return;
      }
    }
    landTypes.add(choice.getChoice());
  }
 else {
    this.discard();
  }
  super.init(source,game);
}
Program: 158505
Project: 158505
Buggy source:
public TundraKavuEffect copy(){
  return new TundraKavuEffect(this);
}

Fixed version (ground truth):
@Override public TundraKavuEffect copy(){
  return new TundraKavuEffect(this);
}
Program: 158506
Project: 158506
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  if (controller != null && sourcePermanent != null) {
    Choice abilityChoice=new ChoiceImpl(true);
    Set<String> abilityChoices=new HashSet<>(3);
    abilityChoice.setMessage("String_Node_Str");
    abilityChoices.add("String_Node_Str");
    abilityChoices.add("String_Node_Str");
    abilityChoices.add("String_Node_Str");
    abilityChoice.setChoices(abilityChoices);
    Ability ability=null;
switch (abilityChoice.getChoice()) {
case "String_Node_Str":
      ability=FirstStrikeAbility.getInstance();
    break;
case "String_Node_Str":
  ability=VigilanceAbility.getInstance();
break;
case "String_Node_Str":
ability=LifelinkAbility.getInstance();
break;
default :
break;
}
if (ability != null) {
GainAbilityControlledEffect effect=new GainAbilityControlledEffect(ability,Duration.EndOfTurn,new FilterControlledCreaturePermanent());
game.addEffect(effect,source);
game.informPlayers(new StringBuilder(sourcePermanent.getName()).append("String_Node_Str").append(controller.getLogName()).append("String_Node_Str").append(abilityChoice.getChoice().toLowerCase()).toString());
return true;
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanent(source.getSourceId());
  if (controller != null && sourcePermanent != null) {
    Choice abilityChoice=new ChoiceImpl(true);
    Set<String> abilityChoices=new HashSet<>(3);
    abilityChoice.setMessage("String_Node_Str");
    abilityChoices.add("String_Node_Str");
    abilityChoices.add("String_Node_Str");
    abilityChoices.add("String_Node_Str");
    abilityChoice.setChoices(abilityChoices);
    while (!controller.choose(outcome,abilityChoice,game)) {
      if (!controller.canRespond()) {
        return false;
      }
    }
    Ability ability=null;
    if (abilityChoice.getChoice() != null) {
switch (abilityChoice.getChoice()) {
case "String_Node_Str":
        ability=FirstStrikeAbility.getInstance();
      break;
case "String_Node_Str":
    ability=VigilanceAbility.getInstance();
  break;
case "String_Node_Str":
ability=LifelinkAbility.getInstance();
break;
default :
break;
}
if (ability != null) {
GainAbilityControlledEffect effect=new GainAbilityControlledEffect(ability,Duration.EndOfTurn,new FilterControlledCreaturePermanent());
game.addEffect(effect,source);
game.informPlayers(sourcePermanent.getName() + "String_Node_Str" + controller.getLogName()+ "String_Node_Str"+ abilityChoice.getChoice().toLowerCase());
return true;
}
}
}
return false;
}
Program: 158507
Project: 158507
Buggy source:
@Override public boolean apply(Game game,Ability source){
  UUID targetId=null;
  if (source != null && source.getTargets() != null) {
    for (    Target target : source.getTargets()) {
      if (target.getFilter() != null && target.getFilter().getMessage().equals(filterMessage)) {
        targetId=target.getFirstTarget();
      }
    }
    if (targetId != null) {
      FixedTarget fixedTarget=new FixedTarget(targetId);
      ContinuousEffect continuousEffect=new BecomesCreatureTargetEffect(new AwakenElementalToken(),false,true,Duration.Custom);
      continuousEffect.setTargetPointer(fixedTarget);
      game.addEffect(continuousEffect,source);
      Effect effect=new AddCountersTargetEffect(CounterType.P1P1.createInstance(awakenValue));
      effect.setTargetPointer(fixedTarget);
      return effect.apply(game,source);
    }
  }
 else {
    if (source == null) {
      logger.fatal("String_Node_Str");
    }
 else     if (source.getTargets() == null) {
      MageObject sourceObj=source.getSourceObject(game);
      if (sourceObj != null) {
        Class<? extends MageObject> sourceClass=sourceObj.getClass();
        if (sourceClass != null) {
          logger.fatal("String_Node_Str" + sourceClass.toString() + "String_Node_Str");
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  UUID targetId=null;
  if (source != null && source.getTargets() != null) {
    for (    Target target : source.getTargets()) {
      if (target.getFilter() != null && target.getFilter().getMessage().equals(filterMessage)) {
        targetId=target.getFirstTarget();
      }
    }
    if (targetId != null) {
      FixedTarget fixedTarget=new FixedTarget(targetId);
      ContinuousEffect continuousEffect=new BecomesCreatureTargetEffect(new AwakenElementalToken(),false,true,Duration.Custom);
      continuousEffect.setTargetPointer(fixedTarget);
      game.addEffect(continuousEffect,source);
      Effect effect=new AddCountersTargetEffect(CounterType.P1P1.createInstance(awakenValue));
      effect.setTargetPointer(fixedTarget);
      return effect.apply(game,source);
    }
  }
 else   if (source == null) {
    logger.fatal("String_Node_Str");
  }
 else   if (source.getTargets() == null) {
    MageObject sourceObj=source.getSourceObject(game);
    if (sourceObj != null) {
      Class<? extends MageObject> sourceClass=sourceObj.getClass();
      if (sourceClass != null) {
        logger.fatal("String_Node_Str" + sourceClass.toString() + "String_Node_Str");
      }
    }
  }
  return true;
}
Program: 158508
Project: 158508
Buggy source:
public AwakenAbility(final AwakenAbility ability){
  super(ability);
  this.awakenValue=ability.awakenValue;
}

Fixed version (ground truth):
public AwakenAbility(final AwakenAbility ability){
  super(ability);
  this.awakenValue=ability.awakenValue;
  this.rule=ability.rule;
}
Program: 158509
Project: 158509
Buggy source:
@Override public LostAuramancers copy(){
  return new LostAuramancers(this);
}

Fixed version (ground truth):
@Override public DiesTriggeredAbility copy(){
  return new LostAuramancersAbility(this);
}
Program: 158510
Project: 158510
Buggy source:
protected void act(Game game){
  if (actions == null || actions.size() == 0) {
    pass(game);
  }
 else {
    boolean usedStack=false;
    while (actions.peek() != null) {
      Ability ability=actions.poll();
      logger.info(new StringBuilder("String_Node_Str").append(game.getPlayer(playerId).getName()).append("String_Node_Str").append(ability.toString()).toString());
      if (ability.getTargets().size() > 0) {
        for (        Target target : ability.getTargets()) {
          for (          UUID id : target.getTargets()) {
            target.updateTarget(id,game);
          }
        }
        Player player=game.getPlayer(ability.getFirstTarget());
        if (player != null) {
          logger.info("String_Node_Str" + player.getName());
        }
      }
      this.activateAbility((ActivatedAbility)ability,game);
      if (ability.isUsesStack()) {
        usedStack=true;
      }
      if (!suggested.isEmpty() && !(ability instanceof PassAbility)) {
        Iterator<String> it=suggested.iterator();
        while (it.hasNext()) {
          Card card=game.getCard(ability.getSourceId());
          String action=it.next();
          logger.info("String_Node_Str" + action + "String_Node_Str"+ card);
          if (action.equals(card.getName())) {
            logger.info("String_Node_Str" + action);
            it.remove();
          }
        }
      }
    }
    if (usedStack) {
      pass(game);
    }
  }
}

Fixed version (ground truth):
protected void act(Game game){
  if (actions == null || actions.isEmpty()) {
    pass(game);
  }
 else {
    boolean usedStack=false;
    while (actions.peek() != null) {
      Ability ability=actions.poll();
      logger.info(new StringBuilder("String_Node_Str").append(game.getPlayer(playerId).getName()).append("String_Node_Str").append(ability.toString()).toString());
      if (ability.getTargets().size() > 0) {
        for (        Target target : ability.getTargets()) {
          for (          UUID id : target.getTargets()) {
            target.updateTarget(id,game);
            if (!target.isNotTarget()) {
              game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.TARGETED,id,ability.getSourceId(),ability.getControllerId()));
            }
          }
        }
        Player player=game.getPlayer(ability.getFirstTarget());
        if (player != null) {
          logger.info("String_Node_Str" + player.getName());
        }
      }
      this.activateAbility((ActivatedAbility)ability,game);
      if (ability.isUsesStack()) {
        usedStack=true;
      }
      if (!suggested.isEmpty() && !(ability instanceof PassAbility)) {
        Iterator<String> it=suggested.iterator();
        while (it.hasNext()) {
          Card card=game.getCard(ability.getSourceId());
          String action=it.next();
          logger.info("String_Node_Str" + action + "String_Node_Str"+ card);
          if (action.equals(card.getName())) {
            logger.info("String_Node_Str" + action);
            it.remove();
          }
        }
      }
    }
    if (usedStack) {
      pass(game);
    }
  }
}
Program: 158511
Project: 158511
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  Permanent sourcePermanent=(Permanent)source.getSourceObjectIfItStillExists(game);
  if (sourcePermanent == null || !sourcePermanent.getControllerId().equals(source.getControllerId())) {
    discard();
    return false;
  }
switch (event.getType()) {
case ZONE_CHANGE:
    if (event.getTargetId().equals(source.getSourceId())) {
      ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
      if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
        discard();
        return false;
      }
    }
  break;
case UNTAP:
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getTargetId().equals(targetPointer.getFirst(game,source))) {
  Permanent targetCreature=game.getPermanent(targetPointer.getFirst(game,source));
  if (targetCreature != null) {
    return targetCreature.getControllerId().equals(game.getActivePlayerId());
  }
 else {
    discard();
    return false;
  }
}
break;
case LOST_CONTROL:
if (event.getTargetId().equals(source.getSourceId())) {
discard();
return false;
}
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  MageObject sourceObject=source.getSourceObjectIfItStillExists(game);
  if (!(sourceObject instanceof Permanent) || !((Permanent)sourceObject).getControllerId().equals(source.getControllerId())) {
    discard();
    return false;
  }
switch (event.getType()) {
case ZONE_CHANGE:
    if (event.getTargetId().equals(source.getSourceId())) {
      ZoneChangeEvent zEvent=(ZoneChangeEvent)event;
      if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
        discard();
        return false;
      }
    }
  break;
case UNTAP:
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getTargetId().equals(targetPointer.getFirst(game,source))) {
  Permanent targetCreature=game.getPermanent(targetPointer.getFirst(game,source));
  if (targetCreature != null) {
    return targetCreature.getControllerId().equals(game.getActivePlayerId());
  }
 else {
    discard();
    return false;
  }
}
break;
case LOST_CONTROL:
if (event.getTargetId().equals(source.getSourceId())) {
discard();
return false;
}
break;
}
return false;
}
Program: 158512
Project: 158512
Buggy source:
@Override public MageObject getSourceObjectIfItStillExists(Game game){
  MageObject currentObject=game.getObject(getSourceId());
  if (currentObject != null) {
    if (sourceObject == null) {
      setSourceObject(currentObject,game);
    }
    MageObjectReference mor=new MageObjectReference(currentObject,game);
    if (mor.getZoneChangeCounter() == getSourceObjectZoneChangeCounter()) {
      return sourceObject;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public MageObject getSourceObjectIfItStillExists(Game game){
  MageObject currentObject=game.getObject(getSourceId());
  if (currentObject != null) {
    if (sourceObject == null) {
      setSourceObject(currentObject,game);
    }
    MageObjectReference mor=new MageObjectReference(currentObject,game);
    if (mor.getZoneChangeCounter() == getSourceObjectZoneChangeCounter()) {
      return currentObject;
    }
  }
  return null;
}
Program: 158513
Project: 158513
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent attackingCreature=game.getPermanent(event.getTargetId());
  if (attackingCreature != null && attackingCreature.hasSubtype("String_Node_Str")) {
    for (    Effect effect : getEffects()) {
      effect.setTargetPointer(new FixedTarget(event.getTargetId()));
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent sourcePermanent=game.getPermanent(getSourceId());
  if (sourcePermanent.isAttacking()) {
    for (    CombatGroup combatGroup : game.getCombat().getGroups()) {
      if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
        return true;
      }
    }
  }
  return false;
}
Program: 158514
Project: 158514
Buggy source:
@Override public boolean checkEventType(GameEvent event,Game game){
  return event.getType().equals(EventType.UNBLOCKED_ATTACKER);
}

Fixed version (ground truth):
@Override public boolean checkEventType(GameEvent event,Game game){
  return event.getType().equals(EventType.DECLARED_BLOCKERS);
}
Program: 158515
Project: 158515
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player newOwner=null;
  int lowLife=Integer.MIN_VALUE;
  boolean tie=false;
  for (  UUID playerID : game.getPlayerList()) {
    Player player=game.getPlayer(playerID);
    if (player.getLife() > lowLife) {
      lowLife=player.getLife();
      newOwner=player;
      tie=false;
    }
 else     if (player.getLife() == lowLife) {
      tie=true;
    }
  }
  if (!tie) {
    game.getPermanent(source.getId()).changeControllerId(newOwner.getId(),game);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Permanent sourcePermanent=game.getPermanent(source.getSourceId());
    if (sourcePermanent != null) {
      Player newController=null;
      int lowLife=Integer.MIN_VALUE;
      boolean tie=false;
      for (      UUID playerID : game.getState().getPlayersInRange(source.getControllerId(),game)) {
        Player player=game.getPlayer(playerID);
        if (player != null) {
          if (player.getLife() > lowLife) {
            lowLife=player.getLife();
            newController=player;
            tie=false;
          }
 else           if (player.getLife() == lowLife) {
            tie=true;
          }
        }
      }
      if (!controller.equals(newController) && !tie && newController != null) {
        ContinuousEffect effect=new GainControlTargetEffect(Duration.Custom,newController.getId());
        effect.setTargetPointer(new FixedTarget(sourcePermanent,game));
        game.addEffect(effect,source);
      }
    }
    return true;
  }
  return false;
}
Program: 158516
Project: 158516
Buggy source:
/** 
 * Tron mana doesn't work with Oath of Nissa. (e.g. can't cast Chandra, Flamecaller with Urza's Tower, Power Plant, and Mine.)
 */
@Test public void testOathOfNissa(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",1);
}

Fixed version (ground truth):
/** 
 * Tron mana doesn't work with Oath of Nissa. (e.g. can't cast Chandra, Flamecaller with Urza's Tower, Power Plant, and Mine.) AI don't get the Planeswalker as playable card (probably because of the as thought effect)
 */
@Test public void testOathOfNissa(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",1);
}
Program: 158517
Project: 158517
Buggy source:
ManaCosts getCastSourceIdManaCosts();

Fixed version (ground truth):
ManaCosts<ManaCost> getCastSourceIdManaCosts();
Program: 158518
Project: 158518
Buggy source:
/** 
 * If the next spell cast has the set sourceId, the spell will be cast without mana (null) or the mana set to manaCosts instead of its normal mana costs.
 * @param sourceId the source that can be cast without mana
 * @param manaCosts alternate ManaCost, null if it can be cast without manacost
 * @param costs alternate other costs you need to pay
 */
void setCastSourceIdWithAlternateMana(UUID sourceId,ManaCosts<ManaCost> manaCosts,mage.abilities.costs.Costs costs);

Fixed version (ground truth):
/** 
 * If the next spell cast has the set sourceId, the spell will be cast without mana (null) or the mana set to manaCosts instead of its normal mana costs.
 * @param sourceId the source that can be cast without mana
 * @param manaCosts alternate ManaCost, null if it can be cast without manacost
 * @param costs alternate other costs you need to pay
 */
void setCastSourceIdWithAlternateMana(UUID sourceId,ManaCosts<ManaCost> manaCosts,Costs<Cost> costs);
Program: 158519
Project: 158519
Buggy source:
@Override public boolean putCardsOnBottomOfLibrary(Cards cards,Game game,Ability source,boolean anyOrder){
  if (cards.size() != 0) {
    if (!anyOrder) {
      for (      UUID objectId : cards) {
        moveObjectToLibrary(objectId,source == null ? null : source.getSourceId(),game,false,false);
      }
    }
 else {
      TargetCard target=new TargetCard(Zone.ALL,new FilterCard("String_Node_Str"));
      target.setRequired(true);
      while (isInGame() && cards.size() > 1) {
        this.choose(Outcome.Neutral,cards,target,game);
        UUID targetObjectId=target.getFirstTarget();
        cards.remove(targetObjectId);
        moveObjectToLibrary(targetObjectId,source == null ? null : source.getSourceId(),game,false,false);
        target.clearChosen();
      }
      if (cards.size() == 1) {
        moveObjectToLibrary(cards.iterator().next(),source == null ? null : source.getSourceId(),game,false,false);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean putCardsOnBottomOfLibrary(Cards cards,Game game,Ability source,boolean anyOrder){
  if (!cards.isEmpty()) {
    if (!anyOrder) {
      for (      UUID objectId : cards) {
        moveObjectToLibrary(objectId,source == null ? null : source.getSourceId(),game,false,false);
      }
    }
 else {
      TargetCard target=new TargetCard(Zone.ALL,new FilterCard("String_Node_Str"));
      target.setRequired(true);
      while (isInGame() && cards.size() > 1) {
        this.choose(Outcome.Neutral,cards,target,game);
        UUID targetObjectId=target.getFirstTarget();
        cards.remove(targetObjectId);
        moveObjectToLibrary(targetObjectId,source == null ? null : source.getSourceId(),game,false,false);
        target.clearChosen();
      }
      if (cards.size() == 1) {
        moveObjectToLibrary(cards.iterator().next(),source == null ? null : source.getSourceId(),game,false,false);
      }
    }
  }
  return true;
}
Program: 158520
Project: 158520
Buggy source:
@Override public void setCastSourceIdWithAlternateMana(UUID sourceId,ManaCosts manaCosts,mage.abilities.costs.Costs costs){
  castSourceIdWithAlternateMana=sourceId;
  castSourceIdManaCosts=manaCosts;
  castSourceIdCosts=costs;
}

Fixed version (ground truth):
@Override public void setCastSourceIdWithAlternateMana(UUID sourceId,ManaCosts<ManaCost> manaCosts,Costs<Cost> costs){
  castSourceIdWithAlternateMana=sourceId;
  castSourceIdManaCosts=manaCosts;
  castSourceIdCosts=costs;
}
Program: 158522
Project: 158522
Buggy source:
public void record(Table table){
  TableProto proto=table.toProto();
  TableRecordRepository.instance.add(new TableRecord(proto,proto.getEndTimeMs()));
  UserManager.getInstance().updateUserHistory();
}

Fixed version (ground truth):
@Override public void record(Table table){
  TableProto proto=table.toProto();
  TableRecordRepository.instance.add(new TableRecord(proto,proto.getEndTimeMs()));
  UserManager.getInstance().updateUserHistory();
}
Program: 158523
Project: 158523
Buggy source:
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  if (game.getStep().getType() == PhaseStep.UNTAP) {
    if (game.getTurnNum() != turn) {
      turn=game.getTurnNum();
      applies=false;
      Permanent storageMatrix=game.getPermanent(source.getSourceId());
      if (storageMatrix != null && !storageMatrix.isTapped()) {
        Choice choiceImpl=new ChoiceImpl(true);
        choiceImpl.setMessage("String_Node_Str");
        choiceImpl.setChoices(choice);
        Player player=game.getPlayer(game.getActivePlayerId());
        if (player != null) {
          while (!player.choose(outcome,choiceImpl,game)) {
            if (player.canRespond()) {
              return false;
            }
          }
          String choosenType=choiceImpl.getChoice();
          game.informPlayers(storageMatrix.getLogName() + "String_Node_Str" + player.getLogName()+ "String_Node_Str"+ choosenType);
          if (choosenType.equals(CardType.ARTIFACT.toString())) {
            type=CardType.ARTIFACT;
          }
 else           if (choosenType.equals(CardType.LAND.toString())) {
            type=CardType.LAND;
          }
 else {
            type=CardType.CREATURE;
          }
          applies=true;
        }
      }
    }
    if (applies) {
      return !permanent.getCardType().contains(type);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(Permanent permanent,Ability source,Game game){
  if (game.getStep().getType() == PhaseStep.UNTAP) {
    if (game.getTurnNum() != turn) {
      turn=game.getTurnNum();
      applies=false;
      Permanent storageMatrix=game.getPermanent(source.getSourceId());
      if (storageMatrix != null && !storageMatrix.isTapped()) {
        Choice choiceImpl=new ChoiceImpl(true);
        choiceImpl.setMessage("String_Node_Str");
        choiceImpl.setChoices(choice);
        Player player=game.getPlayer(game.getActivePlayerId());
        if (player != null) {
          while (!player.choose(outcome,choiceImpl,game)) {
            if (player.canRespond()) {
              return false;
            }
          }
          String choosenType=choiceImpl.getChoice();
          if (choosenType != null) {
            game.informPlayers(storageMatrix.getLogName() + "String_Node_Str" + player.getLogName()+ "String_Node_Str"+ choosenType);
            if (choosenType.equals(CardType.ARTIFACT.toString())) {
              type=CardType.ARTIFACT;
            }
 else             if (choosenType.equals(CardType.LAND.toString())) {
              type=CardType.LAND;
            }
 else {
              type=CardType.CREATURE;
            }
            applies=true;
          }
        }
      }
    }
    if (applies) {
      return !permanent.getCardType().contains(type);
    }
  }
  return false;
}
Program: 158526
Project: 158526
Buggy source:
@Override public boolean apply(Game game,Ability source){
  boolean conditionApplies=false;
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null && controller.getLibrary().size() > 0) {
switch (this.type) {
case CREATURE:
      conditionApplies|=controller.getLibrary().getFromTop(game).getCardType().contains(CardType.CREATURE);
    break;
case LAND:
  conditionApplies|=controller.getLibrary().getFromTop(game).getCardType().contains(CardType.LAND);
break;
case SORCERY:
conditionApplies|=controller.getLibrary().getFromTop(game).getCardType().contains(CardType.SORCERY);
break;
case INSTANT:
conditionApplies|=controller.getLibrary().getFromTop(game).getCardType().contains(CardType.INSTANT);
break;
}
}
return conditionApplies;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  boolean conditionApplies=false;
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null && controller.getLibrary().size() > 0) {
    Card card=controller.getLibrary().getFromTop(game);
    if (card != null) {
switch (this.type) {
case CREATURE:
        conditionApplies|=card.getCardType().contains(CardType.CREATURE);
      break;
case LAND:
    conditionApplies|=card.getCardType().contains(CardType.LAND);
  break;
case SORCERY:
conditionApplies|=card.getCardType().contains(CardType.SORCERY);
break;
case INSTANT:
conditionApplies|=card.getCardType().contains(CardType.INSTANT);
break;
}
}
}
return conditionApplies;
}
Program: 158527
Project: 158527
Buggy source:
@Override public Set<Card> getCards(Game game){
  Set<Card> cards=new LinkedHashSet<>();
  for (  UUID cardId : this) {
    Card card=game.getCard(cardId);
    if (card != null) {
      cards.add(card);
    }
  }
  return cards;
}

Fixed version (ground truth):
@Override public Set<Card> getCards(Game game){
  Set<Card> cards=new LinkedHashSet<>();
  for (Iterator<UUID> it=this.iterator(); it.hasNext(); ) {
    UUID cardId=it.next();
    Card card=game.getCard(cardId);
    if (card != null) {
      cards.add(card);
    }
  }
  return cards;
}
Program: 158528
Project: 158528
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=getDamageValueFromPermanent(blocker,game);
  if (canDamage(blocker,first)) {
    Map<UUID,Integer> assigned=new HashMap<>();
    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=getDamageValueFromPermanent(blocker,game);
  if (canDamage(blocker,first)) {
    Map<UUID,Integer> assigned=new HashMap<>();
    for (    UUID attackerId : attackerOrder) {
      Permanent attacker=game.getPermanent(attackerId);
      if (attacker != null) {
        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: 158530
Project: 158530
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent permanent=game.getPermanent(event.getTargetId());
  if (permanent != null && permanent.getControllerId().equals(this.controllerId) && (permanent.getSubtype().contains("String_Node_Str") || permanent.getSubtype().contains("String_Node_Str"))) {
    MageObject object=game.getObject(event.getSourceId());
    if (object != null && object instanceof Spell) {
      Card c=(Spell)object;
      if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
        if (getTargets().size() == 0) {
          for (          Effect effect : getEffects()) {
            effect.setTargetPointer(new FixedTarget(event.getTargetId()));
          }
        }
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  Permanent permanent=game.getPermanent(event.getTargetId());
  if (permanent != null && permanent.getControllerId().equals(this.controllerId) && (permanent.getSubtype().contains("String_Node_Str") || permanent.getSubtype().contains("String_Node_Str"))) {
    MageObject object=game.getObject(event.getSourceId());
    if (object != null && object instanceof Spell) {
      Card c=(Spell)object;
      if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
        if (getTargets().isEmpty()) {
          for (          Effect effect : getEffects()) {
            effect.setTargetPointer(new FixedTarget(event.getTargetId()));
          }
        }
        return true;
      }
    }
  }
  return false;
}
Program: 158533
Project: 158533
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    return game.getStack().counter(targetPointer.getFirst(game,source),source.getSourceId(),game,Zone.BATTLEFIELD,false,ZoneDetail.NONE);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Spell targetSpell=game.getStack().getSpell(targetPointer.getFirst(game,source));
    if (targetSpell != null) {
      Set<CardType> cardTypes=new HashSet<>(targetSpell.getCardType());
      if (!cardTypes.isEmpty()) {
        if (cardTypes.contains(CardType.ARTIFACT) || cardTypes.contains(CardType.CREATURE)) {
          return game.getStack().counter(targetSpell.getId(),source.getSourceId(),game,Zone.BATTLEFIELD,false,ZoneDetail.NONE);
        }
 else {
          return game.getStack().counter(targetSpell.getId(),source.getSourceId(),game);
        }
      }
    }
  }
  return false;
}
Program: 158534
Project: 158534
Buggy source:
@java.lang.Override public boolean checkEventType(GameEvent event,Game game){
  return event instanceof DamageEvent;
}

Fixed version (ground truth):
@java.lang.Override public boolean checkEventType(GameEvent event,Game game){
  return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}