Program: 159245
Project: 159245
Buggy source:
/** 
 * @param event
 * @param game
 * @return a list of all {@link ReplacementEffect} that apply to the current event
 */
private HashMap<ReplacementEffect,HashSet<Ability>> getApplicableReplacementEffects(GameEvent event,Game game){
  HashMap<ReplacementEffect,HashSet<Ability>> replaceEffects=new HashMap<>();
  if (planeswalkerRedirectionEffect.applies(event,null,game)) {
    replaceEffects.put(planeswalkerRedirectionEffect,null);
  }
  if (auraReplacementEffect.applies(event,null,game)) {
    replaceEffects.put(auraReplacementEffect,null);
  }
  for (  ReplacementEffect effect : replacementEffects) {
    if (event.getAppliedEffects() != null && event.getAppliedEffects().contains(effect.getId())) {
      continue;
    }
    HashSet<Ability> abilities=replacementEffects.getAbility(effect.getId());
    HashSet<Ability> applicableAbilities=new HashSet<>();
    for (    Ability ability : abilities) {
      if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,false)) {
        if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
          if (!game.getScopeRelevant() || effect.hasSelfScope() || !event.getTargetId().equals(ability.getSourceId())) {
            if (effect.applies(event,ability,game)) {
              applicableAbilities.add(ability);
            }
          }
        }
      }
    }
    if (!applicableAbilities.isEmpty()) {
      replaceEffects.put(effect,applicableAbilities);
    }
  }
  for (  PreventionEffect effect : preventionEffects) {
    HashSet<Ability> abilities=preventionEffects.getAbility(effect.getId());
    HashSet<Ability> applicableAbilities=new HashSet<>();
    for (    Ability ability : abilities) {
      if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,false)) {
        if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
          if (effect.applies(event,ability,game)) {
            applicableAbilities.add(ability);
          }
        }
      }
    }
    if (!applicableAbilities.isEmpty()) {
      replaceEffects.put((ReplacementEffect)effect,applicableAbilities);
    }
  }
  return replaceEffects;
}

Fixed version (ground truth):
/** 
 * @param event
 * @param game
 * @return a list of all {@link ReplacementEffect} that apply to the current event
 */
private HashMap<ReplacementEffect,HashSet<Ability>> getApplicableReplacementEffects(GameEvent event,Game game){
  HashMap<ReplacementEffect,HashSet<Ability>> replaceEffects=new HashMap<>();
  if (planeswalkerRedirectionEffect.applies(event,null,game)) {
    replaceEffects.put(planeswalkerRedirectionEffect,null);
  }
  if (auraReplacementEffect.applies(event,null,game)) {
    replaceEffects.put(auraReplacementEffect,null);
  }
  for (  ReplacementEffect effect : replacementEffects) {
    if (event.getAppliedEffects() != null && event.getAppliedEffects().contains(effect.getId())) {
      continue;
    }
    HashSet<Ability> abilities=replacementEffects.getAbility(effect.getId());
    HashSet<Ability> applicableAbilities=new HashSet<>();
    for (    Ability ability : abilities) {
      if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,false)) {
        if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
          if (!game.getScopeRelevant() || effect.hasSelfScope() || !event.getTargetId().equals(ability.getSourceId())) {
            if (effect.applies(event,ability,game)) {
              applicableAbilities.add(ability);
            }
          }
        }
      }
    }
    if (!applicableAbilities.isEmpty()) {
      replaceEffects.put(effect,applicableAbilities);
    }
  }
  for (  PreventionEffect effect : preventionEffects) {
    if (event.getAppliedEffects() != null && event.getAppliedEffects().contains(effect.getId())) {
      continue;
    }
    HashSet<Ability> abilities=preventionEffects.getAbility(effect.getId());
    HashSet<Ability> applicableAbilities=new HashSet<>();
    for (    Ability ability : abilities) {
      if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game,null,false)) {
        if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
          if (effect.applies(event,ability,game)) {
            applicableAbilities.add(ability);
          }
        }
      }
    }
    if (!applicableAbilities.isEmpty()) {
      replaceEffects.put((ReplacementEffect)effect,applicableAbilities);
    }
  }
  return replaceEffects;
}