From 463c3a3781b3e7f8743d14f9f139960d1e182754 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 8 Mar 2022 16:03:36 -0500 Subject: [PATCH] v1.2.0: fixed a bug with purity and adjusted some blob logic --- .../shatteredpixeldungeon/actors/blobs/Blob.java | 4 ++++ .../shatteredpixeldungeon/actors/blobs/Web.java | 12 +++++++++++- .../items/potions/PotionOfPurity.java | 11 +---------- .../shatteredpixeldungeon/levels/Level.java | 10 +++------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java index 753aacae8..cffebbd41 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Blob.java @@ -218,6 +218,10 @@ public class Blob extends Actor { cur = new int[Dungeon.level.length()]; off = new int[Dungeon.level.length()]; } + + public void onBuildFlagMaps( Level l ){ + //do nothing by default, only some blobs affect flags + } public String tileDesc() { return null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java index 230862e20..5f30c4eb1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Web.java @@ -90,7 +90,17 @@ public class Web extends Blob { super.fullyClear(); Dungeon.level.buildFlagMaps(); } - + + @Override + public void onBuildFlagMaps(Level l) { + if (volume > 0){ + for (int i=0; i < l.length(); i++) { + l.solid[i] = l.solid[i] || cur[i] > 0; + l.flamable[i] = l.flamable[i] || cur[i] > 0; + } + } + } + @Override public String tileDesc() { return Messages.get(this, "desc"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java index 38e7cd082..24223c9d1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java @@ -67,16 +67,7 @@ public class PotionOfPurity extends Potion { if (PathFinder.distance[i] < Integer.MAX_VALUE) { for (Blob blob : blobs) { - - int value = blob.cur[i]; - if (value > 0) { - - blob.clear(i); - blob.cur[i] = 0; - blob.volume -= value; - - } - + blob.clear(i); } if (Dungeon.level.heroFOV[i]) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 4bf3df330..702e20be4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -657,12 +657,8 @@ public abstract class Level implements Bundlable { pit[i] = (flags & Terrain.PIT) != 0; } - Web w = (Web) blobs.get(Web.class); - if (w != null && w.volume > 0){ - for (int i=0; i < length(); i++) { - solid[i] = solid[i] || w.cur[i] > 0; - flamable[i] = flamable[i] || w.cur[i] > 0; - } + for (Blob b : blobs.values()){ + b.onBuildFlagMaps(this); } int lastRow = length() - width(); @@ -680,7 +676,7 @@ public abstract class Level implements Bundlable { } //an open space is large enough to fit large mobs. A space is open when it is not solid - // and there is and open corner with both adjacent cells opens + // and there is an open corner with both adjacent cells opens for (int i=0; i < length(); i++) { if (solid[i]){ openSpace[i] = false;