diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java index 2eb602800..85721f317 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/Bomb.java @@ -141,8 +141,9 @@ public class Bomb extends Item { Sample.INSTANCE.play( Assets.Sounds.BLAST ); if (explodesDestructively()) { - - ArrayList affected = new ArrayList<>(); + + ArrayList affectedCells = new ArrayList<>(); + ArrayList affectedChars = new ArrayList<>(); if (Dungeon.level.heroFOV[cell]) { CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30); @@ -155,30 +156,33 @@ public class Bomb extends Item { PathFinder.buildDistanceMap( cell, explodable, explosionRange() ); for (int i = 0; i < PathFinder.distance.length; i++) { if (PathFinder.distance[i] != Integer.MAX_VALUE) { - if (Dungeon.level.heroFOV[i]) { - CellEmitter.get(i).burst(SmokeParticle.FACTORY, 4); - } - - if (Dungeon.level.flamable[i]) { - Dungeon.level.destroy(i); - GameScene.updateMap(i); - terrainAffected = true; - } - - //destroys items / triggers bombs caught in the blast. - Heap heap = Dungeon.level.heaps.get(i); - if (heap != null) { - heap.explode(); - } - + affectedCells.add(i); Char ch = Actor.findChar(i); if (ch != null) { - affected.add(ch); + affectedChars.add(ch); } } } + + for (int i : affectedCells){ + if (Dungeon.level.heroFOV[i]) { + CellEmitter.get(i).burst(SmokeParticle.FACTORY, 4); + } + + if (Dungeon.level.flamable[i]) { + Dungeon.level.destroy(i); + GameScene.updateMap(i); + terrainAffected = true; + } + + //destroys items / triggers bombs caught in the blast. + Heap heap = Dungeon.level.heaps.get(i); + if (heap != null) { + heap.explode(); + } + } - for (Char ch : affected){ + for (Char ch : affectedChars){ //if they have already been killed by another bomb if(!ch.isAlive()){