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 b53d37ff7..137df39cd 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 @@ -53,6 +53,7 @@ public class Web extends Blob { l.solid[cell] = off[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.SOLID) != 0; l.flamable[cell] = off[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.FLAMABLE) != 0; + l.updateOpenSpace(cell); } } } @@ -62,6 +63,7 @@ public class Web extends Blob { super.seed(level, cell, amount); level.solid[cell] = cur[cell] > 0 || (Terrain.flags[level.map[cell]] & Terrain.SOLID) != 0; level.flamable[cell] = cur[cell] > 0 || (Terrain.flags[level.map[cell]] & Terrain.FLAMABLE) != 0; + level.updateOpenSpace(cell); } //affects characters as they step on it. See Level.OccupyCell and Level.PressCell @@ -83,6 +85,7 @@ public class Web extends Blob { Level l = Dungeon.level; l.solid[cell] = cur[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.SOLID) != 0; l.flamable[cell] = cur[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.FLAMABLE) != 0; + l.updateOpenSpace(cell); } @Override @@ -97,6 +100,7 @@ public class Web extends Blob { 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; + //openSpace will be updated as part of building flap maps } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/WallOfLight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/WallOfLight.java index 4bace8cda..210a25670 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/WallOfLight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/WallOfLight.java @@ -259,6 +259,7 @@ public class WallOfLight extends TargetedClericSpell { l.solid[cell] = off[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.SOLID) != 0; l.passable[cell] = off[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.PASSABLE) != 0; l.avoid[cell] = off[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.AVOID) != 0; + l.updateOpenSpace(cell); } } } @@ -269,6 +270,7 @@ public class WallOfLight extends TargetedClericSpell { level.solid[cell] = cur[cell] > 0 || (Terrain.flags[level.map[cell]] & Terrain.SOLID) != 0; level.passable[cell] = cur[cell] == 0 && (Terrain.flags[level.map[cell]] & Terrain.PASSABLE) != 0; level.avoid[cell] = cur[cell] == 0 && (Terrain.flags[level.map[cell]] & Terrain.AVOID) != 0; + level.updateOpenSpace(cell); } @Override @@ -279,6 +281,7 @@ public class WallOfLight extends TargetedClericSpell { l.solid[cell] = cur[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.SOLID) != 0; l.passable[cell] = cur[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.PASSABLE) != 0; l.avoid[cell] = cur[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.AVOID) != 0; + l.updateOpenSpace(cell); } @Override @@ -294,6 +297,7 @@ public class WallOfLight extends TargetedClericSpell { l.solid[i] = l.solid[i] || cur[i] > 0; l.passable[i] = l.passable[i] && cur[i] == 0; l.avoid[i] = l.avoid[i] && cur[i] == 0; + //openSpace will be updated as part of building flap maps } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SkeletonKey.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SkeletonKey.java index 9f95a86e0..8b786fd20 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SkeletonKey.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SkeletonKey.java @@ -500,6 +500,7 @@ public class SkeletonKey extends Artifact { l.solid[cell] = off[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.SOLID) != 0; l.passable[cell] = off[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.PASSABLE) != 0; l.avoid[cell] = off[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.AVOID) != 0; + l.updateOpenSpace(cell); } } @@ -515,6 +516,7 @@ public class SkeletonKey extends Artifact { level.solid[cell] = cur[cell] > 0 || (Terrain.flags[level.map[cell]] & Terrain.SOLID) != 0; level.passable[cell] = cur[cell] == 0 && (Terrain.flags[level.map[cell]] & Terrain.PASSABLE) != 0; level.avoid[cell] = cur[cell] == 0 && (Terrain.flags[level.map[cell]] & Terrain.AVOID) != 0; + level.updateOpenSpace(cell); } @Override @@ -526,6 +528,7 @@ public class SkeletonKey extends Artifact { l.solid[cell] = cur[cell] > 0 || (Terrain.flags[l.map[cell]] & Terrain.SOLID) != 0; l.passable[cell] = cur[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.PASSABLE) != 0; l.avoid[cell] = cur[cell] == 0 && (Terrain.flags[l.map[cell]] & Terrain.AVOID) != 0; + l.updateOpenSpace(cell); } @Override @@ -542,6 +545,7 @@ public class SkeletonKey extends Artifact { l.solid[i] = l.solid[i] || cur[i] > 0; l.passable[i] = l.passable[i] && cur[i] == 0; l.avoid[i] = l.avoid[i] && cur[i] == 0; + //openSpace will be updated as part of building flap maps } } } 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 34e0a8e9e..dee431226 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -878,6 +878,25 @@ public abstract class Level implements Bundlable { } + //updates open space both on the cell itself and adjacent cells + public void updateOpenSpace(int cell){ + for (int i : PathFinder.NEIGHBOURS9) { + if (solid[cell+i]){ + openSpace[cell+i] = false; + } else { + for (int j = 1; j < PathFinder.CIRCLE8.length; j += 2){ + if (solid[cell+i+PathFinder.CIRCLE8[j]]) { + openSpace[cell+i] = false; + } else if (!solid[cell+i+PathFinder.CIRCLE8[(j+1)%8]] + && !solid[cell+i+PathFinder.CIRCLE8[(j+2)%8]]){ + openSpace[cell+i] = true; + break; + } + } + } + } + } + public void destroy( int pos ) { //if raw tile type is flammable or empty int terr = map[pos];