Program: 163891
Project: 163891
Buggy source:
@Override protected void onZap(Ballistica bolt){
  Char ch=Actor.findChar(bolt.collisionPos);
  if (ch != null) {
    if (!(ch instanceof Mob) || ch instanceof NPC) {
      return;
    }
    Mob enemy=(Mob)ch;
    float corruptingPower=2 + level();
    float enemyResist=1 + enemy.EXP;
    if (ch instanceof Mimic || ch instanceof Statue) {
      enemyResist=1 + Dungeon.depth;
    }
 else     if (ch instanceof Piranha || ch instanceof Bee) {
      enemyResist=1 + Dungeon.depth / 2f;
    }
 else     if (ch instanceof Wraith) {
      enemyResist=0.5f + Dungeon.depth / 8f;
    }
 else     if (ch instanceof Yog.BurningFist || ch instanceof Yog.RottingFist) {
      enemyResist=1 + 30;
    }
 else     if (ch instanceof Yog.Larva || ch instanceof King.Undead) {
      enemyResist=1 + 5;
    }
 else     if (ch instanceof Swarm) {
      enemyResist=1 + 3;
    }
    enemyResist*=1 + 2 * Math.pow(enemy.HP / (float)enemy.HT,2);
    for (    Buff buff : enemy.buffs()) {
      if (MAJOR_DEBUFFS.containsKey(buff.getClass()))       enemyResist*=MAJOR_DEBUFF_WEAKEN;
 else       if (MINOR_DEBUFFS.containsKey(buff.getClass()))       enemyResist*=MINOR_DEBUFF_WEAKEN;
 else       if (buff.type == Buff.buffType.NEGATIVE)       enemyResist*=MINOR_DEBUFF_WEAKEN;
    }
    if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
      enemyResist=corruptingPower * .99f;
    }
    if (corruptingPower > enemyResist) {
      corruptEnemy(enemy);
    }
 else {
      float debuffChance=corruptingPower / enemyResist;
      if (Random.Float() < debuffChance) {
        debuffEnemy(enemy,MAJOR_DEBUFFS);
      }
 else {
        debuffEnemy(enemy,MINOR_DEBUFFS);
      }
    }
    processSoulMark(ch,chargesPerCast());
  }
 else {
    Dungeon.level.press(bolt.collisionPos,null,true);
  }
}

Fixed version (ground truth):
@Override protected void onZap(Ballistica bolt){
  Char ch=Actor.findChar(bolt.collisionPos);
  if (ch != null) {
    if (!(ch instanceof Mob)) {
      return;
    }
    Mob enemy=(Mob)ch;
    float corruptingPower=2 + level();
    float enemyResist=1 + enemy.EXP;
    if (ch instanceof Mimic || ch instanceof Statue) {
      enemyResist=1 + Dungeon.depth;
    }
 else     if (ch instanceof Piranha || ch instanceof Bee) {
      enemyResist=1 + Dungeon.depth / 2f;
    }
 else     if (ch instanceof Wraith) {
      enemyResist=0.5f + Dungeon.depth / 8f;
    }
 else     if (ch instanceof Yog.BurningFist || ch instanceof Yog.RottingFist) {
      enemyResist=1 + 30;
    }
 else     if (ch instanceof Yog.Larva || ch instanceof King.Undead) {
      enemyResist=1 + 5;
    }
 else     if (ch instanceof Swarm) {
      enemyResist=1 + 3;
    }
    enemyResist*=1 + 2 * Math.pow(enemy.HP / (float)enemy.HT,2);
    for (    Buff buff : enemy.buffs()) {
      if (MAJOR_DEBUFFS.containsKey(buff.getClass()))       enemyResist*=MAJOR_DEBUFF_WEAKEN;
 else       if (MINOR_DEBUFFS.containsKey(buff.getClass()))       enemyResist*=MINOR_DEBUFF_WEAKEN;
 else       if (buff.type == Buff.buffType.NEGATIVE)       enemyResist*=MINOR_DEBUFF_WEAKEN;
    }
    if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
      enemyResist=corruptingPower * .99f;
    }
    if (corruptingPower > enemyResist) {
      corruptEnemy(enemy);
    }
 else {
      float debuffChance=corruptingPower / enemyResist;
      if (Random.Float() < debuffChance) {
        debuffEnemy(enemy,MAJOR_DEBUFFS);
      }
 else {
        debuffEnemy(enemy,MINOR_DEBUFFS);
      }
    }
    processSoulMark(ch,chargesPerCast());
  }
 else {
    Dungeon.level.press(bolt.collisionPos,null,true);
  }
}