v3.0.0: fixed rare cases where breaking potions can affect bomb AOE

bombs now pre-process cells instead
This commit is contained in:
Evan Debenham
2024-12-31 12:38:28 -05:00
parent d8cdeff422
commit f2e3706782

View File

@@ -142,7 +142,8 @@ public class Bomb extends Item {
if (explodesDestructively()) {
ArrayList<Char> affected = new ArrayList<>();
ArrayList<Integer> affectedCells = new ArrayList<>();
ArrayList<Char> affectedChars = new ArrayList<>();
if (Dungeon.level.heroFOV[cell]) {
CellEmitter.center(cell).burst(BlastParticle.FACTORY, 30);
@@ -155,6 +156,15 @@ 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) {
affectedCells.add(i);
Char ch = Actor.findChar(i);
if (ch != null) {
affectedChars.add(ch);
}
}
}
for (int i : affectedCells){
if (Dungeon.level.heroFOV[i]) {
CellEmitter.get(i).burst(SmokeParticle.FACTORY, 4);
}
@@ -170,15 +180,9 @@ public class Bomb extends Item {
if (heap != null) {
heap.explode();
}
Char ch = Actor.findChar(i);
if (ch != null) {
affected.add(ch);
}
}
}
for (Char ch : affected){
for (Char ch : affectedChars){
//if they have already been killed by another bomb
if(!ch.isAlive()){