Program: 164069
Project: 164069
Buggy source:
private static void veryRareEffect(final Wand wand,final Hero user,final Ballistica bolt){
switch (Random.Int(4)) {
case 0:
    for (int i=0; i < Dungeon.level.length(); i++) {
      int c=Dungeon.level.map[i];
      if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS) {
        GameScene.add(Blob.seed(i,15,Regrowth.class));
      }
    }
  do {
    GameScene.add(Blob.seed(Dungeon.level.randomDestination(),10,Fire.class));
  }
 while (Random.Int(5) != 0);
new Flare(8,32).color(0xFFFF66,true).show(user.sprite,2f);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
GLog.p(Messages.get(CursedWand.class,"String_Node_Str"));
GLog.w(Messages.get(CursedWand.class,"String_Node_Str"));
wand.wandUsed();
break;
case 1:
cursedFX(user,bolt,new Callback(){
public void call(){
Mimic mimic=Mimic.spawnAt(bolt.collisionPos,new ArrayList<Item>());
mimic.adjustStats(Dungeon.depth + 10);
mimic.HP=mimic.HT;
Item reward;
do {
reward=Generator.random(Random.oneOf(Generator.Category.WEAPON,Generator.Category.ARMOR,Generator.Category.RING,Generator.Category.WAND));
}
 while (reward.level() < 2 && !(reward instanceof MissileWeapon));
Sample.INSTANCE.play(Assets.SND_MIMIC,1,1,0.5f);
mimic.items.clear();
mimic.items.add(reward);
wand.wandUsed();
}
}
);
break;
case 2:
try {
Dungeon.saveAll();
if (!Messages.get(CursedWand.class,"String_Node_Str").equals("String_Node_Str")) {
GLog.i(Messages.get(CursedWand.class,"String_Node_Str"));
wand.wandUsed();
}
 else {
GameScene.show(new WndOptions("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"){
@Override public void hide(){
throw new RuntimeException("String_Node_Str");
}
}
);
}
}
 catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
GLog.i(Messages.get(CursedWand.class,"String_Node_Str"));
wand.wandUsed();
}
break;
case 3:
wand.wandUsed();
wand.detach(user.belongings.backpack);
Item result;
do {
result=Generator.random(Random.oneOf(Generator.Category.WEAPON,Generator.Category.ARMOR,Generator.Category.RING,Generator.Category.ARTIFACT));
}
 while (result.level() < 0 && !(result instanceof MissileWeapon));
if (result.isUpgradable()) result.upgrade();
result.cursed=result.cursedKnown=true;
GLog.w(Messages.get(CursedWand.class,"String_Node_Str"));
Dungeon.level.drop(result,user.pos).sprite.drop();
wand.wandUsed();
break;
}
}

Fixed version (ground truth):
private static void veryRareEffect(final Wand wand,final Hero user,final Ballistica bolt){
switch (Random.Int(4)) {
case 0:
    for (int i=0; i < Dungeon.level.length(); i++) {
      int c=Dungeon.level.map[i];
      if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS) {
        GameScene.add(Blob.seed(i,15,Regrowth.class));
      }
    }
  do {
    GameScene.add(Blob.seed(Dungeon.level.randomDestination(),10,Fire.class));
  }
 while (Random.Int(5) != 0);
new Flare(8,32).color(0xFFFF66,true).show(user.sprite,2f);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
GLog.p(Messages.get(CursedWand.class,"String_Node_Str"));
GLog.w(Messages.get(CursedWand.class,"String_Node_Str"));
wand.wandUsed();
break;
case 1:
cursedFX(user,bolt,new Callback(){
public void call(){
Mimic mimic=Mimic.spawnAt(bolt.collisionPos,new ArrayList<Item>());
mimic.adjustStats(Dungeon.depth + 10);
mimic.HP=mimic.HT;
Item reward;
do {
reward=Generator.random(Random.oneOf(Generator.Category.WEAPON,Generator.Category.ARMOR,Generator.Category.RING,Generator.Category.WAND));
}
 while (reward.level() < 2 && !(reward instanceof MissileWeapon));
Sample.INSTANCE.play(Assets.SND_MIMIC,1,1,0.5f);
mimic.items.clear();
mimic.items.add(reward);
wand.wandUsed();
}
}
);
break;
case 2:
try {
Dungeon.saveAll();
if (Messages.lang() != Languages.ENGLISH) {
GLog.i(Messages.get(CursedWand.class,"String_Node_Str"));
wand.wandUsed();
}
 else {
GameScene.show(new WndOptions("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"){
@Override public void hide(){
throw new RuntimeException("String_Node_Str");
}
}
);
}
}
 catch (IOException e) {
ShatteredPixelDungeon.reportException(e);
GLog.i(Messages.get(CursedWand.class,"String_Node_Str"));
wand.wandUsed();
}
break;
case 3:
wand.wandUsed();
wand.detach(user.belongings.backpack);
Item result;
do {
result=Generator.random(Random.oneOf(Generator.Category.WEAPON,Generator.Category.ARMOR,Generator.Category.RING,Generator.Category.ARTIFACT));
}
 while (result.level() < 0 && !(result instanceof MissileWeapon));
if (result.isUpgradable()) result.upgrade();
result.cursed=result.cursedKnown=true;
GLog.w(Messages.get(CursedWand.class,"String_Node_Str"));
Dungeon.level.drop(result,user.pos).sprite.drop();
wand.wandUsed();
break;
}
}