nus-yam/ex-repair huggingface dataset:
Program: 163905
Project: 163905
Buggy source:
private void jump(){
  Level level=Dungeon.level;
  if (enemy == null)   enemy=chooseEnemy();
  if (enemy == null)   return;
  int newPos;
  if (HP > HT / 2) {
    for (int i=0; i < 4; i++) {
      int trapPos;
      do {
        trapPos=Random.Int(level.length());
      }
 while (level.map[trapPos] != Terrain.INACTIVE_TRAP && level.map[trapPos] != Terrain.TRAP);
      if (level.map[trapPos] == Terrain.INACTIVE_TRAP) {
        level.setTrap(new GrippingTrap().reveal(),trapPos);
        Level.set(trapPos,Terrain.TRAP);
        ScrollOfMagicMapping.discover(trapPos);
      }
    }
    int tries=50;
    do {
      newPos=Random.IntRange(3,7) + 32 * Random.IntRange(26,30);
    }
 while ((level.adjacent(newPos,enemy.pos) || Actor.findChar(newPos) != null) && --tries > 0);
    if (tries <= 0)     return;
  }
 else {
    do {
      newPos=Random.Int(level.length());
    }
 while (level.solid[newPos] || level.distance(newPos,enemy.pos) < 8 || Actor.findChar(newPos) != null);
  }
  if (level.heroFOV[pos])   CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
  sprite.move(pos,newPos);
  move(newPos);
  if (level.heroFOV[newPos])   CellEmitter.get(newPos).burst(Speck.factory(Speck.WOOL),6);
  Sample.INSTANCE.play(Assets.SND_PUFF);
  spend(1 / speed());
}

Fixed version (ground truth):
private void jump(){
  Level level=Dungeon.level;
  if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()) {
    fieldOfView=new boolean[Dungeon.level.length()];
    Dungeon.level.updateFieldOfView(this,fieldOfView);
  }
  if (enemy == null)   enemy=chooseEnemy();
  if (enemy == null)   return;
  int newPos;
  if (HP > HT / 2) {
    for (int i=0; i < 4; i++) {
      int trapPos;
      do {
        trapPos=Random.Int(level.length());
      }
 while (level.map[trapPos] != Terrain.INACTIVE_TRAP && level.map[trapPos] != Terrain.TRAP);
      if (level.map[trapPos] == Terrain.INACTIVE_TRAP) {
        level.setTrap(new GrippingTrap().reveal(),trapPos);
        Level.set(trapPos,Terrain.TRAP);
        ScrollOfMagicMapping.discover(trapPos);
      }
    }
    int tries=50;
    do {
      newPos=Random.IntRange(3,7) + 32 * Random.IntRange(26,30);
    }
 while ((level.adjacent(newPos,enemy.pos) || Actor.findChar(newPos) != null) && --tries > 0);
    if (tries <= 0)     return;
  }
 else {
    do {
      newPos=Random.Int(level.length());
    }
 while (level.solid[newPos] || level.distance(newPos,enemy.pos) < 8 || Actor.findChar(newPos) != null);
  }
  if (level.heroFOV[pos])   CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
  sprite.move(pos,newPos);
  move(newPos);
  if (level.heroFOV[newPos])   CellEmitter.get(newPos).burst(Speck.factory(Speck.WOOL),6);
  Sample.INSTANCE.play(Assets.SND_PUFF);
  spend(1 / speed());
}
Program: 163906
Project: 163906
Buggy source:
@Override protected void emit(int index){
  if (blob.volume <= 0) {
    return;
  }
  if (blob.area.isEmpty())   blob.setupArea();
  int[] map=blob.cur;
  float size=DungeonTilemap.SIZE;
  int cell;
  for (int i=blob.area.left; i < blob.area.right; i++) {
    for (int j=blob.area.top; j < blob.area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (map[cell] > 0 && Dungeon.level.heroFOV[cell]) {
        float x=(i + Random.Float()) * size;
        float y=(j + Random.Float()) * size;
        factory.emit(this,index,x,y);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void emit(int index){
  if (blob.volume <= 0) {
    return;
  }
  if (blob.area.isEmpty())   blob.setupArea();
  int[] map=blob.cur;
  float size=DungeonTilemap.SIZE;
  int cell;
  for (int i=blob.area.left; i < blob.area.right; i++) {
    for (int j=blob.area.top; j < blob.area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (map[cell] > 0 && cell < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[cell]) {
        float x=(i + Random.Float()) * size;
        float y=(j + Random.Float()) * size;
        factory.emit(this,index,x,y);
      }
    }
  }
}
Program: 163907
Project: 163907
Buggy source:
@Override public void update(){
  if (visible=Dungeon.level.heroFOV[pos]) {
    super.update();
    if ((delay-=Game.elapsed) <= 0) {
      delay=Random.Float(DELAY);
      ((FlowParticle)recycle(FlowParticle.class)).reset(x + Random.Float(DungeonTilemap.SIZE),y);
    }
  }
}

Fixed version (ground truth):
@Override public void update(){
  if (visible=(pos < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[pos])) {
    super.update();
    if ((delay-=Game.elapsed) <= 0) {
      delay=Random.Float(DELAY);
      ((FlowParticle)recycle(FlowParticle.class)).reset(x + Random.Float(DungeonTilemap.SIZE),y);
    }
  }
}
Program: 163908
Project: 163908
Buggy source:
static boolean cancel(){
  if (Dungeon.hero.curAction != null || Dungeon.hero.resting) {
    Dungeon.hero.curAction=null;
    Dungeon.hero.resting=false;
    return true;
  }
 else {
    return cancelCellSelector();
  }
}

Fixed version (ground truth):
static boolean cancel(){
  if (Dungeon.hero != null || Dungeon.hero.curAction != null || Dungeon.hero.resting) {
    Dungeon.hero.curAction=null;
    Dungeon.hero.resting=false;
    return true;
  }
 else {
    return cancelCellSelector();
  }
}
Program: 163909
Project: 163909
Buggy source:
@Override public void destroy(){
  super.destroy();
  Dungeon.level.mobs.remove(this);
  if (Dungeon.hero.isAlive()) {
    if (alignment == Alignment.ENEMY) {
      Statistics.enemiesSlain++;
      Badges.validateMonstersSlain();
      Statistics.qualifiedForNoKilling=false;
    }
    int exp=Dungeon.hero.lvl <= maxLvl ? EXP : 0;
    if (exp > 0) {
      Dungeon.hero.sprite.showStatus(CharSprite.POSITIVE,Messages.get(this,"String_Node_Str",exp));
      Dungeon.hero.earnExp(exp);
    }
  }
}

Fixed version (ground truth):
@Override public void destroy(){
  super.destroy();
  Dungeon.level.mobs.remove(this);
  if (Dungeon.hero.isAlive()) {
    if (alignment == Alignment.ENEMY) {
      Statistics.enemiesSlain++;
      Badges.validateMonstersSlain();
      Statistics.qualifiedForNoKilling=false;
      int exp=Dungeon.hero.lvl <= maxLvl ? EXP : 0;
      if (exp > 0) {
        Dungeon.hero.sprite.showStatus(CharSprite.POSITIVE,Messages.get(this,"String_Node_Str",exp));
        Dungeon.hero.earnExp(exp);
      }
    }
  }
}
Program: 163910
Project: 163910
Buggy source:
private void corruptEnemy(Mob enemy){
  if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
    GLog.w(Messages.get(this,"String_Node_Str"));
    return;
  }
  if (!enemy.properties().contains(Char.Property.BOSS) && !enemy.properties().contains(Char.Property.MINIBOSS) && !enemy.immunities().contains(Corruption.class)) {
    enemy.HP=enemy.HT;
    for (    Buff buff : enemy.buffs()) {
      buff.detach();
    }
    Buff.affect(enemy,Corruption.class);
    if (enemy.EXP > 0 && curUser.lvl <= enemy.maxLvl) {
      curUser.sprite.showStatus(CharSprite.POSITIVE,Messages.get(enemy,"String_Node_Str",enemy.EXP));
      curUser.earnExp(enemy.EXP);
      enemy.EXP=0;
    }
  }
 else {
    Buff.affect(enemy,Doom.class);
  }
}

Fixed version (ground truth):
private void corruptEnemy(Mob enemy){
  if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
    GLog.w(Messages.get(this,"String_Node_Str"));
    return;
  }
  if (!enemy.properties().contains(Char.Property.BOSS) && !enemy.properties().contains(Char.Property.MINIBOSS) && !enemy.immunities().contains(Corruption.class)) {
    enemy.HP=enemy.HT;
    for (    Buff buff : enemy.buffs()) {
      buff.detach();
    }
    Buff.affect(enemy,Corruption.class);
    Statistics.enemiesSlain++;
    Badges.validateMonstersSlain();
    Statistics.qualifiedForNoKilling=false;
    if (enemy.EXP > 0 && curUser.lvl <= enemy.maxLvl) {
      curUser.sprite.showStatus(CharSprite.POSITIVE,Messages.get(enemy,"String_Node_Str",enemy.EXP));
      curUser.earnExp(enemy.EXP);
    }
  }
 else {
    Buff.affect(enemy,Doom.class);
  }
}
Program: 163911
Project: 163911
Buggy source:
@Override public boolean act(){
  turnsToCost--;
  if (turnsToCost <= 0) {
    charge--;
    if (charge < 0) {
      charge=0;
      detach();
      GLog.w(Messages.get(this,"String_Node_Str"));
      ((Hero)target).interrupt();
    }
 else {
      int lvlDiffFromTarget=((Hero)target).lvl - 1 + level() * 2;
      if (level() >= 7) {
        lvlDiffFromTarget-=level() - 6;
      }
      if (lvlDiffFromTarget >= 0) {
        exp+=Math.round(10f * Math.pow(1.1f,lvlDiffFromTarget));
      }
 else {
        exp+=Math.round(10f * Math.pow(0.75f,-lvlDiffFromTarget));
      }
      if (exp >= (level() + 1) * 50 && level() < levelCap) {
        upgrade();
        exp-=level() * 50;
        GLog.p(Messages.get(this,"String_Node_Str"));
      }
      turnsToCost=5;
    }
    updateQuickslot();
  }
  spend(TICK);
  return true;
}

Fixed version (ground truth):
@Override public boolean act(){
  turnsToCost--;
  if (turnsToCost <= 0) {
    charge--;
    if (charge < 0) {
      charge=0;
      detach();
      GLog.w(Messages.get(this,"String_Node_Str"));
      ((Hero)target).interrupt();
    }
 else {
      int lvlDiffFromTarget=((Hero)target).lvl - (1 + level() * 2);
      if (level() >= 7) {
        lvlDiffFromTarget-=level() - 6;
      }
      if (lvlDiffFromTarget >= 0) {
        exp+=Math.round(10f * Math.pow(1.1f,lvlDiffFromTarget));
      }
 else {
        exp+=Math.round(10f * Math.pow(0.75f,-lvlDiffFromTarget));
      }
      if (exp >= (level() + 1) * 50 && level() < levelCap) {
        upgrade();
        exp-=level() * 50;
        GLog.p(Messages.get(this,"String_Node_Str"));
      }
      turnsToCost=5;
    }
    updateQuickslot();
  }
  spend(TICK);
  return true;
}
Program: 163912
Project: 163912
Buggy source:
public Plant plant(Plant.Seed seed,int pos){
  if (Dungeon.isChallenged(Challenges.NO_HERBALISM)) {
    return null;
  }
  Plant plant=plants.get(pos);
  if (plant != null) {
    plant.wither();
  }
  if (map[pos] == Terrain.HIGH_GRASS || map[pos] == Terrain.EMPTY || map[pos] == Terrain.EMBERS || map[pos] == Terrain.EMPTY_DECO) {
    map[pos]=Terrain.GRASS;
    flamable[pos]=true;
  }
  plant=seed.couch(pos,this);
  plants.put(pos,plant);
  GameScene.plantSeed(pos);
  return plant;
}

Fixed version (ground truth):
public Plant plant(Plant.Seed seed,int pos){
  if (Dungeon.isChallenged(Challenges.NO_HERBALISM)) {
    return null;
  }
  Plant plant=plants.get(pos);
  if (plant != null) {
    plant.wither();
  }
  if (map[pos] == Terrain.HIGH_GRASS || map[pos] == Terrain.EMPTY || map[pos] == Terrain.EMBERS || map[pos] == Terrain.EMPTY_DECO) {
    set(pos,Terrain.GRASS,this);
    GameScene.updateMap(pos);
  }
  plant=seed.couch(pos,this);
  plants.put(pos,plant);
  GameScene.plantSeed(pos);
  return plant;
}
Program: 163913
Project: 163913
Buggy source:
public Heap drop(Item item,int cell){
  if ((Dungeon.isChallenged(Challenges.NO_FOOD) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) || (Dungeon.isChallenged(Challenges.NO_ARMOR) && item instanceof Armor) || (Dungeon.isChallenged(Challenges.NO_HEALING) && item instanceof PotionOfHealing)|| (Dungeon.isChallenged(Challenges.NO_HERBALISM) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch))|| (Dungeon.isChallenged(Challenges.NO_SCROLLS) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) || item instanceof ScrollHolder))|| item == null) {
    Heap heap=new Heap();
    ItemSprite sprite=heap.sprite=new ItemSprite();
    sprite.link(heap);
    return heap;
  }
  Heap heap=heaps.get(cell);
  if (heap == null) {
    heap=new Heap();
    heap.seen=Dungeon.level == this && heroFOV[cell];
    heap.pos=cell;
    if (map[cell] == Terrain.CHASM || (Dungeon.level != null && pit[cell])) {
      Dungeon.dropToChasm(item);
      GameScene.discard(heap);
    }
 else {
      heaps.put(cell,heap);
      GameScene.add(heap);
    }
  }
 else   if (heap.type == Heap.Type.LOCKED_CHEST || heap.type == Heap.Type.CRYSTAL_CHEST) {
    int n;
    do {
      n=cell + PathFinder.NEIGHBOURS8[Random.Int(8)];
    }
 while (!passable[n] && !avoid[n]);
    return drop(item,n);
  }
  heap.drop(item);
  if (Dungeon.level != null) {
    press(cell,null);
  }
  return heap;
}

Fixed version (ground truth):
public Heap drop(Item item,int cell){
  if ((Dungeon.isChallenged(Challenges.NO_FOOD) && (item instanceof Food || item instanceof BlandfruitBush.Seed)) || (Dungeon.isChallenged(Challenges.NO_ARMOR) && item instanceof Armor) || (Dungeon.isChallenged(Challenges.NO_HEALING) && item instanceof PotionOfHealing)|| (Dungeon.isChallenged(Challenges.NO_HERBALISM) && (item instanceof Plant.Seed || item instanceof Dewdrop || item instanceof SeedPouch))|| (Dungeon.isChallenged(Challenges.NO_SCROLLS) && ((item instanceof Scroll && !(item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion)) || item instanceof ScrollHolder))|| item == null) {
    Heap heap=new Heap();
    ItemSprite sprite=heap.sprite=new ItemSprite();
    sprite.link(heap);
    return heap;
  }
  Heap heap=heaps.get(cell);
  if (heap == null) {
    heap=new Heap();
    heap.seen=Dungeon.level == this && heroFOV[cell];
    heap.pos=cell;
    heap.drop(item);
    if (map[cell] == Terrain.CHASM || (Dungeon.level != null && pit[cell])) {
      Dungeon.dropToChasm(item);
      GameScene.discard(heap);
    }
 else {
      heaps.put(cell,heap);
      GameScene.add(heap);
    }
  }
 else   if (heap.type == Heap.Type.LOCKED_CHEST || heap.type == Heap.Type.CRYSTAL_CHEST) {
    int n;
    do {
      n=cell + PathFinder.NEIGHBOURS8[Random.Int(8)];
    }
 while (!passable[n] && !avoid[n]);
    return drop(item,n);
  }
 else {
    heap.drop(item);
  }
  if (Dungeon.level != null) {
    press(cell,null);
  }
  return heap;
}
Program: 163914
Project: 163914
Buggy source:
@Override public void call(){
  if (!finalTarget.isAlive())   return;
  if (finalTarget == Dungeon.hero) {
    if (((float)finalTarget.HP / finalTarget.HT) >= 0.9f) {
      finalTarget.damage((finalTarget.HP - 1),trap);
    }
 else {
      finalTarget.damage(finalTarget.HP,trap);
    }
    Sample.INSTANCE.play(Assets.SND_CURSED);
    if (!finalTarget.isAlive()) {
      Dungeon.fail(GrimTrap.class);
      GLog.n(Messages.get(GrimTrap.class,"String_Node_Str"));
    }
  }
 else {
    finalTarget.damage(finalTarget.HP,this);
    Sample.INSTANCE.play(Assets.SND_BURNING);
  }
  finalTarget.sprite.emitter().burst(ShadowParticle.UP,10);
  if (!finalTarget.isAlive())   finalTarget.next();
}

Fixed version (ground truth):
@Override public void call(){
  finalTarget.damage(finalDmg,trap);
  if (finalTarget == Dungeon.hero) {
    Sample.INSTANCE.play(Assets.SND_CURSED);
    if (!finalTarget.isAlive()) {
      Dungeon.fail(GrimTrap.class);
      GLog.n(Messages.get(GrimTrap.class,"String_Node_Str"));
    }
  }
 else {
    Sample.INSTANCE.play(Assets.SND_BURNING);
  }
  finalTarget.sprite.emitter().burst(ShadowParticle.UP,10);
  Actor.remove(toRemove);
  next();
}
Program: 163916
Project: 163916
Buggy source:
@Override public void call(){
  int dmg=Random.NormalIntRange(1,4) - finalTarget.drRoll();
  finalTarget.damage(dmg,trap);
  if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
    Dungeon.fail(getClass());
  }
  Buff.affect(finalTarget,Poison.class).set(Poison.durationFactor(finalTarget) * (4 + Dungeon.depth));
  Sample.INSTANCE.play(Assets.SND_HIT,1,1,Random.Float(0.8f,1.25f));
  finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(),dmg);
  finalTarget.sprite.flash();
}

Fixed version (ground truth):
@Override public void call(){
  int dmg=Random.NormalIntRange(1,4) - finalTarget.drRoll();
  finalTarget.damage(dmg,trap);
  if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
    Dungeon.fail(trap.getClass());
  }
  Buff.affect(finalTarget,Poison.class).set(Poison.durationFactor(finalTarget) * (4 + Dungeon.depth));
  Sample.INSTANCE.play(Assets.SND_HIT,1,1,Random.Float(0.8f,1.25f));
  finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(),dmg);
  finalTarget.sprite.flash();
  Actor.remove(toRemove);
  next();
}
Program: 163918
Project: 163918
Buggy source:
@Override public void call(){
  int dmg=Random.NormalIntRange(1,4) - finalTarget.drRoll();
  finalTarget.damage(dmg,trap);
  if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
    Dungeon.fail(getClass());
  }
  Sample.INSTANCE.play(Assets.SND_HIT,1,1,Random.Float(0.8f,1.25f));
  finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(),dmg);
  finalTarget.sprite.flash();
}

Fixed version (ground truth):
@Override public void call(){
  int dmg=Random.NormalIntRange(1,4) - finalTarget.drRoll();
  finalTarget.damage(dmg,trap);
  if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
    Dungeon.fail(trap.getClass());
  }
  Sample.INSTANCE.play(Assets.SND_HIT,1,1,Random.Float(0.8f,1.25f));
  finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(),dmg);
  finalTarget.sprite.flash();
  Actor.remove(toRemove);
  next();
}
Program: 163919
Project: 163919
Buggy source:
@Override public void activate(){
  Char target=Actor.findChar(pos);
  if (target == null) {
    for (    Char ch : Actor.chars()) {
      Ballistica bolt=new Ballistica(pos,ch.pos,Ballistica.PROJECTILE);
      if (bolt.collisionPos == ch.pos && (target == null || Dungeon.level.distance(pos,ch.pos) < Dungeon.level.distance(pos,target.pos))) {
        target=ch;
      }
    }
  }
  if (target != null) {
    final Char finalTarget=target;
    final WornDartTrap trap=this;
    if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
      ((MissileSprite)ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).reset(pos,target.sprite,new Dart(),new Callback(){
        @Override public void call(){
          int dmg=Random.NormalIntRange(1,4) - finalTarget.drRoll();
          finalTarget.damage(dmg,trap);
          if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
            Dungeon.fail(getClass());
          }
          Sample.INSTANCE.play(Assets.SND_HIT,1,1,Random.Float(0.8f,1.25f));
          finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(),dmg);
          finalTarget.sprite.flash();
        }
      }
);
    }
 else {
      finalTarget.damage(Random.NormalIntRange(1,4) - finalTarget.drRoll(),trap);
    }
  }
}

Fixed version (ground truth):
@Override public void activate(){
  Char target=Actor.findChar(pos);
  if (target == null) {
    for (    Char ch : Actor.chars()) {
      Ballistica bolt=new Ballistica(pos,ch.pos,Ballistica.PROJECTILE);
      if (bolt.collisionPos == ch.pos && (target == null || Dungeon.level.distance(pos,ch.pos) < Dungeon.level.distance(pos,target.pos))) {
        target=ch;
      }
    }
  }
  if (target != null) {
    final Char finalTarget=target;
    final WornDartTrap trap=this;
    if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
      Actor.add(new Actor(){
{
          actPriority=Integer.MIN_VALUE;
        }
        @Override protected boolean act(){
          final Actor toRemove=this;
          ((MissileSprite)ShatteredPixelDungeon.scene().recycle(MissileSprite.class)).reset(pos,finalTarget.sprite,new Dart(),new Callback(){
            @Override public void call(){
              int dmg=Random.NormalIntRange(1,4) - finalTarget.drRoll();
              finalTarget.damage(dmg,trap);
              if (finalTarget == Dungeon.hero && !finalTarget.isAlive()) {
                Dungeon.fail(trap.getClass());
              }
              Sample.INSTANCE.play(Assets.SND_HIT,1,1,Random.Float(0.8f,1.25f));
              finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(),dmg);
              finalTarget.sprite.flash();
              Actor.remove(toRemove);
              next();
            }
          }
);
          return false;
        }
      }
);
    }
 else {
      finalTarget.damage(Random.NormalIntRange(1,4) - finalTarget.drRoll(),trap);
    }
  }
}
Program: 163920
Project: 163920
Buggy source:
public Plant plant(Plant.Seed seed,int pos){
  if (Dungeon.isChallenged(Challenges.NO_HERBALISM)) {
    return null;
  }
  Plant plant=plants.get(pos);
  if (plant != null) {
    plant.wither();
  }
  if (map[pos] == Terrain.HIGH_GRASS || map[pos] == Terrain.EMPTY || map[pos] == Terrain.EMBERS || map[pos] == Terrain.EMPTY_DECO) {
    map[pos]=Terrain.GRASS;
    flamable[pos]=true;
  }
  plant=seed.couch(pos);
  plants.put(pos,plant);
  GameScene.plantSeed(pos);
  return plant;
}

Fixed version (ground truth):
public Plant plant(Plant.Seed seed,int pos){
  if (Dungeon.isChallenged(Challenges.NO_HERBALISM)) {
    return null;
  }
  Plant plant=plants.get(pos);
  if (plant != null) {
    plant.wither();
  }
  if (map[pos] == Terrain.HIGH_GRASS || map[pos] == Terrain.EMPTY || map[pos] == Terrain.EMBERS || map[pos] == Terrain.EMPTY_DECO) {
    map[pos]=Terrain.GRASS;
    flamable[pos]=true;
  }
  plant=seed.couch(pos,this);
  plants.put(pos,plant);
  GameScene.plantSeed(pos);
  return plant;
}
Program: 163921
Project: 163921
Buggy source:
public Plant couch(int pos){
  try {
    if (Dungeon.level.heroFOV != null && Dungeon.level.heroFOV[pos]) {
      Sample.INSTANCE.play(Assets.SND_PLANT);
    }
    Plant plant=plantClass.newInstance();
    plant.pos=pos;
    return plant;
  }
 catch (  Exception e) {
    ShatteredPixelDungeon.reportException(e);
    return null;
  }
}

Fixed version (ground truth):
public Plant couch(int pos,Level level){
  try {
    if (level.heroFOV != null && level.heroFOV[pos]) {
      Sample.INSTANCE.play(Assets.SND_PLANT);
    }
    Plant plant=plantClass.newInstance();
    plant.pos=pos;
    return plant;
  }
 catch (  Exception e) {
    ShatteredPixelDungeon.reportException(e);
    return null;
  }
}
Program: 163922
Project: 163922
Buggy source:
@Override protected void evolve(){
  boolean[] flamable=Dungeon.level.flamable;
  int cell;
  int fire;
  Freezing freeze=(Freezing)Dungeon.level.blobs.get(Freezing.class);
  boolean observe=false;
  for (int i=area.left - 1; i <= area.right; i++) {
    for (int j=area.top - 1; j <= area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (cur[cell] > 0) {
        if (freeze != null && freeze.cur[cell] > 0) {
          freeze.clear(cell);
          off[cell]=cur[cell]=0;
          continue;
        }
        burn(cell);
        fire=cur[cell] - 1;
        if (fire <= 0 && flamable[cell]) {
          Dungeon.level.destroy(cell);
          observe=true;
          GameScene.updateMap(cell);
        }
      }
 else       if (freeze == null || freeze.cur[cell] < 0) {
        if (flamable[cell] && (cur[cell - 1] > 0 || cur[cell + 1] > 0 || cur[cell - Dungeon.level.width()] > 0 || cur[cell + Dungeon.level.width()] > 0)) {
          fire=4;
          burn(cell);
          area.union(i,j);
        }
 else {
          fire=0;
        }
      }
 else {
        fire=0;
      }
      volume+=(off[cell]=fire);
    }
  }
  if (observe) {
    Dungeon.observe();
  }
}

Fixed version (ground truth):
@Override protected void evolve(){
  boolean[] flamable=Dungeon.level.flamable;
  int cell;
  int fire;
  Freezing freeze=(Freezing)Dungeon.level.blobs.get(Freezing.class);
  boolean observe=false;
  for (int i=area.left - 1; i <= area.right; i++) {
    for (int j=area.top - 1; j <= area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (cur[cell] > 0) {
        if (freeze != null && freeze.volume > 0 && freeze.cur[cell] > 0) {
          freeze.clear(cell);
          off[cell]=cur[cell]=0;
          continue;
        }
        burn(cell);
        fire=cur[cell] - 1;
        if (fire <= 0 && flamable[cell]) {
          Dungeon.level.destroy(cell);
          observe=true;
          GameScene.updateMap(cell);
        }
      }
 else       if (freeze == null || freeze.volume <= 0 || freeze.cur[cell] < 0) {
        if (flamable[cell] && (cur[cell - 1] > 0 || cur[cell + 1] > 0 || cur[cell - Dungeon.level.width()] > 0 || cur[cell + Dungeon.level.width()] > 0)) {
          fire=4;
          burn(cell);
          area.union(i,j);
        }
 else {
          fire=0;
        }
      }
 else {
        fire=0;
      }
      volume+=(off[cell]=fire);
    }
  }
  if (observe) {
    Dungeon.observe();
  }
}
Program: 163923
Project: 163923
Buggy source:
@Override protected void evolve(){
  boolean[] water=Dungeon.level.water;
  int cell;
  Fire fire=(Fire)Dungeon.level.blobs.get(Fire.class);
  for (int i=area.left - 1; i <= area.right; i++) {
    for (int j=area.top - 1; j <= area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (cur[cell] > 0) {
        if (fire != null && fire.cur[cell] > 0) {
          fire.clear(cell);
          off[cell]=cur[cell]=0;
          continue;
        }
        Char ch=Actor.findChar(cell);
        if (ch != null) {
          if (ch.buff(Frost.class) != null) {
            Buff.affect(ch,Frost.class,2f);
          }
 else {
            Buff.affect(ch,Chill.class,water[cell] ? 5f : 3f);
            Chill chill=ch.buff(Chill.class);
            if (chill != null && chill.cooldown() >= 10f) {
              Buff.affect(ch,Frost.class,5f);
            }
          }
        }
        Heap heap=Dungeon.level.heaps.get(cell);
        if (heap != null)         heap.freeze();
        off[cell]=cur[cell] - 1;
        volume+=off[cell];
      }
 else {
        off[cell]=0;
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void evolve(){
  boolean[] water=Dungeon.level.water;
  int cell;
  Fire fire=(Fire)Dungeon.level.blobs.get(Fire.class);
  for (int i=area.left - 1; i <= area.right; i++) {
    for (int j=area.top - 1; j <= area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (cur[cell] > 0) {
        if (fire != null && fire.volume > 0 && fire.cur[cell] > 0) {
          fire.clear(cell);
          off[cell]=cur[cell]=0;
          continue;
        }
        Char ch=Actor.findChar(cell);
        if (ch != null) {
          if (ch.buff(Frost.class) != null) {
            Buff.affect(ch,Frost.class,2f);
          }
 else {
            Buff.affect(ch,Chill.class,water[cell] ? 5f : 3f);
            Chill chill=ch.buff(Chill.class);
            if (chill != null && chill.cooldown() >= 10f) {
              Buff.affect(ch,Frost.class,5f);
            }
          }
        }
        Heap heap=Dungeon.level.heaps.get(cell);
        if (heap != null)         heap.freeze();
        off[cell]=cur[cell] - 1;
        volume+=off[cell];
      }
 else {
        off[cell]=0;
      }
    }
  }
}
Program: 163924
Project: 163924
Buggy source:
@Override public void activate(){
  CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT),0.2f,3);
  Sample.INSTANCE.play(Assets.SND_TELEPORT);
  Char ch=Actor.findChar(pos);
  if (ch instanceof Hero) {
    ScrollOfTeleportation.teleportHero((Hero)ch);
    BArray.setFalse(Dungeon.level.visited);
    BArray.setFalse(Dungeon.level.mapped);
    Dungeon.observe();
  }
 else   if (ch != null) {
    int count=10;
    int pos;
    do {
      pos=Dungeon.level.randomRespawnCell();
      if (count-- <= 0) {
        break;
      }
    }
 while (pos == -1);
    if (pos == -1 || Dungeon.bossLevel()) {
      GLog.w(Messages.get(ScrollOfTeleportation.class,"String_Node_Str"));
    }
 else {
      ch.pos=pos;
      if (ch instanceof Mob && ((Mob)ch).state == ((Mob)ch).HUNTING) {
        ((Mob)ch).state=((Mob)ch).WANDERING;
      }
      ch.sprite.place(ch.pos);
      ch.sprite.visible=Dungeon.level.heroFOV[pos];
    }
  }
  Heap heap=Dungeon.level.heaps.get(pos);
  if (heap != null) {
    int cell=Dungeon.level.randomRespawnCell();
    Item item=heap.pickUp();
    if (cell != -1) {
      Dungeon.level.drop(item,cell);
    }
  }
}

Fixed version (ground truth):
@Override public void activate(){
  CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT),0.2f,3);
  Sample.INSTANCE.play(Assets.SND_TELEPORT);
  Char ch=Actor.findChar(pos);
  if (ch instanceof Hero) {
    ScrollOfTeleportation.teleportHero((Hero)ch);
    BArray.setFalse(Dungeon.level.visited);
    BArray.setFalse(Dungeon.level.mapped);
    GameScene.updateFog();
    Dungeon.observe();
  }
 else   if (ch != null) {
    int count=10;
    int pos;
    do {
      pos=Dungeon.level.randomRespawnCell();
      if (count-- <= 0) {
        break;
      }
    }
 while (pos == -1);
    if (pos == -1 || Dungeon.bossLevel()) {
      GLog.w(Messages.get(ScrollOfTeleportation.class,"String_Node_Str"));
    }
 else {
      ch.pos=pos;
      if (ch instanceof Mob && ((Mob)ch).state == ((Mob)ch).HUNTING) {
        ((Mob)ch).state=((Mob)ch).WANDERING;
      }
      ch.sprite.place(ch.pos);
      ch.sprite.visible=Dungeon.level.heroFOV[pos];
    }
  }
  Heap heap=Dungeon.level.heaps.get(pos);
  if (heap != null) {
    int cell=Dungeon.level.randomRespawnCell();
    Item item=heap.pickUp();
    if (cell != -1) {
      Dungeon.level.drop(item,cell);
    }
  }
}
Program: 163925
Project: 163925
Buggy source:
@Override public boolean act(boolean enemyInFOV,boolean justAlerted){
  if (beamCharged && canAttack(enemy)) {
    enemySeen=enemyInFOV;
    return doAttack(enemy);
  }
  return super.act(enemyInFOV,justAlerted);
}

Fixed version (ground truth):
@Override public boolean act(boolean enemyInFOV,boolean justAlerted){
  if (beamCharged && enemy != null && canAttack(enemy)) {
    enemySeen=enemyInFOV;
    return doAttack(enemy);
  }
  return super.act(enemyInFOV,justAlerted);
}
Program: 163926
Project: 163926
Buggy source:
public void saySpawned(){
  if (Messages.lang() != Languages.ENGLISH)   return;
  int i=(Dungeon.depth - 1) / 5;
  if (chooseEnemy() == null)   yell(Random.element(VOICE_AMBIENT[i]));
 else   yell(Random.element(VOICE_ENEMIES[i][Dungeon.bossLevel() ? 1 : 0]));
  Sample.INSTANCE.play(Assets.SND_GHOST);
}

Fixed version (ground truth):
public void saySpawned(){
  if (Messages.lang() != Languages.ENGLISH)   return;
  int i=(Dungeon.depth - 1) / 5;
  fieldOfView=new boolean[Dungeon.level.length()];
  Dungeon.level.updateFieldOfView(this,fieldOfView);
  if (chooseEnemy() == null)   yell(Random.element(VOICE_AMBIENT[i]));
 else   yell(Random.element(VOICE_ENEMIES[i][Dungeon.bossLevel() ? 1 : 0]));
  Sample.INSTANCE.play(Assets.SND_GHOST);
}
Program: 163927
Project: 163927
Buggy source:
@Override protected Char chooseEnemy(){
  if (enemy == null || !enemy.isAlive() || !Dungeon.level.mobs.contains(enemy) || Dungeon.level.distance(enemy.pos,Dungeon.hero.pos) > 8 || enemy.alignment != Alignment.ENEMY || state == WANDERING) {
    HashSet<Mob> enemies=new HashSet<>();
    for (    Mob mob : Dungeon.level.mobs) {
      if (mob.alignment == Alignment.ENEMY && fieldOfView[mob.pos] && Dungeon.level.distance(mob.pos,Dungeon.hero.pos) <= 8 && mob.state != mob.PASSIVE) {
        enemies.add(mob);
      }
    }
    Char closest=null;
    for (    Char curr : enemies) {
      if (closest == null || Dungeon.level.distance(pos,curr.pos) < Dungeon.level.distance(pos,closest.pos)) {
        closest=curr;
      }
    }
    return closest;
  }
  return enemy;
}

Fixed version (ground truth):
@Override protected Char chooseEnemy(){
  Char enemy=super.chooseEnemy();
  if (enemy != null && Dungeon.level.distance(enemy.pos,Dungeon.hero.pos) <= 8) {
    return enemy;
  }
 else {
    return null;
  }
}
Program: 163928
Project: 163928
Buggy source:
public CustomTiledVisual create(){
  x=tileX * SIZE;
  y=tileY * SIZE;
  return this;
}

Fixed version (ground truth):
public CustomTiledVisual create(){
  camera=null;
  x=tileX * SIZE;
  y=tileY * SIZE;
  return this;
}
Program: 163929
Project: 163929
Buggy source:
private static Item pickItem(Hero hero){
  Item item=null;
  if (Random.Int(2) == 0) {
switch (Random.Int(5)) {
case 0:
      item=hero.belongings.weapon;
    break;
case 1:
  item=hero.belongings.armor;
break;
case 2:
item=hero.belongings.misc1;
break;
case 3:
item=hero.belongings.misc2;
break;
case 4:
item=Dungeon.quickslot.randomNonePlaceholder();
break;
}
if (item == null || item.bones) return pickItem(hero);
}
 else {
Iterator<Item> iterator=hero.belongings.backpack.iterator();
Item curItem;
ArrayList<Item> items=new ArrayList<Item>();
while (iterator.hasNext()) {
curItem=iterator.next();
if (curItem.bones) items.add(curItem);
}
if (Random.Int(3) < items.size()) {
item=Random.element(items);
if (item.stackable) {
item.quantity(Random.NormalIntRange(1,(item.quantity() + 1) / 2));
}
}
}
if (item == null) {
if (Dungeon.gold > 100) {
item=new Gold(Random.NormalIntRange(50,Dungeon.gold / 2));
}
 else {
item=new Gold(50);
}
}
return item;
}

Fixed version (ground truth):
private static Item pickItem(Hero hero){
  Item item=null;
  if (Random.Int(2) == 0) {
switch (Random.Int(5)) {
case 0:
      item=hero.belongings.weapon;
    break;
case 1:
  item=hero.belongings.armor;
break;
case 2:
item=hero.belongings.misc1;
break;
case 3:
item=hero.belongings.misc2;
break;
case 4:
item=Dungeon.quickslot.randomNonePlaceholder();
break;
}
if (item == null || !item.bones) {
return pickItem(hero);
}
}
 else {
Iterator<Item> iterator=hero.belongings.backpack.iterator();
Item curItem;
ArrayList<Item> items=new ArrayList<Item>();
while (iterator.hasNext()) {
curItem=iterator.next();
if (curItem.bones) items.add(curItem);
}
if (Random.Int(3) < items.size()) {
item=Random.element(items);
if (item.stackable) {
item.quantity(Random.NormalIntRange(1,(item.quantity() + 1) / 2));
}
}
}
if (item == null) {
if (Dungeon.gold > 100) {
item=new Gold(Random.NormalIntRange(50,Dungeon.gold / 2));
}
 else {
item=new Gold(50);
}
}
return item;
}
Program: 163930
Project: 163930
Buggy source:
@Override protected void evolve(){
  int cell;
  for (int i=area.top - 1; i <= area.bottom; i++) {
    for (int j=area.left - 1; j <= area.right; j++) {
      cell=j + i * Dungeon.level.width();
      if (Dungeon.level.insideMap(cell)) {
        off[cell]=cur[cell];
        volume+=off[cell];
        if (off[cell] > 0 && Dungeon.level.heroFOV[cell]) {
          Notes.add(Notes.Landmark.ALCHEMY);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void evolve(){
  int cell;
  for (int i=area.top - 1; i <= area.bottom; i++) {
    for (int j=area.left - 1; j <= area.right; j++) {
      cell=j + i * Dungeon.level.width();
      if (Dungeon.level.insideMap(cell)) {
        off[cell]=cur[cell];
        volume+=off[cell];
        if (off[cell] > 0 && Dungeon.level.heroFOV[cell]) {
          Notes.add(Notes.Landmark.ALCHEMY);
        }
        while (off[cell] > 0 && Dungeon.level.heaps.get(cell) != null) {
          int n;
          do {
            n=cell + PathFinder.NEIGHBOURS8[Random.Int(8)];
          }
 while (!Dungeon.level.passable[n]);
          Dungeon.level.drop(Dungeon.level.heaps.get(cell).pickUp(),n).sprite.drop(pos);
        }
      }
    }
  }
}
Program: 163931
Project: 163931
Buggy source:
public boolean canInstakill(Char defender){
  return this == LVL_5 && !defender.properties().contains(Char.Property.MINIBOSS) && !defender.properties().contains(Char.Property.MINIBOSS);
}

Fixed version (ground truth):
public boolean canInstakill(Char defender){
  return this == LVL_5 && !defender.properties().contains(Char.Property.MINIBOSS) && !defender.properties().contains(Char.Property.BOSS);
}
Program: 163932
Project: 163932
Buggy source:
public static void spawn(CityLevel level){
  if (!spawned && Dungeon.depth > 16 && Random.Int(20 - Dungeon.depth) == 0) {
    Imp npc=new Imp();
    do {
      npc.pos=level.randomRespawnCell();
    }
 while (npc.pos == -1 || level.heaps.get(npc.pos) != null || level.findMob(npc.pos) != null || !(Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[0]] && Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[2]]) || !(Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[1]] && Dungeon.level.passable[npc.pos + PathFinder.CIRCLE4[3]]));
    level.mobs.add(npc);
    spawned=true;
    alternative=Random.Int(2) == 0;
    given=false;
    do {
      reward=(Ring)Generator.random(Generator.Category.RING);
    }
 while (reward.cursed);
    reward.upgrade(2);
    reward.cursed=true;
  }
}

Fixed version (ground truth):
public static void spawn(CityLevel level){
  if (!spawned && Dungeon.depth > 16 && Random.Int(20 - Dungeon.depth) == 0) {
    Imp npc=new Imp();
    do {
      npc.pos=level.randomRespawnCell();
    }
 while (npc.pos == -1 || level.heaps.get(npc.pos) != null || level.findMob(npc.pos) != null || !(level.passable[npc.pos + PathFinder.CIRCLE4[0]] && level.passable[npc.pos + PathFinder.CIRCLE4[2]]) || !(level.passable[npc.pos + PathFinder.CIRCLE4[1]] && level.passable[npc.pos + PathFinder.CIRCLE4[3]]));
    level.mobs.add(npc);
    spawned=true;
    alternative=Random.Int(2) == 0;
    given=false;
    do {
      reward=(Ring)Generator.random(Generator.Category.RING);
    }
 while (reward.cursed);
    reward.upgrade(2);
    reward.cursed=true;
  }
}
Program: 163933
Project: 163933
Buggy source:
private void confirmCancelation(){
  GameScene.show(new WndOptions(name(),Messages.get(this,"String_Node_Str"),Messages.get(this,"String_Node_Str"),Messages.get(this,"String_Node_Str")){
    @Override protected void onSelect(    int index){
switch (index) {
case 0:
        curUser.spendAndNext(TIME_TO_READ);
      identifiedByUse=false;
    break;
case 1:
  GameScene.selectItem(itemSelector,mode,inventoryTitle);
break;
}
}
public void onBackPressed(){
}
}
);
}

Fixed version (ground truth):
private void confirmCancelation(){
  GameScene.show(new WndOptions(Messages.titleCase(name()),Messages.get(this,"String_Node_Str"),Messages.get(this,"String_Node_Str"),Messages.get(this,"String_Node_Str")){
    @Override protected void onSelect(    int index){
switch (index) {
case 0:
        curUser.spendAndNext(TIME_TO_READ);
      identifiedByUse=false;
    break;
case 1:
  GameScene.selectItem(itemSelector,mode,inventoryTitle);
break;
}
}
public void onBackPressed(){
}
}
);
}
Program: 163935
Project: 163935
Buggy source:
@Override public boolean act(){
  if (Dungeon.level.map[target.pos] == Terrain.GRASS) {
    Dungeon.level.set(target.pos,Terrain.EMBERS);
    GameScene.updateMap(target.pos);
  }
  spend(TICK);
  left-=TICK;
  if (left < 5) {
    BuffIndicator.refreshHero();
  }
 else   if (left <= 0) {
    detach();
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean act(){
  if (Dungeon.level.map[target.pos] == Terrain.GRASS) {
    Dungeon.level.set(target.pos,Terrain.EMBERS);
    GameScene.updateMap(target.pos);
  }
  spend(TICK);
  left-=TICK;
  if (left <= 0) {
    detach();
  }
 else   if (left < 5) {
    BuffIndicator.refreshHero();
  }
  return true;
}
Program: 163936
Project: 163936
Buggy source:
@Override public boolean act(){
  GameScene.add(Blob.seed(target.pos,50,ToxicGas.class));
  spend(TICK);
  left-=TICK;
  if (left <= 0)   detach();
  return true;
}

Fixed version (ground truth):
@Override public boolean act(){
  GameScene.add(Blob.seed(target.pos,50,ToxicGas.class));
  spend(TICK);
  left-=TICK;
  if (left <= 0) {
    detach();
  }
 else   if (left < 5) {
    BuffIndicator.refreshHero();
  }
  return true;
}
Program: 163937
Project: 163937
Buggy source:
@Override protected void evolve(){
  boolean[] flamable=Dungeon.level.flamable;
  int cell;
  int fire;
  Freezing freeze=(Freezing)Dungeon.level.blobs.get(Freezing.class);
  boolean observe=false;
  for (int i=area.left - 1; i <= area.right; i++) {
    for (int j=area.top - 1; j <= area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (cur[cell] > 0) {
        if (freeze != null && freeze.volume > 0 && freeze.cur[cell] > 0) {
          freeze.clear(cell);
          off[cell]=cur[cell]=0;
          continue;
        }
        burn(cell);
        fire=cur[cell] - 1;
        if (fire <= 0 && flamable[cell]) {
          Dungeon.level.destroy(cell);
          observe=true;
          GameScene.updateMap(cell);
        }
      }
 else       if (freeze == null || freeze.volume <= 0 || freeze.cur[cell] < 0) {
        if (flamable[cell] && (cur[cell - 1] > 0 || cur[cell + 1] > 0 || cur[cell - Dungeon.level.width()] > 0 || cur[cell + Dungeon.level.width()] > 0)) {
          fire=4;
          burn(cell);
          area.union(i,j);
        }
 else {
          fire=0;
        }
      }
 else {
        fire=0;
      }
      volume+=(off[cell]=fire);
    }
  }
  if (observe) {
    Dungeon.observe();
  }
}

Fixed version (ground truth):
@Override protected void evolve(){
  boolean[] flamable=Dungeon.level.flamable;
  int cell;
  int fire;
  Freezing freeze=(Freezing)Dungeon.level.blobs.get(Freezing.class);
  boolean observe=false;
  for (int i=area.left - 1; i <= area.right; i++) {
    for (int j=area.top - 1; j <= area.bottom; j++) {
      cell=i + j * Dungeon.level.width();
      if (cur[cell] > 0) {
        if (freeze != null && freeze.volume > 0 && freeze.cur[cell] > 0) {
          freeze.clear(cell);
          off[cell]=cur[cell]=0;
          continue;
        }
        burn(cell);
        fire=cur[cell] - 1;
        if (fire <= 0 && flamable[cell]) {
          Dungeon.level.destroy(cell);
          observe=true;
          GameScene.updateMap(cell);
        }
      }
 else       if (freeze == null || freeze.volume <= 0 || freeze.cur[cell] <= 0) {
        if (flamable[cell] && (cur[cell - 1] > 0 || cur[cell + 1] > 0 || cur[cell - Dungeon.level.width()] > 0 || cur[cell + Dungeon.level.width()] > 0)) {
          fire=4;
          burn(cell);
          area.union(i,j);
        }
 else {
          fire=0;
        }
      }
 else {
        fire=0;
      }
      volume+=(off[cell]=fire);
    }
  }
  if (observe) {
    Dungeon.observe();
  }
}
Program: 163938
Project: 163938
Buggy source:
private void corruptEnemy(Mob enemy){
  if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
    GLog.w(Messages.get(this,"String_Node_Str"));
    return;
  }
  if (!enemy.properties().contains(Char.Property.BOSS) && !enemy.properties().contains(Char.Property.MINIBOSS) && !enemy.immunities().contains(Corruption.class)) {
    enemy.HP=enemy.HT;
    for (    Buff buff : enemy.buffs()) {
      buff.detach();
    }
    Buff.affect(enemy,Corruption.class);
    if (enemy.EXP > 0) {
      curUser.sprite.showStatus(CharSprite.POSITIVE,Messages.get(enemy,"String_Node_Str",enemy.EXP));
      curUser.earnExp(enemy.EXP);
      enemy.EXP=0;
    }
  }
 else {
    Buff.affect(enemy,Doom.class);
  }
}

Fixed version (ground truth):
private void corruptEnemy(Mob enemy){
  if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
    GLog.w(Messages.get(this,"String_Node_Str"));
    return;
  }
  if (!enemy.properties().contains(Char.Property.BOSS) && !enemy.properties().contains(Char.Property.MINIBOSS) && !enemy.immunities().contains(Corruption.class)) {
    enemy.HP=enemy.HT;
    for (    Buff buff : enemy.buffs()) {
      buff.detach();
    }
    Buff.affect(enemy,Corruption.class);
    if (enemy.EXP > 0 && curUser.lvl <= enemy.maxLvl) {
      curUser.sprite.showStatus(CharSprite.POSITIVE,Messages.get(enemy,"String_Node_Str",enemy.EXP));
      curUser.earnExp(enemy.EXP);
      enemy.EXP=0;
    }
  }
 else {
    Buff.affect(enemy,Doom.class);
  }
}
Program: 163939
Project: 163939
Buggy source:
public void add(State state){
switch (state) {
case BURNING:
    burning=emitter();
  burning.pour(FlameParticle.FACTORY,0.06f);
if (visible) {
  Sample.INSTANCE.play(Assets.SND_BURNING);
}
break;
case LEVITATING:
levitation=emitter();
levitation.pour(Speck.factory(Speck.JET),0.02f);
break;
case INVISIBLE:
if (parent != null) {
if (invisible != null) invisible.killAndErase();
invisible=new AlphaTweener(this,0.4f,0.4f);
parent.add(invisible);
}
 else alpha(0.4f);
break;
case PARALYSED:
paused=true;
break;
case FROZEN:
iceBlock=IceBlock.freeze(this);
paused=true;
break;
case ILLUMINATED:
GameScene.effect(halo=new TorchHalo(this));
break;
case CHILLED:
chilled=emitter();
chilled.pour(SnowParticle.FACTORY,0.1f);
break;
case DARKENED:
darkBlock=DarkBlock.darken(this);
break;
case MARKED:
marked=emitter();
marked.pour(ShadowParticle.UP,0.1f);
break;
case HEALING:
healing=emitter();
healing.pour(Speck.factory(Speck.HEALING),0.5f);
}
}

Fixed version (ground truth):
public void add(State state){
switch (state) {
case BURNING:
    burning=emitter();
  burning.pour(FlameParticle.FACTORY,0.06f);
if (visible) {
  Sample.INSTANCE.play(Assets.SND_BURNING);
}
break;
case LEVITATING:
levitation=emitter();
levitation.pour(Speck.factory(Speck.JET),0.02f);
break;
case INVISIBLE:
if (invisible != null) {
invisible.killAndErase();
}
invisible=new AlphaTweener(this,0.4f,0.4f);
if (parent != null) {
parent.add(invisible);
}
 else alpha(0.4f);
break;
case PARALYSED:
paused=true;
break;
case FROZEN:
iceBlock=IceBlock.freeze(this);
paused=true;
break;
case ILLUMINATED:
GameScene.effect(halo=new TorchHalo(this));
break;
case CHILLED:
chilled=emitter();
chilled.pour(SnowParticle.FACTORY,0.1f);
break;
case DARKENED:
darkBlock=DarkBlock.darken(this);
break;
case MARKED:
marked=emitter();
marked.pour(ShadowParticle.UP,0.1f);
break;
case HEALING:
healing=emitter();
healing.pour(Speck.factory(Speck.HEALING),0.5f);
}
}
Program: 163940
Project: 163940
Buggy source:
@Override public boolean canConnect(Point p){
  return super.canConnect(p) && p.x > top + 1;
}

Fixed version (ground truth):
@Override public boolean canConnect(Point p){
  return super.canConnect(p) && p.y > top + 1;
}
Program: 163941
Project: 163941
Buggy source:
@Override public void play(Animation anim){
  if (curAnim != die) {
    super.play(anim);
  }
}

Fixed version (ground truth):
@Override public void play(Animation anim){
  if (curAnim == null || curAnim != die) {
    super.play(anim);
  }
}
Program: 163942
Project: 163942
Buggy source:
public Plant couch(int pos){
  try {
    if (Dungeon.visible[pos]) {
      Sample.INSTANCE.play(Assets.SND_PLANT);
    }
    Plant plant=plantClass.newInstance();
    plant.pos=pos;
    return plant;
  }
 catch (  Exception e) {
    ShatteredPixelDungeon.reportException(e);
    return null;
  }
}

Fixed version (ground truth):
public Plant couch(int pos){
  try {
    if (Dungeon.visible != null && Dungeon.visible[pos]) {
      Sample.INSTANCE.play(Assets.SND_PLANT);
    }
    Plant plant=plantClass.newInstance();
    plant.pos=pos;
    return plant;
  }
 catch (  Exception e) {
    ShatteredPixelDungeon.reportException(e);
    return null;
  }
}
Program: 163943
Project: 163943
Buggy source:
public static void refreshHero(){
  if (heroInstance != null) {
    heroInstance.layout();
  }
}

Fixed version (ground truth):
public static void refreshHero(){
  if (heroInstance != null) {
    heroInstance.needsRefresh=true;
  }
}
Program: 163944
Project: 163944
Buggy source:
@Override protected boolean canAttack(Char enemy){
  if (beamCooldown == 0) {
    Ballistica aim=new Ballistica(pos,enemy.pos,Ballistica.STOP_TERRAIN);
    if (enemy.invisible == 0 && Level.fieldOfView[enemy.pos] && aim.subPath(1,aim.dist).contains(enemy.pos)) {
      beam=aim;
      beamTarget=aim.collisionPos;
      return true;
    }
 else     return beamCharged;
  }
 else   return super.canAttack(enemy);
}

Fixed version (ground truth):
@Override protected boolean canAttack(Char enemy){
  if (beamCooldown == 0) {
    Ballistica aim=new Ballistica(pos,enemy.pos,Ballistica.STOP_TERRAIN);
    if (enemy.invisible == 0 && !isCharmedBy(enemy) && Level.fieldOfView[enemy.pos] && aim.subPath(1,aim.dist).contains(enemy.pos)) {
      beam=aim;
      beamTarget=aim.collisionPos;
      return true;
    }
 else     return beamCharged;
  }
 else   return super.canAttack(enemy);
}
Program: 163945
Project: 163945
Buggy source:
@Override public boolean act(boolean enemyInFOV,boolean justAlerted){
  if (beamCharged && enemy != null)   enemyInFOV=true;
  return super.act(enemyInFOV,justAlerted);
}

Fixed version (ground truth):
@Override public boolean act(boolean enemyInFOV,boolean justAlerted){
  if (beamCharged && canAttack(enemy)) {
    enemySeen=enemyInFOV;
    return doAttack(enemy);
  }
  return super.act(enemyInFOV,justAlerted);
}